gCAD3D 2.40
ut_txTab.c File Reference

list of strings (0-terminated); add, find, .. More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../ut/ut_umem.h"
#include "../ut/ut_txTab.h"

Functions

int UtxTab_free (TxtTab *tab)
 
int UtxTab_reall_C (char **tab, int newSiz)
 
int UtxTab_reall_I (long **ind, int newSiz)
 
int UtxTab_add_file (TxtTab *sTab, char *fnam)
 
int UtxTab_add_uniq__ (TxtTab *tab, char *newtxt)
 
int UtxTab_add (TxtTab *tab, char *newtxt)
 
int UtxTab_rem (TxtTab *tab)
 
int UtxTab_init_spc (TxtTab *tab, void *spc, int isize)
 
int UtxTab_init_Memspc (TxtTab *tab, Memspc *memSpc)
 
int UtxTab_init__ (TxtTab *tab)
 
int UtxTab_find (char *cs, TxtTab *tab)
 
int UtxTab_query (char **cLast, TxtTab *tab)
 
char * UtxTab__ (int iNr, TxtTab *tab)
 
int UtxTab_nr (TxtTab *tab)
 
int UtxTab_bytes_free (TxtTab *xTab)
 
char * UtxTab_pos_free (TxtTab *xTab)
 
int UtxTab_dump (TxtTab *tab)
 

Detailed Description

list of strings (0-terminated); add, find, ..

NEEDS:
../ut/ut_umem.h ../ut/ut_umem.c UME_..
=====================================================
List_functions_start:
UtxTab_NEW setup of a new StringList
UtxTab_init__ init / clear all words; automatic alloc/realloc
UtxTab_init_Memspc init / clear all words; fixed space in Memspc; no reallocate
UtxTab_init_spc init / clear all words; fixed space (void*); no reallocate
UtxTab_add add a new string
UtxTab_add_uniq__ add string, check if it already exists
UtxTab_add_file make table of strings from file
UtxTab_rem remove last string
UtxTab_query get text of last string; retCod = index of next free
UtxTab_find find string - ask nr
UtxTab__ get text of record Nr iNr;
UtxTab_nr returns nr of strings
UtxTab_bytes_free returns nr of free bytes in TxtTab
UtxTab_pos_free returns next free position in memspace of TxtTab
List_functions_end:
=====================================================

Function Documentation

int UtxTab_free ( TxtTab tab)

do not free TxtTab from UtxTab_init_Memspc

int UtxTab_reall_C ( char **  tab,
int  newSiz 
)
int UtxTab_reall_I ( long **  ind,
int  newSiz 
)
int UtxTab_add_file ( TxtTab sTab,
char *  fnam 
)

make table of strings from file.

int UtxTab_add_uniq__ ( TxtTab tab,
char *  newtxt 
)
* add string, check if it already exists
* RetCode:
* -1 EOM - no enough memory error
* >=0 index of string
*
int UtxTab_add ( TxtTab tab,
char *  newtxt 
)
* add a new string
* RetCode:
* -1 EOM - no enough memory error
* >=0 index of string
*
int UtxTab_rem ( TxtTab tab)

remove last string

int UtxTab_init_spc ( TxtTab tab,
void *  spc,
int  isize 
)
* init / clear all words; fixed space (void*); no reallocate.
* RetCod:
* -1 out of memory error
*
int UtxTab_init_Memspc ( TxtTab tab,
Memspc memSpc 
)
* init / clear all words; fixed space in Memspc; no reallocate.
* RetCod:
* -1 out of memory error
*
int UtxTab_init__ ( TxtTab tab)
* init / clear all words; automatic alloc/realloc.
*
int UtxTab_find ( char *  cs,
TxtTab tab 
)

UtxTab_find find string cs - returns nr; -1 = not found

int UtxTab_query ( char **  cLast,
TxtTab tab 
)
* get text of last string;
* RetCod = index of next free
*
char* UtxTab__ ( int  iNr,
TxtTab tab 
)

get text of record Nr iNr (returns pointer !)

int UtxTab_nr ( TxtTab tab)

returns nr of strings

int UtxTab_bytes_free ( TxtTab xTab)

returns nr of free bytes in TxtTab

char* UtxTab_pos_free ( TxtTab xTab)

returns next free position in memspace of TxtTab

int UtxTab_dump ( TxtTab tab)

dump all strings (test)