![]() |
GNU PROLOG with UTF8 support
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "engine_pl.h"
#include "bips_pl.h"
#include "linedit.h"
#include <unistd.h>
Macros | |
#define | STREAM_SUPP_FILE |
#define | START_ALIAS_TBL_SIZE 128 |
#define | STR_STREAM_WRITE_BLOCK 1024 |
#define | TTY_BUFFER_SIZE 1024 |
#define | BIG_BUFFER 65535 |
#define | ERR_TELL_OR_SEEK_UNDEFINED "fct tell or seek undefined\n" |
#define | INIT_FCT(f, d) pstm->f = (f) ? f : (StmFct) d |
#define | SAVE_FOR_REENTRANCY |
#define | RESTORE_FOR_REENTRANCY |
#define | Before_Reading(pstm, file) |
#define | Update_Counters(pstm, c) |
Functions | |
static void | Init_Stream_Supp () |
static int | Find_Free_Stream (void) |
static void | Del_Aliases_Of_Stream (int stm) |
static void | Update_Mirrors_To_Del_Stream (int stm) |
static Bool | Remove_In_Stream_List (int stm, StmLst **p_start) |
static int | TTY_Getc (void) |
static CHAR32_T | TTY_Get_Key (Bool echo, Bool catch_ctrl_c) |
static void | TTY_Clearerr (void) |
static CHAR32_T | Basic_Call_Fct_Getc (StmInf *pstm) |
static void | Basic_Call_Fct_Putc (CHAR32_T c, StmInf *pstm) |
static int | Str_Stream_Getc (StrSInf *str_stream) |
static void | Str_Stream_Putc (CHAR32_T c, StrSInf *str_stream) |
StmProp | Pl_Prop_And_Stdio_Mode (int mode, Bool text, char *open_str) |
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) |
static void | Init_Stream_Struct (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, StmInf *pstm) |
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) |
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) |
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, int echo, int 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) |
Variables | |
void(* | pl_init_stream_supp )() = Init_Stream_Supp |
static int | atom_constant_term_stream |
static WamWord | stream_1 |
static WamWord | word_current_input_stream |
static WamWord | word_current_output_stream |
static StrSInf | static_str_stream_rd = { NULL, NULL, 0 } |
static StrSInf | static_str_stream_wr = { NULL, NULL, 0 } |
static char | tty_first_buff [TTY_BUFFER_SIZE] |
static char * | tty_buff |
static char * | tty_ptr = NULL |
#define Before_Reading | ( | pstm, | |
file | |||
) |
#define BIG_BUFFER 65535 |
#define ERR_TELL_OR_SEEK_UNDEFINED "fct tell or seek undefined\n" |
#define RESTORE_FOR_REENTRANCY |
#define SAVE_FOR_REENTRANCY |
#define START_ALIAS_TBL_SIZE 128 |
#define STR_STREAM_WRITE_BLOCK 1024 |
#define STREAM_SUPP_FILE |
#define TTY_BUFFER_SIZE 1024 |
#define Update_Counters | ( | pstm, | |
c | |||
) |
|
static |
|
static |
|
static |
|
static |
Bool Pl_Add_Alias_To_Stream | ( | int | atom_alias, |
int | stm | ||
) |
void Pl_Add_Mirror_To_Stream | ( | int | stm, |
int | m_stm | ||
) |
int Pl_Add_Str_Stream | ( | char * | buff, |
int | prop_other | ||
) |
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 | ||
) |
Bool Pl_Del_Mirror_From_Stream | ( | int | stm, |
int | m_stm | ||
) |
void Pl_Delete_Str_Stream | ( | int | stm | ) |
void Pl_Delete_Stream | ( | int | stm | ) |
int Pl_Find_Stream_By_Alias | ( | int | atom_alias | ) |
int Pl_Find_Stream_From_PStm | ( | StmInf * | pstm | ) |
void Pl_Flush_All_Streams | ( | void | ) |
int Pl_Get_Stream_Or_Alias | ( | WamWord | sora_word, |
int | test | ||
) |
int Pl_Io_Fileno_Of_Stream | ( | int | stm | ) |
WamWord Pl_Make_Stream_Tagged_Word | ( | int | stm | ) |
void Pl_PB_Empty_Buffer | ( | StmInf * | pstm | ) |
void Pl_Reassign_Alias | ( | int | atom_alias, |
int | stm | ||
) |
void Pl_Set_Stream_Buffering | ( | int | stm | ) |
FILE* Pl_Stdio_Desc_Of_Stream | ( | int | stm | ) |
Bool Pl_Stdio_Is_Repositionable | ( | FILE * | f | ) |
void Pl_Stdio_Set_Buffering | ( | FILE * | f, |
int | buffering | ||
) |
int Pl_Stream_Close | ( | StmInf * | pstm | ) |
int Pl_Stream_End_Of_Stream | ( | StmInf * | pstm | ) |
void Pl_Stream_Flush | ( | StmInf * | pstm | ) |
void Pl_Stream_Get_Position | ( | StmInf * | pstm, |
PlLong * | offset, | ||
PlLong * | char_count, | ||
PlLong * | line_count, | ||
PlLong * | line_pos | ||
) |
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 | ||
) |
int Pl_Stream_Printf | ( | StmInf * | pstm, |
char * | format, | ||
... | |||
) |
int Pl_Stream_Puts | ( | char * | str, |
StmInf * | pstm | ||
) |
int Pl_Stream_Set_Position | ( | StmInf * | pstm, |
int | whence, | ||
PlLong | offset, | ||
PlLong | char_count, | ||
PlLong | line_count, | ||
PlLong | line_pos | ||
) |
char* Pl_Term_Write_Str_Stream | ( | int | stm | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
void(* pl_init_stream_supp) () = Init_Stream_Supp |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |