gCAD3D 2.40
ut_txt.c File Reference

text manipulations More...

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include "../ut/ut_geo.h"
#include "../ut/ut_txt.h"
#include "../ut/ut_txTab.h"
#include "../ut/ut_os.h"
#include "../xa/xa_msg.h"

Macros

#define bSiz   4096
 
#define LN_MAX_SIZ   128
 

Functions

int UTX_cp_word_nr1 (char *so, char *si, int wNr)
 
int UTX_wTab_dump (char **wTab)
 
char ** UTX_wTab_file (char *memspc, int memSiz, char *fnam)
 
int UTX_wTab_srcLn (char **spa, int *sSiz, int tabSiz, char *srcLn)
 
int UTX_wTab_str (char *wTab[], int tabSiz, char *s1)
 
int UTX_wGrp_find (char *wGrp, char *wd)
 
int UTX_wGrp_nxt (char *wGrp, int wPos)
 
int UTX_wTab_ck (char *wTab[], char *w1)
 
int UTX_ck_wTab (char *ps, char *pe, char *wTab[])
 
int UTX_len__ (char *txt, int sLen)
 
int UTX_safeName (char *snam, int mode)
 
int UTX_fdir_cut (char *fdir)
 
int UTX_fnam_fnrel (char *fnAbs, int isiz, char *fnRel, char *basDir)
 
int UTX_fnam_rel2abs (char *fnAbs, int isiz, char *fnRel, char *actDir)
 
int UTX_fnam_abs2rel (char *fnRel, char *fnAbs, char *actDir)
 
int UTX_fnam__ (char *fdir, char *fnam, char *ftyp, char *fnIn)
 
int UTX_ftyp_cut (char *cbuf)
 
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)
 
int UTX_cat_file (FILE *fpo, char *fnam)
 
int UTX_wrf_str (char *fnam, char *txt)
 
int UTX_str_file (char *txbuf, long *fSiz, char *fnam)
 
int UTX_dir_listf (char *outFilNam, char *fPath, char *fNam, char *fTyp)
 
int UTX_ptab_f (void *outSpc, long spcSiz, char *inFilNam)
 
int UTX_ptab_dump (char **pp1)
 
char * UTX_find_word1 (char *was, char *wo)
 
int UTX_find_wordNr (int *maxLen, char *was, char *wo)
 
int UTX_strcmp_right (char *string, char *text)
 
char * UTX_find_strrstr (char *cbuf, char *str)
 
int UTX_del_foll_chrn (char *cbuf, char *str)
 
char * UTX_find_strrchrn (char *cbuf, char *str)
 
int UTX_cmp_word_wordtab (char *wdtab[], char *wd1)
 
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_ck_uml_c (char *iChar)
 
int UTX_ck_uml_s (char *cbuf, int *lenS, int lenMax)
 
int UTX_chg_2_upper (char *cbuf)
 
int UTX_chg_2_lower (char *cbuf)
 
int UTX_chg_wordn (char *sOut, char *wNew, int wNr, long lenMax)
 
void UTX_cp_word_2_upper (char *txtout, char *txtin)
 
int UTX_cp_nchr_2_upper (char *txtout, char *txtin, int iNr)
 
char * UTX_cp_word__ (char *txtOut, char *txtIn)
 
char UTX_cp_word_t (char *txtOut, char **cBuf)
 
char * UTX_cp_word_term (char *txtOut, char *txtIn, char term)
 
char * UTX_cp_expr (char *cbo, char *cbi)
 
char * UTX_CleanBracks (char *txtbuf, char ch1, char ch2)
 
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_right (char *s1, char *s2)
 
int UTX_chg_nr (char *txtOut, int iNr)
 
int UTX_del_right (char *txtbuf, int cNr)
 
int UTX_endDelChar (char *txtbuf, char chr)
 
int UTX_endDelWord (char *s1, char deli, int mode)
 
int UTX_endAddChar (char *txtbuf, char chr)
 
char * UTX_pos_1n (char string[])
 
char UTX_pos_del (char **txtIn, char **w_next)
 
char UTX_pos_delP (char **delPos, char *startPos)
 
long UTX_pos_del_prev (char *cBuf, long cPos)
 
long UTX_pos_del_next (char *cBuf, long cPos)
 
int UTX_add_i_u (char strBuf[], int zahl)
 
int UTX_add_db (char outBuf[], double *db1)
 
int UTX_add_pt (char outBuf[], void *pt1)
 
int UTX_del_chr (char *cbuf, char cx)
 
int UTX_del_follBl (char *cbuf)
 
int UTX_del_foll0 (char strBuf[])
 
int UTX_del_FilTx (char *dtxt, char *filNam)
 
int UTX_add_fl_u (char strBuf[], double zahl)
 
int UTX_add_fl_u2 (char outBuf[], double z1, double z2)
 
int UTX_add_fl_u3 (char outBuf[], double z1, double z2, double z3, char chDel)
 
int UTX_add_fl_ua (char outBuf[], double *da, int dNr, char chDel)
 
char * UTX_add_fl_1uf (char *outBuf, double d1)
 
int UTX_add_fl_f (char strBuf[], double zahl, int nkAnz)
 
char * UTX_db10__ (char s1[], double d1)
 
char * UTX_db15__ (char s1[], double d1)
 
int UTX_add_fl_10 (char strBuf[], double d1)
 
int UTX_add_fl_15 (char strBuf[], double d1)
 
int UTX_add_fnam_del (char *cbuf)
 
int UTX_add_slash (char *cbuf)
 
int UTX_ins_add (char *s1, int sSiz, char *s2, char *s3)
 
void UTX_ins_s2 (char *s1, char *s2, int maxlen)
 
int UTX_f_lifo_add (char *fNam, int maxLnr, char *newLn)
 
int UTX_fsavLine (char *cbuf, char *filNam, int lnMaxSiz, int lNr)
 
int UTX_fRevL (char *fno, char *fni)
 
int UTX_fgetLine (char *cbuf, int sizBuf, char *filNam, int lNr)
 
char * UTX_memFind (char *buf, char *str)
 
char * UTX_memFind1 (char *buf, long bufSiz, char *str, long strSiz)
 
