Skip to content

Commit

Permalink
Moved addons to use IoState_registerProtoWithId_() and IoState_protoW…
Browse files Browse the repository at this point in the history
…ithId_()
  • Loading branch information
stevedekorte committed Jan 16, 2012
1 parent bd0df87 commit fe9b43c
Show file tree
Hide file tree
Showing 115 changed files with 2,124 additions and 2,711 deletions.
7 changes: 4 additions & 3 deletions addons/AVCodec/source/IoAVCodec.c
Expand Up @@ -34,6 +34,7 @@ videoFrameCount
#include <limits.h>
//#include <math.h>

static const char *protoId = "AVCodec";

#define DATA(self) ((IoAVCodecData *)IoObject_dataPointer(self))

Expand All @@ -46,7 +47,7 @@ void IoAVCodec_registerIfNeeded(IoAVCodec *self)

IoTag *IoAVCodec_newTag(void *state)
{
IoTag *tag = IoTag_newWithName_("AVCodec");
IoTag *tag = IoTag_newWithName_(protoId);
IoTag_state_(tag, state);
IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoAVCodec_rawClone);
IoTag_markFunc_(tag, (IoTagMarkFunc *)IoAVCodec_mark);
Expand All @@ -64,7 +65,7 @@ IoAVCodec *IoAVCodec_proto(void *state)
DATA(self)->inputBuffer = IoSeq_new(state);
DATA(self)->outputBuffer = IoSeq_new(state);

IoState_registerProtoWithFunc_(state, self, IoAVCodec_proto);
IoState_registerProtoWithId_(state, self, protoId);

IoAVCodec_registerIfNeeded(self);

Expand Down Expand Up @@ -104,7 +105,7 @@ IoAVCodec *IoAVCodec_rawClone(IoAVCodec *proto)

IoAVCodec *IoAVCodec_new(void *state)
{
IoObject *proto = IoState_protoWithInitFunction_(state, IoAVCodec_proto);
IoObject *proto = IoState_protoWithId_(state, protoId);
return IOCLONE(proto);
}

Expand Down
6 changes: 4 additions & 2 deletions addons/AppleExtras/source/IoAppleSensors.c
Expand Up @@ -23,6 +23,8 @@ value := sensors getRightLightSensor

#define DATA(self) ((IoAppleSensorsData *)(IoObject_dataPointer(self)))

const char *protoId = "AppleSensors";

