diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1997-11-05 01:04:10 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1997-11-05 01:04:10 +0000 |
commit | 4e35701fd273ba8d0093a29660dee38a92408e9b (patch) | |
tree | afa97d9bf675ea146b86cf09a7c27e1bfbb980f3 /perl.h | |
parent | 2b544454484ed91b6f1ae2cffef4c29b1302dcd7 (diff) | |
download | perl-4e35701fd273ba8d0093a29660dee38a92408e9b.tar.gz |
Builds C++ Borland, MSVC++ (Win32) and GCC++ (Solaris)
p4raw-id: //depot/ansiperl@203
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 101 |
1 files changed, 49 insertions, 52 deletions
@@ -29,6 +29,22 @@ #include "embed.h" +#ifdef __cplusplus +# define START_EXTERN_C extern "C" { +# define END_EXTERN_C } +# define EXTERN_C extern "C" +#else +# define START_EXTERN_C +# define END_EXTERN_C +# define EXTERN_C +#endif + +#if defined(USE_THREADS) /* && !defined(PERL_CORE) && !defined(PERLDLL) */ +#ifndef CRIPPLED_CC +#define CRIPPLED_CC +#endif +#endif + #ifdef OP_IN_REGISTER # ifdef __GNUC__ # define stringify_immed(s) #s @@ -64,21 +80,6 @@ register struct op *op asm(stringify(OP_IN_REGISTER)); #define WITH_THR(s) do { dTHR; s; } while (0) -#ifdef USE_THREADS -# ifdef FAKE_THREADS -# include "fakethr.h" -# else -# ifdef WIN32 -# include <win32thread.h> -# else -# include <pthread.h> -typedef pthread_mutex_t perl_mutex; -typedef pthread_cond_t perl_cond; -typedef pthread_key_t perl_key; -# endif /* WIN32 */ -# endif /* FAKE_THREADS */ -#endif /* USE_THREADS */ - /* * SOFT_CAST can be used for args to prototyped functions to retain some * type checking; it only casts if the compiler does not know prototypes. @@ -949,7 +950,31 @@ typedef I32 (*filter_t) _((int, SV *, int)); # include "unixish.h" # endif # endif -#endif +#endif + +/* + * USE_THREADS needs to be after unixish.h as <pthread.h> includes <sys/signal.h> + * which defines NSIG - which will stop inclusion of <signal.h> + * this results in many functions being undeclared which bothers C++ + * May make sense to have threads after "*ish.h" anyway + */ + +#ifdef USE_THREADS +# ifdef FAKE_THREADS +# include "fakethr.h" +# else +# ifdef WIN32 +# include <win32thread.h> +# else +# include <pthread.h> +typedef pthread_mutex_t perl_mutex; +typedef pthread_cond_t perl_cond; +typedef pthread_key_t perl_key; +# endif /* WIN32 */ +# endif /* FAKE_THREADS */ +#endif /* USE_THREADS */ + + #ifdef VMS # define STATUS_NATIVE statusvalue_vms @@ -1121,13 +1146,7 @@ EXT char Error[1]; #define U_I(what) ((unsigned int)(what)) #define U_L(what) ((U32)(what)) #else -# ifdef __cplusplus - extern "C" { -# endif -U32 cast_ulong _((double)); -# ifdef __cplusplus - } -# endif +EXTERN_C U32 cast_ulong _((double)); #define U_S(what) ((U16)cast_ulong((double)(what))) #define U_I(what) ((unsigned int)cast_ulong((double)(what))) #define U_L(what) (cast_ulong((double)(what))) @@ -1138,15 +1157,11 @@ U32 cast_ulong _((double)); #define I_V(what) ((IV)(what)) #define U_V(what) ((UV)(what)) #else -# ifdef __cplusplus - extern "C" { -# endif +START_EXTERN_C I32 cast_i32 _((double)); IV cast_iv _((double)); UV cast_uv _((double)); -# ifdef __cplusplus - } -# endif +END_EXTERN_C #define I_32(what) (cast_i32((double)(what))) #define I_V(what) (cast_iv((double)(what))) #define U_V(what) (cast_uv((double)(what))) @@ -1251,9 +1266,7 @@ char *strcpy(), *strcat(); #ifdef I_MATH # include <math.h> #else -# ifdef __cplusplus - extern "C" { -# endif +START_EXTERN_C double exp _((double)); double log _((double)); double log10 _((double)); @@ -1265,9 +1278,7 @@ char *strcpy(), *strcat(); double cos _((double)); double atan2 _((double,double)); double pow _((double,double)); -# ifdef __cplusplus - }; -# endif +END_EXTERN_C #endif #ifndef __cplusplus @@ -1338,9 +1349,6 @@ int runops_standard _((void)); int runops_debug _((void)); #endif -#define PER_THREAD_MAGICALS "123456789&`'+/.,\\\";^-%=|~:\001\005!@" -#define N_PER_THREAD_MAGICALS 30 - /****************/ /* Truly global */ /****************/ @@ -1357,7 +1365,6 @@ EXT struct thread * eval_owner; /* Owner thread for doeval */ EXT int nthreads; /* Number of threads currently */ EXT perl_mutex threads_mutex; /* Mutex for nthreads and thread list */ EXT perl_cond nthreads_cond; /* Condition variable for nthreads */ -EXT char * per_thread_magicals INIT(PER_THREAD_MAGICALS); #ifdef FAKE_THREADS EXT struct thread * thr; /* Currently executing (fake) thread */ #endif @@ -1860,8 +1867,7 @@ IEXT I32 Imaxscream IINIT(-1); IEXT SV * Ilastscream; /* shortcuts to misc objects */ -IEXT HV * Ierrhv; -IEXT SV * Ierrsv; +IEXT GV * Ierrgv; /* shortcuts to debugging objects */ IEXT GV * IDBgv; @@ -1970,10 +1976,6 @@ IEXT SV * Imess_sv; #ifdef USE_THREADS /* threads stuff */ IEXT SV * Ithrsv; /* holds struct thread for main thread */ -IEXT perl_mutex Ikeys_mutex; /* protects keys and magical_keys */ -IEXT SV * Ikeys; /* each char marks a per-thread key in-use */ -IEXT PADOFFSET Imagical_keys[N_PER_THREAD_MAGICALS]; - /* index is position in per_thread_magicals */ #endif /* USE_THREADS */ #undef IEXT @@ -1990,10 +1992,7 @@ struct interpreter { #include "thread.h" #include "pp.h" -#ifdef __cplusplus -extern "C" { -#endif - +START_EXTERN_C #include "proto.h" #ifdef EMBED @@ -2004,9 +2003,7 @@ extern "C" { #define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr) #endif -#ifdef __cplusplus -}; -#endif +END_EXTERN_C /* The following must follow proto.h */ |