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


C++ primitiveFail函数代码示例

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


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

示例1: EXPORT

/* win32JoystickDebugPrintRawValues:
	Print the raw values of a readout of the specified joystick.
*/
EXPORT(int) win32JoystickDebugPrintRawValues(void)
{
	int index, err;
	JOYINFO info;

	if(methodArgumentCount() != 1) return primitiveFail();
	index = stackIntegerValue(0);
	if(failed()) return 0;
	if(index < 1 || index > 2) return primitiveFail();

	warnPrintf(TEXT("Raw joystick values (%d):\n"), index);
	err = joyGetPos(index-1, &info);
	if(err != JOYERR_NOERROR) {
		if(err == MMSYSERR_NODRIVER)
			warnPrintf(TEXT("\t<no driver present>\n\n"));
		else if(err == MMSYSERR_INVALPARAM)
			warnPrintf(TEXT("\t<invalid param in joyGetPos()>\n\n"));
		else if(err == MMSYSERR_BADDEVICEID)
			warnPrintf(TEXT("\t<bad device id>\n\n"));
		else if(err == JOYERR_UNPLUGGED)
			warnPrintf(TEXT("\t<joystick unplugged>\n\n"));
		else
			warnPrintf(TEXT("\t<unknown error: %d>\n\n"), err);
	} else {
		warnPrintf(TEXT("\tX: %d\n"), info.wXpos);
		warnPrintf(TEXT("\tY: %d\n"), info.wYpos);
		warnPrintf(TEXT("\tZ: %d\n"), info.wZpos);
		warnPrintf(TEXT("\tButtons: %x\n"), info.wButtons);
	}
	pop(1); /* Leave rcvr on stack */
	return 1;
}
开发者ID:OpenSmalltalk,项目名称:opensmalltalk-vm,代码行数:35,代码来源:sqWin32Joystick.c

示例2: stackLightArrayValue

static sqInt
stackLightArrayValue(sqInt stackIndex)
{
	// B3DAcceleratorPlugin>>#stackLightArrayValue:
    sqInt array;
    sqInt arraySize;
    sqInt i;
    sqInt oop;

	array = stackObjectValue(stackIndex);
	if (array == null) {
return null;
	}
	if (array == (nilObject())) {
		return null;
	}
	if (!((fetchClassOf(array)) == (classArray()))) {
		return primitiveFail();
	}
	arraySize = slotSizeOf(array);
	for (i = 0; i <= (arraySize - 1); i += 1) {
		oop = fetchPointerofObject(i, array);
		if (isIntegerObject(oop)) {
			return primitiveFail();
		}
		if (!((isWords(oop))
			 && ((slotSizeOf(oop)) == 32))) {
			return primitiveFail();
		}
	}
	return array;
}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:32,代码来源:B3DAcceleratorPlugin.c

示例3: primitiveSetViewport

primitiveSetViewport(void)
{
	// B3DAcceleratorPlugin>>#primitiveSetViewport
    sqInt h;
    sqInt handle;
    sqInt result;
    sqInt w;
    sqInt x;
    sqInt y;

	if (!((methodArgumentCount()) == 5)) {
		return primitiveFail();
	}
	h = stackIntegerValue(0);
	w = stackIntegerValue(1);
	y = stackIntegerValue(2);
	x = stackIntegerValue(3);
	handle = stackIntegerValue(4);
	if (failed()) {
		return null;
	}
	result = b3dxSetViewport(handle, x, y, w, h);
	if (!result) {
return primitiveFail();
	}
	return pop(5);
}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:27,代码来源:B3DAcceleratorPlugin.c

示例4: primitiveCreateRendererFlags

