Newsgroups: comp.sources.unix From: glover@credit.erin.utoronto.ca (Mike Glover) Subject: v29i078: cdk - curses development kit, V4.6.0, Part05/09 References: <1.821493023.9103@gw.home.vix.com> Sender: unix-sources-moderator@gw.home.vix.com Approved: vixie@gw.home.vix.com Submitted-By: glover@credit.erin.utoronto.ca (Mike Glover) Posting-Number: Volume 29, Issue 78 Archive-Name: cdk-4.6.0/part05 #!/bin/sh # This is `part05' (part 5 of a multipart archive). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `cdk-4.6.0/entry.c' is being continued... # touch -am 1231235999 $$.touch >/dev/null 2>&1 if test ! -f 1231235999 && test -f $$.touch; then shar_touch=touch else shar_touch=: echo echo 'WARNING: not restoring timestamps. Consider getting and' echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 1231235999 $$.touch # if test ! -r _sharseq.tmp; then echo 'Please unpack part 1 first!' exit 1 fi shar_sequence=`cat _sharseq.tmp` if test "$shar_sequence" != 5; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping cdk-4.6.0/entry.c' else echo 'x - continuing file cdk-4.6.0/entry.c' sed 's/^X//' << 'SHAR_EOF' >> '_sharuue.tmp' && XM("!["B`@("`@("`@("`@('!L86EN8VAAPH@("`@ XM("`@("`@("`O*B!5<&1A=&4@=&AE(&-H87)A8W1E2T^"TQ73L* XM("`@("`@("`@("`@?0H@("`@("`@("`@("!E;G1R>2T^:6YF;UL@96YT2T^;&5F=&-H87)=(#T@<&QA:6YC:&%R.PH*("`@ XM("`@("`@("`@+RH@57!D871E('1H92!S8W)E96XN"0D)"0DJ+PH@("`@("`@ XM("`@("!I9B`H"65N=')Y+3YD:7-P='EP92`]/2!V2$E.5"!\?"!E;G1R>2T^ XM9&ES<'1Y<&4@/3T@=DA#2$%2('Q\(%P*"0D)96YT7!E(#T] XM('9(34E8140@?'P@96YT7!E(#T]('952$-(05(@?'P@7`H) XM"0EE;G1R>2T^9&ES<'1Y<&4@/3T@=DQ(0TA!4B!\?"!E;G1R>2T^9&ES<'1Y XM<&4@/3T@=E5(34E8140@?'P@7`H)"0EE;G1R>2T^9&ES<'1Y<&4@/3T@=DQ( XM34E8140@*0H@("`@("`@("`@("!["B`@("`@("`@("`@("`@(&UV=VEN2T^9FEE;&0L(#`L(&5N=')Y+3YS8W)E96YC;VPK*RP@)RXG('P@ XM96YT2T^9FEE;&0L(#`L(&5N=')Y+3YS8W)E96YC;VPK*RP@<&QA:6YC:&%R XM('P@96YT2T^:6YF;UMT96UP+3%="3T@<&QA:6YC:&%R.PH@("`@("`@ XM("`@("!E;G1R>2T^:6YF;UMT96UP70D](&5N=')Y+3YF:6QL97(@)B!!7T-( XM05)415A4.PH@("`@("`@("`@("!E;G1R>2T^:6YF;UMT96UP*S%="3T@)UPP XM)SL*"B`@("`@("`@("`@("\J(%5P9&%T92!T:&4@2T^9&ES<'1Y<&4@/3T@=DA)3E0@?'P@96YT XM7!E(#T]('9(0TA!4B!\?"!<"@D)"65N=')Y+3YD:7-P='EP XM92`]/2!V2$U)6$5$('Q\(&5N=')Y+3YD:7-P='EP92`]/2!V54A#2$%2('Q\ XM(%P*"0D)96YT7!E(#T]('9,2$-(05(@?'P@96YT7!E(#T]('952$U)6$5$('Q\(%P*"0D)96YT7!E(#T] XM('9,2$U)6$5$("D*("`@("`@("`@("`@>PH@("`@("`@("`@("`@("!M=G=A XM9&1C:"`H96YT2T^9FEE;&1W:61T:"TR+"`G XM+B<@?"!E;G1R>2T^9FEE;&1A='1R*3L*("`@("`@("`@("`@?0H@("`@("`@ XM("`@("!E;'-E"B`@("`@("`@("`@('L*("`@("`@("`@("`@("`@;79W861D XM8V@@*&5N=')Y+3YF:65L9"P@,"P@96YT2T^9FEE;&0L(#`L(&5N=')Y+3YF:65L9'=I9'1H+3$I.PH@("`@ XM("`@("`@("!W2D*>PH@("`O*B!$96-L87)E(&QO8V%L('9A"LK*0H@("![ XM"B`@("`@(&UV=V%D9&-H("AE;G1R>2T^9FEE;&0L(#`L('@L(&5N=')Y+3YF XM:6QL97(I.PH@("!]"@H@("`O*B!2969R97-H('1H92!E;G1R>2!F:65L9"X) XM"0D)"0DJ+PH@("!W2`H0T1+14Y44ED@*F5N=')Y+"!B;V]L96%N($)O>"D*>PH@("`O*B!% XM2`H96YT2T^"`H96YT2T^;&%B96QW:6XI.PH*("`@+RH@4F5D2!F:65L9"X)"0D)"0DJ+PH@("!D"`\(&5N=')Y+3YF:65L9'=I9'1H XM.R!X*RLI"B`@('L*("`@("`@;79W861D8V@@*&5N=')Y+3YF:65L9"P@,"P@ XM>"P@96YT2T^2T^;&5F=&-H87(@/2`P.PH@("`@("`@("!E XM;G1R>2T^"LK*0H@("!["B`@ XM("`@(&UV=V%D9&-H("AE;G1R>2T^9FEE;&0L(#`L('@M96YT2T^:6YF;UMX72D["B`@('T*("`@=VUO=F4@*&5N=')Y+3YF XM:65L9"P@,"P@96YT2`H0T1+14Y44ED@*F5N XM=')Y*0I["B`@('=E2T^;&%B96QW:6XI.PH@("!W97)A2T^2T^4-$2T5N=')Y("A#1$M%3E1262`J96YT2`H96YT7!E("AE;G1R>2T^;&%B96PI.PH@("!F2T^;&%B96QW:6XI.PH@("!I9B`H XM96YTPH@("`@("!D96QW:6X@*&5N=')Y+3YS:&%D XM;W=W:6XI.PH@("!]"@H@("`O*B!5;G)E9VES=&5R('1H:7,@;V)J96-T+@D) XM"0D)"2HO"B`@('5N2`H0T1+ XM14Y44ED@*F5N=')Y+"!C:&%R("IN97=686QU92P@:6YT(&UI;BP@:6YT(&UA XM>"P@8F]O;&5A;B!B;W@I"GL*("`@+RH@1&5C;&%R92!L;V-A;"!V87)I86)L XM97,N"0D)"0D)*B\*("`@:6YT(&-O<'EC:&%R2T^;6%X"0D](&UA>#L*("`@96YT`D)/2!B;W@["@H@("`O*B!)9B!T:&4@<&]I;G1ER`*("`@("`@+RH@5&AE;B!W92!W XM86YT('1O(&IU2T^;6%X XM*3L*"B`@("\J($]++"!E2!I XM;B!T:&4@;F5W('9A;'5E+@D)*B\*("`@8VQE86Y#:&%R("AE;G1R>2T^:6YF XM;RP@96YT"P@)UPP)RD["B`@('-T6-H87)S*3L*?0IT X` Xend SHAR_EOF echo 'File cdk-4.6.0/entry.c is complete' && echo 'uudecoding file cdk-4.6.0/entry.c' && uudecode _sharuue.tmp < _sharuue.tmp && rm -f _sharuue.tmp && $shar_touch -am 1229121095 'cdk-4.6.0/entry.c' && chmod 0400 'cdk-4.6.0/entry.c' || echo 'restore of cdk-4.6.0/entry.c failed' shar_count="`wc -c < 'cdk-4.6.0/entry.c'`" test 19691 -eq "$shar_count" || echo "cdk-4.6.0/entry.c: original size 19691, current size $shar_count" rm -f _sharnew.tmp fi # ============= cdk-4.6.0/graph.c ============== if test -f 'cdk-4.6.0/graph.c' && test X"$1" != X"-c"; then echo 'x - skipping cdk-4.6.0/graph.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting cdk-4.6.0/graph.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'cdk-4.6.0/graph.c' && X#include "cdk.h" X X/* X * $Author: glover $ X * $Date: 1995/12/15 23:49:30 $ X * $Revision: 1.23 $ X */ X X/* X * This creates a graph widget. X */ XCDKGRAPH *newCDKGraph (CDKSCREEN *cdkscreen, int xplace, int yplace, int height, int width, char *title, char *xtitle, char *ytitle) X{ X /* Declare local variables. */ X CDKGRAPH *graph = (CDKGRAPH *)malloc (sizeof (CDKGRAPH)); X int xpos = xplace; X int ypos = yplace; X X /* Rejustify the x and y positions if we need to. */ X alignxy (cdkscreen->window, &xpos, &ypos, width+3, height); X X /* Create the graph pointer */ X graph->parent = cdkscreen->window; X graph->win = newwin (height, width+3, ypos, xpos); X graph->boxHeight = height; X graph->boxWidth = width+3; X graph->box = NOBOX; X graph->minx = 0; X graph->maxx = 0; X graph->xscale = 0; X graph->yscale = 0; X graph->displayType = vLINE; X X /* Is the graph pointer NULL??? */ X if (graph->win == (WINDOW *)NULL) X { X /* Clean up any memory used. */ X free (graph); X X /* Return a NULL pointer. */ X return ( (CDKGRAPH *)NULL ); X } X X /* Translate the graph title char * to a chtype * */ X if (title != (char *)NULL) X { X graph->title = char2Chtype (title, &graph->titlelen, &graph->titlepos); X graph->titlepos = justifyString (graph->boxWidth, graph->titlelen, graph->titlepos); X } X else X { X graph->title = char2Chtype ("Untitled", &graph->titlelen, &graph->titlepos); X graph->titlepos = justifyString (graph->boxWidth, graph->titlelen, graph->titlepos); X } X X /* Translate the X Axis title char * to a chtype * */ X if (xtitle != (char *)NULL) X { X graph->xtitle = char2Chtype (xtitle, &graph->xtitlelen, &graph->xtitlepos); X graph->xtitlepos = justifyString (graph->boxHeight, graph->xtitlelen, graph->xtitlepos); X } X else X { X graph->xtitle = char2Chtype ("X Axis", &graph->xtitlelen, &graph->xtitlepos); X graph->xtitlepos = justifyString (graph->boxHeight, graph->xtitlelen, graph->xtitlepos); X } X X /* Translate the Y Axis title char * to a chtype * */ X if (ytitle != (char *)NULL) X { X graph->ytitle = char2Chtype (ytitle, &graph->ytitlelen, &graph->ytitlepos); X graph->ytitlepos = justifyString (graph->boxWidth, graph->ytitlelen, graph->ytitlepos); X } X else X { X graph->ytitle = char2Chtype ("Y Axis", &graph->ytitlelen, &graph->ytitlepos); X graph->ytitlepos = justifyString (graph->boxWidth, graph->ytitlelen, graph->ytitlepos); X } X X /* Set some values of the graph structure. */ X graph->graphchar = (chtype *)NULL; X X /* Register this baby. */ X registerCDKObject (cdkscreen, vGRAPH, graph); X X /* Return the graph pointer. */ X return (graph); X} X X/* X * This sets the values of the graph. X */ Xint setCDKGraph (CDKGRAPH *graph, int *values, int count, char *graphChars, boolean startAtZero, EGraphDisplayType displayType) X{ X /* Declare local variables. */ X int min = 99999999; X int max = (min * -1); X int x = 0; X int charCount, temp; X X /* Keep the display type. */ X graph->displayType = displayType; X X /* Remove the old graph char if it exists. */ X freeChtype (graph->graphchar); X graph->graphchar = char2Chtype (graphChars, &charCount, &temp); X X /* Check if the number of characters back is the same as the number */ X /* of elements in the list. */ X if (charCount < count) X { X /* Oops. Better let them know. */ X freeChtype (graph->graphchar); X return (FALSE); X } X X /* Copy the X values. */ X for (x=0; x values[x] = values[x]; X } X graph->count = count; X graph->minx = min; X graph->maxx = max; X X /* Check the start at zero status. */ X if (startAtZero) X { X graph->minx = 0; X } X X /* Determine the scales. */ X graph->xscale = ((graph->maxx - graph->minx) / (graph->boxHeight - 5)); X graph->yscale = ((graph->boxWidth-4) / count); X return (TRUE); X} X X/* X * This function draws the graph widget. X */ Xvoid drawCDKGraph (CDKGRAPH *graph, boolean Box) X{ X /* Declare local variables. */ X int x = 0; X int y = 0; X int adj = 0; X chtype attrib = ' '|A_REVERSE; X char temp[100]; X X /* Keep the box information. */ X graph->box = Box; X X /* Erase the old object... */ X eraseCDKGraph (graph); X X /* Draw in the vertical axis */ X drawLine (graph->win, 2, 1, 2, graph->boxHeight-3, ACS_VLINE); X X /* Draw in the horizontal axis */ X drawLine (graph->win, 3, graph->boxHeight-3, graph->boxWidth, graph->boxHeight-3, ACS_HLINE); X X /* Draw in the graph title. */ X if (graph->title != (chtype *)NULL) X { X writeChtype (graph->win, graph->titlepos, 0, graph->title, HORIZONTAL, 0, graph->titlelen); X } X X /* Draw in the X axis title. */ X if (graph->xtitle != (chtype *)NULL) X { X writeChtype (graph->win, 0, graph->xtitlepos, graph->xtitle, VERTICAL, 0, graph->xtitlelen); X attrib = graph->xtitle[0] & A_ATTRIBUTES; X } X X /* Draw in the X axis high value. */ X sprintf (temp, "%d", graph->maxx); X writeCharAttrib (graph->win, 1, 1, temp, attrib, VERTICAL, 0, strlen(temp)); X X /* Draw in the X axis low value. */ X sprintf (temp, "%d", graph->minx); X writeCharAttrib (graph->win, 1, graph->boxHeight-2-strlen(temp), temp, attrib, VERTICAL, 0, strlen(temp)); X X /* Draw in the Y axis title. */ X if (graph->ytitle != (chtype *)NULL) X { X writeChtype (graph->win, graph->ytitlepos, graph->boxHeight-1, graph->ytitle, HORIZONTAL, 0, graph->ytitlelen); X attrib = graph->ytitle[0] & A_ATTRIBUTES; X } X X /* Draw in the Y axis high value. */ X sprintf (temp, "%d", graph->count); X writeCharAttrib (graph->win, graph->boxWidth-strlen(temp)-1, graph->boxHeight-2, temp, attrib, HORIZONTAL, 0, strlen(temp)); X X /* Draw in the Y axis low value. */ X sprintf (temp, "0"); X writeCharAttrib (graph->win, 3, graph->boxHeight-2, temp, attrib, HORIZONTAL, 0, strlen(temp)); X X /* Draw in the lines. */ X adj = 3; X for (y=0; y < graph->count; y++) X { X int colheight = (graph->values[y] / graph->xscale) - 1; X mvwaddch (graph->win, graph->boxHeight-3, adj-1, ACS_TTEE); X X /* If this is a plot graph, all we do is draw a dot. */ X if (graph->displayType == vPLOT) X { X int temploc = graph->boxHeight-4-colheight; X mvwaddch (graph->win, temploc, adj, graph->graphchar[y]); X adj += 2; X } X else X { X for (x=0; x <= graph->yscale; x++) X { X /* Draw a line. */ X drawLine (graph->win, adj, graph->boxHeight-4-colheight, adj, graph->boxHeight-4, graph->graphchar[y]); X adj++; X } X } X } X X /* Draw in the axis corners. */ X mvwaddch (graph->win, 0, 2, ACS_URCORNER); X mvwaddch (graph->win, graph->boxHeight-3, 2, ACS_LLCORNER); X mvwaddch (graph->win, graph->boxHeight-3, graph->boxWidth, ACS_URCORNER); X X /* Refresh and lets see 'er. */ X wrefresh (graph->win); X wrefresh (graph->parent); X} X X/* X * This function destroys the graph widget. X */ Xvoid destroyCDKGraph (CDKGRAPH *graph) X{ X /* Erase the object. */ X eraseCDKGraph (graph); X X /* Clear up the char pointers. */ X freeChtype (graph->title); X freeChtype (graph->xtitle); X freeChtype (graph->ytitle); X freeChtype (graph->graphchar); X X /* Clean up the windows. */ X delwin (graph->win); X X /* Unregister this object. */ X unregisterCDKObject (vGRAPH, graph); X X /* Finish cleaning up. */ X free (graph); X} X X/* X * This function erases the graph widget from the screen. X */ Xvoid eraseCDKGraph (CDKGRAPH *graph) X{ X werase (graph->win); X wrefresh (graph->win); X} SHAR_EOF $shar_touch -am 1229121095 'cdk-4.6.0/graph.c' && chmod 0400 'cdk-4.6.0/graph.c' || echo 'restore of cdk-4.6.0/graph.c failed' shar_count="`wc -c < 'cdk-4.6.0/graph.c'`" test 7984 -eq "$shar_count" || echo "cdk-4.6.0/graph.c: original size 7984, current size $shar_count" rm -f _sharnew.tmp fi # ============= cdk-4.6.0/fselect.c ============== if test -f 'cdk-4.6.0/fselect.c' && test X"$1" != X"-c"; then echo 'x - skipping cdk-4.6.0/fselect.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting cdk-4.6.0/fselect.c (binary)' sed 's/^X//' << 'SHAR_EOF' > _sharuue.tmp && Xbegin 600 cdk-4.6.0/fselect.c XM(VEN8VQU9&4@(F-D:RYH(@H@"B\J"B`J("1!=71H;W(Z(&UI:V5G("0*("H@ XM)$1A=&4Z(#$Y.34O,3(O,3(@,34Z,S(Z,3(@)`H@*B`D4F5V:7-I;VXZ(#$N XM,30@)`H@*B\*(`HO*B!$96-L87)E(&QO8V%L(&9U;F-T:6]N('!R;W1O='EP XM97,N"0D)"0DJ+PIV;VED(&=E=$1I7!E(&]B XM:F5C=%1Y<&4L('9O:60@*F]B:F5C="P@=F]I9"`J8VQI96YT1&%T82D["G9O XM:60@9V5T1&ER3F%M92`H14]B:F5C=%1Y<&4@;V)J96-T5'EP92P@=F]I9"`J XM;V)J96-T+"!V;VED("IC;&EE;G1$871A*3L*=F]I9"!D96QE=&5&:6QE("A% XM3V)J96-T5'EP92!O8FIE8W14>7!E+"!V;VED("IO8FIE8W0L('9O:60@*F-L XM:65N=$1A=&$I.PH*+RH*("H@5&AI7!E(&9I96QD071T7!E(&AI9VAL:6=H="P@8VAA%=I9'1H"0D]('=I9'1H.PH@("!I;G0@ XM8F]X2&5I9VAT"3T@:&5I9VAT.PH@("!I;G0@>'!O2`H8V1K7!O$AE:6=H="D["@H@("`O*B!3970@ XM=&AE(&AE:6=H="!A;F0@=VED=&@@=F%L=65S+@D)"0D)*B\*("`@8F]X5VED XM=&@@/2`H=VED=&@@/"`Q-2`_(#$U(#H@=VED=&@I.PH@("!B;WA(96EG:'0@ XM/2`H:&5I9VAT(#P@-B`_(#8@.B!H96EG:'0I.PH*("`@+RH@36%K92!T:&4@ XM9FEL92!S96QE8W1O%=I9'1H+"!Y<&]S+"!X<&]S*3L* XM"B`@("\J($ES('1H92!W:6YD;W<@3E5,3#\_/PD)"0D)"2HO"B`@(&EF("AF XM"LK*0H@("!["B`@("`@(&9S96QE8W0M/F1I XM5=I9'1H XM(#T@8F]X5VED=&@@+2`X.PH@("!F2`K XM(#(L"@D)"6)O>$AE:6=H="`M(#,L(&)O>%=I9'1H+`H)"0DH8VAA49I;&5I;F9O+"!F XM49I;&5I;F9O+"!F2X)"0D) XM"0DJ+PH@("!R96=IPH@("`@("!DPH@("`@("!F#TP.R!X(#P@ XM9G-E;&5C="T^9FEL94-O=6YT97([('@K*RD*("`@>PH@("`@("`O*B!3=&%T XM('1H92!F:6QE+@D)"0D)"0DJ+PH@("`@("!LPH@("`@("`@("`@;6]D92`]("PH@("`@("`@("!S<')I;G1F("AT96UP+"`B)7-`(BP@9&ER3&ES=%MX XM72D["B`@("`@("`@(&9S96QE8W0M/F1I4-H XM87(@*'1E;7`I.PH@("`@("!]"B`@("`@(&5L%T@/2!C;W!Y0VAAPH@("`@("`@("!S<')I;G1F("AT XM96UP+"`B)7,E8R(L(&1I%TL(&UO9&4I.PH@("`@("`@("!F2X)"0D) XM"2HO"B`@("`@(&9R965#:&%R("AD:7),:7-T6WA=*3L*("`@?0H*("`@+RH@ XM0VQO2X)"0D)"0DJ+PH@("!C;&]S961IPH@("`@("`O*B!!8W1I=F%T92!T:&4@ XMPH@("`@("`@("!R971U7!E+@D)"0D)*B\*("`@("`@;'-T870@*&9I;&5N86UE+"`F XM9FEL95-T870I.PH@("`@("!R96=U;&%R1FEL90D]("@@4U])4U)%1RAF:6QE XM4W1A="YS=%]M;V1E*2`_(#$@.B`P*3L*("`@("`@:68@*')E9W5L87)&:6QE XM*0H@("`@("!["B`@("`@("`@("\J($ET)W,@82!R96=U;&%R(&9I;&4L(&-R XM96%T92!T:&4@9G5L;"!P871H+@D)"2HO"B`@("`@("`@('-P2X)"0D)"2HO XM"B`@("`@("`@(&9R964@*&9I;&5N86UE*3L*"B`@("`@("`@("\J(%)E='5R XM;B!T:&4@8V]M<&QE=&4@<&%T:&YA;64N"0D)"2HO"B`@("`@("`@(')E='5R XM;B`H(&9S96QE8W0M/G!A=&AN86UE("D["B`@("`@('T*("`@("`@96QS90H@ XM("`@("!["B`@("`@("`@("\J($-R96%T92!T:&4@9&ER96-T;W)Y(&YA;64N XM"0D)"0DJ+PH@("`@("`@("!S<')I;G1F("AT96UP+"`B)7,O)7,B+"!F2X)"0D)"2HO"B`@("`@("`@(&9R964@*&9I;&5N86UE XM*3L*"B`@("`@("`@("\J(%-E="!T:&4@9FEL92!S96QE8W1O7!E(&]B:F5C=%1Y<&4L('9O:60@*F]B:F5C="P@=F]I9"`J8VQI XM96YT1&%T82D*>PH@("`O*B!$96-L87)E(&QO8V%L('9A3L*"B`@("\J($%C=&EV871E('1H92!E;G1R XM>2!F:65L9"X)"0D)"0DJ+PH@("!D:7)E8W1O2`H9F5N=')Y*2D["@H@("`O*B!#:&5C:R!T:&4@9&ER XM96-T;W)Y+V9I;&5N86UE"0D)"0DJ+PH@("!L2P@8VAT>7!E XM(&9I96QD071T2P@<&]P('5P(&$@;&ET=&QE(&UE4-H87(@*'1E;7`I.PH*("`@("`@4-H XM87(@*'1E;7`I.PH*("`@("`@;65S9ULR72`]("(@(CL*("`@("`@;65S9ULS XM72`]("(\0SY02!I="X) XM"2HO"B`@(&EF("AFPH@("`@("`O*B!296UO=F4@=&AE(&]L9"!P;VEN=&5R"6%N9"!S XM970@=&AE(&YE=R!V86QU92X)"0DJ+PH@("`@("!F4-H XM87(@*&QI;FM!='1R:6)U=&4I.PH@("!]"B`@(&EF("AF2!F:65L9"X)"0D)*B\*("`@2P@9G-E;&5C="T^<'=D+"`P+"`U,3(L(&9E;G1R>2T^8F]X*3L*("`@9')A XM=T-$2T5N=')Y("AF96YT2T^8F]X*3L*"B`@("\J($=E="!T XM:&4@9&ER96-T;W)Y(&-O;G1E;G1S+@D)"0D)*B\*("`@9V5T1&ER0V]N=&5N XM=',@*&9S96QE8W0I.PH*("`@+RH@4V5T('1H92!V86QU97,@:6X@=&AE('-C XM"D[ XM"GT*"B\J"B`J(%1H:7,@9&5S=')O>7,@=&AE(&9I;&4@#L*"B`@("\J($5R87-E('1H92!F:6QE('-E;&5C=&]R XM+@D)"0D)"2HO"B`@(&5R87-E0T1+1G-E;&5C="`H9G-E;&5C="D["@H@("`O XM*B!&#TP.R!X(#P@ XM9G-E;&5C="T^9FEL94-O=6YT97([('@K*RD*("`@>PH@("`@("!FPH@("`@("!D96QW:6X@*&9S96QE8W0M/G-H861O XM=W=I;BD["B`@('T*("`@9&5L=VEN("AF49I;&5I;F9O("A%3V)J96-T5'EP92!O XM8FIE8W14>7!E+"!V;VED("IO8FIE8W0L('9O:60@*F-L:65N=$1A=&$I"GL* XM("`@+RH@1&5C;&%R92!L;V-A;"!V87)I86)L97,N"0D)"0D)*B\*("`@0T1+ XM4T-23TQ,"0DJ9G-C7!E,D-H87(@*&9S8W)O;&PM XM/FET96U;9G-CPH@("`@("!F:6QE='EP92`](")3;V-K970B.PH@("!]"B`@(&5LPH@("`@("!F XM:6QE='EP92`](")296=U;&%R($9I;&4B.PH@("!]"B`@(&5LPH@("`@("!F:6QE='EP XM92`](")$:7)E8W1OPH@("`@("!F:6QE='EP92`](")#:&%R XM86-T97(@1&5V:6-E(CL*("`@?0H@("!E;'-E(&EF("@@4U])4T),2RAF:6QE XM4W1A="YS=%]M;V1E*2`I"B`@('L*("`@("`@9FEL971Y<&4@/2`B0FQO8VL@ XM1&5V:6-E(CL*("`@?0H@("!E;'-E(&EF("@@4U])4T9)1D\H9FEL95-T870N XM7!E(#T@(D9)1D\@1&5V:6-E XM(CL*("`@?0H@("!E;'-E"B`@('L*("`@("`@9FEL971Y<&4@/2`B56YK;F]W XM;B(["B`@('T*"B`@("\J($=E="!T:&4@=7-E4-H87(@*'1E;7`I.PH*("`@F4@("`@("`@.B`\+U4^)6QD/"%5/B!B>71EF4I.PH@("!M97-G6S1=(#T@8V]P>4-H87(@*'1E;7`I.PH*("`@ XM4-H87(@ XM*'1E;7`I.PH*("`@;65S9ULX72`]("(@(CL*("`@;65S9ULY72`]("(\0SY0 XM4-$2TQA8F5L XM("AI;F9O3&%B96PI.PH@("!F"X)"0D)"0DJ+PH@("!Q=65S XM=&EO;B`](&YE=T-$2T1I86QO9R`H9G-E;&5C="T^65S XM('1H96X@=')Y('1O(&YU:V4@:70N"0D)"2HO"B`@(&EF("AA8W1I=F%T94-$ XM2T1I86QO9R`H<75E2!T;R!C;VYT:6YU92XB XM.PH@("`@("`@("!P;W!5<$UE _sharnew.tmp echo 'x - extracting cdk-4.6.0/histogram.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'cdk-4.6.0/histogram.c' && X#include "cdk.h" X X/* X * $Author: glover $ X * $Date: 1995/12/10 02:16:34 $ X * $Revision: 1.30 $ X */ X X/* X * This creates a histogram widget. X */ XCDKHISTOGRAM *newCDKHistogram (CDKSCREEN *cdkscreen, int xplace, int yplace, int lplace, int height, int width, int orient, char *label, boolean box, boolean shadow) X{ X /* Declare local variables. */ X CDKHISTOGRAM *histogram = (CDKHISTOGRAM *)malloc (sizeof (CDKHISTOGRAM)); X int boxwidth = 0; X int boxheight = height + 2; X int xpos = xplace; X int ypos = yplace; X int labelxoffset = 0; X int labelyoffset = 0; X int fieldxoffset = 0; X int fieldyoffset = 0; X int junk = 0; X char *plainLabel; X X /* Translate the char * to a chtype * */ X histogram->label = char2Chtype (label, &histogram->labellen, &junk); X plainLabel = chtype2Char (histogram->label); X boxwidth = width + histogram->labellen + 3; X X /* Adjust the offset values given the location of the label. */ X alignlabel (plainLabel, lplace, width, &boxwidth, &boxheight, &labelxoffset, &labelyoffset, &fieldxoffset, &fieldyoffset); X freeChar (plainLabel); X X /* Rejustify the x and y positions if we need to. */ X alignxy (cdkscreen->window, &xpos, &ypos, boxwidth, boxheight); X X /* Create the histogram pointer. */ X histogram->parent = cdkscreen->window; X histogram->win = newwin (boxheight, boxwidth, ypos, xpos); X histogram->shadowwin = (WINDOW *)NULL; X histogram->labelwin = subwin (cdkscreen->window, 1, histogram->labellen+2, ypos+labelyoffset, xpos+labelxoffset); X histogram->width = width; X histogram->height = height; X histogram->orient = orient; X histogram->shadow = shadow; X X /* Is the window NULL. */ X if (histogram->win == (WINDOW *)NULL) X { X /* Remove the labelwin if its not NULL. */ X if ( histogram->labelwin != (WINDOW *)NULL) X { X delwin (histogram->labelwin); X } X X /* Clean up any memory used. */ X freeChtype (histogram->label); X free (histogram); X X /* Return a NULL pointer. */ X return ( (CDKHISTOGRAM *)NULL ); X } X X /* Set up some default values. */ X histogram->filler = '#' | A_REVERSE; X histogram->statsattr = A_NORMAL; X histogram->statspos = TOP; X histogram->viewtype = vREAL; X histogram->high = 0; X histogram->low = 0; X histogram->value = 0; X histogram->chars = 0; X histogram->lowx = 0; X histogram->lowy = 0; X histogram->highx = 0; X histogram->highy = 0; X histogram->labelx = 0; X histogram->labely = 0; X histogram->statsx = 0; X histogram->statsy = 0; X histogram->histx = 0; X histogram->histy = 0; X histogram->lowchar = (char *)NULL; X histogram->highchar = (char *)NULL; X histogram->statschar = (char *)NULL; X histogram->box = box; X X /* Do we want a shadow??? */ X if (shadow) X { X histogram->shadowwin = subwin (cdkscreen->window, boxheight, boxwidth, ypos+1, xpos+1); X } X X /* Register this baby. */ X registerCDKObject (cdkscreen, vHISTOGRAM, histogram); X X /* Return this thing. */ X return (histogram); X} X X/* X * This sets the values for the histogram. X */ Xvoid setCDKHistogram (CDKHISTOGRAM *histogram, EHistogramDisplayType viewtype, int statspos, chtype statsattr, int low, int high, int value, chtype filler, boolean box) X{ X /* Declare local variables. */ X char string[100]; X int adj; X float temp; X X /* Keep the box info. */ X histogram->box = box; X X /* We should error check the information we have. */ X histogram->low = (low <= high ? low : 0); X histogram->high = (low <= high ? high : 0); X histogram->value = ( low <= value && value <= high ? value : 0); X X /* Set some of the basic values. */ X histogram->statspos = statspos; X histogram->statsattr = statsattr; X histogram->filler = filler; X histogram->viewtype = viewtype; X histogram->percent = (histogram->high == 0 ? 0 : ( (float)histogram->value / (float)histogram->high )); X if (histogram->orient == VERTICAL) X { X temp = histogram->percent * (float)histogram->height; X } X else X { X temp = histogram->percent * (float)histogram->width; X } X histogram->chars = ( (float)abs(temp) == (float)temp ? (int)temp : (int)temp + 1); X X /* We have a number of variables which determine the personality of */ X /* the histogram. We have to go through each one methodically, and */ X /* set them correctly. This section does this. */ X if (histogram->viewtype != vNONE) X { X if (histogram->orient == VERTICAL) X { X /* Set the vertical adjustment var */ X adj = (histogram->label != (chtype *)NULL ? histogram->labellen + 1 : 0); X X /* Make a vertical histogram the exception. */ X if (histogram->statspos == LEFT || histogram->statspos == TOP) X { X /* Set the character strings correctly. */ X freeChar (histogram->lowchar); X freeChar (histogram->highchar); X freeChar (histogram->statschar); X X /* Set the low label attributes. */ X sprintf (string, "%d", histogram->low); X histogram->lowchar = copyChar (string); X histogram->lowx = histogram->height - (int)strlen (string) + 2; X histogram->lowy = adj; X X /* Set the high label attributes. */ X sprintf (string, "%d", histogram->high); X histogram->highchar = copyChar (string); X histogram->highx = 0; X histogram->highy = adj; X X /* Set the stats label attributes. */ X if (histogram->viewtype == vPERCENT) X { X sprintf (string, "%3.1f%%", (float) (histogram->percent * 100)); X } X else if (histogram->viewtype == vFRACTION) X { X sprintf (string, "%d/%d", histogram->value, histogram->high); X } X else X { X sprintf (string, "%d", histogram->value); X } X histogram->statschar = copyChar (string); X histogram->statsx = ((histogram->height - (int)strlen(string)) / 2) + 1; X histogram->statsy = adj; X } X else if (histogram->statspos == RIGHT || histogram->statspos == BOTTOM) X { X /* Set the character strings correctly. */ X freeChar (histogram->lowchar); X freeChar (histogram->highchar); X freeChar (histogram->statschar); X X /* Set the low label attributes. */ X sprintf (string, "%d", histogram->low); X histogram->lowchar = copyChar (string); X histogram->lowx = histogram->height - (int)strlen (string) + 2; X histogram->lowy = histogram->width + 1; X X /* Set the high label attributes. */ X sprintf (string, "%d", histogram->high); X histogram->highchar = copyChar (string); X histogram->highx = 0; X histogram->highy = histogram->width + 1; X X /* Set the stats label attributes. */ X if (histogram->viewtype == vPERCENT) X { X sprintf (string, "%3.2f%%", (float) (histogram->percent * 100)); X } X else if (histogram->viewtype == vFRACTION) X { X sprintf (string, "%d/%d", histogram->value, histogram->high); X } X else X { X sprintf (string, "%d", histogram->value); X } X histogram->statschar = copyChar (string); X histogram->statsx = ((histogram->height - (int)strlen(string)) / 2) + 1; X histogram->statsy = histogram->width + 1; X } X X /* Set the histogram positions attributes. */ X histogram->histx = histogram->height - histogram->chars + 1; X histogram->histy = adj; X } X else X { X /* Set the vertical adjustment var */ X adj = (histogram->label != (chtype *)NULL ? histogram->labellen + 1 : 0); X X /* Make horizontal the default. */ X if (histogram->statspos == TOP || histogram->statspos == LEFT) X { X /* Set the character strings correctly. */ X freeChar (histogram->lowchar); X freeChar (histogram->highchar); X freeChar (histogram->statschar); X X /* Set the low label attributes. */ X sprintf (string, "%d", histogram->low); X histogram->lowchar = copyChar (string); X histogram->lowx = 0; X histogram->lowy = adj; X X /* Set the high label attributes. */ X sprintf (string, "%d", histogram->high); X histogram->highchar = copyChar (string); X histogram->highx = 0; X histogram->highy = histogram->width - (int)strlen (string) + adj + 1; X X /* Set the stats label attributes. */ X if (histogram->viewtype == vPERCENT) X { X sprintf (string, "%3.1f%%", (float) (histogram->percent * 100)); X } X else if (histogram->viewtype == vFRACTION) X { X sprintf (string, "%d/%d", histogram->value, histogram->high); X } X else X { X sprintf (string, "%d", histogram->value); X } X histogram->statschar = copyChar (string); X histogram->statsx = 0; X histogram->statsy = ((histogram->width - (int)strlen(string)) / 2) + adj + 1; X } X else if (histogram->statspos == BOTTOM || histogram->statspos == RIGHT) X { X /* Set the character strings correctly. */ X freeChar (histogram->lowchar); X freeChar (histogram->highchar); X freeChar (histogram->statschar); X X /* Set the low label attributes. */ X sprintf (string, "%d", histogram->low); X histogram->lowchar = copyChar (string); X histogram->lowx = histogram->height + 1; X histogram->lowy = adj; X X /* Set the high label attributes. */ X sprintf (string, "%d", histogram->high); X histogram->highchar = copyChar (string); X histogram->highx = histogram->height + 1; X histogram->highy = histogram->width - (int)strlen (string) + adj + 1; X X /* Set the stats label attributes. */ X if (histogram->viewtype == vPERCENT) X { X sprintf (string, "%3.1f%%", (float) (histogram->percent * 100)); X } X else if (histogram->viewtype == vFRACTION) X { X sprintf (string, "%d/%d", histogram->value, histogram->high); X } X else X { X sprintf (string, "%d", histogram->value); X } X histogram->statschar = copyChar (string); X histogram->statsx = histogram->height + 1; X histogram->statsy = ((histogram->width - (int)strlen(string)) / 2) + adj + 1; X } X else if (histogram->statspos == CENTER) X { X /* Set the character strings correctly. */ X freeChar (histogram->lowchar); X freeChar (histogram->highchar); X freeChar (histogram->statschar); X X /* Set the low label attributes. */ X sprintf (string, "%d", histogram->low); X histogram->lowchar = copyChar (string); X histogram->lowx = (histogram->height == 1 ? 1 : (histogram->height / 2) ); X histogram->lowy = adj; X X /* Set the high label attributes. */ X sprintf (string, "%d", histogram->high); X histogram->highchar = copyChar (string); X histogram->highx = (histogram->height == 1 ? 1 : (histogram->height / 2) ); X histogram->highy = histogram->width - (int)strlen (string) + adj + 1; X X /* Set the stats label attributes. */ X if (histogram->viewtype == vPERCENT) X { X sprintf (string, "%3.1f%%", (float) (histogram->percent * 100)); X } X else if (histogram->viewtype == vFRACTION) X { X sprintf (string, "%d/%d", histogram->value, histogram->high); X } X else X { X sprintf (string, "%d", histogram->value); X } X histogram->statschar = copyChar (string); X histogram->statsx = (histogram->height == 1 ? 1 : (histogram->height / 2) ); X histogram->statsy = ((histogram->width - (int)strlen(string)) / 2) + adj + 1; X } X } X } X} X X/* X * This function draws the histogram. X */ Xvoid drawCDKHistogram (CDKHISTOGRAM *histogram, boolean Box) X{ X /* Declare the local variables. */ X int x = 0; X int y = 0; X X /* Erase the old object... */ X eraseCDKHistogram (histogram); X X /* Box the widget if asked. */ X if (Box) X { X box (histogram->win, histogram->statsattr | ACS_VLINE, histogram->statsattr |ACS_HLINE); X } X X /* Do we have a shadow to draw??? */ X if (histogram->shadow) X { X drawShadow (histogram->shadowwin); X } X X /* Draw the histogram. */ X if (histogram->orient == VERTICAL) X { X /* Declare the local vars. */ X int temp = (int)strlen (histogram->highchar); X chtype fattr, fchar, battr, bchar; X X /* Draw in the high label */ X for (x=0; x < temp; x++) X { X mvwaddch (histogram->win, histogram->highx + x, X histogram->highy, X histogram->highchar[x] | histogram->statsattr); X } X X /* Draw in the low label */ X temp =(int)strlen (histogram->lowchar); X for (x=0; x < temp; x++) X { X mvwaddch (histogram->win, histogram->lowx + x, X histogram->lowy, X histogram->lowchar[x] | histogram->statsattr); X } X X /* Draw in the stats label */ X temp =(int)strlen (histogram->statschar); X for (x=0; x < temp; x++) X { X mvwaddch (histogram->win, histogram->statsx + x, X histogram->statsy, X histogram->statschar[x] | histogram->statsattr); X } X X /* Draw in the histogram. */ X temp = histogram->labellen; X fattr = histogram->filler & A_ATTRIBUTES; X fchar = histogram->filler & A_CHARTEXT; X X for (x=histogram->histx; x <= histogram->height; x++) X { X for (y=1; y <= histogram->width; y++) X { X#ifdef WINCHBUG X battr = ' ' | A_REVERSE; X#else X battr = mvwinch (histogram->win, x, y+temp ); X#endif X fchar = battr & A_ATTRIBUTES; X bchar = battr & A_CHARTEXT; X if (bchar == ' ') X { X mvwaddch (histogram->win, x, y+temp, histogram->filler); X } X else X { X mvwaddch (histogram->win, x, y+temp, battr | fattr); X } X } X } X wrefresh (histogram->win); X X /* Draw in the label */ X writeChtype (histogram->labelwin, 0, 0, histogram->label, HORIZONTAL, 0, histogram->labellen); X wrefresh (histogram->labelwin); X } X else X { X /* Declare the local vars. */ X int temp = (int)strlen (histogram->highchar); X chtype fattr, fchar, battr, bchar; X int x, y; X X /* Draw in the high label */ X for (x=0; x < temp; x++) X { X mvwaddch (histogram->win, histogram->highx, X histogram->highy + x, X histogram->highchar[x] | histogram->statsattr); X } X X /* Draw in the low label */ X temp = (int)strlen (histogram->lowchar); X for (x=0; x < temp; x++) X { X mvwaddch (histogram->win, histogram->lowx, X histogram->lowy + x, X histogram->lowchar[x] | histogram->statsattr); X } X X /* Draw in the stats label */ X temp = (int)strlen (histogram->statschar); X for (x=0; x < temp; x++) X { X mvwaddch (histogram->win, histogram->statsx, X histogram->statsy + x, X histogram->statschar[x] | histogram->statsattr); X } X X /* Set up some variables we need for the histogram. */ X temp = histogram->labellen; X fattr = histogram->filler & A_ATTRIBUTES; X fchar = histogram->filler & A_CHARTEXT; X X /* Draw in the histogram. */ X for (x=1; x <= histogram->height; x++) X { X for (y=0; y < histogram->chars; y++) X { X /* Get the character and split it into its elements */ X#ifdef WINCHBUG X battr = ' ' | A_REVERSE; X#else X battr = mvwinch (histogram->win, x, y+temp ); X#endif X bchar = battr & A_CHARTEXT; X fchar = battr & A_ATTRIBUTES; X X /* If there was nothing there, put the histogram */ X /* down. */ X if (bchar == ' ') X { X mvwaddch (histogram->win, x, y+temp, histogram->filler); X } X else X { X mvwaddch (histogram->win, x, y+temp, bchar | fattr); X } X } X } X wrefresh (histogram->win); X X /* Draw in the label */ X writeChtype (histogram->labelwin, 0, 0, histogram->label, HORIZONTAL, 0, histogram->labellen); X wrefresh (histogram->labelwin); X } X} X X/* X * This function destroys the histogram. X */ Xvoid destroyCDKHistogram (CDKHISTOGRAM *histogram) X{ X /* Erase the object. */ X eraseCDKHistogram (histogram); X X /* Clean up the char pointers. */ X freeChtype (histogram->label); X freeChar (histogram->lowchar); X freeChar (histogram->highchar); X freeChar (histogram->statschar); X X /* Clean up the windows. */ X delwin (histogram->win); X delwin (histogram->labelwin); X if (histogram->shadow) X { X delwin (histogram->shadowwin); X } X X /* Unregister this object. */ X unregisterCDKObject (vHISTOGRAM, histogram); X X /* Finish cleaning up. */ X free (histogram); X} X X/* X * This function erases the histogram from the screen. X */ Xvoid eraseCDKHistogram (CDKHISTOGRAM *histogram) X{ X werase (histogram->win); X werase (histogram->labelwin); X wrefresh (histogram->win); X wrefresh (histogram->labelwin); X X /* Do we need to erase the shadow... */ X if (histogram->shadow) X { X werase (histogram->shadowwin); X wrefresh (histogram->shadowwin); X } X} SHAR_EOF $shar_touch -am 1229121095 'cdk-4.6.0/histogram.c' && chmod 0400 'cdk-4.6.0/histogram.c' || echo 'restore of cdk-4.6.0/histogram.c failed' shar_count="`wc -c < 'cdk-4.6.0/histogram.c'`" test 18650 -eq "$shar_count" || echo "cdk-4.6.0/histogram.c: original size 18650, current size $shar_count" rm -f _sharnew.tmp fi # ============= cdk-4.6.0/itemlist.c ============== if test -f 'cdk-4.6.0/itemlist.c' && test X"$1" != X"-c"; then echo 'x - skipping cdk-4.6.0/itemlist.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting cdk-4.6.0/itemlist.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'cdk-4.6.0/itemlist.c' && X#include "cdk.h" X X/* X * $Author: glover $ X * $Date: 1995/12/10 02:16:34 $ X * $Revision: 1.5 $ X */ X X/* X * This creates a pointer to an itemlist widget. X */ XCDKITEMLIST *newCDKItemlist (CDKSCREEN *cdkscreen, int xplace, int yplace, int lplace, char *label, char **item, int count, int defaultItem, boolean box, boolean shadow) X{ X /* Set up some variables. */ X CDKITEMLIST *itemlist = (CDKITEMLIST *)malloc (sizeof (CDKITEMLIST)); X char *plainlabel = (char *)NULL; X int boxwidth = 0; X int boxheight = 3; X int fieldWidth = 0; X int xpos = xplace; X int ypos = yplace; X int labelxoffset = 0; X int labelyoffset = 0; X int fieldxoffset = 0; X int fieldyoffset = 0; X int temp = 0; X int x; X X /* Translate the label char *pointer to a chtype pointer. */ X itemlist->label = char2Chtype (label, &itemlist->labellen, &temp); X plainlabel = chtype2Char (itemlist->label); X X /* Go through the list and determine the widest item. */ X for (x=0; x < count; x++) X { X /* Copy the item to the list. */ X itemlist->item[x] = char2Chtype (item[x], &itemlist->itemlen[x], &itemlist->itempos[x]); X fieldWidth = (fieldWidth < itemlist->itemlen[x] ? itemlist->itemlen[x] : fieldWidth); X } X fieldWidth += 2; X X /* Now we need to justify the strings. */ X for (x=0; x < count; x++) X { X itemlist->itempos[x] = justifyString (fieldWidth, itemlist->itemlen[x], itemlist->itempos[x]); X } X X /* Adjust the offset values given the location of the label. */ X alignlabel (plainlabel, lplace, fieldWidth, &boxwidth, &boxheight, &labelxoffset, &labelyoffset, &fieldxoffset, &fieldyoffset); X freeChar (plainlabel); X X /* Rejustify the x and y positions if we need to. */ X alignxy (cdkscreen->window, &xpos, &ypos, boxwidth, boxheight); X X /* Make the label window. */ X itemlist->win = newwin (boxheight, boxwidth, ypos, xpos); X X /* Is the window NULL ??? */ X if (itemlist->win == (WINDOW *)NULL) X { X /* Clean up the pointers. */ X freeChtype (itemlist->label); X free (itemlist); X X /* Exit with NULL. */ X return ( (CDKITEMLIST *)NULL ); X } X X /* Make the field window. */ X itemlist->fieldwin = subwin (cdkscreen->window, 1, fieldWidth, ypos+fieldyoffset, xpos+fieldxoffset); X itemlist->labelwin = subwin (cdkscreen->window, 1, itemlist->labellen+1, ypos+labelyoffset, xpos+labelxoffset); X keypad (itemlist->fieldwin, TRUE); X X /* Set up the rest of the structure. */ X itemlist->parent = cdkscreen->window; X itemlist->shadowwin = (WINDOW *)NULL; X itemlist->fieldWidth = fieldWidth; X itemlist->itemCount = count-1; X itemlist->box = box; X itemlist->shadow = shadow; X X /* Set then default item. */ X if (defaultItem >= 0 && defaultItem <= itemlist->itemCount) X { X itemlist->currentItem = defaultItem; X itemlist->defaultItem = defaultItem; X } X else X { X itemlist->currentItem = 0; X itemlist->defaultItem = 0; X } X X /* Do we want a shadow??? */ X if (shadow) X { X itemlist->shadowwin = newwin (boxheight, boxwidth, ypos+1, xpos+1); X } X X /* Clean the key bindings. */ X cleanCDKObjectBindings (vITEMLIST, itemlist); X X /* Register this baby. */ X registerCDKObject (cdkscreen, vITEMLIST, itemlist); X X /* Return the pointer to the structure */ X return (itemlist); X} X X/* X * This allows the user to play with the widget. X */ Xint activateCDKItemlist (CDKITEMLIST *itemlist) X{ X /* Declare some local variables. */ X chtype input; X X /* Draw the widget. */ X drawCDKItemlist (itemlist, itemlist->box); X X /* Let 'em play.... */ X for (;;) X { X /* Get the input from the user. */ X input = wgetch (itemlist->fieldwin); X X /* Check a predefined binding. */ X if ( ! checkCDKObjectBind (vITEMLIST, itemlist, input) ) X { X switch (input) X { X case KEY_UP : case KEY_RIGHT : case ' ' : case '+' : case 'n' : X if (itemlist->currentItem < itemlist->itemCount ) X { X itemlist->currentItem++; X } X else X { X itemlist->currentItem = 0; X } X break; X X case KEY_DOWN : case KEY_LEFT : case '-' : case 'p' : X if (itemlist->currentItem > 0 ) X { X itemlist->currentItem--; X } X else X { X itemlist->currentItem = itemlist->itemCount; X } X break; X X case 'd' : case 'D' : X itemlist->currentItem = itemlist->defaultItem; X break; X X case '0' : X itemlist->currentItem = 0; X break; X X case '$' : X itemlist->currentItem = itemlist->itemCount; X break; X X case KEY_RETURN : case KEY_TAB : case CDK_NEXT : X return ( itemlist->currentItem ); X break; X X case CDK_REFRESH : X refreshCDKScreen (itemlist->screen); X break; X X default : X Beep(); X break; X } X } X X /* Redraw the field. */ X drawCDKItemlistField (itemlist); X } X} X X/* X * This draws the widget on the screen. X */ Xvoid drawCDKItemlist (CDKITEMLIST *itemlist, int Box) X{ X /* Erase the widget from the screen. */ X eraseCDKItemlist (itemlist); X X /* Did we ask for a shadow? */ X if (itemlist->shadow) X { X drawShadow (itemlist->shadowwin); X } X X /* Box the widget if asked. */ X if (Box) X { X box (itemlist->win, ACS_VLINE, ACS_HLINE); X wrefresh (itemlist->win); X } X X /* Draw in the label to the widget. */ X writeChtype (itemlist->labelwin, 0, 0, itemlist->label, HORIZONTAL, 0, itemlist->labellen); X wrefresh (itemlist->labelwin); X X /* Draw in the field. */ X drawCDKItemlistField (itemlist); X} X X/* X * This function draws the contents of the field. X */ Xvoid drawCDKItemlistField (CDKITEMLIST *itemlist) X{ X /* Declare local vars. */ X int currentItem = itemlist->currentItem; X int x; X X /* Draw in the current item in the field. */ X werase (itemlist->fieldwin); X for (x=0; x < itemlist->itemlen[currentItem]; x++) X { X mvwaddch (itemlist->fieldwin, 0, x+itemlist->itempos[currentItem], itemlist->item[currentItem][x]); X } X wrefresh (itemlist->fieldwin); X} X X/* X * This function removes the widget from the screen. X */ Xvoid eraseCDKItemlist (CDKITEMLIST *itemlist) X{ X werase (itemlist->fieldwin); X werase (itemlist->labelwin); X werase (itemlist->win); X wrefresh (itemlist->win); X X /* Do we want to erase the shadow. */ X if (itemlist->shadow) X { X werase (itemlist->shadowwin); X wrefresh (itemlist->shadowwin); X } X} X X/* X * This function destroys the widget and all the memory it used. X */ Xvoid destroyCDKItemlist (CDKITEMLIST *itemlist) X{ X /* Declare local variables. */ X int x; X X /* Erase the object. */ X eraseCDKItemlist (itemlist); X X /* Clear out the character pointers. */ X freeChtype (itemlist->label); X for (x=0; x <= itemlist->itemCount; x++) X { X freeChtype (itemlist->item[x]); X } X X /* Delete the windows. */ X delwin (itemlist->fieldwin); X delwin (itemlist->labelwin); X delwin (itemlist->win); X if (itemlist->shadow) X { X delwin (itemlist->shadowwin); X } X X /* Unregister this object. */ X unregisterCDKObject (vITEMLIST, itemlist); X X /* Finish cleaning up. */ X free (itemlist); X} X X/* X * This function sets the contents of the list. X */ Xvoid setCDKItemlist (CDKITEMLIST *itemlist, char **item, int count, int defaultItem, boolean box) X{ X /* Declare local variables. */ X int x; X X /* Free up the old memory. */ X for (x=0; x <= itemlist->itemCount; x++) X { X freeChtype (itemlist->item[x]); X } X X /* Copy in the new information. */ X itemlist->itemCount = count-1; X for (x=0; x <= itemlist->itemCount; x++) X { X /* Copy the new stuff in. */ X itemlist->item[x] = char2Chtype (item[x], &itemlist->itemlen[x], &itemlist->itempos[x]); X itemlist->itempos[x] = justifyString (itemlist->fieldWidth, itemlist->itemlen[x], itemlist->itempos[x]); X } X X /* Set the box flag. */ X itemlist->box = box; X X /* Set the default item. */ X if (defaultItem >= 0 && defaultItem <= itemlist->itemCount) X { X itemlist->currentItem = defaultItem; X itemlist->defaultItem = defaultItem; X } X X /* Draw the field. */ X drawCDKItemlistField (itemlist); X} SHAR_EOF $shar_touch -am 1229121095 'cdk-4.6.0/itemlist.c' && chmod 0400 'cdk-4.6.0/itemlist.c' || echo 'restore of cdk-4.6.0/itemlist.c failed' shar_count="`wc -c < 'cdk-4.6.0/itemlist.c'`" test 8749 -eq "$shar_count" || echo "cdk-4.6.0/itemlist.c: original size 8749, current size $shar_count" rm -f _sharnew.tmp fi # ============= cdk-4.6.0/label.c ============== if test -f 'cdk-4.6.0/label.c' && test X"$1" != X"-c"; then echo 'x - skipping cdk-4.6.0/label.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting cdk-4.6.0/label.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'cdk-4.6.0/label.c' && X#include "cdk.h" X X/* X * $Author: glover $ X * $Date: 1995/12/10 02:16:34 $ X * $Revision: 1.28 $ X */ X X/* X * This creates a label widget. X */ XCDKLABEL *newCDKLabel(CDKSCREEN *cdkscreen, int xplace, int yplace, char **mesg, int rows, boolean box, boolean shadow) X{ X /* Maintain the label information */ X CDKLABEL *label = (CDKLABEL *)malloc (sizeof (CDKLABEL)); X int boxWidth = 0; X int boxHeight = rows + 2; X int xpos = xplace; X int ypos = yplace; X int x = 0; X X /* Determine the box width. */ X for (x=0; x < rows; x++) X { X /* Translate the char * to a chtype. */ X label->info[x] = char2Chtype (mesg[x], &label->infolen[x], &label->infopos[x]); X boxWidth = MAX(boxWidth, label->infolen[x]); X } X boxWidth += 2; X X /* Create the string alignments. */ X for (x=0; x < rows; x++) X { X label->infopos[x] = justifyString (boxWidth, label->infolen[x], label->infopos[x]); X } X X /* Rejustify the x and y positions if we need to. */ X alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); X X /* Create the label */ X label->parent = cdkscreen->window; X label->win = newwin (boxHeight, boxWidth, ypos, xpos); X label->shadowwin = (WINDOW *)NULL; X label->xpos = xpos; X label->ypos = ypos; X label->rows = rows; X label->width = boxWidth; X label->box = box; X label->shadow = shadow; X X /* Is the window NULL??? */ X if (label->win == (WINDOW *)NULL) X { X /* Free up any memory used. */ X for (x=0; x < rows; x++) X { X freeChtype (label->info[x]); X } X free(label); X X /* Return a NULL pointer. */ X return ( (CDKLABEL *)NULL ); X } X X /* If a shadow was requested, then create the shadow window. */ X if (shadow) X { X label->shadowwin = newwin (boxHeight, boxWidth, ypos+1, xpos+1); X } X X /* Register this baby. */ X registerCDKObject (cdkscreen, vLABEL, label); X X /* Return the label pointer. */ X return (label); X} X X/* X * This draws the label widget. X */ Xvoid drawCDKLabel (CDKLABEL *label, boolean Box) X{ X /* Declare local variables. */ X int x = 0; X X /* Keep the box information. */ X label->box = Box; X X /* Erase the label widget from the screen. */ X eraseCDKLabel (label); X X /* Box the widget if asked. */ X if (label->box) X { X box (label->win, ACS_VLINE, ACS_HLINE); X } X X /* Is there a shadow??? */ X if (label->shadow) X { X drawShadow (label->shadowwin); X } X X /* Draw in the message. */ X for (x=0; x < label->rows; x++) X { X writeChtype (label->win, label->infopos[x], x+1, label->info[x], HORIZONTAL, 0, label->infolen[x]); X } X wrefresh (label->win); X} X X/* X * This erases the label widget. X */ Xvoid eraseCDKLabel (CDKLABEL *label) X{ X werase (label->win); X wrefresh (label->win); X X /* Do we need to erase the shadow win. */ X if (label->shadow) X { X werase (label->shadowwin); X wrefresh (label->shadowwin); X } X} X X/* X * This destroys the label object pointer. X */ Xvoid destroyCDKLabel (CDKLABEL *label) X{ X /* Declare local variables. */ X int x = 0; X X /* Erase the old label. */ X eraseCDKLabel (label); X X /* Free up the character pointers. */ X for (x=0; x < label->rows ; x++) X { X freeChtype (label->info[x]); X } X X /* Free up the window pointers. */ X delwin (label->win); X X /* Is there a shadow with this widget??? */ X if (label->shadow) X { X delwin (label->shadowwin); X } X X /* Unregister the object. */ X unregisterCDKObject (vLABEL, label); X X /* Free the object pointer. */ X free (label); X} X X/* X * This pauses until a user hits a key... X */ Xchar waitCDKLabel (CDKLABEL *label, char key) X{ X /* If the key is null, we'll accept anything. */ X if ( key == (char)NULL ) X { X return (wgetch (label->win)); X } X else X { X /* Only exit when a specific key is hit. */ X char newkey; X for (;;) X { X newkey = wgetch(label->win); X if (newkey == key) X { X return ( newkey ); X } X } X } X} SHAR_EOF $shar_touch -am 1229121095 'cdk-4.6.0/label.c' && chmod 0400 'cdk-4.6.0/label.c' || echo 'restore of cdk-4.6.0/label.c failed' shar_count="`wc -c < 'cdk-4.6.0/label.c'`" test 4121 -eq "$shar_count" || echo "cdk-4.6.0/label.c: original size 4121, current size $shar_count" rm -f _sharnew.tmp fi # ============= cdk-4.6.0/marquee.c ============== if test -f 'cdk-4.6.0/marquee.c' && test X"$1" != X"-c"; then echo 'x - skipping cdk-4.6.0/marquee.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting cdk-4.6.0/marquee.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'cdk-4.6.0/marquee.c' && X#include "cdk.h" X X/* X * $Author: glover $ X * $Date: 1995/12/10 02:16:34 $ X * $Revision: 1.24 $ X */ X X/* X * This creates a marquee widget. X */ XCDKMARQUEE *newCDKMarquee (CDKSCREEN *cdkscreen, int xplace, int yplace, int width, boolean shadow) X{ X CDKMARQUEE *marquee = (CDKMARQUEE *)malloc (sizeof (CDKMARQUEE)); X int xpos = xplace; X int ypos = yplace; X int boxheight = 3; X int boxwidth = width + 2; X X /* Rejustify the x and y positions if we need to. */ X alignxy (cdkscreen->window, &xpos, &ypos, boxwidth, boxheight); X X /* Create the marquee pointer. */ X marquee->parent = cdkscreen->window; X marquee->win = newwin (boxheight, boxwidth, ypos, xpos); X marquee->shadowwin = (WINDOW *)NULL; X marquee->active = TRUE; X marquee->width = width; X marquee->box = NOBOX; X marquee->shadow = shadow; X X /* Is the window NULL??? */ X if (marquee->win == (WINDOW *)NULL) X { X /* Clean up any memory. */ X free (marquee); X X /* Return a NULL pointer. */ X return ( (CDKMARQUEE *)NULL ); X } X X /* Register this baby. */ X registerCDKObject (cdkscreen, vMARQUEE, marquee); X X /* Return the marquee pointer. */ X return(marquee); X} X X/* X * This activates the marquee. X */ Xint activateCDKMarquee (CDKMARQUEE *marquee, char *mesg, int delay, int repeat, boolean box) X{ X /* Declear local variables. */ X chtype *message; X int mesglength = 0; X int startpos = 0; X int firstchar = 0; X int lastchar = 1; X int repeatCount = 0; X int viewsize = 0; X#ifdef NOUSLEEP X int sleeper = 0; X#endif X int x, y, junk; X X /* Keep the box info. */ X marquee->box = box; X X /* Make sure the message has some content. */ X if (mesg == (char *)NULL) X { X return (-1); X } X X /* Translate the char * to a chtype * */ X message = char2Chtype (mesg, &mesglength, &junk); X X /* Draw in the marquee. */ X drawCDKMarquee (marquee, box); X X /* Set up the variables. */ X viewsize = lastchar - firstchar; X startpos = marquee->width - viewsize + 1; X X /* Start doing the marquee thing... */ X for (;;) X { X if (marquee->active) X { X /* Draw in the characters. */ X y = firstchar; X for (x=startpos ; x < (startpos+viewsize) ; x++) X { X mvwaddch (marquee->win, 1, x, message[y]); X y++; X } X wrefresh (marquee->win); X X /* Set my variables. */ X if (mesglength < marquee->width-2) X { X if (lastchar < mesglength) X { X lastchar ++; X viewsize ++; X startpos = marquee->width - viewsize + 1; X } X else if (lastchar == mesglength) X { X if (startpos > 1) X { X /* This means the whole string is visible. */ X startpos --; X viewsize = mesglength; X } X else X { X /* We have to start chopping the viewsize */ X startpos = 1; X firstchar ++; X viewsize --; X } X } X } X else X { X if (startpos > 1) X { X lastchar ++; X viewsize ++; X startpos --; X } X else X { X if (lastchar < mesglength) X { X firstchar ++; X lastchar ++; X viewsize = marquee->width; X startpos = 1; X } X else X { X firstchar ++; X viewsize --; X startpos = 1; X } X } X } X X /* OK, lets check if we have to start over. */ X if ( viewsize == 0 && firstchar == mesglength) X { X /* Check if we need to repeat or not. */ X repeatCount ++; X if (repeat > 0 && repeatCount == repeat) X { X freeChtype (message); X return (0); X } X X /* Time to start over. */ X mvwaddch (marquee->win, 1, 1, ' '|A_NORMAL); X wrefresh (marquee->win); X#ifndef NOUSLEEP X curs_set(0); X#endif X firstchar = 0; X lastchar = 1; X viewsize = lastchar - firstchar; X startpos = marquee->width - viewsize + 1; X } X X /* Now sleep */ X#ifdef NOUSLEEP X for (sleeper = 0; sleeper <= (delay * 250) ; sleeper++) {} X#else X usleep ( (delay * 10000) ); X#endif X } X else X { X printf ("\r\n\r\n\r\n\r\nMarquee turned off\r\n"); X } X } X} X X/* X * This draws the marquee widget on the screen. X */ Xvoid drawCDKMarquee (CDKMARQUEE *marquee, boolean Box) X{ X /* Keep the box information. */ X marquee->box = Box; X X /* Erase the old object... */ X eraseCDKMarquee (marquee); X X /* Do we need to draw a shadow??? */ X if (marquee->shadow) X { X drawShadow (marquee->shadowwin); X } X X /* Box it if needed. */ X if (Box) X { X box (marquee->win, ACS_VLINE, ACS_HLINE); X wrefresh (marquee->win); X } X} X X/* X * This destroys the marquee. X */ Xvoid destroyCDKMarquee (CDKMARQUEE *marquee) X{ X /* Erase the object. */ X eraseCDKMarquee (marquee); X X /* Clean up the windows. */ X delwin (marquee->win); X if (marquee->shadow) X { X delwin (marquee->shadowwin); X } X X /* Unregister this object. */ X unregisterCDKObject (vMARQUEE, marquee); X X /* Finish cleaning up. */ X free (marquee); X} X X/* X * This erases the marquee. X */ Xvoid eraseCDKMarquee (CDKMARQUEE *marquee) X{ X werase (marquee->win); X wrefresh (marquee->win); X if (marquee->shadow) X { X werase (marquee->shadowwin); X wrefresh (marquee->shadowwin); X } X} SHAR_EOF $shar_touch -am 1229121095 'cdk-4.6.0/marquee.c' && chmod 0400 'cdk-4.6.0/marquee.c' || echo 'restore of cdk-4.6.0/marquee.c failed' shar_count="`wc -c < 'cdk-4.6.0/marquee.c'`" test 5915 -eq "$shar_count" || echo "cdk-4.6.0/marquee.c: original size 5915, current size $shar_count" rm -f _sharnew.tmp fi # ============= cdk-4.6.0/matrix.c ============== if test -f 'cdk-4.6.0/matrix.c' && test X"$1" != X"-c"; then echo 'x - skipping cdk-4.6.0/matrix.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting cdk-4.6.0/matrix.c (binary)' sed 's/^X//' << 'SHAR_EOF' > _sharuue.tmp && Xbegin 600 cdk-4.6.0/matrix.c XM(VEN8VQU9&4@(F-D:RYH(@H*+RH*("H@)$%U=&AO7!L86-E.PH@("!I;G0@;6%X4F]W5&ET XM;&57:61T:`D](#`["B`@(&EN="!B96=X+"!B96=Y+"!X+"!Y+"!Z+"!W+"!C XM96QL=VED=&@["B`@(&EN="!R;W=S<&%C90D)/2!-05@@*#`L(')S<&%C92D[ XM"B`@(&EN="!C;VQS<&%C90D)/2!-05@@*#`L(&-S<&%C92D["@H@("`O*B!- XM86ME('-UF5R;RX)*B\*("`@:68@*')O=W,@/3T@,"!\?"!C;VQS XM(#T](#`@?'P@=G)O=W,@/3T@,"!\?"!V8V]L7-I8V%L XM('-I>F4N"0D)"0D)*B\*("`@=G)O=W,@/2`H=G)O=W,@/B!R;W=S(#\@"`\/2!V"LK*0H@("![ XM"B`@("`@(&)O>&AE:6=H="`K/2`S("L@#TQ.R!X(#P](')O XM=W,[('@K*RD*("`@>PH@("`@("!M871R:7@M/G)O=W1I=&QE6WA=(#T@8VAA XM"T^%TL("9M871R:7@M/G)O=W1I=&QE<&]S6WA=*3L*("`@("`@;6%X4F]W5&ET XM;&57:61T:"`]($U!6"`H;6%X4F]W5&ET;&57:61T:"P@;6%T2!T:&4@"`\/2!R;W=S.R!X*RLI"B`@('L* XM("`@("`@;6%T"T^%TL(&UA=')I XM>"T^%TI.PH@("!]"@H@("`O*B!$971E#TQ.R!X(#P] XM('9C;VQS.R!X*RLI"B`@('L*("`@("`@8F]X=VED=&@@*ST@8V]L=VED=&AS XM6WA=("L@,B`K(&-O;'-P86-E.PH@("!]"B`@(&)O>'=I9'1H+2T["B`@(&)O XM>&AE:6=H="LK.PH*("`@+RH@4F5J=7-T:69Y('1H92!X(&%N9"!Y('!O'D@*&-D:W-C'!O'=I9'1H+"!B;WAH96EG:'0I XM.PH*("`@+RH@36%K92!T:&4@<&]P+75P('=I;F1O=RX)"0D)"0DJ+PH@("!M XM871R:7@M/G=I;B`](&YE=W=I;B`H8F]X:&5I9VAT+"!B;WAW:61T:"P@>7!O XM'!OBLK*0H@ XM("`@("!["B`@("`@("`@(&9R965#:'1Y<&4@*&UA=')I>"T^ETI.PH@("`@("!]"B`@("`@(&9R964@*&UA=')I>"D["@H@("`@("`O*B!2 XM971U'!O2`]('EP;W,@*R`Q.PH*("`@+RH@36%K92!T:&4@)V5M<'1Y)R`P XM>#`@8V5L;"X)"0D)"2HO"B`@(&UA=')I>"T^8V5L;%LP75LP72`]('-U8G=I SHAR_EOF : || echo 'restore of cdk-4.6.0/matrix.c failed' fi echo 'End of archive part 5' echo 'File cdk-4.6.0/matrix.c is continued in part 6' echo 6 > _sharseq.tmp exit 0