p2  0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PNFile Struct Reference

a file is wrapper around a file descriptor, non-volatile but mutable. More...

#include <potion.h>

Public Member Functions

PN potion_file_new (Potion *P, PN cl, PN self, PN path, PN modestr)
 
PN potion_file_with_fd (Potion *P, PN cl, PN self, PN fd)
 
PN potion_file_close (Potion *P, PN cl, pn_file self)
 
PN potion_file_read (Potion *P, PN cl, pn_file self, PN n)
 
PN potion_file_write (Potion *P, PN cl, pn_file self, PN obj)
 
PN potion_file_print (Potion *P, PN cl, pn_file self, PN obj)
 
PN potion_file_string (Potion *P, PN cl, pn_file self)
 

Data Fields

 PN_OBJECT_HEADER
 PNType vt; PNUniq uniq. More...
 
int fd
 
PN path
 
mode_t mode
 

Detailed Description

a file is wrapper around a file descriptor, non-volatile but mutable.

Definition at line 370 of file potion.h.

Member Function Documentation

PN potion_file_new ( Potion P,
PN  cl,
PN  self,
PN  path,
PN  modestr 
)

constructor method. opens a file with 0755 and returns the created PNFile

Parameters
pathPNString
modestrPNString r,r+,w,w+,a,a+
Returns
self or PN_NIL

Definition at line 39 of file file.c.

PN potion_file_with_fd ( Potion P,
PN  cl,
PN  self,
PN  fd 
)

"fd" class method.

Parameters
fdPNInteger
Returns
a new PNFile object for the already opened file descriptor (sorry, empty path).

Definition at line 70 of file file.c.

PN potion_file_close ( Potion P,
PN  cl,
pn_file  self 
)

"close" the file

Returns
PN_NIL

Definition at line 87 of file file.c.

PN potion_file_read ( Potion P,
PN  cl,
pn_file  self,
PN  n 
)

"read" n PNBytes from the file

Parameters
nPNInteger
Returns
n PNBytes or nil or PNError

Definition at line 98 of file file.c.

PN potion_file_write ( Potion P,
PN  cl,
pn_file  self,
PN  obj 
)

"write" a binary representation of obj to the file handle.

Parameters
objPNString, PNBytes, PNInteger (long or double), PNBoolean (char 0 or 1)
Returns
PNInteger written bytes or PN_NIL

Definition at line 117 of file file.c.

PN potion_file_print ( Potion P,
PN  cl,
pn_file  self,
PN  obj 
)

"print" a stringification of any object to the filehandle. Note that write prints the binary value of the object.

Parameters
objany
Returns
"" or PNError

Definition at line 154 of file file.c.

PN potion_file_string ( Potion P,
PN  cl,
pn_file  self 
)

"string" method. some internal descr

Definition at line 161 of file file.c.

Field Documentation

PNFile::PN_OBJECT_HEADER

PNType vt; PNUniq uniq.

Definition at line 371 of file potion.h.

int PNFile::fd

Definition at line 372 of file potion.h.

PN PNFile::path

Definition at line 373 of file potion.h.

mode_t PNFile::mode

Definition at line 374 of file potion.h.


The documentation for this struct was generated from the following files: