| You can do some of this by declaring the quadword time to be an 8-byte
STRING variable. Then, you can use $BINTIM, etc with it by passing it
as ...,FOO BY REFERENCE,...
Note that the string must be static for this to work - putting it in a MAP
is a simple way to do it.
This hack should also allow you to use the time values as a key in the file;
not sure about that, tho - basic may be smarter than I think, but I'm pretty
sure it only checks for key sizes, not type.
-Rick
|
| You can fake BASIC into supporting quadwords by defining a two-word array
and then redefining it, such as
MAP (TEMP) STRING QUAD=4% ! Define four-word (quadword) placeholder
MAP (TEMP) LONG TIME(2%) ! Redefine the quadword as an array
You can then dump the time result in the array by pointing to it by
descriptor. The calling routine doesn't care what the value is, as long
as it has an address of its location. (I haven't used the time system
services for quite a while, so the following may not be quite correct):
CALL SYS$GETTIM(QUAD)
The TIME(1%) buffer then holds the starting address of the time call. The
service calls also ignore boundaries (that is they treat the two-part array
as a quadword), so other calls that require a quadword can use just the
starting address as the argument. For example. to convert the above value
to an ASCII string and print it, the call is:
CALL SYS$ASCTIM &
(, ! Length of returned time string (not needed) &
ASCII_Time$, ! Result of call (ASCII-time) &
TIME(1%), ! Address of time value to convert &
0) ! Conversion flag (0=return full date and time)
PRINT ASCII_Time$
This is dredging up some pretty cobwebby stuff: if anyone has had more recent
experience, please correct the code.
|
| Re .2
Hmmm... I do not like doing this but this is the hackers file
and maybe that means you are allowed to hack other replies...
> MAP (TEMP) STRING QUAD=4% ! Define four-word (quadword) placeholder
This would result in a 4 (four) BYTE, not word placeholder
> MAP (TEMP) LONG TIME(2%) ! Redefine the quadword as an array
This would result in a 3 (three) longword array (time(0..2)) and
more then likely a reserved word violation.
> CALL SYS$GETTIM(QUAD)
This would generatea call by descriptor by default --> ACCVIO
> TIME(1%), ! Address of time value to convert &
[on weak grounds now... this would most likely, not very sure
result in the address of a COPY of the contents of time(1) to
be pushed on the stack and time(1) would never receive the result,
but then again, that might only be true in basic-plus-2 on the 11s.
Other then that your right :-)
Hein.
|
| You do not have to use static strings, as long as you pre-allocate the space.
For example:
QUAD$ = STRING$(8,0)
STS = SYS$BINTIM( INPUT_STRING$, QUAD$ BY REF )
etc.
bob
|
| I tried the method in .1, and it works very nicely !
The product of my labors will be made available in the toolshed
if it comes out well enough. I'm building an 'event scheduler'.
This is a little BASIC program that runs as a detached process.
It owns a multi-keyed ISAM database which stores VMS commands which
are executed according to some kind of schedule. The database
stores the last start time, completion time, completion status,
schedule interval, log file spec, user's UIC, success and failure
counters, next absolute time scheduled, type code (so you can list
the status of all "BACKUP" operations, for example, PID of the
process executing the command (if currently running), and so on.
A library of subroutines with names like "INSERT_EVENT", "MODIFY_EVENT",
and SHOW_EVENT provides access to the data base from user programs.
The event scheduler reads through its database looking for work to do
and when it finds a command that is runnable, it does a create_process
and starts it running under the requestor's UIC. When there are no more
items to process immediately, it sets its alarm clock for when the next
thing will be runnable and goes into common event flag wait. The
routines which write the database also set that flag, and so the scheduler
wakes up and processes things if the database is changed.
When processes that got created by the scheduler complete, they write
their own status back to the database and wake it up.
|