本文整理汇总了C++中PsychCapNumInputArgs函数的典型用法代码示例。如果您正苦于以下问题:C++ PsychCapNumInputArgs函数的具体用法?C++ PsychCapNumInputArgs怎么用?C++ PsychCapNumInputArgs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PsychCapNumInputArgs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FONTSFonts
PsychError FONTSFonts(void)
{
PsychGenericScriptType *nativeStructArray;
int arrayIndex, numFonts;
PsychFontStructType **fontPointerList, *fontElement;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check for required and superfluous arguments
PsychErrorExit(PsychCapNumOutputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(0));
//build a list of pointers to all the the font records in the font list, then hand the list of pointers to PsychCopyFontRecordsToNativeStructArray()
//to get a native struct array of font records and return it to the scripting environment.
arrayIndex=0;
numFonts=PsychGetFontListLength();
fontPointerList=(PsychFontStructType**)malloc(numFonts * sizeof(PsychFontStructType*));
for(fontElement=PsychGetFontListHead();fontElement;fontElement=fontElement->next)
fontPointerList[arrayIndex++]=fontElement;
PsychCopyFontRecordsToNativeStructArray(numFonts, fontPointerList, &nativeStructArray);
free((void*)fontPointerList);
PsychAssignOutStructArray(1, FALSE, nativeStructArray);
return(PsychError_none);
}
示例2: SCREENCloseMovie
PsychError SCREENCloseMovie(void)
{
int moviehandle = -1;
// All sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none);};
PsychErrorExit(PsychCapNumInputArgs(1)); // Max. 1 input args.
PsychErrorExit(PsychRequireNumInputArgs(1)); // Min. 1 input args required.
PsychErrorExit(PsychCapNumOutputArgs(0)); // No output args.
// Get the window record from the window record argument and get info from the window record
//PsychAllocInWindowRecordArg(kPsychUseDefaultArgPosition, TRUE, &windowRecord);
// Get the movie handle:
PsychCopyInIntegerArg(1, TRUE, &moviehandle);
if (moviehandle==-1) {
PsychErrorExitMsg(PsychError_user, "CloseMovie called without valid handle to a movie object.");
}
// Try to delete the movie object, releasing all associated ressources:
PsychDeleteMovie(moviehandle);
return(PsychError_none);
}
示例3: PSYCHHIDGiveMeReports
PsychError PSYCHHIDGiveMeReports(void)
{
PsychGenericScriptType *outErr;
const char *fieldNames[] = {"n", "name", "description"};
char *name = "", *description = "";
long error = 0;
int deviceIndex;
int reportBytes = 1024;
PsychPushHelp(useString,synopsisString,seeAlsoString);
if (PsychIsGiveHelp()) { PsychGiveHelp(); return(PsychError_none); };
PsychErrorExit(PsychCapNumOutputArgs(2));
PsychErrorExit(PsychCapNumInputArgs(2));
PsychCopyInIntegerArg(1,TRUE,&deviceIndex);
PsychCopyInIntegerArg(2,false,&reportBytes);
PsychHIDVerifyInit();
// Returns 1st return argument 'reports':
error = GiveMeReports(deviceIndex,reportBytes); // PsychHIDReceiveReports.c
// Return 2nd return argument 'err' struct:
PsychHIDErrors(NULL, error, &name, &description);
PsychAllocOutStructArray(2, kPsychArgOptional, -1, 3, fieldNames, &outErr);
PsychSetStructArrayStringElement("name", 0, name, outErr);
PsychSetStructArrayStringElement("description", 0, description, outErr);
PsychSetStructArrayDoubleElement("n", 0, (double) error, outErr);
return(PsychError_none);
}
示例4: PSYCHHIDKbCheck
PsychError PSYCHHIDKbCheck(void)
{
int deviceIndex;
int m, n, p;
double *scanList = NULL;
psych_bool isDeviceSpecified;
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
PsychErrorExit(PsychCapNumOutputArgs(3));
PsychErrorExit(PsychCapNumInputArgs(2));
// Choose the device index and its record
isDeviceSpecified=PsychCopyInIntegerArg(1, FALSE, &deviceIndex);
if (!isDeviceSpecified) {
// set the keyboard or keypad device to be the first keyboard device or, if no keyboard, the first keypad
deviceIndex = INT_MAX;
}
// Optional 2nd argument 'scanlist' provided?
if (PsychAllocInDoubleMatArg(2, FALSE, &m, &n, &p, &scanList)) {
// Yep. Matching size?
if (p!=1 || m * n != 256) PsychErrorExitMsg(PsychError_user, "Provided 'scanList' parameter is not a vector of 256 doubles, as required!");
}
return(PsychHIDOSKbCheck(deviceIndex, scanList));
}
示例5: SCREENTexturizeOffscreenWindows
PsychError SCREENTexturizeOffscreenWindows(void)
{
PsychWindowRecordType **windowRecordArray;
int i, numWindows;
//all subfunctions should have these two lines.
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check for superfluous or missing arguments
PsychErrorExit(PsychCapNumInputArgs(0));
PsychErrorExit(PsychRequireNumInputArgs(0));
PsychCreateVolatileWindowRecordPointerList(&numWindows, &windowRecordArray);
for(i=0;i<numWindows;i++){
if(PsychIsOffscreenWindow(windowRecordArray[i])){
PsychUpdateTargetWindowFromTargetDisplay(windowRecordArray[i]);
PsychAllocateTexture(windowRecordArray[i]);
PsychBindTexture(windowRecordArray[i]);
PsychUpdateTexture(windowRecordArray[i]);
}
}
PsychDestroyVolatileWindowRecordPointerList(windowRecordArray);
return(PsychError_none);
}
示例6: SCREENglLoadIdentity
PsychError SCREENglLoadIdentity(void)
{
// If you change useString then also change the corresponding synopsis string in ScreenSynopsis.c
static char useString[] = "Screen('glLoadIdentity', windowPtr);";
static char synopsisString[] = "Reset an OpenGL matrix to its default identity setting. "
"See <http://www.opengl.org/documentation/red_book_1.0/> Chapter 4 for detailed information.";
static char seeAlsoString[] = "";
PsychWindowRecordType *windowRecord;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString,seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check for superfluous arguments
PsychErrorExit(PsychCapNumInputArgs(1)); // The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(1)); // Number of required inputs.
PsychErrorExit(PsychCapNumOutputArgs(0)); // The maximum number of outputs
//get the window record from the window record argument and get info from the window record
PsychAllocInWindowRecordArg(kPsychUseDefaultArgPosition, TRUE, &windowRecord);
// Switch to windows OpenGL context:
PsychSetGLContext(windowRecord);
// Execute it:
glLoadIdentity();
PsychTestForGLErrors();
//All psychfunctions require this.
return(PsychError_none);
}
示例7: SCREENFinalizeMovie
PsychError SCREENFinalizeMovie(void)
{
static char useString[] = "Screen('FinalizeMovie', moviePtr);";
static char synopsisString[] = "Finish creating a new movie file with handle 'moviePtr' and store it to filesystem.\n";
static char seeAlsoString[] = "CreateMovie AddFrameToMovie CloseMovie PlayMovie GetMovieImage GetMovieTimeIndex SetMovieTimeIndex";
int moviehandle = -1;
// All sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none);};
PsychErrorExit(PsychCapNumInputArgs(1)); // Max. 3 input args.
PsychErrorExit(PsychRequireNumInputArgs(1)); // Min. 2 input args required.
PsychErrorExit(PsychCapNumOutputArgs(0)); // Max. 1 output args.
// Get the moviehandle:
PsychCopyInIntegerArg(1, kPsychArgRequired, &moviehandle);
// Finalize the movie:
if (!PsychFinalizeNewMovieFile(moviehandle)) {
PsychErrorExitMsg(PsychError_user, "FinalizeMovie failed for reason mentioned above.");
}
return(PsychError_none);
}
示例8: GESTALTGestalt
PsychError GESTALTGestalt(void)
{
char *selectorCString;
OSType selectorConstant;
CFStringRef selectorCFString;
OSErr callError;
long responseLong, i;
PsychNativeBooleanType *responseArray;
psych_bool returnResponse;
PsychErrorExit(PsychCapNumOutputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(1));
PsychAllocInCharArg(1, kPsychArgRequired, &selectorCString);
if( strlen(selectorCString) != 4)
PsychErrorExitMsg(PsychError_user, "The selector code must be a four-character string");
selectorCFString=CFStringCreateWithCString (NULL, selectorCString, kCFStringEncodingUTF8);
selectorConstant= UTGetOSTypeFromString(selectorCFString);
callError= Gestalt(selectorConstant, &responseLong);
CFRelease(selectorCFString);
if(callError)
PsychCopyOutDoubleArg(1, kPsychArgOptional, (double)callError);
else{
returnResponse=PsychAllocOutBooleanMatArg(1, kPsychArgOptional, 1, 32, 1, &responseArray);
if(returnResponse){
for(i=0;i<32;i++){
if(1<<i & responseLong)
responseArray[31-i]=TRUE;
else
responseArray[31-i]=FALSE;
}
}
}
return(PsychError_none);
}
示例9: SCREENPixelSize
PsychError SCREENPixelSize(void)
{
int screenNumber;
double depth;
PsychWindowRecordType *windowRecord;
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check to see if the user supplied superfluous arguments
PsychErrorExit(PsychCapNumOutputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(1));
//get specified screen number.
if(PsychIsScreenNumberArg(1)){
PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
depth=(double)PsychGetScreenDepthValue(screenNumber);
}else if(PsychIsWindowIndexArg(1)){
PsychAllocInWindowRecordArg(1,TRUE,&windowRecord);
depth=(double)windowRecord->depth;
}else
PsychErrorExit(PsychError_invalidNumdex);
//Allocate a return matrix and load it with the depth values.
PsychCopyOutDoubleArg(1, FALSE, depth);
return(PsychError_none);
}
示例10: EyelinkGetTrackerVersion
PsychError EyelinkGetTrackerVersion(void)
{
int iVersion=0;
char strVersion[40]="unknown tracker type";
//all sub functions should have these two lines
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
//check to see if the user supplied superfluous arguments
PsychErrorExit(PsychCapNumInputArgs(0));
PsychErrorExit(PsychRequireNumInputArgs(0));
PsychErrorExit(PsychCapNumOutputArgs(2));
// // Verify eyelink is up and running
// EyelinkSystemIsConnected();
// EyelinkSystemIsInitialized();
iVersion = eyelink_get_tracker_version(strVersion);
// mexPrintf("Tracker Version: '%s'\n", strVersion );
PsychCopyOutDoubleArg(1, TRUE, iVersion);
PsychCopyOutCharArg(2, FALSE, strVersion);
return(PsychError_none);
}
示例11: SCREENSetMouseHelper
PsychError SCREENSetMouseHelper(void)
{
int screenNumber;
int xPos, yPos;
int deviceIdx = -1;
int detachFromMouse = 0;
//all subfunctions should have these two lines.
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
PsychErrorExit(PsychCapNumInputArgs(5)); //The maximum number of inputs
PsychErrorExit(PsychCapNumOutputArgs(0)); //The maximum number of outputs
PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
PsychCopyInIntegerArg(2,TRUE, &xPos);
PsychCopyInIntegerArg(3,TRUE, &yPos);
PsychCopyInIntegerArg(4,FALSE, &deviceIdx);
PsychCopyInIntegerArg(5,FALSE, &detachFromMouse);
// Position the cursor. On OSX this will also automatically attach it
// to mouse movement:
PsychPositionCursor(screenNumber, xPos, yPos, deviceIdx);
#if PSYCH_SYSTEM == PSYCH_OSX
if (detachFromMouse) CGAssociateMouseAndMouseCursorPosition(false);
#endif
return(PsychError_none);
}
示例12: PSYCHHIDKbTriggerWait
PsychError PSYCHHIDKbTriggerWait(void)
{
int deviceIndex;
int numScankeys;
int* scanKeys;
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
PsychErrorExit(PsychCapNumOutputArgs(1));
PsychErrorExit(PsychCapNumInputArgs(2)); //Specify trigger key code and the deviceNumber of the keyboard or keypad to scan.
// Identify the mandatory trigger array:
if (!PsychAllocInIntegerListArg(1, TRUE, &numScankeys, &scanKeys)){
PsychErrorExitMsg(PsychError_user, "Keycode is required.");
}
// Get optional deviceIndex:
if (!PsychCopyInIntegerArg(2, FALSE, &deviceIndex)) deviceIndex = -1;
// Execute:
PsychHIDOSKbTriggerWait(deviceIndex, numScankeys, scanKeys);
return(PsychError_none);
}
示例13: EyelinkCurrentMode
PsychError EyelinkCurrentMode(void)
{
int iMode = 0;
// Add help strings
PsychPushHelp(useString, synopsisString, seeAlsoString);
// Output help if asked
if(PsychIsGiveHelp()) {
PsychGiveHelp();
return(PsychError_none);
}
// Check arguments
PsychErrorExit(PsychCapNumInputArgs(0));
PsychErrorExit(PsychRequireNumInputArgs(0));
PsychErrorExit(PsychCapNumOutputArgs(1));
// Verify eyelink is up and running
EyelinkSystemIsConnected();
EyelinkSystemIsInitialized();
iMode = eyelink_current_mode();
// Assign output arg
PsychCopyOutDoubleArg(1, TRUE, iMode);
return(PsychError_none);
}
示例14: IOPORTVerbosity
PsychError IOPORTVerbosity(void)
{
static char useString[] = "oldlevel = IOPort('Verbosity' [,level]);";
static char synopsisString[] =
"Set level of verbosity for error/warning/status messages. 'level' optional, new level "
"of verbosity. 'oldlevel' is the old level of verbosity. The following levels are "
"supported: 0 = Shut up. 1 = Print errors, 2 = Print also warnings, 3 = Print also some info, "
"4 = Print more useful info (default), >5 = Be very verbose (mostly for debugging the driver itself). ";
static char seeAlsoString[] = "";
int level= -1;
// Setup online help:
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none); };
PsychErrorExit(PsychCapNumInputArgs(1)); // The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(0)); // The required number of inputs
PsychErrorExit(PsychCapNumOutputArgs(1)); // The maximum number of outputs
PsychCopyInIntegerArg(1, kPsychArgOptional, &level);
if (level < -1) PsychErrorExitMsg(PsychError_user, "Invalid level of verbosity provided. Valid are levels of zero and greater.");
// Return current/old level:
PsychCopyOutDoubleArg(1, kPsychArgOptional, (double) verbosity);
// Set new level, if one was provided:
if (level > -1) verbosity = level;
return(PsychError_none);
}
示例15: IOPORTClose
// Close given port.
PsychError IOPORTClose(void)
{
static char useString[] = "IOPort('Close', handle);";
static char synopsisString[] =
"Close a I/O port device 'handle'. This works for all device types.\n";
static char seeAlsoString[] = "'CloseAll'";
int handle;
// Setup online help:
PsychPushHelp(useString, synopsisString, seeAlsoString);
if(PsychIsGiveHelp()) {PsychGiveHelp(); return(PsychError_none); };
PsychErrorExit(PsychCapNumInputArgs(1)); // The maximum number of inputs
PsychErrorExit(PsychRequireNumInputArgs(1)); // The required number of inputs
PsychErrorExit(PsychCapNumOutputArgs(0)); // The maximum number of outputs
// Get handle:
PsychCopyInIntegerArg(1, kPsychArgRequired, &handle);
// Close associated port:
PsychCloseIOPort(handle);
return(PsychError_none);
}