gCAD3D 2.40
xa_ed_mem.c File Reference

ApplicationSpecific Textfunctions im Memory. More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../ut/ut_geo.h"
#include "../ut/ut_txt.h"
#include "../ut/ut_txfil.h"
#include "../ut/ut_gtypes.h"
#include "../ut/ut_memTab.h"
#include "../ci/NC_apt.h"
#include "../xa/xa_mem.h"
#include "../xa/xa_sele.h"
#include "../xa/xa_ed_mem.h"
#include "../db/ut_DB.h"

Macros

#define INCLUDE_FULL
 

Functions

 typedef_MemTab (ObjDB)
 
int APED_defDbo_skip (char **txso)
 
char * APED_lNr_objNam (long *lNr, long *lLen, char **oNam, char *wTab[], long lSta)
 
int APED_oid_src1 (int *typ, long *dbi, char **ps, long *ll)
 
int APED_search_objID (char *ps, long lLen, char *otx)
 
char * APED_onam_search (char *ps, char *pe)
 
int APED_onam_cut (char *cbuf, char *onam)
 
int APED_src_chg (long lNr, char *sNew)
 
int APED_update__ (long lNr)
 
int APED_VcTra_reset (long lNr)
 
int APED_dec_defLn (char **p2, int *typ, long *ind, char *p1)
 
int APED_ck_defLn (char **p2, char *p1)
 
int APED_dec_txt (char *txLn)
 
int APED_decAdd (char *cPos)
 
int APED_search_dbLimits (long *lTab)
 
int APED_nxt_def_typ (char **lSta, int *lNr, int *lLen, int typ)
 
int APED_find_dbo (long *dli, long *lNr, int typ, long dbi)
 
int APED_objID_defLn (char *oid, char *defLn)
 
int APED_search_defLn (char **lSta, long *lNr, int *lLen, char *otx, long lNEnd, int src)
 
int APED_find_depLn_nxt (char **lSta, long *lNr, long *lLen, char *otx)
 
int APED_find_depLn_last (char **lSta, long *lNr, long *lLen, char *otx)
 
int APED_find_dep__ (MemTab(ObjSRC)*oa, int typ, long dbi)
 
int APED_find_dep_nxt (MemTab(ObjSRC)*oa, int typ, long dbi, long lnr, int iPar)
 
int APED_find_depRef (MemTab(ObjSRC)*oa, long dbi, long lnr, int iPar)
 
int APED_find_depLn_ck (MemTab(ObjSRC)*oa, int *typ, long *dbi)
 
int APED_pt_find (char **cpPt, int *sLen, char **cpNxt, char *cps)
 
char * APED_nxt_obj (char *cps)
 
int APED_pt_chg (int *lsn, long ipt, char *cps, int lso)
 
int APED_find_par_nxt (MemTab(ObjSRC)*oa, int typ, long dbi, long lnr, int iPar)
 
int APED_find_par__ (MemTab(ObjSRC)*oa, int typ, long dbi)
 
int OSRC_add__ (MemTab(ObjSRC)*oa, int *typ, long *dbi, long *dli, long *lnr, int *iPar)
 
int OSRC_find_odb (MemTab(ObjSRC)*oa, int *typ, long *dbi)
 
int APED_txo_srcLn__ (ObjTXTSRC *tso, int itsMax, char *sln)
 
int APED_txo_modObj_get (int *pma, ObjTXTSRC *soi, int rMax, int typ, char *stx)
 
int APED_txo_find_parent (int *typ, long *dbi, ObjTXTSRC *tso, char *txso, int ip)
 
int APED_txo_dump (ObjTXTSRC *tso, char *sl, char *auxTxt)
 

Variables

char AP_ED_oNam [128]
 objectName of active Line More...
 
char * UTF_FilBuf0
 
long UTF_FilBuf0Len
 
char * UTF_FilBuf1
 
long UTF_FilBuf1Len
 
char * ObjCodTab []
 
char * NcoTxtTab []
 
char * GcoTxtTab []
 
