Clarion APP файл (старый)

APP- fixed header
— procedure bodies
— file descriptions
— procedure directory
Fixed header format:
000 W 5008
002 B flags? (87,07 seen)
003 L offset of first file definition
007 W 1 0
1 3
^ ^- procedure count
+- file count (1-memory only)
00B S[13] Base procedure name (blank fill)
018 S[79] help file name
067 S[79] model file name
0B6 S[31] (blanks) — reserved for application description?
0D5 end of the header
File definition format:
— fixed header
— fields in file
— keys in file
File definition header:
B 0, S[13] filename (e.g. «MEMORY», zero fill)
S[2] drive (with terminating zero)
S[60] pathname (blank fill, last zero)
S[4] prefix (last zero)
S[256] (zeros or blanks, last zero)
B ?(0,5 seen)
W (how many fields)
W (how many keys? 3 when 1 key… 3 records used to describe it?)
Field definition format:
W 1 (field type? 1-string, 2-dec, 3-byte, 4-short, 5-long)
B[13] field name(zero or blank fill)
W field size,0,0,0,0,decimals
C[16] (zeros or blanks), B 0
B[8] low value (R*8),B[8] high value (R*8) (even decimals!)
B flags? (0,02h,28h,08h,…)
B len(description),len(picture),0?,len(init value)
B[*] description,B[*] picture,B[0?],B[*] init value
Key description record:
S[13] name
B ?,? — what these 2 bytes mean?
Immediately following last file definition:
S[13] «procname»(terminated by zero, blank fill, last zero)
S[31] description (last char zero),
B type (1=menu,2=table,3=form,4=report?,5=other)
L pointer — where info about the procedure is
W length — the definition size,
B 1(modified, Other is always modified) or 0(old).
R*8 format: normalized, highest bit is sign, next 11 are used by
exponent, remaining 52 are mantissa w/o highest bit;
note negating a number changes its highest bit only!
E_BAZE_PROC  000D5..00139 (l=065)
E_MENU       0013A..00604 (l=4CB)
(R=06h,C=22h,R=0Ah,C=30h,
white on black)
E_TABLE      00605..00B50 (l=54C)
(R=03h,C=34h,R=17h,C=41h,
white on blue)
E_FORM       00B51..0175F (l=C0F)
(R=08h,C=13h,R=12h,C=3Eh,
white on blue)
E_BAZE_PROC_ 01760..017C4 (l=065)
E_MENU_      017C5..01C8F (l=4CB)
E_TABLE_     01C90..021DB (l=54C)
E_FORM_      021DC..02DEA (l=C0F)
F_MENU       02DEB..036B3 (l=8C9)
F_TABLE      036B4..04F15 (l=1862)
Procedure:
— type = Other
«filename»(8 char, blank fill, and terminating zero),
«No » (Binary), «No » (Return Value),
C[6] Data Type name: »      «,»Long
«,»Real  «,»String»,
6*S[13] procedure names (called in the file).
— common header for Menu, Table and Form:
+000       B row0+fix_flag(80h if fixed),col0,row1,col1
+004       B color1,color2 (?)
+006       W field#, paint#
+00A       S[11] help id in »
+015       S[13] model procedure name
+022       S[256] setup procedure
+122       S[13] combine with name
+12F       S[13]*6 hot key definitions 3*(key,proc)
+17D       end of header, remaining data depends
on type:
— type = Menu, header followed by:
screen field definitions and screen definition
— type = Table, header followed by:
S[17] access key, S[256] update proc,
S[256] filter expression, S[17] selector,
screen field definitions and screen definition
— type = Form, header followed by:
S[17] filename
S[256] next proc
3*S[9] related files
screen field definitions and screen definition
— type = Report, (header? followed by?):
Screen field definitions:
B type, row, col (coordinates on entire screen, not in window),
B len, color1, color2 [select1, select2]
type 01=entry: 8-byte field header (sometimes the byte before

last is 0) followed by

S[256] edit proc, S[17] variable name,

S[13] table hot key, e.g. AUTOMATIC,ENTER_KEY,
S[13] table procedure, S[17] file access
key,
S[17] access key field, B[17] (zeros)
type 03=locator: 6-byte header followed by S[17] name, B[17] 0
type 04=display field: 6-byte header (last byte 4) followed by

S[17] variable name, B[17] 0
type 05=computed field: 6-byte header, S[17] name (SCR:x),

S[256] picture, S[256] expression,

S[17] result field
type 06=scrolling display: 6-byte header, S[17] name, 17*0
type 07=scrolling computed: 6-byte header, S[17] name,

S[256] picture, expression,

S[17] result
type 08=scrolling lookup: 6-byte header, S[17]: field to display,

related field, file access key,

new field name, access key field
type 09=pause: 8-byte field header, S[13] edit proc
type 0A=menu item: 8-byte field header followed by S[13] procname
type 0F=conditional field: 6-byte header, S[17] name (SCR:x),

S[256] picture, S[17] result,

B l1,l2,l3, S[l1] expr,

S[l2] ‘true’,S[l3] ‘false’
type 10=total: 6-byte header, S[17] name (SCR:x), S[256] picture,

S[256] type («Count  «,»Sum    «,»Average»)

S[17] field to total
type 11=scrolling conditional: 6-byte header,

S[17] name (SCR:x),

S[256] picture, S[17] result

