1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
ipdir.h
Interface for perl directory functions
*/
/*
PerlXXX_YYY explained - DickH and DougL @ ActiveState.com
XXX := functional group
YYY := stdlib/OS function name
Continuing with the theme of PerlIO, all OS functionality was
encapsulated into one of several interfaces.
PerlIO - stdio
PerlLIO - low level I/O
PerlMem - malloc, realloc, free
PerlDir - directory related
PerlEnv - process environment handling
PerlProc - process control
PerlSock - socket functions
The features of this are:
1. All OS dependant code is in the Perl Host and not the Perl Core.
(At least this is the holy grail goal of this work)
2. The Perl Host (see perl.h for description) can provide a new and
improved interface to OS functionality if required.
3. Developers can easily hook into the OS calls for instrumentation
or diagnostic purposes.
What was changed to do this:
1. All calls to OS functions were replaced with PerlXXX_YYY
*/
#ifndef __Inc__IPerlDir___
#define __Inc__IPerlDir___
class IPerlDir
{
public:
virtual int Makedir(const char *dirname, int mode, int &err) = 0;
virtual int Chdir(const char *dirname, int &err) = 0;
virtual int Rmdir(const char *dirname, int &err) = 0;
virtual int Close(DIR *dirp, int &err) = 0;
virtual DIR *Open(char *filename, int &err) = 0;
virtual struct direct *Read(DIR *dirp, int &err) = 0;
virtual void Rewind(DIR *dirp, int &err) = 0;
virtual void Seek(DIR *dirp, long loc, int &err) = 0;
virtual long Tell(DIR *dirp, int &err) = 0;
};
#endif /* __Inc__IPerlDir___ */
|