gCAD3D 2.35
xa_ed.c File Reference

Neutral EditorFunctions (not Gtk-specific). More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../gui/gui_types.h"
#include "../ut/ut_geo.h"
#include "../ut/ut_txt.h"
#include "../ut/ut_TX.h"
#include "../ut/ut_os.h"
#include "../ut/ut_txfil.h"
#include "../ut/ut_memTab.h"
#include "../ut/ut_cast.h"
#include "../ut/func_types.h"
#include "../gr/ut_DL.h"
#include "../gr/ut_gr.h"
#include "../ci/NC_Main.h"
#include "../db/ut_DB.h"
#include "xa_mem.h"
#include "../xa/xa_uid.h"
#include "../xa/xa_ed.h"
#include "../xa/xa_undo.h"
#include "../xa/xa_app.h"
#include "../xa/xa.h"


#define ED_delIndmax   10


 typedef_MemTab (ObjRange)
void * WIN_ED ()
int ED_update (long ipos)
int ED_newPos ()
int ED_lnr_bis__ (int lNr)
int ED_query_CmdMode ()
int EDE_reload ()
int ED_new_File (char *filnam)
int ED_add_File (char *filnam, int cpos)
int ED_add_Def (char *buf)
int ED_srcLn_grp_add (char *txt, int *grpNr)
int ED_srcLn_add (char *srcLn, int mode)
int ED_add_Line (char *buf)
int ED_add_Text (int typ, long ind, char *buf)
int ED_get_delay ()
int ED_Init ()
int ED_set_eof ()
int ED_Reset ()
int ED_del__ (int lnr)
int ED_del_block (int mode, char *fromLn, char *toLn)
int ED_query_mode ()
int ED_set_mode (int newMode)
int ED_skip_end ()
int ED_skip_start ()
int ED_enter ()
int ED_step ()
int ED_go ()
int ED_GetNxtLin (int *lnr, char *lbuf)
char * ED_Read_cPos ()
int ED_Read_Line (char *buf)
int ED_lnr_mac (int mode)
int ED_lnr_reset ()
int ED_work_dyn ()
int ED_work_exit ()
int ED_work_END (int mode)
void ED_work_ENTER ()
int ED_work_STEP ()
int ED_work_CAD (int lNr, char *cbuf)
int ED_work_CurSet (int new_lnr_act)
int ED_work_GO ()
int ED_cont_file ()
int ED_file__ (int mode, char *fNam)
int ED_work_file (char *filnam)
int ED_set_lnr_von (int lNr)
int ED_set_lnr_act (long lNr)
int ED_set_cpos_lnr_act ()
int ED_get_lnr_act ()
int ED_inc_lnr ()
int ED_ck_lnEnd ()
int ED_ck_lnStart ()
int ED_get_mac_fil ()
int ED_Run ()
void ED_set_delay (int delaytime)
int ED_addRange (MemTab(ObjRange)*rTab, char *lBuf)
int ED_test__ ()


int WC_stat_bound
 ON OFF; Draw boundary of Flächen J/N. More...
int AP_src
 AP_SRC_MEM or AP_SRC_EDI. More...
int WC_modact_ind
ColRGB AP_defcol
 die DefaultColor des aktiven (sub)Model More...
int WC_sur_ind
 Der Index auf die ActiveConstrPlane. More...
MemObj winED
int UI_InpMode
int UI_EditMode
int xa_fl_TxMem
char * UTF_FilBuf0
long UTF_FilBuf0Siz
long UTF_FilBuf0Len
int APT_stat_act
int APT_line_act
int UP_level
int APT_dispPL
static char AP_filnam [256]
static int ED_mode
static int ED_mode_old
static int ED_delay = 0
static FILE * maclun = NULL
int APT_mac_fil = OFF
int ED_lnr_act
static int ED_lnr_von
static int ED_lnr_bis
static int ED_lnr_max
char * ED_cpos
long UI_Ed_fsiz

Detailed Description

Neutral EditorFunctions (not Gtk-specific).