B l1,l2,l3,S[l1],S[l2],S[L3]
type 12=lookup field: 6-byte header, S[17]: field to display,

related field, file access key,

new field name, access key field
type 13=choice field: 8-byte field header, B choice index

S[17] variable name
Color specification:
07 00 — normal
FE 00 — normal
07 02 — reversed
FE 02 — reversed
07 04 — enhanced
FE 05 — blink yellow on white
FE 08 — blink
1E 03 — yellow on blue
5A 0B — light green on magenta
29 03 — light blue on green
39 09 — light blue on cyan
1B 03 — light cyan on blue
2F 09 — bright white on green
78 03 — gray on white
3E 09 — yellow on cyan
0E 09 — yellow on black
1E 09 — yeallow on blue
34 09 — red on cyan
34 00 — normal
(second byte bit flags: 1=first byte is color; 2=reverse;
4=enhanced; 8=blink; 20h=transparent; seems other not used)
Scrolling fields:
— (lookup: f. to displ, new f. name, file acc key, acc k. f. related f.)
— conditional: (7,30,30) name SCR:MSG, pic S30, cond MEM:MESSAGE=»,

T:’* no message *’, F:MEM:MESSAGE, result SCR:S7.
Lookup field: Field to display T1:S, new f. name SCR:S, file

access key T1:KL, access key field T1:L, related
f.
MEM:B, attribute normal; T1:D,SCR:D,T1:KL,T1:L,

MEM:L, reversed.
Display field: MEM:MESSAGE, normal/enhanced/blink yellow on white
Computed field: name SCR:CFx, picture S3, expression mem:message,

result MEM:L, attribute reversed/blink
Conditional field: name SCR:VF, pic S30, cond MEM:L=0, result MEM:B
Entry field (F_TABLE): (5,18,30) name MEM:S_255, edit F_T_ENT_E, attr

normal, select yellow on blue, file lookup yes,

file access key T1:KL, access key field T1:L,

table procedure F_LOOK_TABLE, hot key AUTO;

(5,49,3) MEM:B, F_T_ent_e, light green on

magenta, light blue on green, file lookup yes,

T1:KL, T1:L, F_LOOK_TABLE, ENTER_KEY;

(5,53,1) MEM:D, f_t_ent_e, light blue on cyan,

light cyan on blue, file lookup yes w/o table;

(5,55,1) T1:B, f_t_ent_e, bright white on

green, gray on white, no file lookup.
Locator field (F_TABLE): (5,57,3) name T1:L, yellow on cyan.
Display field (F_TABLE): (6,18,6) name MEM:W, attr yellow on black.
Computed field (F_TABLE): (6,25,6) name SCR:CF1, pic S6, expr MEM:W+1,

result MEM:W, attr yellow on blue.
Conditional field (F_TABLE): (6,32,5), name SCR:VF, pic S5, condition

MEM:MESSAGE=», T:’empty’, F:’*full’

result field (none), attrib red on cyan.
Total field (F_TABLE): (6,38,5), type Count, field to total T1:S,

new f. name SCR:TF, pic N_5, attr normal;

(6,44,8), Sum, T1:L, SCR:TFS, N_8, normal;

(6,54,12), Average, T1:L, SRC:TFA, N_12.3;
Scrolling fields:
— display: (7,18,3) name T1:L
— (lookup: f. to displ, new f. name, file acc key, acc k. f. related f.)
— computed: (7,22,7) name SCR:S7, pic S7, expr S_255, res SCR:CF1
— conditional: (7,30,30) name SCR:MSG, pic S30, cond MEM:MESSAGE=»,

T:’* no message *’, F:MEM:MESSAGE, result SCR:S7.
Painting: (4,18..63,white on black), (23,16..65,gray on green).
Screen definition:
Paintings,each: B row_min,row_max,col_min,col_max,color,01

(last byte 21h — transparent area)
B 01, screen image (repeated data compressed by using
prefix FF before repeated char and count after it),
B 01, screen colors (again data compressed same way),
B 01, (compressed data of screen size, were all 0-s, seems
only in case track has same color as screen,
otherwise
the data is 3 on track, 0 elsewhere)
Report procedures:
RPT_L: 1781 l=04BD
TR1,M: 253B l=04C6
TR2,F: 2A01 l=04C8
2EC9 l=0372
+000,+2 B ? (was 1 or 51h)
+001    B page length
+003    B 50h (width)
+004    B 0,0
+006    W fields on screen
+008    W (1+lines on report design screen)
+00A    S[11] always was 0 (help id)
+015    S[13] model proc
+022    S[256] setup
+122    S[13] combine with
+12F    W report line of cursor (top=2)
+131    B screem line of cursor (top=1)
+132    S[17] record selector
+143    S[6]? report device «Yes»/»No» (zero
fill)
+149    S[17] access key
+15A    S[256] record filter
+25A    end of header
report fields:
6-byte field header, first byte is type;
type 0B=field, header followed by S[17] name, B[17] 0
report lines (first is empty, not shown on screen):
W length of record (not counting the length word),
W type (some standard lines have assigned types: 1=title,
2=pg hdr, 3=body, 4=totals, 5=pg end, 6=gr hdr, 7=gr end)
C[length-2] data to the line (string terminated by zero,
can be two strings, first left justified, second centered,
or fields encoding may follow: B 80h, flags, and repeated
{ col, lng, W field_index (1..max)} for each field in line).