home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / libs / regexp / src / libinit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-19  |  2.9 KB  |  113 lines

  1. /*
  2. **      $VER: LibInit.c 37.10 (1.4.97)
  3. **
  4. **      Library initializers and functions to be called by StartUp.c
  5. **
  6. **      (C) Copyright 1996-97 Andreas R. Kleinert
  7. **      All Rights Reserved.
  8. */
  9.  
  10. #define __USE_SYSBASE        // perhaps only recognized by SAS/C
  11.  
  12. #include <exec/types.h>
  13. #include <exec/memory.h>
  14. #include <exec/libraries.h>
  15. #include <exec/execbase.h>
  16. #include <exec/resident.h>
  17. #include <exec/initializers.h>
  18.  
  19. #ifdef __MAXON__
  20. #include <clib/exec_protos.h>
  21. #else
  22. #include <proto/exec.h>
  23. #endif
  24. #include "compiler.h"
  25.  
  26. #ifndef __GNUC__            // changed from #ifdef
  27. #include "regexpbase.h"  // GNUC can not handle relativ pathnames.
  28.                           // The full path must be given in the makefile
  29. #else
  30. #include "/include/regexp/regexpbase.h"
  31. #endif
  32.  
  33. ULONG __saveds __stdargs L_OpenLibs(void);
  34. void  __saveds __stdargs L_CloseLibs(void);
  35.  
  36. extern struct RegexpBase *RegexpBase;
  37.  
  38.  
  39. struct ExecBase      *SysBase    = NULL;
  40. struct DosLibrary        *DOSBase = NULL;
  41.  
  42. #define VERSION  37
  43. #define REVISION 1
  44.  
  45. char __aligned ExLibName [] = "regexp.library";
  46. char __aligned ExLibID   [] = "regexp 37.1 (20.2.98)";
  47. char __aligned Copyright [] = "Released under GPL";
  48.  
  49. extern ULONG InitTab[];
  50.  
  51. extern APTR EndResident; /* below */
  52.  
  53. struct Resident __aligned ROMTag =     /* do not change */
  54. {
  55.  RTC_MATCHWORD,
  56.  &ROMTag,
  57.  &EndResident,
  58.  RTF_AUTOINIT,
  59.  VERSION,
  60.  NT_LIBRARY,
  61.  0,
  62.  &ExLibName[0],
  63.  &ExLibID[0],
  64.  &InitTab[0]
  65. };
  66.  
  67. APTR EndResident;
  68.  
  69. struct MyDataInit                      /* do not change */
  70. {
  71.  UWORD ln_Type_Init;      UWORD ln_Type_Offset;      UWORD ln_Type_Content;
  72.  UBYTE ln_Name_Init;      UBYTE ln_Name_Offset;      ULONG ln_Name_Content;
  73.  UWORD lib_Flags_Init;    UWORD lib_Flags_Offset;    UWORD lib_Flags_Content;
  74.  UWORD lib_Version_Init;  UWORD lib_Version_Offset;  UWORD lib_Version_Content;
  75.  UWORD lib_Revision_Init; UWORD lib_Revision_Offset; UWORD lib_Revision_Content;
  76.  UBYTE lib_IdString_Init; UBYTE lib_IdString_Offset; ULONG lib_IdString_Content;
  77.  ULONG ENDMARK;
  78. } DataTab =
  79. {
  80.  INITBYTE(OFFSET(Node,         ln_Type),      NT_LIBRARY),
  81.  0x80, (UBYTE) OFFSET(Node,    ln_Name),      (ULONG) &ExLibName[0],
  82.  INITBYTE(OFFSET(Library,      lib_Flags),    LIBF_SUMUSED|LIBF_CHANGED),
  83.  INITWORD(OFFSET(Library,      lib_Version),  VERSION),
  84.  INITWORD(OFFSET(Library,      lib_Revision), REVISION),
  85.  0x80, (UBYTE) OFFSET(Library, lib_IdString), (ULONG) &ExLibID[0],
  86.  (ULONG) 0
  87. };
  88.  
  89.  /* Libraries not shareable between Processes or libraries messing
  90.     with RamLib (deadlock and crash) may not be opened here - open/close
  91.     these later locally and or maybe close them fromout L_CloseLibs()
  92.     when expunging !
  93.  */
  94.  
  95. ULONG __saveds __stdargs L_OpenLibs(void)
  96. {
  97.  SysBase = (*((struct ExecBase **) 4));
  98.  
  99.  DOSBase = (struct DosLibrary*) OpenLibrary("dos.library", 37);
  100.  if(!DOSBase) return(FALSE);
  101.  
  102.  RegexpBase->reb_SysBase = SysBase;
  103.  
  104.  RegexpBase->reb_DOSBase = DOSBase;
  105.  
  106.  return(TRUE);
  107. }
  108.  
  109. void __saveds __stdargs L_CloseLibs(void)
  110. {
  111.  if(DOSBase)       CloseLibrary((struct Library *) DOSBase);
  112. }
  113.