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
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
Purpose: find arctangent
Returns: the arc-tangent of value.
See also: asin(), acos(), atan2(), cos(), cosh(), sin(), sinh(), tan(), tanh()
Platform: DOS and Windows
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
Purpose: converts a string to a double
Returns: a float value converted from the string.
Platform: DOS and Windows
Purpose: converts a string to an integer
Returns: an integer value converted from the string.
Platform: DOS and Windows
Purpose: converts a string to a long
Returns: a long value converted from the string.
Platform: DOS and Windows
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.
Platform: DOS and Windows
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
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
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
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
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
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
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
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
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:
Platform: DOS and Windows
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
Purpose: changes the current working directory to new_dir_name
Returns: 0 if successful.
See also: getcwd(), mkdir(), rename(), rmdir()
Platform: DOS and Windows
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:
Platform: DOS and Windows
int chsize (int handle, long size)
Purpose: Changes the file size.
Parameters:
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
Purpose: clip the range of an integer
Parameters:
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
Purpose: closes the file indicated by handle
Returns: 0 if successful.
See also: dup(), dup2(), open()
Platform: DOS and Windows
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
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:
Purpose: Copies color data from the given color lookup table (CLT), into the data variable. Parameters:
Purpose: Gets the R, G, B values for a single entry of a given color lookup table (CLT).
Parameters:
Returns: 1 if successful, otherwise 0.
Platform: DOS and Windows
Purpose: This function transfers data from the graphics board's active palette to a temporary CLT in system memory. When using two computers, this is faster than GDPget_CLTS and CLTupload() to set the values in a palette. Also more convenient for CSS, which doesn't support structures, although it is equally possible to use GDPget_CLTs and know that each element is a byte, and that they are in RGB order.
Parameters:
Returns: 1 if successful, otherwise 0.
Platform: DOS and Windows
Purpose: Sets the R, G, B values for a single entry of a give color lookup table (CLT).
Parameters:
Returns: 1 if successful, otherwise 0.
Platform: DOS and Windows
Purpose: Copies color data from the data structure into the given color lookup table (CLT).
Parameters:
Purpose: Prints the msg string on the screen, then waits for the user's response. The msg string is usually a question requiring a Yes/No answer.
Parameters: msg, the string to be printed on the screen
Returns: 1 if the user responds "Yes", 0 if the user responds "No", and -1 if ESCAPE is pressed.
Platform: DOS only
Purpose: Prints the msg string on the screen, then waits for the user's response. The msg string is a question that requires an answer which is one of the choices provided.
Parameters:
Returns: 1 if a new value has been set, 0 if no change, and -1 if ESCAPE pressed.
Platform: DOS only
Purpose: Prints the message string on the screen, at location (1, y), and then waits for the user\\\'s response. The message string is a question that requires an answer that is one of the choices provided.
Parameters:
Returns: 1 if a new value has been set, 0 if no change, and -1 if ESCAPE pressed.
Platform: DOS only
Purpose: instructs CORTEX to either begin or stop collecting spike data to place in the data file.
Parameter: BOOL (0 = stop collecting data; 1 = collect data)
Returns: nothing
Platform: DOS and Windows
Purpose: identifies when a circle and a rectangular object overlap each other
Parameters:
Returns: 1 if circle and rectangle overlap, 0 if no overlap.
Platform: DOS and Windows
Purpose: find the cosine of a float
Returns: the cosine of value.
See also: acos(), asin(), atan(), atan2(), cosh(), sin(), sinh(), tan(), tanh()
Platform: DOS and Windows
Purpose: find the hyperbolic cosine of a float
Returns: the hyperbolic cosine of value.
See also: acos(), asin(), atan(), atan2(), cos(), sin(), sinh(), tan(), tanh()
Platform: DOS and Windows
Purpose: sets the current text position to the display point (row, column). This call works in text mode only.
Returns: nothing
See also: SCREENmode(), printxy(), printf()
Platform: DOS and Windows
Purpose: Reads a byte from the given port and deive_number.
Parameters:
Returns: a single byte read from port (a part of device_number).
Comments: Each device listed in the CORTEX.CFG file has a corresponding device_number. The first device listed is device number zero. The nth device is device number n-1. Ports are numbered much the same way (base-0). The first parallel port on a parallel device will be port number 0, and the nth will be port number n-1 (Port A = port 0).
See also: DEVinpw(), DEVoutp(), DEVoutpw()
Platform: DOS and Windows
Purpose: Reads two bytes from the given port and device_number
Parameters:
Comments Each device listed in the CORTEX.CFG file has a corresponding device_number. The first device listed is device number zero. The nth device is device number n-1. Ports are numbered much the same way (base-0). The first parallel port on a parallel device will be port number 0, and the nth will be port number n-1 (Port A = port 0). See also: DEVinp(), DEVoutp(), DEVoutpw()
Platform: DOS and Windows
Purpose: outputs a single byte of data on port (a part of device_number), the data sent if successful, else returns -1
Parameters:
See also: DEVinp(), DEVinpw(), DEVoutpw()
Backward Compatibility: byte_out()
Platform: DOS and Windows
Purpose: Writes two bytes of data to the given port and device_number.
Parameters:
Returns: outputs two bytes of data on port (a port of device_number). Returns the data sent if successful, else returns -1.
Comments: Each device listed in the CORTEX.CFG file has a corresponding device_number. The first device listed is device number zero. The nth device is device number n-1. Ports are numbered much the same way (base-0). The first parallel port on a parallel device will be port number 0, and the nth will be port number n-1 (Port A = port 0).
See also: DEVinp(), DEVoutpw(), DEVoutp()
Platform: DOS and Windows
Purpose: show/unshow the path of the eye movement up to a given point in a trial. display_eye_path(1) will draw the eye path, and display_eye_path(0) will erase it.
Parameters: visible or invisible (1 = visible, 0 = invisible)
Returns: nothing
See also: put_data_in_eye_buf()
Backward Compatibility: display_eye_buf()
Platform: DOS and Windows
Purpose: turns on or off the fixation spot, turns on (visible=1) or off (visible=0) the fixation spot
Parameters: visible or invisible (1 = visible, 0 = invisible)
Returns: nothing
See also: display_test(), Gon_off()
Platform: DOS and Windows
Purpose: causes the histogram for the current condition to be displayed (typically called at the start of the trial)
Parameters: none
Returns: nothing
See also: display_trial_progress(), update_histogram()
Platform: DOS and Windows
Purpose: turns on (visible=1) or off (visible=0) the mapping stimulus in play mode
Parameters: visible or invisible (1 = visible, 0 = invisible)
Returns: nothing
See also: display_test(), Gon_off()
Platform: DOS and Windows
Purpose: turns on (visible=1) or off (visible=0) the sample stimulus (the sample stimulus is defined as the item(s) in TEST0 of the current conditions file)
Parameters: visible or invisible (1 = visible, 2 = invisible)
Returns: nothing
See also: display_test(), Gon_off()
Platform: DOS and Windows
Purpose: turns on (visible=1) or off (visible=0) a specified test_screen (TEST1 through TEST9)
Parameters:
Returns: nothing
See also: display_fixspot(), display_play(), display_sample(), Gon_off()
Platform: DOS and Windows
Purpose: turns on (show_progress=1) or off (show_progress=0) the current trial's raster (the progress line) below the histogram display. Also turns on or off the placement of data into the cumulative on-line histogram. Has no effect on the raw data collection. The function is normally turned off while waiting either a random amount of time or waiting for the subject to do something.
Parameters: 0 = turn progress line off, 1 = turn it on
Returns: nothing
See also: display_histogram(), update_histogram()
Platform: DOS and Windows
Purpose: Finds the minimum distance between a line and a point. This function is generally used to determine the amount of error the subject has made during a saccade towards a target (that lies on a line of slope from the origin).
Parameters:
Returns: the minimum distance between a line of slope passing through the origin (the center of the screen; 0 degrees, 0 degrees) and a point defined by (x degrees, y degrees).
See also: EYEget_dva(), find_DC(), find_slope(), in_corridor()
Platform: DOS and Windows
Purpose: To prevent the program from unloading the current condition's worth of graphics information and to prevent the next set from being loaded.
Parameters: none.
Returns: nothing.
Comments: This function may decrease the time needed between trials (especially if the stimuli are complex), but should only be used when every trial uses the same set of graphical items and every condition uses the same items in each test_screen. The dont_unload_conds flag is reset every trial, so this routine must be called every trial if you want the same graphical environment to persist over many trials. Also, if this called on the LAST trial of a run, the graphical environment will persist into the next run (unless you set the option in the Run:Parameters:General menu or quit CORTEX in between runs).
Platform: DOS and Windows
Purpose: draws onto the EOG_DISPLAY a box centered at (X_center, Y_center), of width width, height height and color color (#include css_inc.h in your state function to use its list of colors)
Parameters:
Returns: nothing.
See also: ITEM_POSmark_pos()
Backward Compatibility: mark_screen_pos()
Platform: DOS and Windows
Purpose: Finds the square of the distance between two points, (x1, y1) and (x2, y2).
Parameters:
Purpose: creates a second file handle for a currently open file.
Parameters: Takes the handle of the currently open file.
Returns: the new file handle
See also: close(), dup2(), open()
Platform: DOS and Windows
Purpose: forces handle_2 to refer to a currently open file (referred to by handle_1)
Parameters:
Returns: 0 if successful.
See also: close(), dup(), open()
Platform: DOS and Windows
Purpose: Records an event code in the cortex data file
Parameters: event code
Returns: nothing
See also: EVENT_CODE
Platform: DOS and Windows
Purpose: cleans up after the trial and turns off the mapping stimulus in play mode
Parameters: none
Returns: nothing
Platform: DOS and Windows
Purpose: checks if the current position within the file referred to by handle is end_of_file
Returns: 1 if currently at end_of_file, 0 if not
Platform: DOS and Windows
Purpose: takes a 12-bit, signed integer value, x, and a channel number, chan, and converts them to the format which the EPP buffer expects.
Parameters:
Returns: a 16-bit value (short integer) containing the 12-bit data value, and 4-bits for the channel number
Platform: DOS and Windows
Purpose: Takes the 16-bit EPP value, x, and returns the 4-bit channel number from it.
Parameters: x, a 16-bit value containg the 12-bit data value and the 4-bit channel number
Returns: the channel number
Platform: DOS and Windows
Purpose: Extracts the 12-bit integer data value from the EPP buffer storage format.
Parameters: x, a 16-bit value containg the 12-bit data value and the 4-bit channel number
Returns: the data value
Platform: DOS and Windows
Returns: evalue
See also: log(), log10(), pow()
Platform: DOS and Windows
gets the eye position in degrees of visual angle (dva)
Purpose: gets the eye position in degrees of visual angle (dva)
Parameters:
Returns: nothing
Backward Compatibility: f_get_X(), f_get_Y(), get_fixation_posX(), get_fixation_posY()
Platform: DOS and Windows
Purpose: copies one ITEM_POS or EYE_WIN's center and size into a new EYE_WIN. Values remain until CORTEX is exited or EYE_WINreset() called.
Parameters:
Returns: nothing
See also: EYE_WINreset(), EYE_WINset()
Platform: DOS and Windows
Purpose: clears all of the saved EYE_WINs from the EYE_WIN scratch buffer. Otherwise they remain until CORTEX is exited.
Parameters: none
Returns: nothing
See also: EYE_WINcopy(), EYE_WINset()
Platform: DOS and Windows
Purpose: stores a position (center and size) for future reference.
Parameters:
Returns: 1 if successful, 0 if an invalid selection
Comments: Values remain until CORTEX is exited or EYE_WINreset() is called.
See also: EYE_WINcopy(), EYE_WINreset()
Backward Compatibility: set_position()
Platform: DOS and Windows
Returns: the absolute value of value
See also: abs()
Platform: DOS and Windows
Purpose: clips the range of a floating point value.
Parameters:
Returns: either the original value, the lower limit, or the upper limit.
Example: a = clip (a,100.3,500.1);
returns a if 100.3 < a <500.1
100.3 if a <= 100.3
500.1 if a = 500.1
See also: clip()
Platform: DOS and Windows
Purpose: closes the open file handle fp.
Parameter: fp - pointer to file
Returns: 0 if the file is successfully closed, and non-zero to indicate an error.
Platform: DOS and Windows
Purpose: determines whether the end-of-file has been reached for the file pointed to by fp.
Parameter: fp - pointer to file
Returns: a nonzero value after the first read operation that attempts to read past the end of the file. It returns 0 if the current position is not end of file.
Platform: DOS and Windows
Purpose: tests for a reading or writing error on the file associated with fp.
Parameter: fp - pointer to file
Returns: If no error has occurred on the file, ferror returns 0. Otherwise, it returns a nonzero value.
Platform: DOS and Windows
Purpose: flushes a stream. If the file associated with the stream is open for output, fflush causes any unwritten data to be written to the file. If the file fp is open for input or update, the fflush function undoes the effect of any preceding ungetc operation on the stream. If the value of fp is NULL, then all files that are open will be flushed.
Parameter: fp - pointer to file
Returns: fflush returns 0 if the buffer was successfully flushed. A non-zero return value indicates an error.
Platform: DOS and Windows
Purpose: gets the next character from the file designated by fp.
Parameter: fp - pointer to file
Returns: the character read as an int or return EOF to indicate an error or end of file.
Platform: DOS and Windows
Purpose: gets a string of characters from the file designated by fp and stores them in the array pointed to by buf. The fgets function stops reading characters when end-of-file is reached, or when a newline character is read, or when n-1 characters have been read, whichever comes first.
Parameters:
Returns: returns buf if successful, otherwise 0.
Platform: DOS and Windows
Purpose: finds denominator constant for distance calculation. This is the denominator constant (DC) of a line that stretches between the origin and a point in the visual field of coordinates (target_x, target_y). Using DC removes the need for costly computations of sin or cosine in trigonometric calculations, thus speeding up functions such as in_corridor() and distance_to_line() that require DC as input.
Parameters: targetx, targety - point in the visual field
Returns: 1.0 / sqrt(1.0 + (target_y / target_x)*( target_y / target_x)), i.e., 1/(1+slope^2)
See also: distance_to_line(), find_slope(), in_corridor()
Platform: DOS and Windows
Purpose: find slope of a line formed from the point (target_x, target_y) and the origin (0,0).
Parameters: targetx, targety - point in the visual field
Returns: the slope (target_y / target_x) of a line stretched between the origin and point (target_x, target_y).
See also: distance_to_line(), find_DC(), in_corridor()
Platform: DOS and Windows
Purpose: computes the largest integer not greater than value.
Parameter: value - floating-point value to be manipulated
Returns: a floating-point value representing the largest integer that is less than or equal to value.
Platform: DOS and Windows
Returns: the maximum of two floating point values
See also: fmin(), max(), min()
Platform: DOS and Windows
Returns: the minimum of two floating point values
See also: fmax(), max(), min()
Platform: DOS and Windows
Purpose: opens the file specified by filename.
Parameters:
Returns: a pointer to the open file. A null pointer value indicates an error.
Platform: DOS and Windows
Purpose: to execute simultaneous motion of two test_screens. This function has largely been replaced by Gscroll().
Parameters:
Returns: time remaining (in msec). Returns 0 when done, and turns off both test_screens, waiting until they are actually off before returning.
NOTE: init_foreback() must be called prior to this function.
See also: init_foreback()
Platform: DOS and Windows
Purpose: writes output to the file pointed to by fp under control of the argument format. The format string has the same syntax and use as in printf().
Parameters:
Returns: the number of bytes written. Otherwise, returns a negative value if an output error occurs.
Platform: DOS and Windows
Purpose: writes the character specified by c to the output stream designated by fp.
Parameters:
Returns: the character written; or, if a write error occurs, returns EOF.
Platform: DOS and Windows
Purpose: writes the character string pointed to by buf to the output stream designated by fp.
Parameters:
Returns: returns EOF if an error occurs otherwise, it returns a non-negative value.
Platform: DOS and Windows
Purpose: reads count elements of size bytes each from the file specified by fp into the buffer specified by buffer.
Parameters:
Returns: the number of complete elements actually read, which may be less than count if an error occurs or if the end of the file is encountered before reaching count.
Platform: DOS and Windows
Purpose: frees (un-allocates) the currently allocated memory pointed to by memory_block. Be careful to be sure that the pointer you are freeing is the correct pointer. A misspelling with this function can crash the system or worse.
Parameter: memory_block - previously allocated memory block to be freed
Returns: nothing
See also: calloc(), malloc(), realloc()
Platform: DOS and Windows
Purpose: calculates the amount of freespace in kilobytes, on the drive containing the Cortex data file.
Parameters: none
Returns: the amount of free space in kilobytes.
Platform: DOS and Windows
Purpose: closes the file currently associated with fp. Then, it opens the file named filename and associates this new file with fp.
Parameters:
Returns: a pointer to the newly opened file. If an error occurs, the original file is closed and the function returns a NULL pointer value.
Platform: DOS and Windows
Purpose: scans input from the file designated by fp under control of the argument format.
Parameters:
Returns: the number of input arguments for which values were successfully scanned and stored. Otherwise, returns EOF when the scanning is terminated by reaching the end of the input stream.
Platform: DOS and Windows
Purpose: changes the read/write position of the file specified by fp. The argument offset is the position to seek to relative to one of three positions specified by the argument where.
Parameters:
Returns: 0 if successful, otherwise non-zero.
Platform: DOS and Windows
Purpose: returns the current read/write position of the file specified by fp.
Parameters: fp - pointer to file
Returns: returns the current read/write position of the file if successful; otherwise, it returns -1 on error.
Platform: DOS and Windows
Purpose: writes count elements of size bytes each to the file specified by fp.
Parameters:
Returns: the number of complete elements successfully written. This value will be less than the requested number of elements only if a write error occurs.
Platform: DOS and Windows
Purpose: Delayed (Gflush()able) version for changing a set of colors. Transfers the colors from a temporary CLT to the active CLT.
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
Platform: DOS and Windows
Purpose: General interface to graphics kernel. All of the other kernel functions are converted into Gadd() calls. Basically, Gadd() is the mother of all graphics kernel functions. Must be followed by Gflush().
Parameters:
| General Graphical Operations | |||
| Operation | arg1 | arg2 | notes |
| G_COLOR_ABS | red*256 +blue | green | Changes requested index value to r,g,b |
| G_COLOR_LUT | 0 | 0 | Changes the current LUT to index |
| G_COLOR_REL | red*256 +blue | green | Adds r,g,b to the requested index in the LUT |
| G_MOVIE_run_FORE | pause_on_each+1 | pause_on_each | Plays a movie forwards |
| G_MOVIE_run_REV | pause_on_each+1 | pause_on_each | Plays a movie backwards |
| G_MOVIE_step | frames | bounds | Adds frames to the current frame of the movie |
| G_PRIORITY | priority | 0 | Changes the priority of test_screen |
| G_VISIBLE | on or off (1 or 0) | 0 | Turns test_screen on or off |
| Operations using degrees per visual angle coordinates | |||
| Operation | arg1 | arg2 | notes |
| G_xy_MOVE_ABS | x | y | Moves test_screen to x,y offset from center of the screen |
| G_xy_MOVE_ABSref | x | y | Moves test_screen to x,y offset from the reference point |
| G_xy_MOVE_ABSorig | x | y | Moves test_screen to x,y offset from the lower left corner of the screen |
| G_xy_MOVE_REL | x | y | Moves test_screen to x,y offset from current position |
| G_xy_PAN_ABS | x | y | Pans test_screen within its window to absolute offset |
| G_xy_PAN_REL | x | y | Pans test_screen within its window relative to current position |
| G_xy_WINSIZE_ABS | x | y | Changes the size of test_screen's window to x,y |
| G_xy_WINSIZE_REL | x | y | Adds x,y to the dimensions of test_screen's window |
| Operations using pixel coordinates | |||
| Operation | arg1 | arg2 | notes |
| G_pix_MOVE_ABS | x | y | Moves test_screen to x,y offset from center of the screen |
| G_pix_MOVE_ABSref | x | y | Moves test_screen to x,y offset from the reference point |
| G_pix_MOVE_ABSorig | x | y | Moves test_screen to x,y offset from the lower left corner of the screen |
| G_pix_MOVE_REL | x | y | Moves test_screen to x,y offset from current position |
| G_pix_PAN_ABS | x | y | Pans test_screen within its window to absolute offset |
| G_pix_PAN_REL | x | y | Pans test_screen within its window relative to current position |
| G_pix_WINSIZE_ABS | x | y | Changes the size of test_screen's window to x,y |
| G_pix_WINSIZE_REL | x | y | Adds x,y to the dimensions of test_screen's window |
| Operations using radial coordinates | |||
| Operation | arg1 | arg2 | notes |
| G_rt_MOVE_ABS | radius | theta | Moves test_screen to r,t offset from center of the screen |
| G_rt_MOVE_ABSref | radius | theta | Moves test_screen to r,t offset from the reference point |
| G_rt_MOVE_ABSorig | radius | theta | Moves test_screen to r,t offset from the lower left corner of the screen |
| G_rt_MOVE_REL | radius | theta | Moves test_screen to r,t offset from current position |
| G_rt_PAN_ABS | radius | theta | Pans test_screen within its window to absolute offset |
| G_rt_PAN_REL | radius | theta | Pans test_screen within its window relative to current position |
| G_rt_WINSIZE_ABS | radius | theta | Changes the size of test_screen's window to r,t |
| G_rt_WINSIZE_REL | radius | theta | Adds r,t to the dimensions of test_screen's window |
Returns: pointer to the thread allocated by Gadd()
See Also: Gadd_with_wait(), Gcheck(), Gdel(), Gflush(), Gpurge()
Platform: DOS and Windows
Purpose: General interface to graphics kernel. This is the same as Gadd(), except that it will wait a specified number of Gflush() calls before executing. Thus, if the user calls Gflush() every screen refresh (to enact real-time animation or movies, for instance), the Gadd_with_wait() operation will be performed in wait_frames screen refreshes. This call is helpful when the user would like to start and end a graphical operation at a variable random times and does not wish to keep track of how much time has passed between the start and end of the operation. Must be followed by Gflush().
Parameters:
Returns: pointer to the thread allocated by Gadd_with_wait()
See also: Gadd(), Gcheck(), Gdel(), Gflush(), Gpurge()
Platform: DOS and Windows
Purpose: Returns the time remaining on a Gadd() thread in milliseconds.
Parameters:
Returns: the time remaining for a graphical operation to run (in milliseconds). The value active_thread is the value returned by many of the New Graphical Routines (the ones that are not instantaneous in duration) and it allows Gcheck() to trace the operation's remaining time on the queue.
See also: Gadd()
Platform: DOS and Windows
sets the color of one index within the current lookup table. To find out which index of the LUT contains the color information for a certain item, call ITEM_POSlut_index(). Must be followed by Gflush().
Platform: DOS and Windows
Purpose: Delayed (Gflush()able) version for changing a set of colors. Transfers the entire palette of colors (i.e., 256 colors) from a temporary CLT to the active CLT.
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
Platform: DOS and Windows
Purpose: Delayed (Gflush()able) version for changing a set of colors. Transfers the colors from a temporary CLT to the active CLT.
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
Platform: DOS and Windows
Purpose: resets the color of an item one color lookup table index at a time by changing a single value within a color lookup table. Adds the values added_red, added_green, and added_blue to the current values for that entry in the color lookup table.
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: GcolorABS(), GcolorLUT(), ITEM_POSlut_index(), load_CLT(), set_CLT_load_index(), set_colorABS(), set_colorREL()
Platform: DOS and Windows
Purpose: removes a graphical operation that has been added to the stack by one of the New Graphics Routines. Only needed if the graphical operation has a duration that is non-instantaneous.
Parameters:
Returns: the number of threads deleted. Note that this can be dangerous if it isn't currently part of the structure, so descend that structure instead of just using next/previous pointers
Platform: DOS and Windows
Purpose: gets the values of the active color lookup table (CLT) which is in use by graphics board
Parameters:
Purpose: sets the values of the active color lookup table (CLT) which is in use by graphics board
Parameters:
Purpose: waits for and returns a key press.
Parameters: none
Returns: casting as (char) will provide the key that was pressed, and the high byte contains special attributes (such as SHIFT or CTRL). Or, one can compare directly with the #defines in css_inc.h (be sure to #include "css_inc.h"). Internally, this function is the same as KeyGet().
See Also: KeyGet()
Platform: DOS and Windows
Purpose: Get a character from the console without echo
Parameters: none
See also: gets()
Platform: DOS only
Purpose: This function will return the name of the Cortex conditions file through a parameter. The timing file must allocate space for the file name.
Parameters: pointer to a string that will hold the filename
Returns: nothing.
Platform: Windows only
Purpose: gets the name of the currently set working directory.
Parameters:
Returns: a pointer to the newly allocated current_directory, which is filled with the requested path string
See also: chdir(), mkdir(), rename(), rmdir()
Platform: DOS and Windows
Purpose: searches the list of environment variables for an entry corresponding to varname
Parameter: varname - Environment variable name
Returns: pointer to that entry in the environment table
Platform: DOS and Windows
Purpose: This function will return the name of the Cortex external variables file through a parameter. The timing file must allocate space for the file name.
Parameters: pointer to a string that will hold the filename
Returns: nothing.
Platform: Windows only
Purpose: This function will return the name of the Cortex items file through a parameter. The timing file must allocate space for the file name.
Parameters: pointer to a string that will hold the filename
Returns: nothing.
Platform: Windows only
Purpose: gets a line from the keyboard and stores it in string. The characters are echoed to the screen as they are typed in (text mode only). The gets() function replaces the newline character '\n' with a NULL character '\0'. The user is responsible for allocating enough memory for the incoming string....otherwise there may be a catastrophe (such as an array overwrite or system crash).
Parameter: buffer Storage location for input string
Returns: the string, if succesful
See Also: getch(), SCREENmode()
Platform: DOS only
Purpose: This function will return the current time and date through a string parameter. The timing file must allocate space for the time/date. The size of the string will be 26 chars. NOTE: This function was added to DOS for version 5.9.6.
Parameters: pointer to a string that will hold the time/date string
Returns: nothing.
Platform: DOS and Windows
Purpose: This function will return the name of the Cortex timing file through a parameter. The timing file must allocate space for the file name.
Parameters: pointer to a string that will hold the filename
Returns: nothing.
Platform: Windows only
Purpose: read a byte from Port A of the PIO24 board.
Parameters:
Returns: input from Port A of PIO24, masked with 2*val if val < 8. Otherwise, returns -1.
Platform: DOS and Windows
Purpose: get the current state of the subject's response bar.
Parameters: none
Returns: bar state. If this is a bar up/bar down paradigm, then bar state returns 0 for bar up, 1 for bar down. If this is a bar left/right paradigm, it returns 1 for bar_centered (neither left nor right) 2 for bar_left, 3 for bar_right, and 4 for bar extra. This function assumes that the bar inputs are connected as specified in CORTEX manual.
See Also: get_block_num()
Platform: DOS and Windows
Purpose: Returns the number of the given block
Parameters: none
Returns: the number of the current block being tested. The first block is 0 not 1.
See also: BLOCKget_block_num(), BLOCKget_cond_num(), BLOCKset_next(), get_cond_num()
Platform: DOS and Windows
Purpose: Returns the percent correct (0-10000) of a given block. This function has been, for the most part, replaced by BLOCKget_pct(). The first block is 0 not 1.
Parameter:
Returns: The average percentage of correct trials (multiplied by 100) of all the conditions in block number block_id.
See also: BLOCKclear_stats(), BLOCKget_pct_correct(), get_cond_pct_correct()
Platform: DOS and Windows
Purpose: get the current CODEbuf value at the given index.
Parameters: index
Returns: the current CODEbuf value at the given index
Platform: Windows only
Purpose: get the current CODE_ISImax value.
Parameters: none
Returns: the current CODE_ISImax value
Platform: Windows only
Purpose: get the current CODE_ISIoverflow value.
Parameters: none
Returns: the current CODE_ISIoverflow value
Platform: Windows only
Purpose: get the current CODE_ISIsize value.
Parameters: none
Returns: the current CODE_ISIsize value
Platform: Windows only
Purpose: Returns the number of the given condition
Parameters: none
Returns: the current condition being tested. The first condition is 0 not 1.
See also: BLOCKget_cond_num(), BLOCKget_block_num(),BLOCKset_next(), get_block_num()
Platform: DOS and Windows
Purpose: Returns the percent correct (0-10000) of a given condition
Parameters:
Returns: the percentage of correct trials (multiplied by 100) in condition cond_id. The first condition is 0 not 1.
See also: BLOCKclear_stats(), BLOCKget_pct_correct(), get_block_pct_correct()
Platform: DOS and Windows
Purpose: read a byte from Port C of the PIO24 board.
Parameters:
Returns: input from Port C of PIO24, masked with 2*val if val < 8. Otherwise, returns -1.
Platform: DOS and Windows
Purpose: get the current EOGbuf value at the given index.
Parameters: index
Returns: the current EOGbuf value at the given index
Platform: Windows only
Purpose: get the current params.dynamic_eyewin_size value.
Parameters: none
Returns: the current params.dynamic_eyewin_size value
Platform: Windows only
Purpose: get the current params.window_x value.
Parameters: none
Returns: the current params.window_x value
Platform: Windows only
Purpose: get the current params.window_y value.
Parameters: none
Returns: the current params.window_y value
Platform: Windows only
purpose: get the current params.eog_gain value.
Parameters: none
Returns: the current params.eog_gain value
Platform: Windows only
Purpose: get the current EOGmax value.
Parameters: none
Returns: the current EOGmax value
Platform: Windows only
Purpose: get the current EOGnew_x value.
Parameters: none
Returns: the current EOGnew_x value
Platform: Windows only
Purpose: get the current EOGnew_y value.
Parameters: none
Returns: the current EOGnew_y value
Platform: Windows only
Purpose: get the current params.eog_xoffset value.
Parameters: none
Returns: the current params.eog_xoffset value
Platform: Windows only
Purpose: get the current params.eog_yoffset value.
Parameters: none
Returns: the current params.eog_yoffset value
Platform: Windows only
Purpose: get the current EOGoverflow value.
Parameters: none
Returns: the current EOGoverflow value
Platform: Windows only
Purpose: get the current params.mc value.
Parameters: none
Returns: the current params.mc value
Platform: Windows only
Purpose: get the current EOGsize value.
Parameters: none
Returns: the current EOGsize value
Platform: Windows only
Purpose: get the current EPPbuf value at the given index.
Returns: the current EPPbuf value at the given index
Platform: Windows only
Purpose: get the current EPPmax value.
Parameters: none
Returns: the current EPPmax value
Platform: Windows only
Purpose: get the current EPPnew_x value.
Parameters: none
Returns: the current EPPnew_x value
Platform: Windows only
Purpose: get the current EPPnew_y value.
Parameters: none
Returns: the current EPPnew_y value
Platform: Windows only
Purpose: get the current EPPoverflow value.
Parameters: none
Returns: the current EPPoverflow value
Platform: Windows only
Purpose: get the current EPPsize value.
Parameters: none
Returns: the current EPPsize value
Platform: Windows only
Purpose: gets the eye storage rate that was set in the Run:
Parameters:General:EOG_storage_rate menu. It is also the value that is stored in the header of the Cortex output data file.
Parameters: none
Returns: the eye data storage rate.
Platform: DOS and Windows
Purpose: find out whether the subject's eye is within the fixation window.
Parameters: none
Returns: fixation state (1 if subject is fixated, 0 if not).
See Also: ITEM_POSeye_ishere(), ITEM_POSeye_iswithin()
Platform: DOS and Windows
Purpose: get the current ISIbuf value at the given index.
Parameters: index
Returns: the current ISIbuf value at the given index
Platform: Windows only
Purpose: get the current params.keep_current_conds value.
Parameters: none
Returns: the current params.keep_current_conds value
Platform: Windows only
Purpose: gets the kHz resolution value that is stored in the header of the Cortex output data file.
Parameters: none
Returns: the kHz resolution value.
Platform: DOS and Windows
Purpose: get the current params.ms_reward_duration value.
Parameters: none
Returns: the current params.ms_reward_duration value
Platform: Windows only
Purpose: finds the default value of a parameter in a file parfile which contains semi-colons at the ends of the lines, and contains an equal sign after the name but before the default_value. (I am not sure of the real use of this function.)
Parameters:
Returns: the default value of the parameter
Platform: DOS and Windows
Purpose: gets the repeat number, as it was stored in the header of the Cortex output data file.
Parameters: none
Returns: the repeat number.
Platform: DOS and Windows
Purpose: Find out whether the subject's eye is within the fixation window. If set_saccade_tolerance() was called first, saccades will be checked for at the desired rate. Otherwise, get_saccade_state() is equal to get_fixation_state(). When there is a saccade error, can't distinquish it from a get_fixation_state error, so a stricter get_fixation_state.
Parameters: none
Returns: 0 if not fixated, 1 if fixated and not saccading, 2 if fixated but saccading too much
See Also: get_fixation_state()
Platform: DOS and Windows
Purpose: get the current TIMER100us_counter value.
Parameters: none
Returns: the current TIMER100us_counter value
Platform: Windows only
Purpose: get the current TIMERms_counter value.
Parameters: none
Returns: the current TIMERms_counter value
Platform: Windows only
Purpose: Returns the current trial_number
Parameters: none
Returns: current trial number
Platform: DOS and Windows
Purpose: gets the trial type that was set in the TRIAL_TYPE column of the conditions file. It is also the value that is stored in the header of the Cortex output data file as the expected_response.
Parameters: none
Returns: the trial type.
Platform: DOS and Windows
Purpose: After queueing a number of graphics commands, you need to flush them to ensure that they are acted upon. You can also specify whether or not to synchronize on them (i.e. wait until the graphics card is finished the requested operations before continuing with the calling program.
Parameter: synchronize (1 = synchronize, 0 = don't synchronize).
Returns: number of threads left in queue to be processed.
Note: If you are using the DirectX version of the receive program, the synchronize parameter of the Gflush() function has no effect. The program will always behave as if Gflush(1) was called. The reason for this behavior is that in a DirectX application, the vertical refreshing behavior must occur at initialization, and cannot be changed dynamically. Since it was assumed that most users would want to synchronize with the vertical refresh, this was programmed to be the default behavior.
See Also: GmoveABS()
Platform: DOS and Windows
Purpose: Moves the center of a test_screen to an absolute position. (Moves the window's center relative to (0,0).) Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: Gdel(), Gflush(), GmoveREL(), Gpurge()
Platform: DOS and Windows
Purpose: Moves the center of a test_screen to another position. (Moves the window's center relative to it's original center.) Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See Also: Gdel(), Gflush(), GmoveREL(), Gpurge()
Platform: DOS and Windows
Purpose: Moves the center of a test_screen to another position. (Moves the window's center relative to the reference point as defined in the Cortex Item:Reference menu option.) Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See Also: Gdel(), Gflush(), GmoveREL(), Gpurge()
Platform: DOS and Windows
Purpose: Move the center of a test_screen to a location relative to its current location. Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: Gdel(), Gflush(), GmoveABS(), Gpurge()
Platform: DOS and Windows
Purpose: Move the fixation window to a new location. This function draws the new fixation window on the user's screen and updates the eye boundary parameters.
Parameters:
Returns: 1 if successful.
Platform: DOS and Windows
Purpose: The Gmovie() function tells CORTEX to display a movie in the specified test_screen. CORTEX will not actually display a frame of the movie until the Gflush() function is called. In order for each new frame of the movies to be drawn, Gflush() must be called. Thus, if your monitor is updated at 60Hz, you should call Gflush() at least once every 1/60 seconds. The easiest way to handle this is to put the Gflush() function within a while-loop immediately after the Gmovie() function is called. If the fifth argument of the Gmovie() function is set to 1, the movies will automatically turn off at the correct time as set by the duration parameter.
Note that Gflush() will return the value 1 if Gmovie() or any other graphical function is pending. Gflush() will return the value 0 if there are no pending graphical functions pending. Therefore, one easy way to guarantee that you will display the movie until the duration has elapsed is with code like the following example:
Platform: DOS and Windows
Purpose: Runs a movie one time through one complete cycle of all of the frames of the movie, and then stops. If the starting_frame is a value other than the first frame of the movie (i.e., frame number 0), then the movie will be displayed starting at the specified frame, and will play through all of the frames of the movie, wrapping around until it reaches the starting_frame - 1. If there is only one frame in the movie, it just calculates the number of frames based upon the time (like Gmovie() does). Gmovie_one_time() must be followed by Gflush(). Refer to the Gflush() information in the description of Gmovie().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: Gmovie(), Gmovie_step(), init_movie(), run_movie()
Platform: DOS and Windows
Purpose: Steps a movie to a new position. Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: Gmovie(), init_movie(), run_movie()
Platform: DOS and Windows
Purpose: Turn a test_screen on or off. Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: display_fixspot(), display_sample(), display_test(), Gdel(), Gflush(), Gpurge()
Platform: DOS and Windows
Purpose: The Gpan() function tells CORTEX to display and pan a test_screen across its center. CORTEX will not actually display a frame until the Gflush() function is called. In order for each new frame to be drawn, Gflush() must be called. The easiest way to handle this is to put the Gflush() function within a while-loop immediately after the Gpan() function is called. If the fifth argument of the Gpan() function is set to 1, the item will automatically turn off at the correct time as set by the duration parameter.
Note that Gflush() will return the value 1 if Gpan() or any other graphical function is pending. Gflush() will return the value 0 if there are no pending graphical functions pending. Therefore, one easy way to guarantee that you will display the pan until the duration has elapsed is with code like the following example:
Gpan(TEST0, 2, 2, 1000, 1);
while (Gflush(1));
Parameters:
See also: Gflush(), GpanABS(), GpanREL(), Gpurge(), init_pan(), pan_win(), pan_wkstABS(), pan_wkstREL()
Platform: DOS and Windows
Purpose: Pans the item across absolute coordinates while its window stays still. Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: Gflush(), Gpan(), GpanREL(), Gpurge(), init_pan(), pan_win(), pan_wkstABS(), pan_wkstREL()
Platform: DOS and Windows
Purpose: Pans the item across coordinates relative to its current position while its window stays still. Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().
See also: Gflush(), Gpan(), GpanABS(), Gpurge(), init_pan(), pan_win(), pan_wkstABS(), pan_wkstREL()
Platform: DOS and Windows
Purpose: window with highest priority is on top in case of overlap. The default is that the FIXSPOT has the highest priority, followed the PLAY stimulus, followed by TEST0, etc. Must be followed by Gflush().
Parameters:
Returns: pointer to thread added. Can be passed to Gcheck() or Gdel()
See also: init_foreback()
Platform: DOS and Windows
Purpose: In situations where one needs to abort a trial, and is not certain which commands might remain in queue, Gpurge() will clear the entire buffer. In general, it is a good idea to specifically Gdel() the commands from the queue, but calling Gpurge() at the end of a timing file (before exit()) may be beneficial. This call is basically the same as Gdel(), but it deletes ALL pending graphics operations at once.
Parameters: none
Returns: number of threads deleted.
See also: Gdel()
Platform: DOS and Windows
Purpose: shutdown all the graphics operations and release all of the resources. Should not need to call this function, since Cortex calls this automatically when the trial is over. May not work with the two-computer version of Cortex.
Parameters: none
Returns: nothing
Platform: DOS and Windows
Purpose: erases the graphics from the screen, and deallocates the storage for them. Should not need to call this function, since Cortex calls this automatically when the trial is over.
Parameters: none
Returns: nothing
Platform: DOS and Windows
Purpose: Draw an item onto an offscreen surface. All objects/groups are drawn with respect to the reference point except for the reference point itself, which is drawn relative to the center of the screen (0,0). Should not need to call this function, since Cortex calls this internally when Gon_off() is called. (Use Gon_off() instead!!)
Parameters:
Returns: nothing
Platform: DOS and Windows