C:/Users/Dennis/src/lang/Life_start/Life/life-1.02/source/sys.c File Reference

#include <unistd.h>
#include "extern.h"
#include "trees.h"
#include "login.h"
#include "types.h"
#include "parser.h"
#include "copy.h"
#include "token.h"
#include "print.h"
#include "lefun.h"
#include "memory.h"
#include "built_ins.h"
#include "error.h"
#include "modules.h"
#include "sys.h"
#include "regexp/regexp.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <sys/wait.h>
#include <sys/param.h>

Go to the source code of this file.

Data Structures

struct  a_stream
struct  text_buffer
struct  psi_feature

Defines

#define ARGNN   10
#define BYTEDATA_SIZE(X)   (*(unsigned long *)(X->value))
#define BYTEDATA_DATA(X)   ((char*)((char*)X->value + sizeof(unsigned long)))
#define BV_AND   0
#define BV_OR   1
#define BV_XOR   2
#define BV_NOT   0
#define BV_COUNT   1
#define BV_GET   0
#define BV_SET   1
#define BV_CLEAR   2
#define FP_NONE   0
#define FP_INPUT   1
#define FP_OUTPUT   2
#define FP_PREPARE(s, OP)
#define TEXTBUFSIZE   5000
#define SEEK_SET   0
#define SEEK_CUR   1
#define SEEK_END   2
#define SETFEATURE(lst, n, nam, val)   ((lst[n].name=nam),(lst[n].value=val))

Typedefs

typedef struct a_streamptr_stream

Functions

long call_primitive (long(*fun)(), int num, argi, void *info)
static ptr_psi_term make_bytedata (ptr_definition sort, unsigned long bytes)
static long make_bitvector_internal (args, result, funct)
static long c_make_bitvector ()
static long bitvector_binop_code (unsigned long *bv1, unsigned long *bv2, ptr_psi_term result, int op)
static long bitvector_binop_internal (args, result, funct, void *op)
static long bitvector_binop (int op)
static long c_bitvector_and ()
static long c_bitvector_or ()
static long c_bitvector_xor ()
static long bitvector_unop_code (unsigned long *bv1, ptr_psi_term result, int op)
static long bitvector_unop_internal (args, result, funct, void *op)
static long bitvector_unop (int op)
static long c_bitvector_not ()
static long c_bitvector_count ()
static long bitvector_bit_code (unsigned long *bv1, long idx, ptr_psi_term result, int op, ptr_psi_term funct)
static long bitvector_bit_internal (args, result, funct, void *op)
static long bitvector_bit (int op)
static long c_bitvector_get ()
static long c_bitvector_set ()
static long c_bitvector_clear ()
void regerror (char *s)
static long regexp_compile_internal (args, result, funct)
static long c_regexp_compile ()
static long regexp_execute_internal (args, result, funct)
static long c_regexp_execute ()
ptr_psi_term fileptr2stream (FILE *fp, ptr_definition *typ)
static long int2stream_internal (args, result, funct)
static long c_int2stream ()
static long fopen_internal (args, result, funct)
static long c_fopen ()
static long fclose_internal (args, result, funct)
static long c_fclose ()
static long fwrite_internal (args, result, funct)
static long c_fwrite ()
static long fflush_internal (args, result, funct)
static long c_fflush ()
static long get_buffer_internal (args, result, funct)
static long c_get_buffer ()
int text_buffer_next (struct text_buffer *buf, int idx, char c, struct text_buffer **rbuf, int *ridx)
char * text_buffer_cmp (struct text_buffer *buf, int idx, char *str)
void text_buffer_push (struct text_buffer **buf, char c)
void text_buffer_free (struct text_buffer *buf)
static long get_record_internal (args, result, funct)
static long c_get_record ()
static long get_code_internal (args, result, funct)
static long c_get_code ()
static long ftell_internal (args, result, funct)
static long c_ftell ()
static long fseek_internal (args, result, funct)
static long c_fseek ()
static long stream2sys_stream_internal (args, result, funct)
static long c_stream2sys_stream ()
static long sys_stream2stream_internal (args, result, funct)
static long c_sys_stream2stream ()
static long socket_internal (args, result, funct)
static long c_socket ()
int is_ipaddr (char *s)
static long bind_or_connect_internal (args, result, funct, void *info)
static long c_bind ()
static long c_connect ()
static long listen_internal (args, result, funct)
static long c_listen ()
static long accept_internal (args, result, funct)
static long c_accept ()
static long errno_internal (args, result, funct)
static long c_errno ()
static long errmsg_internal (args, result, funct)
static long c_errmsg ()
static long import_symbol_internal (args, result, funct)
static long c_import_symbol ()
static long fork_internal (args, result, funct)
static long c_fork ()
static long unify_pterm_result (ptr_psi_term t, ptr_definition sym, lst, int n)
char * get_numeric_feature (long n)
static long unify_wait_result (ptr_psi_term result, pid_t id, int status)
static long wait_internal (args, result, funct)
static long c_wait ()
static long waitpid_internal (args, result, funct)
static long c_waitpid ()
static long kill_internal (args, result, funct)
static long c_kill ()
static long cuserid_internal (args, result, funct)
static long c_cuserid ()
static long gethostname_internal (args, result, funct)
static long c_gethostname ()
static long lazy_project_internal (args, result, funct)
static long c_lazy_project ()
static long wait_on_feature_internal (args, result, funct)
static long c_wait_on_feature ()
static long my_wait_on_feature_internal (args, result, funct)
static long c_my_wait_on_feature ()
static long call_once_internal (args, result, funct)
static long c_call_once ()
static long apply1_internal (args, result, funct)
static long c_apply1 ()
static long getpid_internal (args, result, funct)
static long c_getpid ()
void make_sys_type_links ()
void check_sys_definitions ()
void insert_sys_builtins ()

