Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
io.h
Go to the documentation of this file.
1
2/*
3 * io.h
4 *
5 * Communication between PSSE and the outside world, via libcurl.
6 *
7 * (c) 2019 Simon Brooke <simon@journeyman.cc>
8 * Licensed under GPL version 2.0, or, at your option, any later version.
9 */
10
11#ifndef __psse_io_h
12#define __psse_io_h
13#include <curl/curl.h>
15
16extern CURLSH *io_share;
17
18int io_init( );
19
20#define C_IO_IN L"*in*"
21#define C_IO_OUT L"*out*"
22
23extern struct cons_pointer lisp_io_in;
24extern struct cons_pointer lisp_io_out;
25
26URL_FILE *file_to_url_file( FILE * f );
27wint_t url_fgetwc( URL_FILE * input );
28wint_t url_ungetwc( wint_t wc, URL_FILE * input );
29
30struct cons_pointer get_default_stream( bool inputp, struct cons_pointer env );
31
32struct cons_pointer
33lisp_close( struct stack_frame *frame, struct cons_pointer frame_pointer,
34 struct cons_pointer env );
35struct cons_pointer
36lisp_open( struct stack_frame *frame, struct cons_pointer frame_pointer,
37 struct cons_pointer env );
38struct cons_pointer
39lisp_read_char( struct stack_frame *frame, struct cons_pointer frame_pointer,
40 struct cons_pointer env );
41struct cons_pointer
42lisp_slurp( struct stack_frame *frame, struct cons_pointer frame_pointer,
43 struct cons_pointer env );
44
46#endif
An indirect pointer to a cons cell.
A stack frame.
int io_init()
Initialise the I/O subsystem.
Definition io.c:69
wint_t url_ungetwc(wint_t wc, URL_FILE *input)
Definition io.c:220
struct cons_pointer lisp_io_in
bound to the Lisp string representing C_IO_IN in initialisation.
Definition io.c:51
wint_t url_fgetwc(URL_FILE *input)
get one wide character from the buffer.
Definition io.c:151
struct cons_pointer lisp_open(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: return a stream open on the URL indicated by the first argument; if a second argument is pr...
Definition io.c:437
struct cons_pointer lisp_io_out
bound to the Lisp string representing C_IO_OUT in initialisation.
Definition io.c:55
struct cons_pointer lisp_slurp(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: return a string representing all characters from the stream indicated by arg 0; further arg...
Definition io.c:533
char * lisp_string_to_c_string(struct cons_pointer s)
Convert this lisp string-like-thing (also works for symbols, and, later keywords) into a UTF-8 string...
Definition io.c:95
URL_FILE * file_to_url_file(FILE *f)
given this file handle f, return a new url_file handle wrapping it.
Definition io.c:134
struct cons_pointer get_default_stream(bool inputp, struct cons_pointer env)
Resutn the current default input, or of inputp is false, output stream from this environment.
Definition io.c:411
struct cons_pointer lisp_close(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function, sort-of: close the file indicated by my first arg, and return nil.
Definition io.c:254
CURLSH * io_share
The sharing hub for all connections.
Definition io.c:46
struct cons_pointer lisp_read_char(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: return the next character from the stream indicated by arg 0; further arguments are ignored...
Definition io.c:504