home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / flexcat-1.5.lha / FlexCat / languages / schw臙isch.asm < prev    next >
Assembly Source File  |  1994-07-04  |  18KB  |  561 lines

  1. *
  2. * $VER: schwäbisch.language 38.2 (13.1.94)
  3. * WARNING: BETA TEST VERSION!!!
  4. *
  5.  
  6.         include 'exec/types.i'
  7.         include 'exec/lists.i'
  8.         include 'exec/libraries.i'
  9.         include 'exec/resident.i'
  10.         include 'exec/initializers.i'
  11.         include 'libraries/locale.i'
  12.  
  13. _LVOFreeMem     EQU     -$d2
  14.  
  15. ; Uncomment this to activate slovene ToUpper and StrCmp function.
  16. ;NO_SORT_EXTENSION       SET     1
  17.  
  18.         SECTION CODE
  19.  
  20.         moveq   #-1,d0
  21.         rts
  22.  
  23. Start   dc.w    RTC_MATCHWORD
  24.         dc.l    Start
  25.         dc.l    End
  26.         dc.b    RTF_AUTOINIT
  27.         dc.b    38
  28.         dc.b    NT_LIBRARY
  29.         dc.b    156
  30.         dc.l    name
  31.         dc.l    idStr
  32.         dc.l    initTable
  33.  
  34. name    dc.b    'schwäbisch.language',0
  35. idStr   dc.b    'schwäbisch 38.2 (29.3.94)',13,10,0
  36.  
  37. initTable
  38.         dc.l    42              ; library base size
  39.         dc.l    vectors         ; library routine vectors
  40.         dc.l    structure       ; library base initialization structure
  41.         dc.l    InitFunction    ; initialization function
  42.  
  43. vectors
  44.         dc.l    FuncOpen
  45.         dc.l    FuncClose
  46.         dc.l    FuncExpunge
  47.         dc.l    FuncNull
  48.         dc.l    FuncMask
  49.         dc.l    FuncNull
  50.         dc.l    FuncNull
  51.         dc.l    FuncNull
  52.         dc.l    FuncGetString
  53.         IFND    NO_SORT_EXTENSION
  54.         dc.l    FuncNull
  55.         dc.l    FuncNull
  56.         dc.l    FuncNull
  57.         dc.l    FuncNull
  58.         dc.l    FuncNull
  59.         dc.l    FuncNull
  60.         dc.l    FuncNull
  61.         dc.l    FuncNull
  62.         dc.l    FuncNull
  63.         dc.l    FuncNull
  64.         dc.l    FuncNull
  65.         dc.l    FuncToUpper
  66.         dc.l    FuncStringCompare
  67.         ENDC
  68.         dc.l    -1
  69.  
  70. structure
  71.         INITBYTE        LN_PRI,156
  72.         INITBYTE        LN_TYPE,NT_LIBRARY
  73.         INITLONG        LN_NAME,name
  74.         INITBYTE        LIB_FLAGS, LIBF_CHANGED ! LIBF_SUMUSED
  75.         INITWORD        LIB_VERSION,38
  76.         INITWORD        LIB_REVISION,2
  77.         INITLONG        LIB_IDSTRING,idStr
  78.         dc.w    0
  79.  
  80. *- InitFunction ---------------------------------------------------*
  81. * Input:
  82. *  D0 - catalog base
  83. *  A6 - execbase
  84. *  A0 - ???
  85. *------------------------------------------------------------------*
  86. InitFunction
  87.         move.l  d0,a1                           ; get catalog base
  88.         move.l  a0,34(a1)
  89.         move.l  a6,38(a1)                       ; save sysbase
  90.         rts
  91.  
  92. *- FuncOpen -------------------------------------------------------*
  93. * Input:
  94. *  A6 - catalog base
  95. * Output:
  96. *  D0 - catalog base
  97. *------------------------------------------------------------------*
  98. FuncOpen
  99.         addq.w  #1,LIB_OPENCNT(a6)              ; increase open counter
  100.         bclr    #LIBB_DELEXP,LIB_FLAGS(a6)      ; clear delayed expunge flag
  101.         move.l  a6,d0                           ; return catalog base
  102.         rts
  103.  
  104. *- FuncClose ------------------------------------------------------*
  105. * Input:
  106. *  A6 - catalog base
  107. * Output:
  108. *  D0 = 0
  109. *------------------------------------------------------------------*
  110. FuncClose
  111.         subq.w  #1,LIB_OPENCNT(a6)              ; decrease open counter
  112.         btst    #LIBB_DELEXP,LIB_FLAGS(a6)      ; test delayed expunge flag
  113.         bne.s   .expunge                        ; expunge library if requested
  114.         moveq   #0,d0
  115.         rts
  116. .expunge
  117.         tst.w   LIB_OPENCNT(a6)                 ; still open?
  118.         beq.s   doExpunge                       ; expunge catalog
  119.         moveq   #0,d0
  120.         rts
  121.  
  122. *- FuncExpunge ----------------------------------------------------*
  123. * Input:
  124. *  A6 - catalog base
  125. * Output:
  126. *  ???
  127. *------------------------------------------------------------------*
  128. FuncExpunge
  129.         tst.w   LIB_OPENCNT(a6)                 ; catalog opened?
  130.         beq.s   doExpunge                       ; expunge library
  131.         bset    #LIBB_DELEXP,LIB_FLAGS(a6)      ; set delayed expunge flag
  132.         moveq   #0,d0
  133.         rts
  134. doExpunge
  135.         movem.l d2/a5/a6,-(sp)
  136.         move.l  a6,a5                           ; get catalog base
  137.         move.l  38(a5),a6                       ; get execbase
  138.         move.l  34(a5),d2
  139.         move.l  a5,a1                           ; get catalog base
  140.         REMOVE                                  ; remove catalog node
  141.         move.l  a5,a1                           ; get catalog base
  142.         moveq   #0,d0                           ; clear d0
  143.         move.w  LIB_NEGSIZE(a5),d0              ; get vector array size
  144.         sub.l   d0,a1                           ; get array start address
  145.         add.w   LIB_POSSIZE(a5),d0              ; get catalog base size
  146.         jsr     _LVOFreeMem(a6)                 ; free catalog base memory
  147.         move.l  d2,d0
  148.         movem.l (sp)+,d2/a5/a6
  149.         rts
  150.  
  151. *- FuncNull -------------------------------------------------------*
  152. FuncNull
  153.         moveq   #0,d0
  154.         rts
  155.  
  156. *- FuncMask -------------------------------------------------------*
  157. * Output:
  158. *  D0 = bitmask of implemented functions
  159. *  (f.e. D0 = 1<<3 means function 3 implemented -> function 3 = GetString)
  160. *------------------------------------------------------------------*
  161. FuncMask
  162. ;        IFND    NO_SORT_EXTENSION
  163. ;        move.l  #(1<<3|1<<15|1<<16),d0  ; GetString, ToUpper, StringCompare
  164. ;        else
  165.         move.l  #(1<<3),d0              ; GetString
  166. ;        ENDC
  167.         rts
  168.  
  169.         IFND    NO_SORT_EXTENSION
  170. *- FuncStringCompare ----------------------------------------------*
  171. * Input:
  172. *  D0 - string length
  173. *  D1 - comparsion type
  174. *  A1 - first string
  175. *  A2 - second string
  176. * Output:
  177. *  <0 means string1 < string2
  178. *  =0 means string1 = string2
  179. *  >0 means string1 > string2
  180. *------------------------------------------------------------------*
  181. FuncStringCompare
  182.         tst.l   d0                      ; zero length?
  183.         bne.s   .oklen                  ; length specified
  184.         rts
  185. .oklen  tst.l   d1                      ; SC_ASCII?
  186.         bne.s   doCol1                  ; no, do SC_COLLATE1 or SC_COLLATE2
  187.         movem.l d2/a2,-(sp)             ; save regs
  188.         lea     convTab2(pc),a0         ; get comparison table pointer
  189.         moveq   #0,d2
  190. .next   move.b  (a1)+,d1                ; get character from first string
  191.         move.b  (a2)+,d2                ; get character from second string
  192.         move.b  (a0,d1.w),d1            ; get first comparison char from table
  193.         cmp.b   (a0,d2.w),d1            ; compare with second comp. char
  194.         bne.s   .lower                  ; are chars equal?
  195.         tst.b   d1                      ; end of string?
  196.         beq.s   .equal
  197.         subq.l  #1,d0                   ; one less to go...
  198.         bne.s   .next                   ; go to next character
  199.         movem.l (sp)+,d2/a2
  200.         rts
  201. .equal  moveq   #0,d0                   ; characters are equal
  202.         movem.l (sp)+,d2/a2
  203.         rts
  204. .lower  bhi.s   .higher                 ; char1 > char2?
  205.         moveq   #-1,d0                  ; char1 < char2
  206.         movem.l (sp)+,d2/a2
  207.         rts
  208. .higher moveq   #1,d0                   ; char1 > char2
  209.         movem.l (sp)+,d2/a2
  210.         rts
  211.  
  212. doCol1  subq.l  #1,d1                   ; SC_COLLATE1?
  213.         bne.s   doCol2                  ; no, do SC_COLLATE2
  214.         movem.l d2/a2,-(sp)
  215.         lea     convTab1(pc),a0
  216.         moveq   #0,d2
  217. .next   move.b  (a1)+,d1
  218.         move.b  (a2)+,d2
  219.         move.b  (a0,d1.w),d1
  220.         cmp.b   (a0,d2.w),d1
  221.         bne.s   lbC0001AA
  222.         tst.b   d1
  223.         beq.s   lbC0001A2
  224.         subq.l  #1,d0
  225.         bne.s   .next
  226.         movem.l (sp)+,d2/a2
  227.         rts
  228. lbC0001A2:
  229.         moveq   #0,d0
  230.         movem.l (sp)+,d2/a2
  231.         rts
  232. lbC0001AA:
  233.         bhi.s   lbC0001B4
  234.         moveq   #-1,d0
  235.         movem.l (sp)+,d2/a2
  236.         rts
  237. lbC0001B4:
  238.         moveq   #1,d0
  239.         movem.l (sp)+,d2/a2
  240.         rts
  241. doCol2  subq.l  #1,d1
  242.         bne.s   lbC000226
  243.         movem.l d2/d3/a2,-(sp)
  244.         lea     convTab1(pc),a0
  245.         moveq   #0,d2
  246.         moveq   #0,d3
  247. lbC0001CC:
  248.         move.b  (a1)+,d1
  249.         beq.s   lbC0001E0
  250.         move.b  (a2)+,d2
  251.         cmp.b   d2,d1
  252.         bne.s   lbC0001EC
  253.         subq.l  #1,d0
  254.         bne.s   lbC0001CC
  255.         movem.l (sp)+,d2/d3/a2
  256.         rts
  257. lbC0001E0:
  258.         cmp.b   (a2)