Variables

static char vcid [] = "$Id: sys.c,v 1.9 1996/01/17 00:33:09 duchier Exp $"
ptr_definition sys_bytedata
ptr_definition sys_bitvector
ptr_definition sys_regexp
ptr_definition sys_stream
ptr_definition sys_file_stream
ptr_definition sys_socket_stream
char * sys_errlist []
int sys_nerr
ptr_definition sys_process_no_children
ptr_definition sys_process_exited
ptr_definition sys_process_signaled
ptr_definition sys_process_stopped
ptr_definition sys_process_continued


Define Documentation

#define ARGNN   10

Referenced by call_primitive().

#define BV_AND   0

Definition at line 195 of file sys.c.

Referenced by bitvector_binop_code(), and c_bitvector_and().

#define BV_CLEAR   2

Definition at line 354 of file sys.c.

Referenced by bitvector_bit_code(), and c_bitvector_clear().

#define BV_COUNT   1

Definition at line 277 of file sys.c.

Referenced by bitvector_unop_code(), and c_bitvector_count().

#define BV_GET   0

Definition at line 352 of file sys.c.

Referenced by bitvector_bit_code(), and c_bitvector_get().

#define BV_NOT   0

Definition at line 276 of file sys.c.

Referenced by bitvector_unop_code(), and c_bitvector_not().

#define BV_OR   1

Definition at line 196 of file sys.c.

Referenced by bitvector_binop_code(), and c_bitvector_or().

#define BV_SET   1

Definition at line 353 of file sys.c.

Referenced by bitvector_bit_code(), and c_bitvector_set().

#define BV_XOR   2

Definition at line 197 of file sys.c.

Referenced by bitvector_binop_code(), and c_bitvector_xor().

#define BYTEDATA_DATA (  )     ((char*)((char*)X->value + sizeof(unsigned long)))

Definition at line 161 of file sys.c.

Referenced by accept_internal(), bind_or_connect_internal(), fclose_internal(), fflush_internal(), fileptr2stream(), fseek_internal(), ftell_internal(), fwrite_internal(), get_buffer_internal(), get_code_internal(), get_record_internal(), listen_internal(), and sys_stream2stream_internal().

#define BYTEDATA_SIZE (  )     (*(unsigned long *)(X->value))

Definition at line 160 of file sys.c.

#define FP_INPUT   1

Definition at line 593 of file sys.c.

Referenced by ftell_internal(), get_buffer_internal(), get_code_internal(), and get_record_internal().

#define FP_NONE   0

Definition at line 592 of file sys.c.

Referenced by fflush_internal(), fileptr2stream(), fseek_internal(), and ftell_internal().

#define FP_OUTPUT   2

Definition at line 594 of file sys.c.

Referenced by fwrite_internal().

#define FP_PREPARE ( s,
OP   ) 

Value:

if (s->op != OP && s->op != FP_NONE) fflush(s->fp); \
  s->op = OP;

Definition at line 601 of file sys.c.

Referenced by fwrite_internal(), get_buffer_internal(), get_code_internal(), and get_record_internal().

#define SEEK_CUR   1

Definition at line 977 of file sys.c.

