[Info-vax] VI* on VMS
Arne Vajhøj
arne at vajhoej.dk
Fri Oct 18 20:42:59 EDT 2024
On 10/18/2024 1:47 PM, Arne Vajhøj wrote:
> On 10/18/2024 9:26 AM, Arne Vajhøj wrote:
>> On 10/18/2024 8:48 AM, Arne Vajhøj wrote:
>>> Doing it automatically is an interesting question. I don't know how, but
>>> maybe there is a way in TPU - an "on something changed event". I don't
>>> think anyone wanted to do that back then (late 80's early 90's), but
>>> with todays CPU's then why not.
>>
>> I took a look at the TPU manual. It does not look like there
>> is anything smart for this.
> Nothing in the TPU manual, but something in the TPU$ manual.
>
> This is not pretty, but it seems to work.
Code updated to fix a few issues (not supporting
empty file, having to explicit specify "tpu" as
argument).
procedure eve_auto_match()
if mark (NONE) <> end_of(current_buffer) then
if (current_character = "{") or
(current_character = "(") or
(current_character = ")") or
(current_character = "}") then
eve_match_delimitors();
endif;
endif;
endprocedure;
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <descrip.h>
#include <tpudef.h>
#include <starlet.h>
#include <lib$routines.h>
#include <tpu$routines.h>
static const uint32_t MATCH_DELIM_ACTION = 1;
static void setup_timer();
static void do_match()
{
tpu$trigger_async_action(&MATCH_DELIM_ACTION);
setup_timer();
}
static void setup_timer()
{
uint64_t tmo = 1000000; // 0.1 second
sys$setimr(0, &tmo, do_match, 0, 0);
}
static uint32_t cmd_handler()
{
char cmdlin[1024];
$DESCRIPTOR(cmdlin_desc, cmdlin);
uint16_t cmdlin_len;
uint32_t fileio_desc[2] = { (uint32_t)&tpu$fileio, 0 };
strcpy(cmdlin, "tpu ");
cmdlin_desc.dsc$a_pointer += 4;
cmdlin_desc.dsc$w_length -= 4;
lib$get_foreign(&cmdlin_desc, 0, &cmdlin_len);
cmdlin_desc.dsc$a_pointer -= 4;
cmdlin_desc.dsc$w_length = 4 + cmdlin_len;
return tpu$cliparse(&cmdlin_desc, fileio_desc, NULL);
}
int main(int argc, char *argv[])
{
$DESCRIPTOR(matchdelim_desc, "EVE_AUTO_MATCH()");
uint32_t cmd_handler_desc[2] = { (uint32_t)&cmd_handler, 0 };
uint32_t flags = TPU$M_DELETE_CONTEXT;
lib$establish(tpu$handler);
tpu$initialize(cmd_handler_desc, 0);
tpu$execute_inifile();
tpu$specify_async_action(&MATCH_DELIM_ACTION, &matchdelim_desc);
setup_timer();
tpu$control();
tpu$cleanup(&flags);
return 0;
}
Arne
More information about the Info-vax
mailing list