Created
March 11, 2020 21:45
-
-
Save kriegsman/0c0b4557d9be4c7748aeacb85b6a66b1 to your computer and use it in GitHub Desktop.
"JClock for VMS" / Tue, 5 May 87 17:18 EDT / Info-Vax Digest, Thursday, 7 May 1987, Volume 0 : Issue 12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$! JCLOCK ARCHIVE FILE. | |
$! | |
$! CREATE A NEW, EMPTY SUBDIRECTORY, "SET DEFAULT" TO IT, | |
$! PUT THIS FILE IN THE NEW SUBDIRECTORY AS JCLOCK.ARC AND THEN @JCLOCK.ARC | |
$! | |
$! | |
$! SUPER-ULTRA-GIVE-AWAY-WARE PROGRAM...COPY AND DISTRIBUTE AT RANDOM. | |
$! | |
$! | |
$! MARK KRIEGSMAN, AUTHOR 87-05-05 | |
$ write sys$output "This takes a minute; please wait..." | |
$ create jclock.com | |
$ deck/dollars="Bleah!Bleah!" | |
$ set nocontrol=(T,Y) | |
$ startup:= $JCLOCK$BASE:jclock.exe | |
$ startup 'p1 | |
Bleah!Bleah! | |
$ create jclock.for | |
$ deck/dollars="Zap!Ouch!" | |
!=============================================================================! | |
! ! | |
! J C L O C K - By Mark Kriegsman, around 2-87, at Hampshire College ! | |
! Inspired by JCLOCK for the Macintosh (and God knows ! | |
! where that came from) ! | |
! ! | |
! WHAT IT DOES is stick the current time (12 hour format) in the upper ! | |
! right hand corner of the screen, and optionally ring an ! | |
! Alarm (and blink) at a preset time. ! | |
! ! | |
! REQUIRES that users who wish to run it have at least one "free" ! | |
! subprocess slot (try it, you'll get a message if you don't) ! | |
! REQUIRES that it be run on a VT100 (or better) work-alike terminal. ! | |
! The cursor codes are hard wired in to the program, and ! | |
! not all terminals support "SAVE_CURSOR_POSITION" and the ! | |
! corresponding RESTORE. ! | |
! ! | |
! BAD THINGS about it include: editing gets funny looking sometimes, ! | |
! DCL gets spare CR/LF pairs thrown in sometimes. None ! | |
! of this is fatal, or even Very Bad, but some is annoying. ! | |
! ! | |
! ODD THINGS about it include: mainly that if you start JC and then ! | |
! SET HOST to a different node, the JC output follows you. ! | |
! ! | |
! INSTALLATION NOTE: many users can be running JC at once (each as their ! | |
! own subprocess), so it is recommended that someone ! | |
! put the files (JCLOCK.COM, JCLOCK.INIT, JCLOCK.EXE) ! | |
! a World:Read+Execute subdirectory, and that ! | |
! everyone run it from there. We do this, and ! | |
! everybody gets to use it without having to HAVE it. ! | |
! ! | |
! RESOURCE DRAIN is really, really small. The subprocess HIBERnates for ! | |
! most of the time, and even the IO is non-single-char. ! | |
! Just for kicks, try using MON PROC/TOPCPU and watching ! | |
! how little time it uses. ! | |
! ! | |
! AUTHOR, ADDRESS: Mark Kriegsman ! | |
! Hampshire College ! | |
! Amherst, MA 01002 ! | |
! -or- ! | |
! MKrieg@UMass.BITNET ! | |
! ! | |
!=============================================================================! | |
REAL SECS,ONESEC | |
INTEGER HOUR,MINUTE,SECOND,ALLEN,MAZBUZ,BUZYET | |
CHARACTER*1 ESC,BEEP | |
CHARACTER*2 SAVE,REST,POST,TWODIG | |
CHARACTER*4 NORMAL | |
CHARACTER*7 HOME | |
CHARACTER*8 FLASH | |
CHARACTER*9 PRE | |
CHARACTER*10 TIME | |
CHARACTER*21 BIGGIE | |
CHARACTER*33 BIGGER | |
CHARACTER*10 ALTIME | |
STATUS = LIB$GET_FOREIGN(ALTIME,,ALLEN) ! See if we got an | |
IF (ALLEN .EQ. 0) ALTIME = 'No_Alarm' ! Alarm request | |
BEEP = CHAR(7) ! just to be clear: | |
ESC = CHAR(27) ! these codes work on | |
SAVE = ESC // '7' ! VT100s and "better" | |
REST = ESC // '8' ! terminals, perhaps ONLY. | |
HOME = ESC // '[0;70H' | |
FLASH = ESC // '[5m' // ESC // '[1m' | |
NORMAL = ESC // '[0m' | |
PRE = SAVE // HOME | |
POST = REST | |
ONESEC = 1.0 ! how often to update. | |
MAXBUZ = 3 | |
BUZYET = 0 | |
1 SECS = SECNDS(0.0) ! What time is it? | |
ISEX = IFIX(SECS) ! in seconds. | |
HOUR = ISEX / 3600 ! convert to HMS | |
IF (HOUR .GE. 12) HOUR = HOUR - 12 | |
IF (HOUR .EQ. 0) HOUR = 12 | |
ISEX = MOD(ISEX,3600) | |
MINUTE = ISEX / 60 | |
SECOND = MOD(ISEX,60) ! now to HH:MM:SS | |
TIME = ' ' // TWODIG(HOUR) // ':' // TWODIG(MINUTE) // ':' | |
1 // TWODIG(SECOND) // ' ' | |
BIGGIE = PRE // TIME // POST ! build string to send | |
IF (TIME(2:9) .GE. ALTIME(1:8)) THEN | |
BIGGER = FLASH // BIGGIE // NORMAL | |
WRITE (*,102) BIGGER | |
IF (BUZYET .LT. MAXBUZ) THEN | |
WRITE(*,103) BEEP | |
BUZYET = BUZYET + 1 | |
END IF | |
ELSE | |
WRITE (*,101) BIGGIE | |
END IF | |
STATUS = LIB$WAIT(ONESEC) ! Wait for update | |
IF (.TRUE.) GOTO 1 ! most of the time, eh? | |
STOP | |
101 FORMAT('+',$,21A) ! Watch string length!! | |
102 FORMAT('+',$,33A) | |
103 FORMAT('+',$,1A) | |
END | |
c------------------------------------------------------------------- | |
CHARACTER FUNCTION TWODIG*2(INTGR) | |
c Takes as input an integer and returns a two-character string. | |
INTEGER INTGR,LD,HD | |
HD = INTGR / 10 | |
LD = INTGR - (HD*10) | |
TWODIG = CHAR( HD +48) // CHAR( LD +48) | |
RETURN | |
END | |
Zap!Ouch! | |
$ create jclock.init | |
$ deck/dollars="gurglepop" | |
$ verify = f$verify(0) | |
$ normal1 = %x10000001 | |
$ normal2 = %x00030001 | |
$ message = f$environment("message") | |
$ set message/noid/noseverity/nofacility/notext | |
$ if p1 .eqs. "SHOW" then goto SHOWJCLOCK | |
$ if f$getdvi(f$trnlnm("tt"),"tt_ansicrt") .eqs. "FALSE" then goto NOTANSICRT | |
$ tries = 0 | |
$ me = f$getjpi("","MASTER_PID") | |
$ !me = f$trnlnm("tt") - "TA" - ":" | |
$ TryStop: | |
$ on error then goto TryNewTT | |
$ stop "''me'_JClock" | |
$ if $status .eq. normal1 .or. $status .eq. normal2 then goto Stopped | |
$ write sys$output "Starting JClock" | |
$ altim = "XX:XX:XX" | |
$ if p1 .eqs. "" then goto NoAlarm | |
$ altim = f$cvtime(p1,,"hour") + ":" + f$cvtime(p1,,"minute") + ":" + f$cvtime(p | |
$ NoAlarm: | |
$ on error then goto NoSpawn | |
$ spawn/now/nonoti/out=tt:/proc="''me'_JClock" @JCLOCK$BASE:jclock.com 'altim | |
$ goto Done | |
$ TryNewTT: | |
$ if tries .eq. 2 then goto BigProblem | |
$ tries = tries + 1 | |
$ me = "''me'" + "$" | |
$ goto TryStop | |
$ BigProblem: | |
$ write sys$output "Got a problem too big to fix, can't run JClock." | |
$ goto Done | |
$ ShowJClock: | |
$ scan/sub/nohead/trail/image="JCLOCK" | |
$ goto Done | |
$ NotAnsiCrt: | |
$ write sys$output "Terminal can't support JClock!" | |
$ if JCLOCK$TOLDYASO .eq. 1 then goto Done | |
$ JCLOCK$TOLDYASO == 1 | |
$ write sys$output "Try SET TERM/INQ, or SET TERM/VT100." | |
$ goto Done | |
$ NoSpawn: | |
$ write sys$output "Can't spawn JClock subprocess!" | |
$ Stopped: | |
$ write sys$output "JClock Stopped" | |
$ Done: | |
$ set message'message | |
$ verify = f$verify(verify) | |
gurglepop | |
$ create jclock.help | |
$ deck/dollars="redbutton" | |
This is the subdirectory that contains all the parts and batteries for | |
using the JClock program (so called after the MacProgram of the same name). | |
JClock puts the current time in the upper right hand corner of any | |
VT100 (or better) terminal, and keeps it re-paints it every second. | |
To use it, use | |
$ DEFINE/NOLOG JCLOCK$BASE $$$MAGIC$$$ | |
$ JC*LOCK :== @JCLOCK$BASE:JCLOCK.INIT | |
to set the command to access it. | |
Then, use JC to "install" JClock, and JC again to "remove" it. It conflicts | |
with a few things, but not PHONE, MAIL, <DCL>, or most anything else. | |
You can also use JC 4:30 (or something) to set an "alarm" for 4:30. Note that | |
1) this can be turned off by "removing" the ringing JCLOCK, and 2) it | |
only uses 12-hour time...not 24-hour. | |
redbutton | |
$ create $$$read.me | |
$ deck/dollars="bonanza" | |
No, on second thought don't read me, read JCLOCK.HELP. | |
Sorry for the difficulty. | |
bonanza | |
$ fortran jclock | |
$ link jclock | |
$ delete jclock.obj;* | |
$ set protection=(s:rwed,o:rwed,w:e) jclock.* | |
$ set protection=(w:re) jclock.for,jclock.help | |
$ here = f$enviro("default") | |
$ define/nolog JCLOCK$BASE 'here | |
$ open/write out jclock.temp | |
$ write out "$ edit jclock.help" | |
$ write out "subs/$$$MAGIC$$$/''here'/1:end/notype" | |
$ write out "exit" | |
$ close out | |
$ @jclock.temp/out=nl: | |
$ purge jclock.help | |
$ delete jclock.temp;* | |
$ write sys$output "ok, everything's unpacked." | |
$ write sys$output "You can delete JC.ARC now, but I'm not going to in case you | |
$ write sys$output "A) want to pass it along to someone else, or B) need to re-r | |
$ write sys$output "Execute the JCLOCK.INIT file to start or stop the program." | |
$ write sys$output "Use the command JC to test JClock now. (and to stop it, too | |
$ write sys$output "(Hit a few <RETURN>s after starting it.) | |
$ esc[0,8]=27 | |
$ write sys$output "''esc'#3''esc'[1m''esc'[7mAND FOR GOD'S SAKE READ THE HELP." | |
$ write sys$output "''esc'#4AND FOR GOD'S SAKE READ THE HELP.''esc'[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment