| 1 | /* |
| 2 | * symbianish.h |
| 3 | * |
| 4 | * Copyright (c) Nokia 2004-2005. All rights reserved. |
| 5 | * This code is licensed under the same terms as Perl itself. |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #include "symbian/symbian_port.h" |
| 10 | |
| 11 | /* |
| 12 | * The following symbols are defined if your operating system supports |
| 13 | * functions by that name. All Unixes I know of support them, thus they |
| 14 | * are not checked by the configuration script, but are directly defined |
| 15 | * here. |
| 16 | */ |
| 17 | |
| 18 | #ifndef PERL_MICRO |
| 19 | |
| 20 | /* HAS_IOCTL: |
| 21 | * This symbol, if defined, indicates that the ioctl() routine is |
| 22 | * available to set I/O characteristics |
| 23 | */ |
| 24 | #define HAS_IOCTL / **/ |
| 25 | |
| 26 | /* HAS_UTIME: |
| 27 | * This symbol, if defined, indicates that the routine utime() is |
| 28 | * available to update the access and modification times of files. |
| 29 | */ |
| 30 | /* #define HAS_UTIME / **/ |
| 31 | |
| 32 | /* HAS_GROUP |
| 33 | * This symbol, if defined, indicates that the getgrnam() and |
| 34 | * getgrgid() routines are available to get group entries. |
| 35 | * The getgrent() has a separate definition, HAS_GETGRENT. |
| 36 | */ |
| 37 | #undef HAS_GROUP /**/ |
| 38 | |
| 39 | /* HAS_PASSWD |
| 40 | * This symbol, if defined, indicates that the getpwnam() and |
| 41 | * getpwuid() routines are available to get password entries. |
| 42 | * The getpwent() has a separate definition, HAS_GETPWENT. |
| 43 | */ |
| 44 | #undef HAS_PASSWD /**/ |
| 45 | |
| 46 | #undef HAS_KILL |
| 47 | #undef HAS_WAIT |
| 48 | |
| 49 | #endif /* !PERL_MICRO */ |
| 50 | |
| 51 | /* USEMYBINMODE |
| 52 | * This symbol, if defined, indicates that the program should |
| 53 | * use the routine my_binmode(FILE *fp, char iotype) to insure |
| 54 | * that a file is in "binary" mode -- that is, that no translation |
| 55 | * of bytes occurs on read or write operations. |
| 56 | */ |
| 57 | #undef USEMYBINMODE |
| 58 | |
| 59 | /* Stat_t: |
| 60 | * This symbol holds the type used to declare buffers for information |
| 61 | * returned by stat(). It's usually just struct stat. It may be necessary |
| 62 | * to include <sys/stat.h> and <sys/types.h> to get any typedef'ed |
| 63 | * information. |
| 64 | */ |
| 65 | #define Stat_t struct stat |
| 66 | |
| 67 | /* USE_STAT_RDEV: |
| 68 | * This symbol is defined if this system has a stat structure declaring |
| 69 | * st_rdev |
| 70 | */ |
| 71 | #define USE_STAT_RDEV /**/ |
| 72 | |
| 73 | /* ACME_MESS: |
| 74 | * This symbol, if defined, indicates that error messages should be |
| 75 | * should be generated in a format that allows the use of the Acme |
| 76 | * GUI/editor's autofind feature. |
| 77 | */ |
| 78 | #undef ACME_MESS /**/ |
| 79 | |
| 80 | /* UNLINK_ALL_VERSIONS: |
| 81 | * This symbol, if defined, indicates that the program should arrange |
| 82 | * to remove all versions of a file if unlink() is called. This is |
| 83 | * probably only relevant for VMS. |
| 84 | */ |
| 85 | /* #define UNLINK_ALL_VERSIONS / **/ |
| 86 | |
| 87 | /* VMS: |
| 88 | * This symbol, if defined, indicates that the program is running under |
| 89 | * VMS. It is currently automatically set by cpps running under VMS, |
| 90 | * and is included here for completeness only. |
| 91 | */ |
| 92 | /* #define VMS / **/ |
| 93 | |
| 94 | /* ALTERNATE_SHEBANG: |
| 95 | * This symbol, if defined, contains a "magic" string which may be used |
| 96 | * as the first line of a Perl program designed to be executed directly |
| 97 | * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG |
| 98 | * begins with a character other then #, then Perl will only treat |
| 99 | * it as a command line if it finds the string "perl" in the first |
| 100 | * word; otherwise it's treated as the first line of code in the script. |
| 101 | * (IOW, Perl won't hand off to another interpreter via an alternate |
| 102 | * shebang sequence that might be legal Perl code.) |
| 103 | */ |
| 104 | /* #define ALTERNATE_SHEBANG "#!" / **/ |
| 105 | |
| 106 | #include <signal.h> |
| 107 | #define ABORT() abort() |
| 108 | |
| 109 | /* |
| 110 | * fwrite1() should be a routine with the same calling sequence as fwrite(), |
| 111 | * but which outputs all of the bytes requested as a single stream (unlike |
| 112 | * fwrite() itself, which on some systems outputs several distinct records |
| 113 | * if the number_of_items parameter is >1). |
| 114 | */ |
| 115 | #define fwrite1 fwrite |
| 116 | |
| 117 | #define Stat(fname,bufptr) stat((fname),(bufptr)) |
| 118 | #define Fstat(fd,bufptr) fstat((fd),(bufptr)) |
| 119 | #define Fflush(fp) fflush(fp) |
| 120 | #define Mkdir(path,mode) mkdir((path),(mode)) |
| 121 | |
| 122 | #ifndef PERL_SYS_TERM_BODY |
| 123 | #define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; \ |
| 124 | PERLIO_TERM; MALLOC_TERM; CloseSTDLIB(); |
| 125 | #endif |
| 126 | |
| 127 | #define BIT_BUCKET "NUL:" |
| 128 | |
| 129 | #define dXSUB_SYS |
| 130 | |
| 131 | #define NO_ENVIRON_ARRAY |
| 132 | |
| 133 | int kill(pid_t pid, int signo); |
| 134 | pid_t wait(int *status); |
| 135 | |
| 136 | #ifdef PERL_GLOBAL_STRUCT_PRIVATE |
| 137 | # undef PERL_GET_VARS |
| 138 | # undef PERL_SET_VARS |
| 139 | # undef PERL_UNSET_VARS |
| 140 | # define PERL_GET_VARS() symbian_get_vars() |
| 141 | # define PERL_SET_VARS(v) symbian_set_vars(v) |
| 142 | # define PERL_UNSET_VARS(v) symbian_unset_vars() |
| 143 | #endif /* #ifdef PERL_GLOBAL_STRUCT_PRIVATE */ |
| 144 | |
| 145 | #undef PERL_EXPORT_C |
| 146 | #define PERL_EXPORT_C EXPORT_C /* for perlio.h */ |
| 147 | #define PERL_CALLCONV EXPORT_C /* for proto.h */ |
| 148 | #undef PERL_XS_EXPORT_C |
| 149 | #define PERL_XS_EXPORT_C EXPORT_C |
| 150 | |
| 151 | #ifndef PERL_CORE |
| 152 | #define PERL_CORE /* for WINS builds under VC */ |
| 153 | #endif |
| 154 | |
| 155 | #ifdef USE_PERLIO |
| 156 | #define PERL_NEED_APPCTX /* need storing the PerlBase* */ |
| 157 | #define PERLIO_STD_SPECIAL |
| 158 | #define PERLIO_STD_IN(f, b, n) symbian_read_stdin(f, b, n) |
| 159 | #define PERLIO_STD_OUT(f, b, n) symbian_write_stdout(f, b, n) |
| 160 | /* The console (the STD*) streams are seen by Perl in UTF-8. */ |
| 161 | #define PERL_SYMBIAN_CONSOLE_UTF8 |
| 162 | |
| 163 | #endif |
| 164 | |
| 165 | #undef Strerror |
| 166 | #undef strerror |
| 167 | #define Strerror(eno) ((eno) < 0 ? symbian_get_error_string(eno) : strerror(eno)) |
| 168 | |
| 169 | #define PERL_NEED_TIMESBASE |
| 170 | |
| 171 | #define times(b) symbian_times(b) |
| 172 | #define usleep(u) symbian_usleep(u) |
| 173 | |
| 174 | #define PERL_SYS_INIT_BODY(c, v) symbian_sys_init(c, v) |
| 175 | |
| 176 | #ifdef __SERIES60_1X__ |
| 177 | # error "Unfortunately Perl does not work in S60 1.2 (see FAQ-0929)" |
| 178 | #endif |
| 179 | |
| 180 | #ifdef _MSC_VER |
| 181 | |
| 182 | /* The Symbian SDK insists on the /W4 flag for Visual C. |
| 183 | * The Perl sources are not _that_ clean (Perl builds for Win32 use |
| 184 | * the /W3 flag, and gcc builds always use -Wall, so the sources are |
| 185 | * quite clean). To avoid a flood of warnings let's shut up most |
| 186 | * (for VC 6.0 SP 5). */ |
| 187 | |
| 188 | #pragma warning(disable: 4054) /* function pointer to data pointer */ |
| 189 | #pragma warning(disable: 4055) /* data pointer to function pointer */ |
| 190 | #pragma warning(disable: 4100) /* unreferenced formal parameter */ |
| 191 | #pragma warning(disable: 4101) /* unreferenced local variable */ |
| 192 | #pragma warning(disable: 4102) /* unreferenced label */ |
| 193 | #pragma warning(disable: 4113) /* prototype difference */ |
| 194 | #pragma warning(disable: 4127) /* conditional expression is constant */ |
| 195 | #pragma warning(disable: 4132) /* const object should be initialized */ |
| 196 | #pragma warning(disable: 4133) /* incompatible types */ |
| 197 | #pragma warning(disable: 4189) /* initialized but not referenced */ |
| 198 | #pragma warning(disable: 4244) /* conversion from ... possible loss ... */ |
| 199 | #pragma warning(disable: 4245) /* signed/unsigned char */ |
| 200 | #pragma warning(disable: 4310) /* cast truncates constant value */ |
| 201 | #pragma warning(disable: 4505) /* function has been removed */ |
| 202 | #pragma warning(disable: 4510) /* default constructor could not ... */ |
| 203 | #pragma warning(disable: 4610) /* struct ... can never be instantiated */ |
| 204 | #pragma warning(disable: 4701) /* used without having been initialized */ |
| 205 | #pragma warning(disable: 4702) /* unreachable code */ |
| 206 | #pragma warning(disable: 4706) /* assignment within conditional */ |
| 207 | #pragma warning(disable: 4761) /* integral size mismatch */ |
| 208 | |
| 209 | #endif /* _MSC_VER */ |
| 210 | |
| 211 | #ifdef __MWERKS__ |
| 212 | /* No good way of using the CodeWarrior #pragma unused(varname) with Perl |
| 213 | * source code (e.g. PERL_UNUSED_DECL doesn't work with the pragma syntax). |
| 214 | * Therefore we brutally turn off these particular warnings since there |
| 215 | * is a lot of this in Perl code (pTHX, for example). TOther compilers |
| 216 | * will have to detect these naughty bits. */ |
| 217 | #pragma warn_unusedarg off |
| 218 | #pragma warn_unusedvar off |
| 219 | #pragma warn_emptydecl off |
| 220 | #endif |