err = errno;\
return ret;
-extern int g_closedir(DIR *dirp);
-extern DIR * g_opendir(char *filename);
-extern struct direct * g_readdir(DIR *dirp);
-extern void g_rewinddir(DIR *dirp);
-extern void g_seekdir(DIR *dirp, long loc);
-extern long g_telldir(DIR *dirp);
-
class CPerlDir : public IPerlDir
{
public:
};
virtual int Close(DIR *dirp, int &err)
{
- return g_closedir(dirp);
+ return win32_closedir(dirp);
};
virtual DIR *Open(char *filename, int &err)
{
- return g_opendir(filename);
+ return win32_opendir(filename);
};
virtual struct direct *Read(DIR *dirp, int &err)
{
- return g_readdir(dirp);
+ return win32_readdir(dirp);
};
virtual void Rewind(DIR *dirp, int &err)
{
- g_rewinddir(dirp);
+ win32_rewinddir(dirp);
};
virtual void Seek(DIR *dirp, long loc, int &err)
{
- g_seekdir(dirp, loc);
+ win32_seekdir(dirp, loc);
};
virtual long Tell(DIR *dirp, int &err)
{
- return g_telldir(dirp);
+ return win32_telldir(dirp);
};
};
};
virtual int Putenv(const char *envstring, int &err)
{
- return putenv(envstring);
+ return win32_putenv(envstring);
};
virtual char* LibPath(char *pl)
{
{
return g_win32_get_sitelib(pl);
};
+ virtual int Uname(struct utsname *name, int &err)
+ {
+ return win32_uname(name);
+ };
+ virtual char *Getenv_len(const char *varname, unsigned long *len, int &err)
+ {
+ char *e = win32_getenv(varname);
+ if (e)
+ *len = strlen(e);
+ return e;
+ };
};
class CPerlSock : public IPerlSock
};
virtual int Rename(const char *OldFileName, const char *newname, int &err)
{
- char szNewWorkName[MAX_PATH+1];
- WIN32_FIND_DATA fdOldFile, fdNewFile;
- HANDLE handle;
- char *ptr;
-
- if((strchr(OldFileName, '\\') || strchr(OldFileName, '/'))
- && strchr(newname, '\\') == NULL
- && strchr(newname, '/') == NULL)
- {
- strcpy(szNewWorkName, OldFileName);
- if((ptr = strrchr(szNewWorkName, '\\')) == NULL)
- ptr = strrchr(szNewWorkName, '/');
- strcpy(++ptr, newname);
- }
- else
- strcpy(szNewWorkName, newname);
-
- if(stricmp(OldFileName, szNewWorkName) != 0)
- { // check that we're not being fooled by relative paths
- // and only delete the new file
- // 1) if it exists
- // 2) it is not the same file as the old file
- // 3) old file exist
- // GetFullPathName does not return the long file name on some systems
- handle = FindFirstFile(OldFileName, &fdOldFile);
- if(handle != INVALID_HANDLE_VALUE)
- {
- FindClose(handle);
-
- handle = FindFirstFile(szNewWorkName, &fdNewFile);
-
- if(handle != INVALID_HANDLE_VALUE)
- FindClose(handle);
- else
- fdNewFile.cFileName[0] = '\0';
-
- if(strcmp(fdOldFile.cAlternateFileName, fdNewFile.cAlternateFileName) != 0
- && strcmp(fdOldFile.cFileName, fdNewFile.cFileName) != 0)
- { // file exists and not same file
- DeleteFile(szNewWorkName);
- }
- }
- }
- int ret = rename(OldFileName, szNewWorkName);
- if(ret)
- err = errno;
-
- return ret;
+ CALLFUNCRET(win32_rename(OldFileName, newname))
};
virtual int Setmode(int handle, int mode, int &err)
{
{
win32_abort();
};
+ virtual char * Crypt(const char* clear, const char* salt)
+ {
+ return win32_crypt(clear, salt);
+ };
virtual void Exit(int status)
{
exit(status);
};
virtual char* GetBase(PerlIO* pf, int &err)
{
+#ifdef FILE_base
FILE *f = (FILE*)pf;
return FILE_base(f);
+#else
+ return Nullch;
+#endif
};
virtual int GetBufsiz(PerlIO* pf, int &err)
{
+#ifdef FILE_bufsiz
FILE *f = (FILE*)pf;
return FILE_bufsiz(f);
+#else
+ return (-1);
+#endif
};
virtual int GetCnt(PerlIO* pf, int &err)
{
+#ifdef USE_STDIO_PTR
FILE *f = (FILE*)pf;
return FILE_cnt(f);
+#else
+ return (-1);
+#endif
};
virtual char* GetPtr(PerlIO* pf, int &err)
{
+#ifdef USE_STDIO_PTR
FILE *f = (FILE*)pf;
return FILE_ptr(f);
+#else
+ return Nullch;
+#endif
};
virtual char* Gets(PerlIO* pf, char* s, int n, int& err)
{
};
virtual void SetCnt(PerlIO* pf, int n, int &err)
{
+#ifdef STDIO_CNT_LVALUE
FILE *f = (FILE*)pf;
FILE_cnt(f) = n;
+#endif
};
virtual void SetPtrCnt(PerlIO* pf, char * ptr, int n, int& err)
{
+#ifdef STDIO_PTR_LVALUE
FILE *f = (FILE*)pf;
FILE_ptr(f) = ptr;
FILE_cnt(f) = n;
+#endif
};
virtual void Setlinebuf(PerlIO* pf, int &err)
{
{
try
{
- pPerl->perl_construct();
+ perl_construct();
}
catch(...)
{
win32_fprintf(stderr, "%s\n",
"Error: Unable to construct data structures");
- pPerl->perl_free();
+ perl_free();
pPerl = NULL;
}
}
int retVal;
try
{
- retVal = pPerl->perl_parse(xs_init, argc, argv, env);
+ retVal = perl_parse(xs_init, argc, argv, env);
}
catch(int x)
{
int retVal;
try
{
- retVal = pPerl->perl_run();
+ retVal = perl_run();
}
catch(int x)
{
{
try
{
- pPerl->perl_destruct();
- pPerl->perl_free();
+ perl_destruct();
+ perl_free();
}
catch(...)
{