mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-05 08:10:05 +00:00
removed CObjStream
This commit is contained in:
parent
6056f8eb5b
commit
b902ac90de
@ -7,7 +7,7 @@ print("starting Testsuite...")
|
|||||||
// tests the string.* library
|
// tests the string.* library
|
||||||
|
|
||||||
assert("Hello world!":sub(6) == "world!", "string.sub() failed!")
|
assert("Hello world!":sub(6) == "world!", "string.sub() failed!")
|
||||||
assert("A":rep(6) == "AAAAAA", "string.red() failed!")
|
assert("A":rep(6) == "AAAAAA", "string.rep() failed!")
|
||||||
|
|
||||||
// tests some basic PEMDAS arithmetic
|
// tests some basic PEMDAS arithmetic
|
||||||
|
|
||||||
|
14
src/cobj.c
14
src/cobj.c
@ -59,12 +59,6 @@ void cosmoO_free(CState *state, CObj *obj)
|
|||||||
cosmoM_free(state, CObjObject, objTbl);
|
cosmoM_free(state, CObjObject, objTbl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COBJ_STREAM: {
|
|
||||||
CObjStream *objStrm = (CObjStream *)obj;
|
|
||||||
close(objStrm->fd);
|
|
||||||
cosmoM_free(state, CObjStream, objStrm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case COBJ_TABLE: {
|
case COBJ_TABLE: {
|
||||||
CObjTable *tbl = (CObjTable *)obj;
|
CObjTable *tbl = (CObjTable *)obj;
|
||||||
cosmoT_clearTable(state, &tbl->tbl);
|
cosmoT_clearTable(state, &tbl->tbl);
|
||||||
@ -204,14 +198,6 @@ CObjObject *cosmoO_newObject(CState *state)
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
CObjStream *cosmoO_newStream(CState *state, int fd)
|
|
||||||
{
|
|
||||||
CObjStream *strm = (CObjStream *)cosmoO_allocateBase(state, sizeof(CObjStream), COBJ_STREAM);
|
|
||||||
strm->fd = fd;
|
|
||||||
|
|
||||||
return strm;
|
|
||||||
}
|
|
||||||
|
|
||||||
CObjTable *cosmoO_newTable(CState *state)
|
CObjTable *cosmoO_newTable(CState *state)
|
||||||
{
|
{
|
||||||
CObjTable *obj = (CObjTable *)cosmoO_allocateBase(state, sizeof(CObjTable), COBJ_TABLE);
|
CObjTable *obj = (CObjTable *)cosmoO_allocateBase(state, sizeof(CObjTable), COBJ_TABLE);
|
||||||
|
@ -48,12 +48,6 @@ struct CObjString
|
|||||||
bool isIString;
|
bool isIString;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CObjStream
|
|
||||||
{
|
|
||||||
CommonHeader; // "is a" CObj
|
|
||||||
int fd; // handle to file descriptor, on POSIX compliant OSes this can also be a socket :pog:
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CObjError
|
struct CObjError
|
||||||
{
|
{
|
||||||
CommonHeader; // "is a" CObj
|
CommonHeader; // "is a" CObj
|
||||||
@ -138,7 +132,6 @@ struct CObjUpval
|
|||||||
|
|
||||||
#define cosmoV_readString(x) ((CObjString *)cosmoV_readRef(x))
|
#define cosmoV_readString(x) ((CObjString *)cosmoV_readRef(x))
|
||||||
#define cosmoV_readCString(x) (((CObjString *)cosmoV_readRef(x))->str)
|
#define cosmoV_readCString(x) (((CObjString *)cosmoV_readRef(x))->str)
|
||||||
#define cosmoV_readFD(x) (((CObjStream *)cosmoV_readRef(x))->fd)
|
|
||||||
#define cosmoV_readObject(x) ((CObjObject *)cosmoV_readRef(x))
|
#define cosmoV_readObject(x) ((CObjObject *)cosmoV_readRef(x))
|
||||||
#define cosmoV_readTable(x) ((CObjTable *)cosmoV_readRef(x))
|
#define cosmoV_readTable(x) ((CObjTable *)cosmoV_readRef(x))
|
||||||
#define cosmoV_readFunction(x) ((CObjFunction *)cosmoV_readRef(x))
|
#define cosmoV_readFunction(x) ((CObjFunction *)cosmoV_readRef(x))
|
||||||
@ -166,7 +159,6 @@ bool cosmoO_equal(CState *state, CObj *obj1, CObj *obj2);
|
|||||||
bool cosmoO_isDescendant(CObj *obj, CObjObject *proto);
|
bool cosmoO_isDescendant(CObj *obj, CObjObject *proto);
|
||||||
|
|
||||||
CObjObject *cosmoO_newObject(CState *state);
|
CObjObject *cosmoO_newObject(CState *state);
|
||||||
CObjStream *cosmoO_newStream(CState *state, int fd);
|
|
||||||
CObjTable *cosmoO_newTable(CState *state);
|
CObjTable *cosmoO_newTable(CState *state);
|
||||||
CObjFunction *cosmoO_newFunction(CState *state);
|
CObjFunction *cosmoO_newFunction(CState *state);
|
||||||
CObjCFunction *cosmoO_newCFunction(CState *state, CosmoCFunction func);
|
CObjCFunction *cosmoO_newCFunction(CState *state, CosmoCFunction func);
|
||||||
|
@ -34,7 +34,6 @@ typedef uint32_t cosmo_Flag;
|
|||||||
// objs
|
// objs
|
||||||
typedef struct CObj CObj;
|
typedef struct CObj CObj;
|
||||||
typedef struct CObjObject CObjObject;
|
typedef struct CObjObject CObjObject;
|
||||||
typedef struct CObjStream CObjStream;
|
|
||||||
typedef struct CObjString CObjString;
|
typedef struct CObjString CObjString;
|
||||||
typedef struct CObjUpval CObjUpval;
|
typedef struct CObjUpval CObjUpval;
|
||||||
typedef struct CObjFunction CObjFunction;
|
typedef struct CObjFunction CObjFunction;
|
||||||
|
Loading…
Reference in New Issue
Block a user