From: Zefram <zefram@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu
Subject: module names
Date: Sun, 11 May 1997 18:51:16 +0100 (BST) [thread overview]
Message-ID: <16154.199705111751@stone.dcs.warwick.ac.uk> (raw)
-----BEGIN PGP SIGNED MESSAGE-----
This is an updated version of the code part of patch 3028, making all
the boot/cleanup functions have fixed names, on systems that can handle
the symbol name clash. In addition to what was in 3028, this patch
modifies ansi2knr such that it can grok the new function headers --
this mirrors the modification of makepro.sed.
-zefram
*** Src/ansi2knr.c 1995/06/30 22:07:14 1.1.1.1
--- Src/ansi2knr.c 1997/05/11 14:05:17
***************
*** 234,240 ****
}
while ( isidchar(*p) ) p++;
endfn = p;
! p = skipspace(p, 1);
if ( *p++ != '(' )
return 0; /* not a function */
p = skipspace(p, 1);
--- 234,242 ----
}
while ( isidchar(*p) ) p++;
endfn = p;
! do
! p = skipspace(p, 1);
! while(*p == ')' && (endfn = ++p, 1));
if ( *p++ != '(' )
return 0; /* not a function */
p = skipspace(p, 1);
*** Src/makepro.sed 1997/05/11 12:06:20 1.3
--- Src/makepro.sed 1997/05/11 14:10:57
***************
*** 2,8 ****
/^\/\*\*\/$/{
n
N
! s/\n\([_a-zA-Z][_0-9a-zA-Z]* *\)(/ \1 _((/
s/$/);/
p
}
--- 2,8 ----
/^\/\*\*\/$/{
n
N
! s/\n\([_a-zA-Z][_0-9a-zA-Z]*[ )]*\)(/ \1 _((/
s/$/);/
p
}
*** Src/module.c 1997/05/11 12:06:20 1.29
--- Src/module.c 1997/05/11 13:52:33
***************
*** 180,185 ****
--- 180,197 ----
# define dlclose(X) ((X), 0)
#endif
+ #ifdef DLSYM_NEEDS_UNDERSCORE
+ # define STR_BOOT "_boot_"
+ # define STR_BOOT_S "_boot_%s"
+ # define STR_CLEANUP "_cleanup_"
+ # define STR_CLEANUP_S "_cleanup_%s"
+ #else /* !DLSYM_NEEDS_UNDERSCORE */
+ # define STR_BOOT "boot_"
+ # define STR_BOOT_S "boot_%s"
+ # define STR_CLEANUP "cleanup_"
+ # define STR_CLEANUP_S "cleanup_%s"
+ #endif /* !DLSYM_NEEDS_UNDERSCORE */
+
typedef int (*Module_func) _((Module));
/**/
***************
*** 253,259 ****
--- 265,273 ----
init_module(Module m)
{
char *s, *t;
+ #ifndef DYNAMIC_NAME_CLASH_OK
char buf[PATH_MAX + 1];
+ #endif
Module_func fn;
s = strrchr(m->nam, '/');
***************
*** 263,276 ****
s = m->nam;
if ((t = strrchr(s, '.')))
*t = '\0';
if (strlen(s) + 6 > PATH_MAX)
return 1;
! #ifdef DLSYM_NEEDS_UNDERSCORE
! sprintf(buf, "_boot_%s", s);
! #else
! sprintf(buf, "boot_%s", s);
! #endif
fn = (Module_func) dlsym(m->handle, buf);
if(fn)
return fn(m);
zwarnnam(m->nam, "no boot function", NULL, 0);
--- 277,290 ----
s = m->nam;
if ((t = strrchr(s, '.')))
*t = '\0';
+ #ifdef DYNAMIC_NAME_CLASH_OK
+ fn = (Module_func) dlsym(m->handle, STR_BOOT);
+ #else /* !DYNAMIC_NAME_CLASH_OK */
if (strlen(s) + 6 > PATH_MAX)
return 1;
! sprintf(buf, STR_BOOT_S, s);
fn = (Module_func) dlsym(m->handle, buf);
+ #endif /* !DYNAMIC_NAME_CLASH_OK */
if(fn)
return fn(m);
zwarnnam(m->nam, "no boot function", NULL, 0);
***************
*** 331,337 ****
--- 345,353 ----
cleanup_module(Module m)
{
char *s, *t;
+ #ifndef DYNAMIC_NAME_CLASH_OK
char buf[PATH_MAX + 1];
+ #endif
Module_func fn;
s = strrchr(m->nam, '/');
***************
*** 341,354 ****
s = m->nam;
if ((t = strrchr(s, '.')))
*t = '\0';
if (strlen(s) + 9 > PATH_MAX)
return 1;
! #ifdef DLSYM_NEEDS_UNDERSCORE
! sprintf(buf, "_cleanup_%s", s);
! #else
! sprintf(buf, "cleanup_%s", s);
! #endif
fn = (Module_func) dlsym(m->handle, buf);
if(fn)
return fn(m);
zwarnnam(m->nam, "no cleanup function", NULL, 0);
--- 357,370 ----
s = m->nam;
if ((t = strrchr(s, '.')))
*t = '\0';
+ #ifdef DYNAMIC_NAME_CLASH_OK
+ fn = (Module_func) dlsym(m->handle, STR_CLEANUP);
+ #else /* !DYNAMIC_NAME_CLASH_OK */
if (strlen(s) + 9 > PATH_MAX)
return 1;
! sprintf(buf, STR_CLEANUP_S, s);
fn = (Module_func) dlsym(m->handle, buf);
+ #endif /* !DYNAMIC_NAME_CLASH_OK */
if(fn)
return fn(m);
zwarnnam(m->nam, "no cleanup function", NULL, 0);
*** Src/zsh.h 1997/05/11 12:06:28 1.58
--- Src/zsh.h 1997/05/11 13:52:33
***************
*** 50,55 ****
--- 50,63 ----
# define compctlread(N,A,O,R) compctlreadptr(N,A,O,R)
#endif /* !IN_COMP */
+ #if defined(MODULE) && defined(DYNAMIC_NAME_CLASH_OK)
+ # define BOOT(X) boot_
+ # define CLEANUP(X) cleanup_
+ #else
+ # define BOOT(X) X
+ # define CLEANUP(X) X
+ #endif
+
/* A few typical macros */
#define minimum(a,b) ((a) < (b) ? (a) : (b))
*** Src/Builtins/rlimits.c 1997/05/11 00:12:17 1.1.1.1
--- Src/Builtins/rlimits.c 1997/05/11 14:06:28
***************
*** 586,593 ****
};
/**/
! int
! boot_rlimits(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
--- 586,593 ----
};
/**/
! int BOOT(
! boot_rlimits)(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
***************
*** 595,602 ****
#ifdef MODULE
/**/
! int
! cleanup_rlimits(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
--- 595,602 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_rlimits)(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
*** Src/Builtins/sched.c 1997/05/11 00:12:17 1.1.1.1
--- Src/Builtins/sched.c 1997/05/11 14:06:49
***************
*** 186,193 ****
};
/**/
! int
! boot_sched(Module m)
{
if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
return 1;
--- 186,193 ----
};
/**/
! int BOOT(
! boot_sched)(Module m)
{
if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
return 1;
***************
*** 198,205 ****
#ifdef MODULE
/**/
! int
! cleanup_sched(Module m)
{
struct schedcmd *sch, *schn;
--- 198,205 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_sched)(Module m)
{
struct schedcmd *sch, *schn;
*** Src/Modules/cap.c 1997/05/11 12:06:41 1.2
--- Src/Modules/cap.c 1997/05/11 14:04:16
***************
*** 133,140 ****
};
/**/
! int
! boot_cap(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
--- 133,140 ----
};
/**/
! int BOOT(
! boot_cap)(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
***************
*** 142,149 ****
#ifdef MODULE
/**/
! int
! cleanup_cap(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
--- 142,149 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_cap)(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
*** Src/Modules/clone.c 1997/05/11 12:06:41 1.3
--- Src/Modules/clone.c 1997/05/11 14:07:07
***************
*** 99,106 ****
};
/**/
! int
! boot_clone(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
--- 99,106 ----
};
/**/
! int BOOT(
! boot_clone)(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
***************
*** 108,115 ****
#ifdef MODULE
/**/
! int
! cleanup_clone(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
--- 108,115 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_clone)(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
*** Src/Modules/example.c 1997/05/11 12:06:41 1.8
--- Src/Modules/example.c 1997/05/11 14:07:19
***************
*** 29,38 ****
*
*/
- #ifndef MODULE
- #define mod_boot mod_boot_example
- #endif
-
#include "zsh.h"
#include "example.pro"
--- 29,34 ----
***************
*** 64,71 ****
};
/**/
! int
! boot_example(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
--- 60,67 ----
};
/**/
! int BOOT(
! boot_example)(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
***************
*** 73,80 ****
#ifdef MODULE
/**/
! int
! cleanup_example(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
--- 69,76 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_example)(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
*** Src/Modules/files.c 1997/05/11 12:06:41 1.15
--- Src/Modules/files.c 1997/05/11 14:07:32
***************
*** 514,521 ****
};
/**/
! int
! boot_files(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
--- 514,521 ----
};
/**/
! int BOOT(
! boot_files)(Module m)
{
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
***************
*** 523,530 ****
#ifdef MODULE
/**/
! int
! cleanup_files(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
--- 523,530 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_files)(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
*** Src/Modules/stat.c 1997/05/11 12:06:42 1.4
--- Src/Modules/stat.c 1997/05/11 14:07:44
***************
*** 516,523 ****
}
/**/
! int
! boot_stat(Module m)
{
return addbuiltin("stat", 0, bin_stat, 0, -1, 0, NULL, NULL);
}
--- 516,523 ----
}
/**/
! int BOOT(
! boot_stat)(Module m)
{
return addbuiltin("stat", 0, bin_stat, 0, -1, 0, NULL, NULL);
}
***************
*** 525,532 ****
#ifdef MODULE
/**/
! int
! cleanup_stat(Module m)
{
return deletebuiltin("stat");
}
--- 525,532 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_stat)(Module m)
{
return deletebuiltin("stat");
}
*** Src/Zle/comp1.c 1997/05/11 12:06:45 1.5
--- Src/Zle/comp1.c 1997/05/11 14:07:58
***************
*** 241,248 ****
}
/**/
! int
! boot_comp1(Module m)
{
compctlreadptr = compctlread;
clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *));
--- 241,248 ----
}
/**/
! int BOOT(
! boot_comp1)(Module m)
{
compctlreadptr = compctlread;
clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *));
***************
*** 258,265 ****
#ifdef MODULE
/**/
! int
! cleanup_comp1(Module m)
{
deletehashtable(compctltab);
zfree(clwords, clwsize * sizeof(char *));
--- 258,265 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_comp1)(Module m)
{
deletehashtable(compctltab);
zfree(clwords, clwsize * sizeof(char *));
*** Src/Zle/compctl.c 1997/05/11 12:06:45 1.11
--- Src/Zle/compctl.c 1997/05/11 14:08:11
***************
*** 1027,1034 ****
};
/**/
! int
! boot_compctl(Module m)
{
if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
return 1;
--- 1027,1034 ----
};
/**/
! int BOOT(
! boot_compctl)(Module m)
{
if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
return 1;
***************
*** 1039,1046 ****
#ifdef MODULE
/**/
! int
! cleanup_compctl(Module m)
{
compctltab->printnode = NULL;
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
--- 1039,1046 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_compctl)(Module m)
{
compctltab->printnode = NULL;
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
*** Src/Zle/deltochar.c 1997/05/11 12:06:45 1.8
--- Src/Zle/deltochar.c 1997/05/11 14:08:24
***************
*** 72,79 ****
}
/**/
! int
! boot_deltochar(Module m)
{
w_deletetochar = addzlefunction("delete-to-char", deltochar, ZLE_KEEPSUFFIX);
if (w_deletetochar)
--- 72,79 ----
}
/**/
! int BOOT(
! boot_deltochar)(Module m)
{
w_deletetochar = addzlefunction("delete-to-char", deltochar, ZLE_KEEPSUFFIX);
if (w_deletetochar)
***************
*** 86,93 ****
#ifdef MODULE
/**/
! int
! cleanup_deltochar(Module m)
{
deletezlefunction(w_deletetochar);
return 0;
--- 86,93 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_deltochar)(Module m)
{
deletezlefunction(w_deletetochar);
return 0;
*** Src/Zle/zle_main.c 1997/05/11 12:06:46 1.37
--- Src/Zle/zle_main.c 1997/05/11 14:08:41
***************
*** 778,785 ****
};
/**/
! int
! boot_zle(Module m)
{
/* Set up editor entry points */
trashzleptr = trashzle;
--- 778,785 ----
};
/**/
! int BOOT(
! boot_zle)(Module m)
{
/* Set up editor entry points */
trashzleptr = trashzle;
***************
*** 806,813 ****
#ifdef MODULE
/**/
! int
! cleanup_zle(Module m)
{
int i;
--- 806,813 ----
#ifdef MODULE
/**/
! int CLEANUP(
! cleanup_zle)(Module m)
{
int i;
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii
iQCVAwUBM3XW1XD/+HJTpU/hAQG60wP+NK36DWXFJj549Mh4UbHjEN2SUgEHmzAo
eL4pmDsje2oOh3Df+PNAphypFAdOZRXPea0hbp8oeaX84IHUBfXjqM7MGESSZpVb
VRcW/mBsBirqP6ms5WfcCCULwdgPJT0ZHU9fEW3g5pPCGp+aYEzEEsaAl7luMGW0
XrIXAgm/H2Q=
=M9jl
-----END PGP SIGNATURE-----
next reply other threads:[~1997-05-11 18:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-11 17:51 Zefram [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-03-24 18:51 Zefram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16154.199705111751@stone.dcs.warwick.ac.uk \
--to=zefram@dcs.warwick.ac.uk \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).