fix C major issues

- use delays to implement setup_call
- fix user_* flag
- error handling i CXX should b local
- fix mess on  how to call openQuert
- deter pt -> from a pointer to another one
- avoid text forms when you can use C: LOCLS to locals.h
- fux seto_call
- new gated call
- mem streams
This commit is contained in:
Vitor Santos Costa
2017-08-21 12:29:58 +01:00
parent f8f1d75ad6
commit 54234c7e1d
37 changed files with 1233 additions and 2579 deletions

View File

@@ -10,8 +10,6 @@
static char SccsId[] = "%W% %G%";
#endif
#ifndef YAPSTREAMS_H
#define YAPSTREAMS_H 1
@@ -22,7 +20,6 @@ static char SccsId[] = "%W% %G%";
#include <sys/socket.h>
#endif
#define YAP_ERROR NIL
#define MaxStreams 64
@@ -42,7 +39,6 @@ static char SccsId[] = "%W% %G%";
#define HAVE_SOCKET 1
#endif
//#include "Atoms.h"
//#include "Yap.h"
#include <stdlib.h>
@@ -60,7 +56,6 @@ static char SccsId[] = "%W% %G%";
#include <wchar.h>
/************ SWI compatible support for unicode representations ************/
typedef struct yap_io_position {
int64_t byteno; /* byte-position in file */
@@ -72,7 +67,7 @@ typedef struct yap_io_position {
#ifndef _PL_STREAM_H
typedef struct {
YAP_Atom file; /* current source file */
YAP_Atom file; /* current source file */
yapIOPOS position; /* Line, line pos, char and byte */
} yapSourceLocation;
#endif
@@ -99,12 +94,12 @@ typedef struct read_data_t {
int magic; /* RD_MAGIC */
struct stream_desc *stream;
FILE *f; /* file. of known */
FILE *f; /* file. of known */
YAP_Term position; /* Line, line pos, char and byte */
void *posp; /* position pointer */
size_t posi; /* position number */
void *posp; /* position pointer */
size_t posi; /* position number */
YAP_Term subtpos; /* Report Subterm positions */
YAP_Term subtpos; /* Report Subterm positions */
bool cycles; /* Re-establish cycles */
yapSourceLocation start_of_term; /* Position of start of term */
struct mod_entry *module; /* Current source module */
@@ -114,14 +109,14 @@ typedef struct read_data_t {
int *char_conversion_table; /* active conversion table */
YAP_Atom on_error; /* Handling of syntax errors */
YAP_Atom on_error; /* Handling of syntax errors */
int has_exception; /* exception is raised */
YAP_Term exception; /* raised exception */
YAP_Term variables; /* report variables */
YAP_Term singles; /* Report singleton variables */
YAP_Term varnames; /* Report variables+names */
int strictness; /* Strictness level */
int strictness; /* Strictness level */
#ifdef O_QUASIQUOTATIONS
YAP_Term quasi_quotations; /* User option quasi_quotations(QQ) */
@@ -133,8 +128,7 @@ typedef struct read_data_t {
} read_data, *ReadData;
#if __APPLE__
#if __APPLE__ && !PY4YAP_H
#include "fmemopen.h"
#define HAVE_FMEMOPEN 1
#define HAVE_OPEN_MEMSTREAM 1
@@ -162,8 +156,8 @@ FILE *open_memstream(char **buf, size_t *len);
#endif
typedef struct mem_desc {
char *buf; /* where the file is being read from/written to */
int src; /* where the space comes from, 0 code space, 1 malloc */
char *buf; /* where the file is being read from/written to */
int src; /* where the space comes from, 0 code space, 1 malloc */
YAP_Int max_size; /* maximum buffer size (may be changed dynamically) */
YAP_UInt pos; /* cursor */
volatile void *error_handler;
@@ -171,16 +165,16 @@ typedef struct mem_desc {
#if HAVE_SOCKET
typedef enum { /* in YAP, sockets may be in one of 4 possible status */
new_socket,
server_socket,
client_socket,
server_session_socket,
closed_socket
new_socket,
server_socket,
client_socket,
server_session_socket,
closed_socket
} socket_info;
typedef enum { /* we accept two domains for the moment, IPV6 may follow */
af_inet, /* IPV4 */
af_unix /* or AF_FILE */
af_inet, /* IPV4 */
af_unix /* or AF_FILE */
} socket_domain;
#endif
@@ -229,7 +223,7 @@ typedef struct stream_desc {
struct {
const unsigned char *buf, *ptr;
} irl;
void *private_data;
void *private_data;
} u;
YAP_Int charcount, linecount, linepos;
@@ -247,42 +241,9 @@ void *private_data;
struct vfs *vfs; /** stream belongs to a space */
void *vfs_handle; /** direct handle to stream in that space. */
int (*stream_wgetc_for_read)(
int); /* function the stream uses for parser. It may be different
from above if the ISO character conversion is on */
int); /* function the stream uses for parser. It may be different
from above if the ISO character conversion is on */
encoding_t encoding; /** current encoding for stream */
} StreamDesc;
#endif