2 * The Regina Rexx Interpreter
3 * Copyright (C) 1993-1994 Anders Christensen <anders@pvv.unit.no>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #if defined( DYNAMIC_STATIC )
22 typedef void *(*RPFN
)( char *);
24 #ifdef HAVE_REXXUTIL_PACKAGE
25 extern void *getRexxUtilFunctionAddress( char *name
);
28 #ifdef HAVE_TEST_PACKAGE
29 extern void *getTest1FunctionAddress( char *name
);
30 extern void *getTest2FunctionAddress( char *name
);
33 #ifdef HAVE_REXXTK_PACKAGE
34 extern void *getRexxTkFunctionAddress( char *name
);
37 #ifdef HAVE_REXXCURSES_PACKAGE
38 extern void *getRexxCursesFunctionAddress( char *name
);
41 #ifdef HAVE_REXXGD_PACKAGE
42 extern void *getRexxGdFunctionAddress( char *name
);
45 #ifdef HAVE_REXXISAM_PACKAGE
46 extern void *getRexxISAMFunctionAddress( char *name
);
49 #ifdef HAVE_REXXCURL_PACKAGE
50 extern void *getRexxCURLFunctionAddress( char *name
);
53 #ifdef HAVE_REXXSQL_PACKAGE
54 extern void *getRexxSQLFunctionAddress( char *name
);
57 #ifdef HAVE_REXXEEC_PACKAGE
58 extern void *getRexxEECFunctionAddress( char *name
);
61 #ifdef HAVE_REXXDW_PACKAGE
62 extern void *getRexxDWFunctionAddress( char *name
);
65 #ifdef HAVE_RXSOCK_PACKAGE
66 extern void *getRxSockFunctionAddress( char *name
);
70 # define max(a,b) (((a) > (b)) ? (a) : (b))
74 # define min(a,b) (((a) < (b)) ? (a) : (b))
80 void *(*funcptr
)(char *name
);
83 #ifdef HAVE_TEST_PACKAGE
84 { "test1", getTest1FunctionAddress
} ,
85 { "test2", getTest2FunctionAddress
} ,
87 #ifdef HAVE_REXXUTIL_PACKAGE
88 { "regutil", getRexxUtilFunctionAddress
} ,
89 { "rexxutil", getRexxUtilFunctionAddress
} ,
91 #ifdef HAVE_REXXTK_PACKAGE
92 { "rexxtk", getRexxTkFunctionAddress
},
94 #ifdef HAVE_REXXCURSES_PACKAGE
95 { "rxcurses", getRexxCursesFunctionAddress
},
97 #ifdef HAVE_REXXGD_PACKAGE
98 { "rexxgd", getRexxGdFunctionAddress
},
100 #ifdef HAVE_REXXISAM_PACKAGE
101 { "rexxisam", getRexxISAMFunctionAddress
},
103 #ifdef HAVE_REXXCURL_PACKAGE
104 { "rexxcurl", getRexxCURLFunctionAddress
},
106 #ifdef HAVE_REXXSQL_PACKAGE
107 { "rexxsql", getRexxSQLFunctionAddress
},
109 #ifdef HAVE_REXXEEC_PACKAGE
110 { "rexxeec", getRexxEECFunctionAddress
},
112 #ifdef HAVE_RXSOCK_PACKAGE
113 { "rxsock", getRxSockFunctionAddress
},
115 #ifdef HAVE_REXXDW_PACKAGE
116 { "rexxdw", getRexxDWFunctionAddress
},
120 static int my_stricmp( char *str1
,char *str2
)
122 int len1
,len2
,len
,rc
;
124 len1
= strlen( str1
);
125 len2
= strlen( str2
);
126 len
= min( len1
, len2
);
128 rc
= mem_cmpic( str1
, str2
, len
);
139 void *static_dlopen( char *name
)
141 int i
, num_packages
;
142 num_packages
= sizeof( RexxPackages
) / sizeof( *RexxPackages
);
143 for ( i
= 0; i
< num_packages
; i
++)
145 if ( my_stricmp( RexxPackages
[i
].name
, name
) == 0 )
146 return RexxPackages
[i
].funcptr
;
151 int static_dlsym( void *addr
, char *name
, void **faddr
)
153 RPFN rpaddr
= (RPFN
)addr
;
154 if ( rpaddr
== NULL
)
158 *faddr
= (*rpaddr
)( name
);
165 void static_list_packages()
167 int i
, num_packages
;
168 num_packages
= ( sizeof( RexxPackages
) / sizeof( *RexxPackages
) ) - 1;
169 for ( i
= 0; i
< num_packages
; i
++)
171 fprintf( stderr
, " Statically loaded: %s\n", RexxPackages
[i
].name
);