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


C++ IoMessage_argCount函数代码示例

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


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

示例1: 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

示例2: 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

示例3: IO_METHOD

IO_METHOD(IoObject, shellExecute)
{
	LPCTSTR operation;
	LPCTSTR file;
	LPCTSTR parameters;
	LPCTSTR directory;
	int displayFlag;
	int result;

	operation = CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 0));
	file = CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 1));
	parameters = IoMessage_argCount(m) > 2 ? CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 2)) : NULL;
	directory = IoMessage_argCount(m) > 3 ? CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 3)) : NULL;
	displayFlag = IoMessage_argCount(m) > 4 ? IoMessage_locals_intArgAt_(m, locals, 4) : SW_SHOWNORMAL;

	result = (int)ShellExecute(NULL, operation, file, parameters, directory, displayFlag);

	if(result > 32)
	{
		return self;
	}
	else
	{
		return (IoObject *)IoError_newWithMessageFormat_(IOSTATE, "ShellExecute Error %i", result);
	}
}
开发者ID:Habaut,项目名称:GameBindings,代码行数:26,代码来源:IoSystem.c

示例4: RandomGen_randomDouble

IoObject *IoRandom_value(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc Random value(optionalArg1, optionalArg2)
	If called with:
	<ul>
	<li> no arguments, it returns a floating point
	random Number between 0 and 1.
	<li> one argument, it returns a floating point random
	Number between 0 and optionalArg1.
	<li> two arguments, it returns a floating point random
	Number between optionalArg1 and optionalArg2.
	</ul>
	*/

	double f = RandomGen_randomDouble(DATA(self));
	double result = 0;

	if (IoMessage_argCount(m) > 0)
	{
		double a = IoMessage_locals_doubleArgAt_(m, locals, 0);

		if (IoMessage_argCount(m) > 1)
		{
			double b = IoMessage_locals_doubleArgAt_(m, locals, 1);

			if (a == b )
			{
				result = a;
			}
			else
			{
				result = a + (b - a) * f;
			}
		}
		else
		{
			if (a == 0)
			{
				result = 0;
			}
			else
			{
				result = a * f;
			}
		}
	}
	else
	{
		result = f;
	}

	return IONUMBER(result);
}
开发者ID:Akiyah,项目名称:io,代码行数:53,代码来源:IoRandom.c

示例5: IO_METHOD

IO_METHOD(IoDuration, asString)
{
/*doc Duration asString(formatString)
Returns a string representation of the receiver. The formatString argument is optional. If present, the returned string will be formatted according to ANSI C date formating rules.
<p>
<pre>	
%y years without century as two-digit decimal number (00-99)
%Y year with century as four-digit decimal number

%d days
%H hour as two-digit 24-hour clock decimal integer (00-23)
%M minute as a two-digit decimal integer (00-59)
%S second as a two-digit decimal integer (00-59)

The default format is "%Y %d %H:%M:%S".
</pre>
*/
	UArray *ba;
	char *format = NULL;

	if (IoMessage_argCount(m) == 1)
	{
		format = CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 0));
	}

	ba = Duration_asUArrayWithFormat_(DATA(self), format);
	return IoState_symbolWithUArray_copy_convertToFixedWidth(IOSTATE, ba, 0);
}
开发者ID:ADTSH,项目名称:io,代码行数:28,代码来源:IoDuration.c

示例6: 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

示例7: IO_METHOD

IO_METHOD(IoDirectory, exists)
{
	/*doc Directory exists(optionalPath)
	Returns true if the Directory path exists, and false otherwise.
	If optionalPath string is provided, it tests the existance of that path instead. 
	*/

	IoSymbol *path = DATA(self)->path;
	DIR *dirp;

	if (IoMessage_argCount(m) > 0)
	{
		path = IoMessage_locals_symbolArgAt_(m, locals, 0);
	}

	dirp = opendir(CSTRING(path));

	if (!dirp)
	{
		return IOFALSE(self);
	}

	(void)closedir(dirp);
	return IOTRUE(self);
}
开发者ID:Akiyah,项目名称:io,代码行数:25,代码来源:IoDirectory.c

示例8: IO_METHOD

IO_METHOD(IoCFunction, performOn)
{
	/*doc CFunction performOn(target, blockLocals, optionalMessage, optionalContext)
	Activates the CFunctions with the supplied settings.
	*/

	IoObject *bTarget = IoMessage_locals_valueArgAt_(m, locals, 0);
	IoObject *bLocals = locals;
	IoObject *bMessage = m;
	IoObject *bContext = bTarget;
	int argCount = IoMessage_argCount(m);

	if (argCount > 1)
	{
		bLocals = IoMessage_locals_valueArgAt_(m, locals, 1);
	}

	if (argCount > 2)
	{
		bMessage = IoMessage_locals_valueArgAt_(m, locals, 2);
	}

	if (argCount > 3)
	{
		bContext = IoMessage_locals_valueArgAt_(m, locals, 3);
	}

	return IoCFunction_activate(self, bTarget, bLocals, bMessage, bContext);
}
开发者ID:doublec,项目名称:io,代码行数:29,代码来源:IoCFunction.c

示例9: DynLib_pointerForSymbolName_

