gv_stashpvn
gv_stashsv
he_root
-hoistmust
hv_clear
hv_delayfree_ent
hv_delete
{
int exitstatus;
+#ifdef USE_THREADS
+ MUTEX_INIT(&malloc_mutex);
+#endif
+
PERL_SYS_INIT(&argc,&argv);
perl_init_i18nl10n(1);
CV *cv;
HV *hv;
- sv_setpvf(sv, "%_:%ld-%ld",
- GvSV(curcop->cop_filegv),
- (long)subline, (long)curcop->cop_line);
+ sv_setpvf(sv, "%_:%ld-%ld", GvSV(curcop->cop_filegv),
+ (long)(subline < 0 ? -subline : subline),
+ (long)curcop->cop_line);
gv_efullname3(tmpstr, gv, Nullch);
hv_store(GvHV(DBsub), SvPVX(tmpstr), SvCUR(tmpstr), sv, 0);
if (!db_postponed) {
op_free(o);
#ifdef USE_THREADS
- if (subline) {
+ if (subline > 0) {
argop = newOP(OP_PADAV, OPf_REF);
argop->op_targ = 0; /* curpad[0] is @_ */
}
}
#else
argop = newUNOP(OP_RV2AV, 0,
- scalar(newGVOP(OP_GV, 0, subline ?
+ scalar(newGVOP(OP_GV, 0, subline > 0 ?
defgv : gv_fetchpv("ARGV", TRUE, SVt_PVAV))));
#endif /* USE_THREADS */
return newUNOP(type, 0, scalar(argop));
break;
case '-':
case 0:
+#ifdef WIN32
+ case '\r':
+#endif
case '\n':
case '\t':
break;
if (strEQ(origfilename,"-"))
scriptname = "";
if (fdscript >= 0) {
- rsfp = PerlIO_fdopen(fdscript,"r");
+ rsfp = PerlIO_fdopen(fdscript,PERL_SCRIPT_MODE);
#if defined(HAS_FCNTL) && defined(F_SETFD)
if (rsfp)
fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */
rsfp = PerlIO_stdin();
}
else {
- rsfp = PerlIO_open(scriptname,"r");
+ rsfp = PerlIO_open(scriptname,PERL_SCRIPT_MODE);
#if defined(HAS_FCNTL) && defined(F_SETFD)
if (rsfp)
fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */
#define printf PerlIO_stdoutf
#endif
+#ifndef PERL_SCRIPT_MODE
+#define PERL_SCRIPT_MODE "r"
+#endif
+
/*
* nice_chunk and nice_chunk size need to be set
* and queried under the protection of sv_mutex
{ char *name = SvPV(((SVOP*)yyvsp[0].opval)->op_sv, na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ { CvUNIQUE_on(compcv); subline = -subline; }
yyval.opval = yyvsp[0].opval; }
break;
case 57:
- short yyss[YYSTACKSIZE];
- YYSTYPE yyvs[YYSTACKSIZE];
- #define yystacksize YYSTACKSIZE
- #line 631 "perly.y"
+ #line 632 "perly.y"
/* PROGRAM */
--- 1283,1288 ----
***************
*** 1361,1372 ****
---- 1291,1347 ----
+ #define YYACCEPT goto yyaccept
+ #define YYERROR goto yyerrlab
+ int
+! yyparse()
+ {
+ register int yym, yyn, yystate;
+ #if YYDEBUG
+ register char *yys;
+ extern char *getenv();
+
+ if (yys = getenv("YYDEBUG"))
+ {
+--- 1291,1348 ----
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
+
+ };
+
+ void
-+ yydestruct(ptr)
-+ void* ptr;
++ yydestruct(void *ptr)
+ {
+ struct ysv* ysave = (struct ysv*)ptr;
+ if (ysave->yyss) Safefree(ysave->yyss);
+ }
+
int
- yyparse()
+! yyparse(void)
{
register int yym, yyn, yystate;
+ register short *yyssp;
+ int retval = 0;
#if YYDEBUG
register char *yys;
++ #ifndef __cplusplus
extern char *getenv();
+ #endif
++ #endif
+
+ struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
+ SAVEDESTRUCTOR(yydestruct, ysave);
{
***************
*** 1381,1384 ****
---- 1356,1367 ----
+--- 1357,1368 ----
yychar = (-1);
+ /*
! printf("yydebug: state %d, reading %d (%s)\n", yystate,
yychar, yys);
}
---- 1379,1383 ----
+--- 1380,1384 ----
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
! goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
---- 1389,1412 ----
+--- 1390,1413 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
! goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
---- 1444,1468 ----
+--- 1445,1469 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
! *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
---- 1474,1480 ----
+--- 1475,1481 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
! yystate, yychar, yys);
}
#endif
---- 1493,1499 ----
+--- 1494,1500 ----
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! fprintf(stderr,
! printf("yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
#endif
---- 1504,1508 ----
+--- 1505,1509 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
#endif
***************
-*** 2278,2283 ****
+*** 2279,2284 ****
#if YYDEBUG
if (yydebug)
! printf("yydebug: after reduction, shifting from state 0 to\
! state %d\n", YYFINAL);
#endif
yystate = YYFINAL;
---- 2292,2298 ----
+--- 2294,2300 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
#endif
yystate = YYFINAL;
***************
-*** 2293,2297 ****
+*** 2294,2298 ****
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! printf("yydebug: state %d, reading %d (%s)\n",
YYFINAL, yychar, yys);
}
---- 2308,2312 ----
+--- 2310,2314 ----
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
YYFINAL, yychar, yys);
}
***************
-*** 2308,2317 ****
+*** 2309,2318 ****
#if YYDEBUG
if (yydebug)
! printf("yydebug: after reduction, shifting from state %d \
! goto yyoverflow;
}
*++yyssp = yystate;
---- 2323,2347 ----
+--- 2325,2349 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
}
*++yyssp = yystate;
***************
-*** 2319,2326 ****
+*** 2320,2327 ****
goto yyloop;
yyoverflow:
! yyerror("yacc stack overflow");
yyaccept:
! return (0);
}
---- 2349,2356 ----
+--- 2351,2358 ----
goto yyloop;
yyoverflow:
! yyerror("Out of memory for yacc stack");
subname : WORD { char *name = SvPV(((SVOP*)$1)->op_sv, na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ { CvUNIQUE_on(compcv); subline = -subline; }
$$ = $1; }
;
dSP; /* Make POPBLOCK work. */
PERL_CONTEXT *cx;
SV **newsp;
- I32 gimme;
+ I32 gimme = 0; /* SUSPECT - INITIALZE TO WHAT? NI-S */
I32 optype;
OP dummy;
OP *oop = op, *rop;
)
{
tryname = name;
- tryrsfp = PerlIO_open(name,"r");
+ tryrsfp = PerlIO_open(name,PERL_SCRIPT_MODE);
}
else {
AV *ar = GvAVn(incgv);
sv_setpvf(namesv, "%s/%s", dir, name);
#endif
tryname = SvPVX(namesv);
- tryrsfp = PerlIO_open(tryname, "r");
+ tryrsfp = PerlIO_open(tryname, PERL_SCRIPT_MODE);
if (tryrsfp) {
if (tryname[0] == '.' && tryname[1] == '/')
tryname += 2;
SvCOMPILED_on(sv);
}
+
data->last_start_max = is_inf
? I32_MAX : data->pos_min + data->pos_delta;
}
- sv_catpvn(data->last_found, OPERAND(scan)+1, l);
+ sv_catpvn(data->last_found, (char *)(OPERAND(scan)+1), l);
data->last_end = data->pos_min + l;
data->pos_min += l; /* As in the first entry. */
data->flags &= ~SF_BEFORE_EOL;
ret = reg_node((regflags & PMf_FOLD)
? ((regflags & PMf_LOCALE) ? EXACTFL : EXACTF)
: EXACT);
- s = OPERAND(ret);
+ s = (char *) OPERAND(ret);
regc(0, s++); /* save spot for len */
for (len = 0, p = regparse - 1;
len < 127 && p < regxend;
register I32 def;
I32 numlen;
- s = opnd = OPERAND(regcode);
+ s = opnd = (char *) OPERAND(regcode);
ret = reg_node(ANYOF);
for (Class = 0; Class < 33; Class++)
regc(0, s++);
croak("%s", buf);
}
+
*/
#ifndef DOINIT
-EXT const U8 regkind[];
+EXTCONST U8 regkind[];
#else
-EXT const U8 regkind[] = {
+EXTCONST U8 regkind[] = {
END,
BOL,
BOL,
goto phooey;
} else if (c = prog->regstclass) {
I32 doevery = (prog->reganch & ROPT_SKIP) == 0;
- char *class;
+ char *Class;
if (minlen)
dontbother = minlen - 1;
/* We know what class it must start with. */
switch (OP(c)) {
case ANYOF:
- class = OPERAND(c);
+ Class = (char *) OPERAND(c);
while (s < strend) {
- if (reginclass(class, *s)) {
+ if (reginclass(Class, *s)) {
if (tmp && regtry(prog, s))
goto got_it;
else
nextchar = UCHARAT(++locinput);
break;
case EXACT:
- s = OPERAND(scan);
+ s = (char *) OPERAND(scan);
ln = UCHARAT(s++);
/* Inline the first character, for speed. */
if (UCHARAT(s) != nextchar)
reg_flags |= RF_tainted;
/* FALL THROUGH */
case EXACTF:
- s = OPERAND(scan);
+ s = (char *) OPERAND(scan);
ln = UCHARAT(s++);
/* Inline the first character, for speed. */
if (UCHARAT(s) != nextchar &&
nextchar = UCHARAT(locinput);
break;
case ANYOF:
- s = OPERAND(scan);
+ s = (char *) OPERAND(scan);
if (nextchar < 0)
nextchar = UCHARAT(locinput);
if (!reginclass(s, nextchar))
scan = reginput;
if (max != REG_INFTY && max < loceol - scan)
loceol = scan + max;
- opnd = OPERAND(p);
+ opnd = (char *) OPERAND(p);
switch (OP(p)) {
case ANY:
while (scan < loceol && *scan != '\n')
return match ^ ((flags & ANYOF_INVERT) != 0);
}
+
+
}
}
+#ifdef WIN32
+ win32_strip_return(sv);
+#endif
+
return (SvCUR(sv) - append) ? SvPVX(sv) : Nullch;
}
#define SvTAINT(sv) STMT_START{ if(tainted){SvTAINTED_on(sv);} }STMT_END
-#ifdef CRIPPLED_CC
-
#define SvPV_force(sv, lp) sv_pvn_force(sv, &lp)
#define SvPV(sv, lp) sv_pvn(sv, &lp)
#define SvIVx(sv) sv_iv(sv)
#define SvUV(sv) SvIVx(sv)
#define SvTRUE(sv) SvTRUEx(sv)
-#else /* !CRIPPLED_CC */
+#ifndef CRIPPLED_CC
+/* redefine some things to more efficient inlined versions */
#undef SvIV
#define SvIV(sv) (SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv))
((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force(sv, &lp))
-#undef SvTRUE
-#define SvTRUE(sv) ( \
+#ifdef __GNUC__
+# undef SvIVx
+# undef SvUVx
+# undef SvNVx
+# undef SvPVx
+# undef SvTRUE
+# undef SvTRUEx
+# define SvIVx(sv) ({SV *nsv = (SV*)(sv); SvIV(nsv); })
+# define SvUVx(sv) ({SV *nsv = (SV*)(sv); SvUV(nsv); })
+# define SvNVx(sv) ({SV *nsv = (SV*)(sv); SvNV(nsv); })
+# define SvPVx(sv, lp) ({SV *nsv = (sv); SvPV(nsv, lp); })
+# define SvTRUE(sv) ( \
!sv \
? 0 \
: SvPOK(sv) \
- ? ((Xpv = (XPV*)SvANY(sv)) && \
- (*Xpv->xpv_pv > '0' || \
- Xpv->xpv_cur > 1 || \
- (Xpv->xpv_cur && *Xpv->xpv_pv != '0')) \
+ ? (({XPV *nxpv = (XPV*)SvANY(sv); \
+ nxpv && \
+ (*nxpv->xpv_pv > '0' || \
+ nxpv->xpv_cur > 1 || \
+ (nxpv->xpv_cur && *nxpv->xpv_pv != '0')); }) \
? 1 \
: 0) \
: \
: SvNOK(sv) \
? SvNVX(sv) != 0.0 \
: sv_2bool(sv) )
-
-#ifdef __GNUC__
-# define SvIVx(sv) ({SV *nsv = (SV*)(sv); SvIV(nsv); })
-# define SvUVx(sv) ({SV *nsv = (SV*)(sv); SvUV(nsv); })
-# define SvNVx(sv) ({SV *nsv = (SV*)(sv); SvNV(nsv); })
-# define SvPVx(sv, lp) ({SV *nsv = (sv); SvPV(nsv, lp); })
-#else
+# define SvTRUEx(sv) ({SV *nsv = (sv); SvTRUE(nsv); })
+#else /* __GNUC__ */
+#ifndef USE_THREADS
+/* These inlined macros use globals, which will require a thread
+ * declaration in user code, so we avoid them under threads */
+
+# undef SvIVx
+# undef SvUVx
+# undef SvNVx
+# undef SvPVx
+# undef SvTRUE
+# undef SvTRUEx
# define SvIVx(sv) ((Sv = (sv)), SvIV(Sv))
# define SvUVx(sv) ((Sv = (sv)), SvUV(Sv))
# define SvNVx(sv) ((Sv = (sv)), SvNV(Sv))
# define SvPVx(sv, lp) ((Sv = (sv)), SvPV(Sv, lp))
-#endif /* __GNUC__ */
-
-#define SvTRUEx(sv) ((Sv = (sv)), SvTRUE(Sv))
-
-#endif /* CRIPPLED_CC */
+# define SvTRUE(sv) ( \
+ !sv \
+ ? 0 \
+ : SvPOK(sv) \
+ ? ((Xpv = (XPV*)SvANY(sv)) && \
+ (*Xpv->xpv_pv > '0' || \
+ Xpv->xpv_cur > 1 || \
+ (Xpv->xpv_cur && *Xpv->xpv_pv != '0')) \
+ ? 1 \
+ : 0) \
+ : \
+ SvIOK(sv) \
+ ? SvIVX(sv) != 0 \
+ : SvNOK(sv) \
+ ? SvNVX(sv) != 0.0 \
+ : sv_2bool(sv) )
+# define SvTRUEx(sv) ((Sv = (sv)), SvTRUE(Sv))
+#endif /* !USE_THREADS */
+#endif /* !__GNU__ */
+#endif /* !CRIPPLED_CC */
#define newRV_inc(sv) newRV(sv)
#ifdef __GNUC__
Unmatched right bracket at (re_eval 1) line 1, at end of line
syntax error at (re_eval 1) line 1, near ""{"}"
Compilation failed in regexp at - line 1.
+########
+BEGIN { @ARGV = qw(a b c) }
+BEGIN { print "argv <@ARGV>\nbegin <",shift,">\n" }
+END { print "end <",shift,">\nargv <@ARGV>\n" }
+INIT { print "init <",shift,">\n" }
+EXPECT
+argv <a b c>
+begin <a>
+init <b>
+end <c>
+argv <>
#!./perl
-print "1..51\n";
+print "1..52\n";
# Test glob operations.
local(*bar) = *bar;
print "$bar\n";
+$var = "ok 49";
+$_ = \$var;
+print $$_,"\n";
+
package FINALE;
{
- $ref3 = bless ["ok 51\n"]; # package destruction
- my $ref2 = bless ["ok 50\n"]; # lexical destruction
- local $ref1 = bless ["ok 49\n"]; # dynamic destruction
+ $ref3 = bless ["ok 52\n"]; # package destruction
+ my $ref2 = bless ["ok 51\n"]; # lexical destruction
+ local $ref1 = bless ["ok 50\n"]; # dynamic destruction
1; # flush any temp values on stack
}
char q;
if (s) {
char *nl = strrchr(s,'\n');
- if (nl)
+ if (nl)
*nl = '\0';
}
else if (multi_close < 32 || multi_close == 127) {
deprecate("comma-less variable list");
}
+#ifdef WIN32
+
+static I32
+win32_textfilter(int idx, SV *sv, int maxlen)
+{
+ I32 count = FILTER_READ(idx+1, sv, maxlen);
+ if (count > 0 && !maxlen)
+ win32_strip_return(sv);
+ return count;
+}
+#endif
+
+
void
lex_start(SV *line)
{
else
return 0 ; /* end of file */
}
+
}
return SvCUR(buf_sv);
}
return (*funcp)(idx, buf_sv, maxlen);
}
+
static char *
filter_gets(register SV *sv, register FILE *fp, STRLEN append)
{
+#ifdef WIN32FILTER
+ if (!rsfp_filters) {
+ filter_add(win32_textfilter,NULL);
+ }
+#endif
if (rsfp_filters) {
if (!append)
}
else
return (sv_gets(sv, fp, append));
-
}
register char *d;
register I32 tmp;
STRLEN len;
+ GV *gv = Nullgv;
+ GV **gvp = 0;
if (pending_ident) {
char pit = pending_ident;
}
goto retry;
case '\r':
+#ifndef WIN32CHEAT
warn("Illegal character \\%03o (carriage return)", '\r');
croak(
"(Maybe you didn't strip carriage returns after a network transfer?)\n");
+#endif
case ' ': case '\t': case '\f': case 013:
s++;
goto retry;
case 'z': case 'Z':
keylookup: {
- GV *gv = Nullgv;
- GV **gvp = 0;
+ gv = Nullgv;
+ gvp = 0;
bufptr = s;
s = scan_word(s, tokenbuf, sizeof tokenbuf, FALSE, &len);
return 0;
}
+
if (!len) {
if (SvTAIL(littlestr)) {
if (bigend > big && bigend[-1] == '\n')
- return bigend - 1;
+ return (char *)(bigend - 1);
else
- return bigend;
+ return (char *) bigend;
}
return (char*)big;
}
}
#endif
+
#include "perl.h"
static void
-dep()
+dep(void)
{
deprecate("\"do\" to call subroutines");
}
};
void
-yydestruct(ptr)
-void* ptr;
+yydestruct(void *ptr)
{
struct ysv* ysave = (struct ysv*)ptr;
if (ysave->yyss) Safefree(ysave->yyss);
}
int
-yyparse()
+yyparse(void)
{
register int yym, yyn, yystate;
register short *yyssp;
int retval = 0;
#if YYDEBUG
register char *yys;
+#ifndef __cplusplus
# ifndef getenv
extern char *getenv();
# endif
#endif
+#endif
struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
SAVEDESTRUCTOR(yydestruct, ysave);
{ char *name = SvPV(((SVOP*)yyvsp[0].opval)->op_sv, na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ { CvUNIQUE_on(compcv); subline = -subline; }
yyval.opval = yyvsp[0].opval; }
break;
case 57:
#
# uncomment next line if you want debug version of perl (big,slow)
-#CFG=Debug
+CFG=Debug
#
# set the install locations of the compiler include/libraries
..\taint.c \
..\toke.c \
..\universal.c \
- ..\util.c
+ ..\util.c \
+ ..\malloc.c
CORE_OBJ= ..\av.obj \
..\deb.obj \
..\taint.obj \
..\toke.obj \
..\universal.obj\
- ..\util.obj
+ ..\util.obj \
+ ..\malloc.obj
WIN32_C = perllib.c \
win32.c \
$(CORE_OBJ) : $(CORE_H)
$(DLL_OBJ) : $(CORE_H)
-perldll.def : $(MINIPERL) $(CONFIGPM)
+perldll.def : $(MINIPERL) $(CONFIGPM) makedef.pl ..\global.sym
$(MINIPERL) -w makedef.pl $(DEFINES) $(CCTYPE) > perldll.def
$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
$(CC) $(CFLAGS) -MT -UPERLDLL -c perl95.c
win32sckmt.obj : win32sck.c
- $(CC) $(CFLAGS) -MT -c $(OBJOUT_FLAG)win32sckmt.obj win32sck.c
+ $(CC) $(CFLAGS) -MT -UPERLDLL -c $(OBJOUT_FLAG)win32sckmt.obj win32sck.c
win32mt.obj : win32.c
- $(CC) $(CFLAGS) -MT -c $(OBJOUT_FLAG)win32mt.obj win32.c
+ $(CC) $(CFLAGS) -MT -UPERLDLL -c $(OBJOUT_FLAG)win32mt.obj win32.c
$(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
$(LINK32) -subsystem:console -out:perl95.exe $(LINK_FLAGS) $(LIBFILES) \
## Target system: WIN32
#
-archlibexp='~INST_TOP~\lib'
+archlibexp='~INST_TOP~\lib\~archname~'
archname='MSWin32'
cc='bcc32'
ccflags='-DWIN32'
dlsrc='dl_win32.xs'
dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread'
extensions='~static_ext~ ~dynamic_ext~'
-installarchlib='~INST_TOP~\lib'
+installarchlib='~INST_TOP~\lib\~archname~'
installprivlib='~INST_TOP~\lib'
libpth=''
libs=''
alignbytes='8'
aphostname=''
ar='tlib /P128'
-archlib='~INST_TOP~\lib'
+archlib='~INST_TOP~\lib\~archname~'
archobjs=''
awk='awk'
baserev='5.0'
d_msgget='define'
d_msgrcv='define'
d_msgsnd='define'
-d_mymalloc='undef'
+d_mymalloc='define'
d_nice='undef'
d_oldarchlib='undef'
d_oldsock='undef'
full_sed=''
gcc=''
gccversion=''
+gethbadd_addr_type='char *'
+gethbadd_alen_type='int'
+getnbadd_net_type='long'
gidtype='gid_t'
glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib '
grep='grep'
d_msgget='define'
d_msgrcv='define'
d_msgsnd='define'
-d_mymalloc='undef'
+d_mymalloc='define'
d_nice='undef'
d_oldarchlib='undef'
d_oldsock='undef'
full_sed=''
gcc=''
gccversion=''
+gethbadd_addr_type='char *'
+gethbadd_alen_type='int'
+getnbadd_net_type='long'
gidtype='gid_t'
glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib '
grep='grep'
* $Id: Config_h.U,v 3.0.1.4 1995/09/25 09:10:49 ram Exp $
*/
-/* Configuration time: Thu Apr 11 06:20:49 PDT 1996
- * Configured by: garyng
+/* Configuration time: undef
+ * Configured by: nick
* Target system:
*/
* where library files may be held under a private library, for
* instance.
*/
-#ifdef _ALPHA_
-#define ARCHNAME "alpha-mswin32" /**/
-#else
-#define ARCHNAME "x86-mswin32" /**/
-#endif
+#define ARCHNAME "MSWin32-x86-thread" /**/
/* BIN:
* This symbol holds the path of the bin directory where the package will
*/
/*#define HAS_GETHOSTENT /**/
+/* HAS_GETHBADD:
+ * This symbol, if defined, indicates that the gethostbyaddr routine is
+ * available to lookup host names by their IP addresses.
+ */
+/*#define HAS_GETHBADD /**/
+
+/* Gethbadd_addr_t:
+ * This symbol holds the type used for the 1st argument
+ * to gethostbyaddr().
+ */
+#define Gethbadd_addr_t char *
+
+/* Gethbadd_alen_t:
+ * This symbol holds the type used for the 2nd argument
+ * to gethostbyaddr().
+ */
+#define Gethbadd_alen_t int
+
+/* HAS_GETNBADD:
+ * This symbol, if defined, indicates that the getnetbyaddr routine is
+ * available to lookup networks by their IP addresses.
+ */
+/*#define HAS_GETNBADD /**/
+
+/* Gethbadd_net_t:
+ * This symbol holds the type used for the 1st argument
+ * to getnetbyaddr().
+ */
+#define Getnbadd_net_t long
+
/* HAS_UNAME:
* This symbol, if defined, indicates that the C program may use the
* uname() routine to derive the host name. See also HAS_GETHOSTNAME
*/
/*#define I_NETINET_IN /**/
+/* I_NETDB:
+ * This symbol, if defined, indicates that <netdb.h> exists and
+ * should be included.
+ */
+/*#define I_NETDB /**/
+
/* I_PWD:
* This symbol, if defined, indicates to the C program that it should
* include <pwd.h>.
* This symbol contains the ~name expanded version of ARCHLIB, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define ARCHLIB "c:\\perl\\lib" /**/
-#define ARCHLIB_EXP (win32PerlLibPath()) /**/
+#define ARCHLIB "c:\\perl\\lib\\MSWin32-x86-thread" /**/
+#define ARCHLIB_EXP (win32PerlLibPath(ARCHNAME,NULL)) /**/
/* BINCOMPAT3:
* This symbol, if defined, indicates that Perl 5.004 should be
/* MYMALLOC:
* This symbol, if defined, indicates that we're using our own malloc.
*/
-/*#define MYMALLOC /**/
+#define MYMALLOC /**/
/* OLDARCHLIB:
* This variable, if defined, holds the name of the directory in
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
#define PRIVLIB "c:\\perl\\lib" /**/
-#define PRIVLIB_EXP "c:\\perl\\lib" /**/
+#define PRIVLIB_EXP (win32PerlLibPath(NULL)) /**/
/* SH_PATH:
* This symbol contains the full pathname to the shell used on this
* /bin/pdksh, /bin/ash, /bin/bash, or even something such as
* D:/bin/sh.exe.
*/
-#define SH_PATH "cmd.exe" /**/
+#define SH_PATH "cmd /x /c" /**/
/* SIG_NAME:
* This symbol contains a list of signal names in order of
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
#define SITEARCH "c:\\perl\\lib\\site" /**/
-#define SITEARCH_EXP "c:\\perl\\lib\\site" /**/
+#define SITEARCH_EXP (win32PerlLibPath("site",ARCHNAME,NULL)) /**/
/* SITELIB:
* This symbol contains the name of the private library for this package.
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
#define SITELIB "c:\\perl\\lib\\site" /**/
-#define SITELIB_EXP "c:\\perl\\lib\\site" /**/
+#define SITELIB_EXP (win32PerlLibPath("site",NULL)) /**/
/* STARTPERL:
* This variable contains the string to put in front of a perl
* script to make sure (one hopes) that it runs with perl and not
* some shell.
*/
-#define STARTPERL "#perl" /**/
+#define STARTPERL "#!perl" /**/
/* USE_PERLIO:
* This symbol, if defined, indicates that the PerlIO abstraction should
* $Id: Config_h.U,v 3.0.1.4 1995/09/25 09:10:49 ram Exp $
*/
-/* Configuration time: Thu Apr 11 06:20:49 PDT 1996
- * Configured by: garyng
+/* Configuration time: undef
+ * Configured by: nick
* Target system:
*/
* where library files may be held under a private library, for
* instance.
*/
-#ifdef _ALPHA_
-#define ARCHNAME "alpha-mswin32" /**/
-#else
-#define ARCHNAME "x86-mswin32" /**/
-#endif
+#define ARCHNAME "MSWin32-x86-thread" /**/
/* BIN:
* This symbol holds the path of the bin directory where the package will
*/
/*#define HAS_GETHOSTENT /**/
+/* HAS_GETHBADD:
+ * This symbol, if defined, indicates that the gethostbyaddr routine is
+ * available to lookup host names by their IP addresses.
+ */
+/*#define HAS_GETHBADD /**/
+
+/* Gethbadd_addr_t:
+ * This symbol holds the type used for the 1st argument
+ * to gethostbyaddr().
+ */
+#define Gethbadd_addr_t char *
+
+/* Gethbadd_alen_t:
+ * This symbol holds the type used for the 2nd argument
+ * to gethostbyaddr().
+ */
+#define Gethbadd_alen_t int
+
+/* HAS_GETNBADD:
+ * This symbol, if defined, indicates that the getnetbyaddr routine is
+ * available to lookup networks by their IP addresses.
+ */
+/*#define HAS_GETNBADD /**/
+
+/* Gethbadd_net_t:
+ * This symbol holds the type used for the 1st argument
+ * to getnetbyaddr().
+ */
+#define Getnbadd_net_t long
+
/* HAS_UNAME:
* This symbol, if defined, indicates that the C program may use the
* uname() routine to derive the host name. See also HAS_GETHOSTNAME
*/
/*#define I_NETINET_IN /**/
+/* I_NETDB:
+ * This symbol, if defined, indicates that <netdb.h> exists and
+ * should be included.
+ */
+/*#define I_NETDB /**/
+
/* I_PWD:
* This symbol, if defined, indicates to the C program that it should
* include <pwd.h>.
* This symbol contains the ~name expanded version of ARCHLIB, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
-#define ARCHLIB "c:\\perl\\lib" /**/
-#define ARCHLIB_EXP (win32PerlLibPath()) /**/
+#define ARCHLIB "c:\\perl\\lib\\MSWin32-x86-thread" /**/
+#define ARCHLIB_EXP (win32PerlLibPath(ARCHNAME,NULL)) /**/
/* BINCOMPAT3:
* This symbol, if defined, indicates that Perl 5.004 should be
/* MYMALLOC:
* This symbol, if defined, indicates that we're using our own malloc.
*/
-/*#define MYMALLOC /**/
+#define MYMALLOC /**/
/* OLDARCHLIB:
* This variable, if defined, holds the name of the directory in
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
#define PRIVLIB "c:\\perl\\lib" /**/
-#define PRIVLIB_EXP "c:\\perl\\lib" /**/
+#define PRIVLIB_EXP (win32PerlLibPath(NULL)) /**/
/* SH_PATH:
* This symbol contains the full pathname to the shell used on this
* /bin/pdksh, /bin/ash, /bin/bash, or even something such as
* D:/bin/sh.exe.
*/
-#define SH_PATH "cmd.exe" /**/
+#define SH_PATH "cmd /x /c" /**/
/* SIG_NAME:
* This symbol contains a list of signal names in order of
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
#define SITEARCH "c:\\perl\\lib\\site" /**/
-#define SITEARCH_EXP "c:\\perl\\lib\\site" /**/
+#define SITEARCH_EXP (win32PerlLibPath("site",ARCHNAME,NULL)) /**/
/* SITELIB:
* This symbol contains the name of the private library for this package.
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
#define SITELIB "c:\\perl\\lib\\site" /**/
-#define SITELIB_EXP "c:\\perl\\lib\\site" /**/
+#define SITELIB_EXP (win32PerlLibPath("site",NULL)) /**/
/* STARTPERL:
* This variable contains the string to put in front of a perl
* script to make sure (one hopes) that it runs with perl and not
* some shell.
*/
-#define STARTPERL "#perl" /**/
+#define STARTPERL "#!perl" /**/
/* USE_PERLIO:
* This symbol, if defined, indicates that the PerlIO abstraction should
s#/[ *\*]*\*/#/**/#;
if (/^\s*#define\s+ARCHLIB_EXP/)
{
- $_ = "#define ARCHLIB_EXP (win32PerlLibPath())\t/**/\n"
- . "#define APPLLIB_EXP (win32SiteLibPath())\t/**/\n";
+ $_ = "#define ARCHLIB_EXP (win32PerlLibPath(ARCHNAME,NULL))\t/**/\n";
+ }
+ if (/^\s*#define\s+PRIVLIB_EXP/)
+ {
+ $_ = "#define PRIVLIB_EXP (win32PerlLibPath(NULL))\t/**/\n"
+ }
+ if (/^\s*#define\s+SITEARCH_EXP/)
+ {
+ $_ = "#define SITEARCH_EXP (win32PerlLibPath(\"site\",ARCHNAME,NULL))\t/**/\n";
+ }
+ if (/^\s*#define\s+SITELIB_EXP/)
+ {
+ $_ = "#define SITELIB_EXP (win32PerlLibPath(\"site\",NULL))\t/**/\n";
}
print H;
}
shift(@ARGV);
}
+$opt{'archname'} = 'MSWin32';
+if (defined $ENV{'PROCESSOR_ARCHITECTURE'})
+ {
+ $opt{'archname'} .= '-'.$ENV{'PROCESSOR_ARCHITECTURE'};
+ }
+
+if ($opt{'ccflags'} =~ /USE_THREADS/)
+ {
+ $opt{'archname'} .= '-thread';
+ }
+
if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true
$opt{PATCHLEVEL} = int($1 || 0);
$opt{SUBVERSION} = $2 || '00';
$define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
}
+open(CFG,'config.h') || die "Cannot open config.h:$!";
+while (<CFG>)
+ {
+ $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
+ }
+close(CFG);
+
warn join(' ',keys %define)."\n";
my $CCTYPE = shift || "MSVC";
+print "LIBRARY Perl\n";
+print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
+print "CODE LOADONCALL\n";
+print "DATA LOADONCALL NONSHARED MULTIPLE\n";
+print "EXPORTS\n";
+
$skip_sym=<<'!END!OF!SKIP!';
Perl_block_type
Perl_additem
Perl_opsave
!END!OF!SKIP!
+if ($define{'MYMALLOC'})
+ {
+ $skip_sym .= <<'!END!OF!SKIP!';
+Perl_safefree
+Perl_safemalloc
+Perl_saferealloc
+Perl_safecalloc
+!END!OF!SKIP!
+ emit_symbol('Perl_malloc');
+ emit_symbol('Perl_free');
+ emit_symbol('Perl_realloc');
+ emit_symbol('Perl_calloc');
+ }
+
unless ($define{'USE_THREADS'})
{
$skip_sym .= <<'!END!OF!SKIP!';
# sticks in front of them.
-print "LIBRARY Perl\n";
-print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
-print "CODE LOADONCALL\n";
-print "DATA LOADONCALL NONSHARED MULTIPLE\n";
-print "EXPORTS\n";
-
open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!;
while (<GLOBAL>) {
my $symbol;
my $symbol;
next if (!/^[A-Za-z]/);
next if (/^#/);
+ s/\r//g;
$symbol = $_;
next if ($skip_sym =~ m/^$symbol/m);
$symbol = "Perl_".$symbol if ($define{'USE_THISPTR'}
win32_get_osfhandle
Perl_win32_init
Perl_init_os_extras
+Perl_getTHR
+Perl_setTHR
RunPerl
..\taint.c \
..\toke.c \
..\universal.c \
- ..\util.c
+ ..\util.c \
+ ..\malloc.c
CORE_OBJ= ..\av.obj \
..\deb.obj \
..\taint.obj \
..\toke.obj \
..\universal.obj\
- ..\util.obj
+ ..\util.obj \
+ ..\malloc.obj
WIN32_C = perllib.c \
win32.c \
/* check out the file system characteristics */
if (GetFullPathName(".", MAX_PATH, root, &dummy)) {
- if (dummy = strchr(root, '\\'))
+ dummy = strchr(root,'\\');
+ if (dummy)
*++dummy = '\0';
if (GetVolumeInformation(root, volname, MAX_PATH,
&serial, &maxname, &flags, 0, 0)) {
}
return 0;
}
+
int exitstatus;
PerlInterpreter *my_perl;
+#ifdef USE_THREADS
+ MUTEX_INIT(&malloc_mutex);
+#endif
+
PERL_SYS_INIT(&argc,&argv);
perl_init_i18nl10n(1);
}
char *
-win32PerlLibPath(void)
+win32PerlLibPath(char *sfx,...)
{
+ va_list ap;
char *end;
+ va_start(ap,sfx);
GetModuleFileName((PerlDllHandle == INVALID_HANDLE_VALUE)
? GetModuleHandle(NULL)
: PerlDllHandle,
szPerlLibRoot,
sizeof(szPerlLibRoot));
-
*(end = strrchr(szPerlLibRoot, '\\')) = '\0';
if (stricmp(end-4,"\\bin") == 0)
end -= 4;
strcpy(end,"\\lib");
+ while (sfx)
+ {
+ strcat(end,"\\");
+ strcat(end,sfx);
+ sfx = va_arg(ap,char *);
+ }
+ va_end(ap);
return (szPerlLibRoot);
}
-char *
-win32SiteLibPath(void)
-{
- static char szPerlSiteLib[MAX_PATH+1];
- strcpy(szPerlSiteLib, win32PerlLibPath());
- strcat(szPerlSiteLib, "\\site");
- return (szPerlSiteLib);
-}
BOOL
HasRedirection(char *ptr)
return putchar(c);
}
+#ifdef MYMALLOC
+
+#ifndef USE_PERL_SBRK
+
+static char *committed = NULL;
+static char *base = NULL;
+static char *reserved = NULL;
+static char *brk = NULL;
+static DWORD pagesize = 0;
+static DWORD allocsize = 0;
+
+void *
+sbrk(int need)
+{
+ void *result;
+ if (!pagesize)
+ {SYSTEM_INFO info;
+ GetSystemInfo(&info);
+ /* Pretend page size is larger so we don't perpetually
+ * call the OS to commit just one page ...
+ */
+ pagesize = info.dwPageSize << 3;
+ allocsize = info.dwAllocationGranularity;
+ }
+ /* This scheme fails eventually if request for contiguous
+ * block is denied so reserve big blocks - this is only
+ * address space not memory ...
+ */
+ if (brk+need >= reserved)
+ {
+ DWORD size = 64*1024*1024;
+ char *addr;
+ if (committed && reserved && committed < reserved)
+ {
+ /* Commit last of previous chunk cannot span allocations */
+ addr = (char *) VirtualAlloc(committed,reserved-committed,MEM_COMMIT,PAGE_READWRITE);
+ if (addr)
+ committed = reserved;
+ }
+ /* Reserve some (more) space
+ * Note this is a little sneaky, 1st call passes NULL as reserved
+ * so lets system choose where we start, subsequent calls pass
+ * the old end address so ask for a contiguous block
+ */
+ addr = (char *) VirtualAlloc(reserved,size,MEM_RESERVE,PAGE_NOACCESS);
+ if (addr)
+ {
+ reserved = addr+size;
+ if (!base)
+ base = addr;
+ if (!committed)
+ committed = base;
+ if (!brk)
+ brk = committed;
+ }
+ else
+ {
+ return (void *) -1;
+ }
+ }
+ result = brk;
+ brk += need;
+ if (brk > committed)
+ {
+ DWORD size = ((brk-committed + pagesize -1)/pagesize) * pagesize;
+ char *addr = (char *) VirtualAlloc(committed,size,MEM_COMMIT,PAGE_READWRITE);
+ if (addr)
+ {
+ committed += size;
+ }
+ else
+ return (void *) -1;
+ }
+ return result;
+}
+
+#endif
+#endif
+
DllExport void*
win32_malloc(size_t size)
{
free(block);
}
+
int
win32_open_osfhandle(long handle, int flags)
{
#endif
}
+#ifdef USE_BINMODE_SCRIPTS
+
+void
+win32_strip_return(SV *sv)
+{
+ char *s = SvPVX(sv);
+ char *e = s+SvCUR(sv);
+ char *d = s;
+ while (s < e)
+ {
+ if (*s == '\r' && s[1] == '\n')
+ {
+ *d++ = '\n';
+ s += 2;
+ }
+ else
+ {
+ *d++ = *s++;
+ }
+ }
+ SvCUR_set(sv,d-SvPVX(sv));
+}
+
+#endif
+
+
+
extern int setuid(uid_t uid);
extern int setgid(gid_t gid);
extern int kill(int pid, int sig);
+extern void *sbrk(int need);
#undef Stat
#define Stat win32_stat
extern int do_aspawn(void* really, void ** mark, void ** arglast);
extern int do_spawn(char *cmd);
extern char do_exec(char *cmd);
-extern char * win32PerlLibPath(void);
-extern char * win32SiteLibPath(void);
+extern char * win32PerlLibPath(char *sfx,...);
extern int IsWin95(void);
extern int IsWinNT(void);
#include <sys/socket.h>
#include <netdb.h>
+#ifdef MYMALLOC
+#define EMBEDMYMALLOC /**/
+/* #define USE_PERL_SBRK /**/
+/* #define PERL_SBRK_VIA_MALLOC /**/
+#endif
+
+#ifdef PERLDLL
+#define PERL_CORE
+#endif
+
+#ifdef USE_BINMODE_SCRIPTS
+#define PERL_SCRIPT_MODE "rb"
+EXT void win32_strip_return(struct sv *sv);
+#else
+#define PERL_SCRIPT_MODE "r"
+#define win32_strip_return(sv) NOOP
+#endif
+
#endif /* _INC_WIN32_PERL5 */
#define puts win32_puts
#define getchar win32_getchar
#define putchar win32_putchar
+
+#if !defined(MYMALLOC) || !defined(PERLDLL)
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
#define malloc win32_malloc
#define calloc win32_calloc
#define realloc win32_realloc
#define free win32_free
+#endif
#define pipe(fd) win32_pipe((fd), 512, O_BINARY)
#define pause() win32_sleep((32767L << 16) + 32767)
#include "EXTERN.h"
#include "perl.h"
+__declspec(thread) struct thread *Perl_current_thread = NULL;
+
+void
+Perl_setTHR(struct thread *t)
+{
+ Perl_current_thread = t;
+}
+
+struct thread *
+Perl_getTHR(void)
+{
+ return Perl_current_thread;
+}
+
void
Perl_alloc_thread_key(void)
{
typedef THREAD_RET_TYPE thread_func_t(void *);
+
START_EXTERN_C
+
+#if defined(PERLDLL) && (!defined(__BORLANDC__) || defined(_DLL))
+extern __declspec(thread) struct thread *Perl_current_thread;
+#define SET_THR(t) (Perl_current_thread = t)
+#define THR Perl_current_thread
+#else
+#define THR Perl_getTHR()
+#define SET_THR(t) Perl_setTHR(t)
+#endif
+
void Perl_alloc_thread_key _((void));
int Perl_thread_create _((struct perl_thread *thr, thread_func_t *fn));
void Perl_set_thread_self _((struct perl_thread *thr));
+struct perl_thread *Perl_getTHR _((void));
+void Perl_setTHR _((struct perl_thread *t));
END_EXTERN_C
#define INIT_THREADS NOOP
-#define ALLOC_THREAD_KEY Perl_alloc_thread_key()
+#define ALLOC_THREAD_KEY NOOP
#define SET_THREAD_SELF(thr) Perl_set_thread_self(thr)
#define JOIN(t, avp) \
croak("panic: JOIN"); \
} STMT_END
-#define SET_THR(t) \
- STMT_START { \
- if (TlsSetValue(thr_key, (void *) (t)) == 0) \
- croak("panic: TlsSetValue"); \
- } STMT_END
-
#define YIELD Sleep(0)
#endif /* _WIN32THREAD_H */
+