GNU PROLOG with UTF8 support
Data Structures | Macros | Typedefs | Functions | Variables
stream_supp.h File Reference
#include <stdio.h>
Include dependency graph for stream_supp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  StmProp
 
struct  PbStk
 
struct  stm_lst
 
struct  stm_inf
 
struct  AliasInf
 
struct  StrSInf
 

Macros

#define STREAM_PB_SIZE   8 /* push back buffer size */
 
#define STREAM_MODE_READ   0
 
#define STREAM_MODE_WRITE   1
 
#define STREAM_MODE_APPEND   2
 
#define STREAM_EOF_ACTION_ERROR   0
 
#define STREAM_EOF_ACTION_EOF_CODE   1
 
#define STREAM_EOF_ACTION_RESET   2
 
#define STREAM_BUFFERING_NONE   0
 
#define STREAM_BUFFERING_LINE   1
 
#define STREAM_BUFFERING_BLOCK   2
 
#define STREAM_EOF_NOT   0
 
#define STREAM_EOF_AT   1
 
#define STREAM_EOF_PAST   2
 
#define STREAM_CHECK_VALID   0 /* simply a valid stream */
 
#define STREAM_CHECK_EXIST   1 /* valid and exist */
 
#define STREAM_CHECK_INPUT   2 /* valid, exist and mode=input */
 
#define STREAM_CHECK_OUTPUT   3 /* valid, exist and mode=output */
 
#define STREAM_FCT_UNDEFINED   ((StmFct) (-1)) /* for optional fct */
 
#define TERM_STREAM_ATOM   1 /* values also used in stream.pl */
 
#define TERM_STREAM_CHARS   2
 
#define TERM_STREAM_CODES   3
 
#define PB_Init(pb)   pb.ptr = pb.buff, pb.nb_elems = 0;
 
#define PB_Is_Empty(pb)   (pb.nb_elems == 0)
 
#define PB_Push(pb, elem)
 
#define PB_Pop(pb, elem)
 
#define PB_Top(pb, elem)
 

Typedefs

typedef int(* StmFct) ()
 
typedef struct stm_lstPStmLst
 
typedef struct stm_lst StmLst
 
typedef struct stm_inf StmInf
 

Functions

int Pl_Add_Stream (int atom_file_name, PlLong file, StmProp prop, StmFct fct_getc, StmFct fct_putc, StmFct fct_flush, StmFct fct_close, StmFct fct_tell, StmFct fct_seek, StmFct fct_clearerr)
 
int Pl_Add_Stream_For_Stdio_Desc (FILE *f, int atom_path, int mode, int text)
 
int Pl_Add_Stream_For_Stdio_File (char *path, int mode, Bool text)
 
void Pl_Delete_Stream (int stm)
 
int Pl_Find_Stream_By_Alias (int atom_alias)
 
Bool Pl_Add_Alias_To_Stream (int atom_alias, int stm)
 
void Pl_Reassign_Alias (int atom_alias, int stm)
 
void Pl_Add_Mirror_To_Stream (int stm, int m_stm)
 
Bool Pl_Del_Mirror_From_Stream (int stm, int m_stm)
 
int Pl_Find_Stream_From_PStm (StmInf *pstm)
 
void Pl_Flush_All_Streams (void)
 
void Pl_Set_Stream_Buffering (int stm)
 
int Pl_Get_Stream_Or_Alias (WamWord sora_word, int test_mask)
 
void Pl_Check_Stream_Type (int stm, Bool check_text, Bool for_input)
 
WamWord Pl_Make_Stream_Tagged_Word (int stm)
 
Bool Pl_Stdio_Is_Repositionable (FILE *f)
 
void Pl_Stdio_Set_Buffering (FILE *f, int buffering)
 
FILE * Pl_Stdio_Desc_Of_Stream (int stm)
 
int Pl_Io_Fileno_Of_Stream (int stm)
 
void Pl_PB_Empty_Buffer (StmInf *pstm)
 
CHAR32_T Pl_Stream_Get_Key (StmInf *pstm, Bool echo, Bool catch_ctrl_c)
 
CHAR32_T Pl_Stream_Getc (StmInf *pstm)
 
void Pl_Stream_Ungetc (CHAR32_T c, StmInf *pstm)
 
CHAR32_T Pl_Stream_Peekc (StmInf *pstm)
 
char * Pl_Stream_Gets (char *str, int size, StmInf *pstm)
 
char * Pl_Stream_Gets_Prompt (char *prompt, StmInf *pstm_o, char *str, int size, StmInf *pstm_i)
 
void Pl_Stream_Putc (CHAR32_T c, StmInf *pstm)
 
int Pl_Stream_Puts (char *str, StmInf *pstm)
 
int Pl_Stream_Printf (StmInf *pstm, char *format,...)
 
void Pl_Stream_Flush (StmInf *pstm)
 
int Pl_Stream_Close (StmInf *pstm)
 
int Pl_Stream_End_Of_Stream (StmInf *pstm)
 
void Pl_Stream_Get_Position (StmInf *pstm, PlLong *offset, PlLong *char_count, PlLong *line_count, PlLong *line_pos)
 
