LibraryPackage.hpp
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.ibm.com/developerworks/oss/CPLv1.0.htm */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*----------------------------------------------------------------------------*/
38 /******************************************************************************/
39 /* REXX Kernel */
40 /* */
41 /* Primitive Rexx function/method package */
42 /* */
43 /******************************************************************************/
44 #ifndef LibraryPackage_Included
45 #define LibraryPackage_Included
46 
47 #include "RexxCore.h"
48 #include "SysLibrary.hpp"
49 #include "RexxNativeCode.hpp"
50 #include "CallbackDispatcher.hpp"
51 
52 class PackageManager;
53 class RexxNativeMethod;
54 
56 
58 {
59 public:
60  inline void *operator new(size_t, void *ptr) {return ptr;}
61  inline void operator delete(void *, void *) {;}
62  void *operator new(size_t);
63  inline void operator delete(void *) {;}
64 
67  inline LibraryPackage(RESTORETYPE restoreType) { ; };
68 
69  void live(size_t liveMark);
70  void liveGeneral(int reason);
71  bool load();
72  void unload();
74  void loadPackage();
75  void loadRoutines(RexxRoutineEntry *table);
83  void reload();
84  void reload(RexxPackageEntry *pack);
85  inline bool isLoaded() { return loaded; }
86  inline bool isInternal() { return internal; }
87  inline void makeInternal() { internal = true; }
88 
89 protected:
90 
91  RexxPackageEntry *package; // loaded package information
92  RexxString *libraryName; // the name of the library
93  RexxDirectory *routines; // loaded routines
94  RexxDirectory *methods; // loaded methods
95  SysLibrary lib; // the library management handle
96  bool loaded; // we've at least been able to load the library
97  bool internal; // this is an internal package...no library load required.
98 };
99 
100 
102 {
103 public:
105  virtual ~LibraryLoaderDispatcher() { ; }
106 
107  virtual void run();
108 
109 protected:
111 };
112 
113 
115 {
116 public:
119 
120  virtual void run();
121 
122 protected:
124 };
125 
126 #endif
127 
RexxPackageEntry *RexxEntry * PACKAGE_LOADER()
size_t(RexxEntry * PREGISTEREDROUTINE)(const char *, size_t, PCONSTRXSTRING, const char *, PRXSTRING)
Definition: MethodClass.hpp:80
uint16_t *(RexxEntry * PNATIVEMETHOD)(RexxMethodContext *, ValueDescriptor *)
Definition: MethodClass.hpp:76
uint16_t *(RexxEntry * PNATIVEROUTINE)(RexxCallContext *, ValueDescriptor *)
Definition: MethodClass.hpp:78
RESTORETYPE
Definition: ObjectClass.hpp:80
LibraryLoaderDispatcher(RexxPackageLoader l)
RexxPackageLoader loader
RoutineClass * resolveRoutine(RexxString *name)
RexxRoutineEntry * locateRoutineEntry(RexxString *name)
RexxString * libraryName
RexxPackageEntry * getPackageTable()
void live(size_t liveMark)
LibraryPackage(RESTORETYPE restoreType)
PNATIVEMETHOD resolveMethodEntry(RexxString *name)
void liveGeneral(int reason)
RexxDirectory * methods
LibraryPackage(RexxString *n)
RexxNativeMethod * resolveMethod(RexxString *name)
PREGISTEREDROUTINE resolveRegisteredRoutineEntry(RexxString *name)
PNATIVEROUTINE resolveRoutineEntry(RexxString *name)
void loadRoutines(RexxRoutineEntry *table)
RexxMethodEntry * locateMethodEntry(RexxString *name)
RexxDirectory * routines
RexxPackageEntry * package
LibraryUnloaderDispatcher(RexxPackageUnloader u)
RexxPackageUnloader unloader
void(RexxEntry * RexxPackageUnloader)(RexxThreadContext *)
Definition: oorexxapi.h:239
void(RexxEntry * RexxPackageLoader)(RexxThreadContext *)
Definition: oorexxapi.h:238
#define RexxEntry
Definition: rexx.h:412
Definition: oorexxapi.h:198
Definition: oorexxapi.h:242
Definition: oorexxapi.h:177