1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
|
{
This file is part of the Free Pascal run time library.
A file in Amiga system run time library.
Copyright (c) 1998-2002 by Nils Sjöholm.
member of the Amiga RTL development team.
This is a unit for xadmaster.library
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{
First version of this unit.
12 Feb 2003.
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
}
{$mode objfpc}
{$I useamigasmartlink.inc}
{$ifdef use_amiga_smartlink}
{$smartlink on}
{$endif use_amiga_smartlink}
UNIT XADMASTER;
INTERFACE
USES Exec,utility,amigados;
const
XADMASTERNAME : PChar = 'xadmaster.library';
{
$VER: xadmaster.h 12.0 (24.06.2002)
xadmaster.library defines and structures
Copyright © 1998-2002 by Dirk Stöcker
All Rights Reserved.
}
const
XADNAME = 'xadmaster.library';
{ NOTE: Nearly all structures need to be allocated using the
xadAllocObject function. }
{
library base structure
}
type
PxadMasterBase = ^txadMasterBase;
txadMasterBase = record
xmb_LibNode : tLibrary;
xmb_SysBase : PExecBase;
xmb_DOSBase : PDosLibrary;
xmb_UtilityBase : PUtilityBase;
xmb_RecogSize : ULONG; { read only }
xmb_DefaultName : STRPTR; { name for XADFIF_NOFILENAME (V6) }
end;
{
tag-function call flags
}
{ input tags for xadGetInfo, only one can be specified per call }
const
{ input data size }
XAD_INSIZE = TAG_USER + 1;
XAD_INFILENAME = TAG_USER + 2;
XAD_INFILEHANDLE = TAG_USER + 3;
XAD_INMEMORY = TAG_USER + 4;
XAD_INHOOK = TAG_USER + 5;
{ (V2) }
XAD_INSPLITTED = TAG_USER + 6;
{ (V4) }
XAD_INDISKARCHIVE = TAG_USER + 7;
{ (V8) }
XAD_INXADSTREAM = TAG_USER + 8;
{ (V11) }
XAD_INDEVICE = TAG_USER + 9;
{ output tags, only one can be specified per call, xadXXXXUnArc }
{ output data size }
XAD_OUTSIZE = TAG_USER + 10;
XAD_OUTFILENAME = TAG_USER + 11;
XAD_OUTFILEHANDLE = TAG_USER + 12;
XAD_OUTMEMORY = TAG_USER + 13;
XAD_OUTHOOK = TAG_USER + 14;
XAD_OUTDEVICE = TAG_USER + 15;
{ (V8) }
XAD_OUTXADSTREAM = TAG_USER + 16;
{ object allocation tags for xadAllocObjectA }
{ XADOBJ_FILEINFO, size of needed name space }
XAD_OBJNAMESIZE = TAG_USER + 20;
{ XADOBJ_FILEINFO, size of needed comment space }
XAD_OBJCOMMENTSIZE = TAG_USER + 21;
{ XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size }
XAD_OBJPRIVINFOSIZE = TAG_USER + 22;
{ XADOBJ_DISKINFO, number of needed entries }
XAD_OBJBLOCKENTRIES = TAG_USER + 23;
{ tags for xadGetInfo, xadFileUnArc and xadDiskUnArc }
{ do not use extern clients }
XAD_NOEXTERN = TAG_USER + 50;
{ password when needed }
XAD_PASSWORD = TAG_USER + 51;
{ number of wanted entry }
XAD_ENTRYNUMBER = TAG_USER + 52;
{ the progress hook }
XAD_PROGRESSHOOK = TAG_USER + 53;
{ overwrite file ? }
XAD_OVERWRITE = TAG_USER + 54;
{ create directory tree }
XAD_MAKEDIRECTORY = TAG_USER + 55;
{ ignore drive geometry ? }
XAD_IGNOREGEOMETRY = TAG_USER + 56;
{ lowest cylinder }
XAD_LOWCYLINDER = TAG_USER + 57;
{ highest cylinder }
XAD_HIGHCYLINDER = TAG_USER + 58;
{ verify for disk hook }
XAD_VERIFY = TAG_USER + 59;
{ do not delete partial/corrupt files (V3.3) }
XAD_NOKILLPARTIAL = TAG_USER + 60;
{ format output device (V5) }
XAD_FORMAT = TAG_USER + 61;
{ sector labels are stored on disk (V9) }
XAD_USESECTORLABELS = TAG_USER + 62;
{ ignore the client, if certain flags are set (V11) }
XAD_IGNOREFLAGS = TAG_USER + 63;
{ ignore the client, if certain flags are NOT set (V11) }
XAD_ONLYFLAGS = TAG_USER + 64;
{ input tags for xadConvertDates, only one can be passed }
{ unix date variable }
XAD_DATEUNIX = TAG_USER + 70;
{ amiga date variable }
XAD_DATEAMIGA = TAG_USER + 71;
{ struct DateStamp }
XAD_DATEDATESTAMP = TAG_USER + 72;
{ struct xadDate }
XAD_DATEXADDATE = TAG_USER + 73;
{ struct ClockData }
XAD_DATECLOCKDATA = TAG_USER + 74;
{ input is system time }
XAD_DATECURRENTTIME = TAG_USER + 75;
{ MS-DOS packed format (V2) }
XAD_DATEMSDOS = TAG_USER + 76;
{ Mac date variable (V8) }
XAD_DATEMAC = TAG_USER + 77;
{ CP/M data structure (V10) }
XAD_DATECPM = TAG_USER + 78;
{ CP/M data structure type 2 (V10) }
XAD_DATECPM2 = TAG_USER + 79;
{ ISO9660 date structure (V11) }
XAD_DATEISO9660 = TAG_USER + 300;
{ output tags, there can be specified multiple tags for one call }
{ unix date variable }
XAD_GETDATEUNIX = TAG_USER + 80;
{ amiga date variable }
XAD_GETDATEAMIGA = TAG_USER + 81;
{ struct DateStamp }
XAD_GETDATEDATESTAMP = TAG_USER + 82;
{ struct xadDate }
XAD_GETDATEXADDATE = TAG_USER + 83;
{ struct ClockData }
XAD_GETDATECLOCKDATA = TAG_USER + 84;
{ MS-DOS packed format (V2) }
XAD_GETDATEMSDOS = TAG_USER + 86;
{ Mac date variable (V8) }
XAD_GETDATEMAC = TAG_USER + 87;
{ CP/M data structure (V10) }
XAD_GETDATECPM = TAG_USER + 88;
{ CP/M data structure type 2 (V10) }
XAD_GETDATECPM2 = TAG_USER + 89;
{ ISO9660 date structure (V11) }
XAD_GETDATEISO9660 = TAG_USER + 320;
{ following tags need locale.library to be installed }
{ make local to GMT time }
XAD_MAKEGMTDATE = TAG_USER + 90;
{ make GMT to local time }
XAD_MAKELOCALDATE = TAG_USER + 91;
{ tags for xadHookTagAccess (V3) }
{ the hook uses xadSkipInfo (V3) }
XAD_USESKIPINFO = TAG_USER + 104;
{ pass sector labels with XADAC_WRITE (V9) }
XAD_SECTORLABELS = TAG_USER + 105;
{ pointer to UWORD value (V3) }
XAD_GETCRC16 = TAG_USER + 120;
{ pointer to ULONG value (V3) }
XAD_GETCRC32 = TAG_USER + 121;
{ ID for crc calculation (V3) }
XAD_CRC16ID = TAG_USER + 130;
{ ID for crc calculation (V3) }
XAD_CRC32ID = TAG_USER + 131;
{ tags for xadConvertProtection (V4) }
{ Amiga type protection bits (V4) }
XAD_PROTAMIGA = TAG_USER + 160;
{ protection bits in UNIX mode (V4) }
XAD_PROTUNIX = TAG_USER + 161;
{ MSDOS type protection bits (V4) }
XAD_PROTMSDOS = TAG_USER + 162;
{ input is a xadFileInfo structure (V11) }
XAD_PROTFILEINFO = TAG_USER + 163;
{ return Amiga protection bits (V4) }
XAD_GETPROTAMIGA = TAG_USER + 170;
{ return UNIX protection bits (V11) }
XAD_GETPROTUNIX = TAG_USER + 171;
{ return MSDOS protection bits (V11) }
XAD_GETPROTMSDOS = TAG_USER + 172;
{ fill xadFileInfo protection fields (V11) }
XAD_GETPROTFILEINFO = TAG_USER + 173;
{ tags for xadGetDiskInfo (V7) }
{ the client to start with (V7) }
XAD_STARTCLIENT = TAG_USER + 180;
{ do not create XADERR_EMPTY (V8) }
XAD_NOEMPTYERROR = TAG_USER + 181;
{ tags for xadFreeHookAccess (V8) }
{ error occured, call abort method (V8) }
XAD_WASERROR = TAG_USER + 190;
{ tags for miscellaneous stuff }
{ xadArchiveInfo for stream hooks (V8) }
XAD_ARCHIVEINFO = TAG_USER + 200;
{ error code of function (V12) }
XAD_ERRORCODE = TAG_USER + 201;
{ tags for xadAddFileEntry and xadAddDiskEntry (V10) }
{ set xai_InPos after call (V10) }
XAD_SETINPOS = TAG_USER + 240;
{ insert dirs at list start (V10) }
XAD_INSERTDIRSFIRST = TAG_USER + 241;
{ tags for xadConvertName (V12) }
(* UWORD , default is {'/','\\',0} in source charset (V12) *)
XAD_PATHSEPERATOR = TAG_USER + 260;
{ the characterset of string (V12) }
XAD_CHARACTERSET = TAG_USER + 261;
{ maximum size of following (V12) }
XAD_STRINGSIZE = TAG_USER + 262;
{ zero-terminated string (V12) }
XAD_CSTRING = TAG_USER + 263;
{ lengthed Pascal string (V12) }
XAD_PSTRING = TAG_USER + 264;
{ an xad string (V12) }
XAD_XADSTRING = TAG_USER + 265;
{ default is TRUE (V12) }
XAD_ADDPATHSEPERATOR = TAG_USER + 266;
{ tags for xadGetFilename (V12) }
{ default is FALSE (V12) }
XAD_NOLEADINGPATH = TAG_USER + 280;
{ default is FALSE (V12) }
XAD_NOTRAILINGPATH = TAG_USER + 281;
{ default are #?()[]~% :|",1-31,127-160 (V12) }
XAD_MASKCHARACTERS = TAG_USER + 282;
{ default is '_' (V12) }
XAD_MASKINGCHAR = TAG_USER + 283;
{ pointer which should hold buf size (V12) }
XAD_REQUIREDBUFFERSIZE = TAG_USER + 284;
{ Places 300-339 used for dates! }
{
objects for xadAllocObjectA
}
{ struct xadArchiveInfo }
XADOBJ_ARCHIVEINFO = $0001;
{ struct xadFileInfo }
XADOBJ_FILEINFO = $0002;
{ struct xadDiskInfo }
XADOBJ_DISKINFO = $0003;
{ struct HookParam }
XADOBJ_HOOKPARAM = $0004;
{ struct xadDeviceInfo }
XADOBJ_DEVICEINFO = $0005;
{ struct xadProgressInfo }
XADOBJ_PROGRESSINFO = $0006;
{ struct xadTextInfo }
XADOBJ_TEXTINFO = $0007;
{ struct xadSplitFile (V2) }
XADOBJ_SPLITFILE = $0008;
{ struct xadSkipInfo (V3) }
XADOBJ_SKIPINFO = $0009;
{ struct xadImageInfo (V4) }
XADOBJ_IMAGEINFO = $000A;
{ struct xadSpecial (V11) }
XADOBJ_SPECIAL = $000B;
{ result type of xadAllocVec }
{ memory of requested size and type }
XADOBJ_MEMBLOCK = $0100;
{ private type }
{ an typed XAD string (V12) }
XADOBJ_STRING = $0101;
{
modes for xadCalcCRC126 and xadCalcCRC32
}
XADCRC16_ID1 = $A001;
XADCRC32_ID1 = $EDB88320;
{
hook related stuff
}
{ read data into buffer }
XADHC_READ = 1;
{ write buffer data to file/memory }
XADHC_WRITE = 2;
{ seek in file }
XADHC_SEEK = 3;
{ initialize the hook }
XADHC_INIT = 4;
{ end up hook work, free stuff }
XADHC_FREE = 5;
{ an error occured, delete partial stuff }
XADHC_ABORT = 6;
{ complete input size is needed }
XADHC_FULLSIZE = 7;
{ return disk image info (V4) }
XADHC_IMAGEINFO = 8;
type
PxadHookParam = ^txadHookParam;
txadHookParam = record
xhp_Command : ULONG;
xhp_CommandData : LONG;
xhp_BufferPtr : APTR;
xhp_BufferSize : ULONG;
xhp_DataPos : ULONG; { current seek position }
xhp_PrivatePtr : APTR;
xhp_TagList : APTR; { allows to transport tags to hook (V9) }
end;
{ xadHookAccess commands }
{ get data }
const
XADAC_READ = 10;
{ write data }
XADAC_WRITE = 11;
{ copy input to output }
XADAC_COPY = 12;
{ seek in input file }
XADAC_INPUTSEEK = 13;
{ seek in output file }
XADAC_OUTPUTSEEK = 14;
{
support structures
}
{ Own date structure to cover all possible dates in a human friendly
format. xadConvertDates may be used to convert between different date
structures and variables. }
type
PxadDate = ^txadDate;
txadDate = record
xd_Micros : ULONG; { values 0 to 999999 }
xd_Year : LONG; { values 1 to 2147483648 }
xd_Month : UBYTE; { values 1 to 12 }
xd_WeekDay : UBYTE; { values 1 to 7 }
xd_Day : UBYTE; { values 1 to 31 }
xd_Hour : UBYTE; { values 0 to 23 }
xd_Minute : UBYTE; { values 0 to 59 }
xd_Second : UBYTE; { values 0 to 59 }
end;
{ monday is the first day and }
const
XADDAY_MONDAY = 1;
XADDAY_TUESDAY = 2;
XADDAY_WEDNESDAY = 3;
XADDAY_THURSDAY = 4;
XADDAY_FRIDAY = 5;
XADDAY_SATURDAY = 6;
{ sunday the last day of a week }
XADDAY_SUNDAY = 7;
type
PxadDeviceInfo = ^txadDeviceInfo;
txadDeviceInfo = record { for XAD_OUTDEVICE tag }
xdi_DeviceName : STRPTR; { name of device }
xdi_Unit : ULONG; { unit of device }
xdi_DOSName : STRPTR; { instead of Device+Unit, dos name without ':' }
end;
PxadSplitFile = ^txadSplitFile;
txadSplitFile = record { for XAD_INSPLITTED }
xsf_Next : PxadSplitFile;
xsf_Type : ULONG; { XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK }
xsf_Size : ULONG; { necessary for XAD_INMEMORY, useful for others }
xsf_Data : ULONG; { FileName, Filehandle, Hookpointer or Memory }
end;
PxadSkipInfo = ^txadSkipInfo;
txadSkipInfo = record
xsi_Next : PxadSkipInfo;
xsi_Position : ULONG; { position, where it should be skipped }
xsi_SkipSize : ULONG; { size to skip }
end;
PxadImageInfo = ^txadImageInfo;
txadImageInfo = record { for XADHC_IMAGEINFO }
xii_SectorSize : ULONG; { usually 512 }
xii_FirstSector : ULONG; { of the image file }
xii_NumSectors : ULONG; { of the image file }
xii_TotalSectors : ULONG; { of this device type }
end;
type
PxadClient = ^txadClient;
txadClient = record
xc_Next : PxadClient;
xc_Version : UWORD; { set to XADCLIENT_VERSION }
xc_MasterVersion : UWORD;
xc_ClientVersion : UWORD;
xc_ClientRevision : UWORD;
xc_RecogSize : ULONG; { needed size to recog the type }
xc_Flags : ULONG; { see XADCF_xxx defines }
xc_Identifier : ULONG; { ID of internal clients }
xc_ArchiverName : STRPTR;
xc_RecogData : function :BOOL;
xc_GetInfo : function :LONG;
xc_UnArchive : function :LONG;
xc_Free : procedure ;
end;
{ function interface
ASM(BOOL) xc_RecogData(REG(d0, ULONG size), REG(a0, STRPTR data),
REG(a6, struct xadMasterBase xadMasterBase));
ASM(LONG) xc_GetInfo(REG(a0, struct xadArchiveInfo ai),
REG(a6, struct xadMasterBase xadMasterBase));
ASM(LONG) xc_UnArchive(REG(a0, struct xadArchiveInfo ai),
REG(a6, struct xadMasterBase xadMasterBase));
ASM(void) xc_Free(REG(a0, struct xadArchiveInfo ai),
REG(a6, struct xadMasterBase xadMasterBase));
}
{ xc_RecogData returns 1 when recognized and 0 when not, all the others
return 0 when ok and XADERR values on error. xc_Free has no return
value.
Filesystem clients need to clear xc_RecogSize and xc_RecogData. The
recognition is automatically done by GetInfo. XADERR_FILESYSTEM is
returned in case of unknown format. If it is known detection should
go on and any other code may be returned, if it fails.
The field xc_ArchiverName means xc_FileSystemName for filesystem
clients.
}
type
PxadSpecialUnixDevice = ^txadSpecialUnixDevice;
txadSpecialUnixDevice = record
xfis_MajorVersion : ULONG; { major device version }
xfis_MinorVersion : ULONG; { minor device version }
end;
PxadSpecialAmigaAddress = ^txadSpecialAmigaAddress;
txadSpecialAmigaAddress = record
xfis_JumpAddress : ULONG; { code executaion start address }
xfis_DecrunchAddress : ULONG; { decrunch start of code }
end;
PxadSpecialCBM8bit = ^txadSpecialCBM8bit;
txadSpecialCBM8bit = record
xfis_FileType : UBYTE; { File type XADCBM8BITTYPE_xxx }
xfis_RecordLength : UBYTE; { record length if relative file }
end;
type
PxadSpecial = ^txadSpecial;
txadSpecial = record
xfis_Type : ULONG; { XADSPECIALTYPE to define type of block (V11) }
xfis_Next : PxadSpecial; { pointer to next entry }
xfis_Data : record
case longint of
0 : ( xfis_UnixDevice : txadSpecialUnixDevice );
1 : ( xfis_AmigaAddress : txadSpecialAmigaAddress );
2 : ( xfis_CBM8bit : txadSpecialCBM8bit );
end;
end;
{ Multiuser fields (xfi_OwnerUID, xfi_OwnerUID, xfi_UserName, xfi_GroupName)
and multiuser bits (see <dos/dos.h>) are currently not supported with normal
Amiga filesystem. But the clients support them, if archive format holds
such information.
The protection bits (all 3 fields) should always be set using the
xadConvertProtection procedure. Call it with as much protection information
as possible. It extracts the relevant data at best (and also sets the 2 flags).
DO NOT USE these fields directly, but always through xadConvertProtection
call.
}
type
PxadFileInfo = ^txadFileInfo;
txadFileInfo = record
xfi_Next : PxadFileInfo;
xfi_EntryNumber : ULONG; { number of entry }
xfi_EntryInfo : STRPTR; { additional archiver text }
xfi_PrivateInfo : APTR; { client private, see XAD_OBJPRIVINFOSIZE }
xfi_Flags : ULONG; { see XADFIF_xxx defines }
xfi_FileName : STRPTR; { see XAD_OBJNAMESIZE tag }
xfi_Comment : STRPTR; { see XAD_OBJCOMMENTSIZE tag }
xfi_Protection : ULONG; { OS 3 bits (including multiuser) }
xfi_OwnerUID : ULONG; { user ID }
xfi_OwnerGID : ULONG; { group ID }
xfi_UserName : STRPTR; { user name }
xfi_GroupName : STRPTR; { group name }
xfi_Size : ULONG; { size of this file }
xfi_GroupCrSize : ULONG; { crunched size of group }
xfi_CrunchSize : ULONG; { crunched size }
xfi_LinkName : STRPTR; { name and path of link }
xfi_Date : txadDate;
xfi_Generation : UWORD; { File Generation [0...0xFFFF] (V3) }
xfi_DataPos : ULONG; { crunched data position (V3) }
xfi_MacFork : PxadFileInfo; { pointer to 2nd fork for Mac (V7) }
xfi_UnixProtect : UWORD; { protection bits for Unix (V11) }
xfi_DosProtect : UBYTE; { protection bits for MS-DOS (V11) }
xfi_FileType : UBYTE; { XADFILETYPE to define type of exe files (V11) }
xfi_Special : PxadSpecial; { pointer to special data (V11) }
end;
{ NOTE: the texts passed with that structure must not always be printable.
Although the clients should add an additional (not counted) zero at the text
end, the whole file may contain other unprintable stuff (e.g. for DMS).
So when printing this texts do it on a byte for byte base including
printability checks.
}
type
PxadTextInfo = ^txadTextInfo;
txadTextInfo = record
xti_Next : PxadTextInfo;
xti_Size : ULONG; { maybe zero - no text - e.g. when crypted }
xti_Text : STRPTR; { and there is no password in xadGetInfo() }
xti_Flags : ULONG; { see XADTIF_xxx defines }
end;
type
PxadDiskInfo = ^txadDiskInfo;
txadDiskInfo = record
xdi_Next : PxadDiskInfo;
xdi_EntryNumber : ULONG; { number of entry }
xdi_EntryInfo : STRPTR; { additional archiver text }
xdi_PrivateInfo : APTR; { client private, see XAD_OBJPRIVINFOSIZE }
xdi_Flags : ULONG; { see XADDIF_xxx defines }
xdi_SectorSize : ULONG;
xdi_TotalSectors : ULONG; { see devices/trackdisk.h }
xdi_Cylinders : ULONG; { to find out what these }
xdi_CylSectors : ULONG; { fields mean, they are equal }
xdi_Heads : ULONG; { to struct DriveGeometry }
xdi_TrackSectors : ULONG;
xdi_LowCyl : ULONG; { lowest cylinder stored }
xdi_HighCyl : ULONG; { highest cylinder stored }
xdi_BlockInfoSize : ULONG; { number of BlockInfo entries }
xdi_BlockInfo : Pointer; { see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag }
xdi_TextInfo : PxadTextInfo;{ linked list with info texts }
xdi_DataPos : ULONG; { crunched data position (V3) }
end;
{ BlockInfo points to a UBYTE field for every track from first sector of
lowest cylinder to last sector of highest cylinder. When not used,
pointer must be 0. Do not use it, when there are no entries!
This is just for information. The applications still asks the client
to unarchive whole cylinders and not archived blocks are cleared for
unarchiving.
}
{ If the image file holds total data of disk xii_TotalSectors equals
xii_NumSectors and xii_FirstSector is zero. Addition of xii_FirstSector
and xii_NumSectors cannot exceed xii_TotalSectors value!
}
{
information structures
}
PxadArchiveInfo = ^txadArchiveInfo;
txadArchiveInfo = record
xai_Client : PxadClient; { pointer to unarchiving client }
xai_PrivateClient : APTR; { private client data }
xai_Password : STRPTR; { password for crypted archives }
xai_Flags : ULONG; { read only XADAIF_ flags }
xai_LowCyl : ULONG; { lowest cylinder to unarchive }
xai_HighCyl : ULONG; { highest cylinder to unarchive }
xai_InPos : ULONG; { input position, read only }
xai_InSize : ULONG; { input size, read only }
xai_OutPos : ULONG; { output position, read only }
xai_OutSize : ULONG; { output file size, read only }
xai_FileInfo : PxadFileInfo; { data pointer for file arcs }
xai_DiskInfo : PxadDiskInfo; { data pointer for disk arcs }
xai_CurFile : PxadFileInfo; { data pointer for current file arc }
xai_CurDisk : PxadDiskInfo; { data pointer for current disk arc }
xai_LastError : LONG; { last error, when XADAIF_FILECORRUPT (V2) }
xai_MultiVolume : PULONG; { array of start offsets from parts (V2) }
xai_SkipInfo : PxadSkipInfo; { linked list of skip entries (V3) }
xai_ImageInfo : PxadImageInfo; { for filesystem clients (V5) }
xai_InName : STRPTR; { Input archive name if available (V7) }
end;
{ This structure is nearly complete private to either xadmaster or its
clients. An application program may access for reading only xai_Client,
xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED
and XADAIF_FILECORRUPT are useful. All the other stuff is private and should
not be accessed! }
{ archive entries are encrypted }
const
XADAIB_CRYPTED = 0;
{ file is corrupt, but valid entries are in the list }
XADAIB_FILECORRUPT = 1;
{ unarchive file entry }
XADAIB_FILEARCHIVE = 2;
{ unarchive disk entry }
XADAIB_DISKARCHIVE = 3;
{ overwrite the file (PRIVATE) }
XADAIB_OVERWRITE = 4;
{ create directory when missing (PRIVATE) }
XADAIB_MAKEDIRECTORY = 5;
{ ignore drive geometry (PRIVATE) }
XADAIB_IGNOREGEOMETRY = 6;
{ verify is turned on for disk hook (PRIVATE) }
XADAIB_VERIFY = 7;
{ do not delete partial files (PRIVATE) }
XADAIB_NOKILLPARTIAL = 8;
{ is disk image extraction (V5) }
XADAIB_DISKIMAGE = 9;
{ format in disk hook (PRIVATE) }
XADAIB_FORMAT = 10;
{ do not create empty error (PRIVATE) }
XADAIB_NOEMPTYERROR = 11;
{ in stuff only (PRIVATE) }
XADAIB_ONLYIN = 12;
{ out stuff only (PRIVATE) }
XADAIB_ONLYOUT = 13;
{ use SectorLabels (PRIVATE) }
XADAIB_USESECTORLABELS = 14;
XADAIF_CRYPTED = 1 shl XADAIB_CRYPTED;
XADAIF_FILECORRUPT = 1 shl XADAIB_FILECORRUPT;
XADAIF_FILEARCHIVE = 1 shl XADAIB_FILEARCHIVE;
XADAIF_DISKARCHIVE = 1 shl XADAIB_DISKARCHIVE;
XADAIF_OVERWRITE = 1 shl XADAIB_OVERWRITE;
XADAIF_MAKEDIRECTORY = 1 shl XADAIB_MAKEDIRECTORY;
XADAIF_IGNOREGEOMETRY = 1 shl XADAIB_IGNOREGEOMETRY;
XADAIF_VERIFY = 1 shl XADAIB_VERIFY;
XADAIF_NOKILLPARTIAL = 1 shl XADAIB_NOKILLPARTIAL;
XADAIF_DISKIMAGE = 1 shl XADAIB_DISKIMAGE;
XADAIF_FORMAT = 1 shl XADAIB_FORMAT;
XADAIF_NOEMPTYERROR = 1 shl XADAIB_NOEMPTYERROR;
XADAIF_ONLYIN = 1 shl XADAIB_ONLYIN;
XADAIF_ONLYOUT = 1 shl XADAIB_ONLYOUT;
XADAIF_USESECTORLABELS = 1 shl XADAIB_USESECTORLABELS;
{ These are used for xfi_FileType to define file type. (V11) }
{ infile was only one data file }
const
XADFILETYPE_DATACRUNCHER = 1;
{ infile was text-linked }
XADFILETYPE_TEXTLINKER = 2;
{ infile was an Amiga exe cruncher }
XADFILETYPE_AMIGAEXECRUNCHER = 11;
{ infile was an Amiga exe linker }
XADFILETYPE_AMIGAEXELINKER = 12;
{ infile was an Amiga text-exe linker }
XADFILETYPE_AMIGATEXTLINKER = 13;
{ infile was an Amiga address cruncher }
XADFILETYPE_AMIGAADDRESS = 14;
{ this file is a block device }
XADFILETYPE_UNIXBLOCKDEVICE = 21;
{ this file is a character device }
XADFILETYPE_UNIXCHARDEVICE = 22;
{ this file is a named pipe }
XADFILETYPE_UNIXFIFO = 23;
{ this file is a socket }
XADFILETYPE_UNIXSOCKET = 24;
{ infile was an MSDOS exe cruncher }
XADFILETYPE_MSDOSEXECRUNCHER = 31;
{ xadSpecial entry is xadSpecialUnixDevice }
XADSPECIALTYPE_UNIXDEVICE = 1;
{ xadSpecial entry is xadSpecialAmigaAddress }
XADSPECIALTYPE_AMIGAADDRESS = 2;
{ xadSpecial entry is xadSpecialCBM8bit }
XADSPECIALTYPE_CBM8BIT = 3;
{ Unknown / Unused }
const
XADCBM8BITTYPE_UNKNOWN = $00;
{ Tape - BASIC program file }
XADCBM8BITTYPE_BASIC = $01;
{ Tape - Data block (SEQ file) }
XADCBM8BITTYPE_DATA = $02;
{ Tape - Fixed addres program file }
XADCBM8BITTYPE_FIXED = $03;
{ Tape - Sequential data file }
XADCBM8BITTYPE_SEQDATA = $04;
{ Disk - Sequential file "SEQ" }
XADCBM8BITTYPE_SEQ = $81;
{ Disk - Program file "PRG" }
XADCBM8BITTYPE_PRG = $82;
{ Disk - User-defined file "USR" }
XADCBM8BITTYPE_USR = $83;
{ Disk - Relative records file "REL" }
XADCBM8BITTYPE_REL = $84;
{ Disk - CBM (partition) "CBM" }
XADCBM8BITTYPE_CBM = $85;
{ entry is crypted }
const
XADFIB_CRYPTED = 0;
{ entry is a directory }
XADFIB_DIRECTORY = 1;
{ entry is a link }
XADFIB_LINK = 2;
{ file is an information text }
XADFIB_INFOTEXT = 3;
{ file is in a crunch group }
XADFIB_GROUPED = 4;
{ crunch group ends here }
XADFIB_ENDOFGROUP = 5;
{ no date supported, CURRENT date is set }
XADFIB_NODATE = 6;
{ file is marked as deleted (V3) }
XADFIB_DELETED = 7;
{ before unarchiving the datapos is set (V3) }
XADFIB_SEEKDATAPOS = 8;
{ there was no filename, using internal one (V6) }
XADFIB_NOFILENAME = 9;
{ file size is unknown and thus set to zero (V6) }
XADFIB_NOUNCRUNCHSIZE = 10;
{ file is only partial (V6) }
XADFIB_PARTIALFILE = 11;
{ file is Apple data fork (V7) }
XADFIB_MACDATA = 12;
{ file is Apple resource fork (V7) }
XADFIB_MACRESOURCE = 13;
{ allows extract file during scanning (V10) }
XADFIB_EXTRACTONBUILD = 14;
{ UNIX protection bits are present (V11) }
XADFIB_UNIXPROTECTION = 15;
{ MSDOS protection bits are present (V11) }
XADFIB_DOSPROTECTION = 16;
{ this entry may change until GetInfo is finished (V11) }
XADFIB_ENTRYMAYCHANGE = 17;
{ the xfi_FileName fields is an XAD string (V12) }
XADFIB_XADSTRFILENAME = 18;
{ the xfi_LinkName fields is an XAD string (V12) }
XADFIB_XADSTRLINKNAME = 19;
{ the xfi_Comment fields is an XAD string (V12) }
XADFIB_XADSTRCOMMENT = 20;
XADFIF_CRYPTED = 1 shl XADFIB_CRYPTED;
XADFIF_DIRECTORY = 1 shl XADFIB_DIRECTORY;
XADFIF_LINK = 1 shl XADFIB_LINK;
XADFIF_INFOTEXT = 1 shl XADFIB_INFOTEXT;
XADFIF_GROUPED = 1 shl XADFIB_GROUPED;
XADFIF_ENDOFGROUP = 1 shl XADFIB_ENDOFGROUP;
XADFIF_NODATE = 1 shl XADFIB_NODATE;
XADFIF_DELETED = 1 shl XADFIB_DELETED;
XADFIF_SEEKDATAPOS = 1 shl XADFIB_SEEKDATAPOS;
XADFIF_NOFILENAME = 1 shl XADFIB_NOFILENAME;
XADFIF_NOUNCRUNCHSIZE = 1 shl XADFIB_NOUNCRUNCHSIZE;
XADFIF_PARTIALFILE = 1 shl XADFIB_PARTIALFILE;
XADFIF_MACDATA = 1 shl XADFIB_MACDATA;
XADFIF_MACRESOURCE = 1 shl XADFIB_MACRESOURCE;
XADFIF_EXTRACTONBUILD = 1 shl XADFIB_EXTRACTONBUILD;
XADFIF_UNIXPROTECTION = 1 shl XADFIB_UNIXPROTECTION;
XADFIF_DOSPROTECTION = 1 shl XADFIB_DOSPROTECTION;
XADFIF_ENTRYMAYCHANGE = 1 shl XADFIB_ENTRYMAYCHANGE;
XADFIF_XADSTRFILENAME = 1 shl XADFIB_XADSTRFILENAME;
XADFIF_XADSTRLINKNAME = 1 shl XADFIB_XADSTRLINKNAME;
XADFIF_XADSTRCOMMENT = 1 shl XADFIB_XADSTRCOMMENT;
{ entry is empty, as data was crypted }
const
XADTIB_CRYPTED = 0;
{ text is a banner }
XADTIB_BANNER = 1;
{ text is a file description }
XADTIB_FILEDIZ = 2;
XADTIF_CRYPTED = 1 shl XADTIB_CRYPTED;
XADTIF_BANNER = 1 shl XADTIB_BANNER;
XADTIF_FILEDIZ = 1 shl XADTIB_FILEDIZ;
{ entry is crypted }
const
XADDIB_CRYPTED = 0;
{ before unarchiving the datapos is set (V3) }
XADDIB_SEEKDATAPOS = 1;
{ the clients delivers sector labels (V9) }
XADDIB_SECTORLABELS = 2;
{ allows extract disk during scanning (V10) }
XADDIB_EXTRACTONBUILD = 3;
{ this entry may change until GetInfo is finished (V11) }
XADDIB_ENTRYMAYCHANGE = 4;
{ Some of the crunchers do not store all necessary information, so it
may be needed to guess some of them. Set the following flags in that case
and geometry check will ignore these fields. }
{ sectorsize is guessed (V10) }
XADDIB_GUESSSECTORSIZE = 5;
{ totalsectors number is guessed (V10) }
XADDIB_GUESSTOTALSECTORS = 6;
{ cylinder number is guessed }
XADDIB_GUESSCYLINDERS = 7;
{ cylsectors is guessed }
XADDIB_GUESSCYLSECTORS = 8;
{ number of heads is guessed }
XADDIB_GUESSHEADS = 9;
{ tracksectors is guessed }
XADDIB_GUESSTRACKSECTORS = 10;
{ lowcyl is guessed }
XADDIB_GUESSLOWCYL = 11;
{ highcyl is guessed }
XADDIB_GUESSHIGHCYL = 12;
{ If it is impossible to set some of the fields, you need to set some of
these flags. NOTE: XADDIB_NOCYLINDERS is really important, as this turns
of usage of lowcyl and highcyl keywords. When you have cylinder information,
you should not use these and instead use guess flags and calculate
possible values for the missing fields. }
{ cylinder number is not set }
XADDIB_NOCYLINDERS = 15;
{ cylsectors is not set }
XADDIB_NOCYLSECTORS = 16;
{ number of heads is not set }
XADDIB_NOHEADS = 17;
{ tracksectors is not set }
XADDIB_NOTRACKSECTORS = 18;
{ lowcyl is not set }
XADDIB_NOLOWCYL = 19;
{ highcyl is not set }
XADDIB_NOHIGHCYL = 20;
XADDIF_CRYPTED = 1 shl XADDIB_CRYPTED;
XADDIF_SEEKDATAPOS = 1 shl XADDIB_SEEKDATAPOS;
XADDIF_SECTORLABELS = 1 shl XADDIB_SECTORLABELS;
XADDIF_EXTRACTONBUILD = 1 shl XADDIB_EXTRACTONBUILD;
XADDIF_ENTRYMAYCHANGE = 1 shl XADDIB_ENTRYMAYCHANGE;
XADDIF_GUESSSECTORSIZE = 1 shl XADDIB_GUESSSECTORSIZE;
XADDIF_GUESSTOTALSECTORS = 1 shl XADDIB_GUESSTOTALSECTORS;
XADDIF_GUESSCYLINDERS = 1 shl XADDIB_GUESSCYLINDERS;
XADDIF_GUESSCYLSECTORS = 1 shl XADDIB_GUESSCYLSECTORS;
XADDIF_GUESSHEADS = 1 shl XADDIB_GUESSHEADS;
XADDIF_GUESSTRACKSECTORS = 1 shl XADDIB_GUESSTRACKSECTORS;
XADDIF_GUESSLOWCYL = 1 shl XADDIB_GUESSLOWCYL;
XADDIF_GUESSHIGHCYL = 1 shl XADDIB_GUESSHIGHCYL;
XADDIF_NOCYLINDERS = 1 shl XADDIB_NOCYLINDERS;
XADDIF_NOCYLSECTORS = 1 shl XADDIB_NOCYLSECTORS;
XADDIF_NOHEADS = 1 shl XADDIB_NOHEADS;
XADDIF_NOTRACKSECTORS = 1 shl XADDIB_NOTRACKSECTORS;
XADDIF_NOLOWCYL = 1 shl XADDIB_NOLOWCYL;
XADDIF_NOHIGHCYL = 1 shl XADDIB_NOHIGHCYL;
{ defines for BlockInfo }
{ this block was cleared for archiving }
XADBIB_CLEARED = 0;
{ this block was not archived }
XADBIB_UNUSED = 1;
XADBIF_CLEARED = 1 shl XADBIB_CLEARED;
XADBIF_UNUSED = 1 shl XADBIB_UNUSED;
{
progress report stuff
}
type
PxadProgressInfo = ^txadProgressInfo;
txadProgressInfo = record
xpi_Mode : ULONG; { work modus }
xpi_Client : PxadClient; { the client doing the work }
xpi_DiskInfo : PxadDiskInfo; { current diskinfo, for disks }
xpi_FileInfo : PxadFileInfo; { current info for files }
xpi_CurrentSize : ULONG; { current filesize }
xpi_LowCyl : ULONG; { for disks only }
xpi_HighCyl : ULONG; { for disks only }
xpi_Status : ULONG; { see XADPIF flags }
xpi_Error : LONG; { any of the error codes }
xpi_FileName : STRPTR; { name of file to overwrite (V2) }
xpi_NewName : STRPTR; { new name buffer, passed by hook (V2) }
end;
{ NOTE: For disks CurrentSize is Sector SectorSize, where SectorSize can
be found in xadDiskInfo structure. So you may output the sector value. }
{ different progress modes }
const
XADPMODE_ASK = 1;
XADPMODE_PROGRESS = 2;
XADPMODE_END = 3;
XADPMODE_ERROR = 4;
{ (V10) }
XADPMODE_NEWENTRY = 5;
{ (V11) }
XADPMODE_GETINFOEND = 6;
{ flags for progress hook and ProgressInfo status field }
{ overwrite the file }
XADPIB_OVERWRITE = 0;
{ create the directory }
XADPIB_MAKEDIRECTORY = 1;
{ ignore drive geometry }
XADPIB_IGNOREGEOMETRY = 2;
{ destination is a directory (V10) }
XADPIB_ISDIRECTORY = 3;
{ rename the file (V2) }
XADPIB_RENAME = 10;
{ all ok, proceed }
XADPIB_OK = 16;
{ skip file }
XADPIB_SKIP = 17;
XADPIF_OVERWRITE = 1 shl XADPIB_OVERWRITE;
XADPIF_MAKEDIRECTORY = 1 shl XADPIB_MAKEDIRECTORY;
XADPIF_IGNOREGEOMETRY = 1 shl XADPIB_IGNOREGEOMETRY;
XADPIF_ISDIRECTORY = 1 shl XADPIB_ISDIRECTORY;
XADPIF_RENAME = 1 shl XADPIB_RENAME;
XADPIF_OK = 1 shl XADPIB_OK;
XADPIF_SKIP = 1 shl XADPIB_SKIP;
{
errors
}
{ no error }
XADERR_OK = $0000;
{ unknown error }
XADERR_UNKNOWN = $0001;
{ input data buffers border exceeded }
XADERR_INPUT = $0002;
{ output data buffers border exceeded }
XADERR_OUTPUT = $0003;
{ function called with illegal parameters }
XADERR_BADPARAMS = $0004;
{ not enough memory available }
XADERR_NOMEMORY = $0005;
{ data is corrupted }
XADERR_ILLEGALDATA = $0006;
{ command is not supported }
XADERR_NOTSUPPORTED = $0007;
{ required resource missing }
XADERR_RESOURCE = $0008;
{ error on decrunching }
XADERR_DECRUNCH = $0009;
{ unknown file type }
XADERR_FILETYPE = $000A;
{ opening file failed }
XADERR_OPENFILE = $000B;
{ file, disk has been skipped }
XADERR_SKIP = $000C;
{ user break in progress hook }
XADERR_BREAK = $000D;
{ file already exists }
XADERR_FILEEXISTS = $000E;
{ missing or wrong password }
XADERR_PASSWORD = $000F;
{ could not create directory }
XADERR_MAKEDIR = $0010;
{ wrong checksum }
XADERR_CHECKSUM = $0011;
{ verify failed (disk hook) }
XADERR_VERIFY = $0012;
{ wrong drive geometry }
XADERR_GEOMETRY = $0013;
{ unknown data format }
XADERR_DATAFORMAT = $0014;
{ source contains no files }
XADERR_EMPTY = $0015;
{ unknown filesystem }
XADERR_FILESYSTEM = $0016;
{ name of file exists as directory }
XADERR_FILEDIR = $0017;
{ buffer was to short }
XADERR_SHORTBUFFER = $0018;
{ text encoding was defective }
XADERR_ENCODING = $0019;
{
characterset and filename conversion
}
{ this is the ONLY destination setting for clients! }
CHARSET_HOST = 0;
{ 16bit Unicode (usually no source type) }
CHARSET_UNICODE_UCS2_HOST = 10;
{ 16bit Unicode big endian storage }
CHARSET_UNICODE_UCS2_BIGENDIAN = 11;
{ 16bit Unicode little endian storage }
CHARSET_UNICODE_UCS2_LITTLEENDIAN = 12;
{ variable size unicode encoding }
CHARSET_UNICODE_UTF8 = 13;
{ all the 1xx types are generic types which also maybe a bit dynamic }
{ the default Amiga charset }
CHARSET_AMIGA = 100;
{ the default MSDOS charset }
CHARSET_MSDOS = 101;
{ the default MacOS charset }
CHARSET_MACOS = 102;
{ the default C64 charset }
CHARSET_C64 = 103;
{ the default Atari ST charset }
CHARSET_ATARI_ST = 104;
{ the default Windows charset }
CHARSET_WINDOWS = 105;
{ all the 2xx to 9xx types are real charsets, use them whenever you know
what the data really is }
{ the lower 7 bits of ASCII charsets }
CHARSET_ASCII = 200;
{ the base charset }
CHARSET_ISO_8859_1 = 201;
{ Euro-sign fixed ISO variant }
CHARSET_ISO_8859_15 = 215;
{ Atari ST (US) charset }
CHARSET_ATARI_ST_US = 300;
{ C64 lower case charset }
CHARSET_PETSCII_C64_LC = 301;
{ IBM Codepage 437 charset }
CHARSET_CODEPAGE_437 = 400;
{ Windows Codepage 1252 charset }
CHARSET_CODEPAGE_1252 = 401;
{
client related stuff
}
type
PxadForeman = ^txadForeman;
txadForeman = record
xfm_Security : ULONG; { should be XADFOREMAN_SECURITY }
xfm_ID : ULONG; { must be XADFOREMAN_ID }
xfm_Version : UWORD; { set to XADFOREMAN_VERSION }
xfm_Reserved : UWORD;
xfm_VersString : STRPTR; { pointer to $VER: string }
xfm_FirstClient : PxadClient; { pointer to first client }
end;
{ MOVEQ #-1,D0 and RTS }
const
XADFOREMAN_SECURITY = $70FF4E75;
{ 'XADF' identification ID }
XADFOREMAN_ID = $58414446;
XADFOREMAN_VERSION = 1;
const
XADCLIENT_VERSION = 1;
{ archiver is a file archiver }
XADCB_FILEARCHIVER = 0;
{ archiver is a disk archiver }
XADCB_DISKARCHIVER = 1;
{ external client, set by xadmaster }
XADCB_EXTERN = 2;
{ filesystem clients (V5) }
XADCB_FILESYSTEM = 3;
{ do not check size for recog call (V6) }
XADCB_NOCHECKSIZE = 4;
{ file archiver is plain data file (V11) }
XADCB_DATACRUNCHER = 5;
{ file archiver is executable file (V11) }
XADCB_EXECRUNCHER = 6;
{ file archiver is address crunched file (V11) }
XADCB_ADDRESSCRUNCHER = 7;
{ file archiver is a linker file (V11) }
XADCB_LINKER = 8;
{ master frees XAD strings (V12) }
XADCB_FREEXADSTRINGS = 25;
{ master frees xadSpecial structures (V11) }
XADCB_FREESPECIALINFO = 26;
{ master frees xadSkipInfo structures (V3) }
XADCB_FREESKIPINFO = 27;
{ master frees xadTextInfo structures (V2) }
XADCB_FREETEXTINFO = 28;
{ master frees xadTextInfo text block (V2) }
XADCB_FREETEXTINFOTEXT = 29;
{ master frees xadFileInfo structures (V2) }
XADCB_FREEFILEINFO = 30;
{ master frees xadDiskInfo structures (V2) }
XADCB_FREEDISKINFO = 31;
XADCF_FILEARCHIVER = 1 shl XADCB_FILEARCHIVER;
XADCF_DISKARCHIVER = 1 shl XADCB_DISKARCHIVER;
XADCF_EXTERN = 1 shl XADCB_EXTERN;
XADCF_FILESYSTEM = 1 shl XADCB_FILESYSTEM;
XADCF_NOCHECKSIZE = 1 shl XADCB_NOCHECKSIZE;
XADCF_DATACRUNCHER = 1 shl XADCB_DATACRUNCHER;
XADCF_EXECRUNCHER = 1 shl XADCB_EXECRUNCHER;
XADCF_ADDRESSCRUNCHER = 1 shl XADCB_ADDRESSCRUNCHER;
XADCF_LINKER = 1 shl XADCB_LINKER;
XADCF_FREEXADSTRINGS = 1 shl XADCB_FREEXADSTRINGS;
XADCF_FREESPECIALINFO = 1 shl XADCB_FREESPECIALINFO;
XADCF_FREESKIPINFO = 1 shl XADCB_FREESKIPINFO;
XADCF_FREETEXTINFO = 1 shl XADCB_FREETEXTINFO;
XADCF_FREETEXTINFOTEXT = 1 shl XADCB_FREETEXTINFOTEXT;
XADCF_FREEFILEINFO = 1 shl XADCB_FREEFILEINFO;
XADCF_FREEDISKINFO = 1 shl XADCB_FREEDISKINFO;
{ The types 5 to 9 always need XADCB_FILEARCHIVER set also. These only specify
the type of the archiver somewhat better. Do not mix real archivers and these
single file data clients. }
{
client ID's
}
{ If an external client has set the xc_Identifier field, the internal
client is replaced. }
{ disk archivers start with 1000 }
XADCID_XMASH = 1000;
XADCID_SUPERDUPER3 = 1001;
XADCID_XDISK = 1002;
XADCID_PACKDEV = 1003;
XADCID_ZOOM = 1004;
XADCID_ZOOM5 = 1005;
XADCID_CRUNCHDISK = 1006;
XADCID_PACKDISK = 1007;
XADCID_MDC = 1008;
XADCID_COMPDISK = 1009;
XADCID_LHWARP = 1010;
XADCID_SAVAGECOMPRESSOR = 1011;
XADCID_WARP = 1012;
XADCID_GDC = 1013;
XADCID_DCS = 1014;
{ file archivers start with 5000 }
XADCID_TAR = 5000;
XADCID_SDSSFX = 5001;
XADCID_LZX = 5002;
XADCID_MXMSIMPLEARC = 5003;
XADCID_LHPAK = 5004;
XADCID_AMIGAPLUSUNPACK = 5005;
XADCID_AMIPACK = 5006;
XADCID_LHA = 5007;
XADCID_LHASFX = 5008;
XADCID_PCOMPARC = 5009;
XADCID_SOMNI = 5010;
XADCID_LHSFX = 5011;
XADCID_XPKARCHIVE = 5012;
XADCID_SHRINK = 5013;
XADCID_SPACK = 5014;
XADCID_SPACKSFX = 5015;
XADCID_ZIP = 5016;
XADCID_WINZIPEXE = 5017;
XADCID_GZIP = 5018;
XADCID_ARC = 5019;
XADCID_ZOO = 5020;
XADCID_LHAEXE = 5021;
XADCID_ARJ = 5022;
XADCID_ARJEXE = 5023;
XADCID_ZIPEXE = 5024;
XADCID_LHF = 5025;
XADCID_COMPRESS = 5026;
XADCID_ACE = 5027;
XADCID_ACEEXE = 5028;
XADCID_GZIPSFX = 5029;
XADCID_HA = 5030;
XADCID_SQ = 5031;
XADCID_LHAC64SFX = 5032;
XADCID_SIT = 5033;
XADCID_SIT5 = 5034;
XADCID_SIT5EXE = 5035;
XADCID_MACBINARY = 5036;
XADCID_CPIO = 5037;
XADCID_PACKIT = 5038;
{ filesystem client start with 8000 }
XADCID_FSAMIGA = 8000;
XADCID_FSSANITYOS = 8001;
XADCID_FSFAT = 8002;
{ mixed archivers start with 9000 }
XADCID_DMS = 9000;
XADCID_DMSSFX = 9001;
VAR xadMasterBase : pxadMasterBase;
FUNCTION xadAddDiskEntryA(di : pxadDiskInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadAddFileEntryA(fi : pxadFileInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadAllocObjectA(_type : LONGINT; CONST tags : pTagItem) : POINTER;
FUNCTION xadAllocVec(size : longword; flags : longword) : POINTER;
FUNCTION xadCalcCRC16(id : longword; init : longword; size : longword; buffer : pCHAR) : WORD;
FUNCTION xadCalcCRC32(id : longword; init : longword; size : longword; buffer : pCHAR) : longword;
FUNCTION xadConvertDatesA(CONST tags : pTagItem) : LONGINT;
FUNCTION xadConvertNameA(charset : longword; CONST tags : pTagItem) : pCHAR;
FUNCTION xadConvertProtectionA(CONST tags : pTagItem) : LONGINT;
PROCEDURE xadCopyMem(src : POINTER; dest : POINTER; size : longword);
FUNCTION xadDiskFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadDiskUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadFreeHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
PROCEDURE xadFreeInfo(ai : pxadArchiveInfo);
PROCEDURE xadFreeObjectA(obj : POINTER; CONST tags : pTagItem);
FUNCTION xadGetClientInfo : pxadClient;
FUNCTION xadGetDiskInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadGetErrorText(errnum : longword) : pCHAR;
FUNCTION xadGetFilenameA(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; CONST tags : pTagItem) : LONGINT;
FUNCTION xadGetHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadGetInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadHookAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo) : LONGINT;
FUNCTION xadHookTagAccessA(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
FUNCTION xadRecogFileA(size : longword; memory : POINTER; CONST tags : pTagItem) : pxadClient;
{
Functions and procedures with array of const go here
}
FUNCTION xadAddDiskEntry(di : pxadDiskInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadAddFileEntry(fi : pxadFileInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadAllocObject(_type : LONGINT; const tags : Array Of Const) : POINTER;
FUNCTION xadConvertDates(const tags : Array Of Const) : LONGINT;
FUNCTION xadConvertName(charset : longword; const tags : Array Of Const) : pCHAR;
FUNCTION xadConvertProtection(const tags : Array Of Const) : LONGINT;
FUNCTION xadDiskFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadDiskUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadFreeHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
PROCEDURE xadFreeObject(obj : POINTER; const tags : Array Of Const);
FUNCTION xadGetDiskInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadGetFilename(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; const tags : Array Of Const) : LONGINT;
FUNCTION xadGetHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadGetInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadHookTagAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
FUNCTION xadRecogFile(size : longword; memory : POINTER; const tags : Array Of Const) : pxadClient;
{You can remove this include and use a define instead}
{$I useautoopenlib.inc}
{$ifdef use_init_openlib}
procedure InitXADMASTERLibrary;
{$endif use_init_openlib}
{This is a variable that knows how the unit is compiled}
var
XADMASTERIsCompiledHow : longint;
IMPLEMENTATION
uses
{$ifndef dont_use_openlib}
msgbox,
{$endif dont_use_openlib}
tagsarray;
FUNCTION xadAddDiskEntryA(di : pxadDiskInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L di,A0
MOVEA.L ai,A1
MOVEA.L tags,A2
MOVEA.L xadMasterBase,A6
JSR -162(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadAddFileEntryA(fi : pxadFileInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L fi,A0
MOVEA.L ai,A1
MOVEA.L tags,A2
MOVEA.L xadMasterBase,A6
JSR -156(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadAllocObjectA(_type : LONGINT; CONST tags : pTagItem) : POINTER;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L _type,D0
MOVEA.L tags,A0
MOVEA.L xadMasterBase,A6
JSR -030(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadAllocVec(size : longword; flags : longword) : POINTER;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L size,D0
MOVE.L flags,D1
MOVEA.L xadMasterBase,A6
JSR -108(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadCalcCRC16(id : longword; init : longword; size : longword; buffer : pCHAR) : WORD;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L id,D0
MOVE.L init,D1
MOVE.L size,D2
MOVEA.L buffer,A0
MOVEA.L xadMasterBase,A6
JSR -096(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadCalcCRC32(id : longword; init : longword; size : longword; buffer : pCHAR) : longword;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L id,D0
MOVE.L init,D1
MOVE.L size,D2
MOVEA.L buffer,A0
MOVEA.L xadMasterBase,A6
JSR -102(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadConvertDatesA(CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L tags,A0
MOVEA.L xadMasterBase,A6
JSR -090(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadConvertNameA(charset : longword; CONST tags : pTagItem) : pCHAR;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L charset,D0
MOVEA.L tags,A0
MOVEA.L xadMasterBase,A6
JSR -174(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadConvertProtectionA(CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L tags,A0
MOVEA.L xadMasterBase,A6
JSR -126(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
PROCEDURE xadCopyMem(src : POINTER; dest : POINTER; size : longword);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L src,A0
MOVEA.L dest,A1
MOVE.L size,D0
MOVEA.L xadMasterBase,A6
JSR -114(A6)
MOVEA.L (A7)+,A6
END;
END;
FUNCTION xadDiskFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -138(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadDiskUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -066(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -060(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadFreeHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -150(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
PROCEDURE xadFreeInfo(ai : pxadArchiveInfo);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L xadMasterBase,A6
JSR -054(A6)
MOVEA.L (A7)+,A6
END;
END;
PROCEDURE xadFreeObjectA(obj : POINTER; CONST tags : pTagItem);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L obj,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -036(A6)
MOVEA.L (A7)+,A6
END;
END;
FUNCTION xadGetClientInfo : pxadClient;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L xadMasterBase,A6
JSR -078(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadGetDiskInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -132(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadGetErrorText(errnum : longword) : pCHAR;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L errnum,D0
MOVEA.L xadMasterBase,A6
JSR -072(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadGetFilenameA(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L buffersize,D0
MOVEA.L buffer,A0
MOVEA.L path,A1
MOVEA.L name,A2
MOVEA.L tags,A3
MOVEA.L xadMasterBase,A6
JSR -168(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadGetHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -144(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadGetInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L ai,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -048(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadHookAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L command,D0
MOVE.L data,D1
MOVEA.L buffer,A0
MOVEA.L ai,A1
MOVEA.L xadMasterBase,A6
JSR -084(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadHookTagAccessA(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L command,D0
MOVE.L data,D1
MOVEA.L buffer,A0
MOVEA.L ai,A1
MOVEA.L tags,A2
MOVEA.L xadMasterBase,A6
JSR -120(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
FUNCTION xadRecogFileA(size : longword; memory : POINTER; CONST tags : pTagItem) : pxadClient;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVE.L size,D0
MOVEA.L memory,A0
MOVEA.L tags,A1
MOVEA.L xadMasterBase,A6
JSR -042(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
{
Functions and procedures with array of const go here
}
FUNCTION xadAddDiskEntry(di : pxadDiskInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadAddDiskEntry := xadAddDiskEntryA(di , ai , readintags(tags));
end;
FUNCTION xadAddFileEntry(fi : pxadFileInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadAddFileEntry := xadAddFileEntryA(fi , ai , readintags(tags));
end;
FUNCTION xadAllocObject(_type : LONGINT; const tags : Array Of Const) : POINTER;
begin
xadAllocObject := xadAllocObjectA(_type , readintags(tags));
end;
FUNCTION xadConvertDates(const tags : Array Of Const) : LONGINT;
begin
xadConvertDates := xadConvertDatesA(readintags(tags));
end;
FUNCTION xadConvertName(charset : longword; const tags : Array Of Const) : pCHAR;
begin
xadConvertName := xadConvertNameA(charset , readintags(tags));
end;
FUNCTION xadConvertProtection(const tags : Array Of Const) : LONGINT;
begin
xadConvertProtection := xadConvertProtectionA(readintags(tags));
end;
FUNCTION xadDiskFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadDiskFileUnArc := xadDiskFileUnArcA(ai , readintags(tags));
end;
FUNCTION xadDiskUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadDiskUnArc := xadDiskUnArcA(ai , readintags(tags));
end;
FUNCTION xadFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadFileUnArc := xadFileUnArcA(ai , readintags(tags));
end;
FUNCTION xadFreeHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadFreeHookAccess := xadFreeHookAccessA(ai , readintags(tags));
end;
PROCEDURE xadFreeObject(obj : POINTER; const tags : Array Of Const);
begin
xadFreeObjectA(obj , readintags(tags));
end;
FUNCTION xadGetDiskInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadGetDiskInfo := xadGetDiskInfoA(ai , readintags(tags));
end;
FUNCTION xadGetFilename(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; const tags : Array Of Const) : LONGINT;
begin
xadGetFilename := xadGetFilenameA(buffersize , buffer , path , name , readintags(tags));
end;
FUNCTION xadGetHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadGetHookAccess := xadGetHookAccessA(ai , readintags(tags));
end;
FUNCTION xadGetInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadGetInfo := xadGetInfoA(ai , readintags(tags));
end;
FUNCTION xadHookTagAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
begin
xadHookTagAccess := xadHookTagAccessA(command , data , buffer , ai , readintags(tags));
end;
FUNCTION xadRecogFile(size : longword; memory : POINTER; const tags : Array Of Const) : pxadClient;
begin
xadRecogFile := xadRecogFileA(size , memory , readintags(tags));
end;
const
{ Change VERSION and LIBVERSION to proper values }
VERSION : string[2] = '0';
LIBVERSION : longword = 0;
{$ifdef use_init_openlib}
{$Info Compiling initopening of xadmaster.library}
{$Info don't forget to use InitXADMASTERLibrary in the beginning of your program}
var
xadmaster_exit : Pointer;
procedure ClosexadmasterLibrary;
begin
ExitProc := xadmaster_exit;
if xadMasterBase <> nil then begin
CloseLibrary(pLibrary(xadMasterBase));
xadMasterBase := nil;
end;
end;
procedure InitXADMASTERLibrary;
begin
xadMasterBase := nil;
xadMasterBase := pxadMasterBase(OpenLibrary(XADMASTERNAME,LIBVERSION));
if xadMasterBase <> nil then begin
xadmaster_exit := ExitProc;
ExitProc := @ClosexadmasterLibrary;
end else begin
MessageBox('FPC Pascal Error',
'Can''t open xadmaster.library version ' + VERSION + #10 +
'Deallocating resources and closing down',
'Oops');
halt(20);
end;
end;
begin
XADMASTERIsCompiledHow := 2;
{$endif use_init_openlib}
{$ifdef use_auto_openlib}
{$Info Compiling autoopening of xadmaster.library}
var
xadmaster_exit : Pointer;
procedure ClosexadmasterLibrary;
begin
ExitProc := xadmaster_exit;
if xadMasterBase <> nil then begin
CloseLibrary(pLibrary(xadMasterBase));
xadMasterBase := nil;
end;
end;
begin
xadMasterBase := nil;
xadMasterBase := pxadMasterBase(OpenLibrary(XADMASTERNAME,LIBVERSION));
if xadMasterBase <> nil then begin
xadmaster_exit := ExitProc;
ExitProc := @ClosexadmasterLibrary;
XADMASTERIsCompiledHow := 1;
end else begin
MessageBox('FPC Pascal Error',
'Can''t open xadmaster.library version ' + VERSION + #10 +
'Deallocating resources and closing down',
'Oops');
halt(20);
end;
{$endif use_auto_openlib}
{$ifdef dont_use_openlib}
begin
XADMASTERIsCompiledHow := 3;
{$Warning No autoopening of xadmaster.library compiled}
{$Warning Make sure you open xadmaster.library yourself}
{$endif dont_use_openlib}
END. (* UNIT XADMASTER *)
|