:: Style
:: Functions
AbortCSS()
abs()
acos()
asin()
atan()
atan2()
atof()
atoi()
atol()
BLOCKclear_stats()
BLOCKget_block_n()
BLOCKget_cond_nu()
BLOCKget_control()
BLOCKget_max_val()
BLOCKget_pct_cor()
BLOCKget_stats()
BLOCKset_control()
BLOCKset_next()
break_fixation_e()
byte_c_out()
byte_out()
calloc()
cart2r()
cart2theta()
cartesian2polar()
ceil()
chdir()
chmod()
chsize()
ClearCSSGlobals()
clear_eog()
clip()
clock()
close()
Cls()
CLTactivate()
CLTdownload()
CLTget_val()
CLTretrieve()
CLTset_val()
CLTupload()
CMENUbool()
CMENUboolRC()
CMENUrun()
collect_data()
contact()
cos()
cosh()
CurMov()
DEVinp()
DEVinpw()
DEVoutp()
DEVoutpw()
display_eye_path()
display_fixspot()
display_histogra()
display_play()
display_sample()
display_test()
display_trial_pr()
distance_to_line()
dont_unload_cond()
DrawBox()
dsquared()
dup()
dup2()
encode()
end_trial()
eof()
EPPconvert()
EPPget_chan()
EPPunconvert()
exp()
EYEget_dva()
EYE_WINcopy()
EYE_WINreset()
EYE_WINset()
fabs()
fclip()
fclose()
feof()
ferror()
fflush()
fgetc()
fgets()
find_DC()
find_slope()
floor()
fmax()
fmin()
fopen()
foreback_wins()
fprintf()
fputc()
fputs()
fread()
free()
freespace()
freopen()
fscanf()
fseek()
ftell()
fwrite()
GactivateCLT()
Gadd()
Gadd_with_wait()
Gcheck()
GcolorABS()
GcolorLUT()
GcolorLUTsubset()
GcolorREL()
Gdel()
GDPget_CLT()
GDPset_CLT()
GetAKey()
getch()
getCndsFileName()
getcwd()
getDataFileName()
getenv()
getExternsFileNa()
getItemsFileName()
gets()
getTimeDateStrin()
getTimingFileNam()
get_a_input()
get_bar_state()
get_block_num()
get_block_pct_co()
get_CODEbuf()
get_CODE_ISImax()
get_CODE_ISIover()
get_CODE_ISIsize()
get_cond_num()
get_cond_pct_cor()
get_digital_inpu()
get_EOGbuf()
get_EOGdynamic_f()
get_EOGfixwin_si()
get_EOGfixwin_si()
get_EOGgain()
get_EOGmax()
get_EOGnew_x()
get_EOGnew_y()
get_EOGoffset_x()
get_EOGoffset_y()
get_EOGoverflow()
get_EOGsaccade()
get_EOGsize()
get_EPPbuf()
get_EPPmax()
get_EPPnew_x()
get_EPPnew_y()
get_EPPoverflow()
get_EPPsize()
get_eye_storage_()
get_fixation_sta()
get_ISIbuf()
get_keep_current()
get_kHz_resoluti()
get_ms_reward_du()
get_param()
get_repeat_num()
get_saccade_stat()
get_TIMER100us_c()
get_TIMERms_coun()
get_trial_num()
get_trial_type()
Gflush()
GmoveABS()
GmoveABSorig()
GmoveABSref()
GmoveREL()
Gmove_fixwin()
Gmovie()
Gmovie_one_time()
Gmovie_step()
Gon_off()
Gpan()
GpanABS()
GpanREL()
Gpriority()
Gpurge()
GRAPHICSclose()
GRAPHICSdegenera()
GRAPHICSdraw()
GRAPHICSdraw_bac()
GRAPHICSdraw_con()
GRAPHICSgenerate()
GRAPHICSopen()
GRAPHICSread_col()
GRAPHICSread_col()
GRAPHICSset_colo()
Gscroll()
Gsweep()
Gtransparancy()
GwinSizeABS()
GwinSizeREL()
histogram_Ctik()
histogram_tik()
init_foreback()
init_movie()
init_pan()
init_scroll()
init_sweep()
init_sweep_with_()
init_toggle()
inp()
inpw()
in_corridor()
in_window()
ITEM_POSbind_fix()
ITEM_POSeye_delt()
ITEM_POSeye_ishe()
ITEM_POSeye_iswi()
ITEM_POSget()
ITEM_POSlut_inde()
ITEM_POSmark_pos()
KeyGet()
KeyHit()
KeyPressed()
load_CLT()
load_CLT_subset()
log()
log10()
lseek()
malloc()
max()
memchr()
memcmp()
memcpy()
memmove()
memset()
MessageFloat()
MessageInt()
MessageLong()
MessageString()
min()
mkdir()
MouseMoved()
MousePressed()
move_eye_window()
move_fixspot()
move_sample()
move_test()
Mprintf()
MS_TIMERcheck()
MS_TIMERset()
no_fixation()
open()
outp()
outpw()
pan_win()
pan_wkstABS()
pan_wkstREL()
polar2cartesian()
polar2x()
polar2y()
pow()
printf()
printxy()
putchar()
puts()
put_eye_data_in_()
rand()
rand2()
random()
read()
realloc()
recent_block_sta()
remove()
rename()
repeat_block_if_()
repeat_cond_if_p()
response_before_()
response_correct()
response_early()
response_late()
response_missing()
response_no_bar_()
response_wrong()
reward()
rmdir()
run_movie()
scanf()
SCREENcalc_fixwi()
SCREENdraw_box_o()
SCREENdraw_entir()
SCREENdraw_eye_p()
SCREENdraw_fixwi()
SCREENdraw_histo()
SCREENdraw_raste()
SCREENerase_hist()
SCREENerase_rast()
SCREENerase_rast()
SCREENmode()
SCREENshow_eye_p()
SCREENupdate_eye()
SCREENuser_displ()
scroll_win()
scroll_win_with_()
send_termination()
Serial_Close()
Serial_Flush()
Serial_Open()
Serial_Print()
Serial_Read()
Serial_Ready()
Serial_SetPortHa()
Serial_Write()
set_CLT_load_ind()
set_CODEbuf()
set_CODE_ISImax()
set_CODE_ISIover()
set_CODE_ISIsize()
set_colorABS()
set_colorREL()
set_EOGbuf()
set_EOGdynamic_f()
set_EOGfixwin_si()
set_EOGfixwin_si()
set_EOGgain()
set_EOGmax()
set_EOGnew_x()
set_EOGnew_y()
set_EOGoffset_x()
set_EOGoffset_y()
set_EOGoverflow()
set_EOGsaccade()
set_EOGsize()
set_EPPbuf()
set_EPPmax()
set_EPPnew_x()
set_EPPnew_y()
set_EPPoverflow()
set_EPPsize()
set_expected_res()
set_fixwin_param()
set_ISIbuf()
set_keep_current()
set_ms_reward_du()
set_random_inter()
set_random_timer()
set_response()
set_response_err()
set_saccade_tole()
set_timer()
set_TIMER100us_c()
set_TIMERms_coun()
set_trial_type()
sin()
sinh()
SMENUrun()
SOUNDload()
SOUNDplay()
SOUNDprep()
SOUNDstart()
SOUNDstop()
SOUNDvol()
sprintf()
sqrt()
srand()
srand2()
sscanf()
start_trial()
strcat()
strchr()
strcmp()
strcpy()
strdup()
strlen()
strncat()
strncmp()
strncpy()
strpbrk()
strrchr()
strspn()
strstr()
strtok()
sweep_win()
sweep_win_with_f()
system()
tan()
tanh()
tell()
THREADadd()
THREADdel()
THREADrun()
THREADstart_seqs()
THREADstop_seqs()
time()
TIMERadd()
TIMERaddCSSfn()
TIMERaddINT()
TIMERchange_rate()
TIMERdel()
TIMERget_count()
TIMERget_ms_coun()
TIMERpurge()
TIMERstart_clock()
TIMERstop_clock()
timer_expired()
toggle_wins()
touch_item()
update_histogram()
write()
_stricmp()
:: AbortCSS() 
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