int UTX_memcmp (char *s1, char *s2)
 
char * UTX_memstr (char *von, char *bis, char *sstr)
 
int UTX_chrNr (char *s1)
 
char * UTX_fgets (char *line, int len, FILE *fp)
 
void UTX_CleanAN (char *s1)
 
void UTX_CleanSC (char *string)
 
char * UTX_CleanCR (char *string)
 =========================================================== More...
 
int UTX_CleanLF (char *sBuf)
 
int UTX_CleanCommC (char *cBuf)
 
int UTX_Clean_db (char *cbuf)
 
char * UTX_pos_skipStr (char *cbuf)
 
int UTX_pos_skipBrackX (char **ps, char *pe, char ce)
 
char * UTX_pos_skipBrack (char *cbuf)
 
char * UTX_pos_skipBrack1 (char *cbuf)
 
int UTX_ck_caseChr (char *s1, char *s2)
 
int UTX_ck_casenChr (char *s1, char *s2, int cNr)
 
int UTX_ck_caseStr (char *s1, char *s2)
 
int UTX_ckc_Del1 (char c1)
 
int UTX_ckc_Del2 (char c1)
 
int UTX_ck_specChars (char *s1)
 
char * UTX_find_Del1 (char *p1)
 
char * UTX_pos_skipDeli1 (char *p1)
 
char * UTX_2db_tx (double *d1, double *d2, char *cbuf)
 
double UTX_db_tx (char **po, char *pi)
 
int UTX_pos_skip_num (char **ps)
 
int UTX_pos_skip_int (char **ps)
 
int UTX_pos_skipTermWord (char **wNxt, char *cbuf)
 
char * UTX_pos_skipWord (char *cbuf)
 
char * UTX_pos_skipWords (int wNr, char *p1)
 
int UTX_wordnr (char *cbuf)
 
int UTX_cnr_chr (char *txt, char c1)
 
int UTX_sget_nrRange (double *d1, double *d2, char **expr)
 
int UTX_get_word (char **txtIn, char **w_next, char *txtOut, double *val, char *deli)
 
int UTX_cut_word (char *sBuf, char *s1)
 
int UTX_cut1 (char *cbuf, long *bufSiz, long cPos, long txLen)
 
int UTX_cut2 (char *s1, long lDel)
 
int UTX_insert1 (char *cbuf, long *bufSiz, char *auxBuf, long cPos)
 
int UTX_dump_cnl (char *cPos, int maxLen)
 
int UTX_dump_c__ (char *cPos, int cLen)
 
int UTX_dump_word (char *cPos, char *sDel)
 
int UTX_dump_s__ (char *cPos, int cNr)
 
int UTX_dump_wTab (char *wTab[])
 
int UTX_dump_p1p2 (char *p1, char *p2)
 
int UTX_dump__ (char *cPos, int maxLen)
 
int UTX_cp_print (char *txo, char *txi, int maxLen)
 
int UTX_cp_left (char *sOut, char *sIn, int cNr)
 
int UTX_cp_right (char *sOut, char *sIn, int cNr)
 
int UTX_cpLn_2cp (char *cbuf, char *pos1, char *pos2, int bufSiz)
 
int UTX_cp_Line (char *cTo, char **cNxt, char *cFrom, int maxLen)
 
int UTX_setup_set (char *fn, char *par, char *val)
 
int UTX_setup_get__ (char *cval, char *ctyp, char *fnam)
 
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_htm_fop (FILE **fp, char *fnam)
 
int UTX_htm_fcl (FILE **fp)
 

Variables

const char TX_NUL = '\0'
 
static char TX_buf1 [128]
 
static char TX_buf2 [128]
 

Detailed Description

text manipulations

