📄 trsapi.h
字号:
/* They set low and high guards, and can check their integrity. */
TRSAPI(void, trsGuardPattern,(long pattern, int number));
/* Set pattern for guard, and number of guards (0<number<=16). */
/* Default: trsGuardPattern(0xA55A,1), is set before each test. */
TRSAPI(long int, trsGuardAllocated,(long int base));
/* Returns total memory allocated, relative to base. If base==0, return */
/* absolute value: */
/* base=trsGuardAllocated(0); */
/* ptr=trsGuardcAlloc(10,20); */
/* trsGuardAllocated(base) => 200 */
/* trsGuardFree(ptr); */
/* trsGuardAllocated(base) => 0 */
TRSAPI(void *, trsGuardcAlloc,(size_t number, size_t size));
/* calloc(number,size) and put low and high guard */
TRSAPI(void *, trsGuardFree,(void * ptr));
/* Check guarded memory, and if is OK, then free it and returns NULL. */
/* If guards corrupted, returns ptr. */
TRSAPI(int, trsGuardCheck,(void * ptr));
/* Check guarded memory, allocated by guardcAlloc. Returns: */
/* 0 - if memory OK */
/* -1 - if low guard is corrupted */
/* 1 - if high guard is corrupted */
/* --- Allocate / Deallocate -----------------------------------------------*/
TRSAPI(void *, trsmAlloc, (size_t size));
TRSAPI(void *, trsreAlloc, (void *buf,size_t size));
TRSAPI(float *, trssbAllocate,(int n));
TRSAPI(double *, trsdbAllocate,(int n));
TRSAPI(short *, trswbAllocate,(int n));
TRSAPI(int *, trsibAllocate,(int n));
TRSAPI(long *, trslbAllocate,(int n));
TRSAPI(void *, trsFree, (void * ptr));
/* --- Input ----------------------------------------------------------------*/
/* Read data from console, command line or .ini file. */
/* dst - variable address, where to place entered data. */
/* def - default value, is assigned if <CR> was entered. */
/* if def=="", then trs<?>Reads will wait for any valid input. */
/* if def==NULL, then, if there is no valid input, function returns 0,*/
/* trsReadSource()=>TRS_None, and trsStatus()=>TRS_CONTINUE */
/* help - help line, printed if '?' was entered */
/* All this functions return value: */
/* 1 - if read was successful, i.e. some value was assigned to dst, */
/* 0 - if entered command was !n,!q,!p,!r, or (<cr> with def==NULL), and */
/* no value was assigned to dst. */
/* Extra available input for all ?Read functions: */
/* ? - help on value !e - exit current test */
/* ?? - test header !q - quit */
/* ?h - help on test !r - retry current test */
/* ?l - test listing !p - go to previous test */
/* ?L - whole source file listing !t - go to top of test list */
/* ; - token separator */
/* < - get current value from ini file */
/* *< - get current and rest values from ini file */
/* > - put current value to ini file */
/* *> - put all defined values to ini file */
/* Case,Bit and tRead need first token to be their valid value: */
/* ...,text [abc]=> new;> */
/* or */
/* ...,text [abc]=> ;> */
/* but not extra input: */
/* ...,text [abc]=> > */
TRSAPI(int, trsCaseRead,(int *dst, char *items, char *def, char *helps));
/* Function trsCaseRead assignes to dst item's number, if answer string was */
/* found in items list. Items are counted from 0 by step 1. */
/* First char in items is separator. */
/* Returns: */
/* 1 - if item was recognized */
/* 0 - if command was !n,!q,... */
/* First symbol in items is separator. */
/* Example: */
/* if (!trsCaseRead(Mode,"/C/Exit","Exit","Continue/Exit program")) */
/* return TRS_UNDEF; */
/* if (trsReadSource()==TRS_Default) ... */
/* or */
/* if (!trsCaseRead(Mode,"/C/Exit","C","Continue/Exit program")) */
/* if (trsStatus()==TRS_QUIT) ... */
/* */
TRSAPI(int, trsBitRead, (long int *dst, char *items, char *def, char *helps));
/* Function trsBitRead sets bits into dst if respective item from list was */
/* found. It returns: */
/* 1 - if item was recognized */
/* 0 - if command was !n,!q,... */
/* */
/* Format of items and helps is as in function trsCaseRead */
TRSAPI(int, trstRead,(char *dst, int size, char *def, char *help));
/* size = sizeof(dst[]) */
typedef enum { s_fvr,c_fvr,d_fvr,z_fvr,
w_fvr,v_fvr,i_fvr,j_fvr,l_fvr,
text_fvr,case_fvr,bit_fvr} TRSfvr_t;
TRSAPI(int, trslRead,(long *dst, char *def, char *help));
TRSAPI(int, trswRead,(short *dst, char *def, char *help));
TRSAPI(int, trsiRead,(int *dst, char *def, char *help));
TRSAPI(int, trssRead,(float *dst, char *def, char *help));
TRSAPI(int, trsdRead,(double *dst, char *def, char *help));
TRSAPI(int, trs_Read,(void *dst, char *name,void *extra, char *def,
char *help,TRSfvr_t dsttype));
TRSAPI(int, trslbRead,(long *dst, int n, char *def, char *help));
TRSAPI(int, trswbRead,(short *dst, int n, char *def, char *help));
TRSAPI(int, trsibRead,(int *dst, int n, char *def, char *help));
TRSAPI(int, trssbRead,(float *dst, int n, char *def, char *help));
TRSAPI(int, trsdbRead,(double *dst, int n, char *def, char *help));
TRSAPI(int, trs_bRead,(void *dst, char *name,int n,char *def,char *help,
TRSfvr_t dsttype));
TRSAPI(int, trsPause, (char *def, char *help));
/* --- Returned Flow Status after ?Reads ------------------------------------*/
#define TRS_CONTINUE 0 /* Normal flow */
#define TRS_RETRY -101 /* Restart current test !r */
#define TRS_PREVIOUS -102 /* Start previous test !p */
#define TRS_EXIT -103 /* Exit test with trsResult(0) !e */
#define TRS_TOP -104 /* Go to top of list !t */
#define TRS_QUIT -105 /* Quit test system tsResult(0) !q */
TRSAPI(int, trsStatus,(void)); /* Return flow status */
/* --- Returned source type from where was last Read ------------------------*/
#define TRS_NoInFile -3 /* No value in .ini file */
#define TRS_None -2 /* No any read */
#define TRS_DefaultNull -1 /* <CR> was entered and default==NULL*/
#define TRS_Default 0 /* <CR> was entered, default accepted*/
#define TRS_TTYInput 1 /* direct answer: Enter var> 1,1 */
#define TRS_IndirectTTY 2 /* previously entered "var=src" */
#define TRS_FileInput 3 /* found in file .ini */
#define TRS_CmdLine 4 /* through -D "var=src" */
TRSAPI(int, trsReadSource,(void)); /* Return read source */
/*****************************************************************/
/* --- Generate special benchmark output file -------------------*/
/*****************************************************************/
TRSAPI(void, trsCSVString5,(char *flavour,char *function,char *value,
char *units, char *comments));
TRSAPI(void, trsCSVString6,(char *flavour,char *function,char *value,
char *units, char *comments,char *param1));
TRSAPI(void, trsCSVString7,(char *flavour,char *function,char *value,
char *units, char *comments,
char *param1, char *param2));
TRSAPI(void, trsCSVString8,(char *flavour,char *function,char *value,
char *units, char *comments,
char *param1, char *param2, char *param3));
TRSAPI(void, trsCSVString9,(char *flavour,char *function,char *value,
char *units, char *comments,char *param1,
char *param2, char *param3, char *param4));
TRSAPI(void, trsCSVString10,(char *flavour,char *function,char *value,
char *units, char *comments,char *param1,
char *param2, char *param3, char *param4,
char *param5));
TRSAPI(void, trsCSVString11,(char *flavour,char *function,char *value,
char *units, char *comments,char *param1,
char *param2, char *param3, char *param4,
char *param5, char *param6));
TRSAPI(void, trsCSVString12,(char *flavour,char *function,char *value,
char *units, char *comments,char *param1,
char *param2, char *param3, char *param4,
char *param5, char *param6, char *param7));
TRSAPI(char *, trsFloat ,(float src));
TRSAPI(char *, trsShort ,(short src));
TRSAPI(char *, trsDouble,(double src));
TRSAPI(char *, trsInt ,(int src));
trsProcessorInfo InitProcessorInfo();
/* Only for compatibility with timapi.c */
TRSAPI(void, trsCommandLine,(int argc, char *argv[]));
/* ==========================================================================*/
/* Private section of test system */
#include "trsipi.h" /* Redefinitions and common objects */
#ifdef __cplusplus
}
#endif
#endif /* _TRSAPI_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -