C Functions
132 topics in this section.
B
C
C functions overview
The functionality of the D3 environment is available from the C programming language. This is made available through a s
C functions, integration
The steps necessary to integrate a user C program with the D3 run-time library are:
C programming language C functions
This section discusses C programming language functions.
C programming language C functions list
The following C functions are available.
C string
C string is a series of characters terminated by a null (0x00) character usually used in C.
CPSTR
CPSTR 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.
Custom signal processing
The D3 libraries make extensive use of signal processing. Because of this, the practice of reprogramming signals within
E
G
H
L
S
#
_CP_alpha
The _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_atvar
The _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
_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 sta
_CP_interrupt
_CP_interrupt is a global C integer which contains the last D3 interrupt that occurred. This value is the same as that r
_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 r
_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 e
_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 m
_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 s
_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
_CP_SADDR
_CP_SADDR returns a standard char* pointing to the first character of the string buffer within a CPSTR structure. Becaus
_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_precisi
_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
_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 eventu
_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
_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_system
The _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_time
The _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 v
_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
_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.