当前位置: 首页>>代码示例>>C++>>正文


C++ IoMessage_locals_seqArgAt_函数代码示例

本文整理汇总了C++中IoMessage_locals_seqArgAt_函数的典型用法代码示例。如果您正苦于以下问题:C++ IoMessage_locals_seqArgAt_函数的具体用法?C++ IoMessage_locals_seqArgAt_怎么用?C++ IoMessage_locals_seqArgAt_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IoMessage_locals_seqArgAt_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IO_METHOD

IO_METHOD(IoSeq, replaceFirstSeq)
{
	/*doc Sequence replaceFirstSeq(aSequence, anotherSequence, optionalStartIndex)
	Returns a new Sequence with the first occurance of aSequence
	replaced with anotherSequence in the receiver. If optionalStartIndex is
	provided, the search for aSequence begins at that index. Returns self.
	*/

	IoSeq *subSeq   = IoMessage_locals_seqArgAt_(m, locals, 0);
	IoSeq *otherSeq = IoMessage_locals_seqArgAt_(m, locals, 1);
	size_t startIndex = 0;

	if (IoMessage_argCount(m) > 2)
	{
		startIndex = IoMessage_locals_longArgAt_(m, locals, 2);
	}

	IO_ASSERT_NOT_SYMBOL(self);

	{
		UArray *a = DATA(self);
		UArray *b = DATA(subSeq);
		UArray *c = DATA(otherSeq);
		long i = UArray_find_from_(a, b, startIndex);
		if(i != -1)
		{
			UArray_removeRange(a, i, UArray_size(b));
			UArray_at_putAll_(a, i, c);
		}
	}
	return self;
}
开发者ID:Alessandroo,项目名称:io,代码行数:32,代码来源:IoSeq_mutable.c

示例2: IoMessage_locals_seqArgAt_

IoObject *IoSkipDB_atPut(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc SkipDB atPut(keySymbol, valueSequence)
	Sets the value of valueSequence with the key keySymbol. Returns self.
	*/

	IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
	IoSeq *value = IoMessage_locals_seqArgAt_(m, locals, 1);

	IOASSERT(SKIPDB(self) && SkipDB_isOpen(SKIPDB(self)), "invalid skipdb");

	SkipDB_at_put_(SKIPDB(self), IoSeq_asDatum(key), IoSeq_asDatum(value));
	return self;
}
开发者ID:anthem,项目名称:io,代码行数:14,代码来源:IoSkipDB.c

示例3: IO_METHOD

IO_METHOD(IoDate, fromString)
{
	/*doc Date fromString(aString, formatString)
	Sets the receiver to the date specified by aString as parsed according to the given formatString. See the Date asString method for formatting rules. Returns self. 
	*/

	IoMessage_assertArgCount_receiver_(m, 2, self);
	{
		IoSymbol *date_input = IoMessage_locals_seqArgAt_(m, locals, 0);
		IoSymbol *format = IoMessage_locals_seqArgAt_(m, locals, 1);
		Date_fromString_format_(DATA(self), CSTRING(date_input), CSTRING(format));
	}
	IoObject_isDirty_(self, 1);
	return self;
}
开发者ID:bomma,项目名称:io,代码行数:15,代码来源:IoDate.c

示例4: IoMessage_locals_seqArgAt_

IoObject *IoLinker_makeCFunction(IoLinker *self, IoObject *locals, IoMessage *m)
{
/*doc Linker makeCFunction(aSeq, slotName, object)
Creates a CFunction which users the beginning address of the data in aSeq as its function pointer and 
adds the CFunction to the given object on slot slotName.
*/
	IoSeq *buffer = IoMessage_locals_seqArgAt_(m, locals, 0);
	IoSeq *slotName = IoMessage_locals_seqArgAt_(m, locals, 1);
	IoObject *object = IoMessage_locals_valueArgAt_(m, locals, 2);
	IoCFunction *f;
	IoUserFunction* fp = (IoUserFunction*)IoSeq_rawBytes(buffer);

	f = IoCFunction_newWithFunctionPointer_tag_name_(IOSTATE, fp, IoObject_tag(object), CSTRING(slotName));
	IoObject_setSlot_to_(f, IOSYMBOL("compiledCode"), buffer);
	return f;
}
开发者ID:ADTSH,项目名称:io,代码行数:16,代码来源:IoLinker.c