IoTag *IoAppleSensors_newTag(void *state)
{
IoTag *tag = IoTag_newWithName_("AppleSensors");
Expand All @@ -39,7 +41,7 @@ IoAppleSensors *IoAppleSensors_proto(void *state)

//IoObject_setDataPointer_(self, calloc(1, sizeof(IoAppleSensorsData)));

IoState_registerProtoWithFunc_(state, self, IoAppleSensors_proto);
IoState_registerProtoWithId_(state, self, protoId);

{
IoMethodTable methodTable[] = {
Expand Down Expand Up @@ -72,7 +74,7 @@ IoAppleSensors *IoAppleSensors_rawClone(IoAppleSensors *proto)

IoAppleSensors *IoAppleSensors_new(void *state)
{
IoObject *proto = IoState_protoWithInitFunction_(state, IoAppleSensors_proto);
IoObject *proto = IoState_protoWithId_(state, protoId);
return IOCLONE(proto);
}

Expand Down
8 changes: 5 additions & 3 deletions addons/AsyncRequest/source/IoAsyncRequest.c
Expand Up @@ -18,9 +18,11 @@ asynchronous in Io.
#define IOCB(self) ((struct aiocb *)(IoObject_dataPointer(self)))
#define IOCB_BUFFER(self) ((void *)(IOCB(self)->aio_buf))

static const char *protoId = "AsyncRequest";

IoTag *IoAsyncRequest_newTag(void *state)
{
IoTag *tag = IoTag_newWithName_("AsyncRequest");
IoTag *tag = IoTag_newWithName_(protoId);
IoTag_state_(tag, state);
IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoAsyncRequest_rawClone);
IoTag_freeFunc_(tag, (IoTagFreeFunc *)IoAsyncRequest_free);
Expand All @@ -34,7 +36,7 @@ IoAsyncRequest *IoAsyncRequest_proto(void *state)

IoObject_setDataPointer_(self, calloc(1, sizeof(struct aiocb)));

IoState_registerProtoWithFunc_(state, self, IoAsyncRequest_proto);
IoState_registerProtoWithId_(state, self, protoId);

{
IoMethodTable methodTable[] = {
Expand Down Expand Up @@ -65,7 +67,7 @@ IoAsyncRequest *IoAsyncRequest_rawClone(IoAsyncRequest *proto)

IoAsyncRequest *IoAsyncRequest_new(void *state)
{
IoObject *proto = IoState_protoWithInitFunction_(state, IoAsyncRequest_proto);
IoObject *proto = IoState_protoWithId_(state, protoId);
return IOCLONE(proto);
}

Expand Down
8 changes: 5 additions & 3 deletions addons/BigNum/source/IoBigNum.c
Expand Up @@ -7,9 +7,11 @@ Warning: GMP uses the restrictive GNU license which can be a problem if you are

#define DATA(self) ((IoBigNumData *)(IoObject_dataPointer(self)))

static const char *protoId = "BigNum";

IoTag *IoBigNum_newTag(void *state)
{
IoTag *tag = IoTag_newWithName_("BigNum");
IoTag *tag = IoTag_newWithName_(protoId);
IoTag_state_(tag, state);
IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoBigNum_rawClone);
IoTag_freeFunc_(tag, (IoTagFreeFunc *)IoBigNum_free);
Expand All @@ -23,7 +25,7 @@ IoBigNum *IoBigNum_proto(void *state)
IoObject_tag_(self, IoBigNum_newTag(state));
IoObject_setDataPointer_(self, calloc(1, sizeof(IoBigNumData)));
mpz_init(DATA(self)->integer);
IoState_registerProtoWithFunc_(state, self, IoBigNum_proto);
IoState_registerProtoWithId_(state, self, protoId);
IoMethodTable methodTable[] = {
{"+", IoBigNum_add}
//doc BigNum +(aNum) Add op. Returns result.
Expand Down Expand Up @@ -146,7 +148,7 @@ IoBigNum *IoBigNum_rawClone(IoBigNum * proto)

IoBigNum *IoBigNum_new(void *state)
{
IoObject *proto = IoState_protoWithInitFunction_(state, IoBigNum_proto);
IoObject *proto = IoState_protoWithId_(state, protoId);
return IOCLONE(proto);
}

Expand Down
6 changes: 3 additions & 3 deletions addons/Blowfish/source/IoBlowfish.c
Expand Up @@ -56,7 +56,7 @@ static const char *protoId = "Blowfish";

IoTag *IoBlowfish_newTag(void *state)
{
IoTag *tag = IoTag_newWithName_("Blowfish");
IoTag *tag = IoTag_newWithName_(protoId);
IoTag_state_(tag, state);
IoTag_freeFunc_(tag, (IoTagFreeFunc *)IoBlowfish_free);
IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoBlowfish_rawClone);
Expand All @@ -70,7 +70,7 @@ IoBlowfish *IoBlowfish_proto(void *state)

IoObject_setDataPointer_(self, calloc(1, sizeof(IoBlowfishData)));

IoState_registerProtoWithFunc_(state, self, protoId);
IoState_registerProtoWithId_(state, self, protoId);

{
IoMethodTable methodTable[] = {
Expand All @@ -95,7 +95,7 @@ IoBlowfish *IoBlowfish_rawClone(IoBlowfish *proto)

IoBlowfish *IoBlowfish_new(void *state)
{
IoObject *proto = IoState_protoWithInitFunction_(state, protoId);
IoObject *proto = IoState_protoWithId_(state, protoId);
return IOCLONE(proto);
}

Expand Down
6 changes: 3 additions & 3 deletions addons/Box/source/IoBox.c
Expand Up @@ -34,7 +34,7 @@ void *IoMessage_locals_boxArgAt_(IoMessage *self, void *locals, int n)

IoTag *IoBox_newTag(void *state)
{
IoTag *tag = IoTag_newWithName_("Box");
IoTag *tag = IoTag_newWithName_(protoId);
IoTag_state_(tag, state);
IoTag_freeFunc_(tag, (IoTagFreeFunc *)IoBox_free);
IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoBox_rawClone);
Expand All @@ -55,7 +55,7 @@ IoBox *IoBox_rawClone(IoBox *proto)

IoBox *IoBox_new(void *state)
{
IoBox *proto = IoState_protoWithInitFunction_(state, protoId);
IoBox *proto = IoState_protoWithId_(state, protoId);
return IOCLONE(proto);
}

Expand Down Expand Up @@ -481,7 +481,7 @@ IoBox *IoBox_proto(void *state)
DATA(self)->origin = IoSeq_newVec3f(state, o);
DATA(self)->size = IoSeq_newVec3f(state, o);

IoState_registerProtoWithFunc_(state, self, protoId);
IoState_registerProtoWithId_(state, self, protoId);

{
IoMethodTable methodTable[] = {
Expand Down

0 comments on commit fe9b43c

Please sign in to comment.