#define SEEK_END   2

Definition at line 980 of file sys.c.

#define SEEK_SET   0

Definition at line 974 of file sys.c.

Referenced by fseek_internal().

#define SETFEATURE ( lst,
n,
nam,
val   )     ((lst[n].name=nam),(lst[n].value=val))

Definition at line 1379 of file sys.c.

Referenced by unify_wait_result().

#define TEXTBUFSIZE   5000

Definition at line 753 of file sys.c.

Referenced by text_buffer_push().


Typedef Documentation

typedef struct a_stream * ptr_stream


Function Documentation

static long accept_internal ( args  ,
  result,
  funct 
) [static]

(FILE**)BYTEDATA_DATA(args[0]));

Definition at line 1230 of file sys.c.

References BYTEDATA_DATA, Errorline(), FALSE, fileptr2stream(), NULL, push_goal(), TRUE, and unify.

Referenced by c_accept().

static long apply1_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1711 of file sys.c.

References wl_psi_term::attr_list, buffer, clear_copy(), distinct_copy(), Errorline(), eval, FALSE, featcmp(), function, get_numeric_feature(), heap_copy_string(), integer, push_goal(), quoted_string, REAL, residuate(), wl_definition::rule, stack_insert(), sub_type(), top, TRUE, wl_psi_term::type, and type.

Referenced by c_apply1().

static long bind_or_connect_internal ( args  ,
  result,
  funct,
void*  info 
) [static]

(FILE**)BYTEDATA_DATA(args[0]));

Definition at line 1121 of file sys.c.

References BYTEDATA_DATA, Errorline(), FALSE, is_ipaddr(), NULL, REAL, and TRUE.

Referenced by c_bind(), and c_connect().

static long bitvector_binop ( int  op  )  [static]

Definition at line 249 of file sys.c.

References bitvector_binop_internal(), call_primitive(), NARGS, REQUIRED, and SETARG.

Referenced by c_bitvector_and(), c_bitvector_or(), and c_bitvector_xor().

static long bitvector_binop_code ( unsigned long *  bv1,
unsigned long*  bv2,
ptr_psi_term  result,
int  op 
) [static]

Definition at line 200 of file sys.c.

References BV_AND, BV_OR, BV_XOR, c_abort(), make_bytedata(), NULL, push_goal(), TRUE, unify, and wl_psi_term::value.

Referenced by bitvector_binop_internal().

static long bitvector_binop_internal ( args  ,
  result,
  funct,
void*  op 
) [static]

Definition at line 239 of file sys.c.

References bitvector_binop_code().

Referenced by bitvector_binop().

static long bitvector_bit ( int  op  )  [static]

Definition at line 404 of file sys.c.

References bitvector_bit_internal(), call_primitive(), integer, NARGS, REQUIRED, and SETARG.

Referenced by c_bitvector_clear(), c_bitvector_get(), and c_bitvector_set().

static long bitvector_bit_code ( unsigned long *  bv1,
long  idx,
ptr_psi_term  result,
int  op,
ptr_psi_term  funct 
) [static]

Definition at line 357 of file sys.c.

References BV_CLEAR, BV_GET, BV_SET, Errorline(), FALSE, make_bytedata(), NULL, push_goal(), REAL, TRUE, unify, unify_real_result(), and wl_psi_term::value.

Referenced by bitvector_bit_internal().

static long bitvector_bit_internal ( args  ,
  result,
  funct,
void*  op 
) [static]

Definition at line 394 of file sys.c.

References bitvector_bit_code(), and REAL.

Referenced by bitvector_bit().

static long bitvector_unop ( int  op  )  [static]

Definition at line 332 of file sys.c.

References bitvector_unop_internal(), call_primitive(), NARGS, REQUIRED, and SETARG.

Referenced by c_bitvector_count(), and c_bitvector_not().

static long bitvector_unop_code ( unsigned long *  bv1,
ptr_psi_term  result,
int  op 
) [static]

Definition at line 280 of file sys.c.

References BV_COUNT, BV_NOT, c_abort(), make_bytedata(), NULL, push_goal(), REAL, TRUE, unify, unify_real_result(), and wl_psi_term::value.

Referenced by bitvector_unop_internal().

static long bitvector_unop_internal ( args  ,
  result,
  funct,
void*  op 
) [static]

Definition at line 323 of file sys.c.

References bitvector_unop_code().

Referenced by bitvector_unop().

static long c_accept (  )  [static]

Definition at line 1254 of file sys.c.

