home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / comm / cyberpager-1.5.lha / CyberPager / source / library / LibHead.a < prev    next >
Text File  |  1993-06-15  |  5KB  |  226 lines

  1.     SECTION NTRYHUNK,CODE
  2.  
  3.  NOLIST
  4.  INCLUDE "exec/types.i"
  5.  INCLUDE "exec/execbase.i"
  6.  INCLUDE "exec/libraries.i"
  7.  INCLUDE "exec/initializers.i"
  8.  INCLUDE "exec/resident.i"
  9.  LIST
  10.  
  11. ; if this next equate is set to non-zero then we geneate a second version of
  12. ; ODU that has a different name which is useful for debugging a new version
  13. ; while keeping the old version around for use by programs normally running
  14. ; on the system.  the debug library's name will be OwnDevUnitDebug.library.
  15. ; it is recommended that one not modify the setting within this source
  16. ; file, but rather specify a BUILD_DEBUG define on the command line of
  17. ; whatever assembler one uses.
  18.  
  19.     IFND    BUILD_DEBUG
  20. BUILD_DEBUG:    EQU    0
  21.     ENDIF
  22.  
  23.  INCLUDE "version.i"
  24.  
  25.     XREF    _LinkerDB
  26.     XREF    __BSSBAS
  27.     XREF    __BSSLEN
  28.  
  29.     XREF    _LibInit
  30.     XREF    _LibOpen
  31.     XREF    _LibClose
  32.     XREF    _LibExpunge
  33.  
  34. ; XREFs to the functions in the library I provide
  35.  
  36.     XREF    _AllocPagerHandle
  37.     XREF    _FreePagerHandle
  38.  
  39.     XREF    _ULogA
  40.     XREF    _SetLogLevel
  41.     XREF    _SetLogService
  42.     XREF    _SetLogWho
  43.  
  44.     XREF    _LockFile
  45.     XREF    _UnLockFile
  46.     XREF    _UnLockFiles
  47.  
  48.     XREF    _FindPagerConfig
  49.     XREF    _FindPagerConfigDefault
  50.     XREF    _FreePagerConfig
  51.     XREF    _PagerConfigYesNo
  52.  
  53.     XREF    _FindPagerService
  54.     XREF    _FreePagerService
  55.  
  56.     XREF    _FindPagerAlias
  57.     XREF    _FreePagerAlias
  58.  
  59.     XREF    _GetSequenceNumber
  60.     XREF    _SequenceToName
  61.  
  62.     XREF    _NameInSpool
  63.     XREF    _FreeNameInSpool
  64.  
  65. ; here we define the library base
  66. ; do not change this without changing GSTMaker.h along with it!
  67.  
  68.     STRUCTURE Base,LIB_SIZE
  69.     ULONG    pgr_SegList
  70.     LABEL    Base_SIZEOF
  71.  
  72. ; macro for calling routines in other libraries
  73. CALL    MACRO
  74.     XREF    _LVO\1
  75.     jsr    _LVO\1(a6)
  76.     ENDM
  77.  
  78. ; the first executable location sets an error and returns in case someone
  79. ; tries to load the library as a load moudle instead of OpenLibrary()ing it
  80.     moveq    #-1,d0
  81.     rts
  82.  
  83. ; the romtag structure for this library
  84. initDDescrip:
  85.         ;STRUCTURE RT,0
  86.     dc.w RTC_MATCHWORD    ; UWORD RT_MATCHWORD
  87.     dc.l initDDescrip    ; APTR  RT_MATCHTAG
  88.     dc.l EndCode        ; APTR  RT_ENDSKIP
  89.     dc.b RTF_AUTOINIT    ; UBYTE RT_FLAGS
  90.     dc.b VERSION        ; UBYTE RT_VERSION
  91.     dc.b NT_LIBRARY        ; UBYTE RT_TYPE
  92.     dc.b 0            ; BYTE  RT_PRI
  93.     dc.l PagerName        ; APTR  RT_NAME
  94.     dc.l idString        ; APTR  RT_IDSTRING
  95.     dc.l Init        ; APTR  RT_INIT
  96.  
  97. ; the name of the library
  98. PagerName:
  99.     dc.b    'pager-support'
  100.     IFNE    BUILD_DEBUG
  101.     dc.b    '-debug'
  102.     ENDIF
  103.     dc.b    '.library',0
  104.  
  105. ; text identifier tag for the library
  106.     ds.w 0    ; word align info string for programs like XOper...
  107. idString: dc.b 'pager-support.library v'
  108.       IDSTR
  109.       dc.b 13,10,'Copyright ',$a9,' 1993 by Christopher A. Wichura',13,10
  110.       dc.b 'All Rights Reserved.',13,10,0
  111.  
  112. ; word align everything
  113.     ds.w 0
  114.  
  115. ; this is the init structure that our RTF_AUTOINIT told exec to look for
  116. Init:
  117.     dc.l Base_SIZEOF    ; size of library base data space
  118.     dc.l funcTable        ; pointer to the function initializers
  119.     dc.l dataTable        ; pointer to the data initializers
  120.     dc.l initRoutine    ; routine to run
  121.  
  122. ; here we have the function table.  it, of course, starts with the standard
  123. ; library routines like Open, etc.
  124. funcTable:
  125.     dc.l _LibOpen
  126.     dc.l _LibClose
  127.     dc.l _LibExpunge
  128.     dc.l Null        ; reserved routine
  129.  
  130. ; my library routines
  131.     ; the hooks into the linker library pools routines are provided
  132.     ; at the end of this file
  133.     dc.l LibCreatePool
  134.     dc.l LibDeletePool
  135.     dc.l LibAllocPooled
  136.     dc.l LibFreePooled
  137.  
  138.     dc.l _AllocPagerHandle
  139.     dc.l _FreePagerHandle
  140.  
  141.     dc.l _ULogA
  142.     dc.l _SetLogLevel
  143.     dc.l _SetLogService
  144.     dc.l _SetLogWho
  145.  
  146.     dc.l _LockFile
  147.     dc.l _UnLockFile
  148.     dc.l _UnLockFiles
  149.  
  150.     dc.l _FindPagerConfig
  151.     dc.l _FindPagerConfigDefault
  152.     dc.l _FreePagerConfig
  153.     dc.l _PagerConfigYesNo
  154.  
  155.     dc.l _FindPagerService
  156.     dc.l _FreePagerService
  157.  
  158.     dc.l _FindPagerAlias
  159.     dc.l _FreePagerAlias
  160.  
  161.     dc.l _GetSequenceNumber
  162.     dc.l _SequenceToName
  163.  
  164.     dc.l _NameInSpool
  165.     dc.l _FreeNameInSpool
  166.  
  167. ; end of library function list
  168.     dc.l -1
  169.  
  170. ; static data structures initilization table
  171. dataTable:
  172.     INITBYTE LN_TYPE,NT_LIBRARY
  173.     INITLONG LN_NAME,PagerName
  174.     INITBYTE LIB_FLAGS,LIBF_SUMUSED+LIBF_CHANGED
  175.     INITWORD LIB_VERSION,VERSION
  176.     INITWORD LIB_REVISION,REVISION
  177.     INITLONG LIB_IDSTRING,idString
  178.     dc.l 0
  179.  
  180. ; after the library has been allocated this next routine gets called.
  181. ; d0 = library's pointer, a0 = segment list
  182. ;
  183. ; returning non-zero means ok to link library into system list
  184. initRoutine:
  185.     movem.l    a3/a5,-(sp)
  186.  
  187.     movem.l    d0/a0,-(sp)        ; save pointers
  188.  
  189. ; clear the BSS data area
  190.     lea    __BSSBAS,a3
  191.     moveq    #0,d1
  192.     move.l    #__BSSLEN,d0
  193.     bra.s    2$
  194. 1$    move.l    d1,(a3)+
  195. 2$    dbf    d0,1$
  196.  
  197. ; now call the init routine in the C code to handle any other stuff
  198.     movem.l    (sp)+,d0/a0
  199.     jsr    _LibInit
  200.  
  201. 4$:    movem.l    (sp)+,a3/a5
  202.     rts
  203.  
  204. Null:                ; Commodore reserved routine.  always
  205.     moveq    #0,d0        ; return NULL for now!
  206.     rts
  207.  
  208. POOLHK    MACRO
  209. Lib\1:
  210.     move.l    a6,-(sp)
  211.     move.l    4.w,a6
  212.     XREF    _Asm\1
  213.     jsr    _Asm\1
  214.     move.l    (sp)+,a6
  215.     rts
  216.     ENDM
  217.  
  218.     POOLHK    CreatePool
  219.     POOLHK    DeletePool
  220.     POOLHK    AllocPooled
  221.     POOLHK    FreePooled
  222.  
  223. EndCode:    ; maker for end of this code
  224.  
  225.     END
  226.