[teklib-general] changeset in /hg/teklib/current: removed extern, added TLIBAPI d...
Timm S. Mueller
tmueller at neoscientists.org
Mon Jul 9 22:07:55 CEST 2007
changeset f61ad213f16a in /hg/teklib/current
details: http://teklib.org:8001/hg/teklib/current?cmd=changeset;node=f61ad213f16a
description:
removed extern, added TLIBAPI declarations
diffs (270 lines):
diff -r e04fd54ccb12 -r f61ad213f16a src/teklib/posix/host.c
--- a/src/teklib/posix/host.c Fri Jun 22 08:19:01 2007 +0200
+++ b/src/teklib/posix/host.c Fri Jun 22 08:20:23 2007 +0200
@@ -25,7 +25,7 @@
struct host_modhandle
{
- union
+ union
{
TMODINITFUNC func;
TAPTR object;
@@ -44,7 +44,7 @@ static struct TInitModule *
static struct TInitModule *
host_lookupmodule(TSTRPTR modname, TTAGITEM *tags)
{
- struct TInitModule *imod =
+ struct TInitModule *imod =
(struct TInitModule *) TGetTag(tags, TExecBase_ModInit, TNULL);
if (imod)
{
@@ -63,13 +63,13 @@ host_lookupmodule(TSTRPTR modname, TTAGI
** host init/exit
*/
-TAPTR
+TLIBAPI TAPTR
TEKlib_Init(TTAGITEM *tags)
{
return (TAPTR) 1;
}
-TVOID
+TLIBAPI TVOID
TEKlib_Exit(TAPTR boot)
{
}
@@ -79,20 +79,20 @@ TEKlib_Exit(TAPTR boot)
** host alloc/free
*/
-TAPTR
+TLIBAPI TAPTR
TEKlib_Alloc(TAPTR boot, TUINT size)
{
TAPTR mem = malloc(size);
return mem;
}
-TVOID
+TLIBAPI TVOID
TEKlib_Free(TAPTR boot, TAPTR mem, TUINT size)
{
if (mem) free(mem);
}
-TVOID
+TLIBAPI TVOID
TEKlib_FreeVec(TAPTR boot, TAPTR mem)
{
if (mem) free(mem);
@@ -103,20 +103,20 @@ TEKlib_FreeVec(TAPTR boot, TAPTR mem)
** determine TEKlib global system directory
*/
-TSTRPTR
+TLIBAPI TSTRPTR
TEKlib_GetSysDir(TAPTR boot, TTAGITEM *tags)
{
TSTRPTR sysdir;
TSTRPTR s;
TINT l;
-
+
s = (TSTRPTR) TGetTag(tags, TExecBase_SysDir, (TTAG) TEKHOST_SYSDIR);
l = strlen(s);
sysdir = TEKlib_Alloc(boot, l + 1);
if (sysdir)
strcpy(sysdir, s);
-
+
return sysdir;
}
@@ -125,20 +125,20 @@ TEKlib_GetSysDir(TAPTR boot, TTAGITEM *t
** determine TEKlib global module directory
*/
-TSTRPTR
+TLIBAPI TSTRPTR
TEKlib_GetModDir(TAPTR boot, TTAGITEM *tags)
{
TSTRPTR sysdir;
TSTRPTR s;
TINT l;
-
+
s = (TSTRPTR) TGetTag(tags, TExecBase_ModDir, (TTAG) TEKHOST_MODDIR);
l = strlen(s);
sysdir = TEKlib_Alloc(boot, l + 1);
if (sysdir)
strcpy(sysdir, s);
-
+
return sysdir;
}
@@ -148,7 +148,7 @@ TEKlib_GetModDir(TAPTR boot, TTAGITEM *t
** later resolve to "PROGDIR:" in teklib semantics.
*/
-TSTRPTR
+TLIBAPI TSTRPTR
TEKlib_GetProgDir(TAPTR boot, TTAGITEM *tags)
{
TSTRPTR progdir = TNULL;
@@ -167,10 +167,10 @@ TEKlib_GetProgDir(TAPTR boot, TTAGITEM *
}
return TNULL;
}
-
+
argc = (TINT) TGetTag(tags, TExecBase_ArgC, 0);
argv = (TSTRPTR *) TGetTag(tags, TExecBase_ArgV, TNULL);
-
+
if (argc >= 1 && argv)
{
TSTRPTR olddir = TEKlib_Alloc(boot, MAX_PATH_LEN);
@@ -185,21 +185,21 @@ TEKlib_GetProgDir(TAPTR boot, TTAGITEM *
TINT l = 0;
TSTRPTR s = argv[0];
TINT c;
-
- while (*s)
+
+ while (*s)
{
- s++;
+ s++;
l++;
}
-
+
if (l > 0)
{
success = TTRUE;
- while ((c = *(--s)))
+ while ((c = *(--s)))
{
if (c == '/')
- break;
- l--;
+ break;
+ l--;
}
if (l > 0)
{
@@ -217,13 +217,13 @@ TEKlib_GetProgDir(TAPTR boot, TTAGITEM *
}
}
}
-
+
if (success)
success = (getcwd(progdir, MAX_PATH_LEN) != TNULL);
-
+
if (!(chdir(olddir) == 0))
success = TFALSE;
-
+
if (success)
strcat(progdir, "/");
else
@@ -244,13 +244,13 @@ TEKlib_GetProgDir(TAPTR boot, TTAGITEM *
** load a module. first try progdir/modname, then moddir
*/
-static TAPTR
+static TAPTR
host_getmodule(TSTRPTR modpath)
{
return dlopen(modpath, RTLD_NOW);
}
-static TMODINITFUNC
+static TMODINITFUNC
host_getsymaddr(TAPTR mod, TSTRPTR name)
{
union
@@ -270,7 +270,7 @@ static TVOID closemodule(TAPTR mod)
/*****************************************************************************/
-TAPTR
+TLIBAPI TAPTR
TEKlib_LoadModule(TAPTR boot, TSTRPTR progdir, TSTRPTR moddir, TSTRPTR modname,
TTAGITEM *tags)
{
@@ -291,11 +291,11 @@ TEKlib_LoadModule(TAPTR boot, TSTRPTR pr
handle->type = TYPE_LIB;
return handle;
}
-
+
len1 = progdir ? strlen(progdir) : 0;
len2 = moddir ? strlen(moddir) : 0;
len3 = strlen(modname);
-
+
/* + mod/ + .so + \0 */
t = TEKlib_Alloc(boot, TMAX(len1, len2) + len3 + 4 + TEKHOST_EXTLEN + 1);
if (t)
@@ -305,7 +305,7 @@ TEKlib_LoadModule(TAPTR boot, TSTRPTR pr
strcpy(t + len1, "mod/");
strcpy(t + len1 + 4, modname);
strcpy(t + len1 + 4 + len3, TEKHOST_EXTSTR);
-
+
TDBPRINTF(3,("trying dlopen %s\n", t));
knmod = host_getmodule(t);
if (!knmod)
@@ -313,14 +313,14 @@ TEKlib_LoadModule(TAPTR boot, TSTRPTR pr
if (moddir) strcpy(t, moddir);
strcpy(t + len2, modname);
strcpy(t + len2 + len3, TEKHOST_EXTSTR);
-
+
TDBPRINTF(3,("trying dlopen %s\n", t));
knmod = host_getmodule(t);
}
-
+
if (!knmod)
TDBPRINTF(20,("dlopen %s failed\n", modname));
-
+
TEKlib_FreeVec(boot, t);
}
@@ -343,7 +343,7 @@ TEKlib_LoadModule(TAPTR boot, TSTRPTR pr
** close module
*/
-TVOID
+TLIBAPI TVOID
TEKlib_CloseModule(TAPTR boot, TAPTR knmod)
{
struct host_modhandle *handle = knmod;
@@ -357,7 +357,7 @@ TEKlib_CloseModule(TAPTR boot, TAPTR knm
** get module entry
*/
-TMODINITFUNC
+TLIBAPI TMODINITFUNC
TEKlib_GetEntry(TAPTR boot, TAPTR knmod, TSTRPTR name)
{
struct host_modhandle *handle = knmod;
@@ -371,7 +371,7 @@ TEKlib_GetEntry(TAPTR boot, TAPTR knmod,
** call module
*/
-TUINT
+TLIBAPI TUINT
TEKlib_CallModule(TAPTR boot, TAPTR ModBase, TMODINITFUNC entry,
TAPTR task, TAPTR mod, TUINT16 version, TTAGITEM *tags)
{
More information about the teklib-general
mailing list