References accept_internal(), call_primitive(), NARGS, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_apply1 (  )  [static]

Definition at line 1739 of file sys.c.

References apply1_internal(), call_primitive(), NARGS, NOVALUE, REQUIRED, SETARG, and top.

Referenced by insert_sys_builtins().

static long c_bind (  )  [static]

Definition at line 1188 of file sys.c.

References bind_or_connect_internal(), call_primitive(), integer, MANDATORY, NARGS, NULL, OPTIONAL, quoted_string, and SETARG.

Referenced by insert_sys_builtins().

static long c_bitvector_and (  )  [static]

Definition at line 259 of file sys.c.

References bitvector_binop(), and BV_AND.

Referenced by insert_sys_builtins().

static long c_bitvector_clear (  )  [static]

Definition at line 426 of file sys.c.

References bitvector_bit(), and BV_CLEAR.

Referenced by insert_sys_builtins().

static long c_bitvector_count (  )  [static]

Definition at line 347 of file sys.c.

References bitvector_unop(), and BV_COUNT.

Referenced by insert_sys_builtins().

static long c_bitvector_get (  )  [static]

Definition at line 414 of file sys.c.

References bitvector_bit(), and BV_GET.

Referenced by insert_sys_builtins().

static long c_bitvector_not (  )  [static]

Definition at line 341 of file sys.c.

References bitvector_unop(), and BV_NOT.

Referenced by insert_sys_builtins().

static long c_bitvector_or (  )  [static]

Definition at line 265 of file sys.c.

References bitvector_binop(), and BV_OR.

Referenced by insert_sys_builtins().

static long c_bitvector_set (  )  [static]

Definition at line 420 of file sys.c.

References bitvector_bit(), and BV_SET.

Referenced by insert_sys_builtins().

static long c_bitvector_xor (  )  [static]

Definition at line 271 of file sys.c.

References bitvector_binop(), and BV_XOR.

Referenced by insert_sys_builtins().

static long c_call_once (  )  [static]

Definition at line 1703 of file sys.c.

References call_once_internal(), call_primitive(), MANDATORY, NARGS, NOVALUE, SETARG, top, and UNEVALED.

Referenced by insert_sys_builtins().

static long c_connect (  )  [static]

Definition at line 1199 of file sys.c.

References bind_or_connect_internal(), call_primitive(), integer, MANDATORY, NARGS, OPTIONAL, quoted_string, and SETARG.

Referenced by insert_sys_builtins().

static long c_cuserid (  )  [static]

Definition at line 1535 of file sys.c.

References call_primitive(), cuserid_internal(), and NULL.

Referenced by insert_sys_builtins().

static long c_errmsg (  )  [static]

Definition at line 1296 of file sys.c.

References call_primitive(), errmsg_internal(), integer, NARGS, OPTIONAL, and SETARG.

Referenced by insert_sys_builtins().

static long c_errno (  )  [static]

Definition at line 1273 of file sys.c.

References call_primitive(), errno_internal(), and NULL.

Referenced by insert_sys_builtins().

static long c_fclose (  )  [static]

Definition at line 677 of file sys.c.

References call_primitive(), fclose_internal(), NARGS, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_fflush (  )  [static]

Definition at line 719 of file sys.c.

References call_primitive(), fflush_internal(), MANDATORY, NARGS, and SETARG.

Referenced by insert_sys_builtins().

static long c_fopen (  )  [static]

Definition at line 658 of file sys.c.

References call_primitive(), fopen_internal(), NARGS, quoted_string, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_fork (  )  [static]

Definition at line 1369 of file sys.c.

References call_primitive(), fork_internal(), and NULL.

Referenced by insert_sys_builtins().

static long c_fseek (  )  [static]

Definition at line 997 of file sys.c.

References call_primitive(), fseek_internal(), integer, MANDATORY, NARGS, OPTIONAL, and SETARG.

Referenced by insert_sys_builtins().

static long c_ftell (  )  [static]

Definition at line 966 of file sys.c.

References call_primitive(), ftell_internal(), NARGS, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_fwrite (  )  [static]

Definition at line 699 of file sys.c.

References call_primitive(), fwrite_internal(), MANDATORY, NARGS, quoted_string, and SETARG.

Referenced by insert_sys_builtins().

static long c_get_buffer (  )  [static]

Definition at line 745 of file sys.c.

References call_primitive(), get_buffer_internal(), integer, NARGS, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_get_code (  )  [static]

Definition at line 945 of file sys.c.

References call_primitive(), get_code_internal(), NARGS, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_get_record (  )  [static]

