From: Olaf Flebbe Date: Wed, 20 Sep 2000 23:16:26 +0000 (+0200) Subject: Epoc update X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ed79a026b5aec9cc3f786c2971aa15a4b21f396c;p=p5sagit%2Fp5-mst-13.2.git Epoc update Message-ID: <26423.969484586@www10.gmx.net> p4raw-id: //depot/perl@7124 --- diff --git a/README.epoc b/README.epoc index 2163c46..06290c3 100644 --- a/README.epoc +++ b/README.epoc @@ -3,8 +3,8 @@ Perl 5 README file for the EPOC operating system. ===================================================================== Olaf Flebbe -http://www.linuxstart.com/~oflebbe/perl/perl5.html -2000-05-15 +http://members.linuxstart.com/~oflebbe/perl/perl5.html +2000-09-18 ===================================================================== Introduction @@ -13,10 +13,10 @@ Introduction EPOC is a OS for palmtops and mobile phones. For more informations look at: http://www.symbian.com/ -This is a port of Perl version 5.6.0 to EPOC. It runs on the Perl -Series 5, Series 5mx and the Psion Revo and on the Ericson M128. - -Features are left out, because of restrictions of the POSIX support. +This is a port of perl to EPOC. It runs on the Psion Series 5, 5mx, +5mx Pro, Psion Revo and on the Ericson M128. I have no report about +the Psion Netbook or the S7. For information about this hardware +please refer to http://www.psion.com. ===================================================================== Installation/Usage @@ -32,12 +32,12 @@ left out unicode support modules and modules which will not work with this version. (For details look into epoc/createpkg.pl). If you like to use them, you are free to copy them from a current perl release. -Copy eshell.exe from the same page you got perl to your EPOC device. -Start eshell.exe with a double tap. +Get ESHELL from symbian: +http://developer.epocworld.com/downloads/progs/Eshell.zip Now you can enter: perl -de 0 in order to run the perl debugger. If you are leaving perl, you get into the system screen. You have to -switch back manually to eshell.exe When perl is running, you will see +switch back manually to ESHELL. When perl is running, you will see a task with the name STDOUT in the task list. ====================================================================== @@ -58,35 +58,47 @@ output to stdout. PATH Names ====================================================================== -Pathnames to executables in eshell.exe have to be written with -backslashes '\', file arguments to perl with slashes '/'. The default -drive of perl is the same as the drive perl.exe is located on, the -default path seems to be '/'. +ESHELL looks for executables in ?:/System/Programs. The SIS file +installs perl in this special folder directory. The default drive and +path are the same as folder the executable resides. The EPOC +filesystem is case-preserving, not case-sensitive. + +EPOC uses the ?: syntax for establishing a search order: First in C: (RAM), +then on D: (CF Card) and last in Z: (ROM). + +The perl @INC search path is now implemented with '?:'. Your perl +executable can now live on a different drive than the perl library or +even your scripts. -i.e. command lines look a little bit funny: +ESHELL paths have to be written with backslashes '\', file arguments +to perl with slashes '/'. Remember that I/O redirection is done +internally in perl, so please use slashes for redirects. -D:\perl.exe C:/test.pl >C:/output.txt +perl.exe C:/test.pl >C:/output.txt You can automatically search for file on all EPOC drives with a ? as -the driver letter. For instance ?:\a.txt seraches for C:\a.txt, +the driver letter. For instance ?:\a.txt searches for C:\a.txt, D:\b.txt (and Z:\a.txt). ====================================================================== Editors ====================================================================== -You may have a problem to create perl scripts. A cumbersome workaround -is to use the OPL Editor and exporting to text. +A suitable text-editor can be downloaded +from symbian http://developer.epocworld.com/downloads/progs/Editor.zip + +==================================================================== +Features +==================================================================== -The OPL+ Editor is quite good. (Shareware: http://www.twiddlebit.com) -There is a port of vim around: - http://www.starship.freeserve.co.uk/index.html +The built-in function EPOC::getcwd returns the current directory. ====================================================================== Restrictions ====================================================================== -The following things are left out of this perl port: +Features are left out, because of restrictions of the POSIX support in +EPOC: + backquoting, pipes etc. @@ -118,7 +130,7 @@ Sorry, this is far too short. You will need the C++ SDK from http://developer.epocworld.com/. You will need to set up the cross SDK from - http://www.linuxstart.com/~oflebbe + http://members.linuxstart.com/~oflebbe You may have to adjust config.sh (cc, cppflags) for your epoc install location. @@ -130,30 +142,27 @@ Sorry, this is far too short. Unpack the sources. Build a native perl from this sources... + cp epoc/* . ./Configure -S - make perl + make perl.a cp miniperl.native miniperl make perl + make ext/Errno/pm_to_blib perl link.pl perlmain.o lib/auto/DynaLoader/DynaLoader.a \ - lib/auto/Data/Dumper.a \ + lib/auto/Data/Dumper/Dumper.a \ lib/auto/File/Glob/Glob.a lib/auto/IO/IO.a \ - lib/auto/Socket/Socket.a perl.a `cat ext.libs` + lib/auto/Socket/Socket.a \ + lib/auto/Fcntl/Fcntl.a lib/auto/Sys/Hostname/Hostname.a \ + perl.a `cat ext.libs` perl createpkg.pl - wine "G:/bin/makesis perl.pkg perl.sis" - -==================================================================== -Wish List -==================================================================== + wine G:/bin/makesis perl.pkg perl.sis -- Threads ? -- Acess to the GUI? ==================================================================== Support Status ==================================================================== -I'm offering this port "as is". You can ask me questions, but I can't -guarantee I'll be able to answer them; I don't know much about Perl -internals myself. +I'm offering this port "as is". You can ask me questions, but I can't +guarantee I'll be able to answer them. diff --git a/epoc/config.sh b/epoc/config.sh index af89237..d9be3a7 100644 --- a/epoc/config.sh +++ b/epoc/config.sh @@ -32,8 +32,8 @@ apirevision='' apisubversion='' apiversion='' ar='arm-pe-ar' -archlib='/perl/lib/5.7.0/epoc' -archlibexp='/perl/lib/5.7.0/epoc' +archlib='?:/perl/lib/5.7.0/epoc' +archlibexp='?:/perl/lib/5.7.0/epoc' archname64='' archname='epoc' archobjs='epoc.o epocish.o epoc_stubs.o' @@ -386,7 +386,7 @@ emacs='' eunicefix=':' exe_ext='' expr='expr' -extensions='Data/Dumper File/Glob IO Socket Fcntl' +extensions='Data/Dumper File/Glob IO Socket Fcntl Sys/Hostname Errno' fflushNULL='undef' fflushall='define' find='' @@ -484,21 +484,21 @@ i_vfork='undef' ignore_versioned_solibs='' incpath='' inews='' -installarchlib='/home/olaf/E/lib' -installbin='/home/olaf/E/bin' -installman1dir='' -installman3dir='' -installprefix='/home/olaf/' +installarchlib='/home/of/PERL/perl/lib/5.6.0/epoc' +installbin='/home/of/PERL/System/Programs/' +installman1dir='/home/of/PERL/man1' +installman3dir='/home/of/PERL/man3' +installprefix='' installprefixexp='' -installprivlib='' -installscript='' -installsitearch='/home/olaf/E/site/' -installsitelib='/home/olaf/E/site/lib' +installprivlib='/home/of/PERL/perl/lib/5.6.0/' +installscript='/home/of/PERL/bin/' +installsitearch='/home/of/PERL/site/lib/site_perl/5.6.0/epoc' +installsitelib='/home/of/PERL/perl/lib/site_perl/5.6.0' installstyle='' installusrbinperl='undef' installvendorlib='' intsize='4' -known_extensions='Data/Dumper File/Glob IO Socket Fcntl' +known_extensions='Data/Dumper File/Glob IO Socket Fcntl Sys/Hostname Errno' ksh='' ld='echo' lddlflags='' @@ -559,7 +559,7 @@ netdb_net_type='int' nm='arm-pe-nm' nm_opt='' nm_so_opt='' -nonxs_ext='' +nonxs_ext='Errno' nroff='nroff' o_nonblock='O_NONBLOCK' obj_ext='' @@ -573,7 +573,7 @@ package='' pager='' passcat='' patchlevel='' -path_sep='' +path_sep=':' perl='' perladmin='' perlpath='' @@ -585,8 +585,8 @@ pmake='' pr='' prefix='' prefixexp='' -privlib='/perl/lib/5.7.0' -privlibexp='/perl/lib/5.7.0' +privlib='?:/perl/lib/5.7.0' +privlibexp='?:/perl/lib/5.7.0' prototype='define' ptrsize='4' randbits='31' @@ -630,11 +630,11 @@ sig_name_init='"ZERO", 0' sig_num='0' sig_num_init='0, 0' signal_t='void' -sitearch='/perl/lib/site_perl/5.7.0/epoc' -sitearchexp='/perl/lib/site_perl/5.7.0/epoc' -sitelib='/perl/lib/site_perl/5.7.0/' -sitelib_stem='/perl/lib/site_perl' -sitelibexp='/perl/lib/site_perl/5.7.0/' +sitearch='?:/perl/lib/site_perl/5.7.0/epoc' +sitearchexp='?:/perl/lib/site_perl/5.7.0/epoc' +sitelib='?:/perl/lib/site_perl/5.7.0/' +sitelib_stem='?:/perl/lib/site_perl' +sitelibexp='?:/perl/lib/site_perl/5.7.0/' siteprefix='' siteprefixexp='' sizesize='4' @@ -652,7 +652,7 @@ src='.' ssizetype='long' startperl='' startsh='#!/bin/sh' -static_ext='Data/Dumper File/Glob IO Socket Fcntl' +static_ext='Data/Dumper File/Glob IO Socket Fcntl Sys/Hostname' stdchar='char' stdio_base='' stdio_bufsiz='' @@ -945,4 +945,16 @@ xs_apiversion='5.005' d_getcwd='define' i_sysmode='undef' d_vendorarch='undef' - +d_frexpl='undef' +d_getespwnam='undef' +d_getprpwnam='undef' +d_isnan='define' +d_isnanl='undef' +d_modfl='undef' +d_setproctitle='undef' +d_socks5_init='undef' +i_libutil='undef' +i_prot='undef' +d_SCNfldbl='undef' +d_perl_otherlibdirs='undef' +nvsize='16' diff --git a/epoc/createpkg.pl b/epoc/createpkg.pl index 77dafb1..65a881f 100644 --- a/epoc/createpkg.pl +++ b/epoc/createpkg.pl @@ -3,9 +3,9 @@ use File::Find; use Cwd; -$VERSION="5.6"; +$VERSION="5.7"; $PATCH="0"; -$EPOC_VERSION=20; +$EPOC_VERSION=24; $CROSSCOMPILEPATH=cwd; $CROSSREPLACEPATH="H:\\perl"; @@ -32,7 +32,7 @@ open OUT,">perl.pkg"; print OUT "#{\"perl$VERSION\"},(0x100051d8),$PATCH,$EPOC_VERSION,0\n"; -print OUT "\"$CROSSREPLACEPATH\\perlmain.exe\"-\"!:\\perl.exe\"\n"; +print OUT "\"$CROSSREPLACEPATH\\perlmain.exe\"-\"!:\\system\\programs\\perl.exe\"\n"; find(\&filefound, cwd.'/lib'); print OUT "@\"G:\\lib\\stdlib.sis\",(0x0100002c3)\n" diff --git a/epoc/epoc.c b/epoc/epoc.c index 498036d..a2691f3 100644 --- a/epoc/epoc.c +++ b/epoc/epoc.c @@ -58,6 +58,7 @@ Perl_epoc_init(int *argcp, char ***argvp) { } + #ifdef __MARM__ /* Symbian forgot to include __fixunsdfi into the MARM euser.lib */ /* This is from libgcc2.c , gcc-2.7.2.3 */ @@ -86,6 +87,8 @@ __fixunsdfsi (a) return (SItype) a; } +#endif + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" @@ -143,5 +146,64 @@ do_spawn (pTHX_ SV *really,SV **mark,SV **sp) return rc; } - -#endif +static +XS(epoc_getcwd) /* more or less stolen from win32.c */ +{ + dXSARGS; + /* Make the host for current directory */ + char *buffer; + int buflen = 256; + + char *ptr; + buffer = (char *) malloc( buflen); + if (buffer == NULL) { + XSRETURN_UNDEF; + } + while ((NULL == ( ptr = getcwd( buffer, buflen))) && (errno == ERANGE)) { + buflen *= 2; + if (NULL == realloc( buffer, buflen)) { + XSRETURN_UNDEF; + } + + } + + /* + * If ptr != Nullch + * then it worked, set PV valid, + * else return 'undef' + */ + + if (ptr) { + SV *sv = sv_newmortal(); + char *tptr; + + for (tptr = ptr; *tptr != '\0'; tptr++) { + if (*tptr == '\\') { + *tptr = '/'; + } + } + sv_setpv(sv, ptr); + free( buffer); + + EXTEND(SP,1); + SvPOK_on(sv); + ST(0) = sv; + XSRETURN(1); + } + free( buffer); + XSRETURN_UNDEF; +} + + +void +Perl_init_os_extras(void) +{ + dTHXo; + char *file = __FILE__; + newXS("EPOC::getcwd", epoc_getcwd, file); +} + +void +Perl_my_setenv(pTHX_ char *nam,char *val) { + setenv( nam, val, 1); +} diff --git a/epoc/epoc_stubs.c b/epoc/epoc_stubs.c index b11da40..c1c6bcf 100644 --- a/epoc/epoc_stubs.c +++ b/epoc/epoc_stubs.c @@ -8,8 +8,6 @@ #include -char *environ = 0; - int getgid() {return 0;} int getegid() {return 0;} int geteuid() {return 0;} @@ -31,7 +29,7 @@ signal() { } int execv() { return -1;} int execvp() { return -1;} -void Perl_do_exec() {} +void Perl_do_exec() {} /*------------------------------------------------------------------*/ /* Two dummy functions implement getproto* */ diff --git a/epoc/epocish.h b/epoc/epocish.h index 75a64fc..31da472 100644 --- a/epoc/epocish.h +++ b/epoc/epocish.h @@ -139,4 +139,5 @@ double epoc_atof( const char *ptr); #define atof(a) epoc_atof(a) +#define init_os_extras Perl_init_os_extras diff --git a/epoc/link.pl b/epoc/link.pl index 9da8a35..ab3bd65 100644 --- a/epoc/link.pl +++ b/epoc/link.pl @@ -15,11 +15,11 @@ system("arm-pe-dlltool --as=arm-pe-as --output-exp $basname.exp " . "--base-file $basname.bas $epoc/lib/eexe.o @objs " . "$epoc/lib/ecrt0.o $epoc/lib/estlib.lib $epoc/lib/euser.lib"); -system("arm-pe-ld -s -e _E32Startup -o $basname.exe $basname.exp " . +system("arm-pe-ld -s -e _E32Startup $basname.exp " . "-o $baspe.exe $epoc/lib/eexe.o @objs " . "$epoc/lib/ecrt0.o $epoc/lib/estlib.lib $epoc/lib/euser.lib"); -system( "wine \"$epoc/bin/petran.exe $baspe.exe $basname.exe " . +system( "wine $epoc/bin/petran.exe \"$baspe.exe $basname.exe " . "-nocall -heap 0x00000400 0x00400000 -stack 0x0000c000 " . - "-uid1 0x1000007a -uid2 0x100051d8 -uid3 0x00000000 \" "); + "-uid1 0x1000007a -uid2 0x100051d8 -uid3 0x00000000\" "); diff --git a/lib/AutoLoader.pm b/lib/AutoLoader.pm index c26db72..af33ee8 100644 --- a/lib/AutoLoader.pm +++ b/lib/AutoLoader.pm @@ -4,6 +4,7 @@ use 5.005_64; our(@EXPORT, @EXPORT_OK, $VERSION); my $is_dosish; +my $is_epoc; my $is_vms; BEGIN { @@ -11,6 +12,7 @@ BEGIN { @EXPORT = @EXPORT = (); @EXPORT_OK = @EXPORT_OK = qw(AUTOLOAD); $is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32'; + $is_epoc = $^O eq 'epoc'; $is_vms = $^O eq 'VMS'; $VERSION = '5.57'; } @@ -51,7 +53,11 @@ AUTOLOAD { $filename = "./$filename"; } } - elsif ($is_vms) { + elsif ($is_epoc) { + unless ($filename =~ m{^([a-z?]:)?[\\/]}is) { + $filename = "./$filename"; + } + }elsif ($is_vms) { # XXX todo by VMSmiths $filename = "./$filename"; } diff --git a/lib/Cwd.pm b/lib/Cwd.pm index 2f51689..dbeae69 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -346,6 +346,11 @@ sub _qnx_abs_path { return $realpath; } +sub _epoc_cwd { + $ENV{'PWD'} = EPOC::getcwd(); + return $ENV{'PWD'}; +} + { no warnings; # assignments trigger 'subroutine redefined' warning @@ -394,6 +399,12 @@ sub _qnx_abs_path { *fastcwd = \&cwd; *abs_path = \&fast_abs_path; } + elsif ($^O eq 'epoc') { + *getcwd = \&_epoc_cwd; + *fastgetcwd = \&_epoc_cwd; + *fastcwd = \&_epoc_cwd; + *abs_path = \&fast_abs_path; + } } # package main; eval join('',) || die $@; # quick test diff --git a/mg.c b/mg.c index 1cfaf05..721cfb9 100644 --- a/mg.c +++ b/mg.c @@ -914,7 +914,7 @@ Perl_magic_set_all_env(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg) { -#if defined(VMS) +#if defined(VMS) || defined(EPOC) Perl_die(aTHX_ "Can't make list assignment to %%ENV on this system"); #else # ifdef PERL_IMPLICIT_SYS diff --git a/perl.c b/perl.c index 8e54499..cb2cb14 100644 --- a/perl.c +++ b/perl.c @@ -836,7 +836,7 @@ setuid perl scripts securely.\n"); PL_origargv = argv; PL_origargc = argc; -#ifndef VMS /* VMS doesn't have environ array */ +#if !defined( VMS) && !defined(EPOC) /* VMS doesn't have environ array */ PL_origenviron = environ; #endif @@ -1256,7 +1256,7 @@ print \" \\@INC:\\n @INC\\n\";"); if (xsinit) (*xsinit)(aTHXo); /* in case linked C routines want magical variables */ #ifndef PERL_MICRO -#if defined(VMS) || defined(WIN32) || defined(DJGPP) || defined(__CYGWIN__) +#if defined(VMS) || defined(WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(EPOC) init_os_extras(); #endif #endif @@ -3468,7 +3468,7 @@ S_init_perllib(pTHX) #endif /* MACOS_TRADITIONAL */ } -#if defined(DOSISH) +#if defined(DOSISH) || defined(EPOC) # define PERLLIB_SEP ';' #else # if defined(VMS) diff --git a/perl.h b/perl.h index 0b5c6ea..8f19950 100644 --- a/perl.h +++ b/perl.h @@ -2283,7 +2283,7 @@ EXT char *** environ_pointer; # if !defined(DONT_DECLARE_STD) || \ (defined(__svr4__) && defined(__GNUC__) && defined(sun)) || \ defined(__sgi) || \ - defined(__DGUX) || defined(EPOC) + defined(__DGUX) extern char ** environ; /* environment variables supplied via exec */ # endif # endif diff --git a/pp_sys.c b/pp_sys.c index e35cfd4..7473ba5 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -2328,6 +2328,10 @@ PP(pp_accept) fcntl(fd, F_SETFD, fd > PL_maxsysfd); /* ensure close-on-exec */ #endif +#ifdef EPOC + len = sizeof saddr; /* EPOC somehow truncates info */ +#endif + PUSHp((char *)&saddr, len); RETURN; diff --git a/sv.c b/sv.c index e068d0a..e7bd003 100644 --- a/sv.c +++ b/sv.c @@ -5119,7 +5119,7 @@ Perl_sv_reset(pTHX_ register char *s, HV *stash) } if (GvHV(gv) && !HvNAME(GvHV(gv))) { hv_clear(GvHV(gv)); -#ifndef VMS /* VMS has no environ array */ +#if !defined( VMS) && !defined(EPOC) /* VMS has no environ array */ if (gv == PL_envgv) environ[0] = Nullch; #endif diff --git a/util.c b/util.c index 12c30a0..2548f50 100644 --- a/util.c +++ b/util.c @@ -1934,8 +1934,9 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args) } } -#ifndef VMS /* VMS' my_setenv() is in VMS.c */ -#if !defined(WIN32) && !defined(__CYGWIN__) +#if !defined( VMS) && !defined(EPOC) + /* VMS' and EPOC's my_setenv() is in VMS.c */ +#if !defined(WIN32) && !defined(__CYGWIN__) && void Perl_my_setenv(pTHX_ char *nam, char *val) { @@ -2101,7 +2102,7 @@ Perl_setenv_getix(pTHX_ char *nam) return i; } -#endif /* !VMS */ +#endif /* !VMS && !EPOC*/ #ifdef UNLINK_ALL_VERSIONS I32 diff --git a/util.h b/util.h index cb9f4c9..bcf6b58 100644 --- a/util.h +++ b/util.h @@ -21,11 +21,11 @@ || ((f)[0] && (f)[1] == ':') /* drive name */ \ || ((f)[0] == '\\' && (f)[1] == '\\')) /* UNC path */ # else /* !WIN32 */ -# ifdef DOSISH +# if defined( DOSISH) || defined(EPOC) # define PERL_FILE_IS_ABSOLUTE(f) \ (*(f) == '/' \ || ((f)[0] && (f)[1] == ':')) /* drive name */ -# else /* !DOSISH */ +# else /* NEITHER DOSISH NOR EPOCISH */ # ifdef MACOS_TRADITIONAL # define PERL_FILE_IS_ABSOLUTE(f) (strchr(f, ':')) # else /* !MACOS_TRADITIONAL */