Scheme_Object * scheme_read(Scheme_Object *port)
Reads the next S-expression from the given input port.
void scheme_write(Scheme_Object *obj, Scheme_Object *port)
writes the Scheme value obj to the given output port.
void scheme_write_w_max(Scheme_Object *obj, Scheme_Object *port, int n)
Like scheme_write, but the printing is truncated to n characters. (If printing is truncated, the last three characters are printed as ``.''.)
void scheme_display(Scheme_Object *obj, Scheme_Object *port)
displays the Scheme value obj to the given output port.
void scheme_display_w_max(Scheme_Object *obj, Scheme_Object *port, int n)
Like scheme_display, but the printing is truncated to n characters. (If printing is truncated, the last three characters are printed as ``.''.)
void scheme_write_string(char *str, long len, Scheme_Object *port)
displays the string str to the given output port.
char * scheme_write_to_string(Scheme_Object *obj, long *len)
writes the Scheme value obj to a newly allocated string. If len is not NULL, *len is set to the length of the string.
void scheme_write_to_string_w_max(Scheme_Object *obj, long *len, int n)
Like scheme_write_to_string, but the string is truncated to n characters. (If the string is truncated, the last three characters are ``.''.)
char * scheme_display_to_string(Scheme_Object *obj, long *len)
displays the Scheme value obj to a newly allocated string. If len is not NULL, *len is set to the length of the string.
void scheme_display_to_string_w_max(Scheme_Object *obj, long *len, int n)
Like scheme_display_to_string, but the string is truncated to n characters. (If the string is truncated, the last three characters are ``.''.)
void scheme_debug_print(Scheme_Object *obj)
writes the Scheme value obj to the main thread's output port.
void scheme_flush_output(Scheme_Object *port)
If port is a file port, a buffered data is written to the file. Otherwise, there is no effect. port must be an output port.
int scheme_getc(Scheme_Object *port)
Get the next character from the given input port.
void scheme_ungetc(int ch, Scheme_Object *port)
Puts the character ch back as the next character to be read from the given input port. The character need not have been read from port, and scheme_ungetc can be called to insert any number of characters at the start of port.
int scheme_char_ready(Scheme_Object *port)
Returns 1 if a call to scheme_getc is guranteed not to block for the given input port.
void scheme_need_wakeup(Scheme_Object *port, void *fds)
Requests that appropriate bits are set in fds to specify which file descriptors(s) the given input port reads from. (fds is a pointer to an fd_set struct.)
long scheme_tell(Scheme_Object *port)
Returns the current read position of the given input port.
long scheme_tell_line(Scheme_Object *port)
Returns the current read line of the given input port.
void scheme_close_input_port(Scheme_Object *port)
Closes the given input port.
void scheme_close_output_port(Scheme_Object *port)
Closes the given output port.
Scheme_Object * scheme_make_port_type(char *name)
Creates a new port subtype.
Scheme_Input_Port * scheme_make_input_port( Scheme_Object *subtype,
void *data,
int (*getc_fun)(Scheme_Input_Port*),
int (*char_ready_fun)(Scheme_Input_Port*),
void (*close_fun)(Scheme_Input_Port*),
void (*need_wakeup_fun)(Scheme_Input_Port*, void *))
Creates a new input port with arbitary control functions. The pointer data will be installed as the port's user data, which can be extracted/set with the SCHEME_INPORT_VAL macro. The C value EOF should be used when getc_fun needs to return an end-of-file.
The function need_wakeup_fun will be invoked when the port is blocked on a read; need_wakeup_fun should set appropriate bits in fds to specify which file decriptior(s) it is blocked on (the input parameter is a pointer to an fd_set struct).
Although the return type of scheme_make_input_port is Scheme_Input_Port *, it can be cast into a Scheme_Object *.
Scheme_Output_Port * scheme_make_output_port( Scheme_Object *subtype,
void *data,
void (*write_string_fun)(char *, long, Scheme_Output_Port*),
void (*close_fun)(Scheme_Output_Port*))
Creates a new output port with arbitary control functions. The pointer data will be installed as the port's user data, which can be extracted/set with the SCHEME_OUTPORT_VAL macro. When write_string_fun is called, the second parameter is the length of the string to be written.
Although the return type of scheme_make_input_port is Scheme_Output_Port *, it can be cast into a Scheme_Object *.
Scheme_Object * scheme_make_file_input_port(FILE *fp)
Creates a Scheme input file port from an ANSI C file pointer.
Scheme_Object * scheme_make_named_file_input_port(FILE *fp, char *filename)
Creates a Scheme input file port from an ANSI C file pointer. The filename may be used for error reporting.
Scheme_Object * scheme_make_file_output_port(FILE *fp)
Creates a Scheme output file port from an ANSI C file pointer.
Scheme_Object * scheme_make_string_input_port(char *str)
Creates a Scheme input port from a string; successive read-chars on the port will return successive characters in the string.
Scheme_Object * scheme_make_string_output_port()
Creates a Scheme output port; all writes to the port are kept in a string, which can be obtained with scheme_get_string_output.
char * scheme_get_string_output(Scheme_Object *port)
Returns (in a newly allocated string) all data that has been written to the given string output port so far. (The returned string will be null-terminated.)
char * scheme_get_sized_string_output(Scheme_Object *port, int *len)
Returns (in a newly allocated string) all data that has been written to the given string output port so far and fills in *len with the length of the string.
void scheme_pipe(Scheme_Object **write, Scheme_Object **read)
Creates a pair of ports, setting *write and *read; data written to *write can be read back out of *read.
int scheme_file_exists(char *name)
Returns TRUE if a file by the given name exists, FALSE otherwise. If name specifies a directory, FALSE is returned.
int scheme_directory_exists(char *name)
Returns TRUE if a directory by the given name exists, FALSE otherwise.
char * scheme_expand_filename(char *name, int len, char *where, int *expanded)
Expands the pathname name. Under Unix, this expands `` '' into a user's home directory. On the Macintosh, aliases are resolved to real pathnames. The len argument is the length of the input string; if it is -1, the string is assumed to be null-terminated. The where argument is used if there is an error in the filename; if this is NULL, and error is not reported and NULL is returned instead. If expanded is not NULL, *expanded is set to 1 if some expansion takes place, or 0 if the input name is simply returned.