Relay-Version: version nyu B notes v1.6 9/18/89; site acf4.NYU.EDU From: lrb@rrivax.rri.uwo.ca (Lance R. Bailey) Date: 27 Aug 90 06:53 EDT Date-Received: 27 Aug 90 12:52 EDT Subject: schedular part 4 of 6 Message-ID: <913@ria.ccs.uwo.ca> Path: acf4!cmcl2!phri!rutgers!cs.utexas.edu!news-server.csri.toronto.edu!utgpu!watserv1!ria!rrivax.rri.uwo.ca!lrb Newsgroups: vmsnet.sources Organization: Robarts Research Institute -- London Canada Earth Sender: news@ria.ccs.uwo.ca Reply-To: lrb@rrivax.rri.uwo.ca Lines: 563 News-Software: VAX/VMS VNEWS 1.3-4 -+-+-+-+-+-+-+-+ START OF PART 4 -+-+-+-+-+-+-+-+ X for (i=startslot,StpChk=0;i<=endslot;i++) X `7B if (!StpChk) X `7B if (!isblanks(daytimer`5Bdaynumber`5D`5Bi`5D)) X `7B if (delete) j = warn4del(daytimer`5Bdaynumber`5D`5Bi`5D, i V); X else j = warn4add(daytimer`5Bdaynumber`5D`5Bi`5D, i); X `7D X else j = 1; X `7D X X if (j == 2) break; X StpChk = (j == 3); X X if (!j `7C`7C StpChk) blankout(daytimer`5Bdaynumber`5D`5Bi`5D); X `7D X `20 X if (j == 2) return 0; X X/* spin through the day and book all NONBOOKED slots */ X for (i=startslot;i<=endslot;i++) if (isblanks(daytimer`5Bdaynumber`5D`5B Vi`5D)) X strcpy(daytimer`5Bdaynumber`5D`5Bi`5D,Details); X X X/* spin through from end of file to this date and set the dates */ X X if (daynumber >= NDAYS) X `7B jdMax=day2julian(dates`5BNDAYS-1`5D)+1; X weekday = dates`5BNDAYS-1`5D`5B9`5D; X`20 X for (;NDAYS<=daynumber; ++jdMax,++NDAYS) X `7B ++weekday; if (weekday > '6') weekday = '0'; X X if (jdMax > DaysThisYear) X `7B jdMax = 1; strcpy(currentyear,year); `7D X X strcpy(dates`5BNDAYS`5D,julian2day(jdMax,currentyear,weekday)); X `7D X `7D X X return 1; X X`7D X X X Xget_input(W, ypos,xpos,defS,legal, targetS, helpcode) X WINDOW *W; X int xpos, ypos; X char *defS; X int legal(); X char *targetS; X int helpcode; X`7B int def, good; X int value; X char iline`5B60`5D; X X good = 0; X if (isblanks(defS)) def= -1; X else def= atoi(defS); X X message1(" ? Quit "); X X while (!good) X `7B mvwaddstr(W,ypos,xpos,defS); strcpy(iline," "); X get_string(W,ypos,xpos,iline,55); message2(" "); X X if (*iline == '?') `7B online_help(helpcode); continue; `7D X X if (toupper(*iline) == 'Q') return 0; X X if (isblanks(iline)) `7B strcpy(iline,defS); value= def; `7D X else `7B iline`5B2`5D=0; value = atoi(iline); `7D X X good = legal(value); if (!good) message2("`07Out of range"); X `7D X X message1(" "); X sprintf(targetS,"%02d",value);mvwaddstr(W,ypos,xpos,targetS); X X return 1; X`7D X X X X XConfirm(delete,starthrS,endhrS,startminS,endminS,day,year,month,Details) X int delete; X char *starthrS,*endhrS,*startminS,*endminS,*day,*year,*month,*Details; X`7B WINDOW *confirm; X int ans; X X confirm = newwin(20,66,1,7); X X mvwaddstr(confirm,4,27,"============"); X mvwaddstr(confirm,5,27,"CONFIRMATION"); X mvwaddstr(confirm,6,27,"============"); X X if (delete) X mvwaddstr(confirm,9,12,"Delete: , 19 "); X else X mvwaddstr(confirm,9,12,"Book: , 19 "); X X mvwaddstr(confirm,9,20,monthnames`5Batoi(month)-1`5D ); X mvwaddstr(confirm,9,30,day); X mvwaddstr(confirm,9,36,year); X X mvwaddstr(confirm,10,12,"From: :"); X mvwaddstr(confirm,10,20,starthrS); X mvwaddstr(confirm,10,23,startminS); X mvwaddstr(confirm,10,28," -To- : "); X mvwaddstr(confirm,10,34,endhrS); X mvwaddstr(confirm,10,37,endminS); X X if (!delete) X `7B mvwaddstr(confirm,12,12,"For:"); X mvwaddstr(confirm,13,4,"-------------------------------------------- V----------------"); X mvwaddstr(confirm,14,4,Details); X mvwaddstr(confirm,15,4,"-------------------------------------------- V----------------"); X `7D X X message1(" ? Confirm_entry Quit "); X X do X `7B mvwaddstr(confirm,18,12,"Enter C to Confirm, Q to Quit"); X noecho(); ans = toupper(wgetch(confirm)); echo(); X if (ans == '?') online_help(5); X `7D while (ans != 'C' && ans != 'Q'); X X message1(" "); X X delwin(confirm); X X switch (ans) X `7B case 'C': return 1; X case 'Q': return 0; X `7D X X`7D X X X X Xwarn4add(S,slot) X char *S; X int slot; X`7B WINDOW *Border; X WINDOW *warn; X int ans; X X Border = newwin(10,78,7,1); X warn = subwin(Border,8,76,8,2); X box(warn,'*','*'); X mvwaddstr(warn,2,2,"double booking, time "); X wprintw(warn,"%2d:%02d is already booked as:", slot/NUMPERIODS+8, X (slot%NUMPERIODS)*(60/NUMPERIODS) ); X mvwaddstr(warn,3,2,S); X X message1(" ? Overwrite_original Keep_original Abort_entire_booking St Vop_confirming "); X X do X `7B mvwaddstr(warn,5,2, X "Enter O to Overwrite, K to Keep Original,"); X mvwaddstr(warn,6,2, X " A to Abort booking, S to stop confirmations"); X X noecho(); ans = toupper(wgetch(warn)); echo(); X if (ans == '?') online_help(7); X `7D while (ans != 'O' && ans != 'K' && ans != 'A' && ans != 'S'); X X message1(" "); X X delwin(warn); X delwin(Border); X X switch (ans) X `7B case 'O': return 0; X case 'K': return 1; X case 'A': return 2; X case 'S': return 3; X `7D X X`7D X X X X Xwarn4del(S,slot) X char *S; X int slot; X`7B WINDOW *Border; X WINDOW *warn; X int ans; X X Border = newwin(10,78,7,1); X warn = subwin(Border,8,76,8,2); X box(warn,'*','*'); X mvwaddstr(warn,2,2,"Safety Check:: "); X wprintw(warn,"%2d:%02d is booked as:", slot/NUMPERIODS+8, X (slot%NUMPERIODS)*(60/NUMPERIODS) ); X mvwaddstr(warn,3,2,S); X X message1(" ? Delete_entry Keep_entry Abort_entire_delete_task Stop_co Vnfirming "); X X do X `7B mvwaddstr(warn,5,2, X "Enter D to Delete entry, K to Keep entry, "); X mvwaddstr(warn,6,2, X " A to Abort delete function, S to stop confirmatio Vns"); X noecho(); ans = toupper(wgetch(warn)); echo(); X if (ans == '?') online_help(6); X `7D while (ans != 'D' && ans != 'K' && ans != 'A' && ans != 'S'); X X message1(" "); X X delwin(warn); X delwin(Border); X X switch (ans) X `7B case 'D': return 0; X case 'K': return 1; X case 'A': return 2; X case 'S': return 3; X `7D X X`7D X X X X Xday2julian(D) X char *D; X`7B int year, mon, day; X int jd; X X year = atoi(D); mon = atoi(D+3); day = atoi(D+6); X X jd = juliancounts`5Bmon-1`5D + day; X if ( ( year && !(year%4)) && mon > 2) ++jd; X X return jd; X`7D X X Xchar * Xjulian2day(D,year,wday) X int D; X char *year; X char wday; X`7B static char string`5BDATESIZE`5D; X int mon; X int leapyear; X X leapyear = (atoi(year) && !(atoi(year)%4) ); X X mon=0; X while (juliancounts`5Bmon`5D < D) mon++; X X if (mon >= 3 && leapyear) X `7B if (D == 60 ) /* leap day */ X sprintf(string,"%2s:%02d:%02d:%c", year, mon-1, X D-juliancounts`5Bmon-2`5D, V wday); X else X sprintf(string,"%2s:%02d:%02d:%c",year,mon, X D-juliancounts`5Bmon-1`5D-1 V,wday); X `7D X else X sprintf(string,"%2s:%02d:%02d:%c",year,mon,D-juliancounts`5Bmon-1`5D V,wday); X X return string; X`7D X X X Xblankout(str) X char *str; X `7B while (*str) `7B *str= ' '; ++str; `7D return; `7D X X X X Xisblanks(str) X char *str; X`7B while (*str) X `7B if (!isspace(*str)) X return 0; X X ++str; X `7D X X return 1; X`7D X X X X X/* X * on the vax, strcpy will NOT work if NULL parametors are used X * this codes around it X */ Xchar * Xmstrcpy(t,s) X char *t,*s; X`7B if (s && t) X return strcpy(t,s); X else if (!t) X return t; X else if (!s) X *t = 0; X X return t; X`7D X X X X Xget_string(W,ypos,xpos,linein,limit) X WINDOW *W; X int xpos, ypos; X char *linein; X int limit; X`7B int X, CX; X char *linestart; X int count=0; X X linestart = linein; X *linein = 0; X X CX = mvwinch(W,ypos,xpos); X X = mvwgetch(W,ypos,xpos++); X X while ( ( X != '\n') && ( X != '\r')) X `7B if ( (X == 0177) `7C`7C (X == 010) ) /* delete and BS*/`20 X `7B --linein; --count; X X if (linein < linestart) X `7B linein = linestart; count = 0; X --xpos; X `7D X else X `7B xpos-=2; X mvwaddch(W,ypos,xpos,CX); X wmove(W,ypos,xpos); X wrefresh(W); X `7D X X *linein = 0; X --linein; --count; /* counter the increment below */ X `7D X else *linein = X; X X if (count == (limit -10)) message2("\007"); X X ++count; ++linein; X if (count == limit) X `7B message2("\007end of line"); X --count; --linein;--xpos; X `7D X X if (linein == linestart) CX = mvwinch(W,ypos,xpos); X else CX = mvwinch(W,ypos,xpos-1); X X X = mvwgetch(W,ypos,xpos++); X message2(" "); X `7D X X *linein = 0; X return; X`7D X X X Xchangedatafile(DataFile,DataFilePtr,DataFileCnt,MasterFlags) X char **DataFile; X int *DataFilePtr, DataFileCnt, *MasterFlags; X`7B WINDOW *Border; X WINDOW *change; X int ans, i; X X Border = newwin(DataFileCnt+4+4,78,1,1); X change = subwin(Border,DataFileCnt+4,74,2,2); X mvwaddstr(change,0,29,"CHANGE DATAFILE"); X X message1(" ? Up Down Quit "); X X for (i=0; i< DataFileCnt;i++) X `7B mvwaddstr(change,4+i,29,DataFile`5Bi`5D); X if (MasterFlags`5Bi`5D) waddstr(change," "); X `7D X X i=(*DataFilePtr); X do X `7B mvwaddstr(change,0,4,"Use the U and D keys to pick the datafile, < VCR> to select, Q to quit"); X X wstandout(change); X mvwaddstr(change,4+i,29,DataFile`5Bi`5D); X wstandend(change); X noecho(); ans = toupper(wgetch(change)); echo(); X X switch (ans) X `7B case 'U': X mvwaddstr(change,4+i,29,DataFile`5Bi--`5D); X if (i<0) i = DataFileCnt-1; X break; X X case 'D': X mvwaddstr(change,4+i,29,DataFile`5Bi++`5D); X if (i>=DataFileCnt) i = 0; X break; X X case '\n': case '\r': break; X X case '?': online_help(8); break; X X case 'Q': i = -1; break; X X default: break; X `7D X X `7D while (ans != '\r' && ans != '\n' && ans != 'Q'); X X delwin(change); X delwin(Border); X X if (i == -1) X return 0; X X *DataFilePtr = i; X return 1; X`7D X X X X Xonline_help(which) X int which; X`7B char syscommand`5B80`5D; X WINDOW *COVERWIN; X X if (which > NUMTOPICS `7C`7C which < 0) X `7B message2("error in help routine, contact support"); X return; X `7D X X COVERWIN = newwin(24,80,0,0); /* cover window with blanks */ X sprintf(syscommand,"%s %s",HELPCOM,topics`5Bwhich`5D); X system(syscommand); X delwin(COVERWIN); /* uncover -- majik redraw!! */ X X return; X`7D X X X X/* X * EOF X */ $ CALL UNPACK QUO_VADIS.C;485 159342963 $ create 'f' X X#define SLOTSIZE 60 X#define DATESIZE 11 X X#define OFHeader ":!:!:!:!:!:" X#define FHeader "%!%!%!%!%!%" X#define NUMHOURS 15`20 X#define NUMPERIODS 12`20 X#define NUMSLOTS NUMHOURS * NUMPERIODS X X#define MAXDAYS 365 X X#define SLOTSPERPAGE 20 X X#define QVROOT "quovadis$root:" X#define MAXDATAFILE 20 X X#define PRINTCOMM "print/noident/nonotify/delete/que=lta2" X $ CALL UNPACK QUO_VADIS.H;15 1717187433 $ create 'f' X1 QUO_VADIS X XQuo_vadis is a time schedular. It allows multiple people the ability to Xview/edit multiple schedules. Possible uses are several secretaries booking Xconference rooms, one secretary scheduling many people who are also booking Xthemselves &c. X X2 release_history X Xjul 13, 1990 -- v.1 X -a schedular, share and enjoy Xaug 24, 1990 -- v.2 X -allow each datafile to be either master or slave, not X master for all or slave for all X -create a spawned version that can be attached at will. X (details on this in "usage", below) X -on printout, if a booking is one slot only, then only X show the start time and not the end time X -expand booking from 15 minute slots to 5 minute slots X -change the "1day" view to match the printout, ie: only X show slots that are booked, not the whole day of 180 slots X -change the one week view to show 5 days, not 7 days due to X space limitations on the screen X -change the command "Week" to "5day" X -online help X -(Q)uit command added to data/time specification X X X2 requirments X XVAXC 3.0 X X X2 using_qv X X3 setup X Xdefine two symbols X $ QV == "$quovadis$root:quo_vadis.exe QV" X $ QVS == "@quovadis$root:qv.com" X X X3 usage X X qv `5B-m`5D datafile `5B `5B-m`5D datafile ...`5D X XYou must specify the datafile(s) that you wish to use. if you specify more Xthan one, you can alternate among them with the menu choice "Change_data". XIf you only specify one, you will not have this menu choice. X XIf you wish to look at the data (for example, a Boss who wants to know Xwhere s/he is supposed to be) then do not use the -m parametors. If you Xwish to edit (ie: add or delete) entries in the schedular, then use the X-m (modify) parametor. This is intended for use by the person (secretary) Xwho is responsible for the booking of time. X XAt all times, the legal choices are displayed at the bottom of the screen, Xwith the option letters highlighted. Just press the option key. As you Xproceed through the menus, the list of legal choices will change to Xreflect your current state. X X X3 spawned_usage X X qvs `5B-m`5D datafile `5B `5B-m`5D datafile ...`5D X XThe com file qv.com is pointed to by the symbol qvs. This is important. XWhen qv.com is executed it fires up a spawning version of quo_vadis. That Xis, quo_vadis is fired up in a spawned process. When you quit from the`20 Xspawned version, quo_vadis remains alive as a subprocess. X +-+-+-+-+-+-+-+- END OF PART 4 +-+-+-+-+-+-+-+-