gCAD3D 2.35
ut_txfil.h File Reference

Go to the source code of this file.

Functions

int UTF_clear_ ()
 
long UTF_offset_ (char *cpos)
 
void UTF_load_ (char *txbuf, long *txlen)
 
int UTF_add_file (char *fn)
 
int UTF_add_line (char *txt)
 
int UTF_add_nl ()
 
int UTF_txt_chg (char *cpos, char *txt, long txlen)
 
int UTF_wri_file (char *fn, int iniFunc(FILE *))
 
long UTF_GetLen0 ()
 
char * UTF_GetLinNr (char *lbuf, long *llen, long lNr)
 
char * UTF_GetPosLnr (long *llen, long lNr)
 
int UTF_GetLnrPos (long ipos)
 
char * UTF_GetnextLnPos (char *cpos)
 
char * UTF_GetPrevLnPos (long *lNr, char *cpos)
 
char * UTF_find_tx1 (long *lNr, char *tx1)
 
int UTF_clear1 ()
 
char * UTF_add1_file (char *fn)
 
int UTF_add1_line (char *txt)
 
char * UTF_get1_LnPos (long lNr)
 
long UTF_get1_LnLen (char **lEnd, char *lStart)
 
char * UTF_get1_nxtLnPos (char *actPos)
 
int UTF_insert1 (long cpos)
 
int UTF_del_line1 (long lNr)
 
long UTF_GetLinLen (char **lEnd, char *lStart)
 

Function Documentation

int UTF_clear_ ( )

UTF_clear den Hauptspeicher loeschen

long UTF_offset_ ( char *  cpos)

eine Charpos (ev ex UTF_GetLinNr) in Offset umrechnen

void UTF_load_ ( char *  txbuf,
long *  txlen 
)
int UTF_add_file ( char *  fn)
Datei in den Hauptbuffer laden - hintanhaengen
rc = -1 = Error;
1 = OK.
int UTF_add_line ( char *  txt)
UTF_add_line add line to membuf UTF_FilBuf0
txt is \0-terminated, '\n' will be added.
int UTF_add_nl ( )

UTF_add_nl ein '
' hintanfuegen, wenn nicht vorh.

int UTF_txt_chg ( char *  cpos,
char *  txt,
long  txlen 
)

UTF_txt_chg 1-n chars aendern

int UTF_wri_file ( char *  fn,
int   iniFuncFILE * 
)
write memory -> file fnam; call iniFunc first.
iniFunc eg DL_wri_dynDat0
rc = 0 = Error;
1 = OK.
long UTF_GetLen0 ( )
UTF_GetLen0 liefert die Laenge des UTF_FilBuf0 UTF_FilBuf0Len.
= Dateisize abfragen (zB zum Check EOF ..)
char* UTF_GetLinNr ( char *  lbuf,
long *  llen,
long  lNr 
)
get sourceline from sourcelineNr
Liefert Zeile mit Zeilennummer lNr in lbuf (aus dem mem !)
makes a copy of line <lNr> from UTF_FilBuf0 -> lbuf
Output:
lbuf copy of line <lNr> from UTF_FilBuf0, '\0' terminated. Or NULL.
llen length of lbuf
Retcod NULL: Line does not exist; llen = -1.
else Startpos of line in UTF_FilBuf0.
see also:
UTF_GetPosLnr get a pointer to a sourcecodeline
ATTENTION: lbuf must have size=mem_cbuf1_SIZ !
char* UTF_GetPosLnr ( long *  llen,
long  lNr 
)
von zeile # lNr die Startposition und die Zeilenlaenge der zeile liefern.
ln_pos ist der erste char der line, llen ist die laenge ohne terminator;
der Start der naechsten Zeile ist also ln_pos + llen + term_anz.
Die erste Zeile ist lNr = 1.
Output:
llen gives the position of the LF
RetCode NULL: EOF found.
Usage:
p1 = UTF_GetPosLnr (&lLen, lNr);
UTX_dump_cnl (p1, 60); printf("\n"); // print max 60 chars, but stop at \n
int UTF_GetLnrPos ( long  ipos)
die zeilennummer zu einer offsetpos im MemFile liefern
= die Anzahl von \n von 0 bis ipos zaehlen.
char* UTF_GetnextLnPos ( char *  cpos)
UTF_GetnextLnPos Position der nachfolgenden zeile liefern
cpos = NULL: Bufferstartpos UTF_FilBuf0 liefern.
char* UTF_GetPrevLnPos ( long *  lNr,
char *  cpos 
)
UTF_GetPrevLnPos Position der vorherigen zeile liefern
Input:
lNr NULL: do not provide lineNr of previous Line.
cpos NULL: BufferEndPos UTF_FilBuf0+len liefern.
Output:
lNr = -1 Start of Buffer reached
char* UTF_find_tx1 ( long *  lNr,
char *  tx1 
)
UTF_find_tx1 Zeilenummer der Zeile, die tx1 als erste enthaelt, suchen
Sucht nur im Mem !
RetCod:
position of tx1
NULL - tx1 not found
int UTF_clear1 ( )
UTF_clear1 den Zwischenspeicher Buf1 loeschen
Example see UTF_insert1
char* UTF_add1_file ( char *  fn)
Eine Datei into Buf1 laden
rc = -1 = Error;
1 = OK.
int UTF_add1_line ( char *  txt)
UTF_add1_line add string (0-termin.) into UTF_FilBuf1
Schreibt --> UTF_FilBuf1 (hintanfuegen)
retCod 0 OK
-1 out of mem
Example see UTF_insert1
char* UTF_get1_LnPos ( long  lNr)
UTF_get1_LnPos find startPos of line from LineNr
lNr of first line = 1
RetCod: NULL for EOF or (lNr<1); else first char of line.
long UTF_get1_LnLen ( char **  lEnd,
char *  lStart 
)
UTF_get1_LnLen length of line starting at lStart in UTF_FilBuf1
Output:
lEnd position of next '\n' or '\0'
Retcod (nr of characters ) - 1
char* UTF_get1_nxtLnPos ( char *  actPos)
UTF_get1_nxtLnPos naechste Zeile aus UTF_FilBuf1 lesen
Input:
actPos active Line;
if(actPos == NULL) get first Line;erste zeile liefern.
Output:
retCod position of next line foooollowing actPos
if retCod == NULL: no more line ..
int UTF_insert1 ( long  cpos)
UTF_insert1 insert auxBuffer into mainBuffer at pos cpos.
auxBuffer: UTF_FilBuf1; mainBuffer: UTF_FilBuf0.
cpos < 0: join buffers (mainBuffer += auxBuffer).
update display after buffer-update: see APED_update__ ();
Example:
ObjGX o1; char s1[1000]; int siz_s1=1000; Point p1={1.,0.,0.};
UTF_clear1 (); // init auxBuf
AP_obj_2_txt (NULL, 0L, NULL, 0L); // init AP_obj_2_txt
OGX_SET_OBJ (&o1, Typ_PT, Typ_PT, 1, &p1); // create point-object
AP_obj_2_txt (s1, siz_s1, &o1, -1L); // create sourcecode for obj -> auxBuf
UTF_add1_line ("# end of xx"); // add text to auxBuf
UTF_insert1 (-1L); // store auxBuf (add to active code)
APED_update__ (-1L); // work new codes
int UTF_del_line1 ( long  lNr)

Eine Zeile im Memory loeschen

long UTF_GetLinLen ( char **  lEnd,
char *  lStart 
)
UTF_GetLinLen length of line starting at lStart in UTF_FilBuf0
Output:
lEnd position of next '\n' or '\0'
Retcod nr of characters