2014-01-17 06:58:31 -05:00
|
|
|
/**
|
|
|
|
* See Copyright Notice in picrin.h
|
|
|
|
*/
|
|
|
|
|
2014-01-23 02:47:13 -05:00
|
|
|
#ifndef PICRIN_PORT_H__
|
|
|
|
#define PICRIN_PORT_H__
|
2013-10-17 09:42:47 -04:00
|
|
|
|
2014-01-17 22:41:39 -05:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-01-16 07:00:55 -05:00
|
|
|
enum pic_port_flag {
|
|
|
|
PIC_PORT_IN = 1,
|
|
|
|
PIC_PORT_OUT = 2,
|
|
|
|
PIC_PORT_TEXT = 4,
|
|
|
|
PIC_PORT_BINARY = 8,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum pic_port_status {
|
|
|
|
PIC_PORT_OPEN,
|
|
|
|
PIC_PORT_CLOSE,
|
|
|
|
};
|
|
|
|
|
2013-10-17 09:42:47 -04:00
|
|
|
struct pic_port {
|
|
|
|
PIC_OBJECT_HEADER
|
2014-02-25 07:07:32 -05:00
|
|
|
xFILE *file;
|
2014-01-16 04:24:25 -05:00
|
|
|
int flags;
|
|
|
|
int status;
|
2013-10-17 09:42:47 -04:00
|
|
|
};
|
|
|
|
|
2013-10-24 09:56:04 -04:00
|
|
|
#define pic_port_p(v) (pic_type(v) == PIC_TT_PORT)
|
2013-11-05 00:27:59 -05:00
|
|
|
#define pic_port_ptr(v) ((struct pic_port *)pic_ptr(v))
|
2013-10-17 09:42:47 -04:00
|
|
|
|
2014-01-12 10:49:25 -05:00
|
|
|
pic_value pic_eof_object();
|
|
|
|
|
2014-01-12 10:51:19 -05:00
|
|
|
struct pic_port *pic_stdin(pic_state *);
|
|
|
|
struct pic_port *pic_stdout(pic_state *);
|
|
|
|
struct pic_port *pic_stderr(pic_state *);
|
|
|
|
|
2014-06-25 02:39:40 -04:00
|
|
|
struct pic_port *pic_open_input_string(pic_state *, const char *);
|
2014-02-10 23:45:41 -05:00
|
|
|
struct pic_port *pic_open_output_string(pic_state *);
|
|
|
|
struct pic_string *pic_get_output_string(pic_state *, struct pic_port *);
|
|
|
|
|
|
|
|
void pic_close_port(pic_state *pic, struct pic_port *);
|
|
|
|
|
2014-01-17 22:41:39 -05:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-10-17 09:42:47 -04:00
|
|
|
#endif
|