diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-04 22:39:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-04 22:39:23 +0000 |
commit | f6b3007c38a92f48d086a19ea8682dd935b6d4ee (patch) | |
tree | 34b06be11b8bc4a8d3028149e890aac13fcfce33 /ext | |
parent | efeaa891beb26deace23d0f0d79d1dabb1e7e0a1 (diff) | |
download | perl-f6b3007c38a92f48d086a19ea8682dd935b6d4ee.tar.gz |
Integrate with mainperl.
p4raw-id: //depot/cfgperl@3576
Diffstat (limited to 'ext')
-rw-r--r-- | ext/ByteLoader/byterun.h | 19 | ||||
-rw-r--r-- | ext/Data/Dumper/Dumper.pm | 18 | ||||
-rw-r--r-- | ext/Data/Dumper/Dumper.xs | 42 | ||||
-rw-r--r-- | ext/DynaLoader/dl_aix.xs | 70 | ||||
-rw-r--r-- | ext/Thread/Thread/Specific.pm | 2 |
5 files changed, 57 insertions, 94 deletions
diff --git a/ext/ByteLoader/byterun.h b/ext/ByteLoader/byterun.h index 3a0381f3be..6bc03af5f1 100644 --- a/ext/ByteLoader/byterun.h +++ b/ext/ByteLoader/byterun.h @@ -154,25 +154,6 @@ enum { OPt_COP /* 11 */ }; -EXT int PL_optype_size[] -#ifdef DOINIT -= { - sizeof(OP), - sizeof(UNOP), - sizeof(BINOP), - sizeof(LOGOP), - sizeof(CONDOP), - sizeof(LISTOP), - sizeof(PMOP), - sizeof(SVOP), - sizeof(GVOP), - sizeof(PVOP), - sizeof(LOOP), - sizeof(COP) -} -#endif /* DOINIT */ -; - EXT void byterun(pTHXo_ struct bytestream bs); #define INIT_SPECIALSV_LIST STMT_START { \ diff --git a/ext/Data/Dumper/Dumper.pm b/ext/Data/Dumper/Dumper.pm index d653af336b..3828d7b390 100644 --- a/ext/Data/Dumper/Dumper.pm +++ b/ext/Data/Dumper/Dumper.pm @@ -259,14 +259,22 @@ sub _dump { } } + if ($realpack) { + if ($realpack eq 'Regexp') { + $out = "$val"; + $out =~ s,/,\\/,g; + return "qr/$out/"; + } + else { # we have a blessed ref + $out = $s->{'bless'} . '( '; + $blesspad = $s->{apad}; + $s->{apad} .= ' ' if ($s->{indent} >= 2); + } + } + $s->{level}++; $ipad = $s->{xpad} x $s->{level}; - if ($realpack) { # we have a blessed ref - $out = $s->{'bless'} . '( '; - $blesspad = $s->{apad}; - $s->{apad} .= ' ' if ($s->{indent} >= 2); - } if ($realtype eq 'SCALAR') { if ($realpack) { diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index e0ca4035d3..27d128b6ea 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -251,22 +251,40 @@ DD_dump(pTHX_ SV *val, char *name, STRLEN namelen, SV *retval, HV *seenhv, SvREFCNT_dec(seenentry); } } - - (*levelp)++; - ipad = sv_x(aTHX_ Nullsv, SvPVX(xpad), SvCUR(xpad), *levelp); - if (realpack) { /* we have a blessed ref */ - STRLEN blesslen; - char *blessstr = SvPV(bless, blesslen); - sv_catpvn(retval, blessstr, blesslen); - sv_catpvn(retval, "( ", 2); - if (indent >= 2) { - blesspad = apad; - apad = newSVsv(apad); - sv_x(aTHX_ apad, " ", 1, blesslen+2); + if (realpack) { + if (*realpack == 'R' && strEQ(realpack, "Regexp")) { + STRLEN rlen; + char *rval = SvPV(val, rlen); + char *slash = strchr(rval, '/'); + sv_catpvn(retval, "qr/", 3); + while (slash) { + sv_catpvn(retval, rval, slash-rval); + sv_catpvn(retval, "\\/", 2); + rlen -= slash-rval+1; + rval = slash+1; + slash = strchr(rval, '/'); + } + sv_catpvn(retval, rval, rlen); + sv_catpvn(retval, "/", 1); + return 1; + } + else { /* we have a blessed ref */ + STRLEN blesslen; + char *blessstr = SvPV(bless, blesslen); + sv_catpvn(retval, blessstr, blesslen); + sv_catpvn(retval, "( ", 2); + if (indent >= 2) { + blesspad = apad; + apad = newSVsv(apad); + sv_x(aTHX_ apad, " ", 1, blesslen+2); + } } } + (*levelp)++; + ipad = sv_x(aTHX_ Nullsv, SvPVX(xpad), SvCUR(xpad), *levelp); + if (realtype <= SVt_PVBM) { /* scalar ref */ SV *namesv = newSVpvn("${", 2); sv_catpvn(namesv, name, namelen); diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs index 2e7cd4a7af..69fb7a7151 100644 --- a/ext/DynaLoader/dl_aix.xs +++ b/ext/DynaLoader/dl_aix.xs @@ -77,19 +77,18 @@ typedef struct Module { * We keep a list of all loaded modules to be able to call the fini * handlers at atexit() time. */ -static ModulePtr modList; +static ModulePtr modList; /* XXX threadead */ /* * The last error from one of the dl* routines is kept in static * variables here. Each error is returned only once to the caller. */ -static char errbuf[BUFSIZ]; -static int errvalid; +static char errbuf[BUFSIZ]; /* XXX threadead */ +static int errvalid; /* XXX threadead */ static void caterr(char *); static int readExports(ModulePtr); static void terminate(void); -static void *findMain(void); static char *strerror_failed = "(strerror failed)"; static char *strerror_r_failed = "(strerror_r failed)"; @@ -155,16 +154,14 @@ char *strerrorcpy(char *str, int err) { void *dlopen(char *path, int mode) { register ModulePtr mp; - static void *mainModule; + static int inited; /* XXX threadead */ /* * Upon the first call register a terminate handler that will - * close all libraries. Also get a reference to the main module - * for use with loadbind. + * close all libraries. */ - if (!mainModule) { - if ((mainModule = findMain()) == NULL) - return NULL; + if (!inited) { + inited++; atexit(terminate); } /* @@ -222,7 +219,12 @@ void *dlopen(char *path, int mode) mp->refCnt = 1; mp->next = modList; modList = mp; - if (loadbind(0, mainModule, mp->entry) == -1) { + /* + * Assume anonymous exports come from the module this dlopen + * is linked into, that holds true as long as dlopen and all + * of the perl core are in the same shared object. + */ + if (loadbind(0, (void *)dlopen, mp->entry) == -1) { dlclose(mp); errvalid++; strcpy(errbuf, "loadbind: "); @@ -526,52 +528,6 @@ static int readExports(ModulePtr mp) return 0; } -/* - * Find the main modules entry point. This is used as export pointer - * for loadbind() to be able to resolve references to the main part. - */ -static void * findMain(void) -{ - struct ld_info *lp; - char *buf; - int size = 4*1024; - int i; - void *ret; - - if ((buf = safemalloc(size)) == NULL) { - errvalid++; - strcpy(errbuf, "findMain: "); - strerrorcat(errbuf, errno); - return NULL; - } - while ((i = loadquery(L_GETINFO, buf, size)) == -1 && errno == ENOMEM) { - safefree(buf); - size += 4*1024; - if ((buf = safemalloc(size)) == NULL) { - errvalid++; - strcpy(errbuf, "findMain: "); - strerrorcat(errbuf, errno); - return NULL; - } - } - if (i == -1) { - errvalid++; - strcpy(errbuf, "findMain: "); - strerrorcat(errbuf, errno); - safefree(buf); - return NULL; - } - /* - * The first entry is the main module. The entry point - * returned by load() does actually point to the data - * segment origin. - */ - lp = (struct ld_info *)buf; - ret = lp->ldinfo_dataorg; - safefree(buf); - return ret; -} - /* dl_dlopen.xs * * Platform: SunOS/Solaris, possibly others which use dlopen. diff --git a/ext/Thread/Thread/Specific.pm b/ext/Thread/Thread/Specific.pm index 9c8a66a9e6..46b9b60981 100644 --- a/ext/Thread/Thread/Specific.pm +++ b/ext/Thread/Thread/Specific.pm @@ -18,7 +18,7 @@ C<key_create> returns a unique thread-specific key. sub import { use attrs qw(locked method); require fields; - fields->import(@_); + fields::->import(@_); } sub key_create { |