Numworks Epsilon  1.4.1
Graphing Calculator Operating System
stream.c File Reference
#include <string.h>
#include <unistd.h>
#include "py/objstr.h"
#include "py/stream.h"
#include "py/runtime.h"

Go to the source code of this file.

Macros

#define DEFAULT_BUFFER_SIZE   256
 
#define STREAM_CONTENT_TYPE(stream)   (((stream)->is_text) ? &mp_type_str : &mp_type_bytes)
 

Functions

STATIC mp_obj_t stream_readall (mp_obj_t self_in)
 
mp_uint_t mp_stream_rw (mp_obj_t stream, void *buf_, mp_uint_t size, int *errcode, byte flags)
 
const mp_stream_p_tmp_get_stream_raise (mp_obj_t self_in, int flags)
 
mp_obj_t mp_stream_close (mp_obj_t stream)
 
STATIC mp_obj_t stream_read_generic (size_t n_args, const mp_obj_t *args, byte flags)
 
STATIC mp_obj_t stream_read (size_t n_args, const mp_obj_t *args)
 
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mp_stream_read_obj, 1, 2, stream_read)
 
STATIC mp_obj_t stream_read1 (size_t n_args, const mp_obj_t *args)
 
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mp_stream_read1_obj, 1, 2, stream_read1)
 
mp_obj_t mp_stream_write (mp_obj_t self_in, const void *buf, size_t len, byte flags)
 
void mp_stream_write_adaptor (void *self, const char *buf, size_t len)
 
STATIC mp_obj_t stream_write_method (size_t n_args, const mp_obj_t *args)
 
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mp_stream_write_obj, 2, 4, stream_write_method)
 
STATIC mp_obj_t stream_write1_method (mp_obj_t self_in, mp_obj_t arg)
 
 MP_DEFINE_CONST_FUN_OBJ_2 (mp_stream_write1_obj, stream_write1_method)
 
STATIC mp_obj_t stream_readinto (size_t n_args, const mp_obj_t *args)
 
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mp_stream_readinto_obj, 2, 3, stream_readinto)
 
STATIC mp_obj_t stream_unbuffered_readline (size_t n_args, const mp_obj_t *args)
 
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mp_stream_unbuffered_readline_obj, 1, 2, stream_unbuffered_readline)
 
STATIC mp_obj_t stream_unbuffered_readlines (mp_obj_t self)
 
 MP_DEFINE_CONST_FUN_OBJ_1 (mp_stream_unbuffered_readlines_obj, stream_unbuffered_readlines)
 
mp_obj_t mp_stream_unbuffered_iter (mp_obj_t self)
 
STATIC mp_obj_t stream_seek (size_t n_args, const mp_obj_t *args)
 
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mp_stream_seek_obj, 2, 3, stream_seek)
 
STATIC mp_obj_t stream_tell (mp_obj_t self)
 
 MP_DEFINE_CONST_FUN_OBJ_1 (mp_stream_tell_obj, stream_tell)
 
STATIC mp_obj_t stream_flush (mp_obj_t self)
 
 MP_DEFINE_CONST_FUN_OBJ_1 (mp_stream_flush_obj, stream_flush)
 
STATIC mp_obj_t stream_ioctl (size_t n_args, const mp_obj_t *args)
 
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mp_stream_ioctl_obj, 2, 3, stream_ioctl)
 

Macro Definition Documentation

◆ DEFAULT_BUFFER_SIZE

#define DEFAULT_BUFFER_SIZE   256

Definition at line 46 of file stream.c.

◆ STREAM_CONTENT_TYPE

#define STREAM_CONTENT_TYPE (   stream)    (((stream)->is_text) ? &mp_type_str : &mp_type_bytes)

Definition at line 50 of file stream.c.

Function Documentation

◆ MP_DEFINE_CONST_FUN_OBJ_1() [1/3]

MP_DEFINE_CONST_FUN_OBJ_1 ( mp_stream_unbuffered_readlines_obj  ,
stream_unbuffered_readlines   
)

◆ MP_DEFINE_CONST_FUN_OBJ_1() [2/3]

