This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
check for PA* in both branches of case
[perl5.git] / symbian / symbian_utils.cpp
index e6483ef..9749361 100644 (file)
@@ -76,6 +76,8 @@ extern "C" {
 #ifdef PERL_GLOBAL_STRUCT /* Avoid unused variable warning. */
         dVAR;
 #endif
+        if(!PL_appctx)
+               ((CPerlBase*)PL_appctx) = CPerlBase::NewInterpreter();
         return ((CPerlBase*)PL_appctx)->ConsoleRead(fd, b, n);
     }
     EXPORT_C SSize_t symbian_write_stdout(const int fd, const char *b, int n)
@@ -83,6 +85,8 @@ extern "C" {
 #ifdef PERL_GLOBAL_STRUCT /* Avoid unused variable warning. */
         dVAR;
 #endif
+        if(!PL_appctx)
+               ((CPerlBase*)PL_appctx) = CPerlBase::NewInterpreter();
         return ((CPerlBase*)PL_appctx)->ConsoleWrite(fd, b, n);
     }
     static const char NullErr[] = "";
@@ -171,7 +175,7 @@ extern "C" {
        } else {
          buf8.Format(_L8("Symbian error %d"), error);
        }
-        SV* sv = Perl_get_sv(aTHX_ "\005", GV_ADD); /* $^E or ${^OS_ERROR} */
+        SV* sv = Perl_get_sv(aTHX_ "\005", TRUE); /* $^E or ${^OS_ERROR} */
         if (!sv)
             return (char*)NullErr;
         sv_setpv(sv, (const char *)buf8.PtrZ());
@@ -200,8 +204,13 @@ extern "C" {
         tick -= PL_timesbase.tms_utime;
         TInt64 tickus = TInt64(tick) * TInt64(periodus);
         TInt64 tmps   = tickus / 1000000;
+#ifdef __SERIES60_3X__
+        if (sec)  *sec  = I64LOW(tmps);
+        if (usec) *usec = I64LOW(tickus) - I64LOW(tmps) * 1000000;
+#else
         if (sec)  *sec  = tmps.Low();
         if (usec) *usec = tickus.Low() - tmps.Low() * 1000000;
+#endif //__SERIES60_3X__
         return 0;
     }
     EXPORT_C int symbian_usleep(unsigned int usec)
@@ -287,11 +296,17 @@ extern "C" {
                 error = proc.Create(aFilename,
                                     func,
                                     KStackSize,
+#ifdef __SERIES60_3X__                                    
+                                    KHeapMin,
+                                    KHeapMax,
+                                    (TAny*)command,
+#else
                                     (TAny*)command,
                                     &lib,
                                     RThread().Heap(),
                                     KHeapMin,
                                     KHeapMax,
+#endif                                    
                                     EOwnerProcess);
             else
                 error = KErrNotFound;