~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to utils/data2inc.exm

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Please compile this file with data2inc (e.g. data2inc data2inc.exm demo.inc)
2
 
#
3
 
# This demo file should show all possibilities of the data2inc program.
4
 
# (comment chars are %;#, empty lines are ignored)
5
 
 
6
 
# First, the standard purpose of data2inc.
7
 
 
8
 
# FPC (before 0.99.12) allowed only textual constants of up to 255 bytes.
9
 
# The main use of data2inc is to circumvent this by defining a constant of
10
 
# type ARRAY OF BYTE in an include file.
11
 
#
12
 
# Some of my utils have a small screen of text to show when wrong or no
13
 
# commandline parameters are passed. The below example is for ../demo/crtolf.pp
14
 
# I use an extremely small procedure in EFIO (EFIO.WrArrChar) to display such
15
 
# constants.
16
 
 
17
 
#
18
 
# CrToLf Usage text.
19
 
#
20
 
# First, a '!' to indictate a new record (constant in the include file). This
21
 
# also defines the type of the constant. The record ends at the next line
22
 
# starting with '!' or at the end of the file.
23
 
#
24
 
#  !name  is an array of char type constant
25
 
#  !$name is an array of byte type constant.
26
 
 
27
 
# This is an array of char, named UsageCrtolf
28
 
 
29
 
!UsageCrtolf
30
 
 
31
 
# Now the contents of the type. Empty lines are deleted, so we have to put
32
 
# some constant to indicate an empty line. To ease this, \xxx octal character
33
 
# codes are allowed. (The \015's below translate to CHR(13) which is CR).
34
 
# In data2inc, all characters (and I mean all, even #0 #13 etc) are allowed
35
 
# as long as unprintable characters are noted as with octal code.
36
 
# Beware that a single \ has to be escaped as \\ !!!!!!!!
37
 
 
38
 
Usage:   CrToLf <FileName1> [FileName2] [Switches]\015
39
 
 Default all separators are translated to CrLf, spaces are tabbed\015
40
 
 with a default tablength of 8\015
41
 
  Switches:\015
42
 
  /C        : Lineseparator always Cr\015
43
 
  /L        : Lineseparator always Lf\015
44
 
  /B        : Lineseparator always CrLf(default)\015
45
 
  /T        : Convert spaces to hardtabs, default the otherway around\015
46
 
  /S:<Nr>   : Use tabsize <Nr> (default:8)\015
47
 
\015
48
 
  /W[:size] : word wrap the file to a width of 80 (default) or <size>\015
49
 
              characters if /W is used, tabbing is off\015
50
 
\015
51
 
  /P        : (only together with /W) Strip multiple points too (.... becomes .)\015
52
 
  /R        : (Ignored with /W): Never write more than one linefeed.\015
53
 
  /D        : ROT 13 file (not together with /w)\015
54
 
  /M        : Clean up MAN pages linux\015\015
55
 
 
56
 
# Now we define a new constant, the same principle as above, but we let it
57
 
# translate to an ARRAY OF BYTE typed constant.
58
 
 
59
 
#
60
 
# indexer usage text, translate to array of byte. (The dollarsign after the
61
 
#  exclamation mark).
62
 
#
63
 
 
64
 
!$usageindexer
65
 
Usage: Indexer <directory>\015
66
 
Creates indexes and Files.bbs from descript.ion, recursing directories.\015
67
 
Usage : Indexer <Starting-Directory>\015
68
 
   E.g. Indexer c:..\\source\015\015
69
 
 
70
 
 
71
 
#
72
 
# Now we are moving up to the more advanced possibilities. Everywhere in
73
 
# a record you can add data by placing keyword DATA on a new line, and
74
 
# put your data after it, which works pretty much like the BASIC data command
75
 
#
76
 
# After the DATA keyword, you should put a space, and then several fields
77
 
# with either (integer)nummerical or textual constants.
78
 
#
79
 
# Textual constants are similar to TP textual constants except that you can also
80
 
# use double quotes instead of single, and you can use single quotes inside
81
 
# double quotes. Also #xxx character codes are allowed, and '+' characters
82
 
# which indicate concatenation of strings under BP.
83
 
#
84
 
# Nummerical integer constants come in quite much flavours.
85
 
# $123 , 0x123 , 123h and 123H are equivalent to hexadecimal 123 (= 291 decimal)
86
 
# \666 , 666o and 666O         are equivalent to octal 666       (=438 decimal)
87
 
# 123  , 123d and 123D         is plain decimal 123
88
 
# %010 , 010b and 010B         are equivalent to binary 010      (= 4 decimal)
89
 
#
90
 
#
91
 
# The only problem with integer constants is that 123 is NOT equal to 0123 or
92
 
#  000123
93
 
# 123    will occupy 1 byte
94
 
# 0123   will occupy 2 bytes.
95
 
# 000123 will occupy 4 bytes
96
 
#
97
 
# Same for hexadecimal constants (and the others)
98
 
#
99
 
# FFh     will occupy 1 byte
100
 
# 0FFh    will occupy 2 bytes.
101
 
# 000FFh  will occupy 4 bytes
102
 
#
103
 
 
104
 
# First define a new record, ARRAY OF BYTE style
105
 
# If you want to verify DATA, try removing the '$' in the line below and
106
 
# view the ARRAY OF CHAR data.
107
 
 
108
 
!$weirddata
109
 
 
110
 
This line is just text
111
 
 
112
 
# now a data statement
113
 
#       textual                       , rest nummerical
114
 
 
115
 
DATA 'Hello :'#12+"another 'hello'"#39,123,$123,0x456,789d,776o
116
 
 
117
 
Again normal text.
118
 
 
119
 
DATA \666,12d,13h,%10101010
120
 
 
121
 
# Be carefull with statements as below. Data2inc syntax isn't entirely basic.
122
 
# If you do define lines like the one below, you can't tell one,two,three apart.
123
 
 
124
 
DATA 'one','two','three'
125
 
 
126
 
# A solution would be:
127
 
 
128
 
DATA 'one'#0,'two'#0,'three'#0,0
129
 
 
130
 
#
131
 
# A demonstration line for the difference between $FF, $0FF and $000FF
132
 
#
133
 
 
134
 
DATA $FF,$00FF,$000FF
135
 
 
136
 
#
137
 
# Everything between the !$weirddata line and this line will be added to
138
 
# the constant weirddata. The empty and comment lines are of course not added.
139
 
 
140