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
|
{
This file is part of the Free Pascal run time library.
A file in Amiga system run time library.
Copyright (c) 1998-2003 by Nils Sjoholm
member of the Amiga RTL development team.
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.
**********************************************************************}
{
History:
Added functions and procedures with array of const.
For use with fpc 1.0.7. Thay are in systemvartags.
11 Nov 2002.
Added the define use_amiga_smartlink.
13 Jan 2003.
Update for AmigaOS 3.9.
Added a few overlays.
06 Feb 2003.
nils.sjoholm@mailbox.swipnet.se
}
{$I useamigasmartlink.inc}
{$ifdef use_amiga_smartlink}
{$smartlink on}
{$endif use_amiga_smartlink}
unit utility;
INTERFACE
uses exec;
Type
pClockData = ^tClockData;
tClockData = record
sec : Word;
min : Word;
hour : Word;
mday : Word;
month : Word;
year : Word;
wday : Word;
END;
pHook = ^tHook;
tHook = record
h_MinNode : tMinNode;
h_Entry : Pointer; { assembler entry point }
h_SubEntry : Pointer; { often HLL entry point }
h_Data : Pointer; { owner specific }
END;
{
* Hook calling conventions:
* A0 - pointer to hook data structure itself
* A1 - pointer to parameter structure ("message") typically
* beginning with a longword command code, which makes
* sense in the context in which the hook is being used.
* A2 - Hook specific address data ("object," e.g, GadgetInfo)
*
* Control will be passed to the routine h_Entry. For many
* High-Level Languages (HLL), this will be an assembly language
* stub which pushes registers on the stack, does other setup,
* and then calls the function at h_SubEntry.
*
* The C standard receiving code is:
* CDispatcher( hook, object, message )
* struct Hook *hook;
* APTR object;
* APTR message;
*
* NOTE that register natural order differs from this convention
* for C parameter order, which is A0,A2,A1.
*
* The assembly language stub for "vanilla" C parameter conventions
* could be:
_hookEntry:
move.l a1,-(sp) ; push message packet pointer
move.l a2,-(sp) ; push object pointer
move.l a0,-(sp) ; push hook pointer
move.l h_SubEntry(a0),a0 ; fetch C entry point ...
jsr (a0) ; ... and call it
lea 12(sp),sp ; fix stack
rts
* with this function as your interface stub, you can write
* a Hook setup function as:
SetupHook( hook, c_function, userdata )
struct Hook *hook;
ULONG (*c_function)();
VOID *userdata;
ULONG (*hookEntry)();
hook->h_Entry = hookEntry;
hook->h_SubEntry = c_function;
hook->h_Data = userdata;
* with Lattice C pragmas, you can put the C function in the
* h_Entry field directly if you declare the function:
ULONG __saveds __asm
CDispatcher( register __a0 struct Hook *hook,
register __a2 VOID *object,
register __a1 ULONG *message );
*
***}
{ Namespace definitions }
Type
{ The named object structure }
pNamedObject = ^tNamedObject;
tNamedObject = record
no_Object : Pointer; { Your pointer, for whatever you want }
END;
const
{ Tags for AllocNamedObject() }
ANO_NameSpace = 4000; { Tag to define namespace }
ANO_UserSpace = 4001; { tag to define userspace }
ANO_Priority = 4002; { tag to define priority }
ANO_Flags = 4003; { tag to define flags }
{ Flags for tag ANO_Flags }
NSB_NODUPS = 0;
NSB_CASE = 1;
NSF_NODUPS = 1; { Default allow duplicates }
NSF_CASE = 2; { Default to caseless... }
{ Control attributes for Pack/UnpackStructureTags() }
{ PackTable definition:
*
* The PackTable is a simple array of LONGWORDS that are evaluated by
* PackStructureTags() and UnpackStructureTags().
*
* The table contains compressed information such as the tag offset from
* the base tag. The tag offset has a limited range so the base tag is
* defined in the first longword.
*
* After the first longword, the fields look as follows:
*
* +--------- 1 = signed, 0 = unsigned (for bits, 1=inverted boolean)
* |
* | +------ 00 = Pack/Unpack, 10 = Pack, 01 = Unpack, 11 = special
* | / \
* | | | +-- 00 = Byte, 01 = Integer, 10 = Long, 11 = Bit
* | | | / \
* | | | | | /----- For bit operations: 1 = TAG_EXISTS is TRUE
* | | | | | |
* | | | | | | /-------------------- Tag offset from base tag value
* | | | | | | | \
* m n n o o p q q q q q q q q q q r r r s s s s s s s s s s s s s
* \ | | |
* Bit offset (for bit operations) ----/ | |
* \ |
* Offset into data structure -----------------------------------/
*
* A -1 longword signifies that the next longword will be a new base tag
*
* A 0 longword signifies that it is the end of the pack table.
*
* What this implies is that there are only 13-bits of address offset
* and 10 bits for tag offsets from the base tag. For most uses this
* should be enough, but when this is not, either multiple pack tables
* or a pack table with extra base tags would be able to do the trick.
* The goal here was to make the tables small and yet flexible enough to
* handle most cases.
}
const
PSTB_SIGNED =31;
PSTB_UNPACK =30; { Note that these are active low... }
PSTB_PACK =29; { Note that these are active low... }
PSTB_EXISTS =26; { Tag exists bit true flag hack... }
PSTF_SIGNED = $80000000;
PSTF_UNPACK = $40000000;
PSTF_PACK = $20000000;
PSTF_EXISTS = $4000000;
{***************************************************************************}
PKCTRL_PACKUNPACK = $00000000;
PKCTRL_PACKONLY = $40000000;
PKCTRL_UNPACKONLY = $20000000;
PKCTRL_BYTE = $80000000;
PKCTRL_WORD = $88000000;
PKCTRL_LONG = $90000000;
PKCTRL_UBYTE = $00000000;
PKCTRL_UWORD = $08000000;
PKCTRL_ULONG = $10000000;
PKCTRL_BIT = $18000000;
PKCTRL_FLIPBIT = $98000000;
{***************************************************************************}
{ Macros used by the next batch of macros below. Normally, you don't use
* this batch directly. Then again, some folks are wierd
}
{***************************************************************************}
{ Some handy dandy macros to easily create pack tables
*
* Use PACK_STARTTABLE() at the start of a pack table. You pass it the
* base tag value that will be handled in the following chunk of the pack
* table.
*
* PACK_ENDTABLE() is used to mark the end of a pack table.
*
* PACK_NEWOFFSET() lets you change the base tag value used for subsequent
* entries in the table
*
* PACK_ENTRY() lets you define an entry in the pack table. You pass it the
* base tag value, the tag of interest, the type of the structure to use,
* the field name in the structure to affect and control bits (combinations of
* the various PKCTRL_XXX bits)
*
* PACK_BYTEBIT() lets you define a bit-control entry in the pack table. You
* pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag
* affects. This macro should be used when the field being affected is byte
* sized.
*
* PACK_WORDBIT() lets you define a bit-control entry in the pack table. You
* pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag
* affects. This macro should be used when the field being affected is Integer
* sized.
*
* PACK_LONGBIT() lets you define a bit-control entry in the pack table. You
* pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag
* affects. This macro should be used when the field being affected is longword
* sized.
*
* EXAMPLE:
*
* ULONG packTable[] =
* (
* PACK_STARTTABLE(GA_Dummy),
* PACK_ENTRY(GA_Dummy,GA_Left,Gadget,LeftEdge,PKCTRL_WORD|PKCTRL_PACKUNPACK),
* PACK_ENTRY(GA_Dummy,GA_Top,Gadget,TopEdge,PKCTRL_WORD|PKCTRL_PACKUNPACK),
* PACK_ENTRY(GA_Dummy,GA_Width,Gadget,Width,PKCTRL_UWORD|PKCTRL_PACKUNPACK),
* PACK_ENTRY(GA_Dummy,GA_Height,Gadget,Height,PKCTRL_UWORD|PKCTRL_PACKUNPACK),
* PACK_WORDBIT(GA_Dummy,GA_RelVerify,Gadget,Activation,PKCTRL_BIT|PKCTRL_PACKUNPACK,GACT_RELVERIFY)
* PACK_ENDTABLE
* );
}
{ ======================================================================= }
{ ==== TagItem ========================================================== }
{ ======================================================================= }
{ This data type may propagate through the system for more general use.
* In the meantime, it is used as a general mechanism of extensible data
* arrays for parameter specification and property inquiry (coming soon
* to a display controller near you).
*
* In practice, an array (or chain of arrays) of TagItems is used.
}
Type
Tag = LongInt;
pTag = ^Tag;
pTagItem = ^tTagItem;
tTagItem = record
ti_Tag : Tag;
ti_Data : LongInt;
END;
ppTagItem = ^pTagItem;
{ ---- system tag values ----------------------------- }
CONST
TAG_DONE = 0; { terminates array of TagItems. ti_Data unused }
TAG_END = TAG_DONE;
TAG_IGNORE = 1; { ignore this item, not END of array }
TAG_MORE = 2; { ti_Data is pointer to another array of TagItems
* note that this tag terminates the current array
}
TAG_SKIP = 3; { skip this AND the next ti_Data items }
{ differentiates user tags from control tags }
TAG_USER = $80000000; { differentiates user tags from system tags}
{* If the TAG_USER bit is set in a tag number, it tells utility.library that
* the tag is not a control tag (like TAG_DONE, TAG_IGNORE, TAG_MORE) and is
* instead an application tag. "USER" means a client of utility.library in
* general, including system code like Intuition or ASL, it has nothing to do
* with user code.
*}
{ Tag filter logic specifiers for use with FilterTagItems() }
TAGFILTER_AND = 0; { exclude everything but filter hits }
TAGFILTER_NOT = 1; { exclude only filter hits }
{ Mapping types for use with MapTags() }
MAP_REMOVE_NOT_FOUND = 0; { remove tags that aren't in mapList }
MAP_KEEP_NOT_FOUND = 1; { keep tags that aren't in mapList }
Type
pUtilityBase = ^tUtilityBase;
tUtilityBase = record
ub_LibNode : tLibrary;
ub_Language : Byte;
ub_Reserved : Byte;
END;
function AddNamedObject(nameSpace,obj : pNamedObject) : Boolean;
function AllocateTagItems(num : ULONG) : pTagItem;
function AllocNamedObjectA(const name : STRPTR;const TagList : pTagItem) : pNamedObject;
procedure Amiga2Date(amigatime : ULONG;resultat : pClockData);
procedure ApplyTagChanges(TagList : pTagItem; const ChangeList : pTagItem);
function AttemptRemNamedObject(obj : pNamedObject) : LongInt;
function CallHookPkt(h : pHook;obj, paramPkt : APTR) : ULONG;
function CheckDate(const date : pClockData) : ULONG;
function CloneTagItems(const tagList : pTagItem) : pTagItem;
function Date2Amiga(const date : pClockData) : ULONG;
procedure FilterTagChanges(changelist, oldvalues : pTagItem;apply : ULONG);
function FilterTagItems(taglist : pTagItem ;const tagArray : pULONG;logic : ULONG) : ULONG;
function FindNamedObject(nameSpace : pNamedObject;const name : STRPTR;lastobject: pNamedObject) : pNamedObject;
function FindTagItem(TagVal : Tag;const TagList : pTagItem) : pTagItem;
procedure FreeNamedObject(Obj : pNamedObject);
procedure FreeTagItems(TagList : pTagItem);
function GetTagData(tagval : Tag;default : ULONG;const TagList : pTagItem) : ULONG;
function GetUniqueID : ULONG;
procedure MapTags(TagList : pTagItem;const maplist : pTagItem;IncludeMiss : ULONG);
function NamedObjectName(Obj : pNamedObject) : STRPTR;
function NextTagItem(Item : ppTagItem) : pTagItem;
function PackBoolTags(InitialFlags : ULONG;const TagList, boolmap : pTagItem) : ULONG;
function PackStructureTags(packk: APTR;const packTable : pULONG;const TagList : pTagItem) : ULONG;
procedure RefreshTagItemClones(cloneTagItem : pTagItem; const OriginalTagItems : pTagItem);
procedure ReleaseNamedObject(Obj : pNamedObject);
procedure RemNamedObject(Obj : pNamedObject;Msg : pointer);
function SDivMod32( dividend , divisor : LongInt) : LongInt;
function SMult32(Arg1, Arg2 : LongInt) : LongInt;
function SMult64(Arg1, Arg2 : LongInt) : LongInt;
function Stricmp(const Str1: STRPTR;const Str2 : STRPTR) : LongInt;
function Strnicmp(const Str1: STRPTR;const Str2 : STRPTR;len : LongInt) : LongInt;
function TagInArray(t : Tag;const TagArray : pULONG) : Boolean;
function ToLower(c : ULONG) : Char;
function ToUpper(c : ULONG) : Char;
function UDivMod32( dividend , divisor : ULONG) : ULONG;
function UMult32(Arg1, Arg2 : ULONG) : ULONG;
function UMult64(Arg1, Arg2 : ULONG) : ULONG;
function UnpackStructureTags(const pac: APTR;const packTable: pULONG;TagList : pTagItem) : ULONG;
function AllocNamedObjectA(const name : string;const TagList : pTagItem) : pNamedObject;
FUNCTION FindNamedObject(nameSpace : pNamedObject; CONST name : string; lastObject : pNamedObject) : pNamedObject;
FUNCTION Stricmp(CONST string1 : string; CONST string2 : pCHAR) : LONGINT;
FUNCTION Stricmp(CONST string1 : pCHAR; CONST string2 : string) : LONGINT;
FUNCTION Stricmp(CONST string1 : string; CONST string2 : string) : LONGINT;
FUNCTION Strnicmp(CONST string1 : string; CONST string2 : pCHAR; length : LONGINT) : LONGINT;
FUNCTION Strnicmp(CONST string1 : pCHAR; CONST string2 : string; length : LONGINT) : LONGINT;
FUNCTION Strnicmp(CONST string1 : string; CONST string2 : string; length : LONGINT) : LONGINT;
IMPLEMENTATION
uses pastoc;
function AddNamedObject(nameSpace,obj : pNamedObject) : Boolean;
begin
asm
MOVE.L A6,-(A7)
MOVE.L nameSpace,a0
MOVE.L obj,a1
MOVE.L _UtilityBase,A6
JSR -222(A6)
MOVE.L (A7)+,A6
TST.L d0
bne @success
bra @end
@success:
move.b #1,d0
@end:
move.b d0,@RESULT
end;
end;
function AllocateTagItems(num : ULONG) : pTagItem;
begin
asm
MOVE.L A6,-(A7)
MOVE.L num,d0
MOVE.L _UtilityBase,A6
JSR -066(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function AllocNamedObjectA(const name : STRPTR;const TagList : pTagItem) : pNamedObject;
begin
asm
MOVE.L A6,-(A7)
MOVE.L name,a0
MOVE.L TagList,a1
MOVE.L _UtilityBase,A6
JSR -228(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
procedure Amiga2Date(amigatime : ULONG;resultat : pClockData);
begin
asm
MOVE.L A6,-(A7)
MOVE.L amigatime,d0
MOVE.L resultat,a0
MOVE.L _UtilityBase,A6
JSR -120(A6)
MOVE.L (A7)+,A6
end;
end;
procedure ApplyTagChanges(TagList : pTagItem;const ChangeList : pTagItem);
begin
asm
MOVE.L A6,-(A7)
MOVE.L TagList,a0
MOVE.L ChangeList,a1
MOVE.L _UtilityBase,A6
JSR -186(A6)
MOVE.L (A7)+,A6
end;
end;
function AttemptRemNamedObject(obj : pNamedObject) : LongInt;
begin
asm
MOVE.L A6,-(A7)
MOVE.L obj,a0
MOVE.L _UtilityBase,A6
JSR -234(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function CallHookPkt(h : pHook;obj, paramPkt : APTR) : ULONG;
begin
asm
MOVEM.L a2/a6,-(A7)
MOVE.L h,a0
MOVE.L obj,a2
MOVE.L paramPkt,a1
MOVE.L _UtilityBase,A6
JSR -102(A6)
MOVEM.L (A7)+,a2/a6
MOVE.L d0,@RESULT
end;
end;
function CheckDate(const date : pClockData) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L date,a0
MOVE.L _UtilityBase,A6
JSR -132(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function CloneTagItems(const tagList : pTagItem) : pTagItem;
begin
asm
MOVE.L A6,-(A7)
MOVE.L taglist,a0
MOVE.L _UtilityBase,A6
JSR -072(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function Date2Amiga(const date : pClockData) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L date,a0
MOVE.L _UtilityBase,A6
JSR -126(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
procedure FilterTagChanges(changelist, oldvalues : pTagItem;apply : ULONG);
begin
asm
MOVE.L A6,-(A7)
MOVE.L changelist,a0
MOVE.L oldvalues,a1
MOVE.L apply,d0
MOVE.L _UtilityBase,A6
JSR -054(A6)
MOVE.L (A7)+,A6
end;
end;
function FilterTagItems(taglist : pTagItem ;const tagArray : pULONG;logic : ULONG) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L taglist,a0
MOVE.L tagArray,a1
MOVE.L logic,d0
MOVE.L _UtilityBase,A6
JSR -096(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function FindNamedObject(nameSpace : pNamedObject;const name : STRPTR;lastobject: pNamedObject) : pNamedObject;
begin
asm
MOVEM.L a2/a6,-(A7)
MOVE.L nameSpace,a0
MOVE.L name,a1
MOVE.L lastobject,a2
MOVE.L _UtilityBase,A6
JSR -240(A6)
MOVEM.L (A7)+,a2/a6
MOVE.L d0,@RESULT
end;
end;
function FindTagItem(TagVal : Tag;const TagList : pTagItem) : pTagItem;
begin
asm
MOVE.L A6,-(A7)
MOVE.L TagVal,d0
MOVE.L TagList,a0
MOVE.L _UtilityBase,A6
JSR -030(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
procedure FreeNamedObject(Obj : pNamedObject);
begin
asm
MOVE.L A6,-(A7)
MOVE.L Obj,a0
MOVE.L _UtilityBase,A6
JSR -246(A6)
MOVE.L (A7)+,A6
end;
end;
procedure FreeTagItems(TagList : pTagItem);
begin
asm
MOVE.L A6,-(A7)
MOVE.L TagList,a0
MOVE.L _UtilityBase,A6
JSR -078(A6)
MOVE.L (A7)+,A6
end;
end;
function GetTagData(tagval : Tag;default : ULONG;const TagList : pTagItem) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L tagval,d0
MOVE.L default,d1
MOVE.L TagList,a0
MOVE.L _UtilityBase,A6
JSR -036(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function GetUniqueID : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L _UtilityBase,A6
JSR -270(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
procedure MapTags(TagList : pTagItem;const maplist : pTagItem;IncludeMiss : ULONG);
begin
asm
MOVE.L A6,-(A7)
MOVE.L TagList,a0
MOVE.L maplist,a1
MOVE.L IncludeMiss,d0
MOVE.L _UtilityBase,A6
JSR -060(A6)
MOVE.L (A7)+,A6
end;
end;
function NamedObjectName(Obj : pNamedObject) : STRPTR;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Obj,a0
MOVE.L _UtilityBase,A6
JSR -252(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function NextTagItem(Item : ppTagItem) : pTagItem;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Item,a0
MOVE.L _UtilityBase,A6
JSR -048(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function PackBoolTags(InitialFlags : ULONG;const TagList, boolmap : pTagItem) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L InitialFlags,d0
MOVE.L TagList,a0
MOVE.L boolmap,a1
MOVE.L _UtilityBase,A6
JSR -042(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function PackStructureTags(packk: APTR;const packTable : pULONG;const TagList : pTagItem) : ULONG;
begin
asm
MOVEM.L a2/a6,-(A7)
MOVE.L packk,a0
MOVE.L packTable,a1
MOVE.L TagList,a2
MOVE.L _UtilityBase,A6
JSR -210(A6)
MOVEM.L (A7)+,a2/a6
MOVE.L d0,@RESULT
end;
end;
procedure RefreshTagItemClones(cloneTagItem : pTagItem; const OriginalTagItems : pTagItem);
begin
asm
MOVE.L A6,-(A7)
MOVE.L cloneTagItem,a0
MOVE.L OriginalTagItems,a1
MOVE.L _UtilityBase,A6
JSR -084(A6)
MOVE.L (A7)+,A6
end;
end;
procedure ReleaseNamedObject(Obj : pNamedObject);
begin
asm
MOVE.L A6,-(A7)
MOVE.L Obj,a0
MOVE.L _UtilityBase,A6
JSR -258(A6)
MOVE.L (A7)+,A6
end;
end;
procedure RemNamedObject(Obj : pNamedObject;Msg : pointer);
begin
asm
MOVE.L A6,-(A7)
MOVE.L Obj,a0
MOVE.L Msg,a1
MOVE.L _UtilityBase,A6
JSR -264(A6)
MOVE.L (A7)+,A6
end;
end;
function SDivMod32( dividend , divisor : LongInt) : LongInt;
begin
asm
MOVE.L A6,-(A7)
MOVE.L dividend,d0
MOVE.L divisor,d1
MOVE.L _UtilityBase,A6
JSR -150(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function SMult32(Arg1, Arg2 : LongInt) : LongInt;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Arg1,d0
MOVE.L Arg2,d1
MOVE.L _UtilityBase,A6
JSR -138(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function SMult64(Arg1, Arg2 : LongInt) : LongInt;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Arg1,d0
MOVE.L Arg2,d1
MOVE.L _UtilityBase,A6
JSR -198(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function Stricmp(const Str1: STRPTR;const Str2 : STRPTR) : LongInt;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Str1,a0
MOVE.L Str2,a1
MOVE.L _UtilityBase,A6
JSR -162(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function Strnicmp(const Str1: STRPTR;const Str2 : STRPTR;len : LongInt) : LongInt;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Str1,a0
MOVE.L Str2,a1
MOVE.L len,d0
MOVE.L _UtilityBase,A6
JSR -168(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function TagInArray(t : Tag;const TagArray : pULONG) : Boolean;
begin
asm
MOVE.L A6,-(A7)
MOVE.L t,d0
MOVE.L TagArray,a0
MOVE.L _UtilityBase,A6
JSR -090(A6)
MOVE.L (A7)+,A6
TST.L d0
bne @success
bra @end
@success:
move.b #1,d0
@end:
move.b d0,@RESULT
end;
end;
function ToLower(c : ULONG) : Char;
begin
asm
MOVE.L A6,-(A7)
MOVE.L c,d0
MOVE.L _UtilityBase,A6
JSR -180(A6)
MOVE.L (A7)+,A6
MOVE.B d0,@RESULT
end;
end;
function ToUpper(c : ULONG) : Char;
begin
asm
MOVE.L A6,-(A7)
MOVE.L c,d0
MOVE.L _UtilityBase,A6
JSR -174(A6)
MOVE.L (A7)+,A6
MOVE.B d0,@RESULT
end;
end;
function UDivMod32( dividend , divisor : ULONG) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L dividend,d0
MOVE.L divisor,d1
MOVE.L _UtilityBase,A6
JSR -156(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function UMult32(Arg1, Arg2 : ULONG) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Arg1,d0
MOVE.L Arg2,d1
MOVE.L _UtilityBase,A6
JSR -144(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function UMult64(Arg1, Arg2 : ULONG) : ULONG;
begin
asm
MOVE.L A6,-(A7)
MOVE.L Arg1,d0
MOVE.L Arg2,d1
MOVE.L _UtilityBase,A6
JSR -204(A6)
MOVE.L (A7)+,A6
MOVE.L d0,@RESULT
end;
end;
function UnpackStructureTags(const pac: APTR;const packTable: pULONG;TagList : pTagItem) : ULONG;
begin
asm
MOVEM.L a2/a6,-(A7)
MOVE.L pac,a0
MOVE.L packTable,a1
MOVE.L TagList,a2
MOVE.L _UtilityBase,A6
JSR -216(A6)
MOVEM.L (A7)+,a2/a6
MOVE.L d0,@RESULT
end;
end;
function AllocNamedObjectA(const name : string;const TagList : pTagItem) : pNamedObject;
begin
AllocNamedObjectA := AllocNamedObjectA(pas2c(name),TagList);
end;
FUNCTION FindNamedObject(nameSpace : pNamedObject; CONST name : string; lastObject : pNamedObject) : pNamedObject;
begin
FindNamedObject := FindNamedObject(nameSpace,pas2c(name),lastObject);
end;
FUNCTION Stricmp(CONST string1 : string; CONST string2 : pCHAR) : LONGINT;
begin
Stricmp := Stricmp(pas2c(string1),string2);
end;
FUNCTION Stricmp(CONST string1 : pCHAR; CONST string2 : string) : LONGINT;
begin
Stricmp := Stricmp(string1,pas2c(string2));
end;
FUNCTION Stricmp(CONST string1 : string; CONST string2 : string) : LONGINT;
begin
Stricmp := Stricmp(pas2c(string1),pas2c(string2));
end;
FUNCTION Strnicmp(CONST string1 : string; CONST string2 : pCHAR; length : LONGINT) : LONGINT;
begin
Strnicmp := Strnicmp(pas2c(string1),string2,length);
end;
FUNCTION Strnicmp(CONST string1 : pCHAR; CONST string2 : string; length : LONGINT) : LONGINT;
begin
Strnicmp := Strnicmp(string1,pas2c(string2),length);
end;
FUNCTION Strnicmp(CONST string1 : string; CONST string2 : string; length : LONGINT) : LONGINT;
begin
Strnicmp := Strnicmp(pas2c(string1),pas2c(string2),length);
end;
end.
|