Back to top


:: abs() 
intPlatform: DOS and Windows

Back to top


:: acos() 
floatPlatform: DOS and Windows

Back to top


:: asin() 
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

Back to top


:: atan() 
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

Back to top


:: atan2() 
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

Back to top


:: atof() 
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

Back to top


:: atoi() 
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

Back to top


:: atol() 
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

Back to top


:: BLOCKclear_stats() 
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.

  • block_or_condition (0 = block, 1 = condition, 2 = all blocks, 3 = all conditions)
  • which_one (the block or condition number. If block_or_condition is 2 or 3, this value is ignored)
See also: BLOCKget_pct_correct(), BLOCKget_stats()

Platform: DOS and Windows

Back to top


:: BLOCKget_block_n() 
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

Back to top


:: BLOCKget_cond_nu() 
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

Back to top


:: BLOCKget_control() 

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:

  • block the block number that is wished to be accessed [1-max_blocks]
  • minPctOK the minimal percent correct threshold [if the block's current percent correct is higher than minPctOK, then the block will be considered correct]
  • minTrials the number of trials that the block will run before testing other parameters such as minPctOK
  • recentOK the number of correct trials required from the block's most recentDone trials before the block will be considered correct
  • recentDone the number of the most recent trials that will be used to measure the monkey's progress using either recentOK or recentOKtooLow
  • max_errors the maximum number of errors allowed before the block is considered aborted
  • max_retries the maximum number of retries allowed when the on_error variable is set to Immediate_retry
  • recentOKtooLow if the block's most recentDone trials have this many correct trials or less, the block will be aborted
  • PctOKtooLow if the block's percent correct becomes this low or lower, the block will be aborted

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

See also: BLOCKset_control_info()

Platform: DOS and Windows

Back to top


:: BLOCKget_max_val() 
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

Back to top


:: BLOCKget_pct_cor() 
float BLOCKget_pct_correct (int block_or_condition, int which_one)

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

Parameters:

  • block_or_condition (0 = block, 1 = condition)
  • which_one (the block or condition number)

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

Back to top


:: BLOCKget_stats() 
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:

  • block_or_condition (0 = block, 1 = condition)
  • which_one (the block or condition number [1-max_blocks/conditions])
  • num_correct (the number of correcttrials [so far] in the current block/condition)
  • num_trials (the number of total trials [so far] in the current block/condition)
  • circular_buffer (the results from the last N number of trials from the given block/condition. To set the value of N, see the Run:Parameters:Block/Repeat:Sizing menu)

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

Back to top


:: BLOCKset_control() 

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:

  • block (the block number that is wished to be accessed [1-max_blocks])
  • minPctOK (the minimal percent correct threshold [if the block's current percent correct is higher than minPctOK, then the block will be considered correct])
  • minTrials (the number of trials that the block will run before testing other parameters such as minPctOK)
  • recentOK (the number of correct trials required from the block's most recentDone trials before the block will be considered correct)
  • recentDone (the number of the most recent trials that will be used to measure the monkey's progress using either recentOK or recentOKtooLow)
  • max_errors (the maximum number of errors allowed before the block is considered aborted)
  • max_retries (the maximum number of retries allowed when the on_error variable is set to Immediate_retry)
  • recentOKtooLow (if the block's most recentDone trials have this many correct trials or less, the block will be aborted)
  • PctOKtooLow (if the block's percent correct becomes this low or lower, the block will be aborted)

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

See also: BLOCKget_control_info()

Platform: DOS and Windows

Back to top


:: BLOCKset_next() 
int BLOCKset_next (int block, int condition)

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

Parameters:

  • block (the next block--remember that blocks are numbered 1-max_blocks)
  • condition (the next condition within block--remember that conditions are numbered 1-max_conds)

Returns: 1 if successful, 0 if not.

See also: break_fixation_error()

Platform: DOS and Windows

Back to top


:: break_fixation_e() 
void break_fixation_error()

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

Parameters: none

Returns: nothing

Platform: DOS and Windows

Back to top


:: byte_c_out() 

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

Back to top


:: byte_out() 

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

Back to top


:: calloc() 
pchar calloc (int num_elements, int bytes_per_element)

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

Parameters:

  • num_elements (the number of elements or size bytes_per_element to allocate)
  • bytes_per_element (the size of each element in bytes)

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

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

Platform: DOS and Windows

Back to top


:: cart2r() 

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

Back to top


:: cart2theta() 

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

Back to top


:: cartesian2polar() 
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:

  • x and y are the Cartesian coordinates
  • r - pointer to r which will store the magnitude
  • theta - pointer to theta which will store the angle
Returns: nothing

Platform: DOS and Windows

Back to top


:: ceil() 
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

Back to top


:: chdir() 
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

Back to top


:: chmod() 
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:

  • filename Name of exisiting file
  • pmode Permission setting for file
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

Back to top


:: chsize() 

int chsize (int handle, long size)

Purpose: Changes the file size.

Parameters:

  • handle Handle referring to open file
  • size New length of file in bytes
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

Back to top


:: ClearCSSGlobals() 

void ClearCSSGlobals ()

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

Parameters: none

Returns: nothing

Platform: DOS and Windows

Back to top


:: clear_eog() 

void clear_eog()

Purpose: clear the eog display window

Parameters: none

Returns: nothing

Platform: DOS and Windows

Back to top


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

Purpose: clip the range of an integer

Parameters:

  • value to be clipped
  • lower_limit of desired range
  • upper_limit of desired range
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

Back to top


:: clock() 

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

Back to top


:: close() 
int close (int handle)

Purpose: closes the file indicated by handle

Returns: 0 if successful.

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

Platform: DOS and Windows

Back to top


:: Cls() 
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

Back to top


:: CLTactivate() 
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:


:: CLTdownload() 
int CLTdownload (int CLTnum, int CLTstart_idx, int num_entries, pchar data)

Purpose: Copies color data from the given color lookup table (CLT), into the data variable. Parameters:

  • CLTnum - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.
  • CLTstart_idx - the starting index in the CLT
  • num_entries - the number of entries that should be downloaded
  • data - internally, this parameter is a pointer to an array of BYTE_RGB structures to hold the red, green and blue values.

    typedef struct {
    Platform: DOS and Windows

    Back to top


:: CLTget_val() 
int CLTget_val (int CLTnum, int index, int *r, int *g, int *b)

Purpose: Gets the R, G, B values for a single entry of a given color lookup table (CLT).

Parameters:

  • CLTnum - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.
  • index - the index into the CLT for the color entry to get
  • r - pointer to the red value at the given index
  • g - pointer to the green value at the given index
  • b - pointer to the blue value at the given index

Returns: 1 if successful, otherwise 0.

Platform: DOS and Windows

Back to top


:: CLTretrieve() 
int CLTretrieve (int num_entries, int CLTnum, int src_start, int dst_start)

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:

  • num_entries - the number of entries that should be retrieved
  • CLTnum - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.
  • src_start - the starting index in the CLT
  • dst_start - the ending index in the CLT

Returns: 1 if successful, otherwise 0.

Platform: DOS and Windows

Back to top


:: CLTset_val() 
int CLTset_val (int CLTnum, int index, int r, int g, int b)

Purpose: Sets the R, G, B values for a single entry of a give color lookup table (CLT).

Parameters:

  • CLTnum - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.
  • index - the index into the CLT for the color entry to set
  • r - the red value to set at the given index
  • g - the green value to set at the given index
  • b - the blue value to set at the given index

Returns: 1 if successful, otherwise 0.

Platform: DOS and Windows

Back to top


:: CLTupload() 
int CLTupload (int CLTnum, int CLTstart_idx, int num_entries, pchar data)

Purpose: Copies color data from the data structure into the given color lookup table (CLT).

Parameters:

  • CLTnum - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.
  • CLTstart_idx - the starting index in the CLT
  • num_entries - the number of entries that should be uploaded
  • data - internally, this parameter is a pointer to an array of BYTE_RGB structures which holds the red, green and blue values.

    typedef struct {
    Platform: DOS and Windows

    Back to top


:: CMENUbool() 
int CMENUbool (char *msg)

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

Back to top


:: CMENUboolRC() 
int CMENUboolRC (char *msg, char *choices)

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:

  • msg - the string to be printed on the screen as a question
  • choices - an array of strings containing the choices of responses

Returns: 1 if a new value has been set, 0 if no change, and -1 if ESCAPE pressed.

Platform: DOS only

Back to top


:: CMENUrun() 
int CMENUrun (char *message, int y, int *val, int num_choices, char *choices[])

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:

  • message - the string to be printed on the screen as a question
  • y - the vertical location at which the string will appear
  • val - pointer to the value chosen
  • num_choices - the number of choices
  • choices - an array of strings containing the choices of responses

Returns: 1 if a new value has been set, 0 if no change, and -1 if ESCAPE pressed.

Platform: DOS only

Back to top


:: collect_data() 
void collect_data (int on_off)

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

Back to top


:: contact() 
int contact (int cirx, int ciry, int cir_radius, int ulx, int uly, int lrx, int lry)

Purpose: identifies when a circle and a rectangular object overlap each other

Parameters:

  • cirx center of circle, x coordinate
  • ciry center of circle, y coordinate
  • cir_radius radius of circle
  • ulx upper left corner, x coordinate of bar
  • uly upper left corner, y coordinate of bar
  • lrx lower right corner, x coordinate of bar
  • lry lower right corner, y coordinate of bar

Returns: 1 if circle and rectangle overlap, 0 if no overlap.

Platform: DOS and Windows

Back to top


:: cos() 
float cos (float value)

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

Back to top


:: cosh() 
float cosh (float value)

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

Back to top


:: CurMov() 
void CurMov (int row, int column)

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

Back to top


:: DEVinp() 
int DEVinp (int device_number, int port)

Purpose: Reads a byte from the given port and deive_number.

Parameters:

  • device_number (set in CORTEX.CFG)
  • port (the port on device_number to output the data through)

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

Back to top


:: DEVinpw() 
int DEVinpw (int device_number, int port)

Purpose: Reads two bytes from the given port and device_number

Parameters:

  • device_number (set in CORTEX.CFG)
  • port (the port on device_number to output the data through)
Returns: two bytes (16 bits) 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: DEVinp(), DEVoutp(), DEVoutpw()

Platform: DOS and Windows

Back to top


:: DEVoutp() 
int DEVoutp (int device_number, int port, int data)

Purpose: outputs a single byte of data on port (a part of device_number), the data sent if successful, else returns -1

Parameters:

  • device_number (set in CORTEX.CFG)
  • port (the port on device_number to output the data through)
  • data (a single byte (8 bits) of data)
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(), DEVinpw(), DEVoutpw()

Backward Compatibility: byte_out()

Platform: DOS and Windows

Back to top


:: DEVoutpw() 
int DEVoutpw (int device_number, int port, int data)

Purpose: Writes two bytes of data to the given port and device_number.

Parameters:

  • device_number (set in CORTEX.CFG)
  • port (the port on device_number to output the data through)
  • data (two bytes (16 bits) of data)

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

Back to top


:: display_eye_path() 
void display_eye_path (int visible)

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

Back to top


:: display_fixspot() 
void display_fixspot (int visible)

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

Back to top


:: display_histogra() 
void display_histogram ()

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

Back to top


:: display_play() 
void display_play (int visible)

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

Back to top


:: display_sample() 
void display_sample (int visible)

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

Back to top


:: display_test() 
void display_test (int test_screen, int visible)

Purpose: turns on (visible=1) or off (visible=0) a specified test_screen (TEST1 through TEST9)

Parameters:

  • test stimulus number
  • visible or invisible (1= visible, 0 = invisible)

Returns: nothing

See also: display_fixspot(), display_play(), display_sample(), Gon_off()

Platform: DOS and Windows

Back to top


:: display_trial_pr() 
void display_trial_progress (int show_progress)

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

Back to top


:: distance_to_line() 
float distance_to_line (float x, float y, float slope, float DC)

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:

  • x (location along the horizontal axis of the point to be tested)
  • y (location along the vertical axis of the point to be tested)
  • slope (the slope of the line that passes through the origin to be tested)
  • DC (the denominator constant of the line that passes through the origin)

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

Back to top


:: dont_unload_cond() 
void dont_unload_conds (void)

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

Back to top


:: DrawBox() 
void DrawBox (float X_center, float Y_center, float width, float height, int color)

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:

  • X_center: FLOAT degrees of visual angle.
  • Y_center: FLOAT degrees of visual angle.
  • width: FLOAT degrees of visual angle.
  • height: FLOAT degrees of visual angle.
  • color: INT see css_inc.h (include it in your state function)

Returns: nothing.

See also: ITEM_POSmark_pos()

Backward Compatibility: mark_screen_pos()

Platform: DOS and Windows

Back to top


:: dsquared() 
long dsquared (int x1, int y1, int x2, int y2)

Purpose: Finds the square of the distance between two points, (x1, y1) and (x2, y2).

Parameters:


:: dup() 
int dup (int handle)

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

Back to top


:: dup2() 
int dup2 (int handle_1, int handle_2)

Purpose: forces handle_2 to refer to a currently open file (referred to by handle_1)

Parameters:

  • handle to open file
  • handle to be changed to refer to the current open file

Returns: 0 if successful.

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

Platform: DOS and Windows

Back to top


:: encode() 
void encode (int EVENT_CODE)

Purpose: Records an event code in the cortex data file

Parameters: event code

Returns: nothing

See also: EVENT_CODE

Platform: DOS and Windows

Back to top


:: end_trial() 
void end_trial ()

Purpose: cleans up after the trial and turns off the mapping stimulus in play mode

Parameters: none

Returns: nothing

Platform: DOS and Windows

Back to top


:: eof() 
int eof (int handle)

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

Back to top


:: EPPconvert() 
int EPPconvert (int x, int chan)

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:

  • x - data value
  • chan - channel number

Returns: a 16-bit value (short integer) containing the 12-bit data value, and 4-bits for the channel number

Platform: DOS and Windows

Back to top


:: EPPget_chan() 
int EPPget_chan (int x)

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

Back to top


:: EPPunconvert() 
int EPPunconvert (int x)

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

Back to top


:: exp() 
float exp (float value)

Returns: evalue

See also: log(), log10(), pow()

Platform: DOS and Windows

Back to top


:: EYEget_dva() 
void EYEget_dva (pfloat X, pfloat Y)

gets the eye position in degrees of visual angle (dva)

Purpose: gets the eye position in degrees of visual angle (dva)

Parameters:

  • pointer to X in which to store horizontal position relative to (0, 0)
  • pointer to Y in which to store vertical position relative to (0, 0)

Returns: nothing

Backward Compatibility: f_get_X(), f_get_Y(), get_fixation_posX(), get_fixation_posY()

Platform: DOS and Windows

Back to top


:: EYE_WINcopy() 
void EYE_WINcopy (int eye_window_number, int test_screen, int item_position)

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:

  • eye_window_number (1-EyeWinMax--set in cortex.cfg)
  • test_screen (0-9,FIXSPOT,PLAY,EYE_WIN,BOUND_FIXWIN)
  • item_position within that test_screen (1-x)

Returns: nothing

See also: EYE_WINreset(), EYE_WINset()

Platform: DOS and Windows

Back to top


:: EYE_WINreset() 
void EYE_WINreset ()

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

Back to top


:: EYE_WINset() 
void EYE_WINset (int eye_window_number,float x_center,float y_center,float x_size,float y_size)

Purpose: stores a position (center and size) for future reference.

Parameters:

  • eye_window_number (1-EyeWinMax--set in cortex.cfg)
  • x_center (upon calling function, this pointer will store the x_center value)
  • y_center (upon calling function, this pointer will store the y_center value)
  • x_size (upon calling function, this pointer will store the x_size value)
  • y_size (upon calling function, this pointer will store the y_size value)

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

Back to top


:: fabs() 
float fabs (float value)

Returns: the absolute value of value

See also: abs()

Platform: DOS and Windows

Back to top


:: fclip() 
float fclip (float value, float lower_limit, float upper_limit)

Purpose: clips the range of a floating point value.

Parameters:

  • value - number to be clipped
  • lower_limit - lower end of range
  • upper_limit - upper end of range

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

Back to top


:: fclose() 
int fclose (plong fp)

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

Back to top


:: feof() 
int feof (plong fp)

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

Back to top


:: ferror() 
int ferror (plong fp)

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

Back to top


:: fflush() 
int fflush (plong fp)

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

Back to top


:: fgetc() 
int fgetc (plong fp)

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

Back to top


:: fgets() 
pchar fgets(pchar buf, int n, plong fp)

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:

  • buf - storage location for data
  • n - maximum number of characters to read
  • fp - pointer to file

Returns: returns buf if successful, otherwise 0.

Platform: DOS and Windows

Back to top


:: find_DC() 
float find_DC (float target_x, float target_y)

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

Back to top


:: find_slope() 
float find_slope (float target_x, float target_y)

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

Back to top


:: floor() 
float floor (float value)

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

Back to top


:: fmax() 
float fmax (float value_1, float value_2)

Returns: the maximum of two floating point values

See also: fmin(), max(), min()

Platform: DOS and Windows

Back to top


:: fmin() 
float fmin (float value_1, float value_2)

Returns: the minimum of two floating point values

See also: fmax(), max(), min()

Platform: DOS and Windows

Back to top


:: fopen() 
plong fopen( pchar filename, pchar mode)

Purpose: opens the file specified by filename.

Parameters:

  • filename - filename
  • mode - type of access permitted
    • "r" - open file for reading
    • "w" - open file for writing
    • "a" - append
    • "t" - text
    • "b" - binary

Returns: a pointer to the open file. A null pointer value indicates an error.

Platform: DOS and Windows

Back to top


:: foreback_wins() 
int foreback_wins (int fore_test_screen, int fore_speed, int fore_direction, int back_test_screen, int back_speed, int back_direction)

Purpose: to execute simultaneous motion of two test_screens. This function has largely been replaced by Gscroll().

Parameters:

  • fore_test_screen (TEST0 through 9)
  • fore_speed (of movement, in units of 1/100 of deg per second)
  • fore_direction (of relative motion, in 1/100 of deg of angle)
  • back_test_screen INT background workstation #
  • back_speed INT speed of movement for second workstation.
  • back_direction INT direction of APPARANT motion for second workstation.

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

Back to top


:: fprintf() 
int fprintf ( plong fp, pchar format)

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:

  • fp - pointer to file
  • format - format-control string

Returns: the number of bytes written. Otherwise, returns a negative value if an output error occurs.

Platform: DOS and Windows

Back to top


:: fputc() 
int fputc (int c, plong fp)

Purpose: writes the character specified by c to the output stream designated by fp.

Parameters:

  • c - character to be written
  • fp - pointer to file

Returns: the character written; or, if a write error occurs, returns EOF.

Platform: DOS and Windows

Back to top


:: fputs() 
int fputs (pchar buf, plong fp)

Purpose: writes the character string pointed to by buf to the output stream designated by fp.

Parameters:

  • buf - character string to be written
  • fp - pointer to file

Returns: returns EOF if an error occurs otherwise, it returns a non-negative value.

Platform: DOS and Windows

Back to top


:: fread() 
int fread (pchar buffer, int size, int count, plong fp)

Purpose: reads count elements of size bytes each from the file specified by fp into the buffer specified by buffer.

Parameters:

  • buffer - storage location for data
  • size - item size in bytes
  • count- maximum number of items to be read
  • fp - pointer to file

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

Back to top


:: free() 
void free (pchar memory_block)

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

Back to top


:: freespace() 
float freespace (void)

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

Back to top


:: freopen() 
plong freopen (pchar filename, pchar mode, plong fp)

Purpose: closes the file currently associated with fp. Then, it opens the file named filename and associates this new file with fp.

Parameters:

  • filename - name of new file
  • mode - type of access permitted (see fopen())
  • fp - pointer to file

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

Back to top


:: fscanf() 
int fscanf (plong fp, pchar msg)

Purpose: scans input from the file designated by fp under control of the argument format.

Parameters:

  • fp - pointer to file
  • format - format-control string

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

Back to top


:: fseek() 
int fseek (plong fp, long offset, int where)

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:

  • fp - pointer to the file
  • offset - position to seek to
  • where - the offset will be relative to this location. Allowable values:
    • SEEK_SET - The new file position is computed relative to the start of the file. The value of offset must not be negative.
    • SEEK_CUR - The new file position is computed relative to the current file position. The value of offset may be positive, negative or zero.
    • SEEK_END - The new file position is computed relative to the end of the file.

Returns: 0 if successful, otherwise non-zero.

Platform: DOS and Windows

Back to top


:: ftell() 
long ftell (plong fp)

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

Back to top


:: fwrite() 
int fwrite (pchar buffer, int size, int count, plong fp)

Purpose: writes count elements of size bytes each to the file specified by fp.

Parameters:

  • buffer - storage location for data
  • size - item size in bytes
  • count - maximum number of items to be written
  • fp - pointer to file

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

Back to top


:: GactivateCLT() 
pchar GactivateCLT (int num_entries, int CLTsource, int src_start, int dst_start)

Purpose: Delayed (Gflush()able) version for changing a set of colors. Transfers the colors from a temporary CLT to the active CLT.

Parameters:

  • num entries - the number of CLT entries to load
  • CLTsource - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.
  • src_start - the starting index in the source (temporary) CLT
  • dst_start - the starting index in the destination (active) CLT

Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().

Platform: DOS and Windows

Back to top


:: Gadd() 
pchar Gadd (int test_screen/index, int operation, int repetitions, float arg1, float arg2, int arg3)

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:

  • test_screen/index (TEST0,TEST1,...,FIXSPOT,PLAY; #include "css_inc.h"; or color index)
  • operation (G_xy_MOVE_ABS, ..., see table below; #include "css_inc.h")
  • repetitions (must be =1 units of Gflush() calls: allows "automatic" repeats)
  • arg1 (depends on operation, see below)
  • arg2 (depends on operation, see below)
  • arg3 (depends on operation, see below)
Arguments for Gadd():

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

Back to top


:: Gadd_with_wait() 
pchar Gadd_with_wait (int test_screen/index, int operation, int repetitions, float arg1, float arg2, int wait_frames)

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:

  • test_screen/index (TEST0,TEST1,...,FIXSPOT,PLAY; #include "css_inc.h"; or color index)
  • operation (G_xy_MOVE_ABS, ..., see table below; #include "css_inc.h")
  • repetitions (must be =1 units of Gflush calls: allows "automatic" repeats)
  • arg1 (depends on message, see Gadd())
  • arg2 (depends on message, see Gadd())
  • arg3 (depends on message, see Gadd())
  • wait_frames (number of Gflush() calls until function will be executed)

Returns: pointer to the thread allocated by Gadd_with_wait()

See also: Gadd(), Gcheck(), Gdel(), Gflush(), Gpurge()

Platform: DOS and Windows

Back to top


:: Gcheck() 
long Gcheck (pchar active_thread)

Purpose: Returns the time remaining on a Gadd() thread in milliseconds.

Parameters:

  • active_thread - the value returned by a previous Gadd()

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

Back to top


:: GcolorABS() 
void GcolorABS (int index, int red, int green, int blue);

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().

  • index (index within color LUT)
  • red (0-255)
  • green (0-255)
  • blue (0-255)
See also: GcolorLUT(), GcolorREL(), ITEM_POSlut_index(), load_CLT(), set_CLT_load_index(), set_colorABS(), set_colorREL()

Platform: DOS and Windows

Back to top


:: GcolorLUT() 
void GcolorLUT (int index)

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:

  • CLTsource - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.

Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().

Platform: DOS and Windows

Back to top


:: GcolorLUTsubset() 
pchar GcolorLUTsubset (int num_entries, int CLTsource, int src_start, int dst_start)

Purpose: Delayed (Gflush()able) version for changing a set of colors. Transfers the colors from a temporary CLT to the active CLT.

Parameters:

  • num entries - the number of CLT entries to load
  • CLTsource - number of the CLT as it was loaded into Cortex, through the LUT:Get:From_Disk menu. The first CLT number should be 1.
  • src_start - the starting index in the source (temporary) CLT
  • dst_start - the starting index in the destination (active) CLT

Returns: pointer to thread added. Can be passed to Gcheck() or Gdel().

Platform: DOS and Windows

Back to top


:: GcolorREL() 
void GcolorREL (int index, int red, int green, int blue)

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:

  • index - index within color LUT [use ITEM_POSlut_index()]
  • added_red - offset from the current red value, can be positive or negative
  • added_green - offset from the current green value, can be positive or negative
  • added_blue - offset from the current blue value, can be positive or negative

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

Back to top


:: Gdel() 
void Gdel (pchar active_thread)

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:

  • active_thread (pointer to the graphical operation to be deleted; returned by Gadd())

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

See Also: Gadd(), Gpurge()

Platform: DOS and Windows

Back to top


:: GDPget_CLT() 
pchar GDPget_CLT (int num_colors, int bstart_index, pchar colors)

Purpose: gets the values of the active color lookup table (CLT) which is in use by graphics board

Parameters:

  • num_colors - the number of colors to be retrieved
  • start_index - the starting index in the active CLT
  • colors - the color data values. Internally, this parameter is a pointer to an array of BYTE_RGB structures which hold the red, green and blue values.


  • typedef struct { Platform: DOS and Windows

    Back to top


:: GDPset_CLT() 
void GDPset_CLT (int num_colors, int start_index, pchar colors)

Purpose: sets the values of the active color lookup table (CLT) which is in use by graphics board

Parameters:

  • num_colors - the number of colors to be set
  • start_index - the starting index in the active CLT
  • colors - the color data values. Internally, this parameter is a pointer to an array of BYTE_RGB structures which hold the red, green and blue values.


  • typedef struct {
    Platform: DOS and Windows

    Back to top


:: GetAKey() 
int GetAKey ()

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

Back to top


:: getch() 
int getch()

Purpose: Get a character from the console without echo

Parameters: none

See also: gets()

Platform: DOS only

Back to top


:: getCndsFileName() 
void getCndsFileName(pchar filename)

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

Back to top