summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-11-19 14:16:00 +1200
committerChip Salzenberg <chip@atlantic.net>1996-11-19 14:16:00 +1200
commit55497cffdd24c959994f9a8ddd56db8ce85e1c5b (patch)
tree444dfb8adc0e5b96d56e0532791122c366f50a3e /os2
parentc822f08a5087943f7d9e2c36ce42ea035f03ab97 (diff)
downloadperl-55497cffdd24c959994f9a8ddd56db8ce85e1c5b.tar.gz
[inseparable changes from patch from perl5.003_07 to perl5.003_08]
CORE LANGUAGE CHANGES Subject: Bitwise op sign rationalization From: Chip Salzenberg <chip@atlantic.net> Files: op.c opcode.pl pod/perlop.pod pod/perltoc.pod pp.c pp.h pp_hot.c proto.h sv.c t/op/bop.t Make bitwise ops result in unsigned values, unless C<use integer> is in effect. Includes initial support for UVs. Subject: Defined scoping for C<my> in control structures From: Chip Salzenberg <chip@atlantic.net> Files: op.c perly.c perly.c.diff perly.h perly.y proto.h toke.c Finally defines semantics of "my" in control expressions, like the condition of "if" and "while". In all cases, scope of a "my" var extends to the end of the entire control structure. Also adds new construct "for my", which automatically declares the control variable "my" and limits its scope to the loop. Subject: Fix ++/-- after int conversion (e.g. 'printf "%d"') From: Chip Salzenberg <chip@atlantic.net> Files: pp.c pp_hot.c sv.c This patch makes Perl correctly ignore SvIVX() if either NOK or POK is true, since SvIVX() may be a truncated or overflowed version of the real value. Subject: Make code match Camel II re: functions that use $_ From: Paul Marquess <pmarquess@bfsec.bt.co.uk> Files: opcode.pl Subject: Provide scalar context on left side of "->" From: Chip Salzenberg <chip@atlantic.net> Files: perly.c perly.y Subject: Quote bearword package/handle FOO in "funcname FOO => 'bar'" From: Chip Salzenberg <chip@atlantic.net> Files: toke.c OTHER CORE CHANGES Subject: Warn on overflow of octal and hex integers From: Chip Salzenberg <chip@atlantic.net> Files: proto.h toke.c util.c Subject: If -w active, warn for commas and hashes ('#') in qw() From: Chip Salzenberg <chip@atlantic.net> Files: toke.c Subject: Fixes for pack('w') From: Ulrich Pfeifer <pfeifer@charly.informatik.uni-dortmund.de> Files: pp.c t/op/pack.t Subject: More complete output from sv_dump() From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: sv.c Subject: Major '..' and debugger patches From: Ilya Zakharevich <ilya@math.ohio-state.edu> Files: lib/perl5db.pl op.c pp_ctl.c scope.c scope.h Subject: Fix for formline() From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: global.sym mg.c perl.h pod/perldiag.pod pp_ctl.c proto.h sv.c t/op/write.t Subject: Fix stack botch in untie and binmode From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: pp_sys.c Subject: Complete EMBED, including symbols from interp.sym From: Chip Salzenberg <chip@atlantic.net> Files: MANIFEST embed.pl ext/DynaLoader/dlutils.c ext/SDBM_File/sdbm/sdbm.h global.sym handy.h malloc.c perl.h pp_sys.c proto.h regexec.c toke.c util.c x2p/Makefile.SH x2p/a2p.h x2p/handy.h x2p/util.h New define EMBEDMYMALLOC makes embedding total by avoiding "Mymalloc" etc. Subject: Support old embedding for people who want it From: Chip Salzenberg <chip@atlantic.net> Files: MANIFEST Makefile.SH old_embed.pl old_global.sym PORTABILITY Subject: Miscellaneous VMS fixes From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU> Files: lib/ExtUtils/Liblist.pm lib/ExtUtils/MM_VMS.pm lib/Math/Complex.pm lib/Time/Local.pm lib/timelocal.pl perl.h perl_exp.SH proto.h t/TEST t/io/read.t t/lib/findbin.t t/lib/getopt.t util.c utils/h2xs.PL vms/Makefile vms/config.vms vms/descrip.mms vms/ext/Stdio/Stdio.pm vms/ext/Stdio/Stdio.xs vms/perlvms.pod vms/test.com vms/vms.c Subject: DJGPP patches (MS-DOS) From: "Douglas E. Wegscheid" <wegscd@whirlpool.com> Files: doio.c dosish.h ext/SDBM_File/sdbm/sdbm.c handy.h lib/AutoSplit.pm lib/Cwd.pm lib/File/Find.pm malloc.c perl.c perl.h pp_sys.c proto.h sv.c util.c Subject: Patch to make Perl work under AmigaOS From: "Norbert Pueschel" <pueschel@imsdd.meb.uni-bonn.de> Files: MANIFEST hints/amigaos.sh installman lib/File/Basename.pm lib/File/Find.pm pod/pod2man.PL pp_sys.c util.c
Diffstat (limited to 'os2')
-rw-r--r--os2/Changes8
-rw-r--r--os2/Makefile.SHs2
-rw-r--r--os2/os2.c47
-rw-r--r--os2/os2ish.h5
4 files changed, 58 insertions, 4 deletions
diff --git a/os2/Changes b/os2/Changes
index 9a9524f161..2bd48b2942 100644
--- a/os2/Changes
+++ b/os2/Changes
@@ -104,3 +104,11 @@ after 5.003_05:
perl___ - cannot fork, can dynalink.
The build of the first one - perl - is rather convoluted, and
requires a build of miniperl_.
+
+after 5.003_07:
+ custom tmpfile and tmpname which may use $TMP, $TEMP.
+ all the calls to OS/2 API wrapped so that it is safe to use
+ them under DOS (may die(), though).
+ Tested that popen works under DOS with modified PDKSH and RSX.
+ File::Copy works under DOS.
+ MakeMaker modified to work under DOS (perlmain.c.tmp and sh -c true).
diff --git a/os2/Makefile.SHs b/os2/Makefile.SHs
index a1fcaa49ed..c498706627 100644
--- a/os2/Makefile.SHs
+++ b/os2/Makefile.SHs
@@ -49,6 +49,8 @@ perl5.def: perl.linkexp
echo ' "dlsym"' >>$@
echo ' "dlerror"' >>$@
echo ' "perl_init_i18nl10n"' >>$@
+ echo ' "my_tmpfile"' >>$@
+ echo ' "my_tmpnam"' >>$@
!NO!SUBS!
if [ ! -z "$myttyname" ] ; then
diff --git a/os2/os2.c b/os2/os2.c
index 37219c85d6..f192dd6c29 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -73,6 +73,7 @@ setpriority(int which, int pid, int val)
prio = sys_prio(pid);
+ if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */
if (priors[(32 - val) >> 5] + 1 == (prio >> 8)) {
/* Do not change class. */
return CheckOSError(DosSetPriority((pid < 0)
@@ -114,6 +115,7 @@ getpriority(int which /* ignored */, int pid)
PIB *pib;
ULONG rc, ret;
+ if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */
/* DosGetInfoBlocks has old priority! */
/* if (CheckOSError(DosGetInfoBlocks(&tib, &pib))) return -1; */
/* if (pid != pib->pib_ulpid) { */
@@ -409,6 +411,8 @@ tcp0(char *name)
{
static BYTE buf[20];
PFN fcn;
+
+ if (!(_emx_env & 0x200)) croak("%s requires OS/2", name); /* Die if not OS/2. */
if (!htcp)
DosLoadModule(buf, sizeof buf, "tcp32dll", &htcp);
if (htcp && DosQueryProcAddr(htcp, 0, name, &fcn) == 0)
@@ -421,6 +425,8 @@ tcp1(char *name, int arg)
{
static BYTE buf[20];
PFN fcn;
+
+ if (!(_emx_env & 0x200)) croak("%s requires OS/2", name); /* Die if not OS/2. */
if (!htcp)
DosLoadModule(buf, sizeof buf, "tcp32dll", &htcp);
if (htcp && DosQueryProcAddr(htcp, 0, name, &fcn) == 0)
@@ -601,6 +607,7 @@ os2error(int rc)
static char buf[300];
ULONG len;
+ if (!(_emx_env & 0x200)) return ""; /* Nop if not OS/2. */
if (rc == 0)
return NULL;
if (DosGetMessage(NULL, 0, buf, sizeof buf - 1, rc, "OSO001.MSG", &len))
@@ -947,8 +954,12 @@ Xs_OS2_init()
char *file = __FILE__;
{
GV *gv;
-
- newXS("File::Copy::syscopy", XS_File__Copy_syscopy, file);
+
+ if (_emx_env & 0x200) { /* OS/2 */
+ newXS("File::Copy::syscopy", XS_File__Copy_syscopy, file);
+ newXS("Cwd::extLibpath", XS_Cwd_extLibpath, file);
+ newXS("Cwd::extLibpath_set", XS_Cwd_extLibpath_set, file);
+ }
newXS("DynaLoader::mod2fname", XS_DynaLoader_mod2fname, file);
newXS("Cwd::current_drive", XS_Cwd_current_drive, file);
newXS("Cwd::sys_chdir", XS_Cwd_sys_chdir, file);
@@ -958,8 +969,6 @@ Xs_OS2_init()
newXS("Cwd::sys_is_relative", XS_Cwd_sys_is_relative, file);
newXS("Cwd::sys_cwd", XS_Cwd_sys_cwd, file);
newXS("Cwd::sys_abspath", XS_Cwd_sys_abspath, file);
- newXS("Cwd::extLibpath", XS_Cwd_extLibpath, file);
- newXS("Cwd::extLibpath_set", XS_Cwd_extLibpath_set, file);
gv = gv_fetchpv("OS2::is_aout", TRUE, SVt_PV);
GvMULTI_on(gv);
#ifdef PERL_IS_AOUT
@@ -992,3 +1001,33 @@ Perl_OS2_init()
}
}
+#undef tmpnam
+#undef tmpfile
+
+char *
+my_tmpnam (char *str)
+{
+ char *p = getenv("TMP"), *tpath;
+ int len;
+
+ if (!p) p = getenv("TEMP");
+ tpath = tempnam(p, "pltmp");
+ if (str && tpath) {
+ strcpy(str, tpath);
+ return str;
+ }
+ return tpath;
+}
+
+FILE *
+my_tmpfile ()
+{
+ struct stat s;
+
+ stat(".", &s);
+ if (s.st_mode & S_IWOTH) {
+ return tmpfile();
+ }
+ return fopen(my_tmpnam(NULL), "w+b"); /* Race condition, but
+ grants TMP. */
+}
diff --git a/os2/os2ish.h b/os2/os2ish.h
index 6510a1f145..0597fdcd39 100644
--- a/os2/os2ish.h
+++ b/os2/os2ish.h
@@ -99,6 +99,11 @@ extern char *tmppath;
PerlIO *my_syspopen(char *cmd, char *mode);
/* Cannot prototype with I32 at this point. */
int my_syspclose(PerlIO *f);
+FILE *my_tmpfile (void);
+char *my_tmpnam (char *);
+
+#define tmpfile my_tmpfile
+#define tmpnam my_tmpnam
/*
* fwrite1() should be a routine with the same calling sequence as fwrite(),