int Pl_Stream_Set_Position (StmInf *pstm, int whence, PlLong offset, PlLong char_count, PlLong line_count, PlLong line_pos)
 
int Pl_Stream_Set_Position_LC (StmInf *pstm, PlLong line_count, PlLong line_pos)
 
int Pl_Add_Str_Stream (char *buff, int prop_other)
 
void Pl_Delete_Str_Stream (int stm)
 
char * Pl_Term_Write_Str_Stream (int stm)
 
void Pl_Close_Stm (int stm, Bool force)
 

Variables

StmInf ** pl_stm_tbl
 
int pl_stm_tbl_size
 
int pl_stm_last_used
 
char * pl_alias_tbl
 
WamWord pl_last_input_sora
 
WamWord pl_last_output_sora
 
int pl_stm_stdin
 
int pl_stm_stdout
 
int pl_stm_stderr
 
int pl_stm_input
 
int pl_stm_output
 
int pl_stm_error
 
int pl_stm_top_level_input
 
int pl_stm_top_level_output
 
int pl_stm_debugger_input
 
int pl_stm_debugger_output
 
Bool pl_stream_use_linedit
 
char * pl_le_prompt
 
int pl_use_le_prompt
 
int pl_atom_stream
 
int pl_atom_user_input
 
int pl_atom_user_output
 
int pl_atom_top_level_input
 
int pl_atom_top_level_output
 
int pl_atom_debugger_input
 
int pl_atom_debugger_output
 
int pl_atom_read
 
int pl_atom_write
 
int pl_atom_append
 
int pl_atom_reposition
 
int pl_atom_stream_position
 
int pl_atom_text
 
int pl_atom_binary
 
int pl_atom_error
 
int pl_atom_eof_code
 
int pl_atom_reset
 
int pl_atom_none
 
int pl_atom_line
 
int pl_atom_block
 
int pl_atom_not
 
int pl_atom_at
 
int pl_atom_past
 
int pl_atom_bof
 
int pl_atom_current
 
int pl_atom_eof
 

Macro Definition Documentation

#define PB_Init (   pb)    pb.ptr = pb.buff, pb.nb_elems = 0;
#define PB_Is_Empty (   pb)    (pb.nb_elems == 0)
#define PB_Pop (   pb,
  elem 
)
Value:
do \
{ \
if (pb.ptr != pb.buff) \
pb.ptr--; \
else \
pb.ptr = pb.buff + STREAM_PB_SIZE - 1; \
(elem) = *pb.ptr; \
pb.nb_elems--; \
} \
while (0)
#define STREAM_PB_SIZE
Definition: stream_supp.h:48
#define PB_Push (   pb,
  elem 
)
Value:
do \
{ \
*(pb.ptr) = (elem); \
if (pb.ptr != pb.buff + STREAM_PB_SIZE - 1) \
pb.ptr++; \
else \
pb.ptr = pb.buff; \
if (pb.nb_elems < STREAM_PB_SIZE) \
pb.nb_elems++; \
} \
while (0)
#define STREAM_PB_SIZE
Definition: stream_supp.h:48
#define PB_Top (   pb,
  elem 
)
Value:
do \
{ \
if (pb.ptr != pb.buff) \
(elem) = pb.ptr[-1]; \
else \
(elem) = pb.buff[STREAM_PB_SIZE - 1]; \
} \
while (0)
#define STREAM_PB_SIZE
Definition: stream_supp.h:48
#define STREAM_BUFFERING_BLOCK   2
#define STREAM_BUFFERING_LINE   1
#define STREAM_BUFFERING_NONE   0
#define STREAM_CHECK_EXIST   1 /* valid and exist */
#define STREAM_CHECK_INPUT   2 /* valid, exist and mode=input */
#define STREAM_CHECK_OUTPUT   3 /* valid, exist and mode=output */
#define STREAM_CHECK_VALID   0 /* simply a valid stream */
#define STREAM_EOF_ACTION_EOF_CODE   1
#define STREAM_EOF_ACTION_ERROR   0
#define STREAM_EOF_ACTION_RESET   2
#define STREAM_EOF_AT   1
#define STREAM_EOF_NOT   0
#define STREAM_EOF_PAST   2
#define STREAM_FCT_UNDEFINED   ((StmFct) (-1)) /* for optional fct */
#define STREAM_MODE_APPEND   2
#define STREAM_MODE_READ   0
#define STREAM_MODE_WRITE   1
#define STREAM_PB_SIZE   8 /* push back buffer size */
#define TERM_STREAM_ATOM   1 /* values also used in stream.pl */
#define TERM_STREAM_CHARS   2
#define TERM_STREAM_CODES   3

Typedef Documentation

typedef struct stm_lst* PStmLst
typedef int(* StmFct) ()
typedef struct stm_inf StmInf
typedef struct stm_lst StmLst

Function Documentation