IoDynLib *IoDynLib_callPluginInitFunc(IoDynLib *self, IoObject *locals, IoMessage *m)
{
	/*doc DynLib callPluginInit(functionName)
	Call's the dll function of the specified name. 
	Returns the result as a Number or raises an exception on error.
	*/
	
	intptr_t rc = 0;
	intptr_t *params = NULL;
	void *f = DynLib_pointerForSymbolName_(DATA(self),
									CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 0)));
	if (f == NULL)
	{
		IoState_error_(IOSTATE, m, "Error resolving call '%s'.",
					CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 0)));
		return IONIL(self);
	}

	if (IoMessage_argCount(m) < 1)
	{
		IoState_error_(IOSTATE, m, "Error, you must give an init function name to check for.");
		return IONIL(self);
	}

	params = io_calloc(1, sizeof(intptr_t) * 2);

	params[0] = (intptr_t)IOSTATE;
	params[1] = (intptr_t)IOSTATE->lobby;
	rc = ((intptr_t (*)(intptr_t, intptr_t))f)(params[0], params[1]);
	io_free(params);

	return IONUMBER(rc);
}
开发者ID:Habaut,项目名称:GameBindings,代码行数:33,代码来源:IoDynLib.c

示例10: IoSeq_assertIsVector

IoObject *IoSeq_drawQuad(IoSeq *self, IoObject *locals, IoMessage *m)
{
	IoSeq_assertIsVector(self, locals, m);
	{
	vec2f p = IoSeq_vec2f(self);
	double x, y, w, h;
	double s = 0;

	if (IoMessage_argCount(m) > 1)
	{
		s = -IoMessage_locals_doubleArgAt_(m, locals, 1);
	}

	x = s;
	y = s;
	w = (p.x) - (s*2);
	h = (p.y) - (s*2);

	glBegin(GL_QUADS);
	glVertex2d(w, h);
	glVertex2d(x, h);
	glVertex2d(x, y);
	glVertex2d(w, y);
	glEnd();
	}
	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:27,代码来源:IoVector_gl.c

示例11: IO_METHOD

IO_METHOD(IoSeq, inclusiveSlice)
{
	/*doc Sequence inclusiveSlice(inclusiveStartIndex, inclusiveEndIndex)
	Returns a new string containing the subset of the
	receiver from the inclusiveStartIndex to the inclusiveEndIndex. The inclusiveEndIndex argument
	is optional. If not given, it is assumed to be the end of the string. 
	*/

	long fromIndex = IoMessage_locals_longArgAt_(m, locals, 0);
	long last = UArray_size(DATA(self));
	UArray *ba;

	if (IoMessage_argCount(m) > 1)
	{
		last = IoMessage_locals_longArgAt_(m, locals, 1);
	}

	if (last == -1)
	{
		last = UArray_size(DATA(self));
	}
	else
	{
		last = last + 1;
	}
	
	ba = UArray_slice(DATA(self), fromIndex, last);

	if (ISSYMBOL(self))
	{
		return IoState_symbolWithUArray_copy_(IOSTATE, ba, 0);
	}

	return IoSeq_newWithUArray_copy_(IOSTATE, ba, 0);
}
开发者ID:doublec,项目名称:io,代码行数:35,代码来源:IoSeq_immutable.c

示例12: 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

示例13: 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

示例14: IO_METHOD

IO_METHOD(IoNumber, asString)
{
/*doc Number asString(optionalIntegerDigits, optionalFactionDigits)
Returns a string representation of the receiver. For example:
<pre>
1234.5678 asString(0, 2)
</pre>	
would return:
<pre>
1234.57
</pre>	
*/
	
	if (IoMessage_argCount(m) >= 1)
	{
		int whole = IoMessage_locals_intArgAt_(m, locals, 0);
		int part = 6;
		char *s;
		size_t length;
		IoObject *n;


		if (IoMessage_argCount(m) >= 2)
		{
			part = abs(IoMessage_locals_intArgAt_(m, locals, 1));
		}

		part  = abs(part);
		whole = abs(whole);

		// If whole == 0, printf might need an arbitary size string. Instead of
		// second guessing the size, pick a really big size: 1024.
		length = 1024;
		s = io_calloc(1, length);

		snprintf(s, length, "%*.*f", whole, part, DATA(self));

		n = IOSEQ((unsigned char *)s, (size_t)strlen(s));

		io_free(s);

		return n;
	}

	return IoNumber_justAsString(self, locals, m);
}
开发者ID:Akiyah,项目名称:io,代码行数:46,代码来源:IoNumber.c

示例15: IoBuffer_rawUArray

IoObject *IoMP3Encoder_encode(IoMP3Encoder *self, IoObject *locals, IoMessage *m)
{
    UArray *inBa = IoBuffer_rawUArray(IoMessage_locals_bufferArgAt_(m, locals, 0));
    /*UArray *outBa = IoBuffer_rawUArray(DATA(self)->outBuffer);*/
    
    int start = 0;
    int end = UArray_length(inBa);
    
    if (IoMessage_argCount(m) > 1) start = IoMessage_locals_intArgAt_(m, locals, 1);
    if (IoMessage_argCount(m) > 2) end = IoMessage_locals_intArgAt_(m, locals, 2);
    if (start > end)
    { IoState_error_description_(IOSTATE, m, "MP3Encoder", "range error: start > end"); }
    if (end > UArray_length(inBa))
    { IoState_error_description_(IOSTATE, m, "MP3Encoder", "range error: end > length of input buffer"); }
    
    MP3Encoder_encode(DATA(self)->encoder, UArray_bytes(inBa) + start, end);
    
    return IoMP3Encoder_checkError(self, locals, m);
}
开发者ID:Akiyah,项目名称:io,代码行数:19,代码来源:IoMP3Encoder.c


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