Definition at line 925 of file sys.c.

References call_primitive(), get_record_internal(), NARGS, quoted_string, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_gethostname (  )  [static]

Definition at line 1557 of file sys.c.

References call_primitive(), gethostname_internal(), and NULL.

Referenced by insert_sys_builtins().

static long c_getpid (  )  [static]

Definition at line 1756 of file sys.c.

References call_primitive(), and getpid_internal().

Referenced by insert_sys_builtins().

static long c_import_symbol (  )  [static]

Definition at line 1348 of file sys.c.

References call_primitive(), import_symbol_internal(), MANDATORY, NARGS, NOVALUE, OPTIONAL, SETARG, top, and UNEVALED.

Referenced by insert_sys_builtins().

static long c_int2stream (  )  [static]

Definition at line 633 of file sys.c.

References call_primitive(), int2stream_internal(), integer, NARGS, quoted_string, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_kill (  )  [static]

Definition at line 1511 of file sys.c.

References call_primitive(), integer, kill_internal(), MANDATORY, NARGS, and SETARG.

Referenced by insert_sys_builtins().

static long c_lazy_project (  )  [static]

Definition at line 1593 of file sys.c.

References call_primitive(), lazy_project_internal(), NARGS, NOVALUE, REQUIRED, SETARG, and top.

Referenced by insert_sys_builtins().

static long c_listen (  )  [static]

Definition at line 1221 of file sys.c.

References call_primitive(), integer, listen_internal(), MANDATORY, NARGS, and SETARG.

Referenced by insert_sys_builtins().

static long c_make_bitvector (  )  [static]

Definition at line 188 of file sys.c.

References call_primitive(), integer, make_bitvector_internal(), NARGS, REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_my_wait_on_feature (  )  [static]

Definition at line 1669 of file sys.c.

References call_primitive(), MANDATORY, my_wait_on_feature_internal(), NARGS, NOVALUE, SETARG, top, and UNEVALED.

Referenced by insert_sys_builtins().

static long c_regexp_compile (  )  [static]

Definition at line 486 of file sys.c.

References call_primitive(), NARGS, quoted_string, regexp_compile_internal(), REQUIRED, and SETARG.

Referenced by insert_sys_builtins().

static long c_regexp_execute (  )  [static]

Definition at line 572 of file sys.c.

References call_primitive(), integer, NARGS, NOVALUE, OPTIONAL, quoted_string, regexp_execute_internal(), REQUIRED, SETARG, and top.

Referenced by insert_sys_builtins().

static long c_socket (  )  [static]

Definition at line 1101 of file sys.c.

References call_primitive(), NARGS, OPTIONAL, quoted_string, SETARG, and socket_internal().

Referenced by insert_sys_builtins().

static long c_stream2sys_stream (  )  [static]

Definition at line 1016 of file sys.c.

References call_primitive(), NARGS, REQUIRED, SETARG, stream, and stream2sys_stream_internal().

Referenced by insert_sys_builtins().

static long c_sys_stream2stream (  )  [static]

Definition at line 1036 of file sys.c.

References call_primitive(), NARGS, REQUIRED, SETARG, and sys_stream2stream_internal().

Referenced by insert_sys_builtins().

static long c_wait (  )  [static]

Definition at line 1478 of file sys.c.

References call_primitive(), NULL, and wait_internal().

Referenced by insert_sys_builtins().

static long c_wait_on_feature (  )  [static]

Definition at line 1631 of file sys.c.

References call_primitive(), MANDATORY, NARGS, NOVALUE, SETARG, top, UNEVALED, and wait_on_feature_internal().

Referenced by insert_sys_builtins().

static long c_waitpid (  )  [static]

Definition at line 1494 of file sys.c.

References call_primitive(), integer, NARGS, OPTIONAL, REQUIRED, SETARG, and waitpid_internal().

Referenced by insert_sys_builtins().

static long call_once_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1685 of file sys.c.

References choice_stack, DEFRULES, general_cut, NULL, prove, push_choice_point(), push_goal(), resid_aim, stack_psi_term(), TRUE, wl_psi_term::type, and unify.

Referenced by c_call_once().

long call_primitive ( long (*)()  fun,
int  num,
argi  ,
void*  info 
)

Definition at line 44 of file sys.c.

