summaryrefslogtreecommitdiff
path: root/os2/os2ish.h
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-10-23 23:24:28 -0400
committerGurusamy Sarathy <gsar@cpan.org>1999-10-24 11:11:02 +0000
commited344e4f516e393bcdfd181ec61ffbb056bebd56 (patch)
treede14a1859e804586b669ccab1b5e1f97623c5e7e /os2/os2ish.h
parent72b3d9b4e0eb3eb49735d998edaf49073f03375e (diff)
downloadperl-ed344e4f516e393bcdfd181ec61ffbb056bebd56.tar.gz
Re: [PATCH 5.005_62] OS/2 improvements
Message-Id: <199910240724.DAA12230@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@4432
Diffstat (limited to 'os2/os2ish.h')
-rw-r--r--os2/os2ish.h46
1 files changed, 32 insertions, 14 deletions
diff --git a/os2/os2ish.h b/os2/os2ish.h
index 6993dfca5d..23b109670f 100644
--- a/os2/os2ish.h
+++ b/os2/os2ish.h
@@ -183,16 +183,26 @@ void Perl_OS2_init(char **);
/* XXX This code hideously puts env inside: */
-#ifdef __EMX__
+#ifdef PERL_CORE
+# define PERL_SYS_INIT3(argcp, argvp, envp) STMT_START { \
+ _response(argcp, argvp); \
+ _wildcard(argcp, argvp); \
+ Perl_OS2_init(*envp); } STMT_END
# define PERL_SYS_INIT(argcp, argvp) STMT_START { \
_response(argcp, argvp); \
_wildcard(argcp, argvp); \
- Perl_OS2_init(env); } STMT_END
-#else /* Compiling embedded Perl with non-EMX compiler */
+ Perl_OS2_init(NULL); } STMT_END
+#else /* Compiling embedded Perl or Perl extension */
+# define PERL_SYS_INIT3(argcp, argvp, envp) STMT_START { \
+ Perl_OS2_init(*envp); } STMT_END
# define PERL_SYS_INIT(argcp, argvp) STMT_START { \
- Perl_OS2_init(env); } STMT_END
+ Perl_OS2_init(NULL); } STMT_END
+#endif
+
+#ifndef __EMX__
# define PERL_CALLCONV _System
#endif
+
#define PERL_SYS_TERM() MALLOC_TERM
/* #define PERL_SYS_TERM() STMT_START { \
@@ -318,6 +328,7 @@ extern OS2_Perl_data_t OS2_Perl_data;
#define Perl_rc (OS2_Perl_data.rc)
#define Perl_severity (OS2_Perl_data.severity)
#define errno_isOS2 12345678
+#define errno_isOS2_set 12345679
#define OS2_Perl_flags (OS2_Perl_data.flags)
#define Perl_HAB_set_f 1
#define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
@@ -339,6 +350,7 @@ void Perl_Deregister_MQ(int serve);
int Perl_Serve_Messages(int force);
/* Cannot prototype with I32 at this point. */
int Perl_Process_Messages(int force, long *cntp);
+char *os2_execname(void);
struct _QMSG;
struct PMWIN_entries_t {
@@ -356,23 +368,29 @@ struct PMWIN_entries_t {
extern struct PMWIN_entries_t PMWIN_entries;
void init_PMWIN_entries(void);
-#define perl_hmq_GET(serve) Perl_Register_MQ(serve);
-#define perl_hmq_UNSET(serve) Perl_Deregister_MQ(serve);
+#define perl_hmq_GET(serve) Perl_Register_MQ(serve)
+#define perl_hmq_UNSET(serve) Perl_Deregister_MQ(serve)
#define OS2_XS_init() (*OS2_Perl_data.xs_init)()
+
+#if _EMX_CRT_REV_ >= 60
+# define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2_set, \
+ _setsyserrno(rc))
+#else
+# define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2)
+#endif
+
/* The expressions below return true on error. */
/* INCL_DOSERRORS needed. rc should be declared outside. */
#define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
/* INCL_WINERRORS needed. */
#define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
#define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
-#define FillOSError(rc) (Perl_rc = rc, \
- errno = errno_isOS2, \
+#define FillOSError(rc) (os2_setsyserrno(rc), \
Perl_severity = SEVERITY_ERROR)
-#define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
- errno = errno_isOS2, \
- Perl_severity = ERRORIDSEV(Perl_rc), \
- Perl_rc = ERRORIDERROR(Perl_rc))
+#define FillWinError (Perl_severity = ERRORIDSEV(Perl_rc), \
+ Perl_rc = ERRORIDERROR(Perl_rc)), \
+ os2_setsyserrno(Perl_rc)
#define STATIC_FILE_LENGTH 127
@@ -392,7 +410,7 @@ char *os2error(int rc);
#define QSS_FILE 8 /* Buggy until fixpack18 */
#define QSS_SHARED 16
-#ifdef _OS2EMX_H
+#ifdef _OS2_H
APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
ULONG _res_,PVOID buf,ULONG bufsz);
@@ -550,5 +568,5 @@ typedef struct {
PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
-#endif /* _OS2EMX_H */
+#endif /* _OS2_H */