gCAD3D 2.35
ut_txt.h File Reference

Go to the source code of this file.

Macros

#define TXT_Typ_EOF   0
 
#define TXT_Typ_spec   1
 
#define TXT_Typ_text   2 /* nicht in " eingeschlossenen Texte */
 
#define TXT_Typ_num   3
 
#define TXT_Typ_string   4 /* in " eingeschlossenen Texte */
 
#define term_anz   1
 Anzahl Zeilentrennzeichen 2 (CRLF), or 1 (LF). More...
 
#define term_buf   "\n"
 
#define fnam_del   '/'
 FilenamedelimiterChar. More...
 
#define fnam_del_s   "/"
 
#define UTX_Clear(str)   str[0] = '\0'
 
#define UTX_Siz(sSiz, sStart0, sStart1)   sStart0 + sSiz - sStart1
 clear string More...
 
#define UTX_skip_1bl(tp)   {++(*(tp)); while(**(tp) == ' ') ++(*(tp));}
 skip the active char and following blanks. tp=(char**) ! More...
 
#define UTX_pos_skipLeadBlk(p1)   while(*p1 == ' ') ++p1
 skip blanks (returns Position of first non-blank) More...
 
#define UTX_pos_EOS(p1)   strchr(p1, '\0')
 find end of string ('\0') p1 = UTX_pos_EOS(cString); More...
 
#define UTX_wTab_tmpSpc(wa, waSiz)   (wa)=(char**)MEM_alloc_tmp((waSiz)*sizeof(void*))
 

Functions

void UTX_cp_word_2_upper (char *txtout, char *txtin)
 
char * UTX_cp_word_term (char *txtOut, char *txtIn, char term)
 
char UTX_cp_word_t (char *txtOut, char **cBuf)
 
char * UTX_cp_word__ (char *txtOut, char *txtIn)
 
int UTX_cp_right (char *sOut, char *sIn, int cNr)
 
char * UTX_cp_expr (char *cbo, char *cbi)
 
int UTX_ftyp_s (char *ftyp, char *cbuf, int mode)
 
int UTX_fnam_s (char *fnam, char *cbuf)
 
int UTX_fdir_s (char *fdir, char *cbuf)
 
char UTX_pos_del (char **, char **)
 
long UTX_pos_del_next (char *cBuf, long cPos)
 
long UTX_pos_del_prev (char *cBuf, long cPos)
 
char * UTX_pos_eos (char *)
 
char * UTX_pos_1n (char *)
 
char * UTX_pos_skipBrack (char *cbuf)
 
char * UTX_pos_skipBrack1 (char *cbuf)
 
int UTX_pos_skipTermWord (char **wNxt, char *cbuf)
 
char * UTX_pos_skipWord (char *cbuf)
 
char * UTX_pos_skipWords (int wNr, char *p1)
 
char * UTX_pos_skipStr (char *cbuf)
 
char * UTX_pos_skipDeli1 (char *p1)
 
int UTX_pos_skip_int (char **ps)
 
int UTX_ckc_Del1 (char c1)
 
int UTX_ckc_Del2 (char c1)
 
int UTX_ck_num_i (char *s1)
 
int UTX_ck_num_f (char **pOut, char *cbuf)
 
int UTX_ck_num_digNr (char **cpo, char *cpi)
 
int UTX_cmp_word_wordtab (char *wdtab[], char *wd1)
 
char * UTX_2db_tx (double *d1, double *d2, char *cbuf)
 
double UTX_db_tx (char **po, char *pi)
 
int UTX_add_i_u (char[], int)
 
int UTX_add_db (char outBuf[], double *db1)
 
int UTX_add_pt (char outBuf[], void *pt1)
 
int UTX_add_fl_u (char[], double)
 
int UTX_add_fl_u2 (char[], double, double)
 
int UTX_add_fl_u3 (char[], double, double, double, char chDel)
 
int UTX_add_fl_ua (char[], double *da, int dNr, char chDel)
 
int UTX_add_fl_f (char[], double, int)
 
char * UTX_add_fl_1uf (char *outBuf, double d1)
 