References wl_goal::a, aim, ARGNN, wl_psi_term::attr_list, wl_goal::b, c_abort(), curry(), wl_node::data, deref, deref_ptr, Errorline(), FALSE, featcmp(), find(), JUSTFAIL, MANDATORY, NOVALUE, NULL, overlap_type(), POLYTYPE, REQUIRED, residuate(), sub_type(), TRUE, psi_arg::type, wl_psi_term::type, type, UNEVALED, and wl_psi_term::value.

Referenced by bitvector_binop(), bitvector_bit(), bitvector_unop(), c_accept(), c_apply1(), c_bind(), c_call_once(), c_connect(), c_cuserid(), c_dbmdelete(), c_dbmfetch(), c_dbmfirstkey(), c_dbminit(), c_dbmnextkey(), c_dbmstore(), c_errmsg(), c_errno(), c_fclose(), c_fflush(), c_fopen(), c_fork(), c_fseek(), c_ftell(), c_fwrite(), c_get_buffer(), c_get_code(), c_get_record(), c_gethostname(), c_getpid(), c_import_symbol(), c_int2stream(), c_kill(), c_lazy_project(), c_listen(), c_make_bitvector(), c_my_wait_on_feature(), c_regexp_compile(), c_regexp_execute(), c_socket(), c_stream2sys_stream(), c_sys_stream2stream(), c_wait(), c_wait_on_feature(), and c_waitpid().

void check_sys_definitions (  ) 

Definition at line 1788 of file sys.c.

References check_definition().

Referenced by check().

static long cuserid_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1523 of file sys.c.

References FALSE, name, NULL, push_goal(), stack_string(), TRUE, and unify.

Referenced by c_cuserid().

static long errmsg_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1284 of file sys.c.

References FALSE, NULL, push_goal(), REAL, stack_string(), sys_errlist, sys_nerr, TRUE, and unify.

Referenced by c_errmsg().

static long errno_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1265 of file sys.c.

References NULL, push_goal(), stack_int(), TRUE, and unify.

Referenced by c_errno().

static long fclose_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 667 of file sys.c.

References BYTEDATA_DATA, FALSE, and TRUE.

Referenced by c_fclose().

static long fflush_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 708 of file sys.c.

References BYTEDATA_DATA, FALSE, a_stream::fp, FP_NONE, a_stream::op, and TRUE.

Referenced by c_fflush().

ptr_psi_term fileptr2stream ( FILE*  fp,
ptr_definition typ 
)

Definition at line 606 of file sys.c.

References BYTEDATA_DATA, FP_NONE, and make_bytedata().

Referenced by accept_internal(), fopen_internal(), int2stream_internal(), socket_internal(), and stream2sys_stream_internal().

static long fopen_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 642 of file sys.c.

References FALSE, fileptr2stream(), NULL, push_goal(), TRUE, and unify.

Referenced by c_fopen().

static long fork_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1360 of file sys.c.

References FALSE, REAL, and unify_real_result().

Referenced by c_fork().

static long fseek_internal ( args  ,
  result,
  funct 
) [static]

(FILE**)BYTEDATA_DATA(args[0])

Definition at line 984 of file sys.c.

References BYTEDATA_DATA, FALSE, a_stream::fp, FP_NONE, a_stream::op, REAL, SEEK_SET, and TRUE.

Referenced by c_fseek().

static long ftell_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 953 of file sys.c.

References BYTEDATA_DATA, a_stream::fp, FP_INPUT, FP_NONE, a_stream::op, REAL, and unify_real_result().

Referenced by c_ftell().

static long fwrite_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 685 of file sys.c.

References BYTEDATA_DATA, FALSE, a_stream::fp, FP_OUTPUT, FP_PREPARE, and TRUE.

Referenced by c_fwrite().

static long get_buffer_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 727 of file sys.c.

References BYTEDATA_DATA, FALSE, a_stream::fp, FP_INPUT, FP_PREPARE, heap_alloc(), NULL, push_goal(), quoted_string, REAL, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value.

Referenced by c_get_buffer().

static long get_code_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 934 of file sys.c.

References BYTEDATA_DATA, FALSE, a_stream::fp, FP_INPUT, FP_PREPARE, REAL, and unify_real_result().

Referenced by c_get_code().

char* get_numeric_feature ( long  n  ) 

Definition at line 1403 of file sys.c.

References buf, heap_copy_string(), one, three, and two.

Referenced by apply1_internal().

static long get_record_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 849 of file sys.c.

References BYTEDATA_DATA, text_buffer::data, a_stream::fp, FP_INPUT, FP_PREPARE, heap_alloc(), text_buffer::next, NULL, push_goal(), quoted_string, stack_psi_term(), text_buffer_cmp(), text_buffer_free(), text_buffer_next(), text_buffer_push(), text_buffer::top, TRUE, wl_psi_term::type, unify, and wl_psi_term::value.