示例5: IoMessage_locals_seqArgAt_

IoObject *IoAppleSensors_smsVector(IoAppleSensors *self, IoObject *locals, IoMessage *m)
{
	/*doc AppleSensors smsVector(aVector)
		Sets aVector to the current x, y and z accelerometer values. 
		Returns true on success and false on failure.
	*/
	IoSeq *vector = IoMessage_locals_seqArgAt_(m, locals, 0);
	float *f = IoSeq_floatPointerOfLength_(vector, 3);
	int err;

	if (smsType == -1)
	{
		smsType = detect_sms();
	}

	int v[3] = {0, 0, 0};

	err = read_sms(smsType, &v[0], &v[1], &v[3]);
	
	f[0] = v[0];
	f[1] = v[1];
	f[2] = v[2];

	return err ? IOTRUE(self) : IOFALSE(self);
}
开发者ID:Alessandroo,项目名称:io,代码行数:25,代码来源:IoAppleSensors.c

示例6: IOCB

IoObject *IoAsyncRequest_write(IoAsyncRequest *self, IoObject *locals, IoMessage *m)
{
	/*doc AsyncRequest write(fileOffset, aSeq, bufferOffset, numberOfBytesToWrite)
	Submits an async write request. Returns nil on error, self otherwise. 
	*/
	
	int r;
	IoSeq *data;
	UArray *ba;
	int bufferOffset;
	int bytesToWrite;

	IOCB(self)->aio_offset = (size_t)CNUMBER(IoMessage_locals_numberArgAt_(m, locals, 0));

	data = IoMessage_locals_seqArgAt_(m, locals, 1);
	ba = IoSeq_rawUArray(data);

	bufferOffset = IoMessage_locals_intArgAt_(m, locals, 2);
	bytesToWrite = IoMessage_locals_intArgAt_(m, locals, 3);

	if (bytesToWrite > UArray_size(ba) - bufferOffset)
	{
		bytesToWrite = UArray_size(ba) - bufferOffset;
	}

	IOCB(self)->aio_nbytes = bytesToWrite;
	IOCB(self)->aio_buf = realloc(IOCB_BUFFER(self), bytesToWrite);
	memcpy(IOCB_BUFFER(self), UArray_bytes(ba), bytesToWrite);

	r = aio_write(IOCB(self));

	return r == 0 ? self : IONIL(self);
}
开发者ID:Akiyah,项目名称:io,代码行数:33,代码来源:IoAsyncRequest.c

示例7: OCTX