primitiveCreateRendererFlags(void)
{
	// B3DAcceleratorPlugin>>#primitiveCreateRendererFlags
    sqInt flags;
    sqInt h;
    sqInt result;
    sqInt w;
    sqInt x;
    sqInt y;

	if (!((methodArgumentCount()) == 5)) {
		return primitiveFail();
	}
	h = stackIntegerValue(0);
	w = stackIntegerValue(1);
	y = stackIntegerValue(2);
	x = stackIntegerValue(3);
	flags = stackIntegerValue(4);
	if (failed()) {
		return null;
	}
	result = b3dxCreateRendererFlags(x, y, w, h, flags);
	if (result < 0) {
return primitiveFail();
	}
	pop(6);
	return pushInteger(result);
}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:28,代码来源:B3DAcceleratorPlugin.c

示例5: primitiveFileTruncate

primitiveFileTruncate(void)
{
	// FilePlugin>>#primitiveFileTruncate
    SQFile *file;
    sqInt objectPointer;
    sqInt sz;
    squeakFileOffsetType truncatePosition;

	if (!(isIntegerObject(stackValue(0)))) {
		sz = sizeof(squeakFileOffsetType);
		if ((byteSizeOf(stackValue(0))) > sz) {
			return primitiveFail();
		}
	}
	truncatePosition = positive64BitValueOf(stackValue(0));
	/* begin fileValueOf: */
	objectPointer = stackValue(1);
	if (!((isBytes(objectPointer))
		 && ((byteSizeOf(objectPointer)) == (sizeof(SQFile))))) {
		primitiveFail();
		file = null;
		goto l1;
	}
	file = firstIndexableField(objectPointer);
l1:	/* end fileValueOf: */;
	if (!(failed())) {
		sqFileTruncate(file, truncatePosition);
	}
	if (!(failed())) {
		pop(2);
	}
}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:32,代码来源:FilePlugin.c

示例6: primitiveFileDelete

primitiveFileDelete(void)
{
	// FilePlugin>>#primitiveFileDelete
    char *nameIndex;
    sqInt namePointer;
    sqInt nameSize;
    sqInt okToDelete;

	namePointer = stackValue(0);
	if (!(isBytes(namePointer))) {
		return primitiveFail();
	}
	nameIndex = firstIndexableField(namePointer);

	/* If the security plugin can be loaded, use it to check for permission.
	   If not, assume it's ok */

	nameSize = byteSizeOf(namePointer);
	if (sCDFfn != 0) {
		okToDelete =  ((sqInt (*)(char *, sqInt))sCDFfn)(nameIndex, nameSize);
		if (!okToDelete) {
return primitiveFail();
		}
	}
	sqFileDeleteNameSize(nameIndex, nameSize);
	if (!(failed())) {
		pop(1);
	}
}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:29,代码来源:FilePlugin.c

示例7: display_primitivePluginRequestURLStream

/*
  primitivePluginRequestUrlStream: url with: semaIndex
  Request a URL from the browser. Signal semaIndex
  when the result of the request can be queried.
  Returns a handle used in subsequent calls to plugin
  stream functions.
  Note: A request id is the index into requests[].
*/
int display_primitivePluginRequestURLStream()
{
    sqStreamRequest *req;
    int id, url, length, semaIndex;

    if (!inBrowser) return primitiveFail();

    DPRINT("VM: primitivePluginRequestURLStream()\n");

    for (id=0; id<MAX_REQUESTS; id++) {
        if (!requests[id]) break;
    }
    if (id >= MAX_REQUESTS) return primitiveFail();

    semaIndex= stackIntegerValue(0);
    url= stackObjectValue(1);
    if (failed()) return 0;

    if (!isBytes(url)) return primitiveFail();

    req= calloc(1, sizeof(sqStreamRequest));
    if (!req) return primitiveFail();
    req->localName= NULL;
    req->semaIndex= semaIndex;
    req->state= -1;
    requests[id]= req;

    length= byteSizeOf(url);
    browserGetURLRequest(id, firstIndexableField(url), length, NULL, 0);
    pop(3);
    push(positive32BitIntegerFor(id));
    DPRINT("VM:   request id: %i\n", id);
    return 1;
}
开发者ID:Rydier,项目名称:opensmalltalk-vm,代码行数:42,代码来源:sqUnixMozilla.c

