Tactical commit whilst converting to URL_FILE

This commit is contained in:
Simon Brooke 2019-01-24 18:59:01 +00:00
parent f8c20ab3b1
commit a355a28ffa
23 changed files with 700 additions and 88 deletions

View file

@ -115,7 +115,7 @@ void make_cons_page( ) {
/**
* dump the allocated pages to this `output` stream.
*/
void dump_pages( FILE * output ) {
void dump_pages( URL_FILE * output ) {
for ( int i = 0; i < initialised_cons_pages; i++ ) {
fwprintf( output, L"\nDUMPING PAGE %d\n", i );

View file

@ -47,6 +47,6 @@ struct cons_pointer allocate_cell( char *tag );
void initialise_cons_pages( );
void dump_pages( FILE * output );
void dump_pages( URL_FILE * output );
#endif

View file

@ -95,8 +95,6 @@ struct cons_pointer make_exception( struct cons_pointer message,
struct cons_pointer pointer = allocate_cell( EXCEPTIONTAG );
struct cons_space_object *cell = &pointer2cell( pointer );
// inc_ref( pointer ); /* this is a hack; I don't know why it's necessary to do this, but if I don't the cell gets freed */
inc_ref( message );
inc_ref( frame_pointer );
cell->payload.exception.message = message;
@ -235,7 +233,7 @@ make_special( struct cons_pointer src, struct cons_pointer ( *executable )
* Construct a cell which points to a stream open for reading.
* @param input the C stream to wrap.
*/
struct cons_pointer make_read_stream( FILE * input ) {
struct cons_pointer make_read_stream( URL_FILE * input ) {
struct cons_pointer pointer = allocate_cell( READTAG );
struct cons_space_object *cell = &pointer2cell( pointer );
@ -248,7 +246,7 @@ struct cons_pointer make_read_stream( FILE * input ) {
* Construct a cell which points to a stream open for writing.
* @param output the C stream to wrap.
*/
struct cons_pointer make_write_stream( FILE * output ) {
struct cons_pointer make_write_stream( URL_FILE * output ) {
struct cons_pointer pointer = allocate_cell( WRITETAG );
struct cons_space_object *cell = &pointer2cell( pointer );

View file

@ -16,6 +16,9 @@
*/
#include <wchar.h>
#include <wctype.h>
#include <curl/curl.h>
#include "fopen.h"
#ifndef __consspaceobject_h
#define __consspaceobject_h
@ -488,7 +491,7 @@ struct special_payload {
*/
struct stream_payload {
/** the stream to read from or write to. */
FILE *stream;
URL_FILE *stream;
};
/**
@ -636,9 +639,9 @@ struct cons_pointer make_string( wint_t c, struct cons_pointer tail );
struct cons_pointer make_symbol( wint_t c, struct cons_pointer tail );
struct cons_pointer make_read_stream( FILE * input );
struct cons_pointer make_read_stream( URL_FILE * input );
struct cons_pointer make_write_stream( FILE * output );
struct cons_pointer make_write_stream( URL_FILE * output );
struct cons_pointer c_string_to_lisp_string( wchar_t *string );

View file

@ -26,7 +26,7 @@
#include "vectorspace.h"
void dump_string_cell( FILE * output, wchar_t *prefix,
void dump_string_cell( URL_FILE * output, wchar_t *prefix,
struct cons_pointer pointer ) {
struct cons_space_object cell = pointer2cell( pointer );
if ( cell.payload.string.character == 0 ) {
@ -52,7 +52,7 @@ void dump_string_cell( FILE * output, wchar_t *prefix,
/**
* dump the object at this cons_pointer to this output stream.
*/
void dump_object( FILE * output, struct cons_pointer pointer ) {
void dump_object( URL_FILE * output, struct cons_pointer pointer ) {
struct cons_space_object cell = pointer2cell( pointer );
fwprintf( output,
L"\t%4.4s (%d) at page %d, offset %d count %u\n",
@ -89,7 +89,7 @@ void dump_object( FILE * output, struct cons_pointer pointer ) {
}
break;
case LAMBDATV:
fwprintf( output, L"\t\tLambda cell;\n\t\t args: " );
fwprintf( output, L"\t\t\u03bb cell;\n\t\t args: " );
print( output, cell.payload.lambda.args );
fwprintf( output, L";\n\t\t\tbody: " );
print( output, cell.payload.lambda.body );
@ -98,7 +98,7 @@ void dump_object( FILE * output, struct cons_pointer pointer ) {
case NILTV:
break;
case NLAMBDATV:
fwprintf( output, L"\t\tNlambda cell; \n\t\targs: " );
fwprintf( output, L"\t\tn\u03bb cell; \n\t\targs: " );
print( output, cell.payload.lambda.args );
fwprintf( output, L";\n\t\t\tbody: " );
print( output, cell.payload.lambda.body );

View file

@ -20,6 +20,6 @@
#define __dump_h
void dump_object( FILE * output, struct cons_pointer pointer );
void dump_object( URL_FILE * output, struct cons_pointer pointer );
#endif

View file

@ -241,7 +241,7 @@ void free_stack_frame( struct stack_frame *frame ) {
* @param output the stream
* @param frame_pointer the pointer to the frame
*/
void dump_frame( FILE * output, struct cons_pointer frame_pointer ) {
void dump_frame( URL_FILE * output, struct cons_pointer frame_pointer ) {
struct stack_frame *frame = get_stack_frame( frame_pointer );
if ( frame != NULL ) {
@ -265,7 +265,7 @@ void dump_frame( FILE * output, struct cons_pointer frame_pointer ) {
}
}
void dump_stack_trace( FILE * output, struct cons_pointer pointer ) {
void dump_stack_trace( URL_FILE * output, struct cons_pointer pointer ) {
if ( exceptionp( pointer ) ) {
print( output, pointer2cell( pointer ).payload.exception.message );
fputws( L"\n", output );

View file

@ -47,9 +47,9 @@ struct cons_pointer make_stack_frame( struct cons_pointer previous,
void free_stack_frame( struct stack_frame *frame );
void dump_frame( FILE * output, struct cons_pointer pointer );
void dump_frame( URL_FILE * output, struct cons_pointer pointer );
void dump_stack_trace( FILE * output, struct cons_pointer frame_pointer );
void dump_stack_trace( URL_FILE * output, struct cons_pointer frame_pointer );
struct cons_pointer fetch_arg( struct stack_frame *frame, unsigned int n );