Change 20649 by [EMAIL PROTECTED] on 2003/08/12 12:14:31
Integrate:
[ 20639]
No dor in maint.
[ 20640]
returning would be good, too.
[ 20643]
A generally useful hunk from Ilya's microperl patch.
(If no fcntl F_SETFD, fake it the best we can.)
[ 20644]
More microperlish faking in case no fcntl F_SETFD for pipes.
[ 20645]
Localize PARENT (based on Ilya's microperl patch).
[ 20646]
Apply much of Ilya's microperl patch, but instead of
implementing the opendir()/readdir()/closedir() using
external commands give up "ANSI-pureness" and define them
in uconfig.sh, also define other stuff like rename() and putenv().
Leave out the $| emulation in my_fork() since we are
not supposed to have fork() under microperl.
[ 20647]
Oops.
[ 20648]
If we are void we cannot return a value.
Affected files ...
... //depot/maint-5.8/perl/Makefile.micro#5 integrate
... //depot/maint-5.8/perl/README.micro#2 integrate
... //depot/maint-5.8/perl/doio.c#18 integrate
... //depot/maint-5.8/perl/lib/Cwd.pm#3 integrate
... //depot/maint-5.8/perl/mg.c#25 integrate
... //depot/maint-5.8/perl/perl.c#53 integrate
... //depot/maint-5.8/perl/perl.h#48 integrate
... //depot/maint-5.8/perl/perlvars.h#14 integrate
... //depot/maint-5.8/perl/pp_sys.c#28 integrate
... //depot/maint-5.8/perl/sv.c#65 integrate
... //depot/maint-5.8/perl/uconfig.h#8 integrate
... //depot/maint-5.8/perl/uconfig.sh#7 integrate
... //depot/maint-5.8/perl/util.c#30 integrate
Differences ...
==== //depot/maint-5.8/perl/Makefile.micro#5 (text) ====
Index: perl/Makefile.micro
--- perl/Makefile.micro#4~18790~ Thu Feb 27 22:34:27 2003
+++ perl/Makefile.micro Tue Aug 12 05:14:31 2003
@@ -1,9 +1,10 @@
LD = $(CC)
-DEFINES = -DPERL_CORE -DPERL_MICRO
-OPTIMIZE =
+DEFINES = -DPERL_CORE -DPERL_MICRO -DSTANDARD_C -DPERL_USE_SAFE_PUTENV
+OPTIMIZE =
CFLAGS = $(DEFINES) $(OPTIMIZE)
LIBS = -lm
_O = .o
+ENV = env
all: microperl
@@ -15,7 +16,7 @@
uregcomp$(_O) uregexec$(_O) urun$(_O) \
uscope$(_O) usv$(_O) utaint$(_O) utoke$(_O) \
unumeric$(_O) ulocale$(_O) \
- uuniversal$(_O) uutf8$(_O) uutil$(_O) uperlapi$(_O)
+ uuniversal$(_O) uutf8$(_O) uutil$(_O) uperlapi$(_O) uxsutils$(_O)
microperl: $(O)
$(LD) -o $@ $(O) $(LIBS)
@@ -37,7 +38,7 @@
# The microconfiguration.
uconfig.h: uconfig.sh config_h.SH
- CONFIG_SH=uconfig.sh CONFIG_H=uconfig.h sh ./config_h.SH
+ $(ENV) CONFIG_SH=uconfig.sh CONFIG_H=uconfig.h sh ./config_h.SH
# Do not regenerate perly.c and perly.h.
@@ -80,7 +81,7 @@
$(CC) -c -o $@ $(CFLAGS) miniperlmain.c
uop$(_O): $(HE) op.c keywords.h
- $(CC) -c -o $@ $(CFLAGS) op.c
+ $(CC) -c -o $@ $(CFLAGS) -DPERL_EXTERNAL_GLOB op.c
ureentr$(_O): $(HE) reentr.c
$(CC) -c -o $@ $(CFLAGS) reentr.c
@@ -154,4 +155,7 @@
uperlapi$(_O): $(HE) perlapi.c perlapi.h
$(CC) -c -o $@ $(CFLAGS) perlapi.c
+uxsutils$(_O): $(HE) xsutils.c
+ $(CC) -c -o $@ $(CFLAGS) xsutils.c
+# That's it, folks!
==== //depot/maint-5.8/perl/README.micro#2 (text) ====
Index: perl/README.micro
--- perl/README.micro#1~17645~ Fri Jul 19 12:29:57 2002
+++ perl/README.micro Tue Aug 12 05:14:31 2003
@@ -6,6 +6,16 @@
All this is experimental. If you don't know what to do with microperl
you probably shouldn't. Do not report bugs in microperl; fix the bugs.
+We assume ANSI C plus the following:
+- <stdlib.h>
+- rename()
+- opendir(), readdir(), closedir() (via dirent.h)
+- memchr (via string.h)
+- (a safe) putenv() (via stdlib.h)
+- strtoul() (via stdlib.h)
+(grep for 'define' in uconfig.sh.)
+Also, Perl times() is defined to always return zeroes.
+
If you are still reading this and you are itching to try out microperl:
make -f Makefile.micro
==== //depot/maint-5.8/perl/lib/Cwd.pm#3 (text) ====
Index: perl/lib/Cwd.pm
--- perl/lib/Cwd.pm#2~18080~ Sun Nov 3 21:23:04 2002
+++ perl/lib/Cwd.pm Tue Aug 12 05:14:31 2003
@@ -379,6 +379,7 @@
{
$dotdots .= '/..';
@pst = @cst;
+ local *PARENT;
unless (opendir(PARENT, $dotdots))
{
carp "opendir($dotdots): $!";
==== //depot/maint-5.8/perl/mg.c#25 (text) ====
Index: perl/mg.c
--- perl/mg.c#24~20567~ Fri Aug 8 12:51:22 2003
+++ perl/mg.c Tue Aug 12 05:14:31 2003
@@ -1011,6 +1011,7 @@
int
Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg)
{
+#ifndef PERL_MICRO
#if defined(VMS) || defined(EPOC)
Perl_die(aTHX_ "Can't make list assignment to %%ENV on this system");
#else
@@ -1037,7 +1038,8 @@
}
# endif /* USE_ENVIRON_ARRAY */
# endif /* PERL_IMPLICIT_SYS || WIN32 */
-#endif /* VMS || EPC */
+#endif /* VMS || EPOC */
+#endif /* !PERL_MICRO */
return 0;
}
==== //depot/maint-5.8/perl/perl.c#53 (text) ====
Index: perl/perl.c
--- perl/perl.c#52~20493~ Tue Aug 5 01:43:49 2003
+++ perl/perl.c Tue Aug 12 05:14:31 2003
@@ -304,8 +304,10 @@
("__environ", (unsigned long *) &environ_pointer, NULL);
#endif /* environ */
-#ifdef USE_ENVIRON_ARRAY
+#ifndef PERL_MICRO
+# ifdef USE_ENVIRON_ARRAY
PL_origenviron = environ;
+# endif
#endif
/* Use sysconf(_SC_CLK_TCK) if available, if not
@@ -522,6 +524,7 @@
/* if PERL_USE_SAFE_PUTENV is defined environ will not have been copied
* so we certainly shouldn't free it here
*/
+#ifndef PERL_MICRO
#if defined(USE_ENVIRON_ARRAY) && !defined(PERL_USE_SAFE_PUTENV)
if (environ != PL_origenviron
#ifdef USE_ITHREADS
@@ -541,6 +544,7 @@
environ = PL_origenviron;
}
#endif
+#endif /* !PERL_MICRO */
#ifdef USE_ITHREADS
/* the syntax tree is shared between clones
@@ -1574,9 +1578,7 @@
boot_core_PerlIO();
boot_core_UNIVERSAL();
-#ifndef PERL_MICRO
boot_core_xsutils();
-#endif
if (xsinit)
(*xsinit)(aTHX); /* in case linked C routines want magical variables */
@@ -2994,6 +2996,8 @@
SV *cpp = newSVpvn("",0);
SV *cmd = NEWSV(0,0);
+ if (cpp_cfg[0] == 0) /* PERL_MICRO? */
+ Perl_croak(aTHX_ "Can't run with cpp -P with CPPSTDIN undefined");
if (strEQ(cpp_cfg, "cppstdin"))
Perl_sv_catpvf(aTHX_ cpp, "%s/", BIN_EXP);
sv_catpv(cpp, cpp_cfg);
@@ -3848,6 +3852,7 @@
GvMULTI_on(PL_envgv);
hv = GvHVn(PL_envgv);
hv_magic(hv, Nullgv, PERL_MAGIC_env);
+#ifndef PERL_MICRO
#ifdef USE_ENVIRON_ARRAY
/* Note that if the supplied env parameter is actually a copy
of the global environ then it may now point to free'd memory
@@ -3879,6 +3884,7 @@
mg_set(sv);
}
#endif /* USE_ENVIRON_ARRAY */
+#endif /* !PERL_MICRO */
}
TAINT_NOT;
if ((tmpgv = gv_fetchpv("$",TRUE, SVt_PV))) {
==== //depot/maint-5.8/perl/perl.h#48 (text) ====
Index: perl/perl.h
--- perl/perl.h#47~20606~ Sun Aug 10 13:43:47 2003
+++ perl/perl.h Tue Aug 12 05:14:31 2003
@@ -297,7 +297,7 @@
# define STANDARD_C 1
#endif
-#if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(OS2) ||
defined(__DGUX) || defined( EPOC) || defined(__QNX__) || defined(NETWARE)
+#if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(OS2) ||
defined(__DGUX) || defined( EPOC) || defined(__QNX__) || defined(NETWARE) ||
defined(PERL_MICRO)
# define DONT_DECLARE_STD 1
#endif
@@ -619,11 +619,13 @@
# endif
#endif
+#ifndef PERL_MICRO
#ifndef memchr
# ifndef HAS_MEMCHR
# define memchr(s,c,n) ninstr((char*)(s), ((char*)(s)) + n, &(c), &(c) + 1)
# endif
#endif
+#endif
#ifndef HAS_BCMP
# ifndef bcmp
@@ -1977,12 +1979,13 @@
# endif
# define PERL_FPU_INIT fpsetmask(0);
# else
-# if defined(SIGFPE) && defined(SIG_IGN)
+# if defined(SIGFPE) && defined(SIG_IGN) && !defined(PERL_MICRO)
# define PERL_FPU_INIT PL_sigfpe_saved = signal(SIGFPE, SIG_IGN);
# define PERL_FPU_PRE_EXEC { Sigsave_t xfpe; rsignal_save(SIGFPE,
PL_sigfpe_saved, &xfpe);
# define PERL_FPU_POST_EXEC rsignal_restore(SIGFPE, &xfpe); }
# else
# define PERL_FPU_INIT
+
# endif
# endif
#endif
==== //depot/maint-5.8/perl/perlvars.h#14 (text) ====
Index: perl/perlvars.h
--- perl/perlvars.h#13~20567~ Fri Aug 8 12:51:22 2003
+++ perl/perlvars.h Tue Aug 12 05:14:31 2003
@@ -55,13 +55,17 @@
/* This is constant on most architectures, a global on OS/2 */
PERLVARI(Gsh_path, char *, SH_PATH)/* full path of shell */
+#ifndef PERL_MICRO
/* If Perl has to ignore SIGPFE, this is its saved state.
* See perl.h macros PERL_FPU_INIT and PERL_FPU_{PRE,POST}_EXEC. */
PERLVAR(Gsigfpe_saved, Sighandler_t)
+#endif
/* Restricted hashes placeholder value.
* The contents are never used, only the address. */
PERLVAR(Gsv_placeholder, SV)
+#ifndef PERL_MICRO
PERLVARI(Gcsighandlerp, Sighandler_t, &Perl_csighandler) /* Pointer to
C-level sighandler */
+#endif
==== //depot/maint-5.8/perl/pp_sys.c#28 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#27~20636~ Tue Aug 12 01:58:28 2003
+++ perl/pp_sys.c Tue Aug 12 05:14:31 2003
@@ -4138,6 +4138,8 @@
PerlLIO_close(pp[0]);
#if defined(HAS_FCNTL) && defined(F_SETFD)
fcntl(pp[1], F_SETFD, FD_CLOEXEC);
+#else
+ PerlLIO_close(pp[1]); /* Do as best as we can: pretend success. */
#endif
}
if (PL_op->op_flags & OPf_STACKED) {
@@ -4382,7 +4384,19 @@
}
RETURN;
#else
+# ifdef PERL_MICRO
+ dSP;
+ PUSHs(sv_2mortal(newSVnv((NV)0.0)));
+ EXTEND(SP, 4);
+ if (GIMME == G_ARRAY) {
+ PUSHs(sv_2mortal(newSVnv((NV)0.0)));
+ PUSHs(sv_2mortal(newSVnv((NV)0.0)));
+ PUSHs(sv_2mortal(newSVnv((NV)0.0)));
+ }
+ RETURN;
+# else
DIE(aTHX_ "times not implemented");
+# endif
#endif /* HAS_TIMES */
}
==== //depot/maint-5.8/perl/sv.c#65 (text) ====
Index: perl/sv.c
--- perl/sv.c#64~20580~ Sat Aug 9 01:32:25 2003
+++ perl/sv.c Tue Aug 12 05:14:31 2003
@@ -7091,6 +7091,7 @@
}
if (GvHV(gv) && !HvNAME(GvHV(gv))) {
hv_clear(GvHV(gv));
+#ifndef PERL_MICRO
#ifdef USE_ENVIRON_ARRAY
if (gv == PL_envgv
# ifdef USE_ITHREADS
@@ -7101,6 +7102,7 @@
environ[0] = Nullch;
}
#endif
+#endif /* !PERL_MICRO */
}
}
}
==== //depot/maint-5.8/perl/uconfig.h#8 (text) ====
Index: perl/uconfig.h
--- perl/uconfig.h#7~19919~ Tue Jul 1 14:28:15 2003
+++ perl/uconfig.h Tue Aug 12 05:14:31 2003
@@ -361,7 +361,7 @@
* available to read directory entries. You may have to include
* <dirent.h>. See I_DIRENT.
*/
-/*#define HAS_READDIR / **/
+#define HAS_READDIR /**/
/* HAS_SEEKDIR:
* This symbol, if defined, indicates that the seekdir routine is
@@ -392,7 +392,7 @@
* to rename files. Otherwise you should do the unlink(), link(), unlink()
* trick.
*/
-/*#define HAS_RENAME / **/
+#define HAS_RENAME /**/
/* HAS_RMDIR:
* This symbol, if defined, indicates that the rmdir routine is
@@ -663,7 +663,7 @@
* whether dirent is available or not. You should use this pseudo type to
* portably declare your directory entries.
*/
-/*#define I_DIRENT / **/
+#define I_DIRENT /**/
/*#define DIRNAMLEN / **/
#define Direntry_t struct dirent
@@ -738,7 +738,7 @@
* This symbol, if defined, indicates that <stdlib.h> exists and should
* be included.
*/
-/*#define I_STDLIB / **/
+#define I_STDLIB /**/
/* I_STRING:
* This symbol, if defined, indicates to the C program that it should
@@ -1999,7 +1999,7 @@
* This symbol, if defined, indicates that the strtoul routine is
* available to provide conversion of strings to unsigned long.
*/
-/*#define HAS_STRTOUL / **/
+#define HAS_STRTOUL /**/
/* HAS_UNION_SEMUN:
* This symbol, if defined, indicates that the union semun is
==== //depot/maint-5.8/perl/uconfig.sh#7 (xtext) ====
Index: perl/uconfig.sh
--- perl/uconfig.sh#6~19919~ Tue Jul 1 14:28:15 2003
+++ perl/uconfig.sh Tue Aug 12 05:14:31 2003
@@ -55,7 +55,7 @@
d_chroot='undef'
d_chsize='undef'
d_class='undef'
-d_closedir='undef'
+d_closedir='define'
d_cmsghdr_s='undef'
d_const='undef'
d_copysignl='undef'
@@ -271,12 +271,12 @@
d_quad='undef'
d_random_r='undef'
d_readdir64_r='undef'
-d_readdir='undef'
+d_readdir='define'
d_readdir_r='undef'
d_readlink='undef'
d_readv='undef'
d_recvmsg='undef'
-d_rename='undef'
+d_rename='define'
d_rewinddir='undef'
d_rmdir='undef'
d_safebcpy='undef'
@@ -371,7 +371,7 @@
d_strtold='undef'
d_strtoll='undef'
d_strtoq='undef'
-d_strtoul='undef'
+d_strtoul='define'
d_strtoull='undef'
d_strtouq='undef'
d_strxfrm='undef'
@@ -481,7 +481,7 @@
i_crypt='undef'
i_db='undef'
i_dbm='undef'
-i_dirent='undef'
+i_dirent='define'
i_dld='undef'
i_dlfcn='undef'
i_fcntl='undef'
@@ -517,7 +517,7 @@
i_socks='undef'
i_stdarg='define'
i_stddef='undef'
-i_stdlib='undef'
+i_stdlib='define'
i_string='define'
i_sunmath='undef'
i_sysaccess='undef'
==== //depot/maint-5.8/perl/util.c#30 (text) ====
Index: perl/util.c
--- perl/util.c#29~20181~ Wed Jul 23 06:12:38 2003
+++ perl/util.c Tue Aug 12 05:14:31 2003
@@ -1523,6 +1523,7 @@
#endif /* WIN32 || NETWARE */
+#ifndef PERL_MICRO
I32
Perl_setenv_getix(pTHX_ char *nam)
{
@@ -1540,6 +1541,7 @@
} /* potential SEGV's */
return i;
}
+#endif /* !PERL_MICRO */
#endif /* !VMS && !EPOC*/
@@ -1826,6 +1828,8 @@
#if defined(HAS_FCNTL) && defined(F_SETFD)
/* Close error pipe automatically if exec works */
fcntl(pp[1], F_SETFD, FD_CLOEXEC);
+#else
+ PerlLIO_close(pp[1]); /* Do as best as we can: pretend success. */
#endif
}
/* Now dup our end of _the_ pipe to right position */
@@ -1965,6 +1969,8 @@
PerlLIO_close(pp[0]);
#if defined(HAS_FCNTL) && defined(F_SETFD)
fcntl(pp[1], F_SETFD, FD_CLOEXEC);
+#else
+ PerlLIO_close(pp[1]); /* Do as best as we can: pretend success. */
#endif
}
if (p[THIS] != (*mode == 'r')) {
End of Patch.