typedef unsigned short CHAR;
#define CHARS ((signed)sizeof(CHAR))
+/* must always be 8 bits */
+typedef unsigned char BYTE;
+
/* Memory heap size */
#define DEFAULT_ARENA (5 * 1024 * 1024)
if(can_write(other_port,port->buf_fill))
{
write_string_raw(other_port,
- (char*)(port->buffer + 1),
+ (BYTE*)(port->buffer + 1),
port->buf_fill);
port->buf_pos = port->buf_fill = 0;
}
*((CHAR*)where) = what;
}
-INLINE char bget(CELL where)
+INLINE BYTE bget(CELL where)
{
- return *((char*)where);
+ return *((BYTE*)where);
}
-INLINE void bput(CELL where, char what)
+INLINE void bput(CELL where, BYTE what)
{
- *((char*)where) = what;
+ *((BYTE*)where) = what;
}
bool in_zone(ZONE* z, CELL pointer);
bool read_line_step(PORT* port)
{
int i;
- char ch;
+ BYTE ch;
SBUF* line = untag_sbuf(port->line);
bool read_count_step(PORT* port)
{
int i;
- char ch;
+ BYTE ch;
SBUF* line = untag_sbuf(port->line);
}
/* untagged */
-STRING* from_c_string(const char* c_string)
+STRING* from_c_string(const BYTE* c_string)
{
CELL length = strlen(c_string);
STRING* s = allot_string(length);
}
/* untagged */
-char* to_c_string(STRING* s)
+BYTE* to_c_string(STRING* s)
{
STRING* _c_str = allot_string(s->capacity / CHARS + 1);
CELL i;
- char* c_str = (char*)(_c_str + 1);
+ BYTE* c_str = (BYTE*)(_c_str + 1);
for(i = 0; i < s->capacity; i++)
c_str[i] = string_nth(s,i);
STRING* string(FIXNUM capacity, CELL fill);
void hash_string(STRING* str);
STRING* grow_string(STRING* string, FIXNUM capacity, CHAR fill);
-char* to_c_string(STRING* s);
-STRING* from_c_string(const char* c_string);
+BYTE* to_c_string(STRING* s);
+STRING* from_c_string(const BYTE* c_string);
#define SREF(string,index) ((CELL)string + sizeof(STRING) + index * CHARS)
/* Return true if write was done */
void write_step(PORT* port)
{
- char* chars = (char*)port->buffer + sizeof(STRING);
+ BYTE* chars = (BYTE*)port->buffer + sizeof(STRING);
FIXNUM amount = write(port->fd,chars + port->buf_pos,
port->buf_fill - port->buf_pos);
void write_char_8(PORT* port, FIXNUM ch)
{
- char c = (char)ch;
+ BYTE c = (BYTE)ch;
pending_io_error(port);
}
/* Caller must ensure buffer is of the right size. */
-void write_string_raw(PORT* port, char* str, CELL len)
+void write_string_raw(PORT* port, BYTE* str, CELL len)
{
/* Append string to buffer */
memcpy((void*)((CELL)port->buffer + sizeof(STRING)
void write_string_8(PORT* port, STRING* str)
{
- char* c_str;
+ BYTE* c_str;
pending_io_error(port);
void primitive_add_write_io_task(void);
bool perform_write_io_task(PORT* port);
void write_char_8(PORT* port, FIXNUM ch);
-void write_string_raw(PORT* port, char* str, CELL len);
+void write_string_raw(PORT* port, BYTE* str, CELL len);
void write_string_8(PORT* port, STRING* str);
void primitive_write_8(void);