=====================================================================
Olaf Flebbe <o.flebbe@gmx.de>
-http://www.linuxstart.com/~oflebbe/perl/perl5.html
-2000-05-15
+http://members.linuxstart.com/~oflebbe/perl/perl5.html
+2000-09-18
=====================================================================
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
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.
======================================================================
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.
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.
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.
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'
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=''
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=''
nm='arm-pe-nm'
nm_opt=''
nm_so_opt=''
-nonxs_ext=''
+nonxs_ext='Errno'
nroff='nroff'
o_nonblock='O_NONBLOCK'
obj_ext=''
pager=''
passcat=''
patchlevel=''
-path_sep=''
+path_sep=':'
perl=''
perladmin=''
perlpath=''
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'
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'
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=''
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'
use File::Find;
use Cwd;
-$VERSION="5.6";
+$VERSION="5.7";
$PATCH="0";
-$EPOC_VERSION=20;
+$EPOC_VERSION=24;
$CROSSCOMPILEPATH=cwd;
$CROSSREPLACEPATH="H:\\perl";
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"
}
+
#ifdef __MARM__
/* Symbian forgot to include __fixunsdfi into the MARM euser.lib */
/* This is from libgcc2.c , gcc-2.7.2.3 */
return (SItype) a;
}
+#endif
+
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
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);
+}
#include <string.h>
-char *environ = 0;
-
int getgid() {return 0;}
int getegid() {return 0;}
int geteuid() {return 0;}
int execv() { return -1;}
int execvp() { return -1;}
-void Perl_do_exec() {}
+void Perl_do_exec() {}
/*------------------------------------------------------------------*/
/* Two dummy functions implement getproto* */
double epoc_atof( const char *ptr);
#define atof(a) epoc_atof(a)
+#define init_os_extras Perl_init_os_extras
"--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\" ");
our(@EXPORT, @EXPORT_OK, $VERSION);
my $is_dosish;
+my $is_epoc;
my $is_vms;
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';
}
$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";
}
return $realpath;
}
+sub _epoc_cwd {
+ $ENV{'PWD'} = EPOC::getcwd();
+ return $ENV{'PWD'};
+}
+
{
no warnings; # assignments trigger 'subroutine redefined' warning
*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('',<DATA>) || die $@; # quick test
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
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
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
#endif /* MACOS_TRADITIONAL */
}
-#if defined(DOSISH)
+#if defined(DOSISH) || defined(EPOC)
# define PERLLIB_SEP ';'
#else
# if defined(VMS)
# 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
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;
}
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
}
}
-#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)
{
return i;
}
-#endif /* !VMS */
+#endif /* !VMS && !EPOC*/
#ifdef UNLINK_ALL_VERSIONS
I32
|| ((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 */