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

Public Member Functions

#define vPN(t)   struct PN##t * volatile
 
PN potion_buffile_fdopen (Potion *P, PN cl, pn_ffile self, PN fd, PN modestr)
 
PN potion_buffile_freopen (Potion *P, PN cl, pn_ffile self, PN path, PN modestr, pn_ffile stream)
 
PN potion_buffile_fclose (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_fgetc (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_fgets (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_fread (Potion *P, PN cl, pn_ffile self, PN buf, PN size, PN nitems)
 
PN potion_buffile_fwrite (Potion *P, PN cl, pn_ffile self, PN buf, PN size, PN nitems)
 
PN potion_buffile_fputc (Potion *P, PN cl, pn_ffile self, PN byte)
 
PN potion_buffile_fputs (Potion *P, PN cl, pn_ffile self, PN str)
 
PN potion_buffile_fflush (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_fseek (Potion *P, PN cl, pn_ffile self, PN offset, PN whence)
 
PN potion_buffile_ftell (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_feof (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_fileno (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_unlink (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_flockfile (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_ftrylockfile (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_funlockfile (Potion *P, PN cl, pn_ffile self)
 
PN potion_buffile_string (Potion *P, PN cl, pn_ffile self)
 

Data Fields

 PN_OBJECT_HEADER
 
PN_SIZE siz
 
FILE * file
 
PN path
 

Detailed Description

Definition at line 28 of file buffile.c.

Member Function Documentation

PN potion_buffile_fdopen ( Potion P,
PN  cl,
pn_ffile  self,
PN  fd,
PN  modestr 
)

fdopen associate a stream with the existing file descriptor, fd

See also
potion_buffile_with_fd()
Parameters
fdPN_NUM
modestrPNString r,r+,w,w+,a,a+
Returns
PNBufFile or PNError

Definition at line 73 of file buffile.c.

PN potion_buffile_freopen ( Potion P,
PN  cl,
pn_ffile  self,
PN  path,
PN  modestr,
pn_ffile  stream 
)

freopen opens the file whose name is the string pointed to by path and associates the stream pointed to by the stream argument with it. The original file (if it exists) is closed. The primary use of the freopen() function is to change the file associated with a standard text stream (stderr, stdin, or stdout).

Parameters
pathPNString
modestrPNString r,r+,w,w+,a,a+
streamPNBufFile
Returns
PNBufFile or PNError

Definition at line 92 of file buffile.c.

PN potion_buffile_fclose ( Potion P,
PN  cl,
pn_ffile  self 
)

flush and close a PNBufFile.

Returns
PNInteger (0 or EOF)

Definition at line 129 of file buffile.c.

PN potion_buffile_fgetc ( Potion P,
PN  cl,
pn_ffile  self 
)

read the next character from a PNBufFile

Returns
PNInteger

Definition at line 135 of file buffile.c.

PN potion_buffile_fgets ( Potion P,
PN  cl,
pn_ffile  self 
)

read next line from PNBufFile, max 1024

See also
potion_lobby_read() and potion_file_read()
Returns
PNBytes or PN_NIL

Definition at line 142 of file buffile.c.

PN potion_buffile_fread ( Potion P,
PN  cl,
pn_ffile  self,
PN  buf,
PN  size,
PN  nitems 
)

read nitems of size from the stream into the PNBytes buf

Parameters
bufPNBytes
sizePNInteger
nitemsPNInteger
Returns
PNInteger of read items or PNError

Definition at line 154 of file buffile.c.

PN potion_buffile_fwrite ( Potion P,
PN  cl,
pn_ffile  self,
PN  buf,
PN  size,
PN  nitems 
)

write nitems of size starting at the pointer pointing to buf to the stream.

Parameters
bufPNBytes or PNString
sizePNInteger or if PN_NIL the length of buf
nitemsPNInteger, default 1
Returns
PNInteger of written items or PNError

Definition at line 166 of file buffile.c.

PN potion_buffile_fputc ( Potion P,
PN  cl,
pn_ffile  self,
PN  byte 
)

write the byte (0-255) to a PNBufFile

Parameters
bytePNInteger
Returns
PNInteger

Definition at line 186 of file buffile.c.

PN potion_buffile_fputs ( Potion P,
PN  cl,
pn_ffile  self,
PN  str 
)

write line to PNBufFile

Parameters
strPNString or PNBytes
Returns
PNInteger or PNError

Definition at line 193 of file buffile.c.

PN potion_buffile_fflush ( Potion P,
PN  cl,
pn_ffile  self 
)

"fflush"

Returns
true or PNError

Definition at line 202 of file buffile.c.

PN potion_buffile_fseek ( Potion P,
PN  cl,
pn_ffile  self,
PN  offset,
PN  whence 
)

"fseek" set the file-position indicator for the stream.

Parameters
offsetPNInteger
whencePNInteger
Returns
true or PNError

Definition at line 212 of file buffile.c.

PN potion_buffile_ftell ( Potion P,
PN  cl,
pn_ffile  self 
)

"ftell" returns the file-position indicator for the stream measured in bytes from the beginning of the file.

Returns
PNInteger

Definition at line 221 of file buffile.c.

PN potion_buffile_feof ( Potion P,
PN  cl,
pn_ffile  self 
)

"feof" tests the end-of-file indicator for the stream.

Returns
true or false

Definition at line 230 of file buffile.c.

PN potion_buffile_fileno ( Potion P,
PN  cl,
pn_ffile  self 
)

"fileno"

Returns
its integer file descriptor.

Definition at line 236 of file buffile.c.

PN potion_buffile_unlink ( Potion P,
PN  cl,
pn_ffile  self 
)

"unlink" the PNBufFile. close it if open.

Returns
true or nil

Definition at line 242 of file buffile.c.

PN potion_buffile_flockfile ( Potion P,
PN  cl,
pn_ffile  self 
)

acquire for a thread ownership of a PNBufFile object

Definition at line 252 of file buffile.c.

PN potion_buffile_ftrylockfile ( Potion P,
PN  cl,
pn_ffile  self 
)

non-blocking version of

See also
potion_buffile_flockfile().
Returns
0 for success

Definition at line 258 of file buffile.c.

PN potion_buffile_funlockfile ( Potion P,
PN  cl,
pn_ffile  self 
)

relinquish the ownership granted to the thread of a PNBufFile object

Definition at line 263 of file buffile.c.

PN potion_buffile_string ( Potion P,
PN  cl,
pn_ffile  self 
)

"fprintf" to file.

Parameters
objany
Returns
PN_NIL "string" method. some internal descr

Definition at line 278 of file buffile.c.

Field Documentation

PNBufFile::PN_OBJECT_HEADER

Definition at line 29 of file buffile.c.

PN_SIZE PNBufFile::siz

Definition at line 30 of file buffile.c.

FILE* PNBufFile::file

Definition at line 31 of file buffile.c.

PN PNBufFile::path

Definition at line 32 of file buffile.c.


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