IoSecureServer *IoSecureServer_setCRLFile(IoSecureServer *self, IoObject *locals, IoMessage *msg)
{
	SSL_CTX *ctx = OCTX(self);
	IoSeq *pathSeq = IoMessage_locals_seqArgAt_(msg, locals, 0);
	char *path = IoSeq_asCString(pathSeq);
	if(ctx == NULL)
	{
		IoState_error_(IOSTATE, msg, "SecureServer has no SSL_CTX");
		return IONIL(self);
	}
	X509_STORE *store = SSL_CTX_get_cert_store(ctx);
	X509_STORE_set_verify_cb_func(store, IoSecureSockets_Verify_CRL_Callback);
	X509_STORE_set_flags (store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
	X509_LOOKUP *lookup;
	if (!(lookup = X509_STORE_add_lookup (store, X509_LOOKUP_file ())))
	{
		ERR_print_errors_fp(stderr);
		IoState_error_(IOSTATE, msg, "Error creating X509_LOOKUP object.");
	  	return IONIL(self);
	}
	if (X509_load_crl_file(lookup, path, X509_FILETYPE_PEM) != 1)
	{
		ERR_print_errors_fp(stderr);
		IoState_error_(IOSTATE, msg, "Error loading CRL from file %s\n", path);
	  	return IONIL(self);
	}
	
	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:29,代码来源:IoSecureServer.c

示例8: IoMessage_locals_seqArgAt_

IoObject *IoIPAddress_setIp(IoIPAddress *self, IoObject *locals, IoMessage *m)
{
	IoSeq *ip = IoMessage_locals_seqArgAt_(m, locals, 0);
	char *ipString = IoSeq_asCString(ip);
	IPAddress_setIp_(IPADDRESS(self), ipString);
	return self;
}
开发者ID:cdcarter,项目名称:io,代码行数:7,代码来源:IoIPAddress.c

示例9: IoMessage_locals_seqArgAt_

/*doc Memcached replace(key, value[, expiration])
Asks memcached to store the value identified by the key,
but only if the server *does* already hold data for this key.
Returns true on success, false if there is already data for this key.
Otherwise raises an exception.
*/
IoObject *IoMemcached_replace(IoMemcached *self, IoObject *locals, IoMessage *m)
{
	IoSeq    *key   = IoMessage_locals_seqArgAt_(m, locals, 0);
	IoObject *value = IoMessage_locals_quickValueArgAt_(m, locals, 1);

	time_t expiration = IoMessage_argCount(m) == 3 ? IoMessage_locals_intArgAt_(m, locals, 2) : 0;

	uint32_t flags;
	size_t size;
	char *cvalue = IoMemcached_serialize(self, locals, value, &size, &flags);

	memcached_return_t rc;
	rc = memcached_replace(DATA(self)->mc,
		CSTRING(key), IOSEQ_LENGTH(key),
		cvalue, size,
		expiration, flags
	);

	free(cvalue);

	if(rc != MEMCACHED_SUCCESS && rc != MEMCACHED_NOTSTORED)
		IoState_error_(IOSTATE, m, memcached_strerror(DATA(self)->mc, rc));

	// MEMCACHED_NOTSTORED is a legitmate error in the case of a collision.
	if(rc == MEMCACHED_NOTSTORED)
		return IOSTATE->ioFalse;

	return IOSTATE->ioTrue; // MEMCACHED_SUCCESS
}
开发者ID:ADTSH,项目名称:io,代码行数:35,代码来源:IoMemcached.c

示例10: DATA

IoObject *IoTagDB_atKeyPutTags(IoTagDB *self, IoObject *locals, IoMessage *m)
{
	/*doc TagDB atKeyPutTags(key, tagNameList)
	Sets the tags for key to those in tagNameList. Returns self.
	*/
	
	TagDB *tdb = DATA(self);
	IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
	IoList *tagNames = IoMessage_locals_listArgAt_(m, locals, 1);
	symbolid_t keyid = TagDB_idForSymbol_size_(tdb, CSTRING(key), IoSeq_rawSize(key));
	
	// debugging check
	/*
	Datum *keyDatum = TagDB_symbolForId_(tdb, keyid);
	
	printf("%s -> %i\n", CSTRING(key), (int)keyid);
	printf("%i -> %s\n", (int)keyid, (char *)(keyDatum->data));
	assert(strcmp((char *)(keyDatum->data), (char *)CSTRING(key)) == 0);
	Datum_free(keyDatum);
	*/
	
	{
	Uint64Array *tags = IoTagDB_tagArrayForTagNames_(self, m, tagNames);
	TagDB_begin(tdb);
	TagDB_atKey_putTags_(tdb, keyid, tags);
	TagDB_commit(tdb);
	Uint64Array_free(tags);
	}
	return self;
}
开发者ID:Akiyah,项目名称:io,代码行数:30,代码来源:IoTagDB.c

示例11: IoMessage_locals_seqArgAt_

IoObject *IoFont_lengthOfString(IoFont *self, IoObject *locals, IoMessage *m)
{
	/*doc Font widthOfString(aString)
	Returns a Number with the width that aString would render 
	to with the receiver's current settings.
	*/

	IoSymbol *text = IoMessage_locals_seqArgAt_(m, locals, 0);
	int startIndex = 0;
	int max = IoSeq_rawSize(text);
	int endIndex = max;

	if (IoMessage_argCount(m) == 2)
	{
		startIndex = IoNumber_asInt(IoMessage_locals_numberArgAt_(m, locals, 1));
		if (startIndex > max) startIndex = max;
	}

	if (IoMessage_argCount(m) > 2)
	{
		endIndex = IoNumber_asInt(IoMessage_locals_numberArgAt_(m, locals, 2));
		if (startIndex > max) endIndex = max;
	}

	return IONUMBER( GLFont_lengthOfString( DATA(self)->font, CSTRING(text), startIndex, endIndex) );
}
开发者ID:Teslos,项目名称:io,代码行数:26,代码来源:IoFont.c

示例12: glEnable

IoObject *IoFont_drawString(IoFont *self, IoObject *locals, IoMessage *m)
{
	/*doc Font drawString(aString, optionalStartIndex, optionalEndIndex)
	Draws aString using the optional start and end indexes, if supplied. Returns self.
<p>
Note; Fonts are drawn as RGBA pixel maps. These blending options are recommended:
<pre>	
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
</pre>	
	*/

	IoSymbol *textString = IoMessage_locals_seqArgAt_(m, locals, 0);
	int startIndex = 0;
	int endIndex;

	if (IoMessage_argCount(m) > 1)
	{
		startIndex = IoNumber_asInt(IoMessage_locals_numberArgAt_(m, locals, 1));
		if (startIndex > (int)IoSeq_rawSize(textString)) startIndex = (int)IoSeq_rawSize(textString);
	}

	if (IoMessage_argCount(m) > 2)
	{
		endIndex = IoNumber_asInt(IoMessage_locals_numberArgAt_(m, locals, 2));
	}
	else
	{
		endIndex = IoSeq_rawSize(textString);
	}

	GLFont_drawString(DATA(self)->font, CSTRING(textString) , startIndex, endIndex);
	IoFont_checkError(self, locals, m);
	return self;
}
开发者ID:Teslos,项目名称:io,代码行数:35,代码来源:IoFont.c

示例13: IO_METHOD

//doc ClutterColor fromString(str)
IO_METHOD(IoClutterColor, fromString) {
  ClutterColor color;
  char *seq = CSTRING(IoMessage_locals_seqArgAt_(m, locals, 0));
  clutter_color_from_string(&color, seq);

  return IoClutterColor_newWithColor(IOSTATE, color);
}
开发者ID:BMeph,项目名称:io,代码行数:8,代码来源:IoClutterColor.c

示例14: IO_METHOD

IO_METHOD(IoFile, write)
{
	/*doc File write(aSequence1, aSequence2, ...)
	Writes the arguments to the receiver file. Returns self.
	*/

	int i;

	IoFile_assertOpen(self, locals, m);
	IoFile_assertWrite(self, locals, m);

	for (i = 0; i < IoMessage_argCount(m); i ++)
	{
		IoSymbol *string = IoMessage_locals_seqArgAt_(m, locals, i);
		UArray_writeToCStream_(IoSeq_rawUArray(string), DATA(self)->stream);

		if (ferror(DATA(self)->stream) != 0)
		{
			IoState_error_(IOSTATE, m, "error writing to file '%s'",
							UTF8CSTRING(DATA(self)->path));
		}
	}

	return self;
}
开发者ID:achoy,项目名称:io,代码行数:25,代码来源:IoFile.c

示例15: IoMessage_locals_seqArgAt_

IoObject *IoTagDB_idForSymbol(IoTagDB *self, IoObject *locals, IoMessage *m)
{
	/*doc TagDB idForSymbol(aSeq)
	Returns the TagDB id Number for the symbol specified by aSeq.
	*/
	IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
	return IONUMBER(TagDB_idForSymbol_size_(DATA(self), CSTRING(key), IoSeq_rawSize(key)));
}
开发者ID:Akiyah,项目名称:io,代码行数:8,代码来源:IoTagDB.c


注:本文中的IoMessage_locals_seqArgAt_函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。