work on new :colexpr for graphdraw
[email protected] Fri, 9 Sep 2005 11:17:18 -0700
| Newsgroups | gmane.comp.lib.ivtools.patches |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-1--193732770 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="ivtools-050909-johnston-008" Content-Disposition: attachment; filename=ivtools-050909-johnston-008 Patch: ivtools-050909-johnston-008 For: ivtools-1.2.2 Author: [email protected] Subject: Requires: This is an intermediate patch to ivtools-1.2.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: - added support for color expressions to graphdraw (:colexpr) Index: AttrGlyph/attredit.c diff -c AttrGlyph/attredit.c:1.1 AttrGlyph/attredit.c:1.2 *** AttrGlyph/attredit.c:1.1 Tue Jun 15 08:55:46 2004 --- src/AttrGlyph/attredit.c Fri Sep 9 10:58:43 2005 *************** *** 161,173 **** #else vbuf.push_back(' '); vbuf.push_back('\n'); - vbuf.push_back('\0'); #endif } #ifndef STL_VECTOR _ete->text(buf, update); #else _ete->text(&vbuf[0] ? &vbuf[0] : "", update); #endif } --- 161,173 ---- #else vbuf.push_back(' '); vbuf.push_back('\n'); #endif } #ifndef STL_VECTOR _ete->text(buf, update); #else + vbuf.push_back('\0'); _ete->text(&vbuf[0] ? &vbuf[0] : "", update); #endif } Index: Attribute/paramlist.c diff -c Attribute/paramlist.c:1.1 Attribute/paramlist.c:1.2 *** Attribute/paramlist.c:1.1 Tue Jun 15 08:53:30 2004 --- src/Attribute/paramlist.c Fri Sep 9 10:58:18 2005 *************** *** 606,612 **** return in.good() && (strchr(delim,ch) || ch==')') ? 0 : -1; } ! int ParamList::parse_string (istream& in, char* buf, int buflen) { int cnt = 0; char curr_ch = in.get(); if (curr_ch == '"') { --- 606,612 ---- return in.good() && (strchr(delim,ch) || ch==')') ? 0 : -1; } ! int ParamList::parse_string (istream& in, char* buf, int buflen, boolean keep_backslashes) { int cnt = 0; char curr_ch = in.get(); if (curr_ch == '"') { *************** *** 614,620 **** char prev_ch = '\0'; while(in.good() && cnt<buflen-1 && (curr_ch != '"' || prev_ch == '\\')) { ! if (curr_ch != '\\') buf[cnt++] = curr_ch; prev_ch = curr_ch; curr_ch = in.get(); --- 614,620 ---- char prev_ch = '\0'; while(in.good() && cnt<buflen-1 && (curr_ch != '"' || prev_ch == '\\')) { ! if (curr_ch != '\\' || keep_backslashes) buf[cnt++] = curr_ch; prev_ch = curr_ch; curr_ch = in.get(); Index: Attribute/paramlist.h diff -c Attribute/paramlist.h:1.1 Attribute/paramlist.h:1.2 *** Attribute/paramlist.h:1.1 Tue Jun 15 08:53:30 2004 --- src/Attribute/paramlist.h Fri Sep 9 10:58:18 2005 *************** *** 198,204 **** static int parse_token(istream& in, char* buffer, int buflen, char* delim); // parse token from istream ended by one of a string of delimters, // for use of a param_callback. ! static int parse_string(istream& in, char* buffer, int buflen); // parse string from istream, correctly handling embedded quotes prefixed // by back-slashes, for use of a param_callback. static int parse_points(istream&, Coord*&, Coord*&, int&); --- 198,204 ---- static int parse_token(istream& in, char* buffer, int buflen, char* delim); // parse token from istream ended by one of a string of delimters, // for use of a param_callback. ! static int parse_string(istream& in, char* buffer, int buflen, boolean keep_backslashes=0); // parse string from istream, correctly handling embedded quotes prefixed // by back-slashes, for use of a param_callback. static int parse_points(istream&, Coord*&, Coord*&, int&); Index: ComUnidraw/grfunc.c diff -c ComUnidraw/grfunc.c:1.1 ComUnidraw/grfunc.c:1.2 *** ComUnidraw/grfunc.c:1.1 Tue Jun 15 08:56:29 2004 --- src/ComUnidraw/grfunc.c Fri Sep 9 10:58:51 2005 *************** *** 859,865 **** fgcolor = catalog->FindColor(fgname); //This comparison is made because the user can set only the foreground color by calling //colorsrgb with one argument. ! if (strcmp(bgname,"sym")!=0){ bgcolor = catalog->FindColor(bgname); } ColorCmd* cmd = new ColorCmd(_ed, fgcolor, bgcolor); --- 859,865 ---- fgcolor = catalog->FindColor(fgname); //This comparison is made because the user can set only the foreground color by calling //colorsrgb with one argument. ! if (bgname && strcmp(bgname,"sym")!=0){ bgcolor = catalog->FindColor(bgname); } ColorCmd* cmd = new ColorCmd(_ed, fgcolor, bgcolor); Index: ComUtil/comterp.h diff -c ComUtil/comterp.h:1.1 ComUtil/comterp.h:1.2 *** ComUtil/comterp.h:1.1 Tue Jun 15 08:53:26 2004 --- src/ComUtil/comterp.h Fri Sep 9 10:58:16 2005 *************** *** 48,54 **** /* Token types returned from OPTABLE.C */ #define TOK_COMMAND 23 /* Command name */ ! #define TOK_BLANK 24 /* genereated by empty parens: () */ /* OPTABLE.C Constants */ --- 48,54 ---- /* Token types returned from OPTABLE.C */ #define TOK_COMMAND 23 /* Command name */ ! #define TOK_BLANK 24 /* generated by empty parens: () */ /* OPTABLE.C Constants */ Index: config_ivtools/config.mk diff -c config_ivtools/config.mk:1.2 config_ivtools/config.mk:1.3 *** config_ivtools/config.mk:1.2 Tue Jan 25 09:47:42 2005 --- config/config.mk Fri Sep 9 10:59:12 2005 *************** *** 0 **** --- 1,5 ---- + XCONFIGDIR = /usr/X11R6/lib/X11/config + ABSTOP = /Users/scott/src/ivtools-1.2 + CPU = DARWIN + LIBSTDCPLUSPLUS2 = 0 + LIBSTDCPLUSPLUS3 = 1 Index: GraphUnidraw/nodecomp.c diff -c GraphUnidraw/nodecomp.c:1.1 GraphUnidraw/nodecomp.c:1.2 *** GraphUnidraw/nodecomp.c:1.1 Tue Jun 15 08:56:43 2004 --- src/GraphUnidraw/nodecomp.c Fri Sep 9 10:58:54 2005 *************** *** 594,599 **** --- 594,600 ---- if(al = attrlist()) { static int valexpr_symid = symbol_add("valexpr"); static int val_symid = symbol_add("val"); + static int colexpr_symid = symbol_add("colexpr"); AttributeValue* av = FindValue(valexpr_symid); if (av && av->is_string()) { Iterator it; *************** *** 619,632 **** outstr << av->string_ptr() << '\0'; cerr << "interpreting: " << outstr.str() << "\n"; ComValue retval(comterp->run(outstr.str())); if (retval.is_known()) { const int val_symid = symbol_add("val"); al->add_attr(val_symid, retval); } comterp->brief(old_brief); } } - Observable::notify(); } void NodeComp::Notify() { --- 620,645 ---- outstr << av->string_ptr() << '\0'; cerr << "interpreting: " << outstr.str() << "\n"; ComValue retval(comterp->run(outstr.str())); + cerr << "return value: " << retval << "\n"; if (retval.is_known()) { const int val_symid = symbol_add("val"); al->add_attr(val_symid, retval); + AttributeValue* cv = FindValue(colexpr_symid, false, false, false, true); + if (cv && cv->is_string()) { + comterp->set_attributes(al); + ComValue colval(comterp->run(cv->string_ptr())); + comterp->set_attributes(nil); + PSColor *fgcolor = nil, *bgcolor = nil; + Catalog* catalog = unidraw->GetCatalog(); + fgcolor = catalog->FindColor(colval.string_ptr()); + GetGraphic()->SetColors(fgcolor, bgcolor); + Notify(); + } + Observable::notify(); } comterp->brief(old_brief); } } } void NodeComp::Notify() { Index: OverlayUnidraw/scriptview.c diff -c OverlayUnidraw/scriptview.c:1.1 OverlayUnidraw/scriptview.c:1.2 *** OverlayUnidraw/scriptview.c:1.1 Tue Jun 15 08:56:21 2004 --- src/OverlayUnidraw/scriptview.c Fri Sep 9 10:58:46 2005 *************** *** 685,691 **** char ch; if ((ch=in.peek()) == '\"') { sbuf[0] = '\"'; ! ParamList::parse_string(in, sbuf+1, SBUFSIZE-1); strcat(sbuf, "\"\n"); } else if (ch!=')') { --- 685,691 ---- char ch; if ((ch=in.peek()) == '\"') { sbuf[0] = '\"'; ! ParamList::parse_string(in, sbuf+1, SBUFSIZE-1, true); strcat(sbuf, "\"\n"); } else if (ch!=')') { Index: src_dispatch/dispatcher.c diff -c src_dispatch/dispatcher.c:1.1 src_dispatch/dispatcher.c:1.2 *** src_dispatch/dispatcher.c:1.1 Tue Jun 15 08:54:14 2004 --- src/Dispatch/dispatcher.c Fri Sep 9 10:58:24 2005 *************** *** 659,665 **** #endif #else #ifdef SA_NOCLDSTOP /* POSIX */ ! #if defined(hpux) || defined(linux) sa.sa_handler = (void (*)(int))(&Dispatcher::sigCLD); #else sa.sa_handler = fxSIGACTIONHANDLER(&Dispatcher::sigCLD); --- 659,665 ---- #endif #else #ifdef SA_NOCLDSTOP /* POSIX */ ! #if defined(hpux) || defined(linux) || defined(sun) && defined(__svr4__) sa.sa_handler = (void (*)(int))(&Dispatcher::sigCLD); #else sa.sa_handler = fxSIGACTIONHANDLER(&Dispatcher::sigCLD); *** /dev/null Fri Sep 9 10:59:16 PDT 2005 --- patches/ivtools-050909-johnston-008 *************** patches/ivtools-050909-johnston-008 *** 0 **** --- 1 ---- + ivtools-050909-johnston-008 --Apple-Mail-1--193732770-- ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf