C Functions

C programming language C functions list

.md

The following C functions are available.

In this section

C stringC string is a series of characters terminated by a null (0x00) character usually used in C.CPSTRCPSTR defines the structure of a D3 data element manipulated from the C environment.CPSTR*CPSTR* points to a string structure used by routines that access D3 from the C programming language._CP_alphaThe _CP_alpha function is equivalent to the result = alpha(string) BASIC statement._CP_ascii_CP_ascii is equivalent to the result = ascii(string) BASIC statement._CP_at1_CP_at1 is equivalent to the result = @(x) BASIC statement._CP_at2_CP_at2 is equivalent to the result = @(x,y) BASIC statement._CP_atvarThe _CP_atvar function reads and writes D3 shell variables. It is equivalent to the BASIC u91 user exit._CP_break_CP_break is equivalent to the break expression BASIC statement._CP_build_msg_CP_build_msg queues up arguments for _CP_out_msg. This function, in conjunction with _CP_out_msg, is equivalent to the BASIC error statement. Each parameter is first stacked with _CP_build_msg, and then output with the _CP_out_msg._CP_call_CP_call is equivalent to the call name( {string1 {, string2 {, ...}}}) BASIC statement._CP_casing_CP_casing is equivalent to the casing expression BASIC statement._CP_cat_CP_cat is equivalent to the result = string1:string2 BASIC statement._CP_clearfile_CP_clearfile is equivalent to the clearfile BASIC statement._CP_clearselect_CP_clearselect is equivalent to the clearselect BASIC statement._CP_close_CP_close is equivalent to the close BASIC statement._CP_col1_CP_col1 is equivalent to the result = col1 BASIC statement._CP_col2_CP_col2 is equivalent to the result = col2 BASIC statement._CP_compare_CP_compare is equivalent to the result = (string1 = string2) BASIC statement._CP_convert_CP_convert is equivalent to the convert string1 to string2 in result BASIC statement._CP_count_CP_count is equivalent to the result = count(string1, string2) BASIC statement._CP_crt_CP_crt is equivalent to the crt BASIC statement._CP_crt_n_CP_crt_n is equivalent to the crt BASIC statement._CP_data_CP_data is equivalent to the data string BASIC statement._CP_date_CP_date is equivalent to the result = date() BASIC statement._CP_dcount_CP_dcount is equivalent to the result = dcount(string1, string2) BASIC statement._CP_debug_CP_debug is equivalent to the debug BASIC statement._CP_delete_CP_delete is equivalent to the result = delete(string, ac.expression, vc.expression, sc.expression) BASIC statement._CP_delete_item_CP_delete_item is equivalent to the delete expression,string BASIC statement._CP_dtx_CP_dtx is equivalent to the result = dtx(expression) BASIC statement._CP_ebcdic_CP_ebcdic is equivalent to the result = ebcdic(string) BASIC statement._CP_echo_CP_echo is equivalent to the echo expression BASIC statement._CP_execute_CP_execute is equivalent to the execute command capturing string1 returning string2 BASIC statement._CP_extract_CP_extract is equivalent to the result = extract(string, ac.expression, vc.expression, sc.expression) BASIC statement._CP_field_CP_field is equivalent to the result = field(string1, string2, expression) BASIC statement._CP_field_store_CP_field_store is equivalent to the result[string2, expression1, expression2] = string1 BASIC statement._CP_filelock_CP_filelock is equivalent to the filelock expression BASIC statement._CP_fileunlock_CP_fileunlock is equivalent to the fileunlock expression BASIC statement._CP_fold_CP_fold is equivalent to the result = fold(string1, string2, string3) BASIC statement._CP_footing_CP_footing is equivalent to the footing string BASIC statement._CP_get_CP_get is equivalent to the following BASIC statement:_CP_heading_CP_heading is equivalent to the heading string BASIC statement._CP_iconv_CP_iconv is equivalent to the result = iconv(string1, string2) BASIC statement._CP_in_CP_in is equivalent to the in result for expression BASIC statement._CP_index_CP_index is equivalent to the result = index(string1, string2, expression) BASIC statement._CP_input_CP_input is equivalent to the input BASIC statement._CP_insert_CP_insert is equivalent to the result = insert(string1, ac.expression, vc.expression, sc.expression, string2) BASIC statement._CP_interrupt_CP_interrupt is a global C integer which contains the last D3 interrupt that occurred. This value is the same as that returned by the BASIC function system(37). It is available when linking with the D3 libraries._CP_is__CP_is_ converts an integer into a CPSTR._CP_key_CP_key is equivalent to the key(string1, expression, string2, string3) BASIC statement._CP_load_CP_load is an optional function for preloading BASIC subroutines, before they are needed._CP_locate_CP_locate is equivalent to the following BASIC statement:_CP_lock_CP_lock is equivalent to the lock BASIC statement._CP_logon_CP_logon logs in to D3 from a C main program. This function must be called prior to any other function. This function returns -1 if an error occurs. The error code is contained in _CP_errno._CP_match_CP_match is equivalent to the result = string1 match string2 BASIC statement._CP_mkstr_CP_mkstr dynamically allocates a CPSTR* and fills it with a copy of cstring._CP_mkstrl_CP_mkstrl dynamically allocates a CPSTR* of length expression and fills it with a copy of cstring._CP_num_CP_num is equivalent to the result = num(string) BASIC function._CP_occurs_CP_occurs is equivalent to the result = occurs(string, expression) BASIC function._CP_oconv_CP_oconv is equivalent to the result = oconv(string1, string2) BASIC statement._CP_open_CP_open is equivalent to the open string1,string2 to fd BASIC statement._CP_out_CP_out is equivalent to the out BASIC statement._CP_out_msg_CP_out_msg outputs an error message which has been previously queued by _CP_build_msg. See _CP_build_msg for a coding example._CP_ovfly_subs_CP_ovfly_subs is equivalent to the result[expression1, expression2] = string1 BASIC statement._CP_page_CP_page is equivalent to the page BASIC statement._CP_page_n_CP_page_n is equivalent to the page expression BASIC statement._CP_pick_break_CP_pick_break causes all subsequent breaks to push a level or drop into the debugger as is standard in D3._CP_pick_env_CP_pick_env sets the application to a standard D3 environment. When using this setting, all terminal input and output must be done via D3 routines only (execute, print, crt). The default environment after logging on to D3 is _CP_pick_env._CP_precision_CP_precision is equivalent to the precision number BASIC statement._CP_print_CP_print is equivalent to the print string BASIC statement._CP_print_n_CP_print_n is equivalent to the print string BASIC statement._CP_print_on_CP_print_on is equivalent to the print on expression BASIC statement._CP_printer_CP_printer is equivalent to the printer expression BASIC statement._CP_prompt_CP_prompt is equivalent to the prompt BASIC statement._CP_read_CP_read is equivalent to the read, readu and readu locked BASIC statements (depending upon type):_CP_readfields_CP_readfields supports reading a set of named fields._CP_readnext_CP_readnext is equivalent to the readnext result,value from list BASIC statement._CP_readt_CP_readt is equivalent to the readt BASIC statement._CP_readv_CP_readv is equivalent to the readv BASIC statement._CP_release_CP_release is equivalent to the release expression,string BASIC statement._CP_release_all_CP_release_all is equivalent to the release BASIC statement._CP_replace_CP_replace is equivalent to the result = replace(string1, ac.expression, vc.expression, sc.expression, string2) BASIC statement._CP_replace_bridge_CP_replace_bridge is equivalent to the replace expression,string1 with string2 BASIC statement._CP_rewind_CP_rewind is equivalent to the rewind BASIC statement._CP_root_CP_root is equivalent to the root string1, string2 to result BASIC statement._CP_rs__CP_rs converts a double floating point number into a CPSTR. The precision of this function can be changed using the _CP_precision function._CP_SADDR_CP_SADDR returns a standard char* pointing to the first character of the string buffer within a CPSTR structure. Because _CP_SADDR is a macro, it can be used either to the left or right side of an assignment operator._CP_select_CP_select is equivalent to the select expression1 to list BASIC statement._CP_send_CP_send is equivalent to the send{x} string{:} to port.number BASIC statement._CP_si__CP_si_ converts a CPSTR into an integer._CP_sleep_CP_sleep is equivalent to the sleep(string) BASIC statement._CP_SLEN_CP_SLEN returns the length of the CPSTR*, string._CP_sort_CP_sort is equivalent to the result = sort(string) BASIC statement._CP_soundex_CP_soundex is equivalent to the result = soundex(string, type) BASIC statement._CP_space_CP_space is equivalent to the result = space(expression) BASIC statement._CP_sr__CP_sr_ converts a CPSTR into a double-float number. The precision of the conversion can be changed with the _CP_precision() function._CP_str_CP_str is equivalent to the result = str(string, expression) BASIC statement._CP_str_alloc_CP_str_alloc allocates space for a CPSTR. It is the equivalent of malloc(), but returns a CPSTR*. The expression should contain the length of the string buffer to allocate. A 0 is returned if a failure occurs._CP_str_copy_CP_str_copy makes a copy of a CPSTR. The actual contents of the string are copied rather than just the pointer._CP_str_free_CP_str_free releases the CPSTR* string back to the string pool to be allocated at a later time. All CPSTR*s must eventually be released with _CP_str_free._CP_str_null_CP_str_null points to a null length string. It should be used for reading only, to initialize a pointer with a pointer to a null string._CP_str_realloc_CP_str_realloc reallocates a CPSTR* to a new length._CP_str0_CP_str0 is a static CPSTR* that points to a single character string that contains 0. It should be used for reading only._CP_substr_CP_substr is equivalent to the result = string[beg.pos.expression, len.expression] BASIC statement._CP_sum_CP_sum is equivalent to the result = sum(string) BASIC statement._CP_systemThe _CP_system function is equivalent to the result = system(expression) BASIC statement._CP_TERM_CP_TERM terminates a CPSTR* string with a null character._CP_timeThe _CP_time function is equivalent to the result = time() BASIC statement._CP_timedate_CP_timedate is equivalent to the result = timedate() BASIC statement._CP_trans_CP_trans is equivalent to one of several BASIC transaction processing statements depending on the op parameter. Valid values of op are:_CP_trim_CP_trim is equivalent to the result = trim(string) BASIC statement._CP_unix_break_CP_unix_break causes all subsequent breaks to terminate the process as is standard in UNIX applications._CP_unix_env_CP_unix_env sets the application to a standard UNIX environment. When using this setting, all terminal input and output must be done via standard UNIX routines only (system, printf, scanf)._CP_unlock_CP_unlock is equivalent to the unlock expression BASIC statement._CP_unlock_all_CP_unlock_all is equivalent to the unlock BASIC statement._CP_weof_CP_weof is equivalent to the weof BASIC statement._CP_write_CP_write is equivalent to the write or writeu BASIC statements._CP_writefields_CP_writefields supports writing a set of named fields._CP_writet_CP_writet is equivalent to the writet BASIC statement._CP_writev_CP_writev is equivalent to the writev and writevu BASIC statements._CP_xtd_CP_xtd is equivalent to the result = xtd(string) BASIC statement.