char * CopTxtTab []
 
char MOpTxtStr []
 

Detailed Description

ApplicationSpecific Textfunctions im Memory.

=====================================================
List_functions_start:
APED_oid_dbo__ make name from typ and DB-Index
APED_oid_dbo_all make name from typ and DB-index (all types)
APED_find_dbo Search last DefinitionLine for DB-obj
APED_search_defLn Search last DefinitionLine for obj
APED_nxt_def_typ Search next DefinitionLine of objectTyp
APED_defDbo_skip skip definition-header (skip eg "P20=")
APED_objID_defLn copy definitionHdr out (left of '=')
APED_ck_defLn check if Line cBuf is a Definitionline
APED_dec_defLn check if Line cBuf is a Definitionline; decode ..
APED_dec_txt decode textLine, add all objs to group (oTab)
APED_decAdd decode textLine, add all objs to group (oTab)
APED_oid_src1 get next objID in string
APED_search_objID search objID otx in line ps[lLen]
APED_lNr_objNam get sourcelineNr from ObjName
APED_onam_search search objName between ps and pe
APED_onam_cut cut/copy objName
APED_src_chg deactivate line, insert modified line
// APED_undo_do undo/redo (Delete/restore) line UNUSED !
APED_update__ update display after APED_undo_redo
APED_find_dep__ find all depending sourceObjs (childs)
APED_find_dep_nxt search & add all depending objects
APED_find_depLn_nxt Search next depending Line
APED_find_depLn_last Search last depending Line
APED_find_depRef delete all lines for active constrPlane
APED_find_par__ find all parent-Objs
APED_find_par_nxt search & add all parent objects
APED_pt_find find position of next point in string
APED_pt_chg change point from dbi in string
APED_nxt_obj find next obj in string; skip brackets.
APED_search_dbLimits search highest indices
APED_txo_srcLn__ analyze sourceline > ObjTXTSRC[]
APED_txo_modObj_get get all modifyable-objects out of atomic-objects
APED_txo_find_parent get 1. parent of subObj <ip> typ=Typ_PT
APED_txo_find_ptVal find points with values in tso
// APED_txo_cpy copy iNr records of tso0 starting at iRec -> tso1
APED_VcTra_reset delete Vec's&Tra's after progLine x in DB
OSRC_add__ add record to ObjSRC-table
OSRC_find_odb test if db-obj is already in ObjSRC-table
List_functions_end:
=====================================================
see also:
// AP_search_obj / UTF_GetLinNr
// AP_obj_delCk1 UTF_GetLinNr
APT_obj_expr Create struct from ModelCode (text).
AP_search_obj
AP_SMD_prv
UTF_
APT_decode_ausdr
../xa/srcu.c Dynamic update numeric strings SRCU_..
SRC ../xa/xa_src.c create sourceCode from atomicObjs, dbo ..

Macro Definition Documentation

#define INCLUDE_FULL

Function Documentation