int UTX_add_fl_10 (char[], double)
 
int UTX_add_fl_15 (char[], double)
 
int UTX_del_chr (char *cbuf, char cx)
 
int UTX_del_foll0 (char strBuf[])
 
void UTX_del_follBl (char *cbuf)
 
int UTX_del_FilTx (char *dtxt, char *filNam)
 
char * UTX_fgets (char *line, int len, FILE *fp)
 
int UTX_fgetLine (char *cbuf, int sizBuf, char *filNam, int lNr)
 
int UTX_fsavLine (char *cbuf, char *filNam, int lnMaxSiz, int lNr)
 
int UTX_fRevL (char *fno, char *fni)
 
void UTX_ins_s2 (char *, char *, int)
 
char * UTX_CleanCR (char *string)
 =========================================================== More...
 
void UTX_CleanSC (char *)
 
void UTX_CleanAN (char *)
 
int UTX_CleanCommC (char *cBuf)
 
int UTX_Clean_db (char *)
 
int UTX_chg_chr1 (char newChr, char oldChr, char *cBuf)
 
int UTX_chg_str1 (long *datSiz, void *datStart, void *insDat, void *delPos, long delSiz)
 
int UTX_chg_str2 (int sSiz, char *sDat, char *sOld, char *sNew)
 
int UTX_chg_nr (char *txtOut, int iNr)
 
int UTX_chg_wordn (char *sOut, char *wNew, int wNr, long lenMax)
 
char * UTX_CleanBracks (char *txtbuf, char ch1, char chr2)
 
int UTX_endDelChar (char *txtbuf, char chr)
 
int UTX_get_word (char **txtIn, char **w_next, char *txtOut, double *val, char *deli)
 
char * UTX_find_word1 (char *was, char *wo)
 
char * UTX_find_Del1 (char *p1)
 
char * UTX_find_strrstr (char *cbuf, char *str)
 
int UTX_strcmp_right (char *string, char *text)
 
int UTX_ck_casenChr (char *s1, char *s2, int cNr)
 
char * UTX_memFind (char *buf, char *str)
 
char * UTX_memFind1 (char *buf, long bufSiz, char *str, long strSiz)
 
char * UTX_memstr (char *von, char *bis, char *sstr)
 
int UTX_insert1 (char *cbuf, long *bufSiz, char *auxBuf, long cPos)
 
int UTX_cut1 (char *cbuf, long *bufSiz, long cPos, long txLen)
 
int UTX_wTab_ck (char *wTab[], char *w1)
 
char ** UTX_wTab_file (char *memspc, int memSiz, char *fnam)
 
int UTX_wordnr (char *cbuf)
 
int UTX_setup_set (char *fn, char *par, char *val)
 
int UTX_setup_get (char *cval, char *ctyp, char *fnam, int mode)
 
int UTX_setup_modw (char *fn, char *par, char *wNew, int wNr)
 
int UTX_setup_decs (char *s1, char **pv)
 
int UTX_cat_file (FILE *fpo, char *fnam)
 
int UTX_dir_listf (char *outFilNam, char *fPath, char *fNam, char *fTyp)
 
int UTX_cnr_chr (char *txt, char c1)
 
int UTX_str_file (char *txbuf, long *fSiz, char *fnam)
 

Variables

const char TX_NUL
 

Macro Definition Documentation

#define TXT_Typ_EOF   0
#define TXT_Typ_spec   1
#define TXT_Typ_text   2 /* nicht in " eingeschlossenen Texte */
#define TXT_Typ_num   3
#define TXT_Typ_string   4 /* in " eingeschlossenen Texte */
#define term_anz   1

Anzahl Zeilentrennzeichen 2 (CRLF), or 1 (LF).

#define term_buf   "\n"
#define fnam_del   '/'

FilenamedelimiterChar.

#define fnam_del_s   "/"
#define UTX_Clear (   str)    str[0] = '\0'
#define UTX_Siz (   sSiz,
  sStart0,
  sStart1 
)    sStart0 + sSiz - sStart1

clear string

get length of rest of string

#define UTX_skip_1bl (   tp)    {++(*(tp)); while(**(tp) == ' ') ++(*(tp));}

skip the active char and following blanks. tp=(char**) !

sSiz total size of string from sStart0 to end of string
sStart0 start of stringbuffer
sStart1 first free char in stringbuffer (space sStart0 - sStart1 is in use)
retCode remaining space from sStart1 to end of string
#define UTX_pos_skipLeadBlk (   p1)    while(*p1 == ' ') ++p1

skip blanks (returns Position of first non-blank)

#define UTX_pos_EOS (   p1)    strchr(p1, '\0')

find end of string ('\0') p1 = UTX_pos_EOS(cString);

#define UTX_wTab_tmpSpc (   wa,
  waSiz 
)    (wa)=(char**)MEM_alloc_tmp((waSiz)*sizeof(void*))

UTX_wTab_tmpSpc get tempSpace for UTX_wTab_str (see UTX_wTab_str) memspace exists only until active function returns

Function Documentation

void UTX_cp_word_2_upper ( char *  txtout,
char *  txtin 
)
UTX_cp_word_2_upper copy and change word into capitalletters.
Max 80 char's.
txtout / txtin may be same address
char* UTX_cp_word_term ( char *  txtOut,
char *  txtIn,
char  term 
)
UTX_cp_word_term copy word from startpos to (excluding) term
Returncode:
position after terminating character;
'\0', if terminating character <term> does not exist.
char UTX_cp_word_t ( char *  txtOut,
char **  cBuf 
)
UTX_cp_word_t copy next word, give terminator
Outputs:
Returns the delimiter found as single character
cBuf: word, Terminator & following blanks skipped
txtOut: word (no leading/following blanks, no terminator) Max 252 chars.
can be empty (*txtOut == '\0')
Delimiterzeichen sind:
"'()*+,-/;<=> und blank
Usage-example:
char cBuf[256], tc;
L_nxt: tc = UTX_cp_word_t (cBuf, &tPos);
if(cBuf[0] == '\0') return 0; // outputstring empty
..
if(tc != '\0') goto L_nxt; // inputstring empty
Nachfolgend kann man das Wort abtrennen durch
*cp2 = '\0';
char* UTX_cp_word__ ( char *  txtOut,
char *  txtIn 
)

UTX_cp_word__ copy next word

