1
# Please compile this file with data2inc (e.g. data2inc data2inc.exm demo.inc)
3
# This demo file should show all possibilities of the data2inc program.
4
# (comment chars are %;#, empty lines are ignored)
6
# First, the standard purpose of data2inc.
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.
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
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.
24
# !name is an array of char type constant
25
# !$name is an array of byte type constant.
27
# This is an array of char, named UsageCrtolf
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 \\ !!!!!!!!
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
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
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
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
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.
60
# indexer usage text, translate to array of byte. (The dollarsign after the
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
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
76
# After the DATA keyword, you should put a space, and then several fields
77
# with either (integer)nummerical or textual constants.
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.
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)
91
# The only problem with integer constants is that 123 is NOT equal to 0123 or
93
# 123 will occupy 1 byte
94
# 0123 will occupy 2 bytes.
95
# 000123 will occupy 4 bytes
97
# Same for hexadecimal constants (and the others)
99
# FFh will occupy 1 byte
100
# 0FFh will occupy 2 bytes.
101
# 000FFh will occupy 4 bytes
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.
110
This line is just text
112
# now a data statement
113
# textual , rest nummerical
115
DATA 'Hello :'#12+"another 'hello'"#39,123,$123,0x456,789d,776o
119
DATA \666,12d,13h,%10101010
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.
124
DATA 'one','two','three'
126
# A solution would be:
128
DATA 'one'#0,'two'#0,'three'#0,0
131
# A demonstration line for the difference between $FF, $0FF and $000FF
134
DATA $FF,$00FF,$000FF
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.