*** README.orig Wed Jan 6 22:14:44 1993 --- README Wed Jan 6 22:14:45 1993 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * @(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/README,v 1.4 1992/12/10 05:20:05 william Exp $ */ --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * @(#)$Header: /u/tangram/u/william/X11/TGIF2/Chinese/RCS/README,v 1.5 1993/01/05 17:48:27 william Exp $ */ *************** *** 9,15 **** Cgif (Chinese tgif) is a tgif varient that supports bitmap Chinese characters throught the s command. Chinese characters are inputed through ! the use of Zhu-Yin-Fu-Hao. The Chinese bitmap characters are stored ! in the .obj format, they are available in a seperate compressed tar ! file, "chinese-words.tar.Z". 1) The cgif distribution should be in the 'Chinese' subdirectory of the --- 9,19 ---- Cgif (Chinese tgif) is a tgif varient that supports bitmap Chinese characters throught the s command. Chinese characters are inputed through ! the use of Zhu-Yin-Fu-Hao. Use the left mouse button to select ! the Zhu-Yin-Fu-Hao symbols; use the middle button to fetch the ! Chinese characters; use the right button as back-space for the ! Zhu-Yin-Fu-Hao symbols. Doulbe click on a Chinese character ! to instantiate it in the drawing area. ! The Chinese bitmap characters are stored in the .obj format, they are ! available in a seperate compressed tar file, "chinese-words.tar.Z". 1) The cgif distribution should be in the 'Chinese' subdirectory of the *** cgif.c.orig Wed Jan 6 22:14:49 1993 --- cgif.c Wed Jan 6 22:14:51 1993 *************** *** 6,10 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/cgif.c,v 1.36 1992/10/26 07:37:18 william Exp $"; #endif --- 6,10 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/cgif.c,v 1.37 1992/12/14 04:41:15 william Exp $"; #endif *************** *** 1534,1538 **** SelectChineseChar (); else if (strcmp(s,"Anim") == 0) ! SelectChineseChar (); else if (strcmp(s,"Esca") == 0) TsaiHsing (); --- 1534,1538 ---- SelectChineseChar (); else if (strcmp(s,"Anim") == 0) ! SearchAgain (); else if (strcmp(s,"Esca") == 0) TsaiHsing (); *** tsaihsing.c.orig Wed Jan 6 22:14:55 1993 --- tsaihsing.c Wed Jan 6 22:14:56 1993 *************** *** 6,10 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/tsaihsing.c,v 1.18 1992/08/08 23:08:23 william Exp $"; #endif --- 6,10 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/tsaihsing.c,v 1.20 1992/12/14 04:49:08 william Exp $"; #endif *************** *** 18,21 **** --- 18,22 ---- #include "../cmd.e" #include "../cursor.e" + #include "../dialog.e" #include "../drawing.e" #include "../dup.e" *************** *** 162,168 **** else { ! fprintf (stderr, "\nStateConstraints are:\n"); for (count = 0; count < numStateConstraints; count++) ! fprintf (stderr, "\t'%s'\n", stateConstraints[count]); fprintf (stderr, "\n"); } --- 163,187 ---- else { ! int first=TRUE; ! ! fprintf (stderr, "\nStateConstraints are:\n "); for (count = 0; count < numStateConstraints; count++) ! { ! if (strcmp(stateConstraints[count], "||") == 0) ! { ! fprintf (stderr, "\n %s", stateConstraints[count]); ! first = TRUE; ! } ! else ! { ! if (first) ! { ! fprintf (stderr, " '%s'", stateConstraints[count]); ! first = FALSE; ! } ! else ! fprintf (stderr, " && '%s'", stateConstraints[count]); ! } ! } fprintf (stderr, "\n"); } *************** *** 1399,1413 **** register char * c_ptr; for (c_ptr=s; *c_ptr!='\0'; c_ptr++) if (*c_ptr >= '0' && *c_ptr <= '9') { ! if (numStateConstraints == 0) return (TRUE); for (i=0; i < numStateConstraints; i++) ! if (strncmp (s, stateConstraints[i], lenStateConstraints[i]) == 0) ! return (TRUE); ! return (FALSE); } ! return (FALSE); } --- 1418,1457 ---- register char * c_ptr; + if (numStateConstraints == 0) return (TRUE); for (c_ptr=s; *c_ptr!='\0'; c_ptr++) if (*c_ptr >= '0' && *c_ptr <= '9') { ! int and_condition=TRUE; for (i=0; i < numStateConstraints; i++) ! { ! if (strcmp (stateConstraints[i], "||") == 0) ! { ! if (and_condition) ! return (TRUE); ! else ! { ! and_condition = TRUE; ! continue; ! } ! } ! else ! if (!and_condition) continue; ! if (*stateConstraints[i] == '~') ! { ! if (strncmp (s, &(stateConstraints[i])[1], ! lenStateConstraints[i]-1) == 0) ! and_condition = FALSE; ! } ! else ! { ! if (strncmp (s, stateConstraints[i], ! lenStateConstraints[i]) != 0) ! and_condition = FALSE; ! } ! } ! return (and_condition); } ! return (FALSE); /* ZIP code is required for label generation */ } *************** *** 1480,1483 **** --- 1524,1626 ---- } + #define SEARCH_BACKWARD 0 + #define SEARCH_FORWARD 1 + + char prevSearchStr[MAXSTRING+1]; + int prevSearchDirection=INVALID; + + static + void Search (search_forward, again) + int search_forward, again; + { + struct ObjRec * obj_ptr, * obj_with_keys; + struct AttrRec * attr_ptr; + char search_str[MAXSTRING+1], msg[MAXSTRING+1]; + int search_str_len; + + if (topSel != NULL && topSel != botSel) + { + Msg ("Can only search while 0 or 1 object is selected."); + return; + } + + if (again) + { + strcpy (search_str, prevSearchStr); + if (*search_str == '\0') return; + } + else + { + Dialog ("Please enter an attribute to search:", + "( : accept, : cancel )", search_str); + if (*search_str == '\0') return; + strcpy (prevSearchStr, search_str); + } + search_str_len = strlen (search_str); + prevSearchDirection = search_forward; + + if (curChoice != NOTHING) + { + TieLooseEnds (); + SetCurChoice (NOTHING); + if (topSel!=NULL) { HighLightReverse (); RemoveAllSel (); } + } + + if (topSel == NULL) + obj_ptr = (search_forward) ? botObj : topObj; + else + obj_ptr = (search_forward) ? topSel->obj->prev : topSel->obj->next; + + if (topSel!=NULL) { HighLightReverse (); RemoveAllSel (); } + + for ( ; obj_ptr!=NULL; + obj_ptr=((search_forward) ? obj_ptr->prev : obj_ptr->next)) + { + if ((obj_with_keys = DesiredObj (obj_ptr)) != NULL) + { + attr_ptr = obj_with_keys->lattr; + for ( ; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) + { + int name_len = strlen (attr_ptr->name); + + if (search_str_len >= name_len && + strncmp(attr_ptr->name, search_str, name_len) == 0) + { + if (strncmp(attr_ptr->s, &search_str[name_len], + search_str_len-name_len) == 0) + { + if (topSel == NULL) + { + topSel = botSel = (struct SelRec *) calloc (1, + sizeof(struct SelRec)); + topSel->next = topSel->prev = NULL; + } + topSel->obj = obj_ptr; + UpdSelBBox (); + HighLightForward (); + justDupped = FALSE; + if (!BBoxIntersect (obj_ptr->bbox, drawWinBBox)) + PreciseZoom (zoomedIn, zoomScale, TRUE); + return; + } + } + } + } + } + sprintf (msg, "Can not find '%s'.", search_str); + Dialog (msg, "( or to continue )", search_str); + if (topSel!=NULL) { HighLightReverse (); RemoveAllSel (); } + } + + void SearchAgain () + { + char dummy[MAXSTRING+1]; + + if (prevSearchDirection == INVALID) + Dialog ("No previous search!", "( or to continue )", dummy); + else + Search (prevSearchDirection, TRUE); + } + #define TSAIHSING_READ 0 #define TSAIHSING_SORT 1 *************** *** 1485,1490 **** #define TSAIHSING_FILTER 3 #define TSAIHSING_LABEL 4 ! #define MAXTSAIHSINGMENUS 5 static char * tsaiHsingMenuStr[] = --- 1628,1636 ---- #define TSAIHSING_FILTER 3 #define TSAIHSING_LABEL 4 + #define TSAIHSING_SEARCH_FORWARD 5 + #define TSAIHSING_SEARCH_BACKWARD 6 + #define TSAIHSING_SEARCH_AGAIN 7 ! #define MAXTSAIHSINGMENUS 8 static char * tsaiHsingMenuStr[] = *************** *** 1493,1497 **** "OutputMultiPage", "FilterDrawing", ! "GenerateLabel" }; --- 1639,1646 ---- "OutputMultiPage", "FilterDrawing", ! "GenerateLabel", ! "SearchForward", ! "SearchBackward", ! "SearchAgain" }; *************** *** 1501,1506 **** char * c_ptr; ! if ((c_ptr = getenv("USER")) == NULL) return; ! if (strcmp(c_ptr,"william") != 0) return; CornerLoop (&x, &y); --- 1650,1655 ---- char * c_ptr; ! /* if ((c_ptr = getenv("USER")) == NULL) return; */ ! /* if (strcmp(c_ptr,"william") != 0) return; */ CornerLoop (&x, &y); *************** *** 1515,1518 **** --- 1664,1670 ---- case TSAIHSING_FILTER: FilterDrawing (); break; case TSAIHSING_LABEL: GenLabel (); break; + case TSAIHSING_SEARCH_FORWARD: Search (SEARCH_FORWARD, FALSE); break; + case TSAIHSING_SEARCH_BACKWARD: Search (SEARCH_BACKWARD, FALSE); break; + case TSAIHSING_SEARCH_AGAIN: SearchAgain (); break; } return; *** tsaihsing.e.orig Wed Jan 6 22:14:58 1993 --- tsaihsing.e Wed Jan 6 22:14:59 1993 *************** *** 3,8 **** * * Copyright (C) 1990, 1991, William Cheng. ! * @(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/tsaihsing.e,v 1.3 91/07/15 23:32:31 william Exp $ */ extern void TsaiHsing (); --- 3,9 ---- * * Copyright (C) 1990, 1991, William Cheng. ! * @(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/tsaihsing.e,v 1.4 1992/12/14 04:41:08 william Exp $ */ + extern void SearchAgain (); extern void TsaiHsing (); *** Imakefile.orig Wed Jan 6 22:15:01 1993 --- Imakefile Wed Jan 6 22:15:02 1993 *************** *** 4,11 **** /**/# Copyright (C) 1990, 1991, William Cheng. /**/# ! /**/# @(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/Imakefile,v 1.15 1992/12/10 05:36:12 william Exp $ /**/# ! CGIFVERSION = 2.12 PROGRAMS = cgif unixtomac CDEBUGFLAGS= -g --- 4,11 ---- /**/# Copyright (C) 1990, 1991, William Cheng. /**/# ! /**/# @(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/Imakefile,v 1.16 1993/01/05 17:00:17 william Exp $ /**/# ! CGIFVERSION = 2.12-p1 PROGRAMS = cgif unixtomac CDEBUGFLAGS= -g *************** *** 58,69 **** InstallNonExec(cgif.Xdefaults,$(TGIFDIR)) tar: rm -f cgif-$(CGIFVERSION).tar/**/* ! tar cvf cgif-$(CGIFVERSION).tar /**/*.c /**/*.e \ ! Imakefile Sorted.obj compress cgif-$(CGIFVERSION).tar - - CGIF_FILES = README /**/*.c /**/*.e Imakefile Makefile.noimake cgif.Xdefaults \ - spelling.xbm Sample.obj portrait_1.obj portrait_2.obj distr: version --- 58,68 ---- InstallNonExec(cgif.Xdefaults,$(TGIFDIR)) + CGIF_FILES = README /**/*.c /**/*.e Imakefile Makefile.noimake cgif.Xdefaults \ + spelling.xbm Sample.obj portrait_1.obj portrait_2.obj + tar: rm -f cgif-$(CGIFVERSION).tar/**/* ! tar cvf cgif-$(CGIFVERSION).tar $(CGIF_FILES) Addresses Sorted.obj compress cgif-$(CGIFVERSION).tar distr: version *** cgif.Xdefaults.orig Wed Jan 6 22:15:04 1993 --- cgif.Xdefaults Wed Jan 6 22:15:04 1993 *************** *** 2,6 **** ! Please add the following to your .Xdefaults file. ! ! ! @(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/cgif.Xdefaults,v 1.1 1992/10/26 07:44:28 william Exp $ ! ! Tgif --- 2,6 ---- ! Please add the following to your .Xdefaults file. ! ! ! @(#)$Header: /amnt/kona/tangram/u/william/X11/TGIF2/Chinese/RCS/cgif.Xdefaults,v 1.2 1992/12/14 01:24:38 william Exp $ ! ! Tgif *************** *** 22,24 **** Tgif*Tmp1File: portrait_1.obj Tgif*Tmp2File: portrait_2.obj ! !Tgif*StateConstraints: CA 922 --- 22,31 ---- Tgif*Tmp1File: portrait_1.obj Tgif*Tmp2File: portrait_2.obj ! ! If the following entry is enabled, only generate labels for people ! ! in California whose ZIP code is neither 94* nor 95* OR for anybody ! ! who lives outside of California. ! !Tgif*StateConstraints: CA\n\ ! ! ~CA 94\n\ ! ! ~CA 95\n\ ! ! ||\n\ ! ! ~CA