int UTX_cp_right ( char *  sOut,
char *  sIn,
int  cNr 
)
UTX_cp_right copy n chars from right side of string
ATTENTION: size of sOut must be (cNr + 1) !
- terminates always with '\0'
sOut may not overlap sIn.
RetCode: 0=equal; else=notEqual.
UTX_cp_right (s2, s1, sizeof(s2) - 1);
char* UTX_cp_expr ( char *  cbo,
char *  cbi 
)
UTX_cp_expr copy expression (without closing bracket)
!!! cbi may not include starting bracket !!!
cbi: |3 + 2)| cbo: |3 + 2| RetCod: ||
cbi: |4+(2*4))+2| cbo: |4+(2*4)| RetCod: |+2|
cbi: |sin(4+(2*4))+2| cbo: |sin(4+(2*4)| RetCod: |+2|
RetCode:
position of first char after closing bracket.
NULL Error
int UTX_ftyp_s ( char *  ftyp,
char *  cbuf,
int  mode 
)
UTX_ftyp_s get filetyp from filename (change => upper)
Input:
mode = 0 do not change ftyp-case
mode = 1 change ftyp > upperLetters
Output:
ftyp uppercase
IRC 0: Filetyp out in ftyp (in Groszbuchstaben)
IRC -1: kein Filetyp gefunden ..
".0" kein Filetyp !
int UTX_fnam_s ( char *  fnam,
char *  cbuf 
)
UTX_fnam_s get fnam from string
alles nach dem letzten FilenamedelimiterChar fnam_del ist fileName;
kein fnam_del: fnam = s
IRC 0: OK, fnam out
IRC -1: kein Filename gefunden ..
int UTX_fdir_s ( char *  fdir,
char *  cbuf 
)
UTX_fdir_s get fileDirectory from string
last char ist immer der FilenamedelimiterChar !
alles vor dem letzten FilenamedelimiterChar fnam_del ist fileDir;
Wenn erster Char ist fnam_del: absolutes fileDir; else relativ.
relativ: das pwd (os_bas_dir) vorne weg ...
char UTX_pos_del ( char **  ,
char **   
)
UTX_pos_del find next delimiter (blank or "'()*+,-/;<=>)
Input:
txtIn: startpos
Output:
txtIn: leading blanks skipped
w_next: the pos of the deli
RetCod: the delimiter as single character
Delimiterzeichen sind:
" ""'()*+,-/;<=>"
Beispiel:
char *cp1, *cp2, deli;
deli=UTX_pos_del(&cp1, &cp2);
Nachfolgend kann man das Wort abtrennen durch
*cp2 = '\0';
long UTX_pos_del_next ( char *  cBuf,
long  cPos 
)
find next delimiter (blank nach cPos)
Return pos of first char of word after cPos
Input:
cBuf string
cPos startpos as long
Output:
RetCod: position of blank in cBuf as long
Klammerausdruecke skippen !
long UTX_pos_del_prev ( char *  cBuf,
long  cPos 
)
find previous delimiter (blank vor cPos)
Return pos of first char of word before cPos
Klammerausdruecke skippen !
".. MOD (2)" ??
char* UTX_pos_eos ( char *  )
char* UTX_pos_1n ( char *  )
char* UTX_pos_skipBrack ( char *  cbuf)
UTX_pos_skipBrack find corresponding ')' (returns Position of ')')
find end of bracket ..
Input:
cbuf: '(' must be the first character !
Output:
retCod the position of the ')' corresponding to cbuf[0]
char* UTX_pos_skipBrack1 ( char *  cbuf)
UTX_pos_skipBrack1 find corresponding ')' (returns Position of ')')
find end of bracket ..
Input:
cbuf: !!! first '(' is not included in *cbuf !!!
Output:
retCod the position of the ')' corresponding to the missing ')'
Examples:
strcpy(s1, "(3*3*sin(9)) + (4*4))");
UTX_pos_skipBrack1(&s1[1]); returns ") + (4*4))"
int UTX_pos_skipTermWord ( char **  wNxt,
char *  cbuf 
)
char* UTX_pos_skipWord ( char *  cbuf)
returns Pos. of first char after word (the delimiter !)
find next '\0' oder ','; skip "(...)".
DOES NOT (YET) SKIP STRINGS ("...").
following blanks werden geskippt
char* UTX_pos_skipWords ( int  wNr,
char *  p1 
)

UTX_pos_skipWords skip wNr Words (ret. Pos. of first char after word)

char* UTX_pos_skipStr ( char *  cbuf)
UTX_pos_skipStr find corresponding \" (skip string)
find end of string ..
Input:
cbuf: '\"' must be the first character !
Output:
retCod the position of the '\")' corresponding to cbuf[0]
cp2 = UTX_pos_skipStr (cp1);
if(*cp2) - handle error ..
char* UTX_pos_skipDeli1 ( char *  p1)

UTX_pos_skipDeli1 skip delimiter ' ' ',' '
' '' ''

int UTX_pos_skip_int ( char **  ps)

skip int-number in string

int UTX_ckc_Del1 ( char  c1)
UTX_ckc_Del1 check if char is a delimiter
RC 0 = yes, char is a delimiter
RC 1 = no;
int UTX_ckc_Del2 ( char  c1)
UTX_ckc_Del2 check if char is a delimiter
RC 0 = yes, char is a delimiter
RC 1 = no;
int UTX_ck_num_i ( char *  s1)
UTX_ck_num_i test if word is numeric (int)
RetCod: -1 s1 does NOT start with an integer
else nr of characters (including sign)
int UTX_ck_num_f ( char **  pOut,
char *  cbuf 
)
UTX_ck_num_f test if word is numeric (float)
+-. und Ziffern sind numer.!
Output:
pOut delimitchar (first char after number)
retCod 0 yes, numeric
-1 no, is text ..
int UTX_ck_num_digNr ( char **  cpo,
char *  cpi 
)
returns nr of consecutive digits starting at cpi
first character (*cpi) should be a digit (else returns 0)
cpi must be terminated with '\0'
cpo is the first non-digit-character
int UTX_cmp_word_wordtab ( char *  wdtab[],
char *  wd1 
)
check if word wd1 is in list wdtab.
!!! wdtab must be terminated by "" !!!!
Retcod:
-1 wd1 not in wordList wdtab
>=0 wd1 is wdtab[Retcod]
char *wdtab[]={"CUT","TRIM","nix",""};
(int)wNr = UTX_cmp_word_wordtab (wdtab, "TRIMM");
char* UTX_2db_tx ( double *  d1,
double *  d2,
char *  cbuf 
)

see also UT3D_pt_txt

double UTX_db_tx ( char **  po,
char *  pi 
)
read float from ascii-string
po == pi erlaubt ..
ACHTUNG: pi muss veraenderbar sein !! (D wird in E umgewandelt ...)
int UTX_add_i_u ( char  [],
int   
)

UTX_add_i_u add integer to string

int UTX_add_db ( char  outBuf[],
double *  db1 
)

add double unformatted; Trennzeichen ist blank.

int UTX_add_pt ( char  outBuf[],
void *  pt1 
)

add Pointcoords unformatted; Trennzeichen ist blank.

int UTX_add_fl_u ( char  [],
double   
)
UTX_add_fl_u add double unformatted (del foll. 0's and ".")
Delete following 0's and following ".".
int UTX_add_fl_u2 ( char  [],
double  ,
double   
)
UTX_add_fl_u2 add double,double unformatted (del foll. 0's and ".")
2 Doubles (Komma dazwischen)
int UTX_add_fl_u3 ( char  [],
double  ,
double  ,
double  ,
char  chDel 
)
UTX_add_fl_u3 add 3 doubles unformatted (del foll. 0's and ".")
chDel delimiting character; eg blank ..
3 Doubles (Komma dazwischen)
int UTX_add_fl_ua ( char  [],
double *  da,
int  dNr,
char  chDel 
)
UTX_add_fl_ua add n doubles unformatted (del foll. 0's and ".")
chDel delimiting character; eg blank ..
int UTX_add_fl_f ( char  [],
double  ,
int   
)
UTX_add_fl_f add double with x digits after dec.point
to string. The nr of digits before dec.point is floating.
IGES verwendet %.10f !
char* UTX_add_fl_1uf ( char *  outBuf,
double  d1 
)
UTX_add_fl_1uf add double with max.1 digit after dec.point
unformatted (remove following ".0")
see also UTX_add_fl_f
int UTX_add_fl_10 ( char  [],
double   
)

UTX_add_fl_10 add double with 10 signif digits

int UTX_add_fl_15 ( char  [],
double   
)

UTX_add_fl_15 add double with 15 signif digits

int UTX_del_chr ( char *  cbuf,
char  cx 
)

UTX_del_chr delete all characters <cx> out of string cbuf

int UTX_del_foll0 ( char  strBuf[])
Delete following 0's and following ".".
void UTX_del_follBl ( char *  cbuf)
UTX_del_follBl delete following blanks
see also UTX_CleanCR
int UTX_del_FilTx ( char *  dtxt,
char *  filNam 
)
delete all lines containing <dtxt>
uses file <filNam>.tmp
char* UTX_fgets ( char *  line,
int  len,
FILE *  fp 
)
UTX_fgets Zeile aus Datei lesen und CR',s LF's am Ende deleten.
Lesen einer Datenzeile aus einer Datei.
Im gelesenen String werden von hinten nach vorne ueberfluessige
Blanks ' ', Carriage Returns '\r' und Linefeeds '\n' durch
Nullzeichen '\0' ersetzt (bis zum ersten Vorkommen eines
anderen Zeichens).
int UTX_fgetLine ( char *  cbuf,
int  sizBuf,
char *  filNam,
int  lNr 
)
UTX_fgetLine read line nr. <lNr> out of file <filNam>
first line has lineNr 1
sizBuf size of cbuf
rc -1 File does not exist
rc -2 Line does not exist
rc 0 OK
int UTX_fsavLine ( char *  cbuf,
char *  filNam,
int  lnMaxSiz,
int  lNr 
)
UTX_fsavLine change line Nr. <lNr> in file <filNam>
Input:
cbuf line to add/modify
filNam
lnMaxSiz max. size of lines of file <filNam>
lNr -1 add line; else modify existing line;
First line is lNr=1.
if file has less lines, empty lines are added.
RetCod: 1 File did not exist; created
2 Line did not exist; added.
0 OK
// -1 Error
int UTX_fRevL ( char *  fno,
char *  fni 
)
UTX_fRevL File revert lines; eine Datei zeilenweise umdrehen;
letze Zeile wird zur ersten, vorletze Zeile wird zur zweiten usw.
void UTX_ins_s2 ( char *  ,
char *  ,
int   
)
UTX_ins_s2 insert string left (s1=s2+s1)
UTX_ins_s2 insert string links (s1 = s2//s1)
DO NOT USE; use MEM_ins_str
maxlen ist die max. Lšnge des S1!
s2 MAX 256 chars !!!!!!!!!!!!!
see also UTX_ins_add
char* UTX_CleanCR ( char *  string)

===========================================================

=========================================================== UTX_CleanCR Delete Blanks, CR's u. LF's am Ende. Ersetzung von Blanks, Carriage Returns und Linefeeds durch Nullzeichen von hinten nach vorne bis zum ersten von diesen verschiedenen Zeichen.

UTX_CleanCR Delete Blanks, CR's and LF's at end of string
returns positon of stringterminator \0
void UTX_CleanSC ( char *  )
change all special-chars into '?'
special-char: all (char < ' ') or (char > '}')
void UTX_CleanAN ( char *  )
change all chars not alpha or numeric into '_'
keep [0-9],[A-Z],[a-z]; change others into '_'
int UTX_CleanCommC ( char *  cBuf)

Clean C-Comments (remove // comment and following blanks)

int UTX_Clean_db ( char *  )
clean doubles (change ',' into '.') in gesamter cbuf
MS-Win schreibt "1,0"
See also UTX_chg_chr1.
int UTX_chg_chr1 ( char  newChr,
char  oldChr,
char *  cBuf 
)

in cBuf alle oldChr aendern in newChr (Replace)

int UTX_chg_str1 ( long *  datSiz,
void *  datStart,
void *  insDat,
void *  delPos,
long  delSiz 
)
UTX_chg_str1 change a part in a string
string (datStart) must be terminated with '\0'
Input:
datStart Startposition des String
insDat String to insert
delPos Position where to delete and where to insert
delSiz how much bytes to delete at Pos delPos
Output:
datSiz new size of string (datStart)
strcpy(cbuf, "1234567890"); l1 = strlen(cbuf);
UTX_chg_str1 (&l1, cbuf, "AAA", &cbuf[4], 1); // 5 -> AAA
int UTX_chg_str2 ( int  sSiz,
char *  sDat,
char *  sOld,
char *  sNew 
)
UTX_chg_str2 change <sOld> into <sNew> in <sDat>
RetCod:
-1 Error; sDat too small
0 OK; modified ..
1 OK but sOld did not exist in sDat
int UTX_chg_nr ( char *  txtOut,
int  iNr 
)
change int-number in line beginning at txtOut into iNr
Returncode = Laengendifferenz vorher - nachher
int UTX_chg_wordn ( char *  sOut,
char *  wNew,
int  wNr,
long  lenMax 
)
change word nr wNr in string sOut into word sNew
word-delimiter is blank.
Input:
sOut string with 1-n words; delimiter = blank; 0-terminated.
wNew new word, 0-terminated
wNr first word is 0
lenMax max. length of string sOut
Output:
sOut word modified
char* UTX_CleanBracks ( char *  txtbuf,
char  ch1,
char  chr2 
)
UTX_CleanBracks Remove first/last char (brackets ..)
ACHTUNG: veraendert txtbuf; ueberschreibt ev. last char.
Example:
cp1 = UTX_CleanBracks (cp1, '(', ')');
int UTX_endDelChar ( char *  txtbuf,
char  chr 
)

UTX_endDelChar if last char of string == chr: remove it.

int UTX_get_word ( char **  txtIn,
char **  w_next,
char *  txtOut,
double *  val,
char *  deli 
)
UTX_get_word get next word and its delimiter and typ of word
Input:
txtIn startpos
Output:
txtIn leading blanks skipped
w_next Startpos des nach dem 1. Wort folgenden Textes;
excluding Delimiter, but not operators, Blanks skipped.
txtOut Kopie des 1. Wortes im Buffer txtIn; max. 32 char;
(nur bei Typ 1 und 2); without leading & following blanks
val value (des 1. Wortes, atof)
deli der Delimiter (ein single char; der erste char NACH dem Wort)
Returncodes:
TXT_Typ_EOF 0 = end of txtIn (empty);
TXT_Typ_spec 1 = spec.char (out in txtOut) + - / * ^ . ; ( ) $ ,
TXT_Typ_text 2 = alfatext, (out in txtOut) delimiters are blank , + - / *
. _ does not terminate text.
TXT_Typ_num 3 = num. value (double, out in val);
TXT_Typ_string 4 = string (durch " beidseitig begrenzt) String is copied
to txtOut (max 32 chars) without ", terminated with \0
Beispiele:
RC val deli w_next txtOut
"+3" num 3 ' ' "" -
"-3+2" num -3 '+' "2" -
"-3 -2" num -3 ' ' "-2" - <<<<<<<<<
"- 3" spec '-' "3" "-"
"*3" spec '*' "3" "*"
"(3+1)*2" spec ' ' "3" "("
"v1=5" text - '=' "5" "v1"
"v1 = 5" text - '=' "5" "v1"
"v1-5" text - '-' "5" "v1" <<<<<<<<<
"v1 -5" text - ' ' "-5" "v1" <<<<<<<<<
"v1 p2" text - ' ' "p" "v1"
""ab "" string ' ' "ab "
"abc "a"" text '"' "a"" "abc"
char* UTX_find_word1 ( char *  was,
char *  wo 
)
UTX_find_word1 Wort in Zeile suchen
das Wort was in der zeile wo suchen. WortTrennzeichen sind " ,()[]".
IRC = NULL: ist nicht enthalten
IRC != NULL = position
char* UTX_find_Del1 ( char *  p1)

find next delimiter ' ' '=' ',' '
' '' '{' ...

char* UTX_find_strrstr ( char *  cbuf,
char *  str 
)
find last occurence of str in cbuf
NULL: nicht enthalten
int UTX_strcmp_right ( char *  string,
char *  text 
)
UTX_strcmp_right check if string1 ends with string2
RetCode: 0=equal; else=notEqual.
UTX_strcmp_right check if string1 ends with string2
RetCode: 0=equal; else=notEqual.
int UTX_ck_casenChr ( char *  s1,
char *  s2,
int  cNr 
)
compare n chars of 2 strings - ignore case
s2 must be uppercase !
Cannot handle german specialChars (ae, ue, ..).
Retcod:
0 both Strings are equal
1 Strings are NOT equal
see also strcasecmp strncasecmp (nur Linux !)
char* UTX_memFind ( char *  buf,
char *  str 
)

str in buf suchen

char* UTX_memFind1 ( char *  buf,
long  bufSiz,
char *  str,
long  strSiz 
)
UTX_memFind1 Daten mit bestimmter Laenge suchen
Datablock str (siz = strSiz) in buf bis max. buf[strSiz] suchen.
char* UTX_memstr ( char *  von,
char *  bis,
char *  sstr 
)
den String sstr im Bereich von - bis suchen.
Returns:
position of first char if found
else NULL
int UTX_insert1 ( char *  cbuf,
long *  bufSiz,
char *  auxBuf,
long  cPos 
)
UTX_insert1 insert Textstring into Textbuffer
den textstring auxBuf in den Buffer cbuf an Position cPos einfuegen.
Die momentane Size von cbuf ist bufSiz.
long i1;
i1 = strlen(cbuf);
UTX_insert1(cBuf, &i1, "FSUB ", 0);
int UTX_cut1 ( char *  cbuf,
long *  bufSiz,
long  cPos,
long  txLen 
)
UTX_cut1 cut Textstring out of Textbuffer
Aus cbuf von Pos. cPos weg txLen characters rausloeschen.
int UTX_wTab_ck ( char *  wTab[],
char *  w1 
)
test if wordTable wTab contains string w1
RetCod:
-1 no word of wTab = w1
>=0 nr of word found
Example:
char *ta[]={"Jaenner","Februar","Maerz",NULL};
printf(" %d\n", UTX_wTab_ck (ta, "Februar")); // returns 1
see also UTX_ck_wTab
char** UTX_wTab_file ( char *  memspc,
int  memSiz,
char *  fnam 
)
make table of words from file. End of List is NULL.
Input:
memspc, memSiz where to save file and table. No reallocate !
int UTX_wordnr ( char *  cbuf)
UTX_wordnr returns nr of words
returns Anzahl von Worten in cbuf
als delimiter gelten nur blank und oder ","
Ausdruck wird korrekt behandelt ("D(0 0 1)" ist nur 1 Wort !!)
int UTX_setup_set ( char *  fn,
char *  par,
char *  val 
)
UTX_setup_set add/replace/delete parameter in file
delete parameter if val = NULL
max. Linelength = 1020
Line must stat with <par>; par-val-Delimiter must be a blank !
# starts a comment-line.
RetCod: -2 Error (open, write tempFile error)
-3 Error (tempFile already exists; other process hanging ?)
0 parameter replaced
1 parameter added
2 new file created
Using temporary file <fn>_temp; on init delete all *_temp ?
int UTX_setup_get ( char *  cval,
char *  ctyp,
char *  fnam,
int  mode 
)
UTX_setup_get get parameters (typ, value) from setup-file
skips lines starting with # in setup-file
Input:
ctyp keyWord (1.word) in setupFile.
mode 0=quiet, 1=display errormessage
Output:
cval copy of the value (the 2.word) in the file; size up to 80 chars.
unmodified if keyWord not found
RetCod: 0=OK; -1=ctyp not found.
int UTX_setup_modw ( char *  fn,
char *  par,
char *  wNew,
int  wNr 
)
int UTX_setup_decs ( char *  s1,
char **  pv 
)
decode setup-string; separates parameter, returns valPos.
Input:
s1 parameter blank value
Output:
s1 parameter (s1 modified !) separated with '\0'
pv startposition of value in s1
RetCod 0=ok; -1=no delimiter (blank) found
int UTX_cat_file ( FILE *  fpo,
char *  fnam 
)
UTX_cat_file add file into open fileunit
add file
ATTENTION:
MICROSOFT-BUG: you may not write into a file opened in dll with core-function
int UTX_dir_listf ( char *  outFilNam,
char *  fPath,
char *  fNam,
char *  fTyp 
)
Create list of files into file; filters: filename and/or filetyp.
Input:
fPath dir to search; can have closing "/"
fNam NULL or filename to search; do not use closing "*"
fTyp NULL or filetyp to search; do not use starting "*"
Output:
outFilNam list
RetCode: -1 = Error; else nr of files written.
Example: ls ./xa_*.c
i1 = UTX_dir_listf ("lst.dat", ".", "xa_", ".c");
eine Dateiliste in eine Datei ausgeben; nach Dateitypen gefiltert.
ftyp ohne Stern; also zB ".dat".
fPath mit oder ohne abschliessenden "/".
RetCode: -1 = Error; else nr of files written.
int UTX_cnr_chr ( char *  txt,
char  c1 
)

returns nr of char c1 in string txt

int UTX_str_file ( char *  txbuf,
long *  fSiz,
char *  fnam 
)
UTX_str_file read file -> string; remove ending '\n'
fSiz must have exact filesize; see OS_FilSiz.
UTX_str_file read file -> string; remove ending '\n'
fSiz must have exact filesize; see OS_FilSiz.

Variable Documentation

const char TX_NUL