From: CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 17-SEP-1990 16:50:22.74 To: MRGATE::"ARISIA::EVERHART" CC: Subj: ** Results of the DCL Challange ** Received: by crdgw1.ge.com (5.57/GE 1.73) id AA21373; Sun, 16 Sep 90 14:43:07 EDT Message-Id: <9009161843.AA21373@crdgw1.ge.com> Received: From SUN2.NSFNET-RELAY.AC.UK by CRVAX.SRI.COM with TCP; Sun, 16 SEP 90 11:37:07 PDT Received: from vax.nsfnet-relay.ac.uk by sun2.nsfnet-relay.ac.uk with SMTP inbound id aa04022; Sat, 15 Sep 90 2:42:14 +0000 Received: from sun.nsfnet-relay.ac.uk by vax.NSFnet-Relay.AC.UK via Janet with NIFTP id aa12235; 14 Sep 90 17:15 BST Date: Fri, 14 Sep 90 17:56 BST From: Nick de Smith To: INFO-VAX <@nsfnet-relay.ac.uk:INFO-VAX@crvax.sri.com> Subject: ** Results of the DCL Challange ** Here it is, what you have all been waiting for! The results of the *Great DCL Challange* There have been many responses, most of which have worked. The winner was decided by the most compact use of DCL. The second and third best solutions were slightly less efficient variants of the winner. The fourth best solution was a bit of a hack, but the winner of the "Most hideous and Over-Engineered" solution has to be read to be believed! Congratulations to all those who supplied a correct solution (there were over 50!), and thanks to all those who took part. If there is interest, I'll organise another on the same lines. Again - * Congratulations * to all those who got it right! nick NICK@NCDLAB.ULCC.AC.UK The winner was: *** Simon Graham Digital Equipment Corporation (DEC) *** equal first (but arrived later...) * Sture Langemar QZ Universitetsdata AB (Sweden) * Second equal were (in order of arrival): Matthew Madison Rensselaer Polytechnic Institute Guillaume Gerard French Telecom University (France) Third equal were (in order of arrival): Dave Greenwwod (something with a gov.fed in it) Jim Harvey IUPIU Computing Services Wolfgang Moeller GWDG (GDR) Peter Scott NASA/JPL/Caltech Kevin Black NERC (UK) Michael Kimura Hughes Aircraft Corp (at second attempt!) With help from Craig Lee Fourth equal were (in order of arrival): Harry Flowers Memphis State University Neill Clift General Electric Corporation (GEC UK) R.R, Rodriguez Southwest Texas State University The winner of the "Most ghastly, nasty, and evil" solution was: *** Ed Klavins!!!! Micrognosis (Switzerland) *** The winning solution: $! $!This is the "best" answer. $! $ Record[ 0, 32 ] = %x0CA87960 $ Record[ 32, 32 ] = %x0094972C $! $ Write SYS$OUTPUT F$Fao( "Date : !%D", F$CvUI( 32, 32, F$Fao( "!AD", 8, Record ) ) ) $! $! The previous statement works because: $! 1. "Record" is stored by DCL as a string, and is therefore passed by $! descriptor to functions. $! We use the "!AD" operator of $FAO to extract the descriptor of Record $! using $! F$Fao( "!AD", 8, Record ) $! which will return the descriptor as an 8 byte string. $! 2. We now use $! F$CvUI( 32, 32, descriptor-as-a-string ) $! to return the real address of the data as a 32 bit binary number in an integer. $! This extracts the second 32 bits of the "Record" descriptor, which is $! the value of the dsc$a_pointer element of the descriptor, ie the address of $! the data element (the time quadword) that we require. $! 3. Lastly, we use the address from step 2 as input to $FAO to get the date. As $! the "!AD" format requires the address of a VMS time quadword, and integers are $! passed by value to DCL lexical functions, this last $FAO returns the completed $! string. $! The second best solution: ------------------------ $ Write SYS$OUTPUT F$Fao( "Date : !%D", F$CvUI( 32, 32, F$Fao( "!AD", 8, %x'F$Fao( "!XL", Record )' ) ) ) This has one redundant term in the embedded "!XL". The third best solution: ----------------------- $ Write SYS$OUTPUT F$Fao( "Date : !%D", F$CvUI( 0, 32, F$Fao( "!AD", 8, %x'F$Fao( "!XL", Record )' ) + 4 ) ) This has two redundant terms: the "!XL" (as in solution 2) and in the use of the "+ 4" term rather than using the F$CvUI offset of 32. A fourth solution: ----------------- This is pretty tacky, but it works. You can write to any UW protected page of memory, but be warned: DCL makes use of some of these pages, and writing to them can sometimes cause odd things to happen when using DCL. $ Record[ 0, 32 ] = %x0CA87960 $ Record[ 32, 32 ] = %x0094972C $ CTL$A_COMMON = %x7FFE0C00 ! From SYS.MAP any user writeable page in P1 will do (arghhhh!) $ Deposit /Long CTL$A_COMMON = F$CvUI( %x0*8, 32, Record ), F$CvUI( %x4*8, 32, Record ) $ Write SYS$OUTPUT F$Fao( "Date : !%D", CTL$A_COMMON ) The *Most Awful* solution was: ----------------------------- $ name = f$parse( f$environment( "PROCEDURE" ),,, "NAME" ) $ v=f$verify(0+f$integer(f$trnlnm(name+"_VERIFY"))) $ goto START $!+ $! $! A S C T I M . C O M -- Convert binary time to ascii using DCL with NO $! image invocations $! $! $! Author: Ed Klavins, Micrognosis Zuerich. $! $! Date: 11-SEP-1990 $! $! Environment: VAX/VMS V5.3. No privileges required. $! $! $! P1 - first longword of VMS quadword time $! P2 - second longword of time $! $! Setup: This procedure scans the process symbol table, as stored in the $! process P1 space looking for the symbol containing the VMS quadword time. $! Once the symbol is found, then the address of the translation is calculated, $! and passed to the F$FAO lexical to be formatted as a date. $! $! There are two ways the symbol table could have been scanned: by reading the $! hash table sequentially and examining the symbol hashed at each entry, or $! by scanning the symbol definition blocks once they are linked in a list. $! The second method (which is easier, and quicker) is implemented here. $! $! NOTE: NO IMAGES ARE INVOKED IN DETERMINING THE ASCII TIME $!- $START: $ set symbol /scope=(NOLOCAL) $! $ record[0,32]=f$integer(p1) $ record[32,32]=f$integer(p2) $! $! We do a SHOW SYMBOL here, which causes the known symbols to be linked $! in a linked list (since the symbols are not linked until they are required $! to be listed alphabetically). $! $ define sys$output nl: $ sh symbol * $ define sys$output sys$command $! $ INFO = "%" + NAME + "-I, " ! Information message $ WARN = "%" + NAME + "-W, " ! Warning message $ FATAL = "%" + NAME + "-F, " ! Fatal error message $ say = "write SYS$OUTPUT" ! Print to terminal $! $ CTL$AG_CLIDATA = %x7FFE2A5C !should work for any VMS V5 system $! $! V5.3 CLI definitions -- $ PPD$Q_CLISYMTBL = %xC $ POOL_OFFSET = %x1088 $! $ next_blkoff = %xC $ symlen = %x23 $ symnam = %x24 $ symscpe = %x12 $ $ cnttotal = 0 $ cntlocal = 0 $ $ clisymtbl = f$cvui(0,32,f$fao("!AD",4,CTL$AG_CLIDATA+PPD$Q_CLISYMTBL+4)) $ next_symblk = clisymtbl + POOL_OFFSET $ $SEARCH_LOOP: $ symblk = next_symblk $ next_symblk = f$cvui(0,32,f$fao("!AD",4,symblk+next_blkoff)) $ if next_symblk .eq. 0 then goto NOT_FOUND $ cnttotal = cnttotal + 1 $ local = f$cvsi(0,16,f$fao("!AD",2,symblk+symscpe)) $ if local .eq. -1 then goto SEARCH_LOOP ! Only check local symbols... $ cntlocal = cntlocal + 1 $ len = f$cvui(0,8,f$fao("!AD",1,symblk+symlen)) $! say INFO,"Local symbol is ",f$fao("!AD",len,symblk+symnam) $ if f$fao("!AD",len,symblk+symnam) .nes. "RECORD" then goto SEARCH_LOOP $! say INFO,"Local symbol RECORD found!!!" $ say INFO,"Date: '",f$fao("!%D",symblk+symnam+len+2),"'" $! addrtim == symblk+symnam+len+2 $ goto DONE $! $NOT_FOUND: $ say FATAL,"Local symbol RECORD not found" $DONE: $ say INFO,cntlocal,"/",cnttotal-cntlocal," LOCAL/GLOBAL symbols scanned" $ exit 1+0*f$verify(v)