Exemple #1
0
Fichier : IoDBI.c Projet : BMeph/io
IoObject *IoDBI_drivers(IoDBI *self, IoObject *locals, IoMessage *m)
{
	/*doc DBI drivers
	Get a list of drivers and its associated information:

	<ol>
		<li>name</li>
		<li>description</li>
		<li>filename</li>
		<li>version</li>
		<li>date compiled</li>
		<li>maintainer</li>
		<li>url</li>
	</ol>
	*/
	IoList *list = IOREF(IoList_new(IOSTATE));
	dbi_driver driver = NULL;

	while((driver = dbi_driver_list(driver)) != NULL)
	{
		IoList *dlist = IOREF(IoList_new(IOSTATE));
		IoList_rawAppend_(dlist, IOSYMBOL(dbi_driver_get_name(driver)));
		IoList_rawAppend_(dlist, IOSYMBOL(dbi_driver_get_description(driver)));
		IoList_rawAppend_(dlist, IOSYMBOL(dbi_driver_get_filename(driver)));
		IoList_rawAppend_(dlist, IOSYMBOL(dbi_driver_get_version(driver)));
		IoList_rawAppend_(dlist, IOSYMBOL(dbi_driver_get_date_compiled(driver)));
		IoList_rawAppend_(dlist, IOSYMBOL(dbi_driver_get_maintainer(driver)));
		IoList_rawAppend_(dlist, IOSYMBOL(dbi_driver_get_url(driver)));

		IoList_rawAppend_(list, dlist);
	}

	return list;
}
Exemple #2
0
IoRegexMatch *IoRegexMatch_proto(void *state)
{
	IoObject *self = IoObject_new(state);
	IoObject_tag_(self, IoRegexMatch_newTag(state));

	IoObject_setDataPointer_(self, calloc(1, sizeof(IoRegexMatchData)));
	DATA(self)->regex = IONIL(self);
	DATA(self)->subject = IOSYMBOL("");
	DATA(self)->ranges = IoList_new(state);

	IoState_registerProtoWithFunc_(state, self, IoRegexMatch_proto);

	{
		IoMethodTable methodTable[] = {
			{"regex", IoRegexMatch_regex},
			{"subject", IoRegexMatch_subject},
			{"ranges", IoRegexMatch_ranges},
			{0, 0},
		};

		IoObject_addMethodTable_(self, methodTable);
	}

	return self;
}
Exemple #3
0
void IoAVCodec_createContextIfNeeded(IoAVCodec *self)
{
	if(!DATA(self)->packet)
	{
		DATA(self)->packet = calloc(1, sizeof(AVPacket));
	}

	// video

	// frames
	if (!DATA(self)->frames)
	{
		DATA(self)->frames = IoList_new(IOSTATE);
		IoObject_setSlot_to_(self, IOSYMBOL("frames"), DATA(self)->frames);
	}

	// videoSize
	{
		UArray *sizeUArray = UArray_newWithData_type_encoding_size_copy_("", CTYPE_float32_t, CENCODING_NUMBER, 2, 1);
		IoSeq *sizeSeq = IoSeq_newWithUArray_copy_(IOSTATE, sizeUArray, 0);
		IoObject_setSlot_to_(self, IOSYMBOL("videoSize"), sizeSeq);
	}

	if (!DATA(self)->decodedFrame)
	{
		DATA(self)->decodedFrame = avcodec_alloc_frame();
	}

	// audio

	if(!DATA(self)->audioOutBuffer)
	{
		DATA(self)->audioOutBuffer = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
	}
}
Exemple #4
0
IoObject *IoCertificate_attributes(IoCertificate *self, IoObject *locals, IoMessage *m)
{
	IoObject *map = IoObject_new(IoObject_state(self));
	const EVP_PKEY *pkey = X509_extract_key(X509(self));
	int i;
	for(i = 0; i < EVP_PKEY_get_attr_count(pkey); i++)
	{
		IoList *list = IoList_new(IoObject_state(self));
		X509_ATTRIBUTE *attr = EVP_PKEY_get_attr(pkey, i);
		const char *key = (const char *)OBJ_nid2ln(OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)));
		int j;
		for(j = 0; j < X509_ATTRIBUTE_count(attr); j++)
		{
			ASN1_TYPE *attrType = X509_ATTRIBUTE_get0_type(attr, j);
			ASN1_OBJECT *attrData = X509_ATTRIBUTE_get0_data(attr, j, attrType->type, NULL);
			//consider switching on attrType instead; 
			//really, that would be wiser, so that dates, 
			//numbers, etc can be happy
			/*
			switch(attrType->type) {
				case V_ASN1_OCTET_STRING:
			...
			*/
			int len = i2t_ASN1_OBJECT(NULL, 0, attrData);
			char *value = calloc(len, sizeof(char));
			i2t_ASN1_OBJECT(value, len, attrData);
			IoList_rawAppend_(list, IoSeq_newWithCString_(IoObject_state(self), value));
		}
		IoObject_setSlot_to_(map, IOSYMBOL(key), list);
	}
	return map;
}
Exemple #5
0
void IoEvDNSRequest_callback(int result, char type, int count, int ttl, void *addresses, void *arg)
{
	IoEvDNSRequest *self = arg;
	//type is either DNS_IPv4_A or DNS_PTR or DNS_IPv6_AAAA

	IoObject_setSlot_to_(self, IOSYMBOL("ttl"), IONUMBER(ttl));

	if(result == DNS_ERR_NONE)
	{
		IoList *ioAddresses = IoList_new(IOSTATE);
		IoObject_setSlot_to_(self, IOSYMBOL("addresses"), ioAddresses);
		
		int i;
		for (i = 0; i < count; i ++)
		{
			//addresses needs to be cast according to type
			uint32_t a = ((uint32_t *)addresses)[i];
			struct in_addr addr;
			char *ip;
			addr.s_addr = htonl(get32(rr->rdata));
			ip = (char *)inet_ntoa(addr);
			IoList_rawAppend_(ioAddresses, IOSYMBOL(ip));
		}
	}
	else 
	{
		IoObject_setSlot_to_(self, IOSYMBOL("error"), IOSYMBOL("fail"));
	}

	
	IoMessage *m = IoMessage_newWithName_label_(IOSTATE, IOSYMBOL("handleResponse"), IOSYMBOL("IoEvDNSRequest"));
	IoMessage_locals_performOn_(m, self, self);
}
Exemple #6
0
IoObject *IoTheoraDecodeContext_ycbcr(IoTheoraDecodeContext *self, IoObject *locals, IoMessage *m)
{
	/*doc TheoraDecodecontext ycbcr
	Returns an object containing the YUV data from the decoded frame.
	*/
        th_ycbcr_buffer buffer;
	int ret = th_decode_ycbcr_out(DATA(self)->ctx, buffer);
	IOASSERT(ret == 0, "th_decode_ycbcr_out failed");
	
	IoObject* yuv0 = IoObject_new(IOSTATE);
	IoObject* yuv1 = IoObject_new(IOSTATE);
	IoObject* yuv2 = IoObject_new(IOSTATE);
	IoObject_setSlot_to_(yuv0, IOSYMBOL("width"), IONUMBER(buffer[0].width));
	IoObject_setSlot_to_(yuv0, IOSYMBOL("height"), IONUMBER(buffer[0].height));
	IoObject_setSlot_to_(yuv0, IOSYMBOL("stride"), IONUMBER(buffer[0].stride));
	IoObject_setSlot_to_(yuv0, IOSYMBOL("data"), IOSEQ(buffer[0].data, buffer[0].stride * buffer[0].height));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("width"), IONUMBER(buffer[1].width));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("height"), IONUMBER(buffer[1].height));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("stride"), IONUMBER(buffer[1].stride));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("data"), IOSEQ(buffer[1].data, buffer[1].stride * buffer[1].height));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("width"), IONUMBER(buffer[2].width));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("height"), IONUMBER(buffer[2].height));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("stride"), IONUMBER(buffer[2].stride));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("data"), IOSEQ(buffer[2].data, buffer[2].stride * buffer[2].height));

	IoList* result = IoList_new(IOSTATE);
	IoList_rawAppend_(result, yuv0);
	IoList_rawAppend_(result, yuv1);
	IoList_rawAppend_(result, yuv2);
	return result;
}
Exemple #7
0
IoObject *IoSQLite3_execWithCallback(IoSQLite3 *self,
									 IoObject *locals, IoMessage *m, IoSymbol *s, ResultRowCallback *callback)
{
	IoList *results;

	if (!DATA(self)->db)
	{
		IoSQLite3_justOpen(self);

		if (!DATA(self)->db)
		{
			return IONIL(self);
		}
	}

	DATA(self)->results = IOREF(IoList_new(IOSTATE));

	if (DATA(self)->debugOn)
	{
		IoState_print_(IOSTATE, "*** %s ***\n", CSTRING(s));
	}

	{
		char *zErrMsg;
		sqlite3_exec(DATA(self)->db, CSTRING(s), callback, self, &zErrMsg);

		IoSQLite3_showError(self);
	}

	results = DATA(self)->results;
	DATA(self)->results = NULL;
	return results;
}
Exemple #8
0
IO_METHOD(IoDirectory, items)
{
    /*doc Directory items
    Returns a list object containing File and Directory objects
    for the files and directories of the receiver's path.
    */

    IoList *items = IoList_new(IOSTATE);
    IoDirectoryData *data = DATA(self);
    DIR *dirp = opendir(CSTRING(data->path));
    struct dirent *dp;

    if (!dirp)
    {
        IoState_error_(IOSTATE, m, "Unable to open directory %s", CSTRING(DATA(self)->path));
    }

    while ((dp = readdir(dirp)) != NULL)
    {
        IoList_rawAppend_(items, IoDirectory_itemForDirent_(self, dp));
    }

    (void)closedir(dirp);
    return items;
}
Exemple #9
0
IoList *IoList_newWithList_(void *state, List *list)
{
	IoList *self = IoList_new(state);
	//printf("IoList_newWithList_ %p %p\n", (void *)self, (void *)list);
	List_free(IoObject_dataPointer(self));
	IoObject_setDataPointer_(self, list);
	return self;
}
Exemple #10
0
static IoRegexMatch *IoRegexMatches_searchFrom_withOptions_(IoRegexMatches *self, IoMessage *m, int position, int options)
{
	Regex *regex = IoRegex_rawRegex(DATA(self)->regex);
	int *captures = 0;
	int *capture = 0;
	IoList *rangeList = 0;
	int i = 0;

	int captureCount = Regex_search_from_to_withOptions_captureArray_(
		regex,
		CSTRING(DATA(self)->string),
		position,
		DATA(self)->endPosition,
		options,
		DATA(self)->captureArray
	);

	if (Regex_error(regex))
		IoState_error_(IOSTATE, m, Regex_error(regex));

	if (captureCount == 0)
		return IONIL(self);

	/* The search function puts information about captured substrings in captureArray.
	There's a pair of integers for each capture. The first element of the pair is the
	start index of the substring, and the second element is the end index.
	The first pair represents the entire match. */
	captures = (int *)UArray_data(DATA(self)->captureArray);
	DATA(self)->position = captures[1];
	DATA(self)->currentMatchIsEmpty = (captures[0] == captures[1]);

	capture = captures;
	rangeList = IoList_new(IOSTATE);
	for (i = 0; i < captureCount; i++) {
		IoObject *element = 0;
		// unsure about this locals initialization ...
		IoObject *locals = NULL;
		IoMessage *message = IoMessage_new(IOSTATE);

		if (capture[0] == -1 && capture[1] == -1) {
			/* This capture was not matched. */
			element = IONIL(self);
		} else {
			element = IoRange_new(IOSTATE);
			IoMessage_setCachedArg_to_(message, 0, IONUMBER(capture[0]));
			IoMessage_setCachedArg_to_(message, 1, IONUMBER(capture[1]));
			IoRange_setRange(element, locals, message);
			IoRange_setFirst(element, IONUMBER(capture[0]));
			IoRange_setLast(element, IONUMBER(capture[1]));
		}

		IoList_rawAppend_(rangeList, element);
		capture += 2;
	}

	return IoRegexMatch_newWithRegex_subject_captureRanges_(IOSTATE, DATA(self)->regex, DATA(self)->string, rangeList);
}
Exemple #11
0
IO_METHOD(IoObject, symbols)
{
	/*doc System symbols
	Returns a List containing all Symbols currently in the system.
	*/

	IoList *list = IoList_new(IOSTATE);
	CHASH_FOREACH(IOSTATE->symbols, i, v, IoList_rawAppend_(list, v));
	return list;
}
Exemple #12
0
IoObject *IoCairoSVGSurface_getVersions(IoCairoSVGSurface *self, IoObject *locals, IoMessage *m)
{
	IoList *versionList = IoList_new(IOSTATE);
	const cairo_svg_version_t *versions = 0;
	int versionCount = 0;
	int i = 0;

	cairo_svg_get_versions(&versions, &versionCount);
	for (i = 0; i < versionCount; i++)
		IoList_rawAppend_(versionList, IONUMBER(versions[i]));
	return versionList;
}
Exemple #13
0
IoObject *IoCollector_allObjects(IoCollector *self, IoObject *locals, IoMessage *m)
{
	/*doc Collector allObjects
	Returns a List containing all objects known to the collector.
	*/

	IoList *results = IoList_new(IOSTATE);
	Collector *collector = IOSTATE->collector;

	COLLECTOR_FOREACH(collector, v, IoList_rawAppend_(results, (void *)v));
	return results;
}
Exemple #14
0
IO_METHOD(IoMessage, arguments)
{
	/*doc Message arguments
	Returns a list of the message objects that act as the
	receiver's arguments. Modifying this list will not alter the actual
	list of arguments. Use the arguments_() method to do that. 
	*/

	IoList *argsList = IoList_new(IOSTATE);
	IoList_rawAddBaseList_(argsList, DATA(self)->args);
	return argsList;
}
Exemple #15
0
IoObject *IoCollector_dirtyObjects(IoCollector *self, IoObject *locals, IoMessage *m)
{
	/*doc Collector dirtyObjects
	Returns a List containing all dirty objects known to the collector.
	*/

	IoList *results = IoList_new(IOSTATE);
	Collector *collector = IOSTATE->collector;

	COLLECTOR_FOREACH(collector, v,
		if(IoObject_isDirty(v))
		{
			IoList_rawAppend_(results, (void *)v);
		}
	);
Exemple #16
0
IO_METHOD(IoClutterActor, getAllocationVertices) {
  ClutterVertex vertices[4] = {};
  IoList *result = IoList_new(IOSTATE);

  if(IoMessage_argCount(m) > 0) {
    ClutterActor *ancestor = IOCACTOR(IoMessage_locals_clutterActorArgAt_(m, locals, 0));
    clutter_actor_get_allocation_vertices(IOCACTOR(self), ancestor, vertices);
  } else {
    clutter_actor_get_allocation_vertices(IOCACTOR(self), NULL, vertices);
  }

  IoList_rawAppend_(result, IoClutterVertex_newWithVertex(IOSTATE, &vertices[0]));
  IoList_rawAppend_(result, IoClutterVertex_newWithVertex(IOSTATE, &vertices[1]));
  IoList_rawAppend_(result, IoClutterVertex_newWithVertex(IOSTATE, &vertices[2]));
  IoList_rawAppend_(result, IoClutterVertex_newWithVertex(IOSTATE, &vertices[3]));

  return result;
}
Exemple #17
0
IoObject *IoSQLite_execWithCallback(IoSQLite *self,
									IoObject *locals,
									IoMessage *m,
									IoSymbol *s,
									ResultRowCallback *callback)
{
	IoList *results;

	if (!DATA(self)->db)
	{
		IoSQLite_open(self, locals, m);

		if (!DATA(self)->db)
		{
			return IONIL(self);
		}
	}

	DATA(self)->results = IOREF(IoList_new(IOSTATE));

	if (DATA(self)->debugOn)
	{
		IoState_print_(IOSTATE, "*** %s ***\n", CSTRING(s));
	}

	{
		char *zErrMsg;
		int rc = sqlite_exec(DATA(self)->db, CSTRING(s), callback, self, &zErrMsg);

		if (rc != SQLITE_OK)
		{
			IoSQLite_error_(self, zErrMsg);
			IoState_error_(IOSTATE, m, zErrMsg);
		}
		else
		{
			IoSQLite_error_(self, "");
		}
	}

	results = DATA(self)->results;
	DATA(self)->results = NULL;
	return results;
}
Exemple #18
0
IO_METHOD(IoObject, tokensForString)
{
	/*doc Compiler tokensForString(aString)
	Returns a list of token objects lexed from the input string.
*/

	IoSymbol *text = IoMessage_locals_seqArgAt_(m, locals, 0);
	IoList *tokensList = IoList_new(IOSTATE);
	IoLexer *lexer = IoLexer_new();
	IoSymbol *name = IOSYMBOL("name");
	IoSymbol *line = IOSYMBOL("line");
	IoSymbol *character = IOSYMBOL("character");
	IoSymbol *type = IOSYMBOL("type");

	IoLexer_string_(lexer, CSTRING(text));
	IoLexer_lex(lexer);

	if (IoLexer_errorToken(lexer))
	{
		IoSymbol *errorString  = IOSYMBOL(IoLexer_errorDescription(lexer));
		IoLexer_free(lexer);
		IoState_error_(IOSTATE, NULL, "compile error: %s", CSTRING(errorString));
	}
	else
	{
		IoToken *t;

		while ((t = IoLexer_pop(lexer)))
		{
			IoObject *tokenObject = IoObject_new(IOSTATE);

			IoObject_setSlot_to_(tokenObject, name, IOSYMBOL(IoToken_name(t)));
			IoObject_setSlot_to_(tokenObject, line, IONUMBER(IoToken_lineNumber(t)));
			IoObject_setSlot_to_(tokenObject, character, IONUMBER(IoToken_charNumber(t)));
			IoObject_setSlot_to_(tokenObject, type, IOSYMBOL(IoToken_typeName(t)));

			IoList_rawAppend_(tokensList, tokenObject);
		}
	}

	IoLexer_free(lexer);

	return tokensList;
}
Exemple #19
0
IoObject *IoTagDB_tagsAtKey(IoTagDB *self, IoObject *locals, IoMessage *m)
{
	/*doc TagDB tagsAtKey(key)
	Returns the tags for the specified key.
	*/
	
	TagDB *tdb = DATA(self);
	IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
	symbolid_t keyid = TagDB_idForSymbol_size_(tdb, CSTRING(key), IoSeq_rawSize(key));
	IoList *tagNames = IoList_new(IOSTATE);
	Uint64Array *tags = TagDB_tagsAtKey_(tdb, keyid);
	int i;

	//printf("IoTagDB_tagsAt self = %p\n", (void *)self);

	if (!tags) 
	{
		//printf("IoTagDB_tagsAtKey: no tags found for key\n");
		return IONIL(self);
	}
	
	for (i = 0; i < Uint64Array_size(tags); i ++)
	{
		uint64_t tagid = Uint64Array_at_(tags, i);
		Datum *name = TagDB_symbolForId_(tdb, tagid);
		//printf("tagid %i = %i\n", i, (int)tagid);
		//printf("name '%s'\n", (char *)name->data);

		if (!name)
		{
			printf("IoTagDB_tagsAtKey: no datum returned for TagDB_symbolForId_\n");
		}
		else
		{
			IoList_rawAppend_(tagNames, IoSeq_newWithData_length_(IOSTATE, name->data, name->size));
			Datum_free(name);
		}
	}

	//Uint64Array_free(tags);

	return tagNames;
}
Exemple #20
0
IoObject *IoAVCodec_decodeCodecNames(IoAVCodec *self, IoObject *locals, IoMessage *m)
{
	/*doc AVCodec decodeCodecNames
	Returns a list of strings with the names of the decode codecs.
	*/

	AVCodec *p = first_avcodec;
	IoList *names = IoList_new(IOSTATE);

	while (p)
	{
		if (p->decode)
		{
			IoList_rawAppend_(names, IOSYMBOL(p->name));
		}

		p = p->next;
	}

	return names;
}
Exemple #21
0
IoObject *IoAVCodec_encodeCodecNames(IoAVCodec *self, IoObject *locals, IoMessage *m)
{
	/*doc AVCodec encodeCodecNames
	Returns a list of strings with the names of the encode codecs.
	*/

	AVCodec *p = av_codec_next(NULL);
	IoList *names = IoList_new(IOSTATE);

	while (p)
	{
		if (p->encode)
		{
			IoList_rawAppend_(names, IOSYMBOL(p->name));
		}

        p = av_codec_next(p);
	}

	return names;
}
Exemple #22
0
Fichier : geom.c Projet : ADTSH/io
IoObject *IoODEGeom_collide(IoObject *self, IoObject *locals, IoMessage *m)
{
	dGeomID g1 = DATA(self)->geomId;
	dGeomID g2 = IoMessage_locals_odeGeomIdArgAt_(m, locals, 0);

	int max = IoMessage_argCount(m) > 1 ? IoMessage_locals_doubleArgAt_(m, locals, 1) : 1;
	dContactGeom* contacts = calloc(max, sizeof(*contacts));

	int count = dCollide(g1, g2, max, contacts, sizeof(*contacts));

	IoList *result = IoList_new(IOSTATE);
	int i;

	for(i=0; i < count; i++)
	{
		IoODEContact *contact = IoODEContact_newContactGeom(IOSTATE, &(contacts[i]));
		IoList_rawAppend_(result, contact);
	}

	free(contacts);
	return result;
}
Exemple #23
0
IO_METHOD(IoFile, readLines)
{
	/*doc File readLines
	Returns list containing all lines in the file.
	*/

	IoState *state = IOSTATE;

	if (!DATA(self)->stream)
	{
		IoFile_openForReading(self, locals, m);
	}

	IoFile_assertOpen(self, locals, m);

	{
		IoList *lines = IoList_new(state);
		IoObject *newLine;

		IoState_pushRetainPool(state);

		for (;;)
		{
			IoState_clearTopPool(state);
			newLine = IoFile_readLine(self, locals, m);

			if (ISNIL(newLine))
			{
				break;
			}

			IoList_rawAppend_(lines, newLine);
		}
		IoState_popRetainPool(state);

		return lines;
	}
}
Exemple #24
0
IoObject* IoMySQL_query(IoObject* self, IoObject* locals, IoMessage* m)
{
    /*doc MySQL query(aQueryString)
    Perform a SQL query and return a list of results.
    <pre>
    db query("SELECT * FROM accounts") foreach(println)
    </pre>
    */

    IoObject * queryString = 0x0;
    bool useMap;

    MYSQL* conn = &DATA(self)->connection;
    MYSQL_RES* result;
    MYSQL_ROW row;
    MYSQL_FIELD* column;
    char** columnNames;
    unsigned c, colLength;
    unsigned long* colLengths;
    IoObject *list, *rowObject; //, *tmpObject;

    if(IoMessage_argCount(m) < 1 || !ISSEQ(queryString = IoMessage_locals_quickValueArgAt_(m, locals, 0)))
        IoState_error_(IOSTATE, m, "argument 0 to method 'query' must be a Sequence");

    useMap = IoMessage_argCount(m) > 1 && ISTRUE(IoMessage_locals_quickValueArgAt_(m, locals, 1));

    if(!DATA(self)->connected) //printf("not connected?\n");
        IoState_error_(IOSTATE, m, "not connected yet");

    if(mysql_real_query(conn, CSTRING(queryString), IOSEQ_LENGTH(queryString)))
        IoState_error_(IOSTATE, m, "query error(%d): %s", mysql_errno(&DATA(self)->connection), mysql_error(&DATA(self)->connection));

    if((result = mysql_store_result(conn)) && (colLength = mysql_num_fields(result))) {
        list = IoList_new(IOSTATE);

        if(useMap) {
            columnNames = (char**) malloc(colLength * sizeof(char*));
            for(c = 0; c < colLength && (column = mysql_fetch_field(result)); ++c)
                columnNames[c] = column->name;

            while((row = mysql_fetch_row(result)))
            {
                colLengths = mysql_fetch_lengths(result);
                rowObject = IoMap_new(IOSTATE);

                for(c = 0; c < colLength; ++c)
                    IoMap_rawAtPut(rowObject, IOSYMBOL(columnNames[c]), IOSEQ((unsigned char *)row[c], (size_t)colLengths[c]));

                IoList_rawAppend_(list, rowObject);
            }

            free(columnNames);
        }
        else
        {
            while((row = mysql_fetch_row(result))) {
                colLengths = mysql_fetch_lengths(result);
                rowObject = IoList_new(IOSTATE);

                for(c = 0; c < colLength; ++c)
                    IoList_rawAppend_(rowObject, IOSEQ((unsigned char *)row[c], (size_t)colLengths[c]));

                IoList_rawAppend_(list, rowObject);
            }
        }

        mysql_free_result(result);
        return list;
    }
    else
        return IONUMBER(mysql_affected_rows(conn));
}
Exemple #25
0
IoObject *IoAudioMixer_sounds(IoAudioMixer *self, IoObject *locals, IoMessage *m)
{
	IoList *ioList = IoList_new(IOSTATE);
	List_copy_(IoList_rawList(ioList), DATA(self)->sounds);
	return ioList;
}