示例8: primitiveSetFog

primitiveSetFog(void)
{
	// B3DAcceleratorPlugin>>#primitiveSetFog
    double density;
    sqInt fogType;
    sqInt handle;
    sqInt result;
    sqInt rgba;
    double start;
    double stop;

	if (!((methodArgumentCount()) == 6)) {
		return primitiveFail();
	}
	rgba = positive32BitValueOf(stackValue(0));
	stop = floatValueOf(stackValue(1));
	start = floatValueOf(stackValue(2));
	density = floatValueOf(stackValue(3));
	fogType = stackIntegerValue(4);
	handle = stackIntegerValue(5);
	if (failed()) {
		return null;
	}
	result = b3dxSetFog(handle, fogType, density, start, stop, rgba);
	if (!result) {
return primitiveFail();
	}
	return pop(6);
}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:29,代码来源:B3DAcceleratorPlugin.c

示例9: primitiveDivFloatArray

primitiveDivFloatArray(void)
{
    sqInt arg;
    float *argPtr;
    sqInt i;
    sqInt length;
    sqInt rcvr;
    float *rcvrPtr;

	arg = stackValue(0);
	rcvr = stackValue(1);
	if (!((isWords(arg))
		 && ((isWords(rcvr))
		 && (((length = stSizeOf(arg))) == (stSizeOf(rcvr)))))) {
		return primitiveFail();
	}
	rcvrPtr = ((float *) (firstIndexableField(rcvr)));

	/* Check if any of the argument's values is zero */
	argPtr = ((float *) (firstIndexableField(arg)));
	for (i = 0; i < length; i += 1) {
		if ((intAtPointer(((char*) (argPtr + i)))) == 0) {
			return primitiveFail();
		}
	}
	for (i = 0; i < length; i += 1) {
		rcvrPtr[i] = ((((double) (rcvrPtr[i]))) / (((double) (argPtr[i]))));
	}
	pop(1);
	return 0;
}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:31,代码来源:FloatArrayPlugin.c

示例10: primitiveAioEnable

primitiveAioEnable(void)
{
    static int eventSemaphoreIndices[FD_SETSIZE];
    sqInt externalObject;
    sqInt fd;
    sqInt flags;
    sqInt semaIndex;

	if ((nilObject()) == (stackValue(2))) {
		return primitiveFail();
	}
	fd = stackIntegerValue(2);
	if (fd < 0) {
		return primitiveFail();
	}
	semaIndex = stackIntegerValue(1);
	eventSemaphoreIndices[semaIndex] = semaIndex;
	externalObject = stackObjectValue(0);
	if (externalObject == (trueObject())) {
		flags = AIO_EXT;
	}
	else {
		flags = 0;
	}
	aioEnable(fd, &(eventSemaphoreIndices[semaIndex]), flags);
	pop(4);
	pushInteger(semaIndex);
	return 0;
}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:29,代码来源:AioPlugin.c

示例11: primitiveDropRequestFileName

primitiveDropRequestFileName(void)
{
    sqInt dropIndex;
    char *dropName;
    sqInt i;
    sqInt nameLength;
    sqInt nameOop;
    char *namePtr;

	if (!((methodArgumentCount()) == 1)) {
		return primitiveFail();
	}
	dropIndex = stackIntegerValue(0);

	/* dropRequestFileName returns name or NULL on error */
	dropName = dropRequestFileName(dropIndex);
	if (dropName == null) {
		return primitiveFail();
	}
	nameLength = strlen(dropName);
	nameOop = instantiateClassindexableSize(classString(), nameLength);
	namePtr = firstIndexableField(nameOop);
	for (i = 0; i < nameLength; i += 1) {
		namePtr[i] = (dropName[i]);
	}
	pop(2);
	push(nameOop);
	return 0;
}
开发者ID:estebanlm,项目名称:opensmalltalk-vm,代码行数:29,代码来源:DropPlugin.c