-------------- functions for memory only EDM_* --------------
ED_del__ delete all lines including <lnr> in mem
ED_del_block delete Block; In: first line, last line. UNUSED
ED_cont_file continue with file ..
-------------- functions for memory and editor ED_* --------------
ED_Read_Line Read aus File|Mem
ED_GetNxtLin get next line
ED_work_CurSet new active lineNr; update
ED_Get_LineNr get active lineNr ED_lnr_act
ED_Reset reset to srcLn 0; but no init.
ED_Init reset in srcLn 0
-------------- functions for editor only EDE_* --------------
ED_update Filesize changed - update Mem (Edi -> Memory)
ED_query_CmdMode aktuelle Zeile into ED_buf1 einlesen, ihren Typ feststellen
ED_ck_lnStart test if cursor is at first position in line
ED_ck_lnEnd test if cursor is at last position in line
EDE_reload load ?
ED_new_File Ein Datei ins Hauptprog laden
ED_add_File Insert Datei filnam in den Hauptbuffer an Position cpos
ED_add_Def einen DefText (zB "P123=" in die Datei einfuegen;
ED_srcLn_add save line in memory, Undo-List, work line.
ED_add_Line eine komplette Line zufuegen und abarbeiten
ED_add_Text entscheiden ob kompl. Zeile und nur zufuegen oder auch abarb
ED_Run Wird vom GO/STEP/END-Button gerufen.
ED_newPos cursor in new line;
ED_work_ENTER only for ED_add_Line; do not use ..
ED_work_END das "RUN"
ED_work_exit exit modify, work from curPos to end of model ..
ED_get_lnr_act get ED_lnr_act; see also ED_Get_LineNr
ED_set_cpos_lnr_act set ED_cpos to start of line ED_lnr_act
ED_skip_start keep ED_mode; set ED_mode = ED_mode_go;
ED_enter set ED_mode=ED_mode_enter;
ED_step set ED_mode=ED_mode_step;
ED_go set ED_mode=ED_mode_go;
ED_work_dyn work block :DYNAMIC_DATA
ED_addRange decode ObjRanges and add them to MemTab(ObjRange)
see also:
../xa/xa_ed_mem.c APED_*
../xa/xa_src.c SRC_
AP_APT_* AP_APT_clean
ED_work_Update work from startingLineNr to end
ED_get_curPos get cursorPosition, LineStartPosition, LineEndPosition.
ED_get_actPos get position of active Line (ED_lnr_act) in mem
ED_parent_disp display a selected ParentObject

Macro Definition Documentation

#define ED_delIndmax   10

Function Documentation

typedef_MemTab ( ObjRange  )
void* WIN_ED ( )
int ED_update ( long  ipos)

Filesize changed - update Mem (Edi -> Memory) SOFORT !

int ED_newPos ( )

ED_newPos cursor in new line; use in UI_EdButtonRelease (click into Line) use in UI_EdKeyRelease (CurUp/Dwn)

int ED_lnr_bis__ ( int  lNr)

lNr >= 0 - setzen lNr = -1 - lesen

int ED_query_CmdMode ( )
aktuelle Zeile into ED_buf1 einlesen, ihren Typ feststellen
-3 deleted Line (1.char '_')
-2 commentline (1.char '#')
-1 empty line
0 Defline (eg "P20=..")
1 Direktcommand
2 IndirektCommand
int EDE_reload ( )
int ED_new_File ( char *  filnam)

Ein Datei ins Hauptprog laden

int ED_add_File ( char *  filnam,
int  cpos 

Insert Datei filnam in den Hauptbuffer an Position cpos. cpos < 0: hintanhaengen !

int ED_add_Def ( char *  buf)

einen DefText (zB "P123=" in die Datei einfuegen; muss am Beginn einer zeile liegen.

int ED_srcLn_grp_add ( char *  txt,
int *  grpNr 
add sourcline to last created sourceline as undo-group
grpNr grouplineNr; first = 1, next 2
(first object with grpNr = 0 created with ED_srcLn_add)
set to 1 at first call, increments automatic.
see also ED_srcLn_add (IE_outTxt, 1);
int ED_srcLn_add ( char *  srcLn,
int  mode 
ED_srcLn_add save line in memory, Undo-List, work line.
see also ED_add_Line IE_cad_OK
mode 0=display&save;
1=save;already displayed
int ED_add_Line ( char *  buf)

eine komplette Line zufuegen und abarbeiten see also ED_srcLn_add

int ED_add_Text ( int  typ,
long  ind,
char *  buf 
int ED_get_delay ( )
int ED_Init ( )
int ED_set_eof ( )
int ED_Reset ( )
int ED_del__ ( int  lnr)
ED_del__ delete line <lnr> and all following lines
lNr = 16;
ED_del__ (lNr); // delete code & displist for all lines starting with lNr
ED_work_CurSet (lNr); // update; or use APED_update__
int ED_del_block ( int  mode,
char *  fromLn,
char *  toLn 

ED_del_block delete Block; In: first line, last line. Input: mode = 0 do not delete toLn 1 also delete toLn

int ED_query_mode ( )
value setFunc
0=ED_mode_step ED_step()
1=ED_mode_go = Run ED_go()
3=ED_mode_enter = Edit ED_enter()
int ED_set_mode ( int  newMode)
int ED_skip_end ( )
int ED_skip_start ( )

used by ED_cont_file, ED_work_file <jump, MAC, CALL, return>

int ED_enter ( )

CR by Keyboard; es daf kein CRLF zugefuegt werden ! (sonst doppelt) used by: IE_activate, IE_cad_init1, ED_work_ENTER see ED_query_mode

int ED_step ( )

used after ED_work_ENTER, ED_work_CurSet(!)

int ED_go ( )

used by ED_work_CurSet, ED_PP_run, ED_work_PP.

int ED_GetNxtLin ( int *  lnr,
char *  lbuf 

Liefert naechste Zeile und ZeilenNr. Als Retcod = ihre Länge Dzt nur used for read Fortsetzungszeilen von APT_decode_cv

char* ED_Read_cPos ( )
int ED_Read_Line ( char *  buf)
Get a copy of the next codeline.
- normal: get codeline ED_lnr_act from memory
- if(APT_mac_fil==1): get next line from file
The size of buf must be mem_cbuf1_SIZ !
0-n LineNr; first Line=0, second line=1 ....
-1 EOF
-2 ?? irgendwas mit MODEL ???
get mepos with ED_Read_cPos
int ED_lnr_mac ( int  mode)

0 = save ED_lnr_bis (beim CALL) und set to 999999 1 = restor ED_lnr_bis (nach dem END MAC)

int ED_lnr_reset ( )
int ED_work_dyn ( )
int ED_work_exit ( )
int ED_work_END ( int  mode)

das "RUN" mode unused !

void ED_work_ENTER ( )

es wurde CR am Keyb eingegeben

int ED_work_STEP ( )
int ED_work_CAD ( int  lNr,
char *  cbuf 

1) bei jedem Tab wenn alle Inputs fertig 2) mit OK (CR) wenn alle Inputs fertig RetCod: -3 obj not yet complete

int ED_work_CurSet ( int  new_lnr_act)
Cursor wurde in Editor-Line new_lnr_act gesetzt.
Alle Zeilen bis einschliesslich Zeile new_lnr_act anzeigen (ausfuehren).
Obj der Zeile new_lnr_act hiliten
von der zuletzt bearbeiteten Zeile bis zu lNr new_lnr_act abarbeiten
new_lnr_act -1 query active lineNr (ED_lnr_act)
UT_INT_MAX work from ED_lnr_act to end
int ED_work_GO ( )
int ED_cont_file ( )
int ED_file__ ( int  mode,
char *  fNam 

0 = clear/init; 1 = openNext 2 = closeActive 3 = rewindActive (zB fuer JUMP)

int ED_work_file ( char *  filnam)

nächster call an ED_Read_Line soll nicht die nächste aktuelle Zeile liefern sondern zuerst das File filnam abarbeiten CloseFile macht auch ED_Read_Line.

Bei subModel UP_level=-1

int ED_set_lnr_von ( int  lNr)

see also ED_set_lnr_act

int ED_set_lnr_act ( long  lNr)

see also ED_set_lnr_act EDI_goto_lnr

int ED_set_cpos_lnr_act ( )

ED_set_cpos_lnr_act set ED_cpos to start of line ED_lnr_act

int ED_get_lnr_act ( )

see also AP_lNr_get APT_line_act

int ED_inc_lnr ( )

was AP_lNr_inc

int ED_ck_lnEnd ( )
int ED_ck_lnStart ( )
int ED_get_mac_fil ( )
int ED_Run ( )
void ED_set_delay ( int  delaytime)

An den Beginn der Datei rücksetzen; aber kein WC_Init (für JUMP's usw)

int ED_addRange ( MemTab(ObjRange)*  rTab,
char *  lBuf 
int ED_test__ ( )

Variable Documentation

int WC_stat_bound

ON OFF; Draw boundary of Flächen J/N.

int AP_src


int WC_modact_ind
ColRGB AP_defcol

die DefaultColor des aktiven (sub)Model

int WC_sur_ind

Der Index auf die ActiveConstrPlane.

MemObj winED
int UI_InpMode
int UI_EditMode
int xa_fl_TxMem
char* UTF_FilBuf0
long UTF_FilBuf0Siz
long UTF_FilBuf0Len
int APT_stat_act
int APT_line_act
int UP_level
int APT_dispPL
char AP_filnam[256]
int ED_mode
int ED_mode_old
int ED_delay = 0
FILE* maclun = NULL
int APT_mac_fil = OFF
int ED_lnr_act
int ED_lnr_von
int ED_lnr_bis
int ED_lnr_max
char* ED_cpos
long UI_Ed_fsiz