The CORTEX Function Reference Manual




void AbortCSS ()

Purpose: AbortCSS() can be used to abort out of a trial from a timing file. It is the same function that is used internally in Cortex when some huge error occurs (like the stack overflows), or if the user presses CTRL-BREAK three times to kill the running trials. It stops the clock and cleans up a bit by resetting some of the internal flags. There is no reason to use this function in a timing file under normal circumstances. Instead, it makes more sense to restructure the timing file so that the trial ends normally. Cortex automatically cleans up the necessary flags between trials.

Parameters: none

Returns: none

Platform: DOS and Windows


intPlatform: DOS and Windows


floatPlatform: DOS and Windows


float asin (float value)

Purpose: find arc-sine

Returns: the arc-sine of value.

See also: acos(), atan(), atan2(), cos(), cosh(), sin(), sinh(), tan(), tanh()

Platform: DOS and Windows


float atan (float value)

Purpose: find arctangent

Returns: the arc-tangent of value.

See also: asin(), acos(), atan2(), cos(), cosh(), sin(), sinh(), tan(), tanh()

Platform: DOS and Windows


float atan2 (float y, float x)

Purpose: find arc-tangent of y/x

Returns: the arc-tangent of y/x. Handles equation correctly even if x is equal to zero.

See also: asin(), acos(), atan(), cos(), cosh(), sin(), sinh(), tan(), tanh()

Platform: DOS and Windows


float atof (pchar string)

Purpose: converts a string to a double

Returns: a float value converted from the string.

See also: atoi(), atol()

Platform: DOS and Windows


int atoi (pchar string)

Purpose: converts a string to an integer

Returns: an integer value converted from the string.

See also: atof(), atol()

Platform: DOS and Windows


long atol (pchar string)

Purpose: converts a string to a long

Returns: a long value converted from the string.

See also: atof(), atoi()

Platform: DOS and Windows


int BLOCKclear_stats(int block_or_condition, int which_one);

Purpose: clears the percent correct and circular buffer tables for a given block or condition.

Returns: 1 if valid block or condition number was made, 0 if not.

See also: BLOCKget_pct_correct(), BLOCKget_stats()

Platform: DOS and Windows


int BLOCKget_block_num()

Purpose: Gets current block number

Parameters: none

Returns: current block number

See also: BLOCKget_cond_num(), BLOCKset_next(), get_block_num(), get_cond_num()

Platform: DOS and Windows


int BLOCKget_cond_num()

Purpose: Gets current condition number

Parameters: none

Returns: current condition number

See also: BLOCKget_block_num(), BLOCKset_next(), get_block_num(), get_cond_num()

Platform: DOS and Windows


int BLOCKget_control_info (int block, pfloat minPctOK, pint minTrials, pint recentOK, pint recentDone, pint max_errors, pint max_retries, pint recentOKtooLow, pfloat PctOKtooLow)

Purpose: Gets the current values of these various variables for staircase design. At the end of each trial, these variables are used to check to see if the current block should be considered either unfinished (ie. may need to run some more depending on the parameters set in the Run:Parameters:Block/Repeat family of menus), correct (ie. finished and not to be run again), or aborted (not to be run again because the subject made too many mistakes). These are the exact names of the variables as shown in the Run:Parameters:Block/Repeat:Individual Blocks menu (with the menu length set to "full"). A value of zero for any one of these variables means that it is currently not being tested at the end of the trial.

Parameters:

Returns: 1 if valid block is specified, 0 if not

See also: BLOCKset_control_info()

Platform: DOS and Windows


int BLOCKget_max_vals (pint max_cond)

Purpose: Gets max_block and max_cond values. This could have been done via an external variable, but if these values were inadvertently changed, the system would crash.

Parameters: pint max_cond

Returns: the current maximum block values

See also: BLOCKset_next()

Platform: DOS and Windows


float BLOCKget_pct_correct (int block_or_condition, int which_one)

Purpose: Gets percent correct information for a given block or condition.

Parameters:

Returns: the percent correct information for a given block or condition, or -1 if unsuccessful.

See also: BLOCKclear_stats(), BLOCKget_stats(), get_block_pct_correct(), get_cond_pct_correct()

Platform: DOS and Windows


int BLOCKget_stats (int block_or_condition, int which_one, pint num_correct, pint num_trials, ppchar circular_buffer)

Purpose: gets the circular buffer, number of correct trials, and the number of total trials for a given block condition.

Parameters:

Returns: a non zero value if valid selection is made, 0 if pointers are not yet set

See also: BLOCKclear_stats(), BLOCKget_pct_correct(), get_block_pct_correct(), get_cond_pct_correct()

Platform: DOS and Windows


int BLOCKset_control_info (int block, float minPctOK, int minTrials, int recentOK, int recentDone, int max_errors, int max_retries, int recentOKtooLow, float PctOKtooLow)

Purpose: sets the current values of these various variables for staircase design. At the end of each trial, these variables are used to check to see if the current block should be considered either unfinished (ie. may need to run some more depending on the parameters set in the Run:Parameters:Block/Repeat family of menus), correct (ie. finished and not to be run again), or aborted (not to be run again because the subject made too many mistakes). These are the exact names of the variables as shown in the Run:Parameters:Block/Repeat:Individual Blocks menu (with the menu length set to "full"). A value of zero for any one of these variables means that it is currently not being tested at the end of the trial.

Parameters:

