From 8df4cc65e3dab94e5a243f3b84f0c14a076b7ddf Mon Sep 17 00:00:00 2001 From: CPunch Date: Thu, 9 Feb 2023 12:42:09 -0600 Subject: [PATCH] removed CObjStream --- examples/testsuite.cosmo | 2 +- src/cobj.c | 14 -------------- src/cobj.h | 8 -------- src/cosmo.h | 1 - 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/examples/testsuite.cosmo b/examples/testsuite.cosmo index 1b10c04..cd2107b 100644 --- a/examples/testsuite.cosmo +++ b/examples/testsuite.cosmo @@ -7,7 +7,7 @@ print("starting Testsuite...") // tests the string.* library 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 diff --git a/src/cobj.c b/src/cobj.c index 22354b7..57881c2 100644 --- a/src/cobj.c +++ b/src/cobj.c @@ -59,12 +59,6 @@ void cosmoO_free(CState *state, CObj *obj) cosmoM_free(state, CObjObject, objTbl); break; } - case COBJ_STREAM: { - CObjStream *objStrm = (CObjStream *)obj; - close(objStrm->fd); - cosmoM_free(state, CObjStream, objStrm); - break; - } case COBJ_TABLE: { CObjTable *tbl = (CObjTable *)obj; cosmoT_clearTable(state, &tbl->tbl); @@ -204,14 +198,6 @@ CObjObject *cosmoO_newObject(CState *state) 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 *obj = (CObjTable *)cosmoO_allocateBase(state, sizeof(CObjTable), COBJ_TABLE); diff --git a/src/cobj.h b/src/cobj.h index d46bbfc..86152ed 100644 --- a/src/cobj.h +++ b/src/cobj.h @@ -48,12 +48,6 @@ struct CObjString 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 { CommonHeader; // "is a" CObj @@ -138,7 +132,6 @@ struct CObjUpval #define cosmoV_readString(x) ((CObjString *)cosmoV_readRef(x)) #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_readTable(x) ((CObjTable *)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); CObjObject *cosmoO_newObject(CState *state); -CObjStream *cosmoO_newStream(CState *state, int fd); CObjTable *cosmoO_newTable(CState *state); CObjFunction *cosmoO_newFunction(CState *state); CObjCFunction *cosmoO_newCFunction(CState *state, CosmoCFunction func); diff --git a/src/cosmo.h b/src/cosmo.h index 332db81..f4878e9 100644 --- a/src/cosmo.h +++ b/src/cosmo.h @@ -34,7 +34,6 @@ typedef uint32_t cosmo_Flag; // objs typedef struct CObj CObj; typedef struct CObjObject CObjObject; -typedef struct CObjStream CObjStream; typedef struct CObjString CObjString; typedef struct CObjUpval CObjUpval; typedef struct CObjFunction CObjFunction;