Referenced by c_get_record().

static long gethostname_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1545 of file sys.c.

References FALSE, name, NULL, push_goal(), stack_string(), TRUE, and unify.

Referenced by c_gethostname().

static long getpid_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1749 of file sys.c.

References REAL, and unify_real_result().

Referenced by c_getpid().

static long import_symbol_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1312 of file sys.c.

References wl_keyword::combined_name, current_module, wl_keyword::definition, Errorline(), FALSE, hash_insert(), hash_lookup(), HEAP_ALLOC, heap_copy_string(), make_module_token(), wl_keyword::module, wl_keyword::private_feature, wl_keyword::public, wl_keyword::symbol, wl_module::symbol_table, TRUE, wl_definition::type, and undef.

Referenced by c_import_symbol().

void insert_sys_builtins (  ) 

Definition at line 1816 of file sys.c.

References bi_module, c_accept(), c_apply1(), c_bind(), c_bitvector_and(), c_bitvector_clear(), c_bitvector_count(), c_bitvector_get(), c_bitvector_not(), c_bitvector_or(), c_bitvector_set(), c_bitvector_xor(), c_call_once(), c_connect(), c_cuserid(), c_errmsg(), c_errno(), c_fclose(), c_fflush(), c_fopen(), c_fork(), c_fseek(), c_ftell(), c_fwrite(), c_get_buffer(), c_get_code(), c_get_record(), c_gethostname(), c_getpid(), c_import_symbol(), c_int2stream(), c_kill(), c_lazy_project(), c_listen(), c_make_bitvector(), c_my_wait_on_feature(), c_regexp_compile(), c_regexp_execute(), c_socket(), c_stream2sys_stream(), c_sys_stream2stream(), c_wait(), c_wait_on_feature(), c_waitpid(), current_module, function, insert_dbm_builtins(), new_built_in(), predicate, set_current_module(), sys_module, and update_symbol().

Referenced by init_built_in_types().

static long int2stream_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 617 of file sys.c.

References FALSE, fileptr2stream(), NULL, push_goal(), REAL, TRUE, and unify.

Referenced by c_int2stream().

int is_ipaddr ( char*  s  ) 

Definition at line 1110 of file sys.c.

References NULL.

Referenced by bind_or_connect_internal().

static long kill_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1503 of file sys.c.

References FALSE, REAL, and TRUE.

Referenced by c_kill().

static long lazy_project_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1566 of file sys.c.

References buffer, wl_node::data, featcmp(), find(), integer, NULL, push_goal(), quoted_string, REAL, residuate(), sub_type(), top, TRUE, type, and unify.

Referenced by c_lazy_project().

static long listen_internal ( args  ,
  result,
  funct 
) [static]

(FILE**)BYTEDATA_DATA(args[0]));

Definition at line 1210 of file sys.c.

References BYTEDATA_DATA, FALSE, REAL, and TRUE.

Referenced by c_listen().

static long make_bitvector_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 171 of file sys.c.

References Errorline(), FALSE, make_bytedata(), NULL, push_goal(), REAL, TRUE, and unify.

Referenced by c_make_bitvector().

static ptr_psi_term make_bytedata ( ptr_definition  sort,
unsigned long  bytes 
) [static]

Definition at line 146 of file sys.c.

References heap_alloc(), stack_psi_term(), wl_psi_term::type, and wl_psi_term::value.

Referenced by bitvector_binop_code(), bitvector_bit_code(), bitvector_unop_code(), fileptr2stream(), make_bitvector_internal(), and regexp_compile_internal().

void make_sys_type_links (  ) 

Definition at line 1770 of file sys.c.

References built_in, and make_type_link().

Referenced by encode_types().

static long my_wait_on_feature_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1641 of file sys.c.

References buffer, DEFRULES, featcmp(), find(), integer, NULL, prove, push_goal(), quoted_string, REAL, residuate(), sub_type(), top, TRUE, type, and unify_bool_result().

Referenced by c_my_wait_on_feature().

void regerror ( char*  s  ) 

Definition at line 437 of file sys.c.

static long regexp_compile_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 449 of file sys.c.

References c_abort(), Errorline(), last_regsize(), make_bytedata(), NULL, push_goal(), try::re, regcomp(), regexp::regmust, TRUE, unify, and wl_psi_term::value.