typedef_MemTab ( ObjDB  )
int APED_defDbo_skip ( char **  txso)
char* APED_lNr_objNam ( long *  lNr,
long *  lLen,
char **  oNam,
char *  wTab[],
long  lSta 
)
* get next line with objName containing all filterwords (OR)
* if wTab is empty, next srcline is returned.
* Input:
* wTab filtertext (a list of words, terminated with NULL)
* lSta first sourcelinNr where to search;
* Output:
* lNr sourcelinNr found
* lLen length of sourceline (incl name)
* oNam pointer to found objName
* RetCod:
* NULL no (more) line found
* != NULL OK, startpos of sourceline found
*
* wTab: use UTX_wTab_str
*
int APED_oid_src1 ( int *  typ,
long *  dbi,
char **  ps,
long *  ll 
)
* APED_oid_src1 get next objID in string
* Used for get parents of object
* Does not recognize DX RX ..
* Input:
* ps startpos of sourcetext
* ll lineLength (excluding definitionHeader, objName)
* Output:
* typ,dbi dbo (if rc==0)
* ps startpos of next word (not yet analyzed ..)
* RetCod:
* 0 line contains objID <typ,dbi>
* -1 Error
*
*
int APED_search_objID ( char *  ps,
long  lLen,
char *  otx 
)
* search objID otx in line ps[lLen]
* Input:
* ps startpos of line, including line header
* lLen lineLength (including objName)
* otx what to search; objID; eg "P1"
* RetCod: 1 line is definition of otx ("<otx> = ..")
* 0 line contains otx as parent-obj (".. = .. <otx> .. ")
* -1 line does not contain otx
* -2 line is a commentline
* -3 line is not active
*
char* APED_onam_search ( char *  ps,
char *  pe 
)
* APED_onam_search search objName between ps and pe
* returns position of 1.char after " #" or NULL
*
int APED_onam_cut ( char *  cbuf,
char *  onam 
)
* APED_onam_cut cut/copy objName
* cut cbuf at " #" and copy the following text -> onam
* onam size 128
* MODIFIES cbuf !
*
int APED_src_chg ( long  lNr,
char *  sNew 
)
* APED_src_chg deactivate line, insert modified line
* and report change -> UNDO.
* Input:
* sNew new line, complete. \0-terminated;
* must be a string with at least 2 free characters
*
* RetCod: 0 Ok, line changed ...
* 1 Error; newLine == activeLine;
*
* creates a additional line ! Update: APED_update__
*
int APED_update__ ( long  lNr)
* APED_update__ update display starting from lineNr
* set back to <lNr>, update to end of model.
* lNr -1: start from current lineNr (eg after UTF_insert1)
*
int APED_VcTra_reset ( long  lNr)

APED_VcTra_reset delete Vec's&Tra's after progLine x in DB

