Initial revision
[AROS-Contrib.git] / development / compilers / freepascal / rtl / aros / utility.pas
blob9e089a396e618acf43dd5910d02970f6552e611a
2 This file is part of the Free Pascal run time library.
4 A file in Amiga system run time library.
5 Copyright (c) 1998 by Nils Sjoholm
6 member of the Amiga RTL development team.
8 See the file COPYING.FPC, included in this distribution,
9 for details about the copyright.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 **********************************************************************}
17 unit utility;
19 INTERFACE
20 uses exec;
23 Type
24 pClockData = ^tClockData;
25 tClockData = record
26 sec : Word;
27 min : Word;
28 hour : Word;
29 mday : Word;
30 month : Word;
31 year : Word;
32 wday : Word;
33 END;
35 pHook = ^tHook;
36 tHook = record
37 h_MinNode : tMinNode;
38 h_Entry : Pointer; { assembler entry point }
39 h_SubEntry : Pointer; { often HLL entry point }
40 h_Data : Pointer; { owner specific }
41 END;
44 * Hook calling conventions:
45 * A0 - pointer to hook data structure itself
46 * A1 - pointer to parameter structure ("message") typically
47 * beginning with a longword command code, which makes
48 * sense in the context in which the hook is being used.
49 * A2 - Hook specific address data ("object," e.g, GadgetInfo)
51 * Control will be passed to the routine h_Entry. For many
52 * High-Level Languages (HLL), this will be an assembly language
53 * stub which pushes registers on the stack, does other setup,
54 * and then calls the function at h_SubEntry.
56 * The C standard receiving code is:
57 * CDispatcher( hook, object, message )
58 * struct Hook *hook;
59 * APTR object;
60 * APTR message;
62 * NOTE that register natural order differs from this convention
63 * for C parameter order, which is A0,A2,A1.
65 * The assembly language stub for "vanilla" C parameter conventions
66 * could be:
68 _hookEntry:
69 move.l a1,-(sp) ; push message packet pointer
70 move.l a2,-(sp) ; push object pointer
71 move.l a0,-(sp) ; push hook pointer
72 move.l h_SubEntry(a0),a0 ; fetch C entry point ...
73 jsr (a0) ; ... and call it
74 lea 12(sp),sp ; fix stack
75 rts
77 * with this function as your interface stub, you can write
78 * a Hook setup function as:
80 SetupHook( hook, c_function, userdata )
81 struct Hook *hook;
82 ULONG (*c_function)();
83 VOID *userdata;
85 ULONG (*hookEntry)();
87 hook->h_Entry = hookEntry;
88 hook->h_SubEntry = c_function;
89 hook->h_Data = userdata;
92 * with Lattice C pragmas, you can put the C function in the
93 * h_Entry field directly if you declare the function:
95 ULONG __saveds __asm
96 CDispatcher( register __a0 struct Hook *hook,
97 register __a2 VOID *object,
98 register __a1 ULONG *message );
100 ***}
102 { Namespace definitions }
105 Type
106 { The named object structure }
107 pNamedObject = ^tNamedObject;
108 tNamedObject = record
109 no_Object : Pointer; { Your pointer, for whatever you want }
110 END;
112 const
113 { Tags for AllocNamedObject() }
114 ANO_NameSpace = 4000; { Tag to define namespace }
115 ANO_UserSpace = 4001; { tag to define userspace }
116 ANO_Priority = 4002; { tag to define priority }
117 ANO_Flags = 4003; { tag to define flags }
119 { Flags for tag ANO_Flags }
120 NSB_NODUPS = 0;
121 NSB_CASE = 1;
123 NSF_NODUPS = 1; { Default allow duplicates }
124 NSF_CASE = 2; { Default to caseless... }
127 { Control attributes for Pack/UnpackStructureTags() }
130 { PackTable definition:
132 * The PackTable is a simple array of LONGWORDS that are evaluated by
133 * PackStructureTags() and UnpackStructureTags().
135 * The table contains compressed information such as the tag offset from
136 * the base tag. The tag offset has a limited range so the base tag is
137 * defined in the first longword.
139 * After the first longword, the fields look as follows:
141 * +--------- 1 = signed, 0 = unsigned (for bits, 1=inverted boolean)
143 * | +------ 00 = Pack/Unpack, 10 = Pack, 01 = Unpack, 11 = special
144 * | / \
145 * | | | +-- 00 = Byte, 01 = Integer, 10 = Long, 11 = Bit
146 * | | | / \
147 * | | | | | /----- For bit operations: 1 = TAG_EXISTS is TRUE
148 * | | | | | |
149 * | | | | | | /-------------------- Tag offset from base tag value
150 * | | | | | | | \
151 * 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
152 * \ | | |
153 * Bit offset (for bit operations) ----/ | |
154 * \ |
155 * Offset into data structure -----------------------------------/
157 * A -1 longword signifies that the next longword will be a new base tag
159 * A 0 longword signifies that it is the end of the pack table.
161 * What this implies is that there are only 13-bits of address offset
162 * and 10 bits for tag offsets from the base tag. For most uses this
163 * should be enough, but when this is not, either multiple pack tables
164 * or a pack table with extra base tags would be able to do the trick.
165 * The goal here was to make the tables small and yet flexible enough to
166 * handle most cases.
169 const
170 PSTB_SIGNED =31;
171 PSTB_UNPACK =30; { Note that these are active low... }
172 PSTB_PACK =29; { Note that these are active low... }
173 PSTB_EXISTS =26; { Tag exists bit true flag hack... }
175 PSTF_SIGNED = $80000000;
176 PSTF_UNPACK = $40000000;
177 PSTF_PACK = $20000000;
179 PSTF_EXISTS = $4000000;
182 {***************************************************************************}
185 PKCTRL_PACKUNPACK = $00000000;
186 PKCTRL_PACKONLY = $40000000;
187 PKCTRL_UNPACKONLY = $20000000;
189 PKCTRL_BYTE = $80000000;
190 PKCTRL_WORD = $88000000;
191 PKCTRL_LONG = $90000000;
193 PKCTRL_UBYTE = $00000000;
194 PKCTRL_UWORD = $08000000;
195 PKCTRL_ULONG = $10000000;
197 PKCTRL_BIT = $18000000;
198 PKCTRL_FLIPBIT = $98000000;
201 {***************************************************************************}
204 { Macros used by the next batch of macros below. Normally, you don't use
205 * this batch directly. Then again, some folks are wierd
210 {***************************************************************************}
213 { Some handy dandy macros to easily create pack tables
215 * Use PACK_STARTTABLE() at the start of a pack table. You pass it the
216 * base tag value that will be handled in the following chunk of the pack
217 * table.
219 * PACK_ENDTABLE() is used to mark the end of a pack table.
221 * PACK_NEWOFFSET() lets you change the base tag value used for subsequent
222 * entries in the table
224 * PACK_ENTRY() lets you define an entry in the pack table. You pass it the
225 * base tag value, the tag of interest, the type of the structure to use,
226 * the field name in the structure to affect and control bits (combinations of
227 * the various PKCTRL_XXX bits)
229 * PACK_BYTEBIT() lets you define a bit-control entry in the pack table. You
230 * pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag
231 * affects. This macro should be used when the field being affected is byte
232 * sized.
234 * PACK_WORDBIT() lets you define a bit-control entry in the pack table. You
235 * pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag
236 * affects. This macro should be used when the field being affected is Integer
237 * sized.
239 * PACK_LONGBIT() lets you define a bit-control entry in the pack table. You
240 * pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag
241 * affects. This macro should be used when the field being affected is longword
242 * sized.
244 * EXAMPLE:
246 * ULONG packTable[] =
248 * PACK_STARTTABLE(GA_Dummy),
249 * PACK_ENTRY(GA_Dummy,GA_Left,Gadget,LeftEdge,PKCTRL_WORD|PKCTRL_PACKUNPACK),
250 * PACK_ENTRY(GA_Dummy,GA_Top,Gadget,TopEdge,PKCTRL_WORD|PKCTRL_PACKUNPACK),
251 * PACK_ENTRY(GA_Dummy,GA_Width,Gadget,Width,PKCTRL_UWORD|PKCTRL_PACKUNPACK),
252 * PACK_ENTRY(GA_Dummy,GA_Height,Gadget,Height,PKCTRL_UWORD|PKCTRL_PACKUNPACK),
253 * PACK_WORDBIT(GA_Dummy,GA_RelVerify,Gadget,Activation,PKCTRL_BIT|PKCTRL_PACKUNPACK,GACT_RELVERIFY)
254 * PACK_ENDTABLE
255 * );
259 { ======================================================================= }
260 { ==== TagItem ========================================================== }
261 { ======================================================================= }
262 { This data type may propagate through the system for more general use.
263 * In the meantime, it is used as a general mechanism of extensible data
264 * arrays for parameter specification and property inquiry (coming soon
265 * to a display controller near you).
267 * In practice, an array (or chain of arrays) of TagItems is used.
269 Type
270 Tag = LongInt;
271 pTag = ^Tag;
273 pTagItem = ^tTagItem;
274 tTagItem = record
275 ti_Tag : Tag;
276 ti_Data : LongInt;
277 END;
279 ppTagItem = ^pTagItem;
281 { ---- system tag values ----------------------------- }
282 CONST
283 TAG_DONE = 0; { terminates array of TagItems. ti_Data unused }
284 TAG_END = TAG_DONE;
285 TAG_IGNORE = 1; { ignore this item, not END of array }
286 TAG_MORE = 2; { ti_Data is pointer to another array of TagItems
287 * note that this tag terminates the current array
289 TAG_SKIP = 3; { skip this AND the next ti_Data items }
291 { differentiates user tags from control tags }
292 TAG_USER = $80000000; { differentiates user tags from system tags}
294 {* If the TAG_USER bit is set in a tag number, it tells utility.library that
295 * the tag is not a control tag (like TAG_DONE, TAG_IGNORE, TAG_MORE) and is
296 * instead an application tag. "USER" means a client of utility.library in
297 * general, including system code like Intuition or ASL, it has nothing to do
298 * with user code.
302 { Tag filter logic specifiers for use with FilterTagItems() }
303 TAGFILTER_AND = 0; { exclude everything but filter hits }
304 TAGFILTER_NOT = 1; { exclude only filter hits }
306 { Mapping types for use with MapTags() }
307 MAP_REMOVE_NOT_FOUND = 0; { remove tags that aren't in mapList }
308 MAP_KEEP_NOT_FOUND = 1; { keep tags that aren't in mapList }
312 Type
313 tUtilityBase = record
314 ub_LibNode : tLibrary;
315 ub_Language : Byte;
316 ub_Reserved : Byte;
317 END;
319 function AddNamedObject(nameSpace,
320 obj : pNamedObject) : Boolean;
321 function AllocateTagItems(num : ULONG) : pTagItem;
322 function AllocNamedObjectA(name : STRPTR;
323 TagList : pTagItem) : pNamedObject;
324 procedure Amiga2Date(amigatime : ULONG;
325 resultat : pClockData);
326 procedure ApplyTagChanges(TagList,
327 ChangeList : pTagItem);
328 function AttemptRemNamedObject(obj : pNamedObject) : LongInt;
329 function CallHookPkt(h : pHook;
330 obj, paramPkt : APTR) : ULONG;
331 function CheckDate(date : pClockData) : ULONG;
332 function CloneTagItems(tagList : pTagItem) : pTagItem;
333 function Date2Amiga(date : pClockData) : ULONG;
334 procedure FilterTagChanges(changelist, oldvalues : pTagItem;
335 apply : ULONG);
336 function FilterTagItems(taglist : pTagItem ;
337 tagArray : Pointer;
338 logic : ULONG) : ULONG;
339 function FindNamedObject(nameSpace : pNamedObject;
340 name : STRPTR;
341 lastobject: pNamedObject) : pNamedObject;
342 function FindTagItem(TagVal : Tag;
343 TagList : pTagItem) : pTagItem;
344 procedure FreeNamedObject(Obj : pNamedObject);
345 procedure FreeTagItems(TagList : pTagItem);
346 function GetTagData(tagval : Tag;
347 default : ULONG;
348 TagList : pTagItem) : ULONG;
349 function GetUniqueID : ULONG;
350 procedure MapTags(TagList : pTagItem;
351 maplist : pTagItem;
352 IncludeMiss : ULONG);
353 function NamedObjectName(Obj : pNamedObject) : STRPTR;
354 function NextTagItem(Item : ppTagItem) : pTagItem;
355 function PackBoolTags(InitialFlags : ULONG;
356 TagList, boolmap : pTagItem) : ULONG;
357 function PackStructureTags(packk: APTR;
358 packTable : Pointer;
359 TagList : pTagItem) : ULONG;
360 procedure RefreshTagItemClones(cloneTagItems,
361 OriginalTagItems : pTagItem);
362 procedure ReleaseNamedObject(Obj : pNamedObject);
363 procedure RemNamedObject(Obj : pNamedObject;
364 Msg : pointer);
365 function SDivMod32( dividend , divisor : LongInt) : LongInt;
366 function SMult32(Arg1, Arg2 : LongInt) : LongInt;
367 function SMult64(Arg1, Arg2 : LongInt) : LongInt;
368 function Stricmp(Str1, Str2 : STRPTR) : LongInt;
369 function Strnicmp(Str1, Str2 : STRPTR;
370 len : LongInt) : LongInt;
371 function TagInArray(t : Tag;
372 TagArray : Pointer) : Boolean;
373 function ToLower(c : ULONG) : Char;
374 function ToUpper(c : ULONG) : Char;
375 function UDivMod32( dividend , divisor : ULONG) : ULONG;
376 function UMult32(Arg1, Arg2 : ULONG) : ULONG;
377 function UMult64(Arg1, Arg2 : ULONG) : ULONG;
378 function UnpackStructureTags(pac: APTR;
379 packTable: Pointer;
380 TagList : pTagItem) : ULONG;
382 IMPLEMENTATION
384 function AddNamedObject(nameSpace,
385 obj : pNamedObject) : Boolean;
386 begin
388 MOVE.L A6,-(A7)
389 MOVE.L nameSpace,a0
390 MOVE.L obj,a1
391 MOVE.L _UtilityBase,A6
392 JSR -222(A6)
393 MOVE.L (A7)+,A6
394 TST.L d0
395 bne @success
396 bra @end
397 @success:
398 move.b #1,d0
399 @end:
400 move.b d0,@RESULT
401 end;
402 end;
404 function AllocateTagItems(num : ULONG) : pTagItem;
405 begin
407 MOVE.L A6,-(A7)
408 MOVE.L num,d0
409 MOVE.L _UtilityBase,A6
410 JSR -066(A6)
411 MOVE.L (A7)+,A6
412 MOVE.L d0,@RESULT
413 end;
414 end;
416 function AllocNamedObjectA(name : STRPTR;
417 TagList : pTagItem) : pNamedObject;
418 begin
420 MOVE.L A6,-(A7)
421 MOVE.L name,a0
422 MOVE.L TagList,a1
423 MOVE.L _UtilityBase,A6
424 JSR -228(A6)
425 MOVE.L (A7)+,A6
426 MOVE.L d0,@RESULT
427 end;
428 end;
430 procedure Amiga2Date(amigatime : ULONG;
431 resultat : pClockData);
432 begin
434 MOVE.L A6,-(A7)
435 MOVE.L amigatime,d0
436 MOVE.L resultat,a0
437 MOVE.L _UtilityBase,A6
438 JSR -120(A6)
439 MOVE.L (A7)+,A6
440 end;
441 end;
443 procedure ApplyTagChanges(TagList,
444 ChangeList : pTagItem);
445 begin
447 MOVE.L A6,-(A7)
448 MOVE.L TagList,a0
449 MOVE.L ChangeList,a1
450 MOVE.L _UtilityBase,A6
451 JSR -186(A6)
452 MOVE.L (A7)+,A6
453 end;
454 end;
456 function AttemptRemNamedObject(obj : pNamedObject) : LongInt;
457 begin
459 MOVE.L A6,-(A7)
460 MOVE.L obj,a0
461 MOVE.L _UtilityBase,A6
462 JSR -234(A6)
463 MOVE.L (A7)+,A6
464 MOVE.L d0,@RESULT
465 end;
466 end;
468 function CallHookPkt(h : pHook;
469 obj, paramPkt : APTR) : ULONG;
470 begin
472 MOVEM.L a2/a6,-(A7)
473 MOVE.L h,a0
474 MOVE.L obj,a2
475 MOVE.L paramPkt,a1
476 MOVE.L _UtilityBase,A6
477 JSR -102(A6)
478 MOVEM.L (A7)+,a2/a6
479 MOVE.L d0,@RESULT
480 end;
481 end;
483 function CheckDate(date : pClockData) : ULONG;
484 begin
486 MOVE.L A6,-(A7)
487 MOVE.L date,a0
488 MOVE.L _UtilityBase,A6
489 JSR -132(A6)
490 MOVE.L (A7)+,A6
491 MOVE.L d0,@RESULT
492 end;
493 end;
495 function CloneTagItems(tagList : pTagItem) : pTagItem;
496 begin
498 MOVE.L A6,-(A7)
499 MOVE.L taglist,a0
500 MOVE.L _UtilityBase,A6
501 JSR -072(A6)
502 MOVE.L (A7)+,A6
503 MOVE.L d0,@RESULT
504 end;
505 end;
507 function Date2Amiga(date : pClockData) : ULONG;
508 begin
510 MOVE.L A6,-(A7)
511 MOVE.L date,a0
512 MOVE.L _UtilityBase,A6
513 JSR -126(A6)
514 MOVE.L (A7)+,A6
515 MOVE.L d0,@RESULT
516 end;
517 end;
519 procedure FilterTagChanges(changelist, oldvalues : pTagItem;
520 apply : ULONG);
521 begin
523 MOVE.L A6,-(A7)
524 MOVE.L changelist,a0
525 MOVE.L oldvalues,a1
526 MOVE.L apply,d0
527 MOVE.L _UtilityBase,A6
528 JSR -054(A6)
529 MOVE.L (A7)+,A6
530 end;
531 end;
533 function FilterTagItems(taglist : pTagItem ;
534 tagArray : Pointer;
535 logic : ULONG) : ULONG;
536 begin
538 MOVE.L A6,-(A7)
539 MOVE.L taglist,a0
540 MOVE.L tagArray,a1
541 MOVE.L logic,d0
542 MOVE.L _UtilityBase,A6
543 JSR -096(A6)
544 MOVE.L (A7)+,A6
545 MOVE.L d0,@RESULT
546 end;
547 end;
549 function FindNamedObject(nameSpace : pNamedObject;
550 name : STRPTR;
551 lastobject: pNamedObject) : pNamedObject;
552 begin
554 MOVEM.L a2/a6,-(A7)
555 MOVE.L nameSpace,a0
556 MOVE.L name,a1
557 MOVE.L lastobject,a2
558 MOVE.L _UtilityBase,A6
559 JSR -240(A6)
560 MOVEM.L (A7)+,a2/a6
561 MOVE.L d0,@RESULT
562 end;
563 end;
565 function FindTagItem(TagVal : Tag;
566 TagList : pTagItem) : pTagItem;
567 begin
569 MOVE.L A6,-(A7)
570 MOVE.L TagVal,d0
571 MOVE.L TagList,a0
572 MOVE.L _UtilityBase,A6
573 JSR -030(A6)
574 MOVE.L (A7)+,A6
575 MOVE.L d0,@RESULT
576 end;
577 end;
579 procedure FreeNamedObject(Obj : pNamedObject);
580 begin
582 MOVE.L A6,-(A7)
583 MOVE.L Obj,a0
584 MOVE.L _UtilityBase,A6
585 JSR -246(A6)
586 MOVE.L (A7)+,A6
587 end;
588 end;
590 procedure FreeTagItems(TagList : pTagItem);
591 begin
593 MOVE.L A6,-(A7)
594 MOVE.L TagList,a0
595 MOVE.L _UtilityBase,A6
596 JSR -078(A6)
597 MOVE.L (A7)+,A6
598 end;
599 end;
601 function GetTagData(tagval : Tag;
602 default : ULONG;
603 TagList : pTagItem) : ULONG;
604 begin
606 MOVE.L A6,-(A7)
607 MOVE.L tagval,d0
608 MOVE.L default,d1
609 MOVE.L TagList,a0
610 MOVE.L _UtilityBase,A6
611 JSR -036(A6)
612 MOVE.L (A7)+,A6
613 MOVE.L d0,@RESULT
614 end;
615 end;
617 function GetUniqueID : ULONG;
618 begin
620 MOVE.L A6,-(A7)
621 MOVE.L _UtilityBase,A6
622 JSR -270(A6)
623 MOVE.L (A7)+,A6
624 MOVE.L d0,@RESULT
625 end;
626 end;
628 procedure MapTags(TagList : pTagItem;
629 maplist : pTagItem;
630 IncludeMiss : ULONG);
631 begin
633 MOVE.L A6,-(A7)
634 MOVE.L TagList,a0
635 MOVE.L maplist,a1
636 MOVE.L IncludeMiss,d0
637 MOVE.L _UtilityBase,A6
638 JSR -060(A6)
639 MOVE.L (A7)+,A6
640 end;
641 end;
643 function NamedObjectName(Obj : pNamedObject) : STRPTR;
644 begin
646 MOVE.L A6,-(A7)
647 MOVE.L Obj,a0
648 MOVE.L _UtilityBase,A6
649 JSR -252(A6)
650 MOVE.L (A7)+,A6
651 MOVE.L d0,@RESULT
652 end;
653 end;
655 function NextTagItem(Item : ppTagItem) : pTagItem;
656 begin
658 MOVE.L A6,-(A7)
659 MOVE.L Item,a0
660 MOVE.L _UtilityBase,A6
661 JSR -048(A6)
662 MOVE.L (A7)+,A6
663 MOVE.L d0,@RESULT
664 end;
665 end;
667 function PackBoolTags(InitialFlags : ULONG;
668 TagList, boolmap : pTagItem) : ULONG;
669 begin
671 MOVE.L A6,-(A7)
672 MOVE.L InitialFlags,d0
673 MOVE.L TagList,a0
674 MOVE.L boolmap,a1
675 MOVE.L _UtilityBase,A6
676 JSR -042(A6)
677 MOVE.L (A7)+,A6
678 MOVE.L d0,@RESULT
679 end;
680 end;
682 function PackStructureTags(packk: APTR;
683 packTable : Pointer;
684 TagList : pTagItem) : ULONG;
685 begin
687 MOVEM.L a2/a6,-(A7)
688 MOVE.L packk,a0
689 MOVE.L packTable,a1
690 MOVE.L TagList,a2
691 MOVE.L _UtilityBase,A6
692 JSR -210(A6)
693 MOVEM.L (A7)+,a2/a6
694 MOVE.L d0,@RESULT
695 end;
696 end;
698 procedure RefreshTagItemClones(cloneTagItems,
699 OriginalTagItems : pTagItem);
700 begin
702 MOVE.L A6,-(A7)
703 MOVE.L cloneTagItems,a0
704 MOVE.L OriginalTagItems,a1
705 MOVE.L _UtilityBase,A6
706 JSR -084(A6)
707 MOVE.L (A7)+,A6
708 end;
709 end;
711 procedure ReleaseNamedObject(Obj : pNamedObject);
712 begin
714 MOVE.L A6,-(A7)
715 MOVE.L Obj,a0
716 MOVE.L _UtilityBase,A6
717 JSR -258(A6)
718 MOVE.L (A7)+,A6
719 end;
720 end;
722 procedure RemNamedObject(Obj : pNamedObject;
723 Msg : pointer);
724 begin
726 MOVE.L A6,-(A7)
727 MOVE.L Obj,a0
728 MOVE.L Msg,a1
729 MOVE.L _UtilityBase,A6
730 JSR -264(A6)
731 MOVE.L (A7)+,A6
732 end;
733 end;
735 function SDivMod32( dividend , divisor : LongInt) : LongInt;
736 begin
738 MOVE.L A6,-(A7)
739 MOVE.L dividend,d0
740 MOVE.L divisor,d1
741 MOVE.L _UtilityBase,A6
742 JSR -150(A6)
743 MOVE.L (A7)+,A6
744 MOVE.L d0,@RESULT
745 end;
746 end;
748 function SMult32(Arg1, Arg2 : LongInt) : LongInt;
749 begin
751 MOVE.L A6,-(A7)
752 MOVE.L Arg1,d0
753 MOVE.L Arg2,d1
754 MOVE.L _UtilityBase,A6
755 JSR -138(A6)
756 MOVE.L (A7)+,A6
757 MOVE.L d0,@RESULT
758 end;
759 end;
761 function SMult64(Arg1, Arg2 : LongInt) : LongInt;
762 begin
764 MOVE.L A6,-(A7)
765 MOVE.L Arg1,d0
766 MOVE.L Arg2,d1
767 MOVE.L _UtilityBase,A6
768 JSR -198(A6)
769 MOVE.L (A7)+,A6
770 MOVE.L d0,@RESULT
771 end;
772 end;
774 function Stricmp(Str1, Str2 : STRPTR) : LongInt;
775 begin
777 MOVE.L A6,-(A7)
778 MOVE.L Str1,a0
779 MOVE.L Str2,a1
780 MOVE.L _UtilityBase,A6
781 JSR -162(A6)
782 MOVE.L (A7)+,A6
783 MOVE.L d0,@RESULT
784 end;
785 end;
787 function Strnicmp(Str1, Str2 : STRPTR;
788 len : LongInt) : LongInt;
789 begin
791 MOVE.L A6,-(A7)
792 MOVE.L Str1,a0
793 MOVE.L Str2,a1
794 MOVE.L len,d0
795 MOVE.L _UtilityBase,A6
796 JSR -168(A6)
797 MOVE.L (A7)+,A6
798 MOVE.L d0,@RESULT
799 end;
800 end;
802 function TagInArray(t : Tag;
803 TagArray : Pointer) : Boolean;
804 begin
806 MOVE.L A6,-(A7)
807 MOVE.L t,d0
808 MOVE.L TagArray,a0
809 MOVE.L _UtilityBase,A6
810 JSR -090(A6)
811 MOVE.L (A7)+,A6
812 TST.L d0
813 bne @success
814 bra @end
815 @success:
816 move.b #1,d0
817 @end:
818 move.b d0,@RESULT
819 end;
820 end;
822 function ToLower(c : ULONG) : Char;
823 begin
825 MOVE.L A6,-(A7)
826 MOVE.L c,d0
827 MOVE.L _UtilityBase,A6
828 JSR -180(A6)
829 MOVE.L (A7)+,A6
830 MOVE.B d0,@RESULT
831 end;
832 end;
834 function ToUpper(c : ULONG) : Char;
835 begin
837 MOVE.L A6,-(A7)
838 MOVE.L c,d0
839 MOVE.L _UtilityBase,A6
840 JSR -174(A6)
841 MOVE.L (A7)+,A6
842 MOVE.B d0,@RESULT
843 end;
844 end;
846 function UDivMod32( dividend , divisor : ULONG) : ULONG;
847 begin
849 MOVE.L A6,-(A7)
850 MOVE.L dividend,d0
851 MOVE.L divisor,d1
852 MOVE.L _UtilityBase,A6
853 JSR -156(A6)
854 MOVE.L (A7)+,A6
855 MOVE.L d0,@RESULT
856 end;
857 end;
859 function UMult32(Arg1, Arg2 : ULONG) : ULONG;
860 begin
862 MOVE.L A6,-(A7)
863 MOVE.L Arg1,d0
864 MOVE.L Arg2,d1
865 MOVE.L _UtilityBase,A6
866 JSR -144(A6)
867 MOVE.L (A7)+,A6
868 MOVE.L d0,@RESULT
869 end;
870 end;
872 function UMult64(Arg1, Arg2 : ULONG) : ULONG;
873 begin
875 MOVE.L A6,-(A7)
876 MOVE.L Arg1,d0
877 MOVE.L Arg2,d1
878 MOVE.L _UtilityBase,A6
879 JSR -204(A6)
880 MOVE.L (A7)+,A6
881 MOVE.L d0,@RESULT
882 end;
883 end;
885 function UnpackStructureTags(pac: APTR;
886 packTable: Pointer;
887 TagList : pTagItem) : ULONG;
888 begin
890 MOVEM.L a2/a6,-(A7)
891 MOVE.L pac,a0
892 MOVE.L packTable,a1
893 MOVE.L TagList,a2
894 MOVE.L _UtilityBase,A6
895 JSR -216(A6)
896 MOVEM.L (A7)+,a2/a6
897 MOVE.L d0,@RESULT
898 end;
899 end;
901 end.