MP_DEFINE_CONST_FUN_OBJ_1 ( mp_stream_tell_obj  ,
stream_tell   
)

◆ MP_DEFINE_CONST_FUN_OBJ_1() [3/3]

MP_DEFINE_CONST_FUN_OBJ_1 ( mp_stream_flush_obj  ,
stream_flush   
)

◆ MP_DEFINE_CONST_FUN_OBJ_2()

MP_DEFINE_CONST_FUN_OBJ_2 ( mp_stream_write1_obj  ,
stream_write1_method   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [1/7]

MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( mp_stream_read_obj  ,
,
,
stream_read   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [2/7]

MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( mp_stream_read1_obj  ,
,
,
stream_read1   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [3/7]

MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( mp_stream_write_obj  ,
,
,
stream_write_method   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [4/7]

MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( mp_stream_readinto_obj  ,
,
,
stream_readinto   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [5/7]

MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( mp_stream_unbuffered_readline_obj  ,
,
,
stream_unbuffered_readline   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [6/7]

MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( mp_stream_seek_obj  ,
,
,
stream_seek   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [7/7]

MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( mp_stream_ioctl_obj  ,
,
,
stream_ioctl   
)

◆ mp_get_stream_raise()

const mp_stream_p_t* mp_get_stream_raise ( mp_obj_t  self_in,
int  flags 
)

Definition at line 95 of file stream.c.

◆ mp_stream_close()

mp_obj_t mp_stream_close ( mp_obj_t  stream)

Definition at line 108 of file stream.c.

◆ mp_stream_rw()

mp_uint_t mp_stream_rw ( mp_obj_t  stream,
void *  buf_,
mp_uint_t  size,
int *  errcode,
byte  flags 
)

Definition at line 55 of file stream.c.

◆ mp_stream_unbuffered_iter()

mp_obj_t mp_stream_unbuffered_iter ( mp_obj_t  self)

Definition at line 429 of file stream.c.

◆ mp_stream_write()

mp_obj_t mp_stream_write ( mp_obj_t  self_in,
const void *  buf,
size_t  len,
byte  flags 
)

Definition at line 243 of file stream.c.

◆ mp_stream_write_adaptor()

void mp_stream_write_adaptor ( void *  self,
const char *  buf,
size_t  len 
)

Definition at line 262 of file stream.c.

◆ stream_flush()

STATIC mp_obj_t stream_flush ( mp_obj_t  self)

Definition at line 472 of file stream.c.

◆ stream_ioctl()

STATIC mp_obj_t stream_ioctl ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 483 of file stream.c.

◆ stream_read()

STATIC mp_obj_t stream_read ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 233 of file stream.c.

◆ stream_read1()

STATIC mp_obj_t stream_read1 ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 238 of file stream.c.

◆ stream_read_generic()

STATIC mp_obj_t stream_read_generic ( size_t  n_args,
const mp_obj_t args,
byte  flags 
)

Definition at line 115 of file stream.c.

◆ stream_readall()

STATIC mp_obj_t stream_readall ( mp_obj_t  self_in)

Definition at line 321 of file stream.c.

◆ stream_readinto()

STATIC mp_obj_t stream_readinto ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 292 of file stream.c.

◆ stream_seek()

STATIC mp_obj_t stream_seek ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 437 of file stream.c.

◆ stream_tell()

STATIC mp_obj_t stream_tell ( mp_obj_t  self)

Definition at line 464 of file stream.c.

◆ stream_unbuffered_readline()

STATIC mp_obj_t stream_unbuffered_readline ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 362 of file stream.c.

◆ stream_unbuffered_readlines()

STATIC mp_obj_t stream_unbuffered_readlines ( mp_obj_t  self)

Definition at line 416 of file stream.c.

◆ stream_write1_method()

STATIC mp_obj_t stream_write1_method ( mp_obj_t  self_in,
mp_obj_t  arg 
)

Definition at line 285 of file stream.c.

◆ stream_write_method()

STATIC mp_obj_t stream_write_method ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 266 of file stream.c.