int APED_dec_defLn ( char **  p2,
int *  typ,
long *  ind,
char *  p1 
)
* APED_dec_defLn check if Line p1 is a Definitionline;
* if yes: decode its objID, return positon of objCode
* lines "V=NEW()" sofort auswerten, nicht via WC_Work__;
* Output:
* p2 position of 1 char after '='
* typ, ind typ and DB-index of outputvar.
* RetCod = 0: yes, p1 is a Definitionline.
* -1: No.
*
int APED_ck_defLn ( char **  p2,
char *  p1 
)
* check if Line cBuf is a Definitionline;
* find 1. delimiter; it must be '='.
* Output:
* p2 first char following '=' (only if retCod == 0)
* RetCod 0: yes, p1 is a Definitionline.
* -1: No.
*
* see also APED_search_defLn PRG_ck_defLn APED_dec_defLn
*
int APED_dec_txt ( char *  txLn)
* decode textLine, add all objsID's and codes to group (oTab)
* see IE_decode_Ln
*
int APED_decAdd ( char *  cPos)
* decode textLine, add all objs to group (oTab)
* Line is \n terminated !
*
int APED_search_dbLimits ( long *  lTab)
* APED_search_dbLimits search highest indices
* Output:
* lTab[0] nr of curves (S)
* lTab[1] nr of surfaces (A)
* lTab[2] nr of bodies (B)
* lTab[3] nr of notes (N)
* lTab[4] nr of circles (C)
* lTab[5] nr of lines (L)
* lTab[6] nr of points (P)
* lTab[7] nr of mdRefs (M)
* see also AP_stru_2_txt (NULL,,1);
*
int APED_nxt_def_typ ( char **  lSta,
int *  lNr,
int *  lLen,
int  typ 
)
* Search next DefinitionLine of objectTyp
* In:
* lSta NULL=start search from beginning of model (first call).
* DO NOT MODIFY lSta,lNr,lLen for incremental search !
* typ typ of obj to find; eg Typ_PT
* Out:
* lSta startpos of line found
* lNr nr of line found
* lLen length of line incl \n (MS-Win incl \r)
*
* RetCodes:
* >=0 OK; DB-Index of obj; lSta, lNr, lLen set.
* -1 no (more) line found
*
* see also:
* AP_search_def
* AP_search_obj / UTF_GetLinNr
* UTF_del_rest
*
int APED_find_dbo ( long *  dli,
long *  lNr,
int  typ,
long  dbi 
)
* Search last DefinitionLine for DB-obj
* Input:
* typ,dbi DB-object
* Output:
* dli dispListIndex (-1 for Vecs, Vars)
* lNr Source-LineNr
* RetCod: 0=OK; obj found; -1=Err, obj not found
*
*
int APED_objID_defLn ( char *  oid,
char *  defLn 
)
* APED_objID_defLn copy definitionHdr out (left of '=')
* maxSiz of oid = 32 chars
*
int APED_search_defLn ( char **  lSta,
long *  lNr,
int *  lLen,
char *  otx,
long  lNEnd,
int  src 
)
* Search last DefinitionLine
* In:
* otx zu suchendes Obj; zB "L20"
* lNEnd ab (incl) dieser Zeile nicht mehr suchen. -1: bis zum Ende.
* Out:
* lSta Posi, wo spaeter weitergesucht wird ..
* ist Pointer auf den beginn der gefundenen Zeile ..
* lNr gefundene zeilenNummer; erste Zeile == 1.
* lLen Laenge der Zeile incl \n (und bei MS-Win \r)
* RetCod:
* -1 Error, def.line does not exist.
* 0 OK, def.line found
* 1 OK, def.line found, but without ending '\n'
*
* see also:
* AP_search_def
* AP_search_obj / UTF_GetLinNr
* UTF_del_rest
*
int APED_find_depLn_nxt ( char **  lSta,
long *  lNr,
long *  lLen,
char *  otx 
)
* Search next dependant Line;
* lNr mit Startpos *lSta is a Definitionline (z.B. "L22=...")
* search begins in next Line !
* Input:
* lNr LineNr of Definitionline (where to start search ..)
* lSta Startposition of lNr; NULL == not known.
* otx what to search
* Output:
* lNr LineNr of found depLn
* lSta Startposition of found depLn
* lLen length of found depLn
*
* RetCod: 0 Ok, found ..
* -1 no depending line exists for obj otx
*
int APED_find_depLn_last ( char **  lSta,
long *  lNr,
long *  lLen,
char *  otx 
)
* Search last dependant Line;
* lNr mit Startpos *lSta ist eine Definitionline (z.B. "L22=...")
* search begins in next Line !
* Input:
* lNr LineNr of Definitionline (where to start search ..)
* lSta Startposition of lNr; NULL == not known.
* otx what to search
* Output:
* lNr LineNr of found depLn
* lSta Startposition of found depLn
* lLen length of found depLn
*
* RetCod: 0 Ok, found ..
* -1 es existiert keine depending line zu obj otx
*
int APED_find_dep__ ( MemTab(ObjSRC)*  oa,
int  typ,
long  dbi 
)
* APED_find_dep__ find all depending sourceObjs (childs)
* Example:
* #include "../ut/ut_memTab.h" // MemTab
* APED_find_dep__ (&delTab, typ, dbi);
* printf(" nr of dep.objs = %d\n",delTab.rNr);
* MemTab_free (&delTab);
*
int APED_find_dep_nxt ( MemTab(ObjSRC)*  oa,
int  typ,
long  dbi,
long  lnr,
int  iPar 
)
* APED_find_dep_nxt search & add all depending objects
* Del_find search & add all depending objects
* see also AP_SMD_nxt Del_find
*
int APED_find_depRef ( MemTab(ObjSRC)*  oa,
long  dbi,
long  lnr,
int  iPar 
)
int APED_find_depLn_ck ( MemTab(ObjSRC)*  oa,
int *  typ,
long *  dbi 
)
int APED_pt_find ( char **  cpPt,
int *  sLen,
char **  cpNxt,
char *  cps 
)
char* APED_nxt_obj ( char *  cps)
* find next obj in string; skip brackets.
*
* InPut:
* cps startpos (previous obj)
* OutPut:
* RetCod startpos of next obj or NULL (end of string)
*
* if it is '(' then skip brackets;
* if its ' ' or ',' then skip this char; nxt obj found.
*
*
int APED_pt_chg ( int *  lsn,
long  ipt,
char *  cps,
int  lso 
)
int APED_find_par_nxt ( MemTab(ObjSRC)*  oa,
int  typ,
long  dbi,
long  lnr,
int  iPar 
)
* APED_find_par_nxt search & add all parent objects
* find parents of obj <typ,dbi>; its definition-lineNr is <lnr>.
* RetCod: -1 Error (lnr does not exist)
*
* see also APED_find_dep_nxt AP_SMD_nxt Del_find
* iPar: -1=primary_obj; else index of parent into oa.
*
int APED_find_par__ ( MemTab(ObjSRC)*  oa,
int  typ,
long  dbi 
)
* APED_find_par__ find all parent-Objs
* codeline: "<defObj> = <parent-objects>,<functions>"
*
* see also APED_find_dep__
*
* Example:
* #include "../ut/ut_memTab.h" // MemTab
* MemTab(ObjSRC) parTab = _MEMTAB_NUL;
* APED_find_par__ (&parTab, typ, dbi);
* MemTab_dump (&parTab);
* MemTab_free (&parTab);
*
int OSRC_add__ ( MemTab(ObjSRC)*  oa,
int *  typ,
long *  dbi,
long *  dli,
long *  lnr,
int *  iPar 
)
* OSRC_add__ add record to ObjSRC-table
* Retcod: 0 = OK; -1 = outOfMemory-Error.
*
int OSRC_find_odb ( MemTab(ObjSRC)*  oa,
int *  typ,
long *  dbi 
)
* OSRC_find_odb test if db-obj is already in ObjSRC-table
* RetCod: -1 not else index.
*
int APED_txo_srcLn__ ( ObjTXTSRC tso,
int  itsMax,
char *  sln 
)
* analyze sourceline sln; get source-objects.
* analyze definition-sourceline; get typ,form,level.
*
* Input:
* sln definition-sourcline, without def.Hdr, with name, 0-terminated.
* itsMax max nr of records in tso
* Output:
* tso a list of all objects in sln
* RetCod nr of tso-records, -1=Err
*
* tso.type tso.form
* Typ_NumString Typ_NumString num.value (eg 12 -23 .8)
* Typ_ObjDB Typ_ObjDB (eg "V20" or "P12")
* Typ_ConstVal <codeOffset> NcoTxtTab (num.constant: eg "PI")
* Typ_ConstOG <codeOffset> GcoTxtTab (geom.constants: eg "DX")
* Typ_cmdNCsub <codeOffset> Function fnc: ObjCodTab ("CUT","REV" ..)
* TYP_OpmPlus <codeOffset> MOpTxtStr (math.operator: + - / *)
* Typ_String Typ_String string (eg "Submodel1")
* Typ_Name Typ_Name (the objName eg "# info")
* TYP_FuncEnd - end of list
*
* tso.ilen length in chars of obj
* tso.ipar index to parent (into tso); -1=primary level.
* tso.ioff offset in chars from start of codestring.
*
* see also SRCU_analyz__
*
int APED_txo_modObj_get ( int *  pma,
ObjTXTSRC soi,
int  rMax,
int  typ,
char *  stx 
)
int APED_txo_find_parent ( int *  typ,
long *  dbi,
ObjTXTSRC tso,
char *  txso,
int  ip 
)
int APED_txo_dump ( ObjTXTSRC tso,
char *  sl,
char *  auxTxt 
)

sl: NULL or the corresponding codeline

Variable Documentation

char AP_ED_oNam[128]

objectName of active Line

char* UTF_FilBuf0
long UTF_FilBuf0Len
char* UTF_FilBuf1
long UTF_FilBuf1Len
char* ObjCodTab[]
char* NcoTxtTab[]
char* GcoTxtTab[]
char* CopTxtTab[]
char MOpTxtStr[]