summaryrefslogtreecommitdiff
path: root/epoc
diff options
context:
space:
mode:
authorOlaf Flebbe <o.flebbe@science-computing.de>2001-02-27 00:34:36 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-02-27 06:12:11 +0000
commitd5ff79b3161a608c49c52fd6aa22cff1af6f6b82 (patch)
tree020e9213536d2108b5cf5da6059511b1d3b53ebb /epoc
parente4f0d88dd7061f3d9b4bbe01e378d668273f5363 (diff)
downloadperl-d5ff79b3161a608c49c52fd6aa22cff1af6f6b82.tar.gz
[perl-current] EPOC
Message-ID: <Pine.LNX.4.02.10102262333490.3781-100000@milkyway.science-computing.de> p4raw-id: //depot/perl@8956
Diffstat (limited to 'epoc')
-rw-r--r--epoc/createpkg.pl8
-rw-r--r--epoc/epoc.c85
-rw-r--r--epoc/epocish.c45
-rw-r--r--epoc/epocish.h1
4 files changed, 105 insertions, 34 deletions
diff --git a/epoc/createpkg.pl b/epoc/createpkg.pl
index 65a881f43f..5ce70fc92c 100644
--- a/epoc/createpkg.pl
+++ b/epoc/createpkg.pl
@@ -4,8 +4,8 @@ use File::Find;
use Cwd;
$VERSION="5.7";
-$PATCH="0";
-$EPOC_VERSION=24;
+$PATCH="1";
+$EPOC_VERSION=27;
$CROSSCOMPILEPATH=cwd;
$CROSSREPLACEPATH="H:\\perl";
@@ -13,7 +13,7 @@ $CROSSREPLACEPATH="H:\\perl";
sub filefound {
my $f = $File::Find::name;
- return if ( $f =~ /CVS|unicode|CPAN|ExtUtils|IPC|User|DB.pm|\.a$|\.ld$|\.exists$/i);
+ return if ( $f =~ /CVS|unicode|CPAN|ExtUtils|IPC|User|DB.pm|\.a$|\.ld$|\.exists$|\.pod$/i);
my $back = $f;
$back =~ s|$CROSSCOMPILEPATH||;
@@ -31,7 +31,7 @@ sub filefound {
open OUT,">perl.pkg";
print OUT "#{\"perl$VERSION\"},(0x100051d8),$PATCH,$EPOC_VERSION,0\n";
-
+print OUT "\"$CROSSREPLACEPATH\\Artistic\"-\"\",FT,TA\n";
print OUT "\"$CROSSREPLACEPATH\\perlmain.exe\"-\"!:\\system\\programs\\perl.exe\"\n";
find(\&filefound, cwd.'/lib');
diff --git a/epoc/epoc.c b/epoc/epoc.c
index b9bc652c22..6652ef0ce1 100644
--- a/epoc/epoc.c
+++ b/epoc/epoc.c
@@ -17,6 +17,10 @@ Perl_epoc_init(int *argcp, char ***argvp) {
int truecount=0;
char **lastcp = (*argvp);
char *ptr;
+
+#if 0
+ epoc_spawn_posix_server();
+#endif
for (i=0; i< *argcp; i++) {
if ((*argvp)[i]) {
if (*((*argvp)[i]) == '<') {
@@ -94,54 +98,85 @@ __fixunsdfsi (a)
#include "XSUB.h"
int
-do_aspawn( pTHX_ SV *really,SV **mark,SV **sp) {
- return do_spawn( really, mark, sp);
+do_spawn( char *cmd) {
+ dTHXo;
+ char *argv0, *ptr;
+ char *cmdptr = cmd;
+ int ret;
+
+ argv0 = ptr = malloc( strlen(cmd) + 1);
+
+ while (*cmdptr && !isSPACE( *cmdptr)) {
+ *ptr = *cmdptr;
+ if (*ptr == '/') {
+ *ptr = '\\';
+ }
+ ptr++; cmdptr++;
+ }
+ while (*cmdptr && isSPACE( *cmdptr)) {
+ cmdptr++;
+ }
+ *ptr = '\0';
+ ret = epoc_spawn( argv0, cmdptr);
+ free( argv0);
+ return ret;
}
int
-do_spawn (pTHX_ SV *really,SV **mark,SV **sp)
-{
+do_aspawn ( void *vreally, void **vmark, void **vsp) {
+
+ dTHXo;
+
+ SV *really = (SV*)vreally;
+ SV **mark = (SV**)vmark;
+ SV **sp = (SV**)vsp;
+
+ char **argv;
+ char *str;
+ char *p2, **ptr;
+ char *cmd, *cmdline;
+
+
int rc;
- char **a,*cmd,**ptr, *cmdline, **argv, *p2;
- STRLEN n_a;
- size_t len = 0;
+ int index = 0;
+ int len = 0;
if (sp<=mark)
return -1;
- a=argv=ptr=(char**) malloc ((sp-mark+3)*sizeof (char*));
+ ptr = argv =(char**) malloc ((sp-mark+3)*sizeof (char*));
while (++mark <= sp) {
- if (*mark)
- *a = SvPVx(*mark, n_a);
+ if (*mark && (str = SvPV_nolen(*mark)))
+ argv[index] = str;
else
- *a = "";
- len += strlen( *a) + 1;
- a++;
+ argv[index] = "";
+
+ len += strlen(argv[ index++]) + 1;
}
- *a = Nullch;
+ argv[index++] = 0;
- if (!(really && *(cmd = SvPV(really, n_a)))) {
- cmd = argv[0];
- argv++;
+ cmd = strdup((const char*)(really ? SvPV_nolen(really) : argv[0]));
+
+ for (p2=cmd; *p2 != '\0'; p2++) {
+ /* Change / to \ */
+ if ( *p2 == '/')
+ *p2 = '\\';
}
cmdline = (char * ) malloc( len + 1);
cmdline[ 0] = '\0';
while (*argv != NULL) {
- strcat( cmdline, *argv++);
+ strcat( cmdline, *ptr++);
strcat( cmdline, " ");
}
+
+ free( argv);
- for (p2=cmd; *p2 != '\0'; p2++) {
- /* Change / to \ */
- if ( *p2 == '/')
- *p2 = '\\';
- }
rc = epoc_spawn( cmd, cmdline);
- free( ptr);
free( cmdline);
-
+ free( cmd);
+
return rc;
}
diff --git a/epoc/epocish.c b/epoc/epocish.c
index a0557cc129..a8b95972d0 100644
--- a/epoc/epocish.c
+++ b/epoc/epocish.c
@@ -9,31 +9,60 @@
/* This is C++ Code !! */
#include <e32std.h>
+#include <stdlib.h>
+#include <estlib.h>
+#include <string.h>
extern "C" {
+#if 1
+int
epoc_spawn( char *cmd, char *cmdline) {
RProcess p;
TRequestStatus status;
TInt rc;
rc = p.Create( _L( cmd), _L( cmdline));
- if (rc != KErrNone)
+ if (rc != KErrNone) {
return -1;
+ }
p.Resume();
p.Logon( status);
User::WaitForRequest( status);
+ p.Kill( 0);
if (status!=KErrNone) {
return -1;
}
return 0;
}
+#else
+int
+epoc_spawn( char *cmd, char *cmdline) {
+ int len = strlen(cmd) + strlen(cmdline) + 4;
+ char *n = (char *) malloc( len);
+ int r;
+ strcpy( n, cmd);
+ strcat( n, " ");
+ strcat( n, cmdline);
+ r = system( n);
+ free( n);
+ return r;
+}
+#endif
+/* Workaround for defect strtoul(). Values with leading + are zero */
+
+unsigned long int epoc_strtoul(const char *nptr, char **endptr,
+ int base) {
+ if (nptr && *nptr == '+')
+ nptr++;
+ return strtoul( nptr, endptr, base);
+}
- /* Workaround for defect atof(), see java defect list for epoc */
- double epoc_atof( char* str) {
+/* Workaround for defect atof(), see java defect list for epoc */
+double epoc_atof( char* str) {
TReal64 aRes;
while (TChar( *str).IsSpace()) {
@@ -43,9 +72,9 @@ epoc_spawn( char *cmd, char *cmdline) {
TLex lex( _L( str));
TInt err = lex.Val( aRes, TChar( '.'));
return aRes;
- }
+}
- void epoc_gcvt( double x, int digits, unsigned char *buf) {
+void epoc_gcvt( double x, int digits, unsigned char *buf) {
TRealFormat trel;
trel.iPlaces = digits;
@@ -57,3 +86,9 @@ epoc_spawn( char *cmd, char *cmdline) {
result.Append( TChar( 0));
}
}
+
+#if 0
+void epoc_spawn_posix_server() {
+ SpawnPosixServerThread();
+}
+#endif
diff --git a/epoc/epocish.h b/epoc/epocish.h
index 551d1f51d7..e365fa2c25 100644
--- a/epoc/epocish.h
+++ b/epoc/epocish.h
@@ -138,6 +138,7 @@
double epoc_atof( const char *ptr);
#define atof(a) epoc_atof(a)
+#define strtoul(a,b,c) epoc_strtoul(a,b,c)
#define init_os_extras Perl_init_os_extras