Referenced by c_regexp_compile().

static long regexp_execute_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 503 of file sys.c.

References wl_psi_term::attr_list, buffer, c_abort(), wl_node::data, regexp::endp, Errorline(), FALSE, featcmp(), find(), NSUBEXP, NULL, push_goal(), try::re, REAL, regexec(), regexp::regmust, stack_insert_copystr(), stack_int(), stack_pair(), stack_psi_term(), regexp::startp, top, TRUE, wl_psi_term::type, unify, and unify_bool_result().

Referenced by c_regexp_execute().

static long socket_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1054 of file sys.c.

References Errorline(), FALSE, fileptr2stream(), NULL, push_goal(), TRUE, type, and unify.

Referenced by c_socket().

static long stream2sys_stream_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1007 of file sys.c.

References fileptr2stream(), NULL, push_goal(), TRUE, and unify.

Referenced by c_stream2sys_stream().

static long sys_stream2stream_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1024 of file sys.c.

References BYTEDATA_DATA, NULL, push_goal(), stack_psi_term(), stream, TRUE, wl_psi_term::type, unify, and wl_psi_term::value.

Referenced by c_sys_stream2stream().

char* text_buffer_cmp ( struct text_buffer buf,
int  idx,
char *  str 
)

Definition at line 790 of file sys.c.

References top.

Referenced by get_record_internal().

void text_buffer_free ( struct text_buffer buf  ) 

Definition at line 837 of file sys.c.

References text_buffer::next.

Referenced by get_record_internal().

int text_buffer_next ( struct text_buffer buf,
int  idx,
char  c,
struct text_buffer**  rbuf,
int*  ridx 
)

Definition at line 766 of file sys.c.

References top.

Referenced by get_record_internal().

void text_buffer_push ( struct text_buffer **  buf,
char  c 
)

Definition at line 815 of file sys.c.

References TEXTBUFSIZE.

Referenced by get_record_internal().

static long unify_pterm_result ( ptr_psi_term  t,
ptr_definition  sym,
lst  ,
int  n 
) [static]

Definition at line 1382 of file sys.c.

References wl_psi_term::attr_list, featcmp(), name, NULL, push_goal(), stack_insert(), stack_psi_term(), TRUE, wl_psi_term::type, unify, and psi_feature::value.

Referenced by unify_wait_result().

static long unify_wait_result ( ptr_psi_term  result,
pid_t  id,
int  status 
) [static]

Definition at line 1427 of file sys.c.

References Errorline(), FALSE, one, SETFEATURE, stack_int(), two, and unify_pterm_result().

Referenced by wait_internal(), and waitpid_internal().

static long wait_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1469 of file sys.c.

References status, and unify_wait_result().

Referenced by c_wait().

static long wait_on_feature_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1605 of file sys.c.

References buffer, DEFRULES, featcmp(), find(), integer, NULL, prove, push_goal(), quoted_string, REAL, residuate(), sub_type(), top, TRUE, and type.

Referenced by c_wait_on_feature().

static long waitpid_internal ( args  ,
  result,
  funct 
) [static]

Definition at line 1484 of file sys.c.

References REAL, status, and unify_wait_result().

Referenced by c_waitpid().


Variable Documentation

ptr_definition sys_bitvector

Definition at line 37 of file sys.c.

ptr_definition sys_bytedata

Definition at line 36 of file sys.c.

Referenced by check_psi_term(), check_resid(), match_aim(), and pretty_psi_term().

char* sys_errlist[]

Referenced by errmsg_internal().

ptr_definition sys_file_stream

Definition at line 40 of file sys.c.

int sys_nerr

Referenced by errmsg_internal().

ptr_definition sys_process_continued

Definition at line 1424 of file sys.c.

ptr_definition sys_process_exited

Definition at line 1421 of file sys.c.

ptr_definition sys_process_no_children

Definition at line 1420 of file sys.c.

ptr_definition sys_process_signaled

Definition at line 1422 of file sys.c.

ptr_definition sys_process_stopped

Definition at line 1423 of file sys.c.

ptr_definition sys_regexp

Definition at line 38 of file sys.c.

ptr_definition sys_socket_stream

Definition at line 41 of file sys.c.

ptr_definition sys_stream

Definition at line 39 of file sys.c.

char vcid[] = "$Id: sys.c,v 1.9 1996/01/17 00:33:09 duchier Exp $" [static]

Definition at line 11 of file sys.c.


Generated on Sat Jan 26 08:48:09 2008 for WildLife by  doxygen 1.5.4