Sujet : Re: VI* on VMS
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 19. Oct 2024, 01:42:59
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <67130094$0$712$14726298@news.sunsite.dk>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : Mozilla Thunderbird
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