Needs:
../ut/ut_TX.h ../ut/ut_ui_TX.c|../ut/ut_TX.c TX_Error ..
../ut/ut_umb.h ../ut/ut_umb.c UMB_..
../ut/ut_umem.h ../ut/ut_umem.c UME_..
../ut/ut_txTab.h ../ut/ut_txTab.c UtxTab_init_..
../ut/ut_os.h ../ut/ut_os_aix.c OS_FilSiz ..
../xa/xa_msg.c ../xa/xa_msg.h MSG_STD__ MSG_get_1 ..
../ut/ut_types.h - FLT_32_MAX
- ../ut/ut_mem.c MEM_chg_str ..
- ../ut/ut_utx_dummy.c
=====================================================
List_functions_start:
UTX_cp_word_2_upper copy and change word into capitalletters
UTX_cp_nchr_2_upper copy and change n chars into capitalletters
UTX_cp_word_term copy word bis zum Terminator
UTX_cp_word__ copy next word
UTX_cp_word_nr1 copy word nr <wNr> out of string
UTX_cp_word_t copy next word, give terminator
UTX_cp_expr copy expression (without brackets)
UTX_cp_print add maxLen printable characters from txi --> txo
// APT_cp_ausd kopiert einen Ausdruck (kompletter Klammerinhalt)
UTX_CP__ copy n chars - terminate with '\0' INLINE
UTX_cp_Line copy a Line (terminated by '\n')
UTX_cp_left copy n chars from left side of string
UTX_cp_right copy n chars from right side of string
UTX_cpLn_2cp copy line between 2 pointers; del ending blanks, lf
UTX_db10__ double -> string; precision 10 digits
UTX_db15__ double -> string; precision 15 digits
UTX_add_i_u add integer to string
UTX_add_db add double unformatted; Trennzeichen ist blank
UTX_add_pt add Pointcoords unformatted; Trennzeichen ist blank
UTX_add_fl_u add double unformatted (del foll. 0s and ".")
UTX_add_fl_u2 add double,double unformatted (del foll. 0s and ".")
UTX_add_fl_u3 add 3 doubles unformatted (del foll. 0s and ".")
UTX_add_fl_ua add n doubles unformatted (del foll. 0s and ".")
UTX_add_fl_1uf add double with max. 1 digit after dec.point; unformatted
UTX_add_fl_f add double with x digits after dec.point
UTX_add_fl_10 add double with 10 signif digits
UTX_add_fl_15 add double with 15 signif digits
UTX_add_slash add closing "/" to string (for dirs)
UTX_add_fnam_del add closing "/" or "\\" to string (filename-delimiter)
UTX_chrNr get nr of chars to end of line
UTX_Clear string = '\0' INLINE
UTX_Siz get length of rest of string INLINE
UTX_CleanCR delete following Blanks, CRs and LFs
UTX_CleanLF change lineEnd (Cr|CrLf ..) to single LF
UTX_CleanCommC Clean C-Comments (remove foll. blanks & // comments)
UTX_Clean_db clean doubles (change ',' into '.') See also UTX_chg_chr1
UTX_CleanSC Change SpecialChars into '?' (alle -> ?) UTX_CleanAN Change all chars not alpha or numeric into '_' UTX_CleanBracks Remove first/last char (brackets, '"', ..) UTX_endDelChar if last char of string == chr: remove it UTX_endDelWord remove last word; delimiting char; keep or not. UTX_endAddChar if last char of string != chr: add it UTX_del_right delete last characters UTX_del_chr delete all characters <cx> out of string cbuf UTX_del_follBl delete following blanks, return strLen UTX_del_foll0 Delete following 0s and following "." UTX_del_foll_chrn delete last char if it is in list UTX_del_FilTx delete all lines containing <dtxt> UTX_chg_chr1 in cBuf alle oldChr aendern in newChr UTX_chg_nr change following int-number UTX_chg_str1 change substring in string UTX_chg_str2 change <sOld> into <sNew> in <sDat> UTX_chg_right change right side of string (replace equal nr of chars) UTX_chg_2_upper change string to uppercase; skip textStrings("") UTX_chg_2_lower change string to lowercase (see "_upper") UTX_chg_wordn change word nr wNr in string sOut into word sNew UTX_utf_iso convert ISO-8859-1 (1 byte = 1 char) into UTF-8 UTX_insert1 insert Textstring into Textbuffer UTX_ins_s2 insert string left (s1=s2+s1) UTX_ins_add insert string left and add string right (s1=s2+s1+s3) UTX_cut_word remove word s1 (and its following delimiter) out of sBuf UTX_cut1 cut Textstring out of Textbuffer UTX_cut2 cut lDel chars out of string s1 UTX_len__ change stringlength to <len>; cut or add blanks UTX_pos_EOS find end of string ('\0') UTX_pos_del find next delimiter (blank or "'()*+,-/;<=>) UTX_pos_delP find next program-delimiter (',' or ')') UTX_pos_del_next find next delimiter (blank after cPos) UTX_pos_del_prev find previous delimiter (blank vor cPos) UTX_pos_skipLeadBlk skip blanks (returns Position of first non-blank) INLINE UTX_pos_1n REPLACED BY UTX_pos_skipLeadBlk UTX_pos_skipTermWord terminate & skip next word in string UTX_pos_skipWord skip Word (ret. Pos. of first char after word) UTX_pos_skipWords skip n Words (ret. Pos. of first char after word) UTX_pos_skipBrackX find corresponding bracket UTX_pos_skipBrack find corresponding ')' (returns Position of ')') UTX_pos_skipBrack1 find corresponding ')' (startpos '(' not included) UTX_pos_skipStr find corresponding \" (skip string) UTX_pos_skipDeli1 skip delimiter ' ' ',' '\n' '\r' '\t' UTX_pos_skip_num skip number UTX_pos_skip_int skip int-number UTX_skip_1bl skip this char and following blanks INLINE UTX_ck_caseChr compare 2 characters - ignore case UTX_ck_casenChr compare n chars of 2 strings - ignore case UTX_ck_caseStr compare 2 strings - ignore case UTX_ckc_Del1 check if char is a delimiter UTX_ckc_Del2 check if char is a delimiter (blank|Tab) UTX_ck_specChars test if string contains specialCharacters UTX_ck_num_i test if word is numeric (int) UTX_ck_num_f test if word is numeric (float) UTX_ck_num_digNr returns nr of consecutive digits UTX_ck_uml_c check for Umlaut (); change to normal char UTX_ck_uml_s change all umlaute of string UTX_cmp_word_wordtab check if word wd1 is in list wdtab UTX_find_chr find character in string (strchr) INLINE UTX_find_Del1 // find next delimiter ' ' '=' ',' '\n' '\t' '{' .. UTX_find_word1 Wort in Zeile suchen UTX_find_wordNr find word "was" in string "wo"; return nr of occurences UTX_find_strrstr find last occurence of str in cbuf UTX_find_strrchrn find last occurence of one of the chars of str2 UTX_strcmp_right check if string1 ends with string2 UTX_wGrp_find find word-position in group-of-words UTX_wGrp_nxt find position of next word in group-of-words UTX_wTab_ck test if wordTable wTab contains string w1 UTX_ck_wTab test if string contains a word from wordTable UTX_wTab_str make table of words from string UTX_wTab_srcLn separate sourceline into expressions UTX_wTab_file make table of words from file. UTX_wTab_dump dump wordTable UTX_memstr den String sstr im Bereich von - bis suchen UTX_memFind Daten suchen UTX_memFind1 Daten mit bestimmter Laenge suchen UTX_memcmp returns nr of equal characters of 2 strings UTX_cnr_chr returns nr of a certain char in string UTX_wordnr returns nr of words UTX_get_word get next word and its delimiter and typ of word UTX_sget_nrRange get nr or range out of textstring UTX_db_tx read float from ascii-string UTX_fnam__ separate/copy directory,fileName,fileTyp of full filename UTX_ftyp_s get filetyp from filename (change => upper) UTX_fnam_s get fnam from string UTX_fdir_s get fileDirectory from string UTX_ftyp_cut remove Filetyp from string UTX_safeName make a safe modelname from a modelname UTX_fnam_fnrel make absolute filename from relative Filename and basDir UTX_fnam_rel2abs make absolute filename from relative Filename and actDir UTX_fnam_abs2rel make relative filename from absolutFilename and actDir UTX_fdir_cut cut last subpath from path UTX_fgets Zeile aus Datei lesen und CRs LFs am Ende deleten UTX_fgetLine Zeile Nr. <lNr> aus Datei <filNam> lesen UTX_fsavLine Zeile Nr. <lNr> into Datei <filNam> schreiben UTX_fRevL File revert lines; eine Datei zeilenweise umdrehen; UTX_str_file read file -> string; remove ending '\n' UTX_wrf_str write string -> file UTX_f_lifo_add add line as first line into file with maxLnr lines UTX_setup_get__ get parameters (typ, value) from setup-file UTX_setup_get get parameters (typ, value) from setup-file (1.word only) UTX_setup_set add/replace parameter in file UTX_setup_modw add/replace word of value in param-value-file UTX_setup_decs decode setup-string; separates parameter, returns valPos. UTX_dir_listf Dateiliste in eine Datei ausgeben UTX_cat_file Datei in (offene) Datei ausgeben UTX_ptab_f Pointertabelle aus Datei erstellen UTX_ptab_dump dump table of text-pointers UTX_htm_fop open html-textfile UTX_htm_fcl close html-textfile UTX_dump_cnl dump String (printf) until next '\n' (maxLen) UTX_dump_word print word delimited by one of sDel-chars UTX_dump_c__ dump <cLen> chars - does not stop at \n UTX_dump__ dump <cLen> chars (replace \n\r\t) - stop at \0 UTX_dump_s__ dump <cLen> chars (replace \n\r\t\0) UTX_dump_p1p2 dump string from ps to pe UTX_dump_wTab dumpt table of words List_functions_end: ===================================================== - see also: UtxTab_* Class for stacking Textstrings of variable length UTI_iNr_chrNr give nr of ints for n characters -> ?)
UTX_CleanAN Change all chars not alpha or numeric into '_'
UTX_CleanBracks Remove first/last char (brackets, '"', ..)
UTX_endDelChar if last char of string == chr: remove it
UTX_endDelWord remove last word; delimiting char; keep or not.
UTX_endAddChar if last char of string != chr: add it
UTX_del_right delete last characters
UTX_del_chr delete all characters <cx> out of string cbuf
UTX_del_follBl delete following blanks, return strLen
UTX_del_foll0 Delete following 0s and following "."
UTX_del_foll_chrn delete last char if it is in list
UTX_del_FilTx delete all lines containing <dtxt>
UTX_chg_chr1 in cBuf alle oldChr aendern in newChr
UTX_chg_nr change following int-number
UTX_chg_str1 change substring in string
UTX_chg_str2 change <sOld> into <sNew> in <sDat>
UTX_chg_right change right side of string (replace equal nr of chars)
UTX_chg_2_upper change string to uppercase; skip textStrings("")
UTX_chg_2_lower change string to lowercase (see "_upper")
UTX_chg_wordn change word nr wNr in string sOut into word sNew
UTX_utf_iso convert ISO-8859-1 (1 byte = 1 char) into UTF-8
UTX_insert1 insert Textstring into Textbuffer
UTX_ins_s2 insert string left (s1=s2+s1)
UTX_ins_add insert string left and add string right (s1=s2+s1+s3)
UTX_cut_word remove word s1 (and its following delimiter) out of sBuf
UTX_cut1 cut Textstring out of Textbuffer
UTX_cut2 cut lDel chars out of string s1
UTX_len__ change stringlength to <len>; cut or add blanks
UTX_pos_EOS find end of string ('\0')
UTX_pos_del find next delimiter (blank or "'()*+,-/;<=>)
UTX_pos_delP find next program-delimiter (',' or ')')
UTX_pos_del_next find next delimiter (blank after cPos)
UTX_pos_del_prev find previous delimiter (blank vor cPos)
UTX_pos_skipLeadBlk skip blanks (returns Position of first non-blank) INLINE
UTX_pos_skipTermWord terminate & skip next word in string
UTX_pos_skipWord skip Word (ret. Pos. of first char after word)
UTX_pos_skipWords skip n Words (ret. Pos. of first char after word)
UTX_pos_skipBrackX find corresponding bracket
UTX_pos_skipBrack find corresponding ')' (returns Position of ')')
UTX_pos_skipBrack1 find corresponding ')' (startpos '(' not included)
UTX_pos_skipStr find corresponding \" (skip string)
UTX_pos_skipDeli1 skip delimiter ' ' ',' '\n' '\r' '\t'
UTX_pos_skip_num skip number
UTX_pos_skip_int skip int-number
UTX_skip_1bl skip this char and following blanks INLINE
UTX_ck_caseChr compare 2 characters - ignore case
UTX_ck_casenChr compare n chars of 2 strings - ignore case
UTX_ck_caseStr compare 2 strings - ignore case
UTX_ckc_Del1 check if char is a delimiter
UTX_ckc_Del2 check if char is a delimiter (blank|Tab)
UTX_ck_specChars test if string contains specialCharacters
UTX_ck_num_i test if word is numeric (int)
UTX_ck_num_f test if word is numeric (float)
UTX_ck_num_digNr returns nr of consecutive digits
UTX_ck_uml_c check for Umlaut (; change to normal char UTX_ck_uml_s change all umlaute of string UTX_cmp_word_wordtab check if word wd1 is in list wdtab UTX_find_chr find character in string (strchr) INLINE UTX_find_Del1 // find next delimiter ' ' '=' ',' '\n' '\t' '{' .. UTX_find_word1 Wort in Zeile suchen UTX_find_wordNr find word "was" in string "wo"; return nr of occurences UTX_find_strrstr find last occurence of str in cbuf UTX_find_strrchrn find last occurence of one of the chars of str2 UTX_strcmp_right check if string1 ends with string2 UTX_wGrp_find find word-position in group-of-words UTX_wGrp_nxt find position of next word in group-of-words UTX_wTab_ck test if wordTable wTab contains string w1 UTX_ck_wTab test if string contains a word from wordTable UTX_wTab_str make table of words from string UTX_wTab_srcLn separate sourceline into expressions UTX_wTab_file make table of words from file. UTX_wTab_dump dump wordTable UTX_memstr den String sstr im Bereich von - bis suchen UTX_memFind Daten suchen UTX_memFind1 Daten mit bestimmter Laenge suchen UTX_memcmp returns nr of equal characters of 2 strings UTX_cnr_chr returns nr of a certain char in string UTX_wordnr returns nr of words UTX_get_word get next word and its delimiter and typ of word UTX_sget_nrRange get nr or range out of textstring UTX_db_tx read float from ascii-string UTX_fnam__ separate/copy directory,fileName,fileTyp of full filename UTX_ftyp_s get filetyp from filename (change => upper) UTX_fnam_s get fnam from string UTX_fdir_s get fileDirectory from string UTX_ftyp_cut remove Filetyp from string UTX_safeName make a safe modelname from a modelname UTX_fnam_fnrel make absolute filename from relative Filename and basDir UTX_fnam_rel2abs make absolute filename from relative Filename and actDir UTX_fnam_abs2rel make relative filename from absolutFilename and actDir UTX_fdir_cut cut last subpath from path UTX_fgets Zeile aus Datei lesen und CRs LFs am Ende deleten UTX_fgetLine Zeile Nr. <lNr> aus Datei <filNam> lesen UTX_fsavLine Zeile Nr. <lNr> into Datei <filNam> schreiben UTX_fRevL File revert lines; eine Datei zeilenweise umdrehen; UTX_str_file read file -> string; remove ending '\n' UTX_wrf_str write string -> file UTX_f_lifo_add add line as first line into file with maxLnr lines UTX_setup_get__ get parameters (typ, value) from setup-file UTX_setup_get get parameters (typ, value) from setup-file (1.word only) UTX_setup_set add/replace parameter in file UTX_setup_modw add/replace word of value in param-value-file UTX_setup_decs decode setup-string; separates parameter, returns valPos. UTX_dir_listf Dateiliste in eine Datei ausgeben UTX_cat_file Datei in (offene) Datei ausgeben UTX_ptab_f Pointertabelle aus Datei erstellen UTX_ptab_dump dump table of text-pointers UTX_htm_fop open html-textfile UTX_htm_fcl close html-textfile UTX_dump_cnl dump String (printf) until next '\n' (maxLen) UTX_dump_word print word delimited by one of sDel-chars UTX_dump_c__ dump <cLen> chars - does not stop at \n UTX_dump__ dump <cLen> chars (replace \n\r\t) - stop at \0 UTX_dump_s__ dump <cLen> chars (replace \n\r\t\0) UTX_dump_p1p2 dump string from ps to pe UTX_dump_wTab dumpt table of words List_functions_end: ===================================================== - see also: UtxTab_* Class for stacking Textstrings of variable length UTI_iNr_chrNr give nr of ints for n characters); change to normal char
UTX_ck_uml_s change all umlaute of string
UTX_cmp_word_wordtab check if word wd1 is in list wdtab
UTX_find_chr find character in string (strchr) INLINE
UTX_find_Del1 // find next delimiter ' ' '=' ',' '\n' '\t' '{' ..
UTX_find_word1 Wort in Zeile suchen
UTX_find_wordNr find word "was" in string "wo"; return nr of occurences
UTX_find_strrstr find last occurence of str in cbuf
UTX_find_strrchrn find last occurence of one of the chars of str2
UTX_strcmp_right check if string1 ends with string2
UTX_wGrp_find find word-position in group-of-words
UTX_wGrp_nxt find position of next word in group-of-words
UTX_wTab_ck test if wordTable wTab contains string w1
UTX_ck_wTab test if string contains a word from wordTable
UTX_wTab_str make table of words from string
UTX_wTab_srcLn separate sourceline into expressions
UTX_wTab_file make table of words from file.
UTX_wTab_dump dump wordTable
UTX_memstr den String sstr im Bereich von - bis suchen
UTX_memFind Daten suchen
UTX_memFind1 Daten mit bestimmter Laenge suchen
UTX_memcmp returns nr of equal characters of 2 strings
UTX_cnr_chr returns nr of a certain char in string
UTX_wordnr returns nr of words
UTX_get_word get next word and its delimiter and typ of word
UTX_sget_nrRange get nr or range out of textstring
UTX_db_tx read float from ascii-string
UTX_fnam__ separate/copy directory,fileName,fileTyp of full filename
UTX_ftyp_s get filetyp from filename (change => upper)
UTX_fnam_s get fnam from string
UTX_fdir_s get fileDirectory from string
UTX_ftyp_cut remove Filetyp from string
UTX_safeName make a safe modelname from a modelname
UTX_fnam_fnrel make absolute filename from relative Filename and basDir
UTX_fnam_rel2abs make absolute filename from relative Filename and actDir
UTX_fnam_abs2rel make relative filename from absolutFilename and actDir
UTX_fdir_cut cut last subpath from path
UTX_fgets Zeile aus Datei lesen und CRs LFs am Ende deleten
UTX_fgetLine Zeile Nr. <lNr> aus Datei <filNam> lesen
UTX_fsavLine Zeile Nr. <lNr> into Datei <filNam> schreiben
UTX_fRevL File revert lines; eine Datei zeilenweise umdrehen;
UTX_str_file read file -> string; remove ending '\n'
UTX_wrf_str write string -> file
UTX_f_lifo_add add line as first line into file with maxLnr lines
UTX_setup_get__ get parameters (typ, value) from setup-file
UTX_setup_get get parameters (typ, value) from setup-file (1.word only)
UTX_setup_set add/replace parameter in file
UTX_setup_modw add/replace word of value in param-value-file
UTX_setup_decs decode setup-string; separates parameter, returns valPos.
UTX_dir_listf Dateiliste in eine Datei ausgeben
UTX_cat_file Datei in (offene) Datei ausgeben
UTX_ptab_f Pointertabelle aus Datei erstellen
UTX_ptab_dump dump table of text-pointers
UTX_htm_fop open html-textfile
UTX_htm_fcl close html-textfile
UTX_dump_cnl dump String (printf) until next '\n' (maxLen)
UTX_dump_word print word delimited by one of sDel-chars
UTX_dump_c__ dump <cLen> chars - does not stop at \n
UTX_dump__ dump <cLen> chars (replace \n\r\t) - stop at \0
UTX_dump_s__ dump <cLen> chars (replace \n\r\t\0)
UTX_dump_p1p2 dump string from ps to pe
UTX_dump_wTab dumpt table of words
List_functions_end:
=====================================================
- see also:
UtxTab_* Class for stacking Textstrings of variable length
UTI_iNr_chrNr give nr of ints for n characters

Macro Definition Documentation

#define bSiz   4096
#define LN_MAX_SIZ   128

Function Documentation

int UTX_cp_word_nr1 ( char *  so,
char *  si,
int  wNr 
)
int UTX_wTab_dump ( char **  wTab)

UTX_wTab_dump dump wordTable

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_wTab_srcLn ( char **  spa,
int *  sSiz,
int  tabSiz,
char *  srcLn 
)
int UTX_wTab_str ( char *  wTab[],
int  tabSiz,
char *  s1 
)
* make table of words from string
* split s1 into words; add words into fwTab
* s1 becomes modified (terminates words with \0) !
* End of List is NULL.
*
* Output:
* wTab table of pointers to words, end of table = NULL
* retCod nr of words
*
* Usage:
* char *wTab[20];
* UTX_wTab_str (&wTab, sizeof(wTab), string);
* char **pa;
* pa = wTab;
* while (*pa) { printf(" |%s|\n",*pa); ++pa; }
*
* using tempspace (exists only until active function returns):
* #define WTAB_SIZ 10
* char **pa;
*
int UTX_wGrp_find ( char *  wGrp,
char *  wd 
)
* UTX_wGrp_find find word-position in group-of-words
* group-of-words: words delimited by '|'
* Example:
* char *wGrp = {"UNL|UNL1|UNL2"};
* ii = UTX_wGrp_find (wGrp, "UN"); // returns -1;
* ii = UTX_wGrp_find (wGrp, "UNL1"); // returns 4;
* UTX_cp_word_term (so, &wGrp[ii], '|'); // copy -> so
*
int UTX_wGrp_nxt ( char *  wGrp,
int  wPos 
)
* UTX_wGrp_nxt find position of next word in group-of-words
* group-of-words: words delimited by '|'
* Example:
* char *wg = {"UNL|UNL1|UNL2"};
* ii = UTX_wGrp_nxt (wg, 0); // returns 4;
* ii = UTX_wGrp_nxt (wg, 9); // returns -1;
*
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
*
int UTX_ck_wTab ( char *  ps,
char *  pe,
char *  wTab[] 
)
* test if string ps-pe contains a word from wordTable wTab
* RetCod:
* -1 no word of wTab in string ps-pe
* >=0 nr of word found
* see also UTX_wTab_ck
*
int UTX_len__ ( char *  txt,
int  sLen 
)

UTX_len__ change stringlength to <len>; cut or add blanks

int UTX_safeName ( char *  snam,
int  mode 
)
* UTX_safeName make a safe modelname from a modelname
* mode:
* 0: change '. ' to '_', do not change '/' (fuer absolute Filenames)
* 1: change all '. ' and '/' to '_'
* 2: change all '/' to '_'
*
int UTX_fdir_cut ( char *  fdir)
* UTX_fdir_cut cut last subpath from path
* last char of fdir must be '/'
*
int UTX_fnam_fnrel ( char *  fnAbs,
int  isiz,
char *  fnRel,
char *  basDir 
)

UTX_fnam_rel2abs make absolute filename from relative Filename and basDir RF 2018-05-23

int UTX_fnam_rel2abs ( char *  fnAbs,
int  isiz,
char *  fnRel,
char *  actDir 
)

UTX_fnam_rel2abs make absolute filename from relative Filename and actDir DO NOT USE - replaced by UTX_fnam_fnrel

int UTX_fnam_abs2rel ( char *  fnRel,
char *  fnAbs,
char *  actDir 
)
* make relative filename from absolutFilename and currentDirectoryName
* actDir must end with closing "/"
*
int UTX_fnam__ ( char *  fdir,
char *  fnam,
char *  ftyp,
char *  fnIn 
)
* UTX_fnam__ separate/copy directory,fileName,fileTyp of full filename
* Input:
* fnIn full filname;
* fdir size must be >= 128
* fnam size must be >= 128
* ftyp size must be >= 32
* Output:
* fdir directory; can be NULL (no directory);
* fnam filname;
* ftyp fileTyp; can be NULL (no fileTyp);
*
* fdir out eg: "/xx" (absolute directory)
* or "Data" (symbolic-directory)
* or ".x" or "../x" or "." (relative direcotory)
*
*
int UTX_ftyp_cut ( char *  cbuf)

UTX_ftyp_cut remove Filetyp from string

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 ...
*
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_wrf_str ( char *  fnam,
char *  txt 
)
* UTX_wrf_str write string -> file
* txt must be null-terminated
*
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.
* See MEM_get_file()
*
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_ptab_f ( void *  outSpc,
long  spcSiz,
char *  inFilNam 
)

eine Pointertabelle (zB fuer GUI_Popup) aus einer Datei erstellen. File has one entry per line.

int UTX_ptab_dump ( char **  pp1)

UTX_ptab_dump dump table of text-pointers

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
*
int UTX_find_wordNr ( int *  maxLen,
char *  was,
char *  wo 
)
* find word "was" in string "wo"; return nr of occurences
* and max size between (max len of line).
*
int UTX_strcmp_right ( char *  string,
char *  text 
)
* UTX_strcmp_right check if string1 ends with string2
* RetCode: 0=equal; else=notEqual.
*
char* UTX_find_strrstr ( char *  cbuf,
char *  str 
)
* find last occurence of str in cbuf
* NULL: nicht enthalten
*
int UTX_del_foll_chrn ( char *  cbuf,
char *  str 
)
* UTX_del_foll_chrn delete last char of cbuf if it is in str
*
char* UTX_find_strrchrn ( char *  cbuf,
char *  str 
)
* UTX_find_strrchrn find last occurence of one of the chars of str2
* returns NULL or the position of the last char in cbuf also found in str.
* (see strpbrk = find first)
* NULL: nicht enthalten
*
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");
*
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_ck_uml_c ( char *  iChar)
* check for Umlaut (; change to normal char * RetCod: * 0=kein Umlaut; * 1=Umlaut changed to normal char. * * see also UTX_ck_uml_s UTX_CleanSC UTX_safeName * ); change to normal char
* RetCod:
* 0=kein Umlaut;
* 1=Umlaut changed to normal char.
*
*
int UTX_ck_uml_s ( char *  cbuf,
int *  lenS,
int  lenMax 
)
* change all umlaute of string
* RetCod = Anzahl gefundener Umlaute
*
*
int UTX_chg_2_upper ( char *  cbuf)
* UTX_chg_2_upper change string to uppercase; skip textStrings("")
* RetCod: nr of modified characters
*
int UTX_chg_2_lower ( char *  cbuf)

UTX_chg_2_lower change string to lowercase

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
*
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
*
int UTX_cp_nchr_2_upper ( char *  txtout,
char *  txtin,
int  iNr 
)
* UTX_cp_nchr_2_upper copy and change n chars into capitalletters.
* txtout / txtin may be same address
*
char* UTX_cp_word__ ( char *  txtOut,
char *  txtIn 
)

UTX_cp_word__ copy next word

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_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_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
*
char* UTX_CleanBracks ( char *  txtbuf,
char  ch1,
char  ch2 
)
* UTX_CleanBracks Remove first/last char (brackets ..)
* ACHTUNG: veraendert txtbuf; ueberschreibt ev. last char.
* Example:
* cp1 = UTX_CleanBracks (cp1, '(', ')');
*
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_right ( char *  s1,
char *  s2 
)
* UTX_chg_right change right side of string (replace equal nr of chars)
* change the right side of string s1 into s2
*
int UTX_chg_nr ( char *  txtOut,
int  iNr 
)
* change int-number in line beginning at txtOut into iNr
* Returncode = Laengendifferenz vorher - nachher
*
int UTX_del_right ( char *  txtbuf,
int  cNr 
)

UTX_del_right delete last characters

int UTX_endDelChar ( char *  txtbuf,
char  chr 
)

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

int UTX_endDelWord ( char *  s1,
char  deli,
int  mode 
)
* UTX_endDelWord remove last word; delimiting char; keep or not.
* Input:
* deli delimiting char
* mode 0=keep delimiting char; 1=remove also delimiting char.
* RetCod:
* -1 no deli in s1
*
int UTX_endAddChar ( char *  txtbuf,
char  chr 
)

UTX_endAddChar if last char of string != chr: add it.

char* UTX_pos_1n ( char  string[])
* UTX_pos_1n skip blanks (returns Position of first non-blank)
* ersetzt durch UTX_pos_skipLeadBlk
*
char UTX_pos_del ( char **  txtIn,
char **  w_next 
)
* 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';
*
char UTX_pos_delP ( char **  delPos,
char *  startPos 
)
* UTX_pos_delP find next program-delimiter (',' or ')')
*
* Input:
* startPos: startpos
* Output:
* delPos: the pos of the deli
* RetCod: the delimiter as single character
*
*
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)" ??
*
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 !
*
int UTX_add_i_u ( char  strBuf[],
int  zahl 
)

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_del_chr ( char *  cbuf,
char  cx 
)

UTX_del_chr delete all characters <cx> out of string cbuf

int UTX_del_follBl ( char *  cbuf)
* UTX_del_follBl delete following blanks, return strLen
* see also UTX_CleanCR
*
int UTX_del_foll0 ( char  strBuf[])
* Delete following 0's and following ".".
*
int UTX_del_FilTx ( char *  dtxt,
char *  filNam 
)
* delete all lines containing <dtxt>
* uses file <filNam>.tmp
*
int UTX_add_fl_u ( char  strBuf[],
double  zahl 
)
* UTX_add_fl_u add double unformatted (del foll. 0's and ".")
*
* Delete following 0's and following ".".
*
int UTX_add_fl_u2 ( char  outBuf[],
double  z1,
double  z2 
)
* UTX_add_fl_u2 add double,double unformatted (del foll. 0's and ".")
* 2 Doubles (Komma dazwischen)
*
int UTX_add_fl_u3 ( char  outBuf[],
double  z1,
double  z2,
double  z3,
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  outBuf[],
double *  da,
int  dNr,
char  chDel 
)
* UTX_add_fl_ua add n doubles unformatted (del foll. 0's and ".")
* chDel delimiting character; eg blank ..
*
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_f ( char  strBuf[],
double  zahl,
int  nkAnz 
)
* 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_db10__ ( char  s1[],
double  d1 
)
* UTX_add_fl_10 add double with 10 signif digits
* remove following blanks and ending '.'
* returns position of closing 0
* size of s1 > 32
*
char* UTX_db15__ ( char  s1[],
double  d1 
)
* UTX_db15__ add double with 15 signif digits
* size of s1 > 40
* returns position of closing 0
*
int UTX_add_fl_10 ( char  strBuf[],
double  d1 
)
* UTX_add_fl_10 add double with 10 signif digits
* remove following blanks and ending '.'
* free size of strBuf > 32
*
int UTX_add_fl_15 ( char  strBuf[],
double  d1 
)
* UTX_add_fl_15 add double with 15 signif digits
* free size of strBuf > 40
* remove following blanks and ending '.'
*
int UTX_add_fnam_del ( char *  cbuf)
* UTX_add_fnam_del add closing "/" or "\\" to string (filename-delimiter)
* see also UTX_endAddChar
*
int UTX_add_slash ( char *  cbuf)
* UTX_add_slash add closing "/" to string (for dir's)
* see also UTX_endAddChar UTX_add_fnam_del
*
int UTX_ins_add ( char *  s1,
int  sSiz,
char *  s2,
char *  s3 
)

UTX_ins_add insert string left and add string right (s1=s2+s1+s3) see also UTX_ins_s2

void UTX_ins_s2 ( char *  s1,
char *  s2,
int  maxlen 
)
* 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. Lnge des S1!
* s2 MAX 256 chars !!!!!!!!!!!!!
* see also UTX_ins_add
*
int UTX_f_lifo_add ( char *  fNam,
int  maxLnr,
char *  newLn 
)
* UTX_f_lifo_add add line as first line into file with maxLnr lines
* add line as first line into file;
* all lines must uniq;
* if file has more then maxNr Lines, delete surplus lines
*
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.
*
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
*
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.
*
int UTX_memcmp ( char *  s1,
char *  s2 
)

returns nr of equal characters

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_chrNr ( char *  s1)
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).
*
void UTX_CleanAN ( char *  s1)
* change all chars not alpha or numeric into '_'
* keep [0-9],[A-Z],[a-z]; change others into '_'
*
*
void UTX_CleanSC ( char *  string)
* change all special-chars into '?'
* special-char: all (char < ' ') or (char > '}')
*
*
char* UTX_CleanCR ( char *  string)

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

* UTX_CleanCR Delete Blanks, CR's and LF's at end of string
* returns positon of stringterminator \0
*
*
int UTX_CleanLF ( char *  sBuf)
* UTX_CleanLF change lineEnd (Cr|CrLf ..) to single LF.
* Input:
* sBuf line, eg from file (ex MS ..)
* Output:
* sBuf end of line is '\n'
* RetCod nr of characters of sBuf
*
int UTX_CleanCommC ( char *  cBuf)

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

int UTX_Clean_db ( char *  cbuf)
* clean doubles (change ',' into '.') in gesamter cbuf
* MS-Win schreibt "1,0"
* See also UTX_chg_chr1.
*
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 ..
*
int UTX_pos_skipBrackX ( char **  ps,
char *  pe,
char  ce 
)
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_ck_caseChr ( char *  s1,
char *  s2 
)
* compare 2 characters - ignore case
* s2 must be uppercase !
* Cannot handle german specialChars (ae, ue, ..).
* Retcod:
* 0 both chars are equal
* 1 chars are NOT equal
*
* see also strcasecmp strncasecmp (nur Linux !)
*
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 !)
*
int UTX_ck_caseStr ( char *  s1,
char *  s2 
)
* compare 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 !)
*
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_specChars ( char *  s1)
* test if string contains specialCharacters
* RetCod: 0=OK, keine SpecChar im string s1 enthalten.
* RetCod: -1=ERROR; es ist SpecChar im string s1 enthalten.
*
char* UTX_find_Del1 ( char *  p1)

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

char* UTX_pos_skipDeli1 ( char *  p1)

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

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_pos_skip_num ( char **  ps)

skip number

int UTX_pos_skip_int ( char **  ps)

skip int-number in string

int UTX_pos_skipTermWord ( char **  wNxt,
char *  cbuf 
)
char* UTX_pos_skipWord ( char *  cbuf)
* UTX_pos_skipWord skip Word
* 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)

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_cnr_chr ( char *  txt,
char  c1 
)

returns nr of char c1 in string txt

int UTX_sget_nrRange ( double *  d1,
double *  d2,
char **  expr 
)
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"
*
int UTX_cut_word ( char *  sBuf,
char *  s1 
)
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_cut2 ( char *  s1,
long  lDel 
)
* UTX_cut2 cut lDel chars out of string s1
* starting from position s1 remove <lDel> characters.
*
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_dump_cnl ( char *  cPos,
int  maxLen 
)
* print next <maxLen> characters, but stop at \n.
* printf("|");UTX_dump_cnl(p1,40);printf("|\n");
* DOES NOT OUTPUT the closing \n
*
int UTX_dump_c__ ( char *  cPos,
int  cLen 
)
* print next <cLen> characters; \n will be printed ..
* printf(" Line %d |",i1);
* UTX_dump_c__ (cpos, 30);
* printf("|\n");
*
int UTX_dump_word ( char *  cPos,
char *  sDel 
)
int UTX_dump_s__ ( char *  cPos,
int  cNr 
)
* UTX_dump_s__ dump String (replace \n\r\t\0) max cNr chars;
* Es wird auch '\0' und die folgenden chars ausgegeben !!
*
int UTX_dump_wTab ( char *  wTab[])
* UTX_dump_wTab dumpt table of words
*
int UTX_dump_p1p2 ( char *  p1,
char *  p2 
)
* UTX_dump_p1p2 dump string from ps to pe
* Usage:
* printf(" p1-p2 = |n");UTX_dump_p1p2(p1,p2);printf("|\n");
*
int UTX_dump__ ( char *  cPos,
int  maxLen 
)
* UTX_dump__ dump String (replace \n\r\t)
* Es wird bei '\0' gestoppt.
*
int UTX_cp_print ( char *  txo,
char *  txi,
int  maxLen 
)
* add printable characters from txi --> txo; but max. maxLen Chars.
* size of txo must be (maxLen + 1) !
* Change nonprintable characters to '?'
*
int UTX_cp_left ( char *  sOut,
char *  sIn,
int  cNr 
)
* copy string, max. cNr chars from left side of string sIn -> sOut;
* ATTENTION: size of sOut must be (cNr + 1) !
* - terminates always with '\0'
* sOut may not overlap sIn.
*
* RetCod: nr of characters copied (excluding '\0')
*
* UTX_cp_left (s2, s1, sizeof(s2) - 1);
*
*
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);
*
*
int UTX_cpLn_2cp ( char *  cbuf,
char *  pos1,
char *  pos2,
int  bufSiz 
)
* UTX_cpLn_2cp copy line between 2 pointers; del ending blanks, lf.
* Input:
* pos1 start of line to be copied
* pos2 start of next line
*
int UTX_cp_Line ( char *  cTo,
char **  cNxt,
char *  cFrom,
int  maxLen 
)
* UTX_cp_Line copy a Line (terminated by '\n')
* Input:
* cFrom string in,
* maxLen size of cTo, including "\0" (minimum 2)
* Output:
* cTo string out; \n is not included;
* terminated with "\0"; length=maxlen or less
* cNxt position of 1 char of next Line
* retCod length of cTo
*
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 
)
* UTX_setup_get__ get parameters (typ, value) from setup-file
* skips lines starting with # in setup-file
* Input:
* ctyp keyWord (1.word) in setupFile.
* Output:
* cval copy of the value (the 2.word) in the file; size up to 250 chars.
* unmodified if keyWord not found
* RetCod: 0=OK; -1=ctyp not found.
*
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_htm_fop ( FILE **  fp,
char *  fnam 
)

UTX_htm_fop open html-textfile

int UTX_htm_fcl ( FILE **  fp)

UTX_htm_fcl close html-textfile

Variable Documentation

const char TX_NUL = '\0'
char TX_buf1[128]
static
char TX_buf2[128]
static