home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Resources / System / BoingBag1 / Contributions / Workbench / RexxArpLib3p6 / src / rxhtable.a < prev    next >
Text File  |  1998-06-19  |  5KB  |  129 lines

  1. SAS AMIGA 680x0OBJ Module Disassembler 6.57
  2. Copyright © 1995 SAS Institute, Inc.
  3.  
  4.  
  5. Amiga Object File Loader V1.00
  6. 68000 Instruction Set
  7.  
  8. EXTERNAL DEFINITIONS
  9.  
  10. @rxhtable_index 0000-00
  11.  
  12. SECTION 00 "text" 00000078 BYTES
  13. ;   1: /** rxhtable.c
  14. ;   2:  *
  15. ;   3:  *   DESCRIPTION:
  16. ;   4:  *   ===========
  17. ;   5:  *
  18. ;   6:  * This function finds the index associated with the function
  19. ;   7:  * name given in the argument string.
  20. ;   8:  *                                            
  21. ;   9:  * It uses a hashing function that was found using the program
  22. ;  10:  * 'hash' by W.G.J. Langeveld.
  23. ;  11:  *
  24. ;  12:  *   SYNOPSIS:
  25. ;  13:  *   =========
  26. ;  14:  *
  27. ;  15:  * index = rxhtable_index(name)
  28. ;  16:  *
  29. ;  17:  * int index the index of the function, -1 if not found.
  30. ;  18:  * char *name name of function.
  31. ;  19:  *
  32. ;  20: **/
  33. ;  21: 
  34. ;  22: #include <string.h>
  35. ;  23: #include <ctype.h>
  36. ;  24: 
  37. ;  25: 
  38. ;  26: 
  39. ;  27: static int hash_table[] = 
  40. ;  28: {
  41. ;  29:     -1,  -1,   8,  -1,  17,  -1,  18,   7,  -1,   9,
  42. ;  30:     6,  15,  10,  -1,   0,  -1,  11,  -1,  -1,  -1,
  43. ;  31:     5,  12,  16,  14,  19,  13,  -1,  -1,  -1,   4,
  44. ;  32:     1,   2,  -1,  -1,   3,  -1,  -1,  
  45. ;  33: };
  46. ;  34: 
  47. ;  35: 
  48. ;  36: int rxhtable_index(char *);
  49. ;  37: static int hash(unsigned char *);
  50. ;  38: 
  51. ;  39: 
  52. ;  40: int rxhtable_index( char *s )
  53.        | 0000  594F                           SUBQ.W      #4,A7
  54. ;  41: {
  55. ;  42:     return(hash_table[hash(s)]);
  56.        | 0002  2E8E                           MOVE.L      A6,(A7)
  57.        | 0004  6100 0014                      BSR.W       001A
  58.        | 0008  48C0                           EXT.L       D0
  59.        | 000A  2200                           MOVE.L      D0,D1
  60.        | 000C  D281                           ADD.L       D1,D1
  61.        | 000E  41EC  0000-01.2                LEA         01.00000000(A4),A0
  62.        | 0012  3030 1800                      MOVE.W      00(A0,D1.L),D0
  63.        | 0016  584F                           ADDQ.W      #4,A7
  64.        | 0018  4E75                           RTS
  65. ;  43: }
  66. ;  44: 
  67. ;  45: 
  68. ;  46: static int hash( unsigned char *s )
  69.        | 001A  594F                           SUBQ.W      #4,A7
  70.        | 001C  2F07                           MOVE.L      D7,-(A7)
  71.        | 001E  2248                           MOVEA.L     A0,A1
  72. ;  47: {
  73. ;  48:     register int res;
  74. ;  49:     register unsigned char *sp;
  75. ;  50:     register unsigned int c;
  76. ;  51:     
  77. ;  52:     res = strlen(s);
  78.        | 0020  4A18                           TST.B       (A0)+
  79.        | 0022  66FC                           BNE.B       0020
  80.        | 0024  5388                           SUBQ.L      #1,A0
  81.        | 0026  91C9                           SUBA.L      A1,A0
  82.        | 0028  3E08                           MOVE.W      A0,D7
  83. ;  53:     
  84. ;  54:     for (sp = s; *sp; sp++ ) 
  85.        | 002A  2F4E 0004                      MOVE.L      A6,0004(A7)
  86.        | 002E  6032                           BRA.B       0062
  87. ;  55:     {
  88. ;  56:         c = toupper(*sp);
  89.        | 0030  7000                           MOVEQ       #00,D0
  90.        | 0032  1011                           MOVE.B      (A1),D0
  91.        | 0034  41EC  0001-XX.2                LEA         ___ctype+00000001(A4),A0
  92.        | 0038  0830 0001 0000                 BTST        #0001,00(A0,D0.W)
  93.        | 003E  670A                           BEQ.B       004A
  94.        | 0040  7200                           MOVEQ       #00,D1
  95.        | 0042  1200                           MOVE.B      D0,D1
  96.        | 0044  0441 0020                      SUBI.W      #0020,D1
  97.        | 0048  6004                           BRA.B       004E
  98.        | 004A  7200                           MOVEQ       #00,D1
  99.        | 004C  1200                           MOVE.B      D0,D1
  100. ;  57:         res = ((res * 23 + c ) & 0x7ff);
  101.        | 004E  2007                           MOVE.L      D7,D0
  102.        | 0050  E540                           ASL.W       #2,D0
  103.        | 0052  9047                           SUB.W       D7,D0
  104.        | 0054  E740                           ASL.W       #3,D0
  105.        | 0056  9047                           SUB.W       D7,D0
  106.        | 0058  D041                           ADD.W       D1,D0
  107.        | 005A  0240 07FF                      ANDI.W      #07FF,D0
  108.        | 005E  3E00                           MOVE.W      D0,D7
  109.        | 0060  5289                           ADDQ.L      #1,A1
  110.        | 0062  4A11                           TST.B       (A1)
  111.        | 0064  66CA                           BNE.B       0030
  112. ;  58:     }
  113. ;  59:     return(res % 37);
  114.        | 0066  3007                           MOVE.W      D7,D0
  115.        | 0068  48C0                           EXT.L       D0
  116.        | 006A  81FC 0025                      DIVS.W      #0025,D0
  117.        | 006E  4840                           SWAP        D0
  118.        | 0070  2E1F                           MOVE.L      (A7)+,D7
  119.        | 0072  584F                           ADDQ.W      #4,A7
  120.        | 0074  4E75                           RTS
  121.        | 0076  4E71                           NOP
  122.  
  123. SECTION 01 "__MERGED" 0000004C BYTES
  124. 0000 FF FF FF FF 00 08 FF FF 00 11 FF FF 00 12 00 07 ................
  125. 0010 FF FF 00 09 00 06 00 0F 00 0A FF FF 00 00 FF FF ................
  126. 0020 00 0B FF FF FF FF FF FF 00 05 00 0C 00 10 00 0E ................
  127. 0030 00 13 00 0D FF FF FF FF FF FF 00 04 00 01 00 02 ................
  128. 0040 FF FF FF FF 00 03 FF FF FF FF 00 00 ............
  129.