Bool Pl_Add_Alias_To_Stream ( int  atom_alias,
int  stm 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Add_Mirror_To_Stream ( int  stm,
int  m_stm 
)

Here is the caller graph for this function:

int Pl_Add_Str_Stream ( char *  buff,
int  prop_other 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Add_Stream ( int  atom_file_name,
PlLong  file,
StmProp  prop,
StmFct  fct_getc,
StmFct  fct_putc,
StmFct  fct_flush,
StmFct  fct_close,
StmFct  fct_tell,
StmFct  fct_seek,
StmFct  fct_clearerr 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Add_Stream_For_Stdio_Desc ( FILE *  f,
int  atom_path,
int  mode,
int  text 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Add_Stream_For_Stdio_File ( char *  path,
int  mode,
Bool  text 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Check_Stream_Type ( int  stm,
Bool  check_text,
Bool  for_input 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Close_Stm ( int  stm,
Bool  force 
)

Here is the call graph for this function:

Here is the caller graph for this function:

Bool Pl_Del_Mirror_From_Stream ( int  stm,
int  m_stm 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Delete_Str_Stream ( int  stm)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Delete_Stream ( int  stm)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Find_Stream_By_Alias ( int  atom_alias)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Find_Stream_From_PStm ( StmInf pstm)

Here is the caller graph for this function:

void Pl_Flush_All_Streams ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Get_Stream_Or_Alias ( WamWord  sora_word,
int  test_mask 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Io_Fileno_Of_Stream ( int  stm)

Here is the call graph for this function:

Here is the caller graph for this function:

WamWord Pl_Make_Stream_Tagged_Word ( int  stm)
void Pl_PB_Empty_Buffer ( StmInf pstm)

Here is the caller graph for this function:

void Pl_Reassign_Alias ( int  atom_alias,
int  stm 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Set_Stream_Buffering ( int  stm)

Here is the call graph for this function:

Here is the caller graph for this function:

FILE* Pl_Stdio_Desc_Of_Stream ( int  stm)

Here is the caller graph for this function:

Bool Pl_Stdio_Is_Repositionable ( FILE *  f)

Here is the caller graph for this function:

void Pl_Stdio_Set_Buffering ( FILE *  f,
int  buffering 
)

Here is the caller graph for this function:

int Pl_Stream_Close ( StmInf pstm)

Here is the caller graph for this function:

int Pl_Stream_End_Of_Stream ( StmInf pstm)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Stream_Flush ( StmInf pstm)

Here is the caller graph for this function:

CHAR32_T Pl_Stream_Get_Key ( StmInf pstm,
Bool  echo,
Bool  catch_ctrl_c 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Stream_Get_Position ( StmInf pstm,
PlLong offset,
PlLong char_count,
PlLong line_count,
PlLong line_pos 
)

Here is the caller graph for this function:

CHAR32_T Pl_Stream_Getc ( StmInf pstm)

Here is the call graph for this function:

Here is the caller graph for this function:

char* Pl_Stream_Gets ( char *  str,
int  size,
StmInf pstm 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* Pl_Stream_Gets_Prompt ( char *  prompt,
StmInf pstm_o,
char *  str,
int  size,
StmInf pstm_i 
)

Here is the call graph for this function:

Here is the caller graph for this function:

CHAR32_T Pl_Stream_Peekc ( StmInf pstm)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Stream_Printf ( StmInf pstm,
char *  format,
  ... 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Stream_Putc ( CHAR32_T  c,
StmInf pstm 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Stream_Puts ( char *  str,
StmInf pstm 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_Stream_Set_Position ( StmInf pstm,
int  whence,
PlLong  offset,
PlLong  char_count,
PlLong  line_count,
PlLong  line_pos 
)

Here is the caller graph for this function:

int Pl_Stream_Set_Position_LC ( StmInf pstm,
PlLong  line_count,
PlLong  line_pos 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Stream_Ungetc ( CHAR32_T  c,
StmInf pstm 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* Pl_Term_Write_Str_Stream ( int  stm)

Here is the caller graph for this function:

Variable Documentation

char* pl_alias_tbl
int pl_atom_append
int pl_atom_at
int pl_atom_binary
int pl_atom_block
int pl_atom_bof
int pl_atom_current
int pl_atom_debugger_input
int pl_atom_debugger_output
int pl_atom_eof
int pl_atom_eof_code
int pl_atom_error
int pl_atom_line
int pl_atom_none
int pl_atom_not
int pl_atom_past
int pl_atom_read
int pl_atom_reposition
int pl_atom_reset
int pl_atom_stream
int pl_atom_stream_position
int pl_atom_text
int pl_atom_top_level_input
int pl_atom_top_level_output
int pl_atom_user_input
int pl_atom_user_output
int pl_atom_write
WamWord pl_last_input_sora
WamWord pl_last_output_sora
char* pl_le_prompt
int pl_stm_debugger_input
int pl_stm_debugger_output
int pl_stm_error
int pl_stm_input
int pl_stm_last_used
int pl_stm_output
int pl_stm_stderr
int pl_stm_stdin
int pl_stm_stdout
StmInf** pl_stm_tbl
int pl_stm_tbl_size
int pl_stm_top_level_input
int pl_stm_top_level_output
Bool pl_stream_use_linedit
int pl_use_le_prompt