Returns: 1 if valid block is specified, 0 if not

See also: BLOCKget_control_info()

Platform: DOS and Windows


int BLOCKset_next (int block, int condition)

Purpose: sets the block and condition to be run in the next trial

Parameters:

Returns: 1 if successful, 0 if not.

See also: break_fixation_error()

Platform: DOS and Windows


void break_fixation_error()

Purpose: Records in the data file that the monkey has broken fixation

Parameters: none

Returns: nothing

Platform: DOS and Windows


void byte_c_out (int byte)

Purpose: Write the given byte to Port C of the PIO24 board. (Note that thisfunction will not work for the PIO24 portion of the CIO-DAS1602/12 or the PCI-DAS1602/12 boards. For those boards, please use the DEVoutp() function.)

Parameters: byte - a single byte (8 bits) of data

Returns: nothing

Platform: DOS and Windows


void byte_out (int byte)

Purpose: Write the given byte to Port C of the PIO24 board. (Note that thisfunction will not work for the PIO24 portion of the CIO-DAS1602/12 or the PCI-DAS1602/12 boards. For those boards, please use the DEVoutp() function.)

Parameters: byte - a single byte (8 bits) of data

Returns: nothing

Platform: DOS and Windows


pchar calloc (int num_elements, int bytes_per_element)

Purpose: allocates an array in memory with elements initialized to 0.

Parameters:

Returns: a pointer to the first element in the array.

See also: free(), malloc(), realloc()

Platform: DOS and Windows


float cart2r (float x, floaty)

Purpose: A Cartesian to polar transform which computes the magnitude (rho) value for the given x, y cartesian coordinates.

Parameters: x and y are the Cartesian cooridinates.

Returns: the magnitude.

Platform: DOS and Windows


float cart2theta (float x, float y)

Purpose: A Cartesian to polar transform which computes the phase angle theta (in degrees) for a given x, y coordinate.

Parameters: x, y are the Cartesian coordinates

Returns: The phase angle theta polar value.

Platform: DOS and Windows


void cartesian2polar (float x, float y, pfloat r, pfloat theta)

Purpose: A Cartesian to polar transform which computes the phase angle theta (in degrees) and the magnitude r, for a given x, y coordinate.

Parameters:

Returns: nothing

Platform: DOS and Windows


int ceil (float value)

Purpose: Calculates the ceiling of a value.

Retuns: the smallest integer that is greater than or equal to value.

See also: floor()

Platform: DOS and Windows


int chdir (pchar new_dir_name)

Purpose: changes the current working directory to new_dir_name

Returns: 0 if successful.

See also: getcwd(), mkdir(), rename(), rmdir()

Platform: DOS and Windows


int chmod (const char *filename, int pmode)

Purpose: Change the file-permission settings. The _chmod function changes the permission setting of the file specified by filename. The permission setting controls read and write access to the file.

Parameters:

Returns: Each of these functions returns 0 if the permission setting is successfully changed. A return value of -1 indicates that the specified file could not be found, in which case errno is set to ENOENT.

Platform: DOS and Windows


int chsize (int handle, long size)

Purpose: Changes the file size.

Parameters:

Returns: _chsize returns the value 0 if the file size is successfully changed. A return value of -1 indicates an error: errno is set to EACCES if the specified file is locked against access, to EBADF if the specified file is read-only or the handle is invalid, or to ENOSPC if no space is left on the device.

Platform: DOS and Windows


void ClearCSSGlobals ()

Purpose: Clears all the external variables that can be set by the user.

Parameters: none

Returns: nothing

Platform: DOS and Windows


void clear_eog()

Purpose: clear the eog display window

Parameters: none

Returns: nothing

Platform: DOS and Windows


int clip (int value, int lower_limit, int upper_limit)

Purpose: clip the range of an integer

Parameters:

Example:

a = clip (a,100,500);
returns a if 100 < a < 500
100 if a <= 100
500 if a >= 500

See also: fclip()

Platform: DOS and Windows


long clock()

Purpose: Calculates the processor time used by the calling process.

Parameters: none

Returns: clock returns the number of clock ticks of elapsed processor time. The returned value is the product of the amount of time that has elapsed since the start of a process and the value of the CLOCKS_PER_SEC constant.

Comments: The clock function tells how much processor time the calling process has used. The time in seconds is approximated by dividing the clock return value by the value of the CLOCKS_PER_SEC constant In Microsoft and Watcom C/C++, the value of CLOCKS_PER_SEC is 1000. Note: In MS-DOS, clock() returns the time elapsed since the process started. This may not be equal to the actual processor time used by the process.

Platform: DOS and Windows


int close (int handle)

Purpose: closes the file indicated by handle

Returns: 0 if successful.

See also: dup(), dup2(), open()

Platform: DOS and Windows


void Cls ()

Purpose: clears the screen to black and resets the cursor position to the top left corner (0, 0). Works in text mode only (SCREENmode(1)).

Parameters: none

Returns: nothing

See also: SCREENmode()

Platform: DOS and Windows


int CLTactivate (int num_entries, int CLTnum, int src_start, int dst_start)

Purpose: Transfer color data from temporary to active CLTs (color lookup tables). The graphics board only has one color palette in use at a time (i.e., the active CLT). To optimize the speed of lookup table operations, any other temporary color palettes must reside in system memory. When this function call is executed, the given temporary CLT is activated on the graphics board.

Parameters: