mrr@amanpt1.Newport.RI.US (Mark Rinfret) (10/12/89)
This posting is in 5 parts and offers an Amiga date requester module for use in applications where it is appropriate/necessary to solicit dates from the user. Also included is a stand-alone application which can be driven by an ARexx macro. All components of the date can be set/retrieved by an ARexx macro script. See the "test" and "listsince" macro files for examples. Mark Rinfret, 10/11/89 ============================================================================ #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 5)." # Contents: MRDateReq.h MRDateReq.pw.uue MRDates.h MRGadgets.c # MRGadgets.h MakeFile ReadMe listsince minrexx.h rxdatereq.c test # Wrapped by mrr@mrramiga on Wed Oct 11 18:10:16 1989 # This shar was created for Amiga and may have pathnames which # are incompatible with Unix. Replace colon (:) with slash (/) # in offending pathnames. if test -f MRDateReq.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MRDateReq.h\" else echo shar: Extracting \"MRDateReq.h\" \(1436 characters\) sed "s/^X//" >MRDateReq.h <<'END_OF_MRDateReq.h' X/* MRDateReq.h - definitions of the date requester package. */ X X#ifndef _MRDATEREQ_H X#define _MRDATEREQ_H X#include <libraries/dos.h> X#include "MRDates.h" X X/* The following structure defines a packet used to interface with the X * MRDateRequest function. It is highly recommended that objects of this X * type be dynamically allocated using AllocMem() (or equivalent) to X * insure that the base address of the structure is longword-aligned. X * Also note that the pointer to a structure of this type is equivalent X * to a "struct DateTime *" since the first field in this structure is X * an embedded ARP DateTime structure. X */ Xtypedef struct { X /* The following fields are filled in by the caller: */ X struct DateTime ARPDatePacket; X char *prompt; X struct Window *window; X X /* The following fields are filled in by MRDateRequest: */ X struct Requester *requester; /* for local use only! */ X MRDate newDate; /* alternate format date */ X int status; /* result code */ X int myStrings; /* true => strings are mine */ X } MRDatePacket; X Xvoid FreeMRDatePacket(/* MRDatePacket *thePacket */); XMRDatePacket * CreateMRDatePacket(/* struct DateStamp *theDate, X int theFormat, int makeStrings */); Xint MRDateRequest(/* MRDatePacket *datePacket */); X X#endif END_OF_MRDateReq.h echo shar: Missing newline added to \"MRDateReq.h\" if test 1436 -ne `wc -c <MRDateReq.h`; then echo shar: \"MRDateReq.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f MRDateReq.pw.uue -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MRDateReq.pw.uue\" else echo shar: Extracting \"MRDateReq.pw.uue\" \(9085 characters\) sed "s/^X//" >MRDateReq.pw.uue <<'END_OF_MRDateReq.pw.uue' X Xbegin 644 MRDateReq.pw XM4&]W97)7:6YD;W=S('8R+C5B(*DQ.3@W+"`Q.3@X(&)Y($E.3U9!5%)/3DE#T XM4RP@24Y#+B`@("`@("`@("`@("`@("`@("`@("`@```#[`````(@`8!L````% XM`0`````!``````]-4D1A=&5297$N<'<N8P```````````0`#``(```C@``4`O XM!?____\`````````````````````````````````'@`@&2@``0````$```$`# XM!``+`3@`?``%``7_____````&45N=&5R($1A=&4@+R!$871E($9O<FUA=```U XM*77``!,`%P`H``@```@#``0`*74$```````GA+@``````"EU,````"EU8/__6 XM__\````%`"EU%````````````"D````I``D````)```````````"`0$`__;_1 XM]P``````*6ZH`````````!$@665A<B!-;VYT:"!$87D@``````4Q.3<X````: XM`1(```@!`"ESD``GB!``)X\P`"EUB``I=:``*76P````"WEE87)'861G970`G XM`````0`````!``````Q914%27T=!1$=%5``````!``````$``"EV\`!"`!<`T XM&@`(``,``P`$`"EU[``````````````````I=B@````I=EC_____````!0`I> XM=?P````````````;````&P`)````"0``````````````!4IA;@``````$``#J XM``$`*7:``"EVF``I=J@`*7:X`"EVT``I=N`````,;6]N=&A'861G970`````A XM`0`````!``````U-3TY42%]'041'150``````0`````!```I>.``;@`7`!L`# XM"```"`,`!``I=QP`````````````````*7=8````*7>(_____P````4`*7<L` XM````````````'````!P`"0````D```````````````4P,0`@`````1(```@!L XM`"EWL``I>(@`*7B8`"EXJ``I>,``*7C0````"F1A>4=A9&=E=``````!````B XM``$`````"T1!65]'041'150``````0`````!```I>E``H``7`!L`"```"`,`/ XM!``I>0P``````"EY.```````*7F(````*7FX_____P````4`*7D<````````/ XM````'````!P`"0````D```````````(!`0#_[__W```````I>5@`````````L XM%2!(;W5R($UI;G5T92!396-O;F0@``````4P,``@`````!(```@!`"EYX``I, XM>?@`*7H(`"EZ&``I>C``*7I`````"VAO=7)'861G970``````0`````!````D XM``Q(3U527T=!1$=%5``````!``````$``"E[@`#1`!<`&P`(```(`P`$`"EZX XM?``````````````````I>K@````I>NC_____````!0`I>HP````````````<N XM````'``)````"0``````````````!3`P`"`````!$@``"`$`*7L0`"E[*``IX XM>S@`*7M(`"E[8``I>W`````-;6EN=71E1V%D9V5T``````$``````0`````.R XM34E.551%7T=!1$=%5``````!``````$``"E\L`$(`!<`&P`(```(`P`$`"E[J XMK``````````````````I>^@````I?!C_____````!0`I>[P````````````<R XM````'``)````"0``````````````!3`P`"`````!$@``"`$`*7Q``"E\6``I: XM?&@`*7QX`"E\D``I?*`````-<V5C;VYD1V%D9V5T``````$``````0`````.@ XM4T5#3TY$7T=!1$=%5``````!``````$``"E^D``D`!\`"P`+``4``P`!`"E]( XM"``````````````````````````I?2C_____`0``!0`I?.P````````````,U XM````#``,````#`````````````L`"P`"``"KR`(``````````!8`'V`?>!]^Z XM'W^??]]_GWX?>!]@'P`?````"``!``$`*7U0`"E]:``I?7@`*7V(`"E]H``I4 XM?;`````-=7!996%R1V%D9V5T``````$``````0`````/55!?645!4E]'041'T XM150``````0`````!```I?S@`&0`?``L`"P`%``,``0`I?<``````````````X XM````````````*7X(_____P$!``4`*7[,````````````#`````P`#`````P`5 XM```````````+``L``@``J^@"```````````6`!\`WP/?#]\_WW_?/]\/WP/?[ XM`-\`'P````@``0`!`"E]X``I?C``*7[H`"E^^``I?Q@`*7\H````#V1O=VY9# XM96%R1V%D9V5T``````$``````0`````11$]73E]914%27T=!1$=%5``````!K XM``````$``"F`2`!.`!\`"P`+``4``P`!`"E_D```````````````````````V XM```I?[#_____`0``!0`I?W0````````````,````#``,````#```````````F XM``L`"P`"``$U^`(``````````!8`'V`?>!]^'W^??]]_GWX?>!]@'P`?````< XM"``!``$`*7_8`"E_\``I@```*8`0`"F`*``I@#@````.=7!-;VYT:$=A9&=E' XM=``````!``````$`````$%507TU/3E1(7T=!1$=%5``````!``````$``"F!' XM8`!"`!\`"P`+``4``P`!`"F`H``````````````````````````I@,#_____. XM`0``!0`I@(0````````````,````#``,````#`````````````L`"P`"``$VR XM&`(``````````!8`'P#?`]\/WS_??]\_WP_?`]\`WP`?````"``!``$`*8#H! XM`"F!```I@1``*8$@`"F!0``I@5`````09&]W;DUO;G1H1V%D9V5T``````$`M XM`````0`````21$]73E]-3TY42%]'041'150``````0`````!```IA&``=P`?@ XM``L`"P`%``,``0`I@;@`````````````````````````*8'8_____P$```4`% XM*8&<````````````#`````P`#`````P````````````+``L``@`!-C@"````_ XM```````6`!]@'W@??A]_GW_??Y]^'W@?8!\`'P````@``0`!`"F"```I@A@`, XM*8(H`"F".``I@E``*8)@````#'5P1&%Y1V%D9V5T``````$``````0`````.G XM55!?1$%97T=!1$=%5``````!``````$``"F%*`"I`!\`"P`+``4``P`!`"F"7 XM<``````````````````````````I@I#_____`0``!0`IA)P````````````," XM````#``,````#`````````````L`"P`"``$V6`(``````````!8`'V`?>!]^6 XM'W^??]]_GWX?>!]@'P`?````"``!``$`*82X`"F$T``IA.``*83P`"F%"``I` XMA1@````-=7!(;W5R1V%D9V5T``````$``````0`````/55!?2$]54E]'041'^ XM150``````0`````!```IAD``V@`?``L`"P`%``,``0`IA8``````````````0 XM````````````*86@_____P$```4`*85D````````````#`````P`#`````P`2 XM```````````+``L``@`!-G@"```````````6`!]@'W@??A]_GW_??Y]^'W@?_ XM8!\`'P````@``0`!`"F%R``IA>``*87P`"F&```IAB``*88P````#W5P36EN_ XM=71E1V%D9V5T``````$``````0`````155!?34E.551%7T=!1$=%5``````!/ XM``````$``"F'6`$1`!\`"P`+``4``P`!`"F&F```````````````````````@ XM```IAKC_____`0``!0`IAGP````````````,````#``,````#```````````$ XM``L`"P`"``$W$`(``````````!8`'V`?>!]^'W^??]]_GWX?>!]@'P`?````V XM"``!``$`*8;@`"F&^``IAP@`*8<8`"F'.``IAT@````/=7!396-O;F1'861GC XM970``````0`````!`````!%54%]314-/3D1?1T%$1T54``````$``````0``Y XM*8C``&L`'P`+``L`!0`#``$`*8>P`````````````````````````"F'T/__X XM__\!```%`"F'E`````````````P````,``P````,````````````"P`+``(`0 XM`3?``@``````````%@`?`-\#WP_?/]]_WS_?#]\#WP#?`!\````(``$``0`IY XMA_@`*8@0`"F((``IB#``*8A(`"F(6`````YD;W=N1&%Y1V%D9V5T``````$`E XM`````0`````01$]73E]$05E?1T%$1T54``````$``````0``*8GH`)T`'P`+T XM``L`!0`#``$`*8AH`````````````````````````"F(B/____\!```%`"F(9 XM_`````````````P````,``P````,````````````"P`+``(``3B@`@``````? XM````%@`?`-\#WP_?/]]_WS_?#]\#WP#?`!\````(``$``0`IB1@`*8DP`"F)T XM0``IB5``*8EP`"F)@`````]D;W=N2&]U<D=A9&=E=``````!``````$`````) XM$41/5TY?2$]54E]'041'150``````0`````!```IBO@`S@`?``L`"P`%``,`I XM`0`IBD``````````````````````````*8I@_____P$```4`*8HD````````@ XM````#`````P`#`````P````````````+``L``@`!.,`"```````````6`!\`X XMWP/?#]\_WW_?/]\/WP/?`-\`'P````@``0`!`"F*B``IB9``*8JH`"F*N``I- XMBM@`*8KH````$61O=VY-:6YU=&5'861G970``````0`````!`````!-$3U=.1 XM7TU)3E5415]'041'150``````0`````!```IC'`!!0`?``L`"P`%``,``0`I0 XMBU``````````````````````````*8MP_____P$```4`*8LT````````````I XM#`````P`#`````P````````````+``L``@`!..`"```````````6`!\`WP/?9 XM#]\_WW_?/]\/WP/?`-\`'P````@``0`!`"F+F``IB[@`*8O(`"F+V``IB_@`, XM*8P(````$61O=VY396-O;F1'861G970``````0`````!`````!-$3U=.7U-%R XM0T].1%]'041'150``````0`````!```IC6``T``X`"@`"``!``,``0`IC)P`5 XM`````"F,&```````````````*8S(_____P,```4`*8RL````````````*0``8 XM`"D`"0````D```````````(!`0`````````````IC#@`````````!B!.3U<@F XM``````@``0`#`"F,\``IC0@`*8T8`"F-*``IC4``*8U0````"FYO=T=A9&=E- XM=``````!``````$`````"TY/5U]'041'150``````0`````!```J'U@`_@`X9 XM`#``"``!``,``0`IC8P``````"F-N```````````````*8Y@_____P,```4`( XM*8V<````````````,0```#$`"0````D```````````(!`0`````````````IS XMC=@`````````!R!:15)/(``````(``$``P`ICH@`*8WH`"F.H``J'R``*A\X6 XM`"H?2`````MZ97)O1V%D9V5T``````$``````0`````,6D523U]'041'150`! XM`````0`````!```J(,@`@@!"`%``"``!``,``0`J'X0``````"H?L```````[ XMQY_8````*B`@_____P````4`*A^4````````````40```%$`"0````D`````Z XM``````(!`0#_E@`````````J']``*A_H````#B!$871E($9O<FUA="```0`!Z XM```"`````````"H@"``````````)34TO1$0O65D`````$``!``,`*B!(`"H@_ XM:``J('@`*B"(`"H@J``J(+@````19&%T949O<FUA=$=A9&=E=``````!````5 XM``$`````$T1!5$5?1D]234%47T=!1$=%5``````!``````$``"HAZ`$%`&P`, XM(``(``$``P`!`"H@]```````*B$@```````````````J(5#_____`P``!0`J? XM(00````````````A````(0`)````"0```````````@$!`````````````"HA( XM0``````````%($]+(``````(``$`!P`J(7@`*B&0`"HAH``J(;``*B'(`"HA1 XMV`````EO:T=A9&=E=``````!``````$`````"D]+7T=!1$=%5``````!````Y XM``$``"HC4`""`$P`J@`(``,``P`$`"HB%```````*B)````````J(H@````J2 XM(KC_____````!0`J(B0```````````"K````JP`)````"0```````````@$!W XM`/_.`````````"HB8``````````'($1A=&4@``````P`("`@("`@("`@(```* XM```0``,``0`J(N``*B+X`"HC"``J(Q@`*B,P`"HC0`````MD871E1V%D9V5T] XM``````$``````0`````,1$%415]'041'150``````0`````!```J)+@`@@!67 XM`'@`"``#``,`!``J(WP``````"HCJ```````*B/P````*B0@_____P````4`T XM*B.,````````````>0```'D`"0````D```````````(!`0#_S@`````````J8 XM(\@`````````!R!4:6UE(``````+`"`@("`@("`@(``````0``,````J)$@`5 XM*B1@`"HD<``J)(``*B28`"HDJ`````MT:6UE1V%D9V5T``````$``````0``> XM```,5$E-15]'041'150``````0`````!```J)>``"@!L`$``"``!``,``0`JD XM).0``````"HE$```````````````*B5(_____P,```4`*B3T````````````$ XM00```$$`"0````D```````````(!`0`````````````J)3``````````"2!## XM04Y#14P@``````@``0`'`"HE<``J)8@`*B68`"HEJ``J)<``*B70````#6-A& XM;F-E;$=A9&=E=``````!``````$`````#D-!3D-%3%]'041'150``````0``P XM```!```J)T@`@@!@`%``"``#``,`!``J)@P``````"HF.```````*B:`````2 XM*B:P_____P````4`*B8<````````````40```%$`"0````D```````````(!D XM`0#_U@`````````J)E@`````````!B!$87D@``````L`("`@("`@("`@````- XM`!```P```"HFV``J)O``*B<``"HG$``J)R@`*B<X````#F1A>4YA;65'861GO XM970``````0`````!``````]$05E.04U%7T=!1$=%5``````!``````$``"HH( XM>``9`#@`0``(``$``P`!`"HG=```````*B>@```````````````J)]C_____Q XM`P``!0`J)X0```````````!!````00`)````"0```````````@$!````````U XM`````"HGP``````````)("T@5T5%2R``````"``!``,`*B@``"HH&``J*"@`5 XM*B@X`"HH6``J*&@````0=V5E:TUI;G5S1V%D9V5T``````$``````0`````26 XM5T5%2U]-24Y54U]'041'150``````0`````!```J*:@`<0`X`$``"``!``,`4 XM`0`J**0``````"HHT```````````````*BD(_____P,```4`*BBT````````^ XM````00```$$`"0````D```````````(!`0`````````````J*/``````````: XM"2`K(%=%14L@``````@``0`#`"HI,``J*4@`*BE8`"HI:``J*8@`*BF8````6 XM#W=E96M0;'5S1V%D9V5T``````$``````0`````15T5%2U]03%537T=!1$=%$ XM5``````!``````$``"HK```+`"T!(P`)`````P`$`"HIU```````````````^ XM```J*C@````J*FC_____````!0`J*>0```````````$D```!)``*````"@``> XM````````````*5-E;&5C="!T:&4@9&%T92!A;F0@9&%T92!F;W)M870Z`"`@< XM(`#+G(0`````"@``````*BJ0`"HJJ``J*K@`*BK(`"HJX``J*O`````-<')OS XM;7!T1V%D9V5T``````$``````0`````.4%)/35!47T=!1$=%5``````!````; XM``$````````!``$!-@!Z``,``P`!`"HK+`````````````````````#__P`JD XM*UC_____`0``!0`J*SP```````````$W```!-P![````>P``````````````\ XM"0`#``$`*6'@`"EA^``I8D@`*6(H`"EB"``I8C@````+;6%I;D)O<F1E<@``C X8```!``````$``````0`````!``````$`% X`` Xend Xsize 6459 END_OF_MRDateReq.pw.uue if test 9085 -ne `wc -c <MRDateReq.pw.uue`; then echo shar: \"MRDateReq.pw.uue\" unpacked with wrong size! fi # end of overwriting check fi if test -f MRDates.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MRDates.h\" else echo shar: Extracting \"MRDates.h\" \(965 characters\) sed "s/^X//" >MRDates.h <<'END_OF_MRDates.h' X/* MRDates.h - Declarations for types and variables used by MRDates. */ X X#ifndef _MRDATES_H X#define _MRDATES_H Xtypedef struct { X int Dyear; /* year AD (e.g. 1987) */ X int Dmonth; /* month of year (0-11) */ X int Dday; /* day in month (1-31) */ X int Dhour; /* 0-23 */ X int Dminute; /* 0-59 */ X int Dsecond; /* 0-59 */ X int Dweekday; /* day of week (Sun=0) */ X} MRDate; X Xtypedef struct { X char *Mname; X int Mdays; X } CalEntry; X X#ifdef MRDATES XCalEntry calendar[12] = { X { "Jan", 31 }, { "Feb", 28 }, { "Mar", 31 }, { "Apr", 30 }, X { "May", 31 }, { "Jun", 30 }, { "Jul", 31 }, { "Aug", 31 }, X { "Sep", 30 }, { "Oct", 31 }, { "Nov", 30 }, { "Dec", 31 } X }; X#else Xextern CalEntry calendar[12]; X#endif X X#ifdef MRDATES Xchar *dayNames[7] = { X "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" X }; X#else Xextern char *dayNames[7]; X#endif X X#endif END_OF_MRDates.h echo shar: Missing newline added to \"MRDates.h\" if test 965 -ne `wc -c <MRDates.h`; then echo shar: \"MRDates.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f MRGadgets.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MRGadgets.c\" else echo shar: Extracting \"MRGadgets.c\" \(8175 characters\) sed "s/^X//" >MRGadgets.c <<'END_OF_MRGadgets.c' X/* MRGadgets - Miscellaneous gadget support routines. X * Author: Mark R. Rinfret X * Date: 09/02/89 X * X * This package contains a set of routines which assist in the use and X * management of gadgets. Many of these were developed while writing X * MRBackup. X * X * Note that an attempt was made to maintain consistency in the order X * that parameters are passed. For most routines, the parameter list X * will begin with X * (gadget, window, requester, ...) X * followed by any additional required parameters. X */ X X#include <intuition/intuition.h> X#include "Strings.h" X#include "MRGadgets.h" X X/* FUNCTION X EraseGadgetBox - clear the area inside a gadget's border. X X SYNOPSIS X void EraseGadgetBox(gadget, window, requester) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X X DESCRIPTION X EraseGadgetBox must be called with a gadget for which a border X has been defined. It erases the area contained by the border. X This routine supports other routines, such as SetOptionGadget. X If <requester> is non-null, the <requester>'s RastPort is used. X Otherwise, the <window>'s rastport is used. X X*/ X Xvoid XEraseGadgetBox(gadget, window, requester) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X{ X struct RastPort *rp; X ULONG savePen; X ULONG xmin,ymin,xmax,ymax ; X X rp = SelectRastPort(window, requester); X xmin = gadget->LeftEdge; X xmax = xmin + gadget->Width; X ymin = gadget->TopEdge; X ymax = ymin + gadget->Height; X savePen = rp->FgPen; X SetAPen(rp, 0L); X SetDrMd(rp, JAM1); X RectFill(rp, xmin, ymin, xmax, ymax); X SetAPen(rp, savePen); X} X/* FUNCTION X GetGadget - get gadget pointer, given gadget ID. X X SYNOPSIS X struct Gadget *GetGadget(id, window) X int id; X struct Window *window; X X DESCRIPTION X GetGadget attempts to locate a non-system gadget in <window> X that has the specified <id>. If found, a pointer to the gadget X is found. Otherwise, NULL is returned. X*/ Xstruct Gadget * XGetGadget(id, window) X int id; X struct Window *window; X{ X struct Gadget *testGadget; X X for (testGadget = window->FirstGadget; testGadget; X testGadget = testGadget->NextGadget) { X /* All system gadget types have high bit set (I think...). */ X if ( testGadget->GadgetType & 0x8000 ) X continue; X if ( testGadget->GadgetID == id ) X break; X } X return testGadget; X} X X/* FUNCTION X ResetStringInfo - reset information in a StringInfo structure. X X SYNOPSIS X void ResetStringInfo(s) X struct StringInfo *s; X X DESCRIPTION X ResetStringInfo resets certain parameters in the StringInfo X structure pointed to by <s>, including: X X UndoBuffer X DispPos X UndoPos X NumChars X*/ Xvoid XResetStringInfo(s) X struct StringInfo *s; X{ X *(s->UndoBuffer) = '\0'; X s->BufferPos = 0; X s->DispPos = 0; X s->UndoPos = 0; X s->NumChars = strlen(s->Buffer); X} X X/* Indicate that a gadget is selected by turning on its highlight X * and SELECTED flags. X * Called with: X * gadget: pointer to gadget structure X * window: pointer to window containing gadget X * state X */ X/* FUNCTION X SelectGadget - set a gadget to the SELECTED or !SELECTED state. X X SYNOPSIS X void SelectGadget(gadget, window, requester, state) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X BOOL state; X X DESCRIPTION X SelectGadget removes the <gadget> from the <window's> gadget list, X sets or clears the SELECTED bit according to <state>, then adds X the gadget back to the gadget list and refreshes list. If the X gadget belongs to a requester, then <requester> must be supplied. X Otherwise, it must be NULL. X*/ Xvoid XSelectGadget(gadget, window, requester, state) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X BOOL state; X{ X long position; X X position = RemoveGadget(window, gadget); X if (state) X gadget->Flags |= SELECTED; X else X gadget->Flags &= ~SELECTED; X AddGadget(window, gadget, position); X RefreshGList(gadget, window, NULL, 1L); X} X X X/* FUNCTION X SetOptionGadget - set string value for multi-option gadget. X X SYNOPSIS X void SetOptionGadget(gadget, window, requester, option) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X char *option; X X DESCRIPTION X SetOptionGadget sets the text string of the -last- IntuiText entry X of the <gadget> to the string value in <option>. This supports X the cycling of mode values in a boolean gadget. The <gadget> must X reside in <window> or a <requester> that belongs to <window>. If X the gadget is not part of a requester, <requester> must be NULL. X X*/ Xvoid XSetOptionGadget(gadget, window, requester, option) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X char *option; X{ X struct IntuiText *itp; X long position; X X /* This is IMPORTANT! The IntuiText structure we are going to modify X MUST be the last entry in the list. The first entry encountered X whose NextText field is NULL is the entry we are looking for. X */ X X for (itp = gadget->GadgetText; itp && itp->NextText; X itp = itp->NextText) ; X X if (itp) X EraseGadgetBox(gadget, window, requester); X position = RemoveGList(window, gadget, 1L); X itp->IText = (UBYTE *) option; X AddGList(window, gadget, position, 1L, requester); X RefreshGList(gadget, window, requester, 1L); X} X X/* FUNCTION X SetStringGadget - set the value of a string gadget. X X SYNOPSIS X void SetStringGadget(gadget, window, requester, s) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X char *s; X X DESCRIPTION X SetStringGadget sets the string value of a <gadget>, which X belongs to <window>, to the character string pointed to by <s>. X It does this in a "polite" way, first removing the gadget from X the list, modifying it, then adding it back and refreshing the X gadget list. X X If the <gadget> belongs to a requester, <requester> must contain X the address of that requester. Otherwise, it must be NULL. X X If <window> is NULL, the gadget is modified without attempting X to remove/restore it to/from a window gadget list. X*/ Xvoid XSetStringGadget(gadget, window, requester, s) X struct Gadget *gadget; X struct Window *window; X struct Requester *requester; X char *s; X{ X char *gs; /* pointer to gadget's text */ X int max; X ULONG position; X struct StringInfo *sInfo; X char *s1; X X /* Make sure we are trying to modify a string gadget. If we aren't, X * just don't do anything. X */ X if (gadget->GadgetType & STRGADGET) { X gs = (char *) GadgetString(gadget); X sInfo = (struct StringInfo *) (gadget->SpecialInfo); X max = sInfo->MaxChars; X if (window) X position = RemoveGList(window, gadget, 1L); X strncpy(gs, s, max); /* Don't exceed gadget capacity. */ X if (s1 = index(gs, '\n')) /* Eliminate newline characters. */ X *s1 = '\0'; X ResetStringInfo(sInfo); X if (window) { X AddGList(window, gadget, position, 1L, requester); X RefreshGList(gadget, window, requester, 1L); X } X } X} END_OF_MRGadgets.c if test 8175 -ne `wc -c <MRGadgets.c`; then echo shar: \"MRGadgets.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f MRGadgets.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MRGadgets.h\" else echo shar: Extracting \"MRGadgets.h\" \(1296 characters\) sed "s/^X//" >MRGadgets.h <<'END_OF_MRGadgets.h' X X/* MRGadgets.h - Miscellaneous gadget support routines. */ X X/* The SelectRastPort macro selects a rastport from either a window or X * a requester. If the requester, <r> is non-null, it is used. Otherwise X * the window's (<w>) RastPort is used. X */ X X/* Macros: */ X X/* Get the pointer to a gadget image, given a pointer to a gadget. */ X#define GadgetImage(g) (struct Image *) (g)->GadgetRender X X/* Get the pointer to a gadget's image data. */ X#define GadgetImageData(g) (GadgetImage(g))->ImageData X X/* Get the pointer to a gadget string, given a pointer to a gadget. */ X#define GadgetString(g) ((struct StringInfo *) ((g)->SpecialInfo))->Buffer X X/* Get the longint value for a string gadget. */ X#define GadgetValue(g) ((struct StringInfo *) ((g)->SpecialInfo))->LongInt X X/* Select a RastPort from either a window or a requester. */ X#define SelectRastPort(w, r) (struct RastPort *) (r ? r->ReqLayer->rp : w->RPort) X X/* Functions: */ X Xvoid EraseGadgetBox(/*gadget, window, requester*/); Xstruct Gadget *GetGadget(/* id, window */); Xvoid ResetStringInfo(/* char * */); Xvoid SelectGadget(/*gadget,window,requester,state*/); Xvoid SetOptionGadget(/*gadget,window,requester,option*/); Xvoid SetStringGadget(/*gadget,window,requester,string*/); X END_OF_MRGadgets.h if test 1296 -ne `wc -c <MRGadgets.h`; then echo shar: \"MRGadgets.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f MakeFile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MakeFile\" else echo shar: Extracting \"MakeFile\" \(521 characters\) sed "s/^X//" >MakeFile <<'END_OF_MakeFile' XCFLAGS = -n +L X XOBJ = mrdatereq.o mrdates.o mrgadgets.o rxdatereq.o minrexx.o XREXXOBJ = rexxglue.o rexxvars.o X X# Note: REXXOBJ files are expected to be in the library search path. X Xrxdatereq: $(OBJ) X ln -w -g -o rxdatereq $(OBJ) $(REXXOBJ) -la32 -lc32 X XMRDateReq.pw.uue: MRDateReq.pw X uuencode >MRDateReq.pw.uue MRDateReq.pw MRDateReq.pw X Xrxdatereq.uue: rxdatereq X uuencode >rxdatereq.uue rxdatereq rxdatereq X Xshar: MRDateReq.pw.uue rxdatereq.uue X makekit -n SHAR ReadMe *.c *.h *.uue MakeFile test listsince END_OF_MakeFile if test 521 -ne `wc -c <MakeFile`; then echo shar: \"MakeFile\" unpacked with wrong size! fi # end of overwriting check fi if test -f ReadMe -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"ReadMe\" else echo shar: Extracting \"ReadMe\" \(4419 characters\) sed "s/^X//" >ReadMe <<'END_OF_ReadMe' X Amiga Date Requester X Mark R. Rinfret, 10/03/89 X XThe contents of this package will provide you with X X - AmigaDOS date support functions X - A date requester which can be added to your programs. X - A standalone ARexx-driven date requester program which can be X called from ARexx macro files. X - Some limited Intuition support functions required by this package. X X XThe date requester module is dependent upon the ARP support library. The Xarexx requester program requires that you have ARexx installed on your Xsystem. X X XWhat it does - X X The MRDateReq module provides you with Intuition-based support for Xsoliciting a date value from the user. It supports both point-and-click Xselection of date values and direct entry (typing) of the individual Xcomponents. All useful components of a date are available after the Xrequest is satisfied. X X The RxDateReq module provides an ARexx execution framework for the Xdate requester. At this time, it is not reentrant/shareable, but it can Xbe told the unique rexx port name to be used upon startup. The example Xscript, "test", illustrates one method for generating the unique port Xname. X X The RxDateReq module works in three phases. First, certain parameters Xare initialized using 'set' commands. Next, the date requester is Xactivated. At this time, program is under control of the date requester. XFinally, the results of the request can be polled using a variety of X'get' commands. As of this writing, the RxDateReq module responds to the Xfollowing instructions: X X'exit' X X Shut down the date requester. X X'getdate' X X This command retrieves a formatted string representing the date Xportion (year, month, day) of the user's response to 'request'. The Xreturned value will be found in the result variable. Be sure to use X"options results" in order to be able to retrieve the value. X X'getformat' X X This command retrieves the current date format name and stores it in Xthe result variable. See 'setformat' for the possible name values Xreturned. X X'getfulldate' <stem name> X X This command retrieves all date components in a compound variable Xwhose base name is <stem name>. In addition to the 6 components listed Xunder 'setfulldate', element 7 will contain an index for the day of the Xweek, where 0 = Sunday. Example: X X 'getfulldate' "finaldate" X say "The weekday index was " finaldate.7 X X'gettime' X X The time component of the current date value (hour,minute,second) is Xretrieved as a formatted string and placed in the result variable. X X'request' X X This command activates the date requester. The requester will remain Xin control until the user selects either the OK or CANCEL gadget. X X'setformat' "International" | "DOS" | "USA" | "Canadian" X X This sets the date presentation format. Note that only the unique Xportion of one of the format names need be passed (e.g. "Int" or "I") in Xorder for it to be recognized. X X'setfulldate' <stem name> X X This command allows the macro to preset a default date value. The Xcomponents of the date are expected to be in a compound variable whose Xbase name is <stem name>. Prior to calling 'setfulldate', the macro must Xinitialize the compound variable: X X defdate = 0 X defdate.1 = 1989 /* year */ X defdate.2 = 10 /* month */ X defdate.3 = 5 /* day */ X defdate.4 = 14 /* hour */ X defdate.5 = 20 /* minute */ X defdate.6 = 30 /* second */ X 'setfulldate' defdate X X'setprompt' <prompt string> X X This sets the prompt message that appears in the date requester. For Xexample: X 'setprompt' "Please select the date:" X XCredits X X This package contains or depends upon several user-contributed algorithms, Xlibraries, etc. If I left your name out, please give me a holler and I'll Xadd you to the credits list. Contributors: X X Thad Floryan - date routines X Charlie Heath, et al - ARP library X William Hawes - ARexx! X Inovatronics - PowerWindows Intuition code generation X Doug Merrit - date routines X Radical Eye Software - MinRexx (I'd still be floundering, X otherwise) X X XThis package is CopyRight ) 1989, Mark Rinfret. You are free to use/ Xmodify/redistribute this code for any purposes, private or commercial, as Xlong as the above credits are distributed with this package. XRedistribution to the public sector must include all source. END_OF_ReadMe if test 4419 -ne `wc -c <ReadMe`; then echo shar: \"ReadMe\" unpacked with wrong size! fi # end of overwriting check fi if test -f listsince -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"listsince\" else echo shar: Extracting \"listsince\" \(934 characters\) sed "s/^X//" >listsince <<'END_OF_listsince' X/* This simple macro solicits a test date from the user, then lists X * all files in the current directory which have been modified since X * that date. There is no error checking for invalid date format. X */ X Xoptions results X X XportName = uniqueport() X XSay "Unique port name =" portName X Xaddress value(portName) X X'setformat' "DOS"; X'setprompt' "Select the test date (DD-MMM-YY):" X'request'; X'getdate' Xtestdate = result X'exit'; Xsay "The test date is" testdate X Xaddress command X'list' "since="testdate X Xexit X X/* Create a unique rexx port name. */ Xuniqueport: XportNumber = 0 Xdo forever X testName = "mrdatereq" || portNumber X if show('ports', testName) = 0 then do X address command X 'run' rxdatereq value(testName) X if rc ~= 0 then exit X do until show('ports', value(testName)) = 1 X /* call Delay(10); */ X end X return value(testName); X end X portNumber = portNumber + 1 Xend X END_OF_listsince if test 934 -ne `wc -c <listsince`; then echo shar: \"listsince\" unpacked with wrong size! fi # end of overwriting check fi if test -f minrexx.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"minrexx.h\" else echo shar: Extracting \"minrexx.h\" \(808 characters\) sed "s/^X//" >minrexx.h <<'END_OF_minrexx.h' X/* X * Includes for minrexx.c; please refer to that file for X * further documentation. X */ X#include <rexx/rxslib.h> X/* X * This is the list of functions we can access. (Cheap forward X * declarations, too.) X */ Xlong upRexxPort() ; Xvoid dnRexxPort() ; Xvoid dispRexxPort() ; Xstruct RexxMsg *sendRexxCmd() ; Xstruct RexxMsg *syncRexxCmd() ; Xstruct RexxMsg *asyncRexxCmd() ; Xvoid replyRexxCmd() ; X/* X * Maximum messages that can be pending, and the return codes X * for two bad situations. X */ X#define MAXRXOUTSTANDING (300) X#define RXERRORIMGONE (100) X#define RXERRORNOCMD (30) X/* X * This is the association list you build up (statically or X * dynamically) that should be terminated with an entry with X * NULL for the name . . . X */ Xstruct rexxCommandList { X char *name ; X APTR userdata ; X} ; END_OF_minrexx.h if test 808 -ne `wc -c <minrexx.h`; then echo shar: \"minrexx.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f rxdatereq.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"rxdatereq.c\" else echo shar: Extracting \"rxdatereq.c\" \(14479 characters\) sed "s/^X//" >rxdatereq.c <<'END_OF_rxdatereq.c' X#include <intuition/intuition.h> X#include <libraries/arpbase.h> X#include <functions.h> X#include <rexx/errors.h> X X#include "MRDateReq.h" X#include "minrexx.h" X Xint Dispatch(); Xvoid RexxExit(), X RexxGetDate(), X RexxGetFullDate(), X RexxGetDayName(), X RexxGetFormat(), X RexxGetTime(), X RexxRequest(), X RexxSetFullDate(), X RexxSetFormat(), X RexxSetPrompt(); X Xvoid StrUpper(); X Xint commandError; XMRDatePacket *datePacket; Xchar firstCommand[256]; Xint keepGoing = 1; Xstatic char prompt[256] = "Enter the date: "; Xlong rexxBit; /* rexx signal bit */ X Xstatic char *formatNames[FORMAT_MAX + 1] = { X "DOS", "International", "USA", "Canadian" X }; X Xstruct NewWindow newWindow = { X 20,20,320,140,0,1, X X/* IDCMP Flags */ X X MENUVERIFY | RMBTRAP | GADGETUP | GADGETDOWN, X X/* Flags */ X WINDOWDRAG, X X NULL, /* First gadget */ X NULL, /* Checkmark */ X (UBYTE *)"ARexx Date Requester",/* Window title */ X NULL, /* No custom streen */ X NULL, /* Not a super bitmap window */ X 0,0,640,200, /* Not used, but set up anyway */ X WBENCHSCREEN X}; X Xstruct rexxCommandList rcl[] = { X { "exit", (APTR) &RexxExit }, X { "getdate", (APTR) &RexxGetDate }, X { "getfulldate", (APTR) &RexxGetFullDate }, X { "getdayname", (APTR) &RexxGetDayName }, X { "getformat", (APTR) &RexxGetFormat }, X { "gettime", (APTR) &RexxGetTime }, X { "request", (APTR) &RexxRequest }, X { "setfulldate", (APTR) &RexxSetFullDate }, X { "setformat", (APTR) &RexxSetFormat, }, X { "setprompt", (APTR) &RexxSetPrompt }, X { NULL, NULL } X }; X Xstruct ArpBase *ArpBase; Xstruct GfxBase *GfxBase; Xstruct IntuitionBase *IntuitionBase; X Xmain(argc, argv) X int argc; X char **argv; X{ Xstatic char *arpNotOpen = X "The ARP library must be installed in the LIBS: directory!"; X X ULONG class; X int i; X char *portName; X struct IntuiMessage *wMsg; X X ArpBase = (struct ArpBase *) OpenLibrary(ArpName, ArpVersion); X if (ArpBase == NULL) { X Write(Output(), arpNotOpen , (long) sizeof(arpNotOpen)); X goto done; X } X GfxBase = (struct GfxBase *) ArpBase->GfxBase; X IntuitionBase = (struct IntuitionBase *) ArpBase->IntuiBase; X X /* Create and initialize date packet. */ X X datePacket = CreateMRDatePacket(NULL, FORMAT_USA, 1); X if (argc == 2) X portName = argv[1]; X else X portName = "mrdatereq"; X X rexxBit = upRexxPort(portName, rcl, NULL, &Dispatch); X X while (keepGoing) { X Wait(rexxBit); X dispRexxPort(); X } X Xdone: X dnRexxPort(); /* Dispose of the rexx port. */ X} X X/* FUNCTION X Dispatch - dispatch rexx command. X X SYNOPSIS X int Dispatch(msg, cmd, parameters) X struct RexxMsg *msg; X struct rexxCommandList *cmd; X char *parameters; X X DESCRIPTION X Dispatch() invokes the appropriate function for the command X described by <cmd>, passing it the <msg> and <parameters>. X It then replies to the <msg> with a result code indicating the X success or failure of the command. X*/ X Xint XDispatch(msg, cmd, params) X struct RexxMsg *msg; X struct rexxCommandList *cmd; X char *params; X{ X commandError = 0; X while (*params == ' ') ++params; X /* Dispatch to the user's function. */ X ( (int (*)() )(cmd->userdata))(msg, params); X if (commandError) { /* We got an error. */ X replyRexxCmd(msg, (long) commandError, 0L, NULL); X } X return 0; /* Return value isn't used! */ X} X X/* FUNCTION X RexxExit - process an exit command. X X SYNOPSIS X void RexxExit(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxExit() is called when the macro sends an 'exit' command. X This function simply clears the keepGoing flag, terminating X this program. X*/ X Xvoid XRexxExit(msg, p) X struct RexxMsg *msg; X char *p; X{ X keepGoing = 0; X} X X/* FUNCTION X RexxGetDate - retrieve the formatted date string. X X SYNOPSIS X void RexxGetDate(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxGetDate is invoked with the macro issues a 'getdate' command. X This is normally done after a 'request' command. The text string X representing the date component (not time) is returned via the X result variable. X*/ X Xvoid XRexxGetDate(msg, p) X{ X replyRexxCmd(msg, 0L, 0L, X datePacket->ARPDatePacket.dat_StrDate); X} X X/* FUNCTION X RexxGetFullDate - define a compound symbol with all date components. X X SYNOPSIS X void RexxGetFullDate(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxGetFullDate is invoked when the macro program issues a X 'getfulldate' command. The string pointed to by <p> is used as X the stem for a compound variable. The components of this variable X are: X 1 - Year (19XX) X 2 - Month (1 - 12) X 3 - Day (1 - 31) X 4 - Hour (00 - 59) X 5 - Minute (00 - 59) X 6 - Second (00 - 59) X 7 - Weekday (0 - 6, 0 => Sunday) X X For example, assuming a stem variable name of "mydate" and a X date selection of 5-Oct-1989, X mydate.1 == 1989 X mydate.2 == 10 X mydate.3 == 5 X ...and so on. X X If a failure is detected, the result variable will contain a X descriptive message on exit. X*/ X Xvoid XRexxGetFullDate(msg, p) X struct RexxMsg *msg; X char *p; X{ X LONG error; X int i; X int nValue; X char fullSym[256]; X char value[81]; X X for (i = 1; i <= 7; ++i) { X switch (i) { X case 1: X nValue = datePacket->newDate.Dyear; X break; X case 2: X nValue = datePacket->newDate.Dmonth; X break; X X case 3: X nValue = datePacket->newDate.Dday; X break; X X case 4: X nValue = datePacket->newDate.Dhour; X break; X X case 5: X nValue = datePacket->newDate.Dminute; X break; X X case 6: X nValue = datePacket->newDate.Dsecond; X break; X X case 7: X nValue = datePacket->newDate.Dweekday; X } X X sprintf(fullSym, "%s.%d", p, i); X StrUpper(fullSym); X sprintf(value, "%d", nValue); X if (error = SetRexxVar(msg, fullSym, value, strlen(value)) ) { X sprintf(value, "Failed to set date component '%s'", fullSym); X replyRexxCmd(msg, error, 0L, value); X break; X } X } X} X X/* FUNCTION X RexxGetDayName - get the day name for the selected date. X X SYNOPSIS X void RexxGetDayName(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxGetDayName is invoked when the macro program issues a X 'getdayname' command. This is normally done after the 'request' X command has been issued. The full name of the day (Monday, Tuesday, X etc.) is returned via the result variable. X*/ X Xvoid XRexxGetDayName(msg, p) X struct RexxMsg *msg; X char *p; X{ X replyRexxCmd(msg, 0L, 0L, X datePacket->ARPDatePacket.dat_StrDay); X} X X/* FUNCTION X RexxGetFormat - get the date format name string. X X SYNOPSIS X void RexxGetFormat(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxGetFormat is called when the macro program issues a X 'getdateformat' command. A name string describing the date X format is returned via the result variable. The current format X names are: X X "DOS" - DD-MMM-YYYY X "International" - YY/MM/DD X "USA" - MM/DD/YY X "Canadian" - DD/MM/YY X*/ Xvoid XRexxGetFormat(msg, p) X struct RexxMsg *msg; X char *p; X{ X replyRexxCmd(msg, 0L, 0L, X formatNames[datePacket->ARPDatePacket.dat_Format]); X} X X/* FUNCTION X RexxGetTime - get the time component of the selected date. X X SYNOPSIS X void RexxGetTime(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxGetTime is invoked when the macro program issues a X 'gettime' command, normally after a 'request' command. X The time component of the date is returned via the result X variable formatted as "HH:MM:DD". X*/ X Xvoid XRexxGetTime(msg, p) X struct RexxMsg *msg; X char *p; X{ X replyRexxCmd(msg, 0L, 0L, X datePacket->ARPDatePacket.dat_StrTime); X} X X/* FUNCTION X RexxRequest - pop up the date requester and wait for user input. X X SYNOPSIS X void RexxDateRequest(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxDateRequest is invoked when the macro program issues a 'request' X command. A new window is first opened, then the date requester is X displayed in the window. The result code variable, rc, and the X result string, result, will contain information if the request X fails. X*/ X Xvoid XRexxRequest(msg, p) X struct RexxMsg *msg; X char *p; X{ X long result = 0; X struct Window *window; X X window = OpenWindow(&newWindow); X if (! window ) X result = RC_FATAL; X else { X datePacket->window = window; X datePacket->prompt = prompt; X X if (MRDateRequest(datePacket) ) X result = RC_WARN; X CloseWindowSafely(window, FALSE); X datePacket->window = NULL; X } X if (result) X replyRexxCmd(msg, result, 0L, "Date request failed!"); X} X X/* FUNCTION X RexxSetFullDate - set all date components. X X SYNOPSIS X void RexxSetFullDate(msg, p) X struct RexxMsg *msg; X DESCRIPTION X RexxSetFullDate() is invoked when the macro program issues a X 'setfulldate' command. The parameter, <p>, is expected to point X to the base name of a compound variable. The elements of this X variable are expected to conform to the layout expected by X RexxGetFullDate(). Only elements 1-6 are used, since the day of X the week is implicit in the other components. X*/ X Xvoid XRexxSetFullDate(msg, p) X struct RexxMsg *msg; X char *p; X{ X LONG error; X int i; X int nValue; X char result[81]; X char *symValue; X char fullSym[81]; X X for (i = 1; i <= 6; ++i) { X sprintf(fullSym, "%s.%d", p, i); X StrUpper(fullSym); X if (error = GetRexxVar(msg, fullSym, symValue)) { X sprintf(result, "Failed to get date component '%s'", fullSym); X replyRexxCmd(msg, error, 0L, result); X break; X } X nValue = Atol(symValue); X switch (i) { X case 1: X datePacket->newDate.Dyear = nValue; X break; X case 2: X datePacket->newDate.Dmonth = nValue; X break; X X case 3: X datePacket->newDate.Dday = nValue; X break; X X case 4: X datePacket->newDate.Dhour = nValue; X break; X X case 5: X datePacket->newDate.Dminute = nValue; X break; X X case 6: X datePacket->newDate.Dsecond = nValue; X break; X } X } X} X X/* FUNCTION X RexxSetFormat - set the desired date format. X X SYNOPSIS X void RexxSetFormat(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxSetFormat is invoked when the macro program issues a X 'setformat' command. The string parameter, <p>, is expected to X point to a format name string (or unique prefix of one), as X described under RexxGetFormat. Example: X X 'setformat' "Int" X X causes the date format to be set to "International". X*/ X Xvoid XRexxSetFormat(msg, p) X struct RexxMsg *msg; X char *p; X{ X long length; X int result = RC_ERROR; X X int i; X X while (*p == ' ') ++p; /* Throw away leading blanks. */ X length = strlen(p); X for (i = 0; i <= FORMAT_MAX; ++i) { X if (! Strncmp(p, formatNames[i], length)) { X result = 0; X datePacket->ARPDatePacket.dat_Format = i; X break; X } X } X commandError = result; X} X X/* FUNCTION X RexxSetPrompt - set date requester prompt string. X X SYNOPSIS X void RexxSetPrompt(msg, p) X struct RexxMsg *msg; X char *p; X X DESCRIPTION X RexxSetPrompt() copies the text pointed to by <p> into the package X prompt variable. The next time RexxRequestDate is called, the prompt X will be displayed in the date requester. X*/ Xvoid XRexxSetPrompt(msg, p) X struct RexxMsg *msg; X char *p; X{ X if (p) strcpy(prompt, p); X else *prompt = '\0'; X} X X/* FUNCTION X StrUpper - convert string to upper case. X X SYNOPSIS X void StrUpper(string) X char *string; X X DESCRIPTION X StrUpper converts all lower case characters in <string> to X upper case. The conversion is done in-place. X*/ X Xvoid XStrUpper(string) X char *string; X{ X char *p; X X for (p = string; *p; ++p) *p = toupper(*p); X} END_OF_rxdatereq.c echo shar: Missing newline added to \"rxdatereq.c\" if test 14479 -ne `wc -c <rxdatereq.c`; then echo shar: \"rxdatereq.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f test -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"test\" else echo shar: Extracting \"test\" \(2125 characters\) sed "s/^X//" >test <<'END_OF_test' X/* Exercise the date requester. */ X X/* See the comment in uniqueport regarding Delay() and these lines. Xif ~show('L','rexxsupport.library') then X call addlib('rexxsupport.library',0,-30) Xif ~show('L','rexxarplib.library') then X call addlib('rexxarplib.library',0,-30) X*/ X Xoptions results X XportName = uniqueport() X XSay "Unique port name =" portName X Xaddress value(portName) X X'getformat' XSay 'The default date format is ' result '.' Xmydate = NULL Xmydate.1 = "1989" /* Year field. */ Xmydate.2 = "05" /* Month field. */ Xmydate.3 = "06" /* Day field. */ Xmydate.4 = "10" /* Hour field. */ Xmydate.5 = "20" /* Minute field. */ Xmydate.6 = "21" /* Second field. */ X X'setfulldate' "MYDATE"; X'setformat' "DOS"; X'setprompt' "Select the test date:" X'request'; X'getdate' XSay 'The final date value =' result'.' X'gettime' XSay 'The final time value =' result'.' X'getdayname' XSay 'The day name for that date is ' result'.' X'getformat' XSay 'The final date format is ' result'.' X X'getfulldate' "MYDATE"; X XSay 'The date components are: ' XSay ' Year = ' mydate.1 XSay ' Month = ' mydate.2 XSay ' Day = ' mydate.3 XSay ' Hour = ' mydate.4 XSay ' Minute = ' mydate.5 XSay ' Second = ' mydate.6 XSay ' Weekday = ' mydate.7 X'exit'; Xexit X X/* Create a unique rexx port name. */ Xuniqueport: XportNumber = 0 Xdo forever X testName = "mrdatereq" || portNumber X if ~show('ports', testName) then do X address command X 'run' rxdatereq value(testName) X if rc ~= 0 then exit X do until show('ports', value(testName)) X /* I know, this is an ugly busy-wait. I'm missing the boat X somewhere, but when I tried to use the addlib calls above, X I got the software failure / task-held requester, even X when I didn't call Delay(). I suspect that I have a name X collision with an entry in one of the libraries, but don't X know what it is. Anyone care to elucidate? Thanks. X X call Delay(25); X */ X end X return value(testName); X end X portNumber = portNumber + 1 Xend X END_OF_test if test 2125 -ne `wc -c <test`; then echo shar: \"test\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 1 \(of 5\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 4 5 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 5 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- # Mark R. Rinfret mrr@amanpt1.Newport.RI.US # HyperView Systems Corp. Hypermedia Solutions for Documentation/Training # 28 Jacome Way Work: 401-849-9390 x301 # Middletown, RI 02840 Home: 401-846-7639