Go to the source code of this file.
Defines | |
#define | TXT_Typ_EOF 0 |
#define | TXT_Typ_spec 1 |
#define | TXT_Typ_text 2 |
#define | TXT_Typ_num 3 |
#define | TXT_Typ_string 4 |
#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_skip_1bl(tp) {++(*(tp)); while(**(tp) == ' ') ++(*(tp));} |
skip the active char and following blanks. tp=(char**) ! | |
#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 ('') p1 = UTX_pos_EOS(cString); | |
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) |
char * | UTX_pos_skipWord (char *cbuf) |
char * | UTX_pos_skipWords (int wNr, char *p1) |
char * | UTX_pos_skipDeli1 (char *p1) |
int | UTX_pos_skip_int (char **ps) |
int | UTX_ckc_Del1 (char c1) |
int | UTX_ck_num1 (char **pOut, char *cbuf) |
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) |
int | UTX_add_fl_f (char[], double, int) |
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, char *filNam, int lNr) |
int | UTX_fsavLine (char *cbuf, char *filNam, int lNr) |
int | UTX_fRevL (char *fno, char *fni) |
void | UTX_ins_s2 (char *, char *, int) |
void | UTX_CleanCR (char *) |
void | UTX_CleanSC (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_nr (char *txtOut, int iNr) |
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_wordnr (char *cbuf) |
int | UTX_cat_file (FILE *fpo, char *fnam) |
int | UTX_dir_listf (char *outFilNam, char *fPath, char *fTyp) |
Variables | |
const char | TX_NUL |
#define TXT_Typ_EOF 0 |
#define TXT_Typ_spec 1 |
#define TXT_Typ_text 2 |
#define TXT_Typ_num 3 |
#define TXT_Typ_string 4 |
#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_skip_1bl | ( | tp | ) | {++(*(tp)); while(**(tp) == ' ') ++(*(tp));} |
skip the active char and following blanks. tp=(char**) !
#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 ('') p1 = UTX_pos_EOS(cString);
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 bis zum Terminator. returns Pos. HINTER dem Terminator. Der term.Character wird nicht nach txtOut kopiert. Wenn der Terminator nicht gefunden wird, wird auf das LineEnd gezeigt.
char UTX_cp_word_t | ( | char * | txtOut, | |
char ** | cBuf | |||
) |
UTX_cp_word_t copy next word, give terminator see UTX_cp_word__ UTX_find_Del1 UTX_pos_del 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 | |||
) |
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 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 Outputs: Returns the delimiter found as single character txtIn: leading blanks skipped w_next: the pos of the deli 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 | |||
) |
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 | ) |
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 include in *cbuf !!! Example: "(3*3) + (4*4))" Output: retCod the position of the ')' corresponding to the missing ')' Example: ")"
char* UTX_pos_skipWord | ( | char * | cbuf | ) |
UTX_pos_skipWord skip Word (ret. Pos. of first char after word) find next '\0' oder ','; skip "(...)". DOES NOT 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_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 | ) |
int UTX_ck_num1 | ( | char ** | pOut, | |
char * | cbuf | |||
) |
UTX_ck_num1 test ob word numer ist +-. und Ziffern sind numer.! RC= 0: ja, text ist eine Zahl RC=-1: nein, nur Text. pOut = delimitchar (first char after number)
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 | ||||
) |
int UTX_add_fl_u2 | ( | char | [], | |
double | , | |||
double | ||||
) |
int UTX_add_fl_u3 | ( | char | [], | |
double | , | |||
double | , | |||
double | ||||
) |
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 ! see UTX_del_foll0
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
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, | |
char * | filNam, | |||
int | lNr | |||
) |
UTX_fgetLine Zeile Nr. <lNr> aus Datei <filNam> lesen erste Zeile ist 1. cbuf muss mind 80 lang sein ! rc -1 File does not exist rc -2 Line does not exist rc 0 OK
int UTX_fsavLine | ( | char * | cbuf, | |
char * | filNam, | |||
int | lNr | |||
) |
UTX_fsavLine Zeile Nr. <lNr> into Datei <filNam> schreiben Erste Zeile hat lNr=1. wenn Datei filNam weniger als lNr Zeilen hat, werden Leerzeilen erzeugt !! lNr = -1: hintanfuegen. rc -1 File does not exist rc -2 Line does not exist rc 0 OK
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 links (s1 = s2//s1) maxlen ist die max. Länge des S1! s" radf max 256 chars lang sein.
void UTX_CleanCR | ( | char * | ) |
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.
void UTX_CleanSC | ( | char * | ) |
change all Sonderzeichen into '?'
int UTX_CleanCommC | ( | char * | cBuf | ) |
Clean C-Comments (remove // comment and following blanks)
int UTX_Clean_db | ( | char * | ) |
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 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 (cbuf, &l1, "AAA", 3, &cbuf[4], 1); // 5 -> AAA
int UTX_chg_nr | ( | char * | txtOut, | |
int | iNr | |||
) |
change int-number in line beginning at txtOut into iNr
Returncode = Laengendifferenz vorher - nachher
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 copy word & return typ of word: Input: txtIn 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 | |||
) |
int UTX_ck_casenChr | ( | char * | s1, | |
char * | s2, | |||
int | cNr | |||
) |
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 | |||
) |
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_cat_file | ( | FILE * | fpo, | |
char * | fnam | |||
) |
int UTX_dir_listf | ( | char * | outFilNam, | |
char * | fPath, | |||
char * | fTyp | |||
) |
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.
const char TX_NUL |