ivtools-patch Mailing List for ivtools (Page 9)
Brought to you by:
johnston
You can subscribe to this list here.
1999 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2000 |
Jan
(17) |
Feb
(14) |
Mar
(7) |
Apr
(7) |
May
(20) |
Jun
(18) |
Jul
(5) |
Aug
(9) |
Sep
(4) |
Oct
(2) |
Nov
(2) |
Dec
(1) |
2001 |
Jan
(3) |
Feb
(2) |
Mar
(5) |
Apr
(7) |
May
(9) |
Jun
(15) |
Jul
(10) |
Aug
(2) |
Sep
(10) |
Oct
(15) |
Nov
(14) |
Dec
(2) |
2002 |
Jan
(8) |
Feb
(13) |
Mar
(10) |
Apr
(3) |
May
(2) |
Jun
(7) |
Jul
(5) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(10) |
Dec
|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(3) |
2004 |
Jan
(2) |
Feb
(6) |
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(4) |
Nov
(1) |
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2010 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ivt...@li...> - 2000-06-21 05:32:47
|
Patch: ivtools-000621-johnston-078 For: ivtools-0.8.3 Author: joh...@us... Subject: expand on the trace of non-post-evaluated commands Requires: This is an intermediate patch to ivtools-0.8.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - expand on the trace output for non-post-evaluated commands (ComFunc's). Since each of them has all its arguments (and keywords) ready to go on the stack, it is a simple matter to loop through and print these. It gives an interesting visualization of the innards of any complex comterp expression with control constructs, because you get to see what the arguments of each command (or operator) evaluated to before the command itself was executed. The next step would be print the unevaluated expressions for a post-evaluated command before they are executed. It might also be possible to trace there value after they are determined at run-time, to see what the "cond" or "if" conditional evaluated too. Index: ComTerp/comterp.c diff -c ComTerp/comterp.c:1.19 ComTerp/comterp.c:1.20 *** ComTerp/comterp.c:1.19 Tue Jun 20 06:20:22 2000 --- src/ComTerp/comterp.c Wed Jun 21 11:38:50 2000 *************** *** 222,233 **** func->push_funcstate(sv.narg(), sv.nkey(), pedepth, sv.command_symid()); } if (this->trace_mode()) { for(int i=0; i<pedepth; i++) cerr << " "; ! cerr << symbol_pntr(sv.command_symid()) << ": nargs=" << sv.narg() << ! " nkeys=" << sv.nkey() << "\n"; } func->execute(); func->pop_funcstate(); if (_just_reset && !_func_for_next_expr) { push_stack(ComValue::blankval()); --- 222,249 ---- func->push_funcstate(sv.narg(), sv.nkey(), pedepth, sv.command_symid()); } + + /* output execution trace */ if (this->trace_mode()) { for(int i=0; i<pedepth; i++) cerr << " "; ! cerr << symbol_pntr(sv.command_symid()); ! if (func->post_eval()) ! cerr << ": nargs=" << sv.narg() << " nkeys=" << sv.nkey() << "\n"; ! else { ! int ntotal = func->nargs() + func->nkeys(); ! for(int i=0; i<ntotal; i++) { ! if (i) ! cerr << " "; ! else ! cerr << "("; ! cerr << stack_top(i-ntotal+1); ! } ! cerr << ")\n"; ! } } + func->execute(); + func->pop_funcstate(); if (_just_reset && !_func_for_next_expr) { push_stack(ComValue::blankval()); *** /dev/null Wed Jun 21 11:39:37 PDT 2000 --- patches/ivtools-000621-johnston-078 *************** patches/ivtools-000621-johnston-078 *** 0 **** --- 1 ---- + ivtools-000621-johnston-078 |
From: <ivt...@li...> - 2000-06-20 00:26:55
|
Patch: ivtools-000620-johnston-077 For: ivtools-0.8.3 Author: joh...@us... Subject: first draft of trace command. Requires: This is an intermediate patch to ivtools-0.8.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - first version of comterp trace command: trace([flag] :get) -- toggle or set trace mode When true, the trace mode causes the interpreter to print out the name of the command (ComFunc) ready to be executed, and the number of arguments and number of keywords supplied to it. Indentation is 4 spaces time the depth of post-evaluate expression, i.e. a doubly nested for-loop has 8 spaces of indentation on the inner loop, four for the outer loop. Index: top_ivtools/MANIFEST diff -c top_ivtools/MANIFEST:1.11 top_ivtools/MANIFEST:1.12 *** top_ivtools/MANIFEST:1.11 Tue Jun 13 02:27:04 2000 --- ./MANIFEST Tue Jun 20 06:20:18 2000 *************** *** 155,160 **** --- 155,162 ---- ivtools-0.8/src/ComTerp/condfunc.h ivtools-0.8/src/ComTerp/ctrlfunc.c ivtools-0.8/src/ComTerp/ctrlfunc.h + ivtools-0.8/src/ComTerp/debugfunc.c + ivtools-0.8/src/ComTerp/debugfunc.h ivtools-0.8/src/ComTerp/dotfunc.c ivtools-0.8/src/ComTerp/dotfunc.h ivtools-0.8/src/ComTerp/helpfunc.c Index: top_ivtools/MANIFEST.perceps diff -c top_ivtools/MANIFEST.perceps:1.7 top_ivtools/MANIFEST.perceps:1.8 *** top_ivtools/MANIFEST.perceps:1.7 Wed May 31 06:28:47 2000 --- ./MANIFEST.perceps Tue Jun 20 06:20:18 2000 *************** *** 28,33 **** --- 28,34 ---- ComTerp/comvalue.h ComTerp/condfunc.h ComTerp/ctrlfunc.h + ComTerp/debugfunc.h ComTerp/dotfunc.h ComTerp/helpfunc.h ComTerp/iofunc.h Index: ComTerp/Imakefile diff -c ComTerp/Imakefile:1.2 ComTerp/Imakefile:1.3 *** ComTerp/Imakefile:1.2 Sun Feb 13 21:43:36 2000 --- src/ComTerp/Imakefile Tue Jun 20 06:20:22 2000 *************** *** 24,29 **** --- 24,30 ---- Obj(comvalue) Obj(condfunc) ObjA(ctrlfunc) + Obj(debugfunc) Obj(dotfunc) Obj(helpfunc) Obj(iofunc) Index: ComTerp/comterp.c diff -c ComTerp/comterp.c:1.18 ComTerp/comterp.c:1.19 *** ComTerp/comterp.c:1.18 Tue Jun 20 04:31:39 2000 --- src/ComTerp/comterp.c Tue Jun 20 06:20:22 2000 *************** *** 32,37 **** --- 32,38 ---- #include <ComTerp/comvalue.h> #include <ComTerp/condfunc.h> #include <ComTerp/ctrlfunc.h> + #include <ComTerp/debugfunc.h> #include <ComTerp/dotfunc.h> #include <ComTerp/helpfunc.h> #include <ComTerp/iofunc.h> *************** *** 124,129 **** --- 125,131 ---- _handler = nil; _val_for_next_func = nil; _func_for_next_expr = nil; + _trace_mode = 0; } *************** *** 220,225 **** --- 222,232 ---- func->push_funcstate(sv.narg(), sv.nkey(), pedepth, sv.command_symid()); } + if (this->trace_mode()) { + for(int i=0; i<pedepth; i++) cerr << " "; + cerr << symbol_pntr(sv.command_symid()) << ": nargs=" << sv.narg() << + " nkeys=" << sv.nkey() << "\n"; + } func->execute(); func->pop_funcstate(); if (_just_reset && !_func_for_next_expr) { *************** *** 848,853 **** --- 855,861 ---- add_command("run", new RunFunc(this)); add_command("help", new HelpFunc(this)); + add_command("trace", new TraceFunc(this)); add_command("symid", new SymIdFunc(this)); add_command("symval", new SymValFunc(this)); add_command("symbol", new SymbolFunc(this)); Index: ComTerp/comterp.h diff -c ComTerp/comterp.h:1.9 ComTerp/comterp.h:1.10 *** ComTerp/comterp.h:1.9 Tue Jun 20 04:31:39 2000 --- src/ComTerp/comterp.h Tue Jun 20 06:20:22 2000 *************** *** 226,231 **** --- 226,237 ---- void pop_servstate(); // pop ComTerpServ state that was saved earlier + void trace_mode(int mode) { _trace_mode = mode; } + // set trace mode + + int trace_mode() { return _trace_mode; } + // return trace mode + protected: void incr_stack(); void incr_stack(int n); *************** *** 249,255 **** virtual void pop_funcstate(); // pop ComFuncState off stack - protected: ComValue* _stack; int _stack_top; unsigned int _stack_siz; --- 255,260 ---- *************** *** 288,293 **** --- 293,300 ---- ComValue* _val_for_next_func; // ComValue to pass to next command + int _trace_mode; + // trace mode friend class ComFunc; friend class ComterpHandler; Index: ComTerp/debugfunc.c diff -c /dev/null ComTerp/debugfunc.c:1.1 *** /dev/null Tue Jun 20 06:20:24 2000 --- src/ComTerp/debugfunc.c Tue Jun 20 06:20:22 2000 *************** *** 0 **** --- 1,57 ---- + /* + * Copyright (c) 2000 IET Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + #include <ComTerp/debugfunc.h> + #include <ComTerp/comterp.h> + + #define TITLE "DebugFunc" + + /*****************************************************************************/ + + TraceFunc::TraceFunc(ComTerp* comterp) : ComFunc(comterp) { + } + + void TraceFunc::execute() { + static int get_symid = symbol_add("get"); + boolean get_flag = stack_key(get_symid).is_true(); + if (get_flag) { + reset_stack(); + int mode = comterp()->trace_mode(); + ComValue retval(mode, ComValue::IntType); + push_stack(retval); + } else { + if (nargs()==0) { + reset_stack(); + int mode = !comterp()->trace_mode(); + comterp()->trace_mode(mode); + ComValue retval(mode, ComValue::IntType); + push_stack(retval); + } else { + ComValue retval(stack_arg(0)); + reset_stack(); + comterp()->trace_mode(retval.int_val()); + push_stack(retval); + } + } + } + Index: ComTerp/debugfunc.h diff -c /dev/null ComTerp/debugfunc.h:1.1 *** /dev/null Tue Jun 20 06:20:24 2000 --- src/ComTerp/debugfunc.h Tue Jun 20 06:20:22 2000 *************** *** 0 **** --- 1,47 ---- + /* + * Copyright (c) 2000 IET Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + /* + * collection of debug functions + */ + + #if !defined(_debugfunc_h) + #define _debugfunc_h + + #include <ComTerp/comfunc.h> + + class ComTerp; + class ComValue; + + //: command for toggling or setting trace mode + // trace([flag] :val) -- toggle or set trace mode + class TraceFunc : public ComFunc { + public: + TraceFunc(ComTerp*); + + virtual void execute(); + virtual const char* docstring() { + return "%s([flag] :val) -- toggle or set trace mode"; } + }; + + #endif /* !defined(_debugfunc_h) */ Index: comterp/README diff -c comterp/README:1.11 comterp/README:1.12 *** comterp/README:1.11 Tue Jun 20 04:31:41 2000 --- src/comterp_/README Tue Jun 20 06:20:25 2000 *************** *** 182,188 **** help(cmdname [cmdname ...]) -- help for commands ! trace([flag]) -- toggle or set trace mode [str]=print(fmtstr val :string|:str :err) -- print value with format string [str]=print(val :string|:str :err) -- print value with format string --- 182,188 ---- help(cmdname [cmdname ...]) -- help for commands ! trace([flag] :get) -- toggle or set trace mode [str]=print(fmtstr val :string|:str :err) -- print value with format string [str]=print(val :string|:str :err) -- print value with format string Index: man1_ivtools/comterp.1 diff -c man1_ivtools/comterp.1:1.11 man1_ivtools/comterp.1:1.12 *** man1_ivtools/comterp.1:1.11 Tue Jun 20 04:33:15 2000 --- src/man/man1/comterp.1 Tue Jun 20 06:21:08 2000 *************** *** 191,197 **** help(cmdname [cmdname ...]) -- help for commands ! trace([flag]) -- toggle or set trace mode [str]=print(fmtstr val :string|:str :err) -- print value with format string [str]=print(val :string|:str :err) -- print value --- 191,197 ---- help(cmdname [cmdname ...]) -- help for commands ! trace([flag] :get) -- toggle or set trace mode [str]=print(fmtstr val :string|:str :err) -- print value with format string [str]=print(val :string|:str :err) -- print value *** /dev/null Tue Jun 20 06:21:12 PDT 2000 --- patches/ivtools-000620-johnston-077 *************** patches/ivtools-000620-johnston-077 *** 0 **** --- 1 ---- + ivtools-000620-johnston-077 |
From: <ivt...@li...> - 2000-06-19 22:37:11
|
Patch: ivtools-000620-johnston-076 For: ivtools-0.8.3 Author: joh...@us... Subject: make wider use of ComTerpState stack Requires: This is an intermediate patch to ivtools-0.8.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - rename ComTerpServState to ComTerpState (because that is what it was), and make more widespread use of it in all the ::run* methods. This makes multiple run commands on the same line work for the first time. Index: ComTerp/comterp.c diff -c ComTerp/comterp.c:1.17 ComTerp/comterp.c:1.18 *** ComTerp/comterp.c:1.17 Tue Jun 6 11:50:19 2000 --- src/ComTerp/comterp.c Tue Jun 20 04:31:39 2000 *************** *** 95,100 **** --- 95,106 ---- if(dmm_calloc((void**)&_fsstack, _fsstack_siz, sizeof(ComFuncState)) != 0) KANRET("error in call to dmm_calloc"); + /* Allocate servstate stack to initial size */ + _ctsstack_top = -1; + _ctsstack_siz = 256; + if(dmm_calloc((void**)&_ctsstack, _ctsstack_siz, sizeof(ComFuncState)) != 0) + KANRET("error in call to dmm_calloc"); + _pfoff = 0; _pfnum = 0; _quitflag = false; *************** *** 170,178 **** --- 176,188 ---- } int ComTerp::eval_expr(ComValue* pfvals, int npfvals) { + #if 0 int save_pfoff = _pfoff; int save_pfnum = _pfnum; ComValue* save_pfcomvals = _pfcomvals; + #else + push_servstate(); + #endif _pfoff = 0; _pfnum = npfvals; *************** *** 183,191 **** --- 193,205 ---- eval_expr_internals(); } + #if 0 _pfoff = save_pfoff; _pfnum = save_pfnum; _pfcomvals = save_pfcomvals; + #else + pop_servstate(); + #endif return FUNCOK; } *************** *** 878,886 **** --- 892,904 ---- int tokoff = _pfoff; /* swap in input pointer and function */ + #if 0 void* save_inptr = _inptr; infuncptr save_infunc = _infunc; outfuncptr save_outfunc = _outfunc; + #else + push_servstate(); + #endif FILE* fptr = fopen(filename, "r"); _inptr = fptr; _outfunc = nil; *************** *** 908,916 **** --- 926,938 ---- } } + #if 0 _inptr = save_inptr; _infunc = save_infunc; _outfunc = save_outfunc; + #else + pop_servstate(); + #endif load_postfix(tokbuf, toklen, tokoff); delete tokbuf; *************** *** 1105,1110 **** --- 1127,1204 ---- void ComTerp::clr_val_for_next_func() { delete _val_for_next_func; _val_for_next_func = nil; + } + + ComTerpState* ComTerp::top_servstate() { + return _ctsstack_top < 0 ? nil : _ctsstack+_ctsstack_top; + } + + void ComTerp::pop_servstate() { + if (_ctsstack_top >=0) { + + ComTerpState* cts_state = top_servstate(); + + /* clean up */ + delete _buffer; + delete _pfbuf; + delete [] _pfcomvals; + + /* restore copies of everything */ + _pfbuf = cts_state->pfbuf(); + _pfnum = cts_state->pfnum(); + _pfoff = cts_state->pfoff(); + _bufptr = cts_state->bufptr(); + _linenum = cts_state->linenum(); + // _just_reset = cts_state->just_reset(); + _buffer = cts_state->buffer(); + _pfcomvals = cts_state->pfcomvals(); + _infunc = cts_state->infunc(); + _eoffunc = cts_state->eoffunc(); + _errfunc = cts_state->errfunc(); + _inptr = cts_state->inptr(); + + _ctsstack_top--; + } + } + + void ComTerp::push_servstate() { + ComTerpState cts_state; + + /* save copies of everything */ + cts_state.pfbuf() = _pfbuf; + cts_state.pfnum() = _pfnum; + cts_state.pfoff() = _pfoff; + cts_state.bufptr() = _bufptr; + cts_state.linenum() = _linenum; + // cts_state.just_reset() = _just_reset; + cts_state.buffer() = _buffer; + cts_state.pfcomvals() = _pfcomvals; + cts_state.infunc() = _infunc; + cts_state.eoffunc() = _eoffunc; + cts_state.errfunc() = _errfunc; + cts_state.inptr() = _inptr; + + /* re-initialize */ + if(dmm_calloc((void**)&_pfbuf, _pfsiz, sizeof(postfix_token)) != 0) + KANRET("error in call to dmm_calloc"); + _pfnum = _pfoff = 0; + _buffer = new char[_bufsiz]; + _bufptr = 0; + _linenum = 0; + _just_reset = false; + _pfcomvals = nil; + + if (_ctsstack_top+1 == _ctsstack_siz) { + _ctsstack_siz *= 2; + dmm_realloc_size(sizeof(ComTerpState)); + if(dmm_realloc((void**)&_ctsstack, (unsigned long)_ctsstack_siz) != 0) { + KANRET("error in call to dmm_realloc"); + return; + } + } + _ctsstack_top++; + ComTerpState* ctss = _ctsstack + _ctsstack_top; + *ctss = cts_state; } Index: ComTerp/comterp.h diff -c ComTerp/comterp.h:1.8 ComTerp/comterp.h:1.9 *** ComTerp/comterp.h:1.8 Tue Jun 6 11:50:19 2000 --- src/ComTerp/comterp.h Tue Jun 20 04:31:39 2000 *************** *** 39,44 **** --- 39,45 ---- class AttributeValue; class ComFunc; class ComFuncState; + class ComTerpState; class ComValue; class ostream; *************** *** 216,221 **** --- 217,231 ---- unsigned int& linenum() { return _linenum; } // count of lines processed + ComTerpState* top_servstate(); + // return pointer to top state on ComTerpServ state stack + + void push_servstate(); + // push ComTerpServ state for later retrieval + + void pop_servstate(); + // pop ComTerpServ state that was saved earlier + protected: void incr_stack(); void incr_stack(int n); *************** *** 233,240 **** void eval_expr_internals(int pedepth=0); ComFuncState* top_funcstate(); ! void push_funcstate(ComFuncState& funcstate); ! void pop_funcstate(); protected: ComValue* _stack; --- 243,253 ---- void eval_expr_internals(int pedepth=0); ComFuncState* top_funcstate(); ! // return top ComFuncState on stack ! virtual void push_funcstate(ComFuncState& funcstate); ! // push ComFuncState onto stack ! virtual void pop_funcstate(); ! // pop ComFuncState off stack protected: ComValue* _stack; *************** *** 256,261 **** --- 269,278 ---- int _fsstack_top; unsigned int _fsstack_siz; + ComTerpState* _ctsstack; // stack of ComTerpServ state + int _ctsstack_top; + unsigned int _ctsstack_siz; + ComValue* _pfcomvals; // postfix buffer of ComValue's converted from postfix_token *************** *** 277,280 **** --- 294,336 ---- friend class ComTerpIOHandler; }; + //: object for holding ComTerp state + // object that holds the state of a ComTerp + // which allows for nested and recursive use of a singular ComTerp + class ComTerpState { + public: + ComTerpState() {} + ComTerpState(ComTerpState& ctss) { *this = ctss; } + // copy constructor. + + postfix_token*& pfbuf() { return _pfbuf; } + int& pfnum() { return _pfnum; } + int& pfoff() { return _pfoff; } + int& bufptr() { return _bufptr; } + int& bufsiz() { return _bufsiz; } + int& linenum() { return _linenum; } + // int& just_reset() { return _just_reset; } + char*& buffer() { return _buffer; } + ComValue*& pfcomvals() { return _pfcomvals; } + infuncptr& infunc() { return _infunc; } + eoffuncptr& eoffunc() { return _eoffunc; } + errfuncptr& errfunc() { return _errfunc; } + void*& inptr() { return _inptr; } + + protected: + + postfix_token* _pfbuf; + int _pfnum; + int _pfoff; + int _bufptr; + int _linenum; + // int _just_reset; + char* _buffer; + int _bufsiz; + ComValue* _pfcomvals; + infuncptr _infunc; + eoffuncptr _eoffunc; + errfuncptr _errfunc; + void* _inptr; + }; #endif /* !defined(_comterp_h) */ Index: ComTerp/comterpserv.c diff -c ComTerp/comterpserv.c:1.4 ComTerp/comterpserv.c:1.5 *** ComTerp/comterpserv.c:1.4 Thu Jun 8 03:56:57 2000 --- src/ComTerp/comterpserv.c Tue Jun 20 04:31:39 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994-1997 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 61,72 **** _npause = 0; - /* Allocate servstate stack to initial size */ - _ctsstack_top = -1; - _ctsstack_siz = 256; - if(dmm_calloc((void**)&_ctsstack, _ctsstack_siz, sizeof(ComFuncState)) != 0) - KANRET("error in call to dmm_calloc"); - _logger_mode = 0; } --- 62,67 ---- *************** *** 248,259 **** --- 243,258 ---- int ComTerpServ::runfile(const char* filename) { /* save enough state as needed by this interpreter */ + #if 0 void* save_inptr = _inptr; infuncptr save_infunc = _infunc; outfuncptr save_outfunc = _outfunc; eoffuncptr save_eoffunc = _eoffunc; errfuncptr save_errfunc = _errfunc; int save_linenum = _linenum; + #else + push_servstate(); + #endif _inptr = this; _infunc = (infuncptr)&ComTerpServ::s_fgets; _eoffunc = (eoffuncptr)&ComTerpServ::s_feof; *************** *** 314,325 **** --- 313,328 ---- } else push_stack(ComValue::nullval()); + #if 0 _inptr = save_inptr; _infunc = save_infunc; _outfunc = save_outfunc; _eoffunc = save_eoffunc; _errfunc = save_errfunc; _linenum = save_linenum; + #else + pop_servstate(); + #endif return status; } *************** *** 327,332 **** --- 330,336 ---- ComValue& ComTerpServ::run(const char* expression, boolean nested) { _errbuf[0] = '\0'; + #if 0 postfix_token* save_pfbuf = _pfbuf; int save_pfoff = _pfoff; int save_pfnum = _pfnum; *************** *** 334,364 **** --- 338,379 ---- int save_linenum = _linenum; int save_just_reset = _just_reset; char* save_buffer = _buffer; + #else + push_servstate(); + #endif _buffer = new char[_bufsiz]; _bufptr = 0; _buffer[_bufptr] = '\0'; + #if 0 if (save_pfoff) { + #endif _pfbuf = new postfix_token[_pfsiz]; _pfoff = 0; + #if 0 } ComValue* save_pfcomvals = _pfcomvals; + #endif _pfcomvals = nil; if (expression) { load_string(expression); + #if 0 infuncptr save_infunc = _infunc; eoffuncptr save_eoffunc = _eoffunc; errfuncptr save_errfunc = _errfunc; void* save_inptr = _inptr; + #endif _infunc = (infuncptr)&ComTerpServ::s_fgets; _eoffunc = (eoffuncptr)&ComTerpServ::s_feof; _errfunc = (errfuncptr)&ComTerpServ::s_ferror; _inptr = this; read_expr(); + #if 0 _infunc = save_infunc; _eoffunc = save_eoffunc; _errfunc = save_errfunc; _inptr = save_inptr; + #endif err_str(_errbuf, BUFSIZ, "comterp"); } if (!*_errbuf) { *************** *** 366,371 **** --- 381,387 ---- err_str(_errbuf, BUFSIZ, "comterp"); } + #if 0 _pfnum = save_pfnum; _bufptr = save_bufptr; delete _buffer; *************** *** 379,384 **** --- 395,403 ---- } delete [] _pfcomvals; _pfcomvals = save_pfcomvals; + #else + pop_servstate(); + #endif return *_errbuf ? ComValue::nullval() : pop_stack(); } *************** *** 386,397 **** --- 405,420 ---- ComValue& ComTerpServ::run(postfix_token* tokens, int ntokens) { _errbuf[0] = '\0'; + #if 0 postfix_token* save_pfbuf = _pfbuf; int save_pfnum = _pfnum; int save_pfoff = _pfoff; int save_bufptr = _bufptr; int save_linenum = _linenum; int save_just_reset = _just_reset; + #else + push_servstate(); + #endif _pfbuf = tokens; _pfnum = ntokens; _pfoff = 0; *************** *** 400,411 **** --- 423,438 ---- err_str(_errbuf, BUFSIZ, "comterp"); ComValue& retval = *_errbuf ? ComValue::nullval() : pop_stack(); + #if 0 _pfbuf = save_pfbuf; _pfnum = save_pfnum; _pfoff = save_pfoff; _bufptr = save_bufptr; _linenum = save_linenum; _just_reset = save_just_reset; + #else + pop_servstate(); + #endif return retval; } *************** *** 427,503 **** add_command("eval", new EvalFunc(this)); } } - - ComTerpServState* ComTerpServ::top_servstate() { - return _ctsstack_top < 0 ? nil : _ctsstack+_ctsstack_top; - } - - void ComTerpServ::pop_servstate() { - if (_ctsstack_top >=0) { - - ComTerpServState* cts_state = top_servstate(); - - /* clean up */ - delete _buffer; - delete _pfbuf; - delete [] _pfcomvals; - - /* restore copies of everything */ - _pfbuf = cts_state->pfbuf(); - _pfnum = cts_state->pfnum(); - _pfoff = cts_state->pfoff(); - _bufptr = cts_state->bufptr(); - _linenum = cts_state->linenum(); - _just_reset = cts_state->just_reset(); - _buffer = cts_state->buffer(); - _pfcomvals = cts_state->pfcomvals(); - _infunc = cts_state->infunc(); - _eoffunc = cts_state->eoffunc(); - _errfunc = cts_state->errfunc(); - _inptr = cts_state->inptr(); - - _ctsstack_top--; - } - } - - void ComTerpServ::push_servstate() { - ComTerpServState cts_state; - - /* save copies of everything */ - cts_state.pfbuf() = _pfbuf; - cts_state.pfnum() = _pfnum; - cts_state.pfoff() = _pfoff; - cts_state.bufptr() = _bufptr; - cts_state.linenum() = _linenum; - cts_state.just_reset() = _just_reset; - cts_state.buffer() = _buffer; - cts_state.pfcomvals() = _pfcomvals; - cts_state.infunc() = _infunc; - cts_state.eoffunc() = _eoffunc; - cts_state.errfunc() = _errfunc; - cts_state.inptr() = _inptr; - - /* re-initialize */ - if(dmm_calloc((void**)&_pfbuf, _pfsiz, sizeof(postfix_token)) != 0) - KANRET("error in call to dmm_calloc"); - _pfnum = _pfoff = 0; - _buffer = new char[_bufsiz]; - _bufptr = 0; - _linenum = 0; - _just_reset = false; - _pfcomvals = nil; - - if (_ctsstack_top+1 == _ctsstack_siz) { - _ctsstack_siz *= 2; - dmm_realloc_size(sizeof(ComTerpServState)); - if(dmm_realloc((void**)&_ctsstack, (unsigned long)_ctsstack_siz) != 0) { - KANRET("error in call to dmm_realloc"); - return; - } - } - _ctsstack_top++; - ComTerpServState* ctss = _ctsstack + _ctsstack_top; - *ctss = cts_state; - } - - --- 454,456 ---- Index: ComTerp/comterpserv.h diff -c ComTerp/comterpserv.h:1.4 ComTerp/comterpserv.h:1.5 *** ComTerp/comterpserv.h:1.4 Thu Jun 8 03:56:57 2000 --- src/ComTerp/comterpserv.h Tue Jun 20 04:31:39 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994-1999 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 34,41 **** #include <ComTerp/comterp.h> - class ComTerpServState; - //: extended ComTerp that works with buffered IO. class ComTerpServ : public ComTerp { public: --- 35,40 ---- *************** *** 73,87 **** int& npause() { return _npause; } // return (reference to) number of pauses - ComTerpServState* top_servstate(); - // return pointer to top state on ComTerpServ state stack - - void push_servstate(); - // push ComTerpServ state for later retrieval - - void pop_servstate(); - // pop ComTerpServ state that was saved earlier - protected: static char* s_fgets(char* s, int n, void* serv); --- 72,77 ---- *************** *** 108,158 **** int _npause; int _logger_mode; - ComTerpServState* _ctsstack; // stack of ComTerpServ state - int _ctsstack_top; - unsigned int _ctsstack_siz; - friend class ComterpHandler; friend class ComTerpIOHandler; }; - //: object for holding ComTerpServ state - // object that holds the state of a ComTerpServ - // which allows for nested and recursive use of a singular ComTerpServ - class ComTerpServState { - public: - ComTerpServState() {} - ComTerpServState(ComTerpServState& ctss) { *this = ctss; } - // copy constructor. - - postfix_token*& pfbuf() { return _pfbuf; } - int& pfnum() { return _pfnum; } - int& pfoff() { return _pfoff; } - int& bufptr() { return _bufptr; } - int& bufsiz() { return _bufsiz; } - int& linenum() { return _linenum; } - int& just_reset() { return _just_reset; } - char*& buffer() { return _buffer; } - ComValue*& pfcomvals() { return _pfcomvals; } - infuncptr& infunc() { return _infunc; } - eoffuncptr& eoffunc() { return _eoffunc; } - errfuncptr& errfunc() { return _errfunc; } - void*& inptr() { return _inptr; } - - protected: - - postfix_token* _pfbuf; - int _pfnum; - int _pfoff; - int _bufptr; - int _linenum; - int _just_reset; - char* _buffer; - int _bufsiz; - ComValue* _pfcomvals; - infuncptr _infunc; - eoffuncptr _eoffunc; - errfuncptr _errfunc; - void* _inptr; - }; #endif --- 98,105 ---- Index: comterp/README diff -c comterp/README:1.10 comterp/README:1.11 *** comterp/README:1.10 Sun Jun 11 00:18:59 2000 --- src/comterp_/README Tue Jun 20 04:31:41 2000 *************** *** 182,187 **** --- 182,189 ---- help(cmdname [cmdname ...]) -- help for commands + trace([flag]) -- toggle or set trace mode + [str]=print(fmtstr val :string|:str :err) -- print value with format string [str]=print(val :string|:str :err) -- print value with format string Index: man1_ivtools/comterp.1 diff -c man1_ivtools/comterp.1:1.10 man1_ivtools/comterp.1:1.11 *** man1_ivtools/comterp.1:1.10 Sun Jun 11 00:19:31 2000 --- src/man/man1/comterp.1 Tue Jun 20 04:33:15 2000 *************** *** 191,196 **** --- 191,198 ---- help(cmdname [cmdname ...]) -- help for commands + trace([flag]) -- toggle or set trace mode + [str]=print(fmtstr val :string|:str :err) -- print value with format string [str]=print(val :string|:str :err) -- print value *** /dev/null Tue Jun 20 04:33:31 PDT 2000 --- patches/ivtools-000620-johnston-076 *************** patches/ivtools-000620-johnston-076 *** 0 **** --- 1 ---- + ivtools-000620-johnston-076 |
From: <ivt...@li...> - 2000-06-15 23:50:11
|
Patch: ivtools-000616-johnston-075 For: ivtools-0.8.3 Author: joh...@us... Subject: disable brush dashing when drawing arrowheads Requires: This is an intermediate patch to ivtools-0.8.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - make a brush undashed when drawing any arrowhead. It just didn't look good to see three quarters of an arrowhead at the end of a dashed line. There are still discrepancies between the how an arrowhead looks in the ArrowVarView and how it looks in a drawing. This math could be reviewed and improved. Index: src_x11/xbrush.c diff -c src_x11/xbrush.c:1.1 src_x11/xbrush.c:1.2 *** src_x11/xbrush.c:1.1 Tue Jan 18 03:07:42 2000 --- src/IV-X11/xbrush.c Fri Jun 16 05:56:12 2000 *************** *** 160,165 **** --- 160,167 ---- int Brush::dash_list(int i) const { return int(impl_->dash_list[i]); } + boolean Brush::dashed() { return impl_ && impl_->dash_list; } + /* anachronism */ unsigned int Brush::Width() const { return rep(Session::instance()->default_display())->width_; Index: UniIdraw/idarrowhead.c diff -c UniIdraw/idarrowhead.c:1.1 UniIdraw/idarrowhead.c:1.2 *** UniIdraw/idarrowhead.c:1.1 Tue Jan 18 03:10:11 2000 --- src/UniIdraw/idarrowhead.c Fri Jun 16 05:56:40 2000 *************** *** 108,113 **** --- 108,120 ---- SF_Polygon::draw(c, gs); } else { + /* if brush is dashed, disable it for the arrowhead */ + if (br->dashed()) { + Ref(br); + PSBrush* newbr = new PSBrush(0, br->Width()); + gs->SetBrush(newbr); + } + Coord ytip = Vertices::y()[TIP]; float thk = UnscaledLength(br->Width(), gs->GetTransformer()); Coord hcorrect = CorrectedHeight(thk); *************** *** 123,128 **** --- 130,141 ---- SF_Polygon::draw(c, gs); Vertices::y()[TIP] = ytip; } + + /* if brush was dashed, restore it */ + if (br->dashed()) { + gs->SetBrush(br); + Unref(br); + } } } Index: UniIdraw/idvars.c diff -c UniIdraw/idvars.c:1.1 UniIdraw/idvars.c:1.2 *** UniIdraw/idvars.c:1.1 Tue Jan 18 03:10:13 2000 --- src/UniIdraw/idvars.c Fri Jun 16 05:56:40 2000 *************** *** 211,216 **** --- 211,221 ---- output->Line(canvas, HPAD, ymax/2, xmax-HPAD, ymax/2); #endif /* Line */ + /* remove the dashing for the arrowheads */ + if (_head || _tail) + if (_brush->dashed()) + output->SetBrush(new PSBrush(0, _brush->Width())); + if (_head) { x[2] = x[0] = xmax-ARROWX; y[0] = ymax/2 - ARROWY; Index: include_interviews/brush.h diff -c include_interviews/brush.h:1.1 include_interviews/brush.h:1.2 *** include_interviews/brush.h:1.1 Tue Jan 18 03:12:24 2000 --- src/include/InterViews/brush.h Fri Jun 16 05:56:55 2000 *************** *** 51,56 **** --- 51,57 ---- virtual Coord width() const; virtual int dash_count() const; virtual int dash_list(int index) const; + boolean dashed(); BrushRep* rep(Display*) const; protected: *** /dev/null Fri Jun 16 05:57:16 PDT 2000 --- patches/ivtools-000616-johnston-075 *************** patches/ivtools-000616-johnston-075 *** 0 **** --- 1 ---- + ivtools-000616-johnston-075 |
From: <ivt...@li...> - 2000-06-15 22:42:51
|
Patch: ivtools-000616-johnston-074 For: ivtools-0.8.3 Author: joh...@us... Subject: part 2 of patch to fix Landscape-mode text editing Requires: This is an intermediate patch to ivtools-0.8.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - part 2 of patch to fix Landscape-mode text editing. This makes all cases works, and propogates the fix to idraw as well. Index: Unidraw/text.c diff -c Unidraw/text.c:1.1 Unidraw/text.c:1.2 *** Unidraw/text.c:1.1 Tue Jan 18 03:10:04 2000 --- src/Unidraw/text.c Fri Jun 16 04:49:04 2000 *************** *** 275,285 **** } if (rel != nil) { ! if (v->GetOrientation()==Rotated ) rel->Rotate(-90); rel->InvTransform(xpos, ypos); } ! if (v->GetOrientation()==Rotated) textgr->Rotate(90.0); textgr->Translate(xpos, ypos); textgr->FillBg(false); --- 275,285 ---- } if (rel != nil) { ! if (v->GetOrientation()==Rotated && !tool->IsA(RESHAPE_TOOL)) rel->Rotate(-90); rel->InvTransform(xpos, ypos); } ! if (v->GetOrientation()==Rotated && !tool->IsA(RESHAPE_TOOL)) textgr->Rotate(90.0); textgr->Translate(xpos, ypos); textgr->FillBg(false); Index: OverlayUnidraw/ovtext.c diff -c OverlayUnidraw/ovtext.c:1.3 OverlayUnidraw/ovtext.c:1.4 *** OverlayUnidraw/ovtext.c:1.3 Thu Jun 15 06:19:43 2000 --- src/OverlayUnidraw/ovtext.c Fri Jun 16 04:49:10 2000 *************** *** 305,311 **** rel->Rotate(-90); rel->InvTransform(xpos, ypos); } ! if (v->GetOrientation()==Rotated) textgr->Rotate(90.0); textgr->Translate(xpos, ypos); textgr->FillBg(false); --- 305,311 ---- rel->Rotate(-90); rel->InvTransform(xpos, ypos); } ! if (v->GetOrientation()==Rotated && !tool->IsA(RESHAPE_TOOL)) textgr->Rotate(90.0); textgr->Translate(xpos, ypos); textgr->FillBg(false); *** /dev/null Fri Jun 16 04:49:39 PDT 2000 --- patches/ivtools-000616-johnston-074 *************** patches/ivtools-000616-johnston-074 *** 0 **** --- 1 ---- + ivtools-000616-johnston-074 |
From: <ivt...@li...> - 2000-06-15 22:42:28
|
Patch: ivtools-000615-johnston-073 For: ivtools-0.8.3 Author: joh...@us... Subject: fix bug in Landscape text editing, extend -stripped behavior Requires: This is an intermediate patch to ivtools-0.8.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - fix bug in editing text graphics in Landscape mode. A while back things were changed so you could enter horizontal text in landscape mode. This changed code that was used both when you typed in new text, and when you edited existing text. But the test for Landscape mode (and the resultant rotation by 90 degrees before pasting) needed only to be done in the case of new text. This is the explanation for the text disappearing after its been edited with the Reshape tool which some have seen, but seemed to be a hard-to-replicate bug. - extend the use of -stripped to ivtools flipbook as well as comdraw. Now you can bring up a flipbook without any toolbar or menubar. - cause the menubar and toolbar (and state variables) to be constructed anyways when -stripped is given. This keeps the keyboard shortcuts working, a necessary feature when there is no GUI for those commands and tools. Index: OverlayUnidraw/ovkit.c diff -c OverlayUnidraw/ovkit.c:1.4 OverlayUnidraw/ovkit.c:1.5 *** OverlayUnidraw/ovkit.c:1.4 Fri May 12 04:19:04 2000 --- src/OverlayUnidraw/ovkit.c Thu Jun 15 06:19:42 2000 *************** *** 284,289 **** --- 284,293 ---- WidgetKit& wk = *WidgetKit::instance(); PolyGlyph* topbox = lk.vbox(); + Glyph* menus = kit->MakeMenus(); + Glyph* states = kit->MakeStates(); + Glyph* toolbar = kit->MakeToolbar(); + if (stripped_flag) { Target* viewer = *************** *** 293,301 **** } else { - Glyph* menus = kit->MakeMenus(); - Glyph* states = kit->MakeStates(); - Glyph* toolbar = kit->MakeToolbar(); if (states) menus->append(states); Target* viewer = --- 297,302 ---- Index: OverlayUnidraw/ovtext.c diff -c OverlayUnidraw/ovtext.c:1.2 OverlayUnidraw/ovtext.c:1.3 *** OverlayUnidraw/ovtext.c:1.2 Fri Mar 24 23:15:48 2000 --- src/OverlayUnidraw/ovtext.c Thu Jun 15 06:19:43 2000 *************** *** 27,32 **** --- 27,33 ---- */ #include <OverlayUnidraw/ovclasses.h> + #include <OverlayUnidraw/ovcmds.h> #include <OverlayUnidraw/ovtext.h> #include <OverlayUnidraw/paramlist.h> *************** *** 280,286 **** if (size == 0) { if (tool->IsA(RESHAPE_TOOL)) { ! cmd = new DeleteCmd(ed); } else { v->Update(); // to repair text display-incurred damage } --- 281,287 ---- if (size == 0) { if (tool->IsA(RESHAPE_TOOL)) { ! cmd = new OvDeleteCmd(ed); } else { v->Update(); // to repair text display-incurred damage } *************** *** 300,306 **** } if (rel != nil) { ! if (v->GetOrientation()==Rotated ) rel->Rotate(-90); rel->InvTransform(xpos, ypos); } --- 301,307 ---- } if (rel != nil) { ! if (v->GetOrientation()==Rotated && !tool->IsA(RESHAPE_TOOL)) rel->Rotate(-90); rel->InvTransform(xpos, ypos); } Index: ComUnidraw/unifunc.c diff -c ComUnidraw/unifunc.c:1.7 ComUnidraw/unifunc.c:1.8 *** ComUnidraw/unifunc.c:1.7 Wed Jun 14 03:50:10 2000 --- src/ComUnidraw/unifunc.c Thu Jun 15 06:19:48 2000 *************** *** 192,198 **** OvImportCmd* ImportFunc::import(const char* path, boolean popen) { OvImportCmd* cmd = new OvImportCmd(editor()); cmd->pathname(path, popen); ! execute_log(cmd); if (cmd->component()) { ((OverlayComp*)cmd->component())->SetPathName(path); ((OverlayComp*)cmd->component())->SetByPathnameFlag(!popen); --- 192,198 ---- OvImportCmd* ImportFunc::import(const char* path, boolean popen) { OvImportCmd* cmd = new OvImportCmd(editor()); cmd->pathname(path, popen); ! cmd->Execute(); if (cmd->component()) { ((OverlayComp*)cmd->component())->SetPathName(path); ((OverlayComp*)cmd->component())->SetByPathnameFlag(!popen); *************** *** 212,217 **** --- 212,218 ---- if ((cmd = import(pathnamev.string_ptr(), popen_flag)) && cmd->component()) { ComValue compval(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); + delete cmd; compval.object_compview(true); push_stack(compval); } else *************** *** 221,226 **** --- 222,228 ---- if (cmd = import(stack_arg(i).string_ptr(), popen_flag)) { ComValue compval(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); + delete cmd; compval.object_compview(true); push_stack(compval); *************** *** 236,241 **** --- 238,244 ---- cmd = import(inlist->GetAttrVal(it)->string_ptr(), popen_flag); ComValue* val = new ComValue(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); + delete cmd; val->object_compview(true); outlist->Append(val); inlist->Next(it); Index: FrameUnidraw/framekit.c diff -c FrameUnidraw/framekit.c:1.5 FrameUnidraw/framekit.c:1.6 *** FrameUnidraw/framekit.c:1.5 Tue Mar 14 23:19:03 2000 --- src/FrameUnidraw/framekit.c Thu Jun 15 06:19:50 2000 *************** *** 149,184 **** void FrameKit::InitLayout(OverlayKit* kit, const char* name) { FrameEditor* ed = (FrameEditor*) kit->GetEditor(); if (ed->GetWindow() == nil) { TextObserver* mousedoc_observer = new TextObserver(ed->MouseDocObservable(), ""); WidgetKit& wk = *WidgetKit::instance(); const LayoutKit& layout = *LayoutKit::instance(); Glyph* menus = kit->MakeMenus(); Glyph* states = kit->MakeStates(); Glyph* toolbar = kit->MakeToolbar(); ! if (states) menus->append(states); ! Target* viewer = new Target(new Frame(kit->Interior()), TargetPrimitiveHit); ! Catalog* catalog = unidraw->GetCatalog(); ! if (const char* toolbarloca = catalog->GetAttribute("toolbarloc")) { ! if (strcmp(toolbarloca, "r") == 0) ! toolbar->prepend(layout.vcenter(viewer)); ! else /* if (strcmp(toolbarloca, "l") == 0) */ toolbar->append(layout.vcenter(viewer)); ! } else ! toolbar->append(layout.vcenter(viewer)); ! menus->append(toolbar); ! ! ! Style* style = Session::instance()->style(); ! boolean bookgeom = style->value_is_on("bookgeom"); ! ! PolyGlyph* topbox = layout.vbox(); ! ed->body(menus); ! ed->GetKeyMap()->Execute(CODE_SELECT); ! topbox->append(ed); ! if (!bookgeom) { boolean set_flag = kit->set_button_flag(); boolean clr_flag = kit->clr_button_flag(); EivTextEditor* texteditor = nil; --- 149,197 ---- void FrameKit::InitLayout(OverlayKit* kit, const char* name) { FrameEditor* ed = (FrameEditor*) kit->GetEditor(); + Catalog* catalog = unidraw->GetCatalog(); + const char* stripped_string = catalog->GetAttribute("stripped"); + boolean stripped_flag = stripped_string ? strcmp(stripped_string, "true")==0 : false; if (ed->GetWindow() == nil) { TextObserver* mousedoc_observer = new TextObserver(ed->MouseDocObservable(), ""); WidgetKit& wk = *WidgetKit::instance(); const LayoutKit& layout = *LayoutKit::instance(); + PolyGlyph* topbox = layout.vbox(); + Glyph* menus = kit->MakeMenus(); Glyph* states = kit->MakeStates(); Glyph* toolbar = kit->MakeToolbar(); ! ! if (stripped_flag) { ! ! Target* viewer = ! new Target(new Frame(ed->Interior()), TargetPrimitiveHit); ! ed->body(viewer); ! topbox->append(ed); ! ! } else { ! if (states) menus->append(states); ! Target* viewer = new Target(new Frame(kit->Interior()), TargetPrimitiveHit); ! Catalog* catalog = unidraw->GetCatalog(); ! if (const char* toolbarloca = catalog->GetAttribute("toolbarloc")) { ! if (strcmp(toolbarloca, "r") == 0) ! toolbar->prepend(layout.vcenter(viewer)); ! else /* if (strcmp(toolbarloca, "l") == 0) */ ! toolbar->append(layout.vcenter(viewer)); ! } else toolbar->append(layout.vcenter(viewer)); ! menus->append(toolbar); ! ! ! Style* style = Session::instance()->style(); ! boolean bookgeom = style->value_is_on("bookgeom"); ! ! ed->body(menus); ! ed->GetKeyMap()->Execute(CODE_SELECT); ! topbox->append(ed); ! if (!bookgeom) { boolean set_flag = kit->set_button_flag(); boolean clr_flag = kit->clr_button_flag(); EivTextEditor* texteditor = nil; *************** *** 188,208 **** else texteditor = new EivTextEditor(wk.style()); ((FrameEditor*)ed)->_texteditor = texteditor; ! Button* set = set_flag ? wk.push_button("Set", new ActionCallback(FrameEditor)( ! (FrameEditor*)ed, &FrameEditor::SetText ! )) : nil; ! Button* clear = clr_flag ? wk.push_button("Clear", new ActionCallback(FrameEditor)( ! (FrameEditor*)ed, &FrameEditor::ClearText ! )) : nil; Glyph* buttonbox = nil; if (set && !clear) { buttonbox = ! layout.vbox( ! layout.hcenter(set)); } else if (!set && clear) { buttonbox = ! layout.vbox( ! layout.hcenter(clear)); } else if (set && clear) { buttonbox = layout.vbox( --- 201,221 ---- else texteditor = new EivTextEditor(wk.style()); ((FrameEditor*)ed)->_texteditor = texteditor; ! Button* set = set_flag ? ! wk.push_button("Set", new ActionCallback(FrameEditor) ! ((FrameEditor*)ed, &FrameEditor::SetText)) : ! nil; ! Button* clear = clr_flag ? ! wk.push_button("Clear", new ActionCallback(FrameEditor) ! ((FrameEditor*)ed, &FrameEditor::ClearText)) : ! nil; Glyph* buttonbox = nil; if (set && !clear) { buttonbox = ! layout.vbox(layout.hcenter(set)); } else if (!set && clear) { buttonbox = ! layout.vbox(layout.hcenter(clear)); } else if (set && clear) { buttonbox = layout.vbox( *************** *** 213,253 **** } if (buttonbox) { topbox->append( ! wk.outset_frame( ! layout.hbox( ! layout.vcenter( ! layout.margin( ! buttonbox, ! 10 ! ) ! ), ! layout.vcenter(texteditor) ) ) ); } else { topbox->append( ! wk.outset_frame( ! layout.hbox( ! layout.vcenter( ! layout.margin( ! layout.vbox( ! wk.label("type help"), ! layout.vspace(10), ! wk.label("to print"), ! layout.vspace(10), ! wk.label("info to stdout") ! ), ! 10 ! ) ! ), ! layout.vcenter(texteditor) ) ) ); } } ! ManagedWindow* w = new ApplicationWindow(topbox); ed->SetWindow(w); Style* s = new Style(Session::instance()->style()); --- 226,267 ---- } if (buttonbox) { topbox->append( ! wk.outset_frame( ! layout.hbox( ! layout.vcenter( ! layout.margin( ! buttonbox, ! 10 ) + ), + layout.vcenter(texteditor) ) + ) ); } else { topbox->append( ! wk.outset_frame( ! layout.hbox( ! layout.vcenter( ! layout.margin( ! layout.vbox( ! wk.label("type help"), ! layout.vspace(10), ! wk.label("to print"), ! layout.vspace(10), ! wk.label("info to stdout") ! ), ! 10 ) + ), + layout.vcenter(texteditor) ) + ) ); } + } } ! ManagedWindow* w = new ApplicationWindow(topbox); ed->SetWindow(w); Style* s = new Style(Session::instance()->style()); Index: flipbook/main.c diff -c flipbook/main.c:1.1 flipbook/main.c:1.2 *** flipbook/main.c:1.1 Tue Jan 18 03:11:20 2000 --- src/flipbook/main.c Thu Jun 15 06:19:52 2000 *************** *** 155,160 **** --- 155,161 ---- { "*zoomer_off", "false" }, { "*opaque_off", "false" }, { "*slideshow", "0" }, + { "*stripped", "false" }, #ifdef HAVE_ACE { "*comdraw", "20002" }, { "*import", "20003" }, *************** *** 195,200 **** --- 196,202 ---- { "-opaque_off", "*opaque_off", OptionValueImplicit, "true" }, { "-opoff", "*opaque_off", OptionValueImplicit, "true" }, { "-slideshow", "*slideshow", OptionValueNext }, + { "-stripped", "*stripped", OptionValueImplicit, "true" }, #ifdef HAVE_ACE { "-import", "*import", OptionValueNext }, { "-comdraw", "*comdraw", OptionValueNext }, *************** *** 211,217 **** [-opaque_off|-opoff] [-pagecols|-ncols] [-pagerows|-nrows] [-panner_off|-poff] \n\ [-panner_align|-pal tl|tc|tr|cl|c|cr|cl|bl|br|l|r|t|b|hc|vc ] \n\ [-scribble_pointer|-scrpt ] [-slideshow sec] [-slider_off|-soff] \n\ ! [-toolbarloc|-tbl r|l ] [-theight|-th n] [-tile] [-twidth|-tw n] \n\ [-zoomer_off|-zoff] [file]"; #else static char* usage = --- 213,219 ---- [-opaque_off|-opoff] [-pagecols|-ncols] [-pagerows|-nrows] [-panner_off|-poff] \n\ [-panner_align|-pal tl|tc|tr|cl|c|cr|cl|bl|br|l|r|t|b|hc|vc ] \n\ [-scribble_pointer|-scrpt ] [-slideshow sec] [-slider_off|-soff] \n\ ! [-stripped] [-toolbarloc|-tbl r|l ] [-theight|-th n] [-tile] [-twidth|-tw n] \n\ [-zoomer_off|-zoff] [file]"; #else static char* usage = *** /dev/null Thu Jun 15 06:20:14 PDT 2000 --- patches/ivtools-000615-johnston-073 *************** patches/ivtools-000615-johnston-073 *** 0 **** --- 1 ---- + ivtools-000615-johnston-073 |
From: <ivt...@li...> - 2000-06-13 23:14:30
|
Patch: ivtools-000614-johnston-072 For: ivtools-0.8.3 Author: joh...@us... Subject: add :popen keyword to comdraw import command Requires: This is an intermediate patch to ivtools-0.8.3. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - add :popen keyword to comdraw import command, so that Unix command lines can be substituted for pathnames, i.e.: import("pbmtext \"TEST STRING\" | pnmalias" :popen) will cause a anti-aliased rendering of TEST STRING to be imported as a PPM raster file. Index: ComUnidraw/grfunc.c diff -c ComUnidraw/grfunc.c:1.10 ComUnidraw/grfunc.c:1.11 *** ComUnidraw/grfunc.c:1.10 Sun Jun 11 11:59:38 2000 --- src/ComUnidraw/grfunc.c Wed Jun 14 03:50:08 2000 *************** *** 1029,1082 **** } } - /*****************************************************************************/ - - ReorderFunc::ReorderFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { - } - - void ReorderFunc::execute() { - ComValue destval(stack_arg(0)); - ComValue srcval(stack_arg(1)); - - reset_stack(); - #if 0 - if (!destval.object_compview() && !srcval.object_compview()) return; - - OverlayViewer* viewer = (OverlayViewer*)GetEditor()->GetViewer(); - - ComponentView* destview = (ComponentView*)destval.obj_val(); - OverlayComp* destcomp = destview ? (OverlayComp*)destview->GetSubject() : nil; - OverlayView* destview2 = destcomp ? destcomp->FindView(viewer) : nil; - - ComponentView* srcview = (ComponentView*)srcval.obj_val(); - OverlayComp* srccomp = srcview ? (OverlayComp*)srcview->GetSubject() : nil; - OverlayView* srcview2 = srccomp ? srccomp->FindView(viewer) : nil; - - OverlaysView* topview = ((OverlayEditor*)GetEditor())->GetFrame(); - if (topview && destview2 && srcview2) { - - GraphicView* saveview = nil; - Iterator i; - for(topview->First(i); !topview->Done(i); topview->Next(i)) { - if (topview->GetView(i)==srcview2) { - saveview = topview->Remove(i); - break; - } - } - - if (saveview) { - for(topview->First(i); !topview->Done(i); topview->Next(i)) { - if (topview->GetView(i)==dstview2) { - topview->InsertBefore(i, saveview); - break; - } - } - } - - } - #endif - } - - --- 1029,1033 ---- Index: ComUnidraw/grfunc.h diff -c ComUnidraw/grfunc.h:1.4 ComUnidraw/grfunc.h:1.5 *** ComUnidraw/grfunc.h:1.4 Sat May 27 00:49:12 2000 --- src/ComUnidraw/grfunc.h Wed Jun 14 03:50:10 2000 *************** *** 332,345 **** return "%s(inpath outpath [xsize] [ysiz]) -- tile pgm or ppm image file"; } }; - //: command to move graphic in front of another - // reorder(destview srcview) -- move graphic to the front of another - class ReorderFunc : public UnidrawFunc { - public: - ReorderFunc(ComTerp*,Editor*); - virtual void execute(); - virtual const char* docstring() { - return "%s(destview srcview) -- move graphic to the front of another"; } - }; - #endif /* !defined(_grfunc_h) */ --- 332,335 ---- Index: ComUnidraw/unifunc.c diff -c ComUnidraw/unifunc.c:1.6 ComUnidraw/unifunc.c:1.7 *** ComUnidraw/unifunc.c:1.6 Tue Jun 6 11:51:04 2000 --- src/ComUnidraw/unifunc.c Wed Jun 14 03:50:10 2000 *************** *** 189,213 **** ImportFunc::ImportFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { } ! OvImportCmd* ImportFunc::import(const char* path) { OvImportCmd* cmd = new OvImportCmd(editor()); ! cmd->pathname(path); execute_log(cmd); if (cmd->component()) { ((OverlayComp*)cmd->component())->SetPathName(path); ! ((OverlayComp*)cmd->component())->SetByPathnameFlag(true); } return cmd; } void ImportFunc::execute() { ComValue pathnamev(stack_arg(0)); reset_stack(); OvImportCmd* cmd; if (!pathnamev.is_array()) { if (nargs()==1) { ! if (cmd = import(pathnamev.string_ptr())) { ComValue compval(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); compval.object_compview(true); --- 189,215 ---- ImportFunc::ImportFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { } ! OvImportCmd* ImportFunc::import(const char* path, boolean popen) { OvImportCmd* cmd = new OvImportCmd(editor()); ! cmd->pathname(path, popen); execute_log(cmd); if (cmd->component()) { ((OverlayComp*)cmd->component())->SetPathName(path); ! ((OverlayComp*)cmd->component())->SetByPathnameFlag(!popen); } return cmd; } void ImportFunc::execute() { ComValue pathnamev(stack_arg(0)); + static int popen_symid = symbol_add("popen"); + boolean popen_flag = stack_key(popen_symid).is_true(); reset_stack(); OvImportCmd* cmd; if (!pathnamev.is_array()) { if (nargs()==1) { ! if ((cmd = import(pathnamev.string_ptr(), popen_flag)) && cmd->component()) { ComValue compval(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); compval.object_compview(true); *************** *** 216,222 **** push_stack(ComValue::nullval()); } else { for (int i=0; i<nargs(); i++) ! if (cmd = import(stack_arg(i).string_ptr())) { ComValue compval(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); compval.object_compview(true); --- 218,224 ---- push_stack(ComValue::nullval()); } else { for (int i=0; i<nargs(); i++) ! if (cmd = import(stack_arg(i).string_ptr(), popen_flag)) { ComValue compval(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); compval.object_compview(true); *************** *** 231,237 **** Iterator it; inlist->First(it); while(!inlist->Done(it)) { ! cmd = import(inlist->GetAttrVal(it)->string_ptr()); ComValue* val = new ComValue(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); val->object_compview(true); --- 233,239 ---- Iterator it; inlist->First(it); while(!inlist->Done(it)) { ! cmd = import(inlist->GetAttrVal(it)->string_ptr(), popen_flag); ComValue* val = new ComValue(((OverlayComp*)cmd->component())->classid(), new ComponentView(cmd->component())); val->object_compview(true); Index: ComUnidraw/unifunc.h diff -c ComUnidraw/unifunc.h:1.4 ComUnidraw/unifunc.h:1.5 *** ComUnidraw/unifunc.h:1.4 Tue Jun 6 11:51:04 2000 --- src/ComUnidraw/unifunc.h Wed Jun 14 03:50:10 2000 *************** *** 93,107 **** }; //: command to import a graphic file ! // import(pathname) -- import graphic file from pathname or URL. class ImportFunc : public UnidrawFunc { public: ImportFunc(ComTerp*,Editor*); ! OvImportCmd* import(const char* path); // helper method to import from path virtual void execute(); virtual const char* docstring() { ! return "%s(pathname) -- import graphic file from pathname or URL"; } }; --- 93,107 ---- }; //: command to import a graphic file ! // import(pathname :popen) -- import graphic file from pathname or URL, or from a command if :popen. class ImportFunc : public UnidrawFunc { public: ImportFunc(ComTerp*,Editor*); ! OvImportCmd* import(const char* path, boolean popen=false); // helper method to import from path virtual void execute(); virtual const char* docstring() { ! return "%s(pathname :popen) -- import graphic file from pathname or URL, or from a command if :popen"; } }; Index: comdraw/README diff -c comdraw/README:1.9 comdraw/README:1.10 *** comdraw/README:1.9 Thu Jun 8 04:00:30 2000 --- src/comdraw/README Wed Jun 14 03:50:13 2000 *************** *** 82,88 **** update() -- update viewer ! import(pathstr) -- import graphic file from pathname or URL ncols() -- onscreen horizontal extent in pixels nrows() -- onscreen vertical extent in pixels --- 82,88 ---- update() -- update viewer ! import(pathstr :popen) -- import graphic file from pathname or URL, or from a command if :popen ncols() -- onscreen horizontal extent in pixels nrows() -- onscreen vertical extent in pixels Index: man1_ivtools/comdraw.1 diff -c man1_ivtools/comdraw.1:1.11 man1_ivtools/comdraw.1:1.12 *** man1_ivtools/comdraw.1:1.11 Thu Jun 8 04:00:45 2000 --- src/man/man1/comdraw.1 Wed Jun 14 03:50:27 2000 *************** *** 90,96 **** update() -- update viewer ! import(pathstr) -- import graphic file from pathname or URL ncols() -- onscreen horizontal extent in pixels nrows() -- onscreen vertical extent in pixels --- 90,96 ---- update() -- update viewer ! import(pathstr :popen) -- import graphic file from pathname or URL, or from a command if :popen ncols() -- onscreen horizontal extent in pixels nrows() -- onscreen vertical extent in pixels *** /dev/null Wed Jun 14 03:50:35 PDT 2000 --- patches/ivtools-000614-johnston-072 *************** patches/ivtools-000614-johnston-072 *** 0 **** --- 1 ---- + ivtools-000614-johnston-072 |
From: <ivt...@li...> - 2000-06-12 20:23:26
|
Patch: ivtools-000613-johnston-071 For: ivtools-0.8.2 Author: joh...@us... Subject: add Unidraw-common/[component.c compview.c] symlinks to MANIFEST Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - add Unidraw-common/[component.c compview.c] symlinks to MANIFEST Index: top_ivtools/MANIFEST diff -c top_ivtools/MANIFEST:1.10 top_ivtools/MANIFEST:1.11 *** top_ivtools/MANIFEST:1.10 Wed May 31 06:28:47 2000 --- ./MANIFEST Tue Jun 13 02:27:04 2000 *************** *** 789,794 **** --- 789,796 ---- ivtools-0.8/src/UniIdraw/idversion.h ivtools-0.8/src/Unidraw-common/Imakefile ivtools-0.8/src/Unidraw-common/Makefile + ivtools-0.8/src/Unidraw-common/component.c + ivtools-0.8/src/Unidraw-common/compview.c ivtools-0.8/src/Unidraw-common/geomobjs.c ivtools-0.8/src/Unidraw-common/iterator.c ivtools-0.8/src/Unidraw-common/ulist.c *** /dev/null Tue Jun 13 02:28:00 PDT 2000 --- patches/ivtools-000613-johnston-071 *************** patches/ivtools-000613-johnston-071 *** 0 **** --- 1 ---- + ivtools-000613-johnston-071 |
From: <ivt...@li...> - 2000-06-12 20:22:22
|
Patch: ivtools-000613-johnston-070 For: ivtools-0.8.2 Author: joh...@us... Subject: last patch to bring up to ivtools-0.8.3 Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - last patch to bring up to ivtools-0.8.3 Index: top_ivtools/CHANGES diff -c top_ivtools/CHANGES:1.3 top_ivtools/CHANGES:1.4 *** top_ivtools/CHANGES:1.3 Sat Apr 29 02:30:02 2000 --- ./CHANGES Tue Jun 13 02:02:23 2000 *************** *** 1,3 **** --- 1,202 ---- + June 12th 2000 ivtools-0.8.3 + + - remove the output for a ComValue of BlankType in the related ostream + operator. This puts it back to the way it has long been. The output + of "<blank>" was just a temporary debugging thing. + + - add an "acknowledgebox" command (AcknowledgeBoxFunc) to command, to allow + a script to pop-up a dialog box and require the user to press ok. + + - add a confirmbox command to comdraw that returns 1 for Yes, 0 for + No, and -1 if Cancelled. + + - use a self-growing STL (Standard Template Library) vector<char> to + read comterp commands from a socket. This replaces the year-old hack + of using a 1 megabyte input buffer (BUFSIZ*BUFSIZ), which was + problematic in certain run-time environments, causing an inexplicable + crash at the head of ComterpHandler::handle_input before any code of + the method was executed. + + If this approach proves out, it should be migrated to all the other + large input buffers spread around ivtools (where-ever the size is + BUFSIZ*BUFSIZ), and would make for a significant reduction in the + runtime footprint of some programs. + + - fix AttributeValue::geta(int classid) and add back a + ComValue::geta(int classid) + + - fix the use of CLASS_SYMID macro in OverlaysComp class definition. + It was missing the "s" from the class name string. + + - new comterp commands to "split" a string or symbol into a list of + characters, and to "join" a list of characters into a string or + symbol. + + - add -DUnidrawCommon to the compiler command line in the + Unidraw-common library, and make judicious use of "#ifndef + UnidrawCommon" in Unidraw/component.c and Unidraw/compview.c, so they + only pull in stuff out of libUnidraw-common. + + - print "nil" instead of "Unknown type" when a ComValue is of + UnknownType, since that is how UnknownType is used throughout comterp, + as the nil value which means no value. + + - bug fixed in AttributeListEditor where a fixed buffer of length 1024 + was overflowed. Replaced with a vector <char> instead. + + - change comterp eval command to return a single value if it has only one argument. + + - change the Dialog class so that a box put up with ::map_for or + ::map_for_aligned (as opposed to ::post_for or ::post_for_aligned) can + unmap itself when cancelled or accepted. + + - add highlight command to comdraw interpreter: + + highlight(compview compviewgs) -- set the highlight graphic state for a graphic + + - changed ComTerpModule::reset to reuse buffers without reallocating them. + + - fixed equality comparisons in comterp against nil (which is + ComValue::UnknownType under the hood). Now nil!=0 is true (1) and + nil==0 is false (0). + + - added base class method to set an OverlayView's HighlightGraphic and + member variable _hilite_gs to hold it. + + - fixed bug in OverlayScript::ReadOther. Now the attribute built from + a keyword with no following value(followed by the closing paren) gets + a value of true (1). + + - add a global variable capability to comterp. Now you can: + + global(v1)=100 + + and the value v1 will be available in all other copies of the command + interpreter running at the time. If a local variable of the same name + exists, you can access the global value by: + + symval(global(v1)) + + The "global" command returns a ComValue of SymbolType with a new + global flag set to true. This flag is subsequently checked when doing + symbol lookup, and if true the values are taken from the global symbol + table (a static class variable of ComTerp). + + - add a AttributeValue::clear() method to zero out all the bytes of + the double sized multi-value union _v. + + - add "frame" command to comdraw (and flipbook) to return the current + composite graphic. + + - make comdraw versions of the "at" and "size" commands that work on + composite graphic objects (i.e. the list of sub-graphics gets used as + the list). + + - add a static method ComValue::minusoneval to return a ComValue set + to -1. + + - ensure a ComValue is really of ObjectType before returning the value + of the ::object_compview() flag. + + - test for global symbol flag before doing local symbol table lookup + in comterp. + + - ensure the global symbol flag is zeroed when constructing a ComValue + from a postfix_token struct. + + - remove bug in comdraw "center" command. + + - fix bug in "mbr" and "points" commands of comdraw (same one that was + in "center"). + + - annotate (prefix) the result from a timeexpr command with "timeexpr + result: ". Otherwise it is kind of hard to tell where these things + come from. + + - modify min and max commands of comterp so that max(num nil) is always num, + and min(num nil) is always num as well. + + - preserve the ComTerp associated with a ComterpHandler if there is a timer evaluated expression still running. + + - define AttributeValue::boolean_val() to return true for any symbol + or string value if the symbol id is greater than or equal to zero. + + - new "delete" command for comdraw. + + - new :clear flag on the "select" command of comdraw. + + - new :scrn flag on the "center" and "mbr" commands of comdraw (to + return screen relative coordinates as opposed to drawing coordinates). + + - fix :str keyword of print command (shortcut for :string) + + - add :sym and :symbol keyword to print command, for generating + symbols the same way :str and :string can generate strings. + + - fix a few cases in the execute method of a derived Comfunc where a + reference is initialized to a ComValue on the interpreter stack + (ComValue&), and then used after the stack has been reset for this + command (ComFunc::reset_stack), which obliterates all the input + arguments. Instead a local copy of the ComValue is initialized. + + - add a comdraw "growgroup" command: + + newgroup=growgroup(groupview compview) -- add graphic to existing group graphic + + This is implemented with a MacroCmd (macro command) that has two + members, an UngroupCmd to break down the initial group into its + constituent parts, and an (Ov)GroupCmd to build it back up to include + the new graphic. + + - add comdraw "trimgroup" command, to reverse the effect of a "growgroup" + command: + + newgroup=trimgroup(groupview compview) -- remove graphic from existing group graphic + + Underneath the hood this a macro command (MacroCmd) with an ungroup + command (UngroupCmd) followed by group command (OvGroupCmd) with the + specified graphic removed from the list. This does not delete that + graphic, but that can be done with a "delete" command if so desired. + + - fix bug in comdraw "select" command, so that changes to the current + selection are graphically represented in the viewer. + + - add pause command to comdraw. Can be embedded in the middle of a + script, and allows for arbitrary commands to be evaluated until a + simple C/R is entered. + + - add a "logger" mode to comterp: + + comterp logger 'portnum' + + Listens for and accept connections on portnum, then simply forward + the incoming messages to stdout, while ack'ing back with newlines. For + debugging purposes, not really a use of the interpreter. + + - revise comdraw documentation, to make it more obvious that the + "import" command requires a string for its pathname argument, and that + a string has to be embedded in double-quotes. + + - upgrades to smoothly compile on RedHat 6.2 + + - add a :n argument to the eq command (the command that underlies the + "==" operator), so that it can be used for partial string comparison, + i.e.: + + eq("string1" "string2" :n 6) + + returns true. + + - fix up the comdraw text command to work at other than 1x mag. + + - fix two bugs in the Attribute tool dialog box. Make things work + when there are no attributes defined (a problem that cropped up since + using STL vector template to store the contents of the dialog buffer). + And use a ComponentView to hold the pointer to a Component being + examined by the dialog box, so that if the Component gets deleted in + the drawing editor the Attribute tool dialog box won't be fooled into + thinking it still has a good Component pointer. + April 28th 2000 ivtools-0.8.2 - Add a new version of a dot (".") func to comdraw, one that accesses Index: top_ivtools/INSTALL diff -c top_ivtools/INSTALL:1.7 top_ivtools/INSTALL:1.8 *** top_ivtools/INSTALL:1.7 Sat Apr 29 02:30:02 2000 --- ./INSTALL Tue Jun 13 02:02:23 2000 *************** *** 1,23 **** INSTALL for ivtools-0.8 ! Instructions for building ivtools-0.8.2 from source: 0. Compilation Environment ! Tools you will need before you can build (note, if you are attempting ! to build on Windows NT, look at README.cygwin as well): ! 0.a. a Unix machine. We know it has been built on Linux, Solaris, ! Irix, Dec Alpha, HPUX, and SunOS. 0.b. The gcc compiler. Recently we've been building and testing with egcs-1.0.3 and gcc-2.8.1. gcc-2.7.2 will still work, as probably would gcc-2.6.3. You will also need an equivalent copy of libstdc++. The libstdc++ version numbers stay roughly in synch with the gcc version numbers. If you have gcc-2.8.1 you'd want libstdc++-2.8.1, ! etc.. 0.c. An installed copy of X11R6 as distributed by the Open Group, or an equivalent (XFree86 for Linux, or X11R5 from MIT). If you use a vendor's X11 product, the product should be based on X11R4 or later --- 1,29 ---- INSTALL for ivtools-0.8 ! Instructions for building ivtools-0.8.3 from source: 0. Compilation Environment ! Things you will need (or might want) before building ivtools: ! 0.a. a Unix machine. We know it has been built on Linux, NetBSD, ! Solaris, Irix, Dec Alpha, HPUX, and SunOS. Alternately it can be ! built on Windows NT with the Cygwin utilities from RedHat. See ! README.cygwin for details. 0.b. The gcc compiler. Recently we've been building and testing with egcs-1.0.3 and gcc-2.8.1. gcc-2.7.2 will still work, as probably would gcc-2.6.3. You will also need an equivalent copy of libstdc++. The libstdc++ version numbers stay roughly in synch with the gcc version numbers. If you have gcc-2.8.1 you'd want libstdc++-2.8.1, ! etc.. + Also be aware that sometimes the include files for libstdc++ are in + /usr/local/include/g++-2, a place that cannot be auto-determined by + the configure script. Establishing a symbolic link to + /usr/local/include/g++ will fix the problem. + 0.c. An installed copy of X11R6 as distributed by the Open Group, or an equivalent (XFree86 for Linux, or X11R5 from MIT). If you use a vendor's X11 product, the product should be based on X11R4 or later *************** *** 33,40 **** ** find the gcc variant of cpp. Read more about it at ** http://www.vectaport.com/ivtools/faq.html#imakecppprob ! 0.d. You also might want to acquire and build clippoly, a LGPLed library for ! polygon clipping from: http://www.ph.tn.tudelft.nl/People/klamer/clippoly_entry.html --- 39,46 ---- ** find the gcc variant of cpp. Read more about it at ** http://www.vectaport.com/ivtools/faq.html#imakecppprob ! 0.d. If you want to use the polygon intersection tools, acquire and ! build clippoly, a LGPLed library for polygon clipping from: http://www.ph.tn.tudelft.nl/People/klamer/clippoly_entry.html *************** *** 42,69 **** shared library in the clippoly directory with: "gcc -shared -o libclippoly.so *.o" (you can leave out test.o if you want). ! i0.e. You also might want to acquire and build ACE, a C++ middleware ! toolkit available from: http://www.cs.wustl.edu/%7Eschmidt/ACE.html ! We currently use ACE-4.6. You may have to add some of the #define's ! listed in the ACE_wrappers/ace/README file to ! ACE_wrappers/ace/config.h, to alleviate warnings of undefined ! functions. For example, on Linux RedHat 4.1 we had to add: ! ! #define ACE_LACKS_READIR_R ! ! You may also want to avoid building with thread support if you have ! any problems with using ACE. ivtools makes no use of ACE threads ! capability. ! ! gcc-2.8.1 and egcs-1.0.2 or greater are needed for ACE-4.5 or greater. ! Ensure -fPIC is used when compiling. If you are building with ! gcc-2.7.2.* or earlier, you'll want to use ACE-4.2 instead of the ! latest version of ACE. You can still get a copy at ! http://www.vectaport.com/pub/src/ACE-4.2.tar.gz. You may want to ! apply this patch: http://www.vectaport.com/pub/src/ace4.2warnpatch. 0.f if you want to build the ivxt example program, which demonstrates the embedding of a ivtools drawing editor inside Motif widgets, you'll --- 48,61 ---- shared library in the clippoly directory with: "gcc -shared -o libclippoly.so *.o" (you can leave out test.o if you want). ! i0.e. If you want to use the network server capabilities of the ! ivtools programs, acquire and build ACE, a C++ middleware toolkit ! available from: http://www.cs.wustl.edu/%7Eschmidt/ACE.html ! We currently use ACE-5.1. If you have problems with the ./configure ! script, consider using the latest beta version of ACE instead. 0.f if you want to build the ivxt example program, which demonstrates the embedding of a ivtools drawing editor inside Motif widgets, you'll *************** *** 84,91 **** 1.a. You no longer need to set your CPU environment variable to build ivtools, but you still need a CPU specific configuration file. Ready-made configurations that have been known to work exist for ! LINUX, SUN4 (and Solaris), SGI, HP800 (HPUX), ALPHA, and now CYGWIN ! (for Windows NT). Use "make CPU" from the top directory to see the symbol ivtools will use for your OS (grep config/arch.def for ArchitectureName to get a --- 76,83 ---- 1.a. You no longer need to set your CPU environment variable to build ivtools, but you still need a CPU specific configuration file. Ready-made configurations that have been known to work exist for ! LINUX, SUN4 (and Solaris), SGI, HP800 (HPUX), ALPHA, NETSBD, and now ! CYGWIN (for Windows NT). Use "make CPU" from the top directory to see the symbol ivtools will use for your OS (grep config/arch.def for ArchitectureName to get a *************** *** 158,164 **** 2.a. cd to the ivtools-0.8/ directory (you'd already be in this directory after running the configure script). ! 2.b. Compile it with a "make World" command. This command: - regenerates the top-level Makefile to snap it to the current directory ("make Makefile"). --- 150,157 ---- 2.a. cd to the ivtools-0.8/ directory (you'd already be in this directory after running the configure script). ! 2.b. Compile it with a "make" command. The first time it is run it ! does all these individual steps (the equivalent of "make World"): - regenerates the top-level Makefile to snap it to the current directory ("make Makefile"). *************** *** 177,188 **** http://www.vectaport.com/ivtools/faq.html#SourceBuild ! ** The "make World" should no longer need any other command line ! ** options, since these are generated by the configure script and ! ** pulled in by the top-level Makefile. If you have problems and you ! ** suspect this evolution, verify that the definition of XCONFIGDIR ! ** and ABSTOP in config/config.mk are accurate (ABSTOP should be set ! ** to the top-level directory of the ivtools source tree). 3. Testing: --- 170,180 ---- http://www.vectaport.com/ivtools/faq.html#SourceBuild ! ** Subsequent use of "make" will only do the "make -k" phase described ! ** above. To redo everything, either do a "make World", or do a "make ! ** clean" followed by a "make". The "make clean" deletes the files ! ** that suppress the make stateges, make.makefile, make.makefiles, ! ** make.depend, and make.make. 3. Testing: Index: top_ivtools/README diff -c top_ivtools/README:1.4 top_ivtools/README:1.5 *** top_ivtools/README:1.4 Sat Apr 29 02:30:02 2000 --- ./README Tue Jun 13 02:02:23 2000 *************** *** 2,8 **** README for ivtools 0.8 ! This directory contains a release of ivtools 0.8.2 from Vectaport Inc.. You should read the rest of this file for information on what ivtools is and the INSTALL file for instructions on how to build it. --- 2,8 ---- README for ivtools 0.8 ! This directory contains a release of ivtools 0.8.3 from Vectaport Inc.. You should read the rest of this file for information on what ivtools is and the INSTALL file for instructions on how to build it. *************** *** 134,149 **** http://www.vectaport.com/ivtools/mailinglists.html - **NOTE** A new term might be added to the COPYRIGHT in the future, to - acquire some of the protection of an LGPL style open-source license - without adding restrictions to purely binary forms of redistribution. - Take a look at the COPYRIGHT.proposed file and forward comments to - ivt...@ve.... See an on-line discussion of this - proposal at http://www.vectaport.com/ivtools/caveats.html. Vote your - preference in a survey at: - - http://sourceforge.net/survey/survey.php?group_id=275&survey_id=10018 - Online documentation (including an FAQ) is available for ivtools at: http://www.vectaport.com/ivtools/doc/ --- 134,139 ---- *************** *** 288,294 **** Solaris 2.6 building from M. Rasit Eskicioglu at the University of Alberta. NetBSD port by Todd Gruhn. ! Cygwin development environment for Windows NT from Cygnus Solutions. Patches to iv-3.2a incorporated from the PDP++ distribution from Carnegie Mellon University Department of Psychiatry, Randall --- 278,284 ---- Solaris 2.6 building from M. Rasit Eskicioglu at the University of Alberta. NetBSD port by Todd Gruhn. ! Cygwin development environment for Windows NT from RedHat (Cygnus Solutions). Patches to iv-3.2a incorporated from the PDP++ distribution from Carnegie Mellon University Department of Psychiatry, Randall *************** *** 444,449 **** The balance of ivtools has been developed by Vectaport Inc. (P.O. Box 7141, Redwood City, CA 94063), with additional support from IET Inc. (P.O. Box 112450, Campbell, CA 95011) in the form of ARPA ! subcontracts (DACA76-93-C-0025 and DACA76-97-C-0005), as well as ! support from Applied Sciences Inc, San Francisco, CA, in the form of a ! subcontract for a Phase II SBIR from NASA Ames. --- 434,441 ---- The balance of ivtools has been developed by Vectaport Inc. (P.O. Box 7141, Redwood City, CA 94063), with additional support from IET Inc. (P.O. Box 112450, Campbell, CA 95011) in the form of ARPA ! subcontracts (DACA76-93-C-0025 and DACA76-97-C-0005), and more ! recently by granting part-time employee Scott Johnston the freedom to ! evolve ivtools and related open-source frameworks as part of his ! job. There was also support from Applied Sciences Inc, San Francisco, ! CA, in the form of a subcontract for a Phase II SBIR from NASA Ames. Index: top_ivtools/VERSION diff -c top_ivtools/VERSION:1.3 top_ivtools/VERSION:1.4 *** top_ivtools/VERSION:1.3 Sat Apr 29 02:30:02 2000 --- ./VERSION Tue Jun 13 02:02:23 2000 *************** *** 1 **** ! Release 0.8.2 --- 1 ---- ! Release 0.8.3 Index: include_std/version.h diff -c include_std/version.h:1.4 include_std/version.h:1.5 *** include_std/version.h:1.4 Sat Apr 29 02:30:33 2000 --- src/include/ivstd/version.h Tue Jun 13 02:02:56 2000 *************** *** 1,3 **** ! #define IvtoolsVersion 0.8.2 ! #define VersionString "0.8.2" ! #define ReleaseString "ivtools-0.8.2" --- 1,3 ---- ! #define IvtoolsVersion 0.8.3 ! #define VersionString "0.8.3" ! #define ReleaseString "ivtools-0.8.3" Index: config_ivtools/params.def diff -c config_ivtools/params.def:1.3 config_ivtools/params.def:1.4 *** config_ivtools/params.def:1.3 Sat Apr 29 02:30:39 2000 --- config/params.def Tue Jun 13 02:03:02 2000 *************** *** 36,42 **** * VersionNumber */ #ifndef Version ! #define Version 0.8.2 #endif VERSION = Version --- 36,42 ---- * VersionNumber */ #ifndef Version ! #define Version 0.8.3 #endif VERSION = Version *** /dev/null Tue Jun 13 02:03:05 PDT 2000 --- patches/ivtools-000613-johnston-070 *************** patches/ivtools-000613-johnston-070 *** 0 **** --- 1 ---- + ivtools-000613-johnston-070 |
From: <ivt...@li...> - 2000-06-12 18:28:06
|
Patch: ivtools-000610-johnston-066 For: ivtools-0.8.2 Author: joh...@us... Subject: upgrades to smoothly compile on RedHat 6.2 Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - upgrades to smoothly compile on RedHat 6.2 Index: ComTerp/symbolfunc.c diff -c ComTerp/symbolfunc.c:1.6 ComTerp/symbolfunc.c:1.7 *** ComTerp/symbolfunc.c:1.6 Wed May 17 06:58:39 2000 --- src/ComTerp/symbolfunc.c Sat Jun 10 01:49:22 2000 *************** *** 204,210 **** void JoinStrFunc::execute() { ComValue listv(stack_arg(0)); ! static sym_symid = symbol_add("sym"); ComValue symflagv(stack_key(sym_symid)); boolean symflag = symflagv.is_true(); reset_stack(); --- 204,210 ---- void JoinStrFunc::execute() { ComValue listv(stack_arg(0)); ! static int sym_symid = symbol_add("sym"); ComValue symflagv(stack_key(sym_symid)); boolean symflag = symflagv.is_true(); reset_stack(); Index: src_os/directory.c diff -c src_os/directory.c:1.2 src_os/directory.c:1.3 *** src_os/directory.c:1.2 Wed Feb 2 03:09:37 2000 --- src/OS/directory.c Sat Jun 10 01:49:28 2000 *************** *** 22,27 **** --- 22,28 ---- * OF THIS SOFTWARE. */ + #include <stdio.h> #include <OS/directory.h> #include <OS/memory.h> #include <OS/string.h> *************** *** 41,47 **** #endif #include <pwd.h> - #include <stdio.h> #include <string.h> #include <sys/stat.h> --- 42,47 ---- *************** *** 51,57 **** */ extern "C" { ! #if Debian_Potato extern int sprintf __P ((char *__restrict __s, __const char *__restrict __format, ...)); #endif --- 51,57 ---- */ extern "C" { ! #if 0 extern int sprintf __P ((char *__restrict __s, __const char *__restrict __format, ...)); #endif Index: src_os/file.c diff -c src_os/file.c:1.1 src_os/file.c:1.2 *** src_os/file.c:1.1 Tue Jan 18 03:07:48 2000 --- src/OS/file.c Sat Jun 10 01:49:28 2000 *************** *** 42,48 **** /* no standard place for these */ extern "C" { ! extern int close(int); #if defined(sgi) extern int read(int, void*, unsigned int); #endif --- 42,52 ---- /* no standard place for these */ extern "C" { ! #ifdef __P ! extern int close __P ((int)); ! #else ! extern int close (int); ! #endif #if defined(sgi) extern int read(int, void*, unsigned int); #endif *** /dev/null Sat Jun 10 01:50:05 PDT 2000 --- patches/ivtools-000610-johnston-066 *************** patches/ivtools-000610-johnston-066 *** 0 **** --- 1 ---- + ivtools-000610-johnston-066 |
From: <ivt...@li...> - 2000-06-12 18:27:06
|
Patch: ivtools-000612-johnston-069 For: ivtools-0.8.2 Author: joh...@us... Subject: fix two bugs in attribute dialog box Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - fix two bugs in the Attribute tool dialog box. Make things work when there are no attributes defined (a problem that cropped up since using STL vector template to store the contents of the dialog buffer). And use a ComponentView to hold the pointer to a Component being examined by the dialog box, so that if the Component gets deleted in the drawing editor the Attribute tool dialog box won't be fooled into thinking it still has a good Component pointer. Index: AttrGlyph/attredit.c diff -c AttrGlyph/attredit.c:1.2 AttrGlyph/attredit.c:1.3 *** AttrGlyph/attredit.c:1.2 Fri May 12 04:18:56 2000 --- src/AttrGlyph/attredit.c Mon Jun 12 09:33:16 2000 *************** *** 162,168 **** #ifndef STL_VECTOR _ete->text(buf, update); #else ! _ete->text(&vbuf[0], update); #endif } --- 162,168 ---- #ifndef STL_VECTOR _ete->text(buf, update); #else ! _ete->text(&vbuf[0] ? &vbuf[0] : "", update); #endif } Index: OverlayUnidraw/ovgdialog.c diff -c OverlayUnidraw/ovgdialog.c:1.2 OverlayUnidraw/ovgdialog.c:1.3 *** OverlayUnidraw/ovgdialog.c:1.2 Fri May 12 04:19:04 2000 --- src/OverlayUnidraw/ovgdialog.c Mon Jun 12 09:33:24 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994,1999 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 22,31 **** */ #include <Attribute/attrlist.h> - #include <OverlayUnidraw/ovcomps.h> #include <OverlayUnidraw/ovgdialog.h> #include <Unidraw/unidraw.h> #include <Unidraw/statevars.h> #include <AttrGlyph/attredit.h> #include <IVGlyph/textedit.h> --- 23,33 ---- */ #include <Attribute/attrlist.h> #include <OverlayUnidraw/ovgdialog.h> + #include <OverlayUnidraw/ovcomps.h> #include <Unidraw/unidraw.h> #include <Unidraw/statevars.h> + #include <Unidraw/Components/compview.h> #include <AttrGlyph/attredit.h> #include <IVGlyph/textedit.h> *************** *** 167,173 **** Style* style_; AttributeDialog* dialog_; AttributeListEditor* editor_; ! OverlayComp* comp_; AttributeList* copylist_; void init(OverlayComp*, AttributeDialog*, Style*); --- 169,175 ---- Style* style_; AttributeDialog* dialog_; AttributeListEditor* editor_; ! ComponentView* compview_; AttributeList* copylist_; void init(OverlayComp*, AttributeDialog*, Style*); *************** *** 194,199 **** --- 196,202 ---- AttributeDialog::~AttributeDialog() { impl_->free(); + delete impl_->compview_; delete impl_; } *************** *** 202,209 **** void AttributeDialogImpl::init(OverlayComp* oc, AttributeDialog* p, Style* s) { dialog_ = p; style_ = s; ! comp_ = oc; ! copylist_ = new AttributeList(comp_->GetAttributeList()); Resource::ref(copylist_); build(copylist_); } --- 205,212 ---- void AttributeDialogImpl::init(OverlayComp* oc, AttributeDialog* p, Style* s) { dialog_ = p; style_ = s; ! compview_ = new ComponentView(oc); ! copylist_ = new AttributeList(oc->GetAttributeList()); Resource::ref(copylist_); build(copylist_); } *************** *** 254,260 **** editor_->add(); // should set modified flag here if something happenns // ((ModifStatusVar*)<Editor>->GetState("ModifStatusVar"))->SetModifStatus(true); ! comp_->SetAttributeList(copylist_); Unref(copylist_); dialog_->dismiss(true); unidraw->Update(); --- 257,264 ---- editor_->add(); // should set modified flag here if something happenns // ((ModifStatusVar*)<Editor>->GetState("ModifStatusVar"))->SetModifStatus(true); ! OverlayComp* comp = (OverlayComp*)compview_->GetSubject(); ! if (comp) comp->SetAttributeList(copylist_); Unref(copylist_); dialog_->dismiss(true); unidraw->Update(); *** /dev/null Mon Jun 12 09:33:55 PDT 2000 --- patches/ivtools-000612-johnston-069 *************** patches/ivtools-000612-johnston-069 *** 0 **** --- 1 ---- + ivtools-000612-johnston-069 |
From: <ivt...@li...> - 2000-06-12 18:26:23
|
Patch: ivtools-000611-johnston-068 For: ivtools-0.8.2 Author: joh...@us... Subject: fix up the comdraw text command to work at other than 1x mag. Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - fix up the comdraw text command to work at other than 1x mag. Index: ComUnidraw/grfunc.c diff -c ComUnidraw/grfunc.c:1.9 ComUnidraw/grfunc.c:1.10 *** ComUnidraw/grfunc.c:1.9 Thu Jun 1 13:00:18 2000 --- src/ComUnidraw/grfunc.c Sun Jun 11 11:59:38 2000 *************** *** 302,310 **** text->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } if (fntVar != nil) text->SetFont(fntVar->GetFont()); ! text->SetTransformer(rel); ! Unref(rel); text->Translate(args[x0], args[y0]); TextOvComp* comp = new TextOvComp(text); cmd = new PasteCmd(_ed, new Clipboard(comp)); ComValue compval(symbol_add("TextComp"), new ComponentView(comp)); --- 302,311 ---- text->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } if (fntVar != nil) text->SetFont(fntVar->GetFont()); ! text->SetTransformer(new Transformer()); text->Translate(args[x0], args[y0]); + text->GetTransformer()->postmultiply(rel); + Unref(rel); TextOvComp* comp = new TextOvComp(text); cmd = new PasteCmd(_ed, new Clipboard(comp)); ComValue compval(symbol_add("TextComp"), new ComponentView(comp)); *** /dev/null Sun Jun 11 11:59:55 PDT 2000 --- patches/ivtools-000611-johnston-068 *************** patches/ivtools-000611-johnston-068 *** 0 **** --- 1 ---- + ivtools-000611-johnston-068 |
From: <ivt...@li...> - 2000-06-12 18:25:41
|
Patch: ivtools-000611-johnston-067 For: ivtools-0.8.2 Author: joh...@us... Subject: extend the equality operator for partial string comparison Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - add a :n argument to the eq command (the command that underlies the "==" operator), so that it can be used for partial string comparison, i.e.: eq("string1" "string2" :n 6) returns true. Index: ComTerp/boolfunc.c diff -c ComTerp/boolfunc.c:1.4 ComTerp/boolfunc.c:1.5 *** ComTerp/boolfunc.c:1.4 Tue May 16 06:21:10 2000 --- src/ComTerp/boolfunc.c Sun Jun 11 00:18:56 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994-1997 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 24,29 **** --- 25,31 ---- #include <ComTerp/boolfunc.h> #include <ComTerp/comvalue.h> #include <ComTerp/comterp.h> + #include <string.h> #define TITLE "BoolFunc" *************** *** 190,195 **** --- 192,199 ---- void EqualFunc::execute() { ComValue& operand1 = stack_arg(0); ComValue& operand2 = stack_arg(1); + static int n_symid = symbol_add("n"); + ComValue& nval =stack_key(n_symid); promote(operand1, operand2); ComValue result(operand1); result.type(ComValue::BooleanType); *************** *** 230,239 **** result.boolean_ref() = operand1.double_val() == operand2.double_val(); break; case ComValue::StringType: - result.boolean_ref() = operand1.string_val() == operand2.string_val(); - break; case ComValue::SymbolType: ! result.boolean_ref() = operand1.symbol_val() == operand2.symbol_val(); break; default: result.boolean_ref() = operand1.is_type(ComValue::UnknownType) && --- 234,247 ---- result.boolean_ref() = operand1.double_val() == operand2.double_val(); break; case ComValue::StringType: case ComValue::SymbolType: ! if (nval.is_unknown()) ! result.boolean_ref() = operand1.symbol_val() == operand2.symbol_val(); ! else { ! const char* str1 = operand1.symbol_ptr(); ! const char* str2 = operand2.symbol_ptr(); ! result.boolean_ref() = strncmp(str1, str2, nval.int_val())==0; ! } break; default: result.boolean_ref() = operand1.is_type(ComValue::UnknownType) && Index: ComTerp/boolfunc.h diff -c ComTerp/boolfunc.h:1.1 ComTerp/boolfunc.h:1.2 *** ComTerp/boolfunc.h:1.1 Tue Jan 18 03:07:03 2000 --- src/ComTerp/boolfunc.h Sun Jun 11 00:18:56 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994-1997,1999 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 65,77 **** //: == (equality) operator. class EqualFunc : public NumFunc { public: EqualFunc(ComTerp*); virtual void execute(); virtual const char* docstring() { ! return "== is the equal operator"; } }; --- 66,80 ---- //: == (equality) operator. + // also useful for partial string comparison with :n keyword, i.e. + // eq("string1" "string2" :n 6) returns true. class EqualFunc : public NumFunc { public: EqualFunc(ComTerp*); virtual void execute(); virtual const char* docstring() { ! return "== is the equal operator\nbool=eq(str1 str2 :n len) -- partial string comparison"; } }; Index: ComTerp/comhandler.c diff -c ComTerp/comhandler.c:1.11 ComTerp/comhandler.c:1.12 *** ComTerp/comhandler.c:1.11 Thu Jun 8 03:56:56 2000 --- src/ComTerp/comhandler.c Sun Jun 11 00:18:56 2000 *************** *** 96,101 **** --- 96,102 ---- const void *arg) { if (_timeoutscriptid<0) return 0; + comterp_->push_servstate(); comterp_->load_string(symbol_pntr(_timeoutscriptid)); if (comterp_->read_expr()) { if (comterp_->eval_expr()) { *************** *** 106,111 **** --- 107,113 ---- delete comterp_; #endif timeoutscriptid(-1); + comterp_->pop_servstate(); comterp_ = nil; return -1; } else { *************** *** 119,124 **** --- 121,127 ---- } } } + comterp_->pop_servstate(); return 0; } Index: ComTerp/comvalue.c diff -c ComTerp/comvalue.c:1.16 ComTerp/comvalue.c:1.17 *** ComTerp/comvalue.c:1.16 Sat May 20 02:22:20 2000 --- src/ComTerp/comvalue.c Sun Jun 11 00:18:56 2000 *************** *** 150,160 **** break; case ComValue::SymbolType: ! if (brief) if (svp->global_flag()) out << "global("; out << symbol_pntr( svp->symbol_ref()); if (svp->global_flag()) out << ")"; ! else { title = "symbol( "; symbol = symbol_pntr( svp->symbol_ref() ); out << title << symbol; --- 150,160 ---- break; case ComValue::SymbolType: ! if (brief) { if (svp->global_flag()) out << "global("; out << symbol_pntr( svp->symbol_ref()); if (svp->global_flag()) out << ")"; ! } else { title = "symbol( "; symbol = symbol_pntr( svp->symbol_ref() ); out << title << symbol; Index: comterp/README diff -c comterp/README:1.9 comterp/README:1.10 *** comterp/README:1.9 Thu Jun 8 03:56:59 2000 --- src/comterp_/README Sun Jun 11 00:18:59 2000 *************** *** 197,202 **** --- 197,204 ---- str=join(clist :sym) -- join list of characters into string + bool=eq(str1 str2 :n len) -- partial string comparison + postfix(arg1 [arg2 [arg3 ... [argn]]]) -- echo unevaluated postfix arguments (with [narg|nkey] after defined commands, {narg|nkey} after undefined commands, (narg) after keys, and a * following post-evaluation commands) Index: man1_ivtools/comterp.1 diff -c man1_ivtools/comterp.1:1.9 man1_ivtools/comterp.1:1.10 *** man1_ivtools/comterp.1:1.9 Thu Jun 8 04:00:45 2000 --- src/man/man1/comterp.1 Sun Jun 11 00:19:31 2000 *************** *** 206,211 **** --- 206,213 ---- str=join(clist :sym) -- join list of characters into string + bool=eq(str1 str2 :n len) -- partial string comparison + postfix(arg1 [arg2 [arg3 ... [argn]]]) -- echo unevaluated postfix arguments (with [narg|nkey] after defined commands, {narg|nkey} after undefined commands, (narg) after keys, and a * following post-evaluation commands) arr=posteval(arg1 [arg2 [arg3 ... [argn]]]) -- post-evaluate every fixed argument (until nil) and return array *** /dev/null Sun Jun 11 00:19:36 PDT 2000 --- patches/ivtools-000611-johnston-067 *************** patches/ivtools-000611-johnston-067 *** 0 **** --- 1 ---- + ivtools-000611-johnston-067 |
From: <ivt...@li...> - 2000-06-06 05:57:56
|
Patch: ivtools-000606-johnston-064 For: ivtools-0.8.2 Author: joh...@us... Subject: add pause command to comdraw Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - adds pause command to comdraw. Can be embedded in the middle of a script, and allows for arbitrary commands to be evaluated until a simple C/R is entered. Index: ComTerp/comfunc.c diff -c ComTerp/comfunc.c:1.3 ComTerp/comfunc.c:1.4 *** ComTerp/comfunc.c:1.3 Sat Apr 15 03:29:44 2000 --- src/ComTerp/comfunc.c Tue Jun 6 11:50:19 2000 *************** *** 431,433 **** --- 431,434 ---- ComFuncState::ComFuncState(ComFuncState& cfs) { *this = cfs; } + Index: ComTerp/comhandler.c diff -c ComTerp/comhandler.c:1.9 ComTerp/comhandler.c:1.10 *** ComTerp/comhandler.c:1.9 Sun May 21 02:14:05 2000 --- src/ComTerp/comhandler.c Tue Jun 6 11:50:19 2000 *************** *** 160,166 **** comterp_->_fd = fd; comterp_->_outfunc = (outfuncptr)&ComTerpServ::fd_fputs; ! int status = comterp_->ComTerp::run(false /* !once */); return (istr.good() ? 0 : -1) && status; } --- 160,166 ---- comterp_->_fd = fd; comterp_->_outfunc = (outfuncptr)&ComTerpServ::fd_fputs; ! int status = comterp_->ComTerp::run(false /* !once */, false /* !nested */); return (istr.good() ? 0 : -1) && status; } Index: ComTerp/comterp.c diff -c ComTerp/comterp.c:1.16 ComTerp/comterp.c:1.17 *** ComTerp/comterp.c:1.16 Sat May 20 02:22:20 2000 --- src/ComTerp/comterp.c Tue Jun 6 11:50:19 2000 *************** *** 103,109 **** /* Create ComValue symbol table */ _localtable = new ComValueTable(100); ! #if 0 if (!_globaltable) { _globaltable = new ComValueTable(100); } --- 103,109 ---- /* Create ComValue symbol table */ _localtable = new ComValueTable(100); ! #if 0 /* deferred until first use */ if (!_globaltable) { _globaltable = new ComValueTable(100); } *************** *** 693,699 **** _quitflag = flag; } ! int ComTerp::run(boolean one_expr) { int status = 1; _errbuf[0] = '\0'; char errbuf_save[BUFSIZ]; --- 693,699 ---- _quitflag = flag; } ! int ComTerp::run(boolean one_expr, boolean nested) { int status = 1; _errbuf[0] = '\0'; char errbuf_save[BUFSIZ]; *************** *** 713,719 **** if (read_expr()) { status = 0; int top_before = _stack_top; ! eval_expr(); if (top_before == _stack_top) status = 2; err_str( _errbuf, BUFSIZ, "comterp" ); --- 713,719 ---- if (read_expr()) { status = 0; int top_before = _stack_top; ! eval_expr(nested); if (top_before == _stack_top) status = 2; err_str( _errbuf, BUFSIZ, "comterp" ); *************** *** 741,750 **** if (errbuf_save[0]) strcpy(_errbuf, errbuf_save); } } ! _stack_top = -1; if (one_expr) break; } if (status==1 && _pfnum==0) status=2; return status; } --- 741,752 ---- if (errbuf_save[0]) strcpy(_errbuf, errbuf_save); } } ! if (!nested) ! _stack_top = -1; if (one_expr) break; } if (status==1 && _pfnum==0) status=2; + if (nested && status!=2) _stack_top--; return status; } Index: ComTerp/comterp.h diff -c ComTerp/comterp.h:1.7 ComTerp/comterp.h:1.8 *** ComTerp/comterp.h:1.7 Wed May 17 06:58:39 2000 --- src/ComTerp/comterp.h Tue Jun 6 11:50:19 2000 *************** *** 149,159 **** virtual void exit(int status=0); // call _exit(). ! virtual int run(boolean one_expr=false); // run interpreter until end-of-file or quit command, unless // 'one_expr' is true. Leave 'one_expr' false when using a ComTerpServ. // Return Value: -1 if eof, 0 if normal operation, 1 if ! // partial expression parsed, 2 if no result computed virtual int runfile(const char* filename); // run interpreter on contents of 'filename'. --- 149,160 ---- virtual void exit(int status=0); // call _exit(). ! virtual int run(boolean one_expr=false, boolean nested=false); // run interpreter until end-of-file or quit command, unless // 'one_expr' is true. Leave 'one_expr' false when using a ComTerpServ. // Return Value: -1 if eof, 0 if normal operation, 1 if ! // partial expression parsed, 2 if no result computed. 'nested' indicates ! // contents of stack should be preserved. virtual int runfile(const char* filename); // run interpreter on contents of 'filename'. Index: ComTerp/comterpserv.c diff -c ComTerp/comterpserv.c:1.2 ComTerp/comterpserv.c:1.3 *** ComTerp/comterpserv.c:1.2 Thu Feb 10 02:58:00 2000 --- src/ComTerp/comterpserv.c Tue Jun 6 11:50:19 2000 *************** *** 58,63 **** --- 58,71 ---- /* inform the parser which infunc is the oneshot infunc */ _oneshot_infunc = (infuncptr)&s_fgets; + + _npause = 0; + + /* Allocate servstate stack to initial size */ + _ctsstack_top = -1; + _ctsstack_siz = 256; + if(dmm_calloc((void**)&_ctsstack, _ctsstack_siz, sizeof(ComFuncState)) != 0) + KANRET("error in call to dmm_calloc"); } ComTerpServ::~ComTerpServ() { *************** *** 184,190 **** return 1; } ! int ComTerpServ::run() { char buffer[BUFSIZ]; char errbuf[BUFSIZ]; --- 192,198 ---- return 1; } ! int ComTerpServ::run(boolean one_expr, boolean nested) { char buffer[BUFSIZ]; char errbuf[BUFSIZ]; *************** *** 200,206 **** _linenum = 0; #if 1 ! ComTerp::run(); #else while (!feof(_fptr) && !quitflag()) { --- 208,214 ---- _linenum = 0; #if 1 ! ComTerp::run(one_expr, nested); #else while (!feof(_fptr) && !quitflag()) { *************** *** 409,415 **** load_string(script); read_expr(); } ! void ComTerpServ::add_defaults() { if (!_defaults_added) { ComTerp::add_defaults(); --- 417,423 ---- load_string(script); read_expr(); } ! void ComTerpServ::add_defaults() { if (!_defaults_added) { ComTerp::add_defaults(); *************** *** 417,420 **** --- 425,501 ---- add_command("eval", new EvalFunc(this)); } } + + ComTerpServState* ComTerpServ::top_servstate() { + return _ctsstack_top < 0 ? nil : _ctsstack+_ctsstack_top; + } + + void ComTerpServ::pop_servstate() { + if (_ctsstack_top >=0) { + + ComTerpServState* cts_state = top_servstate(); + + /* clean up */ + delete _buffer; + delete _pfbuf; + delete [] _pfcomvals; + + /* restore copies of everything */ + _pfbuf = cts_state->pfbuf(); + _pfnum = cts_state->pfnum(); + _pfoff = cts_state->pfoff(); + _bufptr = cts_state->bufptr(); + _linenum = cts_state->linenum(); + _just_reset = cts_state->just_reset(); + _buffer = cts_state->buffer(); + _pfcomvals = cts_state->pfcomvals(); + _infunc = cts_state->infunc(); + _eoffunc = cts_state->eoffunc(); + _errfunc = cts_state->errfunc(); + _inptr = cts_state->inptr(); + + _ctsstack_top--; + } + } + + void ComTerpServ::push_servstate() { + ComTerpServState cts_state; + + /* save copies of everything */ + cts_state.pfbuf() = _pfbuf; + cts_state.pfnum() = _pfnum; + cts_state.pfoff() = _pfoff; + cts_state.bufptr() = _bufptr; + cts_state.linenum() = _linenum; + cts_state.just_reset() = _just_reset; + cts_state.buffer() = _buffer; + cts_state.pfcomvals() = _pfcomvals; + cts_state.infunc() = _infunc; + cts_state.eoffunc() = _eoffunc; + cts_state.errfunc() = _errfunc; + cts_state.inptr() = _inptr; + + /* re-initialize */ + if(dmm_calloc((void**)&_pfbuf, _pfsiz, sizeof(postfix_token)) != 0) + KANRET("error in call to dmm_calloc"); + _pfnum = _pfoff = 0; + _buffer = new char[_bufsiz]; + _bufptr = 0; + _linenum = 0; + _just_reset = false; + _pfcomvals = nil; + + if (_ctsstack_top+1 == _ctsstack_siz) { + _ctsstack_siz *= 2; + dmm_realloc_size(sizeof(ComTerpServState)); + if(dmm_realloc((void**)&_ctsstack, (unsigned long)_ctsstack_siz) != 0) { + KANRET("error in call to dmm_realloc"); + return; + } + } + _ctsstack_top++; + ComTerpServState* ctss = _ctsstack + _ctsstack_top; + *ctss = cts_state; + } + Index: ComTerp/comterpserv.h diff -c ComTerp/comterpserv.h:1.2 ComTerp/comterpserv.h:1.3 *** ComTerp/comterpserv.h:1.2 Thu Feb 10 02:58:00 2000 --- src/ComTerp/comterpserv.h Tue Jun 6 11:50:19 2000 *************** *** 34,39 **** --- 34,41 ---- #include <ComTerp/comterp.h> + class ComTerpServState; + //: extended ComTerp that works with buffered IO. class ComTerpServ : public ComTerp { public: *************** *** 50,56 **** // generate buffer of length 'codelen' of postfix tokens ready // to be converted into ComValue objects and executed. ! virtual int run(); // run this interpreter until quit or exit command. virtual ComValue& run(const char*, boolean nested=false); // interpret and return value of expression. 'nested' flag used --- 52,58 ---- // generate buffer of length 'codelen' of postfix tokens ready // to be converted into ComValue objects and executed. ! virtual int run(boolean one_expr=false, boolean nested=false); // run this interpreter until quit or exit command. virtual ComValue& run(const char*, boolean nested=false); // interpret and return value of expression. 'nested' flag used *************** *** 68,73 **** --- 70,88 ---- virtual boolean is_serv() { return true; } // flag to test if ComTerp or ComTerpServ + int& npause() { return _npause; } + // return (reference to) number of pauses + + ComTerpServState* top_servstate(); + // return pointer to top state on ComTerpServ state stack + + void push_servstate(); + // push ComTerpServ state for later retrieval + + void pop_servstate(); + // pop ComTerpServ state that was saved earlier + + protected: static char* s_fgets(char* s, int n, void* serv); *************** *** 91,99 **** --- 106,158 ---- int _fd; FILE* _fptr; int _instat; + int _npause; + ComTerpServState* _ctsstack; // stack of ComTerpServ state + int _ctsstack_top; + unsigned int _ctsstack_siz; + friend class ComterpHandler; friend class ComTerpIOHandler; }; + //: object for holding ComTerpServ state + // object that holds the state of a ComTerpServ + // which allows for nested and recursive use of a singular ComTerpServ + class ComTerpServState { + public: + ComTerpServState() {} + ComTerpServState(ComTerpServState& ctss) { *this = ctss; } + // copy constructor. + + postfix_token*& pfbuf() { return _pfbuf; } + int& pfnum() { return _pfnum; } + int& pfoff() { return _pfoff; } + int& bufptr() { return _bufptr; } + int& bufsiz() { return _bufsiz; } + int& linenum() { return _linenum; } + int& just_reset() { return _just_reset; } + char*& buffer() { return _buffer; } + ComValue*& pfcomvals() { return _pfcomvals; } + infuncptr& infunc() { return _infunc; } + eoffuncptr& eoffunc() { return _eoffunc; } + errfuncptr& errfunc() { return _errfunc; } + void*& inptr() { return _inptr; } + + protected: + + postfix_token* _pfbuf; + int _pfnum; + int _pfoff; + int _bufptr; + int _linenum; + int _just_reset; + char* _buffer; + int _bufsiz; + ComValue* _pfcomvals; + infuncptr _infunc; + eoffuncptr _eoffunc; + errfuncptr _errfunc; + void* _inptr; + }; #endif Index: ComGlyph/comtextedit.h diff -c ComGlyph/comtextedit.h:1.1 ComGlyph/comtextedit.h:1.2 *** ComGlyph/comtextedit.h:1.1 Sat Feb 26 03:07:46 2000 --- src/ComGlyph/comtextedit.h Tue Jun 6 11:50:51 2000 *************** *** 52,58 **** class ComTextEditor : public EivTextEditor { public: ComTextEditor(Style*, ComTerpServ* comterp=nil, boolean active=true); ! virtual ~ComTextEditor(); ComTE_View* comtextview(); }; --- 52,59 ---- class ComTextEditor : public EivTextEditor { public: ComTextEditor(Style*, ComTerpServ* comterp=nil, boolean active=true); ! virtual ~ComTextEditor(); ! ComTE_View* comtextview(); }; Index: ComGlyph/comtextview.c diff -c ComGlyph/comtextview.c:1.2 ComGlyph/comtextview.c:1.3 *** ComGlyph/comtextview.c:1.2 Mon Feb 28 17:33:01 2000 --- src/ComGlyph/comtextview.c Tue Jun 6 11:50:51 2000 *************** *** 146,151 **** --- 146,158 ---- end_of_line(); int dot = text_editor_->Dot(); int len = dot-mark; + + /* zero-length input happens when only a C/R was entered, which means unpause */ + /* if pause is active */ + if (!len && comterp()->npause()) { + comterp()->npause()--; + return; + } char* buffer = new char [len+1]; te_buffer_->Copy(mark, buffer, len); buffer[len] = '\0'; *************** *** 217,225 **** /* load and interpret if expression closed */ comterp()->load_string(bufptr); ! int status = comterp()->ComTerp::run(false /* !once */); comterp()->linenum()--; ComValue result(comterp()->stack_top(1)); ostream* out = new strstream(); if (*comterp()->errmsg()) { *out << comterp()->errmsg() << "\n"; --- 224,236 ---- /* load and interpret if expression closed */ comterp()->load_string(bufptr); ! int status = comterp()->ComTerp::run(false /* !once */, true /* nested */); comterp()->linenum()--; + #if 1 ComValue result(comterp()->stack_top(1)); + #else + ComValue result(comterp()->pop_stack()); + #endif ostream* out = new strstream(); if (*comterp()->errmsg()) { *out << comterp()->errmsg() << "\n"; Index: OverlayUnidraw/ovunidraw.c diff -c OverlayUnidraw/ovunidraw.c:1.1 OverlayUnidraw/ovunidraw.c:1.2 *** OverlayUnidraw/ovunidraw.c:1.1 Tue Jan 18 03:10:55 2000 --- src/OverlayUnidraw/ovunidraw.c Tue Jun 6 11:51:00 2000 *************** *** 54,61 **** --- 54,68 ---- #include <IV-X11/xevent.h> #include <IV-X11/xwindow.h> + #include <ComTerp/comterpserv.h> + #include <iostream.h> + MacroCmd* OverlayUnidraw::_cmdq = nil; + boolean* OverlayUnidraw::_updated_ptr = nil; + ComTerpServ* OverlayUnidraw::_comterp = nil; + int OverlayUnidraw::_npause = nil; + /*****************************************************************************/ OverlayUnidraw::OverlayUnidraw (Catalog* c, int& argc, char** argv, *************** *** 63,68 **** --- 70,77 ---- : Unidraw(c, argc, argv, od, pd) { _cmdq = new MacroCmd(); _ovviewer = nil; + _comterp = nil; + _npause = 0; /* replace default Painter with an OverlayPainter */ OverlayGraphic::new_painter(); *************** *** 72,77 **** --- 81,88 ---- : Unidraw(c, w) { _cmdq = new MacroCmd(); _ovviewer = nil; + _comterp = nil; + _npause = 0; } OverlayUnidraw::~OverlayUnidraw () *************** *** 84,93 **** _cmdq->Append(cmd); } - MacroCmd* OverlayUnidraw::_cmdq = nil; - boolean* OverlayUnidraw::_updated_ptr = nil; boolean OverlayUnidraw::unidraw_updated() { return *_updated_ptr; } boolean OverlayUnidraw::unidraw_updated_or_command_pushed() { --- 95,104 ---- _cmdq->Append(cmd); } boolean OverlayUnidraw::unidraw_updated() { return *_updated_ptr; } + boolean OverlayUnidraw::npause_lessened() + { return _comterp && _npause > _comterp->npause(); } boolean OverlayUnidraw::unidraw_updated_or_command_pushed() { *************** *** 96,113 **** return !_cmdq->Done(it) || unidraw_updated(); } void OverlayUnidraw::Run () { Session* session = GetWorld()->session(); Event e; Iterator it; alive(true); ! while (alive() && !session->done()) { updated(false); _updated_ptr = &_updated; // session->read(e, &unidraw_updated); ! session->read(e, &unidraw_updated_or_command_pushed); if (!updated()) { e.handle(); session->default_display()->flush(); --- 107,133 ---- return !_cmdq->Done(it) || unidraw_updated(); } + boolean OverlayUnidraw::unidraw_updated_or_command_pushed_or_npause_lessened() + { + Iterator it; + _cmdq->First(it); + return !_cmdq->Done(it) || unidraw_updated() || npause_lessened(); + } + void OverlayUnidraw::Run () { Session* session = GetWorld()->session(); Event e; Iterator it; alive(true); + _npause = _comterp ? _comterp->npause() : 0; ! while (alive() && !session->done() && !npause_lessened()) { updated(false); _updated_ptr = &_updated; // session->read(e, &unidraw_updated); ! // session->read(e, &unidraw_updated_or_command_pushed); ! session->read(e, &unidraw_updated_or_command_pushed_or_npause_lessened); if (!updated()) { e.handle(); session->default_display()->flush(); *************** *** 126,131 **** --- 146,153 ---- Update(true); } } + _npause = _comterp ? _comterp->npause() : 0; + } void OverlayUnidraw::Log (Command* cmd, boolean dirty) { *************** *** 191,193 **** --- 213,223 ---- } } } + + + + + + + + Index: OverlayUnidraw/ovunidraw.h diff -c OverlayUnidraw/ovunidraw.h:1.1 OverlayUnidraw/ovunidraw.h:1.2 *** OverlayUnidraw/ovunidraw.h:1.1 Tue Jan 18 03:10:55 2000 --- src/OverlayUnidraw/ovunidraw.h Tue Jun 6 11:51:00 2000 *************** *** 31,36 **** --- 31,37 ---- #include <Unidraw/unidraw.h> class Command; + class ComTerpServ; class Event; class MacroCmd; class OverlayViewer; *************** *** 53,68 **** --- 54,76 ---- void Append(Command*); static boolean unidraw_updated(); + static boolean npause_lessened(); static boolean unidraw_updated_or_command_pushed(); + static boolean unidraw_updated_or_command_pushed_or_npause_lessened(); static void pointer_tracker_func(Event&); void CurrentViewer(OverlayViewer* viewer) { _ovviewer = viewer; } OverlayViewer* CurrentViewer() { return _ovviewer; } + + ComTerpServ* comterp() { return _comterp; } + void comterp(ComTerpServ* comterp) { _comterp = comterp; } protected: static MacroCmd* _cmdq; static boolean* _updated_ptr; OverlayViewer* _ovviewer; + static ComTerpServ* _comterp; + static int _npause; }; #endif Index: ComUnidraw/comeditor.c diff -c ComUnidraw/comeditor.c:1.11 ComUnidraw/comeditor.c:1.12 *** ComUnidraw/comeditor.c:1.11 Wed May 31 12:01:26 2000 --- src/ComUnidraw/comeditor.c Tue Jun 6 11:51:04 2000 *************** *** 40,45 **** --- 40,46 ---- #include <OverlayUnidraw/ovclasses.h> #include <OverlayUnidraw/ovcomps.h> + #include <OverlayUnidraw/ovunidraw.h> #include <OverlayUnidraw/scriptview.h> #include <Unidraw/catalog.h> *************** *** 94,99 **** --- 95,101 ---- void ComEditor::Init (OverlayComp* comp, const char* name) { if (!comp) comp = new OverlayIdrawComp; _terp = new ComTerpServ(); + ((OverlayUnidraw*)unidraw)->comterp(_terp); AddCommands(_terp); char buffer[BUFSIZ]; sprintf(buffer, "Comdraw%d", ncomterp()); *************** *** 105,111 **** void ComEditor::InitCommands() { if (!_terp) _terp = new ComTerpServ(); ! const char* comdraw_off_str = unidraw->GetCatalog()->GetAttribute("comdraw_off"); if ((!comterplist() || comterplist()->Number()==1) && (comdraw_off_str ? strcmp(comdraw_off_str, "false")==0 : true)) _terp_iohandler = new ComTerpIOHandler(_terp, stdin); --- 107,113 ---- void ComEditor::InitCommands() { if (!_terp) _terp = new ComTerpServ(); ! const char* comdraw_off_str = unidraw->GetCatalog()->GetAttribute("comdraw_off"); if ((!comterplist() || comterplist()->Number()==1) && (comdraw_off_str ? strcmp(comdraw_off_str, "false")==0 : true)) _terp_iohandler = new ComTerpIOHandler(_terp, stdin); *************** *** 194,199 **** --- 196,203 ---- comterp->add_command("growgroup", new GrowGroupFunc(comterp, this)); comterp->add_command("trimgroup", new TrimGroupFunc(comterp, this)); + + comterp->add_command("pause", new UnidrawPauseFunc(comterp, this)); } /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) { Index: ComUnidraw/unifunc.c diff -c ComUnidraw/unifunc.c:1.5 ComUnidraw/unifunc.c:1.6 *** ComUnidraw/unifunc.c:1.5 Fri May 19 11:20:39 2000 --- src/ComUnidraw/unifunc.c Tue Jun 6 11:51:04 2000 *************** *** 29,34 **** --- 29,36 ---- #include <OverlayUnidraw/ovimport.h> #include <OverlayUnidraw/ovselection.h> #include <OverlayUnidraw/ovviews.h> + #include <ComGlyph/comtextedit.h> + #include <ComGlyph/comtextview.h> #include <Unidraw/clipboard.h> #include <Unidraw/creator.h> #include <Unidraw/globals.h> *************** *** 40,49 **** #include <Unidraw/Graphic/graphic.h> #include <InterViews/transformer.h> #include <InterViews/window.h> ! #include <ComTerp/comterp.h> #include <ComTerp/comvalue.h> #include <Attribute/attrlist.h> #include <stdio.h> #include <unistd.h> #define TITLE "UnidrawFunc" --- 42,52 ---- #include <Unidraw/Graphic/graphic.h> #include <InterViews/transformer.h> #include <InterViews/window.h> ! #include <ComTerp/comterpserv.h> #include <ComTerp/comvalue.h> #include <Attribute/attrlist.h> #include <stdio.h> + #include <strstream.h> #include <unistd.h> #define TITLE "UnidrawFunc" *************** *** 255,264 **** ComponentView* view = (ComponentView*)viewval.obj_val(); OverlayComp* comp = (OverlayComp*)view->GetSubject(); ! AttributeList* comp_al = comp->attrlist(); ! if (!comp_al) comp->SetAttributeList(al); ! else { comp_al->merge(al); delete al; } --- 258,267 ---- ComponentView* view = (ComponentView*)viewval.obj_val(); OverlayComp* comp = (OverlayComp*)view->GetSubject(); ! AttributeList* comp_al = comp ? comp->attrlist() : nil; ! if (!comp_al && comp) comp->SetAttributeList(al); ! else if (comp_al) { comp_al->merge(al); delete al; } *************** *** 283,287 **** --- 286,326 ---- push_stack(retval); } else push_stack(ComValue::nullval()); + } + + /*****************************************************************************/ + + UnidrawPauseFunc::UnidrawPauseFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { + } + + void UnidrawPauseFunc::execute() { + ComValue msgstrv(stack_arg(0)); + reset_stack(); + comterpserv()->npause()++; + + ComTextEditor* te = (ComTextEditor*) + ((OverlayEditor*)GetEditor())->TextEditor(); + if (te) { + ComTE_View* tv = te->comtextview(); + if (tv) { + if (msgstrv.is_string()) { + tv->insert_string((char*)msgstrv.string_ptr(), strlen(msgstrv.string_ptr())); + tv->insert_char('\n'); + } + ostrstream sbuf_s; + sbuf_s << "pause(" << comterpserv()->npause() << "): enter command or press C/R to continue\n"; + sbuf_s.put('\0'); + tv->insert_string(sbuf_s.str(), strlen(sbuf_s.str())); + comterpserv()->push_servstate(); + unidraw->Run(); + comterpserv()->pop_servstate(); + ostrstream sbuf_e; + sbuf_e << "end of pause(" << comterpserv()->npause()+1 << ")\n"; + sbuf_e.put('\0'); + tv->insert_string(sbuf_e.str(), strlen(sbuf_e.str())); + } + } else { + cerr << "this version of pause command only works with ComTextEditor\n"; + } } Index: ComUnidraw/unifunc.h diff -c ComUnidraw/unifunc.h:1.3 ComUnidraw/unifunc.h:1.4 *** ComUnidraw/unifunc.h:1.3 Fri May 19 11:20:39 2000 --- src/ComUnidraw/unifunc.h Tue Jun 6 11:51:04 2000 *************** *** 127,131 **** --- 127,142 ---- }; + //: command to pause script execution until C/R + // pause -- pause script execution until C/R + class UnidrawPauseFunc : public UnidrawFunc { + public: + UnidrawPauseFunc(ComTerp*,Editor*); + virtual void execute(); + virtual const char* docstring() { + return "pause -- pause script execution until C/R"; } + + }; + #endif /* !defined(_unifunc_h) */ Index: comdraw/README diff -c comdraw/README:1.7 comdraw/README:1.8 *** comdraw/README:1.7 Wed May 31 12:01:30 2000 --- src/comdraw/README Tue Jun 6 11:51:05 2000 *************** *** 118,123 **** --- 118,124 ---- run(filename) -- run commands from file quit() -- quit this interpreter exit() -- exit entire application + pause([msgstr]) -- pause script execution until C/R OPTIONS Index: man1_ivtools/comdraw.1 diff -c man1_ivtools/comdraw.1:1.9 man1_ivtools/comdraw.1:1.10 *** man1_ivtools/comdraw.1:1.9 Wed May 31 12:01:46 2000 --- src/man/man1/comdraw.1 Tue Jun 6 11:51:19 2000 *************** *** 131,136 **** --- 131,137 ---- run(filename) -- run commands from file quit() -- quit this interpreter exit() -- exit entire application + pause([msgstr]) -- pause script execution until C/R .SH OPTIONS *** /dev/null Tue Jun 6 11:51:27 PDT 2000 --- patches/ivtools-000606-johnston-064 *************** patches/ivtools-000606-johnston-064 *** 0 **** --- 1 ---- + ivtools-000606-johnston-064 |
From: <ivt...@li...> - 2000-06-01 07:00:42
|
Patch: ivtools-000601-johnston-063 For: ivtools-0.8.2 Author: joh...@us... Subject: fix bug in comdraw select command to show changes in viewer Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - fix bug in comdraw "select" command, so that changes to the current selection are graphically represented in the viewer. Index: ComUnidraw/grfunc.c diff -c ComUnidraw/grfunc.c:1.8 ComUnidraw/grfunc.c:1.9 *** ComUnidraw/grfunc.c:1.8 Sat May 27 00:49:12 2000 --- src/ComUnidraw/grfunc.c Thu Jun 1 13:00:18 2000 *************** *** 729,737 **** } if (newSel){ delete sel; _ed->SetSelection(newSel); ! newSel->Update(); unidraw->Update(); } reset_stack(); --- 729,738 ---- } if (newSel){ + sel->Clear(); delete sel; _ed->SetSelection(newSel); ! newSel->Update(viewer); unidraw->Update(); } reset_stack(); *** /dev/null Thu Jun 1 13:00:33 PDT 2000 --- patches/ivtools-000601-johnston-063 *************** patches/ivtools-000601-johnston-063 *** 0 **** --- 1 ---- + ivtools-000601-johnston-063 |
From: <ivt...@li...> - 2000-05-31 05:54:15
|
Patch: ivtools-000531-johnston-062 For: ivtools-0.8.2 Author: joh...@us... Subject: add comdraw trimgroup command Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - add comdraw "trimgroup" command, to reverse the effect of a "growgroup" command: newgroup=trimgroup(groupview compview) -- remove graphic from existing group graphic Underneath the hood this a macro command (MacroCmd) with an ungroup command (UngroupCmd) followed by group command (OvGroupCmd) with the specified graphic removed from the list. This does not delete that graphic, but that can be done with a "delete" command if so desired. Index: ComUnidraw/comeditor.c diff -c ComUnidraw/comeditor.c:1.10 ComUnidraw/comeditor.c:1.11 *** ComUnidraw/comeditor.c:1.10 Wed May 31 06:29:26 2000 --- src/ComUnidraw/comeditor.c Wed May 31 12:01:26 2000 *************** *** 191,197 **** --- 191,199 ---- comterp->add_command("highlight", new HighlightFunc(comterp, this)); comterp->add_command("frame", new FrameFunc(comterp, this)); + comterp->add_command("growgroup", new GrowGroupFunc(comterp, this)); + comterp->add_command("trimgroup", new TrimGroupFunc(comterp, this)); } /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) { Index: ComUnidraw/groupfunc.c diff -c ComUnidraw/groupfunc.c:1.1 ComUnidraw/groupfunc.c:1.2 *** ComUnidraw/groupfunc.c:1.1 Wed May 31 06:35:51 2000 --- src/ComUnidraw/groupfunc.c Wed May 31 12:01:28 2000 *************** *** 40,59 **** void GrowGroupFunc::execute() { ComValue groupval(stack_arg(0)); ! ComValue newval(stack_arg(1)); reset_stack(); ! if (!groupval.object_compview() && !newval.object_compview()) return; OverlayViewer* viewer = (OverlayViewer*)GetEditor()->GetViewer(); ComponentView* groupview = (ComponentView*)groupval.obj_val(); OverlayComp* groupcomp = groupview ? (OverlayComp*)groupview->GetSubject() : nil; ! ComponentView* newview = (ComponentView*)newval.obj_val(); ! OverlayComp* newcomp = newview ? (OverlayComp*)newview->GetSubject() : nil; ! if (groupcomp && newcomp) { /* first determine if group has non-zero members */ Iterator i; --- 40,59 ---- void GrowGroupFunc::execute() { ComValue groupval(stack_arg(0)); ! ComValue grval(stack_arg(1)); reset_stack(); ! if (!groupval.object_compview() && !grval.object_compview()) return; OverlayViewer* viewer = (OverlayViewer*)GetEditor()->GetViewer(); ComponentView* groupview = (ComponentView*)groupval.obj_val(); OverlayComp* groupcomp = groupview ? (OverlayComp*)groupview->GetSubject() : nil; ! ComponentView* grview = (ComponentView*)grval.obj_val(); ! OverlayComp* grcomp = grview ? (OverlayComp*)grview->GetSubject() : nil; ! if (groupcomp && grcomp) { /* first determine if group has non-zero members */ Iterator i; *************** *** 76,90 **** Clipboard* gcb = new Clipboard(); for(; !groupcomp->Done(i); groupcomp->Next(i)) gcb->Append(groupcomp->GetComp(i)); ! gcb->Append(newcomp); OvGroupCmd* gcmd = new OvGroupCmd(GetEditor()); ! OverlaysComp* newgroup = new OverlaysComp(); ! gcmd->SetGroup(newgroup); gcmd->SetClipboard(gcb); mcmd->Append(gcmd); execute_log(mcmd); ! ComValue retval(OverlaysComp::class_symid(), new ComponentView(newgroup)); retval.object_compview(true); push_stack(retval); return; --- 76,158 ---- Clipboard* gcb = new Clipboard(); for(; !groupcomp->Done(i); groupcomp->Next(i)) gcb->Append(groupcomp->GetComp(i)); ! gcb->Append(grcomp); OvGroupCmd* gcmd = new OvGroupCmd(GetEditor()); ! OverlaysComp* grgroup = new OverlaysComp(); ! grgroup->SetAttributeList(groupcomp->attrlist()); ! gcmd->SetGroup(grgroup); gcmd->SetClipboard(gcb); mcmd->Append(gcmd); execute_log(mcmd); ! ComValue retval(OverlaysComp::class_symid(), new ComponentView(grgroup)); ! retval.object_compview(true); ! push_stack(retval); ! return; ! } ! ! push_stack(ComValue::nullval()); ! } ! ! /*****************************************************************************/ ! ! TrimGroupFunc::TrimGroupFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { ! } ! ! void TrimGroupFunc::execute() { ! ComValue groupval(stack_arg(0)); ! ComValue grval(stack_arg(1)); ! ! reset_stack(); ! if (!groupval.object_compview() && !grval.object_compview()) return; ! ! OverlayViewer* viewer = (OverlayViewer*)GetEditor()->GetViewer(); ! ! ComponentView* groupview = (ComponentView*)groupval.obj_val(); ! OverlayComp* groupcomp = groupview ? (OverlayComp*)groupview->GetSubject() : nil; ! ! ComponentView* grview = (ComponentView*)grval.obj_val(); ! OverlayComp* grcomp = grview ? (OverlayComp*)grview->GetSubject() : nil; ! ! if (groupcomp && grcomp) { ! ! /* first determine if individual graphic really is in the group graphic */ ! Iterator i; ! groupcomp->First(i); ! boolean found = false; ! while (!groupcomp->Done(i) && !found) { ! GraphicComp* subcomp = groupcomp->GetComp(i); ! if (subcomp==grcomp) found = true; ! groupcomp->Next(i); ! } ! if (!found) { ! push_stack(ComValue::nullval()); ! return; ! } ! ! MacroCmd* mcmd = new MacroCmd(GetEditor()); ! ! /* ungroup */ ! Clipboard* ucb = new Clipboard(); ! ucb->Append(groupcomp); ! UngroupCmd* ucmd = new UngroupCmd(GetEditor()); ! ucmd->SetClipboard(ucb); ! mcmd->Append(ucmd); ! ! /* regroup */ ! Clipboard* gcb = new Clipboard(); ! for(groupcomp->First(i); !groupcomp->Done(i); groupcomp->Next(i)) ! if (groupcomp->GetComp(i) != grcomp) ! gcb->Append(groupcomp->GetComp(i)); ! OvGroupCmd* gcmd = new OvGroupCmd(GetEditor()); ! OverlaysComp* grgroup = new OverlaysComp(); ! grgroup->SetAttributeList(groupcomp->attrlist()); ! gcmd->SetGroup(grgroup); ! gcmd->SetClipboard(gcb); ! mcmd->Append(gcmd); ! ! execute_log(mcmd); ! ComValue retval(OverlaysComp::class_symid(), new ComponentView(grgroup)); retval.object_compview(true); push_stack(retval); return; Index: ComUnidraw/groupfunc.h diff -c ComUnidraw/groupfunc.h:1.1 ComUnidraw/groupfunc.h:1.2 *** ComUnidraw/groupfunc.h:1.1 Wed May 31 06:35:52 2000 --- src/ComUnidraw/groupfunc.h Wed May 31 12:01:28 2000 *************** *** 27,39 **** #include <ComUnidraw/unifunc.h> //: command to add graphic to existing group graphic ! // growgroup(groupview compview) -- add graphic to existing group graphic class GrowGroupFunc : public UnidrawFunc { public: GrowGroupFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "%s(groupview compview) -- add graphic to existing group graphic"; } }; #endif /* !defined(_groupfunc_h) */ --- 27,49 ---- #include <ComUnidraw/unifunc.h> //: command to add graphic to existing group graphic ! // newgroup=growgroup(groupview compview) -- add graphic to existing group graphic class GrowGroupFunc : public UnidrawFunc { public: GrowGroupFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "newgroup=%s(groupview compview) -- add graphic to existing group graphic"; } ! }; ! ! //: command to remove graphic from existing group graphic ! // newgroup=trimgroup(groupview compview) -- remove graphic from existing group graphic ! class TrimGroupFunc : public UnidrawFunc { ! public: ! TrimGroupFunc(ComTerp*,Editor*); ! virtual void execute(); ! virtual const char* docstring() { ! return "newgroup=%s(groupview compview) -- remove graphic from existing group graphic"; } }; #endif /* !defined(_groupfunc_h) */ Index: comdraw/README diff -c comdraw/README:1.6 comdraw/README:1.7 *** comdraw/README:1.6 Wed May 31 06:29:28 2000 --- src/comdraw/README Wed May 31 12:01:30 2000 *************** *** 66,72 **** GROUP/UNGROUP COMMANDS ! growgroup(groupview compview) -- add graphic to existing group graphic COMPONENT AND ATTRIBUTE COMMANDS --- 66,73 ---- GROUP/UNGROUP COMMANDS ! newgroup=growgroup(groupview compview) -- add graphic to existing group graphic ! newgroup=trimgroup(groupview compview) -- remove graphic from existing group graphic COMPONENT AND ATTRIBUTE COMMANDS Index: man1_ivtools/comdraw.1 diff -c man1_ivtools/comdraw.1:1.8 man1_ivtools/comdraw.1:1.9 *** man1_ivtools/comdraw.1:1.8 Wed May 31 06:29:44 2000 --- src/man/man1/comdraw.1 Wed May 31 12:01:46 2000 *************** *** 74,80 **** .SH GROUP/UNGROUP COMMANDS ! growgroup(groupview compview) -- add graphic to existing group graphic .SH COMPONENT AND ATTRIBUTE COMMANDS --- 74,81 ---- .SH GROUP/UNGROUP COMMANDS ! newgroup=growgroup(groupview compview) -- add graphic to existing group graphic ! newgroup=trimgroup(groupview compview) -- remove graphic from existing group graphic .SH COMPONENT AND ATTRIBUTE COMMANDS *** /dev/null Wed May 31 12:01:54 PDT 2000 --- patches/ivtools-000531-johnston-062 *************** patches/ivtools-000531-johnston-062 *** 0 **** --- 1 ---- + ivtools-000531-johnston-062 |
From: <ivt...@li...> - 2000-05-31 00:25:49
|
Patch: ivtools-000531-johnston-061 For: ivtools-0.8.2 Author: joh...@us... Subject: add ComUnidraw/groupfunc.[ch] Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - add src/ComUnidraw/groupfunc.[ch] Index: ComUnidraw/groupfunc.c diff -c /dev/null ComUnidraw/groupfunc.c:1.1 *** /dev/null Wed May 31 06:35:55 2000 --- src/ComUnidraw/groupfunc.c Wed May 31 06:35:51 2000 *************** *** 0 **** --- 1,98 ---- + /* + * Copyright (c) 2000 IET Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + #include <ComUnidraw/groupfunc.h> + #include <OverlayUnidraw/ovcmds.h> + #include <OverlayUnidraw/ovcomps.h> + #include <OverlayUnidraw/oved.h> + #include <OverlayUnidraw/ovviews.h> + #include <OverlayUnidraw/ovviewer.h> + #include <Unidraw/Commands/macro.h> + #include <Unidraw/Commands/struct.h> + #include <Unidraw/clipboard.h> + #include <Unidraw/iterator.h> + #include <iostream.h> + + /*****************************************************************************/ + + GrowGroupFunc::GrowGroupFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { + } + + void GrowGroupFunc::execute() { + ComValue groupval(stack_arg(0)); + ComValue newval(stack_arg(1)); + + reset_stack(); + if (!groupval.object_compview() && !newval.object_compview()) return; + + OverlayViewer* viewer = (OverlayViewer*)GetEditor()->GetViewer(); + + ComponentView* groupview = (ComponentView*)groupval.obj_val(); + OverlayComp* groupcomp = groupview ? (OverlayComp*)groupview->GetSubject() : nil; + + ComponentView* newview = (ComponentView*)newval.obj_val(); + OverlayComp* newcomp = newview ? (OverlayComp*)newview->GetSubject() : nil; + + if (groupcomp && newcomp) { + + /* first determine if group has non-zero members */ + Iterator i; + groupcomp->First(i); + if (groupcomp->Done(i)) { + push_stack(ComValue::nullval()); + return; + } + + MacroCmd* mcmd = new MacroCmd(GetEditor()); + + /* ungroup */ + Clipboard* ucb = new Clipboard(); + ucb->Append(groupcomp); + UngroupCmd* ucmd = new UngroupCmd(GetEditor()); + ucmd->SetClipboard(ucb); + mcmd->Append(ucmd); + + /* regroup */ + Clipboard* gcb = new Clipboard(); + for(; !groupcomp->Done(i); groupcomp->Next(i)) + gcb->Append(groupcomp->GetComp(i)); + gcb->Append(newcomp); + OvGroupCmd* gcmd = new OvGroupCmd(GetEditor()); + OverlaysComp* newgroup = new OverlaysComp(); + gcmd->SetGroup(newgroup); + gcmd->SetClipboard(gcb); + mcmd->Append(gcmd); + + execute_log(mcmd); + ComValue retval(OverlaysComp::class_symid(), new ComponentView(newgroup)); + retval.object_compview(true); + push_stack(retval); + return; + } + + push_stack(ComValue::nullval()); + } + + + + Index: ComUnidraw/groupfunc.h diff -c /dev/null ComUnidraw/groupfunc.h:1.1 *** /dev/null Wed May 31 06:35:55 2000 --- src/ComUnidraw/groupfunc.h Wed May 31 06:35:52 2000 *************** *** 0 **** --- 1,39 ---- + /* + * Copyright (c) 2000 IET Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + #if !defined(groupfunc_h) + #define _groupfunc_h + + #include <ComUnidraw/unifunc.h> + + //: command to add graphic to existing group graphic + // growgroup(groupview compview) -- add graphic to existing group graphic + class GrowGroupFunc : public UnidrawFunc { + public: + GrowGroupFunc(ComTerp*,Editor*); + virtual void execute(); + virtual const char* docstring() { + return "%s(groupview compview) -- add graphic to existing group graphic"; } + }; + + #endif /* !defined(_groupfunc_h) */ *** /dev/null Wed May 31 06:36:13 PDT 2000 --- patches/ivtools-000531-johnston-061 *************** patches/ivtools-000531-johnston-061 *** 0 **** --- 1 ---- + ivtools-000531-johnston-061 |
From: <ivt...@li...> - 2000-05-31 00:23:33
|
Patch: ivtools-000531-johnston-060 For: ivtools-0.8.2 Author: joh...@us... Subject: comdraw growgroup command replaces reorder command Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - in comdraw, replace the partially implemented "reorder" with a fully working "growgroup" command: newgroup=growgroup(groupview compview) -- add graphic to existing group graphic This is implemented with a MacroCmd (macro command) that has two members, an UngroupCmd to break down the initial group into its constituent parts, and an (Ov)GroupCmd to build it back up to include the new graphic. Index: top_ivtools/MANIFEST diff -c top_ivtools/MANIFEST:1.9 top_ivtools/MANIFEST:1.10 *** top_ivtools/MANIFEST:1.9 Fri May 19 11:19:57 2000 --- ./MANIFEST Wed May 31 06:28:47 2000 *************** *** 200,205 **** --- 200,207 ---- ivtools-0.8/src/ComUnidraw/grfunc.h ivtools-0.8/src/ComUnidraw/grlistfunc.c ivtools-0.8/src/ComUnidraw/grlistfunc.h + ivtools-0.8/src/ComUnidraw/groupfunc.c + ivtools-0.8/src/ComUnidraw/groupfunc.h ivtools-0.8/src/ComUnidraw/grstatfunc.c ivtools-0.8/src/ComUnidraw/grstatfunc.h ivtools-0.8/src/ComUnidraw/highlightfunc.c Index: top_ivtools/MANIFEST.perceps diff -c top_ivtools/MANIFEST.perceps:1.6 top_ivtools/MANIFEST.perceps:1.7 *** top_ivtools/MANIFEST.perceps:1.6 Fri May 19 11:19:58 2000 --- ./MANIFEST.perceps Wed May 31 06:28:47 2000 *************** *** 50,55 **** --- 50,56 ---- ComUnidraw/grdotfunc.h ComUnidraw/grfunc.h ComUnidraw/grlistfunc.h + ComUnidraw/groupfunc.h ComUnidraw/grstatfunc.h ComUnidraw/highlightfunc.h ComUnidraw/nfunc.h Index: OverlayUnidraw/ovcomps.c diff -c OverlayUnidraw/ovcomps.c:1.6 OverlayUnidraw/ovcomps.c:1.7 *** OverlayUnidraw/ovcomps.c:1.6 Fri May 19 11:20:33 2000 --- src/OverlayUnidraw/ovcomps.c Wed May 31 06:29:20 2000 *************** *** 919,926 **** void OverlaysComp::InsertAfter (Iterator i, GraphicComp* comp) { Graphic* g = comp->GetGraphic(); Graphic* parent; ! ! Elem(i)->Prepend(new UList(comp)); if (g != nil) { Iterator j; --- 919,931 ---- void OverlaysComp::InsertAfter (Iterator i, GraphicComp* comp) { Graphic* g = comp->GetGraphic(); Graphic* parent; ! ! if (Elem(i)) ! Elem(i)->Prepend(new UList(comp)); ! else { ! cerr << "OverlaysComp::InsertAfter -- Iterator has nil value\n"; ! return; ! } if (g != nil) { Iterator j; Index: ComUnidraw/Imakefile diff -c ComUnidraw/Imakefile:1.5 ComUnidraw/Imakefile:1.6 *** ComUnidraw/Imakefile:1.5 Fri May 19 11:20:38 2000 --- src/ComUnidraw/Imakefile Wed May 31 06:29:26 2000 *************** *** 20,25 **** --- 20,26 ---- Obj26(grdotfunc) Obj26(grfunc) Obj26(grlistfunc) + Obj26(groupfunc) Obj26(grstatfunc) Obj26(highlightfunc) Obj26(comeditor) Index: ComUnidraw/comeditor.c diff -c ComUnidraw/comeditor.c:1.9 ComUnidraw/comeditor.c:1.10 *** ComUnidraw/comeditor.c:1.9 Sat May 27 00:49:12 2000 --- src/ComUnidraw/comeditor.c Wed May 31 06:29:26 2000 *************** *** 25,30 **** --- 25,31 ---- #include <ComUnidraw/grdotfunc.h> #include <ComUnidraw/grfunc.h> #include <ComUnidraw/grlistfunc.h> + #include <ComUnidraw/groupfunc.h> #include <ComUnidraw/grstatfunc.h> #include <ComUnidraw/highlightfunc.h> #include <ComUnidraw/comeditor.h> *************** *** 190,196 **** comterp->add_command("highlight", new HighlightFunc(comterp, this)); comterp->add_command("frame", new FrameFunc(comterp, this)); ! comterp->add_command("reorder", new ReorderFunc(comterp, this)); } /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) { --- 191,197 ---- comterp->add_command("highlight", new HighlightFunc(comterp, this)); comterp->add_command("frame", new FrameFunc(comterp, this)); ! comterp->add_command("growgroup", new GrowGroupFunc(comterp, this)); } /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) { Index: comdraw/README diff -c comdraw/README:1.5 comdraw/README:1.6 *** comdraw/README:1.5 Mon May 22 02:10:09 2000 --- src/comdraw/README Wed May 31 06:29:28 2000 *************** *** 64,69 **** --- 64,73 ---- scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection + GROUP/UNGROUP COMMANDS + + growgroup(groupview compview) -- add graphic to existing group graphic + COMPONENT AND ATTRIBUTE COMMANDS compview=setattr(compview [:keyword value [:keyword value [...]]]) -- set attributes of a graphic component Index: man1_ivtools/comdraw.1 diff -c man1_ivtools/comdraw.1:1.7 man1_ivtools/comdraw.1:1.8 *** man1_ivtools/comdraw.1:1.7 Sat May 27 00:49:24 2000 --- src/man/man1/comdraw.1 Wed May 31 06:29:44 2000 *************** *** 71,77 **** move(dx dy) -- move current selection scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection ! reorder(destview srcview) -- move graphic to the front of another .SH COMPONENT AND ATTRIBUTE COMMANDS --- 71,80 ---- move(dx dy) -- move current selection scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection ! ! .SH GROUP/UNGROUP COMMANDS ! ! growgroup(groupview compview) -- add graphic to existing group graphic .SH COMPONENT AND ATTRIBUTE COMMANDS *** /dev/null Wed May 31 06:29:51 PDT 2000 --- patches/ivtools-000531-johnston-060 *************** patches/ivtools-000531-johnston-060 *** 0 **** --- 1 ---- + ivtools-000531-johnston-060 |
From: <ivt...@li...> - 2000-05-26 18:54:11
|
Patch: ivtools-000527-johnston-059 For: ivtools-0.8.2 Author: joh...@us... Subject: print command can generate symbols, first draft of comdraw reorder command Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - fix :str keyword of print command (shortcut for :string) - add :sym and :symbol keyword to print command, for generating symbols the same way :str and :string can generate strings. - first draft of a comdraw reorder command, that takes a destination and source graphic argument, and moves the source graphic immediately in front of the destination graphics (in the front-to-back ordering of the graphics tree -- this does not change the location of the source graphic on the screen). It does not work yet, and the body is #if 0'ed out. - fix a few cases in the execute method of a derived Comfunc where a reference is initialized to a ComValue on the interpreter stack (ComValue&), and then used after the stack has been reset for this command (ComFunc::reset_stack), which obliterates all the input arguments. Instead a local copy of the ComValue is initialized. Before: ComValue& val = stack_arg(0); reset_stack(); // val becomes of UnknownType After: ComValue val(stack_arg(0)); reset_stack(); // val remains the same type it was The use of references to ComValue's on the stack is limited to carefully written execute methods that need the efficiency of not constructing an intermediate ComValue. In general it is easiest to create local ComValue's, one for each argument (or keyword argument) of interest, and then call ComFunc::reset_stack before the rest of the body of the method. Index: ComTerp/iofunc.c diff -c ComTerp/iofunc.c:1.3 ComTerp/iofunc.c:1.4 *** ComTerp/iofunc.c:1.3 Sat May 20 02:22:20 2000 --- src/ComTerp/iofunc.c Sat May 27 00:48:54 2000 *************** *** 45,50 **** --- 45,54 ---- ComValue strflag(stack_key(str_symid)); static int string_symid = symbol_add("string"); ComValue stringflag(stack_key(string_symid)); + static int sym_symid = symbol_add("sym"); + ComValue symflag(stack_key(sym_symid)); + static int symbol_symid = symbol_add("symbol"); + ComValue symbolflag(stack_key(symbol_symid)); static int err_symid = symbol_add("err"); ComValue errflag(stack_key(err_symid)); reset_stack(); *************** *** 52,58 **** const char* fstr = formatstr.is_string() ? formatstr.string_ptr() : "nil"; streambuf* strmbuf = nil; ! if (stringflag.is_false() && strflag.is_false()) { filebuf * fbuf = new filebuf(); strmbuf = fbuf; if (comterp()->handler()) { --- 56,63 ---- const char* fstr = formatstr.is_string() ? formatstr.string_ptr() : "nil"; streambuf* strmbuf = nil; ! if (stringflag.is_false() && strflag.is_false() && ! symbolflag.is_false() && symflag.is_false()) { filebuf * fbuf = new filebuf(); strmbuf = fbuf; if (comterp()->handler()) { *************** *** 153,158 **** --- 158,168 ---- if (stringflag.is_true() || strflag.is_true()) { out << '\0'; ComValue retval(((strstreambuf*)strmbuf)->str()); + push_stack(retval); + } else if (symbolflag.is_true() || symflag.is_true()) { + out << '\0'; + int symbol_id = symbol_add(((strstreambuf*)strmbuf)->str()); + ComValue retval(symbol_id, ComValue::SymbolType); push_stack(retval); } delete strmbuf; Index: ComTerp/iofunc.h diff -c ComTerp/iofunc.h:1.2 ComTerp/iofunc.h:1.3 *** ComTerp/iofunc.h:1.2 Mon Feb 21 20:48:41 2000 --- src/ComTerp/iofunc.h Sat May 27 00:48:54 2000 *************** *** 35,41 **** class ComValue; //: value printing command for ComTerp. ! // [str]=print(fmtstr val :string|:str :err) -- print value with format string // [str]=print(val :string|:str :err) -- print value class PrintFunc : public ComFunc { public: --- 35,41 ---- class ComValue; //: value printing command for ComTerp. ! // [str]=print(fmtstr val :string|:str :symbol|:sym :err) -- print value with format string // [str]=print(val :string|:str :err) -- print value class PrintFunc : public ComFunc { public: *************** *** 43,49 **** virtual void execute(); virtual const char* docstring() { ! return "[str]=%s(fmtstr val :string|:str :err) -- print value with format string"; } }; #endif /* !defined(_iofunc_h) */ --- 43,49 ---- virtual void execute(); virtual const char* docstring() { ! return "[str]=%s(fmtstr val :string|:str :symbol|:sym :err) -- print value with format string"; } }; #endif /* !defined(_iofunc_h) */ Index: ComUnidraw/comeditor.c diff -c ComUnidraw/comeditor.c:1.8 ComUnidraw/comeditor.c:1.9 *** ComUnidraw/comeditor.c:1.8 Mon May 22 02:10:05 2000 --- src/ComUnidraw/comeditor.c Sat May 27 00:49:12 2000 *************** *** 190,195 **** --- 190,196 ---- comterp->add_command("highlight", new HighlightFunc(comterp, this)); comterp->add_command("frame", new FrameFunc(comterp, this)); + comterp->add_command("reorder", new ReorderFunc(comterp, this)); } /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) { Index: ComUnidraw/grfunc.c diff -c ComUnidraw/grfunc.c:1.7 ComUnidraw/grfunc.c:1.8 *** ComUnidraw/grfunc.c:1.7 Mon May 22 02:10:05 2000 --- src/ComUnidraw/grfunc.c Sat May 27 00:49:12 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994-1997 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 574,580 **** } void FontFunc::execute() { ! ComValue& fnum = stack_arg(0); int fn = fnum.int_val(); reset_stack(); --- 575,581 ---- } void FontFunc::execute() { ! ComValue fnum(stack_arg(0)); int fn = fnum.int_val(); reset_stack(); *************** *** 596,602 **** } void BrushFunc::execute() { ! ComValue& bnum = stack_arg(0); int bn = bnum.int_val(); reset_stack(); --- 597,603 ---- } void BrushFunc::execute() { ! ComValue& bnum =stack_arg(0); int bn = bnum.int_val(); reset_stack(); *************** *** 618,624 **** } void PatternFunc::execute() { ! ComValue& pnum = stack_arg(0); int pn = pnum.int_val(); reset_stack(); --- 619,625 ---- } void PatternFunc::execute() { ! ComValue pnum(stack_arg(0)); int pn = pnum.int_val(); reset_stack(); *************** *** 993,1003 **** } void TileFileFunc::execute() { ! ComValue& ifilev = stack_arg(0); ! ComValue& ofilev = stack_arg(1); ComValue five12(512); ! ComValue& twidthv = stack_arg(2, false, five12); ! ComValue& theightv = stack_arg(3, false, five12); reset_stack(); char* ifile = symbol_pntr(ifilev.symbol_ref()); --- 994,1004 ---- } void TileFileFunc::execute() { ! ComValue ifilev(stack_arg(0)); ! ComValue ofilev(stack_arg(1)); ComValue five12(512); ! ComValue twidthv(stack_arg(2, false, five12)); ! ComValue theightv(stack_arg(3, false, five12)); reset_stack(); char* ifile = symbol_pntr(ifilev.symbol_ref()); *************** *** 1024,1029 **** --- 1025,1078 ---- else { push_stack(ComValue::nullval()); } + } + + /*****************************************************************************/ + + ReorderFunc::ReorderFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { + } + + void ReorderFunc::execute() { + ComValue destval(stack_arg(0)); + ComValue srcval(stack_arg(1)); + + reset_stack(); + #if 0 + if (!destval.object_compview() && !srcval.object_compview()) return; + + OverlayViewer* viewer = (OverlayViewer*)GetEditor()->GetViewer(); + + ComponentView* destview = (ComponentView*)destval.obj_val(); + OverlayComp* destcomp = destview ? (OverlayComp*)destview->GetSubject() : nil; + OverlayView* destview2 = destcomp ? destcomp->FindView(viewer) : nil; + + ComponentView* srcview = (ComponentView*)srcval.obj_val(); + OverlayComp* srccomp = srcview ? (OverlayComp*)srcview->GetSubject() : nil; + OverlayView* srcview2 = srccomp ? srccomp->FindView(viewer) : nil; + + OverlaysView* topview = ((OverlayEditor*)GetEditor())->GetFrame(); + if (topview && destview2 && srcview2) { + + GraphicView* saveview = nil; + Iterator i; + for(topview->First(i); !topview->Done(i); topview->Next(i)) { + if (topview->GetView(i)==srcview2) { + saveview = topview->Remove(i); + break; + } + } + + if (saveview) { + for(topview->First(i); !topview->Done(i); topview->Next(i)) { + if (topview->GetView(i)==dstview2) { + topview->InsertBefore(i, saveview); + break; + } + } + } + + } + #endif } Index: ComUnidraw/grfunc.h diff -c ComUnidraw/grfunc.h:1.3 ComUnidraw/grfunc.h:1.4 *** ComUnidraw/grfunc.h:1.3 Mon May 22 02:10:05 2000 --- src/ComUnidraw/grfunc.h Sat May 27 00:49:12 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994-1997,1999 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 329,334 **** --- 330,345 ---- virtual void execute(); virtual const char* docstring() { return "%s(inpath outpath [xsize] [ysiz]) -- tile pgm or ppm image file"; } + }; + + //: command to move graphic in front of another + // reorder(destview srcview) -- move graphic to the front of another + class ReorderFunc : public UnidrawFunc { + public: + ReorderFunc(ComTerp*,Editor*); + virtual void execute(); + virtual const char* docstring() { + return "%s(destview srcview) -- move graphic to the front of another"; } }; #endif /* !defined(_grfunc_h) */ Index: man1_ivtools/comdraw.1 diff -c man1_ivtools/comdraw.1:1.6 man1_ivtools/comdraw.1:1.7 *** man1_ivtools/comdraw.1:1.6 Mon May 22 02:10:19 2000 --- src/man/man1/comdraw.1 Sat May 27 00:49:24 2000 *************** *** 71,76 **** --- 71,77 ---- move(dx dy) -- move current selection scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection + reorder(destview srcview) -- move graphic to the front of another .SH COMPONENT AND ATTRIBUTE COMMANDS *** /dev/null Sat May 27 00:49:27 PDT 2000 --- patches/ivtools-000527-johnston-059 *************** patches/ivtools-000527-johnston-059 *** 0 **** --- 1 ---- + ivtools-000527-johnston-059 |
From: <ivt...@li...> - 2000-05-26 18:53:41
|
Patch: ivtools-000522-johnston-058 For: ivtools-0.8.2 Author: joh...@us... Subject: work on comdraw commands: select, center, mbr, and new delete Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - define AttributeValue::boolean_val() to return true for any symbol or string value if the symbol id is greater than or equal to zero. - new "delete" command for comdraw. - new :clear flag on the "select" command of comdraw. - new :scrn flag on the "center" and "mbr" commands of comdraw (to return screen relative coordinates as opposed to drawing coordinates). Index: Attribute/attrvalue.c diff -c Attribute/attrvalue.c:1.9 Attribute/attrvalue.c:1.10 *** Attribute/attrvalue.c:1.9 Wed May 17 06:58:36 2000 --- src/Attribute/attrvalue.c Mon May 22 02:09:47 2000 *************** *** 235,241 **** case AttributeValue::BooleanType: return boolean_ref(); case AttributeValue::SymbolType: ! return (boolean) int_val(); case AttributeValue::ObjectType: return (boolean) obj_val(); default: --- 235,242 ---- case AttributeValue::BooleanType: return boolean_ref(); case AttributeValue::SymbolType: ! case AttributeValue::StringType: ! return (boolean) int_val()!=-1; case AttributeValue::ObjectType: return (boolean) obj_val(); default: Index: ComUnidraw/comeditor.c diff -c ComUnidraw/comeditor.c:1.7 ComUnidraw/comeditor.c:1.8 *** ComUnidraw/comeditor.c:1.7 Fri May 19 11:20:38 2000 --- src/ComUnidraw/comeditor.c Mon May 22 02:10:05 2000 *************** *** 149,154 **** --- 149,155 ---- comterp->add_command("setattr", new SetAttrFunc(comterp, this)); comterp->add_command("select", new SelectFunc(comterp, this)); + comterp->add_command("delete", new DeleteFunc(comterp, this)); comterp->add_command("move", new MoveFunc(comterp, this)); comterp->add_command("scale", new ScaleFunc(comterp, this)); comterp->add_command("rotate", new RotateFunc(comterp, this)); Index: ComUnidraw/grfunc.c diff -c ComUnidraw/grfunc.c:1.6 ComUnidraw/grfunc.c:1.7 *** ComUnidraw/grfunc.c:1.6 Fri Mar 24 23:15:50 2000 --- src/ComUnidraw/grfunc.c Mon May 22 02:10:05 2000 *************** *** 665,672 **** --- 665,681 ---- static int all_symid = symbol_add("all"); ComValue all_flagv(stack_key(all_symid)); boolean all_flag = all_flagv.is_true(); + static int clear_symid = symbol_add("clear"); + ComValue clear_flagv(stack_key(clear_symid)); + boolean clear_flag = clear_flagv.is_true(); Selection* sel = _ed->GetViewer()->GetSelection(); + if (clear_flag) { + sel->Clear(); + reset_stack(); + return; + } + OverlaySelection* newSel = new OverlaySelection(); Viewer* viewer = _ed->GetViewer(); *************** *** 727,732 **** --- 736,774 ---- reset_stack(); ComValue retval(avl); push_stack(retval); + } + + /*****************************************************************************/ + + DeleteFunc::DeleteFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { + } + + void DeleteFunc::execute() { + Viewer* viewer = _ed->GetViewer(); + + int nf=nargsfixed(); + if (nf==0) { + reset_stack(); + return; + } + + Clipboard* delcb = new Clipboard(); + + for (int i=0; i<nf; i++) { + ComValue& obj = stack_arg(i); + if (obj.object_compview()) { + ComponentView* comview = (ComponentView*)obj.obj_val(); + OverlayComp* comp = (OverlayComp*)comview->GetSubject(); + if (comp) delcb->Append(comp); + } + } + + DeleteCmd* delcmd = new DeleteCmd(GetEditor(), delcb); + delcmd->Execute(); + unidraw->Update(); + delete delcmd; + + reset_stack(); } /*****************************************************************************/ Index: ComUnidraw/grfunc.h diff -c ComUnidraw/grfunc.h:1.2 ComUnidraw/grfunc.h:1.3 *** ComUnidraw/grfunc.h:1.2 Fri Mar 10 23:42:09 2000 --- src/ComUnidraw/grfunc.h Mon May 22 02:10:05 2000 *************** *** 151,164 **** }; //: command to select graphics in comdraw. ! // select([compview ...] :all) -- make these graphics the current selection, // default returns current selection. class SelectFunc : public UnidrawFunc { public: SelectFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "%s([compview ...] :all) -- make these graphics the current selection (dflt is current)"; } }; //: command to move current selection in comdraw --- 151,174 ---- }; //: command to select graphics in comdraw. ! // select([compview ...] :all :clear) -- make these graphics the current selection, // default returns current selection. class SelectFunc : public UnidrawFunc { public: SelectFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "%s([compview ...] :all :clear) -- make these graphics the current selection (dflt is current)"; } ! }; ! ! //: command to delete graphics in comdraw. ! // delete(compview [compview ...]) -- delete graphic(s) ! class DeleteFunc : public UnidrawFunc { ! public: ! DeleteFunc(ComTerp*,Editor*); ! virtual void execute(); ! virtual const char* docstring() { ! return "%s([compview ...]) -- delete graphic(s)"; } }; //: command to move current selection in comdraw Index: ComUnidraw/grstatfunc.c diff -c ComUnidraw/grstatfunc.c:1.4 ComUnidraw/grstatfunc.c:1.5 *** ComUnidraw/grstatfunc.c:1.4 Sat May 20 02:26:47 2000 --- src/ComUnidraw/grstatfunc.c Mon May 22 02:10:05 2000 *************** *** 25,30 **** --- 25,31 ---- #include <OverlayUnidraw/ovclasses.h> #include <OverlayUnidraw/ovvertices.h> #include <OverlayUnidraw/ovline.h> + #include <OverlayUnidraw/ovviewer.h> #include <Unidraw/Components/grview.h> #include <Unidraw/Components/grcomp.h> *************** *** 39,44 **** --- 40,47 ---- #define TITLE "GrStatFunc" + static int scrn_symid = symbol_add("scrn"); + /*****************************************************************************/ CenterFunc::CenterFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { *************** *** 57,62 **** --- 60,67 ---- if (!yx_flag && !x_flag && !y_flag) xy_flag = true; boolean return_an_array = xy_flag || yx_flag; + boolean scrn_flag = stack_key(scrn_symid).is_true(); + Viewer* viewer = _ed->GetViewer(); ComValue obj(stack_arg(0)); reset_stack(); *************** *** 67,72 **** --- 72,81 ---- if (gr) { float cx, cy; gr->GetCenter(cx, cy); + + if (scrn_flag) + ((OverlayViewer*)viewer)->DrawingToScreen(cx, cy, cx, cy); + if (return_an_array) { AttributeValueList* avl = new AttributeValueList(); ComValue* v1 = new ComValue(xy_flag ? cx : cy); *************** *** 96,101 **** --- 105,112 ---- boolean lbrt_flag = stack_key(lbrt_symval).is_true(); boolean lrbt_flag = stack_key(lrbt_symval).is_true(); + boolean scrn_flag = stack_key(scrn_symid).is_true(); + Viewer* viewer = _ed->GetViewer(); ComValue obj(stack_arg(0)); reset_stack(); *************** *** 106,111 **** --- 117,128 ---- if (gr) { float l, b, r, t; gr->GetBounds(l, b, r, t); + + if (scrn_flag) { + ((OverlayViewer*)viewer)->DrawingToScreen(l, b, l, b); + ((OverlayViewer*)viewer)->DrawingToScreen(r, t, r, t); + } + AttributeValueList* avl = new AttributeValueList(); ComValue* lval = new ComValue(l); ComValue* bval = new ComValue(b); Index: ComUnidraw/grstatfunc.h diff -c ComUnidraw/grstatfunc.h:1.1 ComUnidraw/grstatfunc.h:1.2 *** ComUnidraw/grstatfunc.h:1.1 Tue Jan 18 03:11:07 2000 --- src/ComUnidraw/grstatfunc.h Mon May 22 02:10:05 2000 *************** *** 27,49 **** #include <ComUnidraw/unifunc.h> //: command to return center of graphics in comdraw. ! // xylist=center(compview :xy :yx :x :y) -- center of compview (dflt :xy) class CenterFunc : public UnidrawFunc { public: CenterFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "xylist=%s(compview :xy :yx :x :y) -- center of compview (dflt :xy)"; } }; //: command to return minimum-bounding rectangle of graphics in comdraw. ! // rectlist=mbr(compview :lbrt :lrbt) -- minimum-bounding rectangle of compview (dflt :lbrt) class MbrFunc : public UnidrawFunc { public: MbrFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "rectlist=%s(compview :lbrt :lrbt) -- minimum-bounding rectangle of compview (dflt :lbrt :lrbt)"; } }; //: command to return point list associated with a graphic --- 27,49 ---- #include <ComUnidraw/unifunc.h> //: command to return center of graphics in comdraw. ! // xylist=center(compview :xy :yx :x :y :scrn) -- center of compview (dflt :xy) class CenterFunc : public UnidrawFunc { public: CenterFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "xylist=%s(compview :xy :yx :x :y :scrn) -- center of compview (dflt :xy)"; } }; //: command to return minimum-bounding rectangle of graphics in comdraw. ! // rectlist=mbr(compview :lbrt :lrbt :scrn) -- minimum-bounding rectangle of compview (dflt :lbrt) class MbrFunc : public UnidrawFunc { public: MbrFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "rectlist=%s(compview :lbrt :lrbt :scrn) -- minimum-bounding rectangle of compview (dflt :lbrt :lrbt)"; } }; //: command to return point list associated with a graphic Index: comdraw/README diff -c comdraw/README:1.4 comdraw/README:1.5 *** comdraw/README:1.4 Fri May 19 11:20:41 2000 --- src/comdraw/README Mon May 22 02:10:09 2000 *************** *** 40,48 **** GRAPHIC STATS COMMANDS ! xylist=center(compview :xy :yx :x :y) -- center of compview (dflt :xy) ! rectlist=mbr(compview :lbrt :lrbt) -- minimum bounding rectangle of compview (dflt :lbrt) ! ptlist=points(compview) -- return point list from compview graphic GRAPHIC STATE COMMANDS --- 40,48 ---- GRAPHIC STATS COMMANDS ! xylist=center(compview :xy :yx :x :y :scrn) -- center of compview (dflt :xy) ! rectlist=mbr(compview :lbrt :lrbt :scrn) -- minimum bounding rectangle of compview (dflt :lbrt) ! ptlist=points(compview :scrn) -- return point list from compview graphic GRAPHIC STATE COMMANDS *************** *** 58,64 **** DIRECT MANIPULATION COMMANDS ! select(compview [compview ...] :all) -- make these graphics the current selection move(dx dy) -- move current selection scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection --- 58,65 ---- DIRECT MANIPULATION COMMANDS ! select([compview ...] :all :clear) -- make these graphics the current selection ! delete(compview [compview ...]) -- delete graphic(s) move(dx dy) -- move current selection scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection Index: man1_ivtools/comdraw.1 diff -c man1_ivtools/comdraw.1:1.5 man1_ivtools/comdraw.1:1.6 *** man1_ivtools/comdraw.1:1.5 Fri May 19 11:20:55 2000 --- src/man/man1/comdraw.1 Mon May 22 02:10:19 2000 *************** *** 45,52 **** .SH GRAPHIC STATS COMMANDS ! xylist=center(compview :xy :yx :x :y) -- center of compview (dflt :xy) ! rectlist=mbr(compview :lbrt :lrbt) -- minimum bounding rectangle of compview (dflt :lbrt) ptlist=points(compview) -- return point list from compview graphic .SH GRAPHIC STATE COMMANDS --- 45,52 ---- .SH GRAPHIC STATS COMMANDS ! xylist=center(compview :xy :yx :x :y :scrn) -- center of compview (dflt :xy) ! rectlist=mbr(compview :lbrt :lrbt :scrn) -- minimum bounding rectangle of compview (dflt :lbrt) ptlist=points(compview) -- return point list from compview graphic .SH GRAPHIC STATE COMMANDS *************** *** 65,72 **** .SH DIRECT MANIPULATION COMMANDS ! select(compview [compview ...] :all) -- make these graphics the current selection move(dx dy) -- move current selection scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection --- 65,73 ---- .SH DIRECT MANIPULATION COMMANDS ! select([compview ...] :all :clear) -- make these graphics the current selection + delete(compview [compview ...]) -- delete graphic(s) move(dx dy) -- move current selection scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection *** /dev/null Mon May 22 02:10:23 PDT 2000 --- patches/ivtools-000522-johnston-058 *************** patches/ivtools-000522-johnston-058 *** 0 **** --- 1 ---- + ivtools-000522-johnston-058 |
From: <ivt...@li...> - 2000-05-21 01:03:22
|
Patch: ivtools-000521-johnston-057 For: ivtools-0.8.2 Author: joh...@us... Subject: make min and max commands ignore nil, keep handler around if timer events still ongoing Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - modify min and max commands of comterp so that max(num nil) is always num, and min(num nil) is always num as well. - preserve the ComTerp associated with a ComterpHandler if there is a timer evaluated expression still running. Index: ComTerp/comhandler.c diff -c ComTerp/comhandler.c:1.8 ComTerp/comhandler.c:1.9 *** ComTerp/comhandler.c:1.8 Sat May 20 05:58:29 2000 --- src/ComTerp/comhandler.c Sun May 21 02:14:05 2000 *************** *** 83,89 **** COMTERP_REACTOR::instance ()->cancel_timer (this); #endif this->peer ().close (); ! delete comterp_; } int --- 83,91 ---- COMTERP_REACTOR::instance ()->cancel_timer (this); #endif this->peer ().close (); ! if (_timeoutscriptid<0) ! delete comterp_; ! else /* timer could be still running */; } int Index: ComTerp/numfunc.c diff -c ComTerp/numfunc.c:1.1 ComTerp/numfunc.c:1.2 *** ComTerp/numfunc.c:1.1 Tue Jan 18 03:07:04 2000 --- src/ComTerp/numfunc.c Sun May 21 02:14:05 2000 *************** *** 549,554 **** --- 549,557 ---- result.double_ref() = operand1.double_val() < operand2.double_val() ? operand1.double_val() : operand2.double_val(); break; + case ComValue::UnknownType: + result.assignval(operand2); + break; } reset_stack(); push_stack(result); *************** *** 604,609 **** --- 607,616 ---- result.double_ref() = operand1.double_val() > operand2.double_val() ? operand1.double_val() : operand2.double_val(); break; + case ComValue::UnknownType: + result.assignval(operand2); + break; + } reset_stack(); push_stack(result); *** /dev/null Sun May 21 02:15:00 PDT 2000 --- patches/ivtools-000521-johnston-057 *************** patches/ivtools-000521-johnston-057 *** 0 **** --- 1 ---- + ivtools-000521-johnston-057 |
From: <ivt...@li...> - 2000-05-21 01:02:59
|
Patch: ivtools-000520-johnston-056 For: ivtools-0.8.2 Author: joh...@us... Subject: annotate the timeexpr result Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - annotate (prefix) the result from a timeexpr command with "timeexpr result: ". Otherwise it is kind of hard to tell where these things come from. Index: ComTerp/comhandler.c diff -c ComTerp/comhandler.c:1.7 ComTerp/comhandler.c:1.8 *** ComTerp/comhandler.c:1.7 Sat May 20 02:22:20 2000 --- src/ComTerp/comhandler.c Sat May 20 05:58:29 2000 *************** *** 107,112 **** --- 107,113 ---- if (!comterp_->stack_empty()) { filebuf obuf(1); ostream ostr(&obuf); + ostr << "timeexpr result: "; comterp_->print_stack_top(ostr); ostr << "\n"; ostr.flush(); *** /dev/null Sat May 20 05:59:08 PDT 2000 --- patches/ivtools-000520-johnston-056 *************** patches/ivtools-000520-johnston-056 *** 0 **** --- 1 ---- + ivtools-000520-johnston-056 |
From: <ivt...@li...> - 2000-05-21 01:02:38
|
Patch: ivtools-000520-johnston-055 For: ivtools-0.8.2 Author: joh...@us... Subject: more command interpreter related bug fixes Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - fix bug in "mbr" and "points" commands of comdraw (same one that was in "center"). Index: ComUnidraw/grstatfunc.c diff -c ComUnidraw/grstatfunc.c:1.3 ComUnidraw/grstatfunc.c:1.4 *** ComUnidraw/grstatfunc.c:1.3 Sat May 20 02:22:49 2000 --- src/ComUnidraw/grstatfunc.c Sat May 20 02:26:47 2000 *************** *** 97,103 **** boolean lrbt_flag = stack_key(lrbt_symval).is_true(); Viewer* viewer = _ed->GetViewer(); ! ComValue& obj = stack_arg(0); reset_stack(); if (obj.object_compview()) { ComponentView* compview = (ComponentView*)obj.obj_val(); --- 97,103 ---- boolean lrbt_flag = stack_key(lrbt_symval).is_true(); Viewer* viewer = _ed->GetViewer(); ! ComValue obj(stack_arg(0)); reset_stack(); if (obj.object_compview()) { ComponentView* compview = (ComponentView*)obj.obj_val(); *************** *** 131,137 **** void PointsFunc::execute() { Viewer* viewer = _ed->GetViewer(); ! ComValue& obj = stack_arg(0); reset_stack(); if (obj.object_compview()) { ComponentView* compview = (ComponentView*)obj.obj_val(); --- 131,137 ---- void PointsFunc::execute() { Viewer* viewer = _ed->GetViewer(); ! ComValue obj(stack_arg(0)); reset_stack(); if (obj.object_compview()) { ComponentView* compview = (ComponentView*)obj.obj_val(); *** /dev/null Sat May 20 02:27:06 PDT 2000 --- patches/ivtools-000520-johnston-055 *************** patches/ivtools-000520-johnston-055 *** 0 **** --- 1 ---- + ivtools-000520-johnston-055 |
From: <ivt...@li...> - 2000-05-21 01:02:14
|
Patch: ivtools-000520-johnston-054 For: ivtools-0.8.2 Author: joh...@us... Subject: command interpreter related bug fixes Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - ensure a ComValue is really of ObjectType before returning the value of the ::object_compview() flag. - test for global symbol flag before doing local symbol table lookup in comterp. - ensure the global symbol flag is zeroed when constructing a ComValue from a postfix_token struct. - remove bug in "center" command. Index: Attribute/attrvalue.h diff -c Attribute/attrvalue.h:1.11 Attribute/attrvalue.h:1.12 *** Attribute/attrvalue.h:1.11 Wed May 17 06:58:36 2000 --- src/Attribute/attrvalue.h Sat May 20 02:22:18 2000 *************** *** 216,222 **** boolean command_alias(); // returns true if command is an alias, not the first name. ! boolean object_compview() { return _object_compview; } // true if object is wrapped with a ComponentView void object_compview(boolean flag) { _object_compview = flag; } // true if object is wrapped with a ComponentView --- 216,222 ---- boolean command_alias(); // returns true if command is an alias, not the first name. ! boolean object_compview() { return is_object() && _object_compview; } // true if object is wrapped with a ComponentView void object_compview(boolean flag) { _object_compview = flag; } // true if object is wrapped with a ComponentView Index: ComTerp/comhandler.c diff -c ComTerp/comhandler.c:1.6 ComTerp/comhandler.c:1.7 *** ComTerp/comhandler.c:1.6 Fri May 19 11:20:02 2000 --- src/ComTerp/comhandler.c Sat May 20 02:22:20 2000 *************** *** 134,139 **** --- 134,141 ---- char ch; filebuf ibuf(fd); istream istr(&ibuf); + + // problem handling new-lines embedded in character strings while(istr.good() && istr.get(ch),ch!='\n'&&ch!='\0') inv.push_back(ch); inv.push_back('\0'); Index: ComTerp/comterp.c diff -c ComTerp/comterp.c:1.15 ComTerp/comterp.c:1.16 *** ComTerp/comterp.c:1.15 Wed May 17 06:58:39 2000 --- src/ComTerp/comterp.c Sat May 20 02:22:20 2000 *************** *** 602,608 **** if (comval.type() == ComValue::SymbolType) { void* vptr = nil; ! if (localtable()->find(vptr, comval.symbol_val()) && !comval.global_flag() ) { comval.assignval(*(ComValue*)vptr); return comval; } else if (_alist) { --- 602,608 ---- if (comval.type() == ComValue::SymbolType) { void* vptr = nil; ! if (!comval.global_flag() && localtable()->find(vptr, comval.symbol_val()) ) { comval.assignval(*(ComValue*)vptr); return comval; } else if (_alist) { Index: ComTerp/comvalue.c diff -c ComTerp/comvalue.c:1.15 ComTerp/comvalue.c:1.16 *** ComTerp/comvalue.c:1.15 Fri May 19 11:20:02 2000 --- src/ComTerp/comvalue.c Sat May 20 02:22:20 2000 *************** *** 94,99 **** --- 94,100 ---- } ComValue::ComValue(postfix_token* token) { + clear(); void* v1 = &_v; void* v2 = &token->v; memcpy(v1, v2, sizeof(double)); *************** *** 107,113 **** case TOK_FLOAT: type(FloatType); break; case TOK_DOUBLE: type(DoubleType); break; case TOK_EOF: type(EofType); break; ! case TOK_COMMAND: type(SymbolType); break; case TOK_KEYWORD: type(KeywordType); break; case TOK_BLANK: type(BlankType); break; default: type(UnknownType); break; --- 108,114 ---- case TOK_FLOAT: type(FloatType); break; case TOK_DOUBLE: type(DoubleType); break; case TOK_EOF: type(EofType); break; ! case TOK_COMMAND: type(SymbolType); _v.symval.globalflag=0; break; case TOK_KEYWORD: type(KeywordType); break; case TOK_BLANK: type(BlankType); break; default: type(UnknownType); break; Index: ComTerp/iofunc.c diff -c ComTerp/iofunc.c:1.2 ComTerp/iofunc.c:1.3 *** ComTerp/iofunc.c:1.2 Mon Feb 21 20:48:41 2000 --- src/ComTerp/iofunc.c Sat May 20 02:22:20 2000 *************** *** 150,156 **** } ! if (stringflag.is_true()) { out << '\0'; ComValue retval(((strstreambuf*)strmbuf)->str()); push_stack(retval); --- 150,156 ---- } ! if (stringflag.is_true() || strflag.is_true()) { out << '\0'; ComValue retval(((strstreambuf*)strmbuf)->str()); push_stack(retval); Index: ComUnidraw/grstatfunc.c diff -c ComUnidraw/grstatfunc.c:1.2 ComUnidraw/grstatfunc.c:1.3 *** ComUnidraw/grstatfunc.c:1.2 Fri Mar 24 23:15:50 2000 --- src/ComUnidraw/grstatfunc.c Sat May 20 02:22:49 2000 *************** *** 58,64 **** boolean return_an_array = xy_flag || yx_flag; Viewer* viewer = _ed->GetViewer(); ! ComValue& obj = stack_arg(0); reset_stack(); if (obj.object_compview()) { ComponentView* compview = (ComponentView*)obj.obj_val(); --- 58,64 ---- boolean return_an_array = xy_flag || yx_flag; Viewer* viewer = _ed->GetViewer(); ! ComValue obj(stack_arg(0)); reset_stack(); if (obj.object_compview()) { ComponentView* compview = (ComponentView*)obj.obj_val(); *** /dev/null Sat May 20 02:23:09 PDT 2000 --- patches/ivtools-000520-johnston-054 *************** patches/ivtools-000520-johnston-054 *** 0 **** --- 1 ---- + ivtools-000520-johnston-054 |
From: <ivt...@li...> - 2000-05-19 05:16:22
|
Patch: ivtools-000519-johnston-053 For: ivtools-0.8.2 Author: joh...@us... Subject: "frame" command returns composite graphic, "at" and "size" work on composite graphics Requires: This is an intermediate patch to ivtools-0.8.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - add "frame" command to comdraw (and flipbook) to return the current composite graphic. - make comdraw versions of the "at" and "size" commands that work on composite graphic objects (i.e. the list of sub-graphics gets used as the list). - add a static method ComValue::minusoneval to return a ComValue set to -1. Index: top_ivtools/MANIFEST diff -c top_ivtools/MANIFEST:1.8 top_ivtools/MANIFEST:1.9 *** top_ivtools/MANIFEST:1.8 Tue May 16 06:21:02 2000 --- ./MANIFEST Fri May 19 11:19:57 2000 *************** *** 198,203 **** --- 198,205 ---- ivtools-0.8/src/ComUnidraw/grdotfunc.h ivtools-0.8/src/ComUnidraw/grfunc.c ivtools-0.8/src/ComUnidraw/grfunc.h + ivtools-0.8/src/ComUnidraw/grlistfunc.c + ivtools-0.8/src/ComUnidraw/grlistfunc.h ivtools-0.8/src/ComUnidraw/grstatfunc.c ivtools-0.8/src/ComUnidraw/grstatfunc.h ivtools-0.8/src/ComUnidraw/highlightfunc.c Index: top_ivtools/MANIFEST.perceps diff -c top_ivtools/MANIFEST.perceps:1.5 top_ivtools/MANIFEST.perceps:1.6 *** top_ivtools/MANIFEST.perceps:1.5 Tue May 16 06:21:02 2000 --- ./MANIFEST.perceps Fri May 19 11:19:58 2000 *************** *** 49,54 **** --- 49,55 ---- ComUnidraw/dialogfunc.h ComUnidraw/grdotfunc.h ComUnidraw/grfunc.h + ComUnidraw/grlistfunc.h ComUnidraw/grstatfunc.h ComUnidraw/highlightfunc.h ComUnidraw/nfunc.h Index: ComTerp/comhandler.c diff -c ComTerp/comhandler.c:1.5 ComTerp/comhandler.c:1.6 *** ComTerp/comhandler.c:1.5 Wed May 10 03:28:30 2000 --- src/ComTerp/comhandler.c Fri May 19 11:20:02 2000 *************** *** 41,47 **** ComterpHandler::ComterpHandler (void) { ! comterp_ = new ComTerpServ(/*BUFSIZ*BUFSIZ*/); comterp_->handler(this); comterp_->add_defaults(); _timeoutscriptid = -1; --- 41,47 ---- ComterpHandler::ComterpHandler (void) { ! comterp_ = new ComTerpServ(BUFSIZ*BUFSIZ); comterp_->handler(this); comterp_->add_defaults(); _timeoutscriptid = -1; Index: ComTerp/comvalue.c diff -c ComTerp/comvalue.c:1.14 ComTerp/comvalue.c:1.15 *** ComTerp/comvalue.c:1.14 Wed May 17 06:58:39 2000 --- src/ComTerp/comvalue.c Fri May 19 11:20:02 2000 *************** *** 43,48 **** --- 43,49 ---- ComValue ComValue::_unkval(ComValue::UnknownType); ComValue ComValue::_oneval(1, ComValue::IntType); ComValue ComValue::_zeroval(0, ComValue::IntType); + ComValue ComValue::_minusoneval(-1, ComValue::IntType); /*****************************************************************************/ *************** *** 348,353 **** --- 349,359 ---- ComValue& ComValue::zeroval() { *&_zeroval = ComValue(0, ComValue::IntType); return _zeroval; + } + + ComValue& ComValue::minusoneval() { + *&_minusoneval = ComValue(-1, ComValue::IntType); + return _minusoneval; } boolean ComValue::is_comfunc(int func_classid) { Index: ComTerp/comvalue.h diff -c ComTerp/comvalue.h:1.10 ComTerp/comvalue.h:1.11 *** ComTerp/comvalue.h:1.10 Sat May 6 05:46:22 2000 --- src/ComTerp/comvalue.h Fri May 19 11:20:02 2000 *************** *** 143,148 **** --- 143,150 ---- // returns reference to IntType ComValue with value of 1. static ComValue& zeroval(); // returns reference to IntType ComValue with value of 0. + static ComValue& minusoneval(); + // returns reference to IntType ComValue with value of -1. protected: void zero_vals() { _narg = _nkey = _nids = _pedepth = 0; } *************** *** 159,164 **** --- 161,167 ---- static ComValue _unkval; static ComValue _oneval; static ComValue _zeroval; + static ComValue _minusoneval; }; #endif /* !defined(_comvalue_h) */ Index: ComTerp/listfunc.h diff -c ComTerp/listfunc.h:1.3 ComTerp/listfunc.h:1.4 *** ComTerp/listfunc.h:1.3 Thu Apr 6 23:23:12 2000 --- src/ComTerp/listfunc.h Fri May 19 11:20:02 2000 *************** *** 46,70 **** }; //: list member command for ComTerp. ! // val=at(list n) -- return the nth item in a list. class ListAtFunc : public ComFunc { public: ListAtFunc(ComTerp*); virtual void execute(); virtual const char* docstring() { ! return "val=at(list n) -- return the nth item in a list"; } }; //: list size command for ComTerp. ! // num=size(list) -- return size of a list. class ListSizeFunc : public ComFunc { public: ListSizeFunc(ComTerp*); virtual void execute(); virtual const char* docstring() { ! return "val=size(list -- return the size of the list"; } }; #endif /* !defined(_listfunc_h) */ --- 46,70 ---- }; //: list member command for ComTerp. ! // val=at(list|attrlist n) -- return the nth item in a list. class ListAtFunc : public ComFunc { public: ListAtFunc(ComTerp*); virtual void execute(); virtual const char* docstring() { ! return "val=at(list|attrlist n) -- return the nth item in a list"; } }; //: list size command for ComTerp. ! // num=size(list|attrlist) -- return size of a list. class ListSizeFunc : public ComFunc { public: ListSizeFunc(ComTerp*); virtual void execute(); virtual const char* docstring() { ! return "val=size(list|attrlist) -- return the size of the list"; } }; #endif /* !defined(_listfunc_h) */ Index: comterp/README diff -c comterp/README:1.7 comterp/README:1.8 *** comterp/README:1.7 Fri May 12 04:18:19 2000 --- src/comterp_/README Fri May 19 11:20:04 2000 *************** *** 155,163 **** lst=list([olst]) -- create an empty list or copy existing one ! val=at(list n) -- return nth item in a list ! num=size(list) -- return size of a list CONTROL COMMANDS (using post evaluation): --- 155,163 ---- lst=list([olst]) -- create an empty list or copy existing one ! val=at(list|attrlist n) -- return nth item in a list ! num=size(list|attrlist) -- return size of a list CONTROL COMMANDS (using post evaluation): Index: OverlayUnidraw/ovcomps.c diff -c OverlayUnidraw/ovcomps.c:1.5 OverlayUnidraw/ovcomps.c:1.6 *** OverlayUnidraw/ovcomps.c:1.5 Wed May 10 03:28:48 2000 --- src/OverlayUnidraw/ovcomps.c Fri May 19 11:20:33 2000 *************** *** 122,130 **** #endif void OverlayComp::SetAttributeList(AttributeList* al) { Unref(_attrlist); ! _attrlist = al; ! Resource::ref(_attrlist); #if 0 // experimentation with attribute changing if (al) { --- 122,131 ---- #endif void OverlayComp::SetAttributeList(AttributeList* al) { + if (_attrlist) Unref(_attrlist); ! _attrlist = al; ! Resource::ref(_attrlist); #if 0 // experimentation with attribute changing if (al) { Index: OverlayUnidraw/ovcomps.h diff -c OverlayUnidraw/ovcomps.h:1.5 OverlayUnidraw/ovcomps.h:1.6 *** OverlayUnidraw/ovcomps.h:1.5 Sat May 6 05:46:54 2000 --- src/OverlayUnidraw/ovcomps.h Fri May 19 11:20:33 2000 *************** *** 127,134 **** (const char* name, boolean last = false, boolean breadth = false, boolean down = true, boolean up = false); // search component tree for specified attribute value by 'name'. Only ! // default argument mode implemented so far -- return first occurence found ! // with a downward depth-first search. virtual AttributeValue* FindValue (int symid, boolean last = false, boolean breadth = false, boolean down = true, boolean up = false); --- 127,134 ---- (const char* name, boolean last = false, boolean breadth = false, boolean down = true, boolean up = false); // search component tree for specified attribute value by 'name'. Only ! // two modes supported so far: the default argument mode which returns the ! // first occurence found with a downward depth-first search, and upward search. virtual AttributeValue* FindValue (int symid, boolean last = false, boolean breadth = false, boolean down = true, boolean up = false); Index: ComUnidraw/Imakefile diff -c ComUnidraw/Imakefile:1.4 ComUnidraw/Imakefile:1.5 *** ComUnidraw/Imakefile:1.4 Tue May 16 06:21:54 2000 --- src/ComUnidraw/Imakefile Fri May 19 11:20:38 2000 *************** *** 19,24 **** --- 19,25 ---- Obj26(grdotfunc) Obj26(grfunc) + Obj26(grlistfunc) Obj26(grstatfunc) Obj26(highlightfunc) Obj26(comeditor) Index: ComUnidraw/comeditor.c diff -c ComUnidraw/comeditor.c:1.6 ComUnidraw/comeditor.c:1.7 *** ComUnidraw/comeditor.c:1.6 Tue May 16 06:21:54 2000 --- src/ComUnidraw/comeditor.c Fri May 19 11:20:38 2000 *************** *** 24,29 **** --- 24,30 ---- #include <ComUnidraw/grdotfunc.h> #include <ComUnidraw/grfunc.h> + #include <ComUnidraw/grlistfunc.h> #include <ComUnidraw/grstatfunc.h> #include <ComUnidraw/highlightfunc.h> #include <ComUnidraw/comeditor.h> *************** *** 180,190 **** --- 181,194 ---- comterp->add_command("dot", new GrDotFunc(comterp)); comterp->add_command("attrlist", new GrAttrListFunc(comterp)); + comterp->add_command("at", new GrListAtFunc(comterp)); + comterp->add_command("size", new GrListSizeFunc(comterp)); comterp->add_command("acknowledgebox", new AcknowledgeBoxFunc(comterp, this)); comterp->add_command("confirmbox", new ConfirmBoxFunc(comterp, this)); comterp->add_command("highlight", new HighlightFunc(comterp, this)); + comterp->add_command("frame", new FrameFunc(comterp, this)); } /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) { Index: ComUnidraw/grdotfunc.c diff -c ComUnidraw/grdotfunc.c:1.3 ComUnidraw/grdotfunc.c:1.4 *** ComUnidraw/grdotfunc.c:1.3 Thu Apr 6 23:23:48 2000 --- src/ComUnidraw/grdotfunc.c Fri May 19 11:20:38 2000 *************** *** 60,67 **** if (before_part.is_object() && before_part.object_compview()) { ComponentView* compview = (ComponentView*)before_part.obj_val(); OverlayComp* comp = (OverlayComp*)compview->GetSubject(); ! ComValue stuffval(AttributeList::class_symid(), (void*)comp->GetAttributeList()); ! before_part.assignval(stuffval); } DotFunc::execute(); --- 60,75 ---- if (before_part.is_object() && before_part.object_compview()) { ComponentView* compview = (ComponentView*)before_part.obj_val(); OverlayComp* comp = (OverlayComp*)compview->GetSubject(); ! if (comp) { ! ComValue stuffval(AttributeList::class_symid(), (void*)comp->GetAttributeList()); ! before_part.assignval(stuffval); ! } else { ! cerr << "nil subject on compview value\n"; ! reset_stack(); ! push_stack(ComValue::nullval()); ! return; ! } ! } DotFunc::execute(); *************** *** 78,85 **** if (compviewv.object_compview()) { ComponentView* compview = (ComponentView*)compviewv.obj_val(); OverlayComp* comp = compview ? (OverlayComp*)compview->GetSubject() : nil; ! ComValue retval(AttributeList::class_symid(), (void*)comp->GetAttributeList()); ! push_stack(retval); } } --- 86,96 ---- if (compviewv.object_compview()) { ComponentView* compview = (ComponentView*)compviewv.obj_val(); OverlayComp* comp = compview ? (OverlayComp*)compview->GetSubject() : nil; ! if (comp) { ! ComValue retval(AttributeList::class_symid(), (void*)comp->GetAttributeList()); ! push_stack(retval); ! } else ! push_stack(ComValue::nullval()); } } Index: ComUnidraw/grlistfunc.c diff -c /dev/null ComUnidraw/grlistfunc.c:1.1 *** /dev/null Fri May 19 11:20:40 2000 --- src/ComUnidraw/grlistfunc.c Fri May 19 11:20:39 2000 *************** *** 0 **** --- 1,110 ---- + /* + * Copyright (c) 2000 IET Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + #include <ComUnidraw/grlistfunc.h> + #include <OverlayUnidraw/ovclasses.h> + #include <OverlayUnidraw/ovcomps.h> + #include <Unidraw/Components/compview.h> + #include <Unidraw/iterator.h> + #include <ComTerp/listfunc.h> + + #define TITLE "GrListFunc" + + /*****************************************************************************/ + + GrListAtFunc::GrListAtFunc(ComTerp* comterp) : ComFunc(comterp) { + } + + void GrListAtFunc::execute() { + ComValue listv(stack_arg(0)); + ComValue nv(stack_arg(1)); + + if (listv.object_compview()) { + reset_stack(); + ComponentView* compview = (ComponentView*)listv.obj_val(); + OverlayComp* comp = (OverlayComp*)compview->GetSubject(); + OverlaysComp* comps = (OverlaysComp*) (comp->IsA(OVERLAYS_COMP) ? comp : nil); + if (comps && nv.int_val()>=0) { + Iterator i; + int count = 0; + comps->First(i); + while (!comps->Done(i)) { + if (count==nv.int_val()) { + OverlayComp* retcomp = (OverlayComp*)comps->GetComp(i); + if (retcomp) { + ComValue retval(retcomp->classid(), new ComponentView(retcomp)); + retval.object_compview(true); + push_stack(retval); + return; + } + } + comps->Next(i); + count++; + } + } + } else { + ListAtFunc atfunc(comterp()); + push_funcstate(funcstate()->nargs(), funcstate()->nkeys(), pedepth()); + atfunc.execute(); + pop_funcstate(); + return; + } + push_stack(ComValue::nullval()); + } + + /*****************************************************************************/ + + GrListSizeFunc::GrListSizeFunc(ComTerp* comterp) : ComFunc(comterp) { + } + + void GrListSizeFunc::execute() { + ComValue listv(stack_arg(0)); + + if (listv.object_compview()) { + reset_stack(); + ComponentView* compview = (ComponentView*)listv.obj_val(); + OverlayComp* comp = (OverlayComp*)compview->GetSubject(); + OverlaysComp* comps = (OverlaysComp*) (comp->IsA(OVERLAYS_COMP) ? comp : nil); + if (comps) { + Iterator i; + int count = 0; + comps->First(i); + while (!comps->Done(i)) { + count++; + comps->Next(i); + } + ComValue retval (count, ComValue::IntType); + push_stack(retval); + return; + } + } else { + ListSizeFunc atfunc(comterp()); + push_funcstate(funcstate()->nargs(), funcstate()->nkeys(), pedepth()); + atfunc.execute(); + pop_funcstate(); + return; + } + push_stack(ComValue::nullval()); + } + + Index: ComUnidraw/grlistfunc.h diff -c /dev/null ComUnidraw/grlistfunc.h:1.1 *** /dev/null Fri May 19 11:20:40 2000 --- src/ComUnidraw/grlistfunc.h Fri May 19 11:20:39 2000 *************** *** 0 **** --- 1,59 ---- + /* + * Copyright (c) 2000 IET Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + + /* + * at func for componentviews + */ + + #if !defined(_grlistfunc_h) + #define _grlistfunc_h + + #include <ComTerp/listfunc.h> + + //: list member command for ComUnidraw + // val=at(list|attrlist|compview n) -- return the nth item in a list. + class GrListAtFunc : public ComFunc { + public: + GrListAtFunc(ComTerp*); + + virtual void execute(); + virtual const char* docstring() { + return "val=at(list|attrlist|compview n) -- return the nth item in a list"; } + }; + + //: list size command for Unidraw + // num=size(list|attrlist|compview) -- return size of a list. + class GrListSizeFunc : public ComFunc { + public: + GrListSizeFunc(ComTerp*); + + virtual void execute(); + virtual const char* docstring() { + return "val=size(list|attrlist|compview) -- return the size of the list"; } + }; + + #endif /* !defined(_grlistfunc_h) */ + + + + Index: ComUnidraw/unifunc.c diff -c ComUnidraw/unifunc.c:1.4 ComUnidraw/unifunc.c:1.5 *** ComUnidraw/unifunc.c:1.4 Fri Mar 24 23:15:50 2000 --- src/ComUnidraw/unifunc.c Fri May 19 11:20:39 2000 *************** *** 1,5 **** /* ! * Copyright (c) 1994-2000 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided --- 1,6 ---- /* ! * Copyright (c) 2000 Vectaport Inc, IET Inc. ! * Copyright (c) 1994-1999 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided *************** *** 27,32 **** --- 28,34 ---- #include <OverlayUnidraw/ovcomps.h> #include <OverlayUnidraw/ovimport.h> #include <OverlayUnidraw/ovselection.h> + #include <OverlayUnidraw/ovviews.h> #include <Unidraw/clipboard.h> #include <Unidraw/creator.h> #include <Unidraw/globals.h> *************** *** 261,265 **** --- 263,287 ---- delete al; } push_stack(viewval); + } + + /*****************************************************************************/ + + FrameFunc::FrameFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { + } + + void FrameFunc::execute() { + ComValue indexv(stack_arg(0, false, ComValue::minusoneval())); + reset_stack(); + OverlayEditor* ed = (OverlayEditor*)GetEditor(); + + OverlaysView* frameview = ed->GetFrame(indexv.int_val()); + if (frameview && frameview->GetSubject()) { + OverlayComp* comp = (OverlayComp*)frameview->GetSubject(); + ComValue retval(comp->classid(), new ComponentView(comp)); + retval.object_compview(true); + push_stack(retval); + } else + push_stack(ComValue::nullval()); } Index: ComUnidraw/unifunc.h diff -c ComUnidraw/unifunc.h:1.2 ComUnidraw/unifunc.h:1.3 *** ComUnidraw/unifunc.h:1.2 Fri Mar 24 23:15:50 2000 --- src/ComUnidraw/unifunc.h Fri May 19 11:20:39 2000 *************** *** 1,4 **** --- 1,5 ---- /* + * Copyright (c) 2000 IET Inc. * Copyright (c) 1994-1999 Vectaport Inc. * * Permission to use, copy, modify, distribute, and sell this software and *************** *** 115,118 **** --- 116,131 ---- }; + //: command to composite component for a frame, defaults to current + // compview=frame([index]) -- return composite component for a frame, defaults to current + class FrameFunc : public UnidrawFunc { + public: + FrameFunc(ComTerp*,Editor*); + virtual void execute(); + virtual const char* docstring() { + return "compview=%s([index]) -- return composite component for a frame, defaults to current"; } + + }; + #endif /* !defined(_unifunc_h) */ + Index: comdraw/README diff -c comdraw/README:1.3 comdraw/README:1.4 *** comdraw/README:1.3 Tue May 16 06:21:56 2000 --- src/comdraw/README Fri May 19 11:20:41 2000 *************** *** 63,72 **** scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection ! ATTRIBUTE COMMANDS compview=setattr(compview [:keyword value [:keyword value [...]]]) -- set attributes of a graphic component attrlist(compview) -- return attribute list of component VIEWER COMMANDS --- 63,75 ---- scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection ! COMPONENT AND ATTRIBUTE COMMANDS compview=setattr(compview [:keyword value [:keyword value [...]]]) -- set attributes of a graphic component attrlist(compview) -- return attribute list of component + compview=frame([index]) -- return composite component for a frame, defaults to current + val=at(list|attrlist|compview n) -- return the nth item in a list. + num=size(list|attrlist|compview) -- return size of a list. VIEWER COMMANDS Index: include_components/component.h diff -c include_components/component.h:1.2 include_components/component.h:1.3 *** include_components/component.h:1.2 Mon May 8 22:07:35 2000 --- src/include/Unidraw/Components/component.h Fri May 19 11:20:51 2000 *************** *** 84,93 **** static boolean use_unidraw() { return _use_unidraw; } static void use_unidraw(boolean flag) { _use_unidraw = flag; } protected: Component(); - ComponentView* View(UList*); virtual void SetParent(Component* child, Component* parent); protected: UList* _views; --- 84,95 ---- static boolean use_unidraw() { return _use_unidraw; } static void use_unidraw(boolean flag) { _use_unidraw = flag; } + + UList* ViewList() { return _views; } + ComponentView* View(UList*); protected: Component(); virtual void SetParent(Component* child, Component* parent); protected: UList* _views; Index: man1_ivtools/comdraw.1 diff -c man1_ivtools/comdraw.1:1.4 man1_ivtools/comdraw.1:1.5 *** man1_ivtools/comdraw.1:1.4 Tue May 16 06:22:15 2000 --- src/man/man1/comdraw.1 Fri May 19 11:20:55 2000 *************** *** 71,80 **** scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection ! .SH ATTRIBUTE COMMANDS compview=setattr(compview [:keyword value [:keyword value [...]]]) -- set attributes of a graphic component attrlist(compview) -- return attribute list of component .SH VIEWER COMMANDS --- 71,83 ---- scale(xflt yflt) -- scale current selection rotate(degflt) -- rotate current selection ! .SH COMPONENT AND ATTRIBUTE COMMANDS compview=setattr(compview [:keyword value [:keyword value [...]]]) -- set attributes of a graphic component attrlist(compview) -- return attribute list of component + compview=frame([index]) -- return composite component for a frame, defaults to current + val=at(list|attrlist|compview n) -- return the nth item in a list. + num=size(list|attrlist|compview) -- return size of a list. .SH VIEWER COMMANDS Index: man1_ivtools/comterp.1 diff -c man1_ivtools/comterp.1:1.7 man1_ivtools/comterp.1:1.8 *** man1_ivtools/comterp.1:1.7 Fri May 12 04:19:24 2000 --- src/man/man1/comterp.1 Fri May 19 11:20:55 2000 *************** *** 165,173 **** lst=list([olst]) -- create an empty list or copy existing one ! val=at(list n) -- return nth item in a list ! num=size(list) -- return size of a list .SH CONTROL COMMANDS (using post evaluation): --- 165,173 ---- lst=list([olst]) -- create an empty list or copy existing one ! val=at(list|attrlist n) -- return nth item in a list ! num=size(list|attrlist) -- return size of a list .SH CONTROL COMMANDS (using post evaluation): *** /dev/null Fri May 19 11:21:05 PDT 2000 --- patches/ivtools-000519-johnston-053 *************** patches/ivtools-000519-johnston-053 *** 0 **** --- 1 ---- + ivtools-000519-johnston-053 |