示例12: primitiveAioSuspend

primitiveAioSuspend(void)
{
    sqInt exceptionWatch;
    sqInt fd;
    sqInt flags;
    sqInt readWatch;
    sqInt writeWatch;

	if ((nilObject()) == (stackValue(3))) {
		return primitiveFail();
	}
	fd = stackIntegerValue(3);
	if (fd < 0) {
		return primitiveFail();
	}
	exceptionWatch = stackObjectValue(2);
	readWatch = stackObjectValue(1);
	writeWatch = stackObjectValue(0);
	flags = 0;
	if (exceptionWatch == (trueObject())) {
		flags = flags | (AIO_X);
	}
	if (readWatch == (trueObject())) {
		flags = flags | (AIO_R);
	}
	if (writeWatch == (trueObject())) {
		flags = flags | (AIO_W);
	}
	aioSuspend(fd, flags);
	pop(5);
	pushInteger(flags);
	return 0;
}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:33,代码来源:AioPlugin.c

示例13: primitiveDirectoryDelete

primitiveDirectoryDelete(void)
{
	// FilePlugin>>#primitiveDirectoryDelete
    sqInt dirName;
    char *dirNameIndex;
    sqInt dirNameSize;
    sqInt okToDelete;

	dirName = stackValue(0);
	if (!(isBytes(dirName))) {
		return primitiveFail();
	}
	dirNameIndex = firstIndexableField(dirName);

	/* If the security plugin can be loaded, use it to check for permission.
	   If not, assume it's ok */

	dirNameSize = byteSizeOf(dirName);
	if (sCDPfn != 0) {
		okToDelete =  ((sqInt (*)(char *, sqInt))sCDPfn)(dirNameIndex, dirNameSize);
		if (!okToDelete) {
return primitiveFail();
		}
	}
	if (!(dir_Delete(dirNameIndex, dirNameSize))) {
		return primitiveFail();
	}
	pop(1);
}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:29,代码来源:FilePlugin.c

示例14: primitiveCreateRenderer

primitiveCreateRenderer(void)
{
	// B3DAcceleratorPlugin>>#primitiveCreateRenderer
    sqInt allowHardware;
    sqInt allowSoftware;
    sqInt h;
    sqInt result;
    sqInt w;
    sqInt x;
    sqInt y;

	if (!((methodArgumentCount()) == 6)) {
		return primitiveFail();
	}
	h = stackIntegerValue(0);
	w = stackIntegerValue(1);
	y = stackIntegerValue(2);
	x = stackIntegerValue(3);
	allowHardware = booleanValueOf(stackValue(4));
	allowSoftware = booleanValueOf(stackValue(5));
	if (failed()) {
		return null;
	}
	result = b3dxCreateRenderer(allowSoftware, allowHardware, x, y, w, h);
	if (result < 0) {
return primitiveFail();
	}
	pop(7);
	return pushInteger(result);
}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:30,代码来源:B3DAcceleratorPlugin.c

示例15: primitiveCompositeTexture

primitiveCompositeTexture(void)
{
	// B3DAcceleratorPlugin>>#primitiveCompositeTexture
    sqInt h;
    sqInt rendererHandle;
    sqInt result;
    sqInt texHandle;
    sqInt translucent;
    sqInt w;
    sqInt x;
    sqInt y;

	if (!((methodArgumentCount()) == 7)) {
		return primitiveFail();
	}
	translucent = booleanValueOf(stackValue(0));
	h = stackIntegerValue(1);
	w = stackIntegerValue(2);
	y = stackIntegerValue(3);
	x = stackIntegerValue(4);
	texHandle = stackIntegerValue(5);
	rendererHandle = stackIntegerValue(6);
	if (failed()) {
		return null;
	}
	result = b3dxCompositeTexture(rendererHandle, texHandle, x, y, w, h, translucent);
	if (!result) {
return primitiveFail();
	}
	return pop(7);
}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:31,代码来源:B3DAcceleratorPlugin.c


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