[Info-vax] VI* on VMS

Arne Vajhøj arne at vajhoej.dk
Fri Oct 18 13:47:18 EDT 2024


On 10/18/2024 9:26 AM, Arne Vajhøj wrote:
> On 10/18/2024 8:48 AM, Arne Vajhøj wrote:
>> On 10/18/2024 8:09 AM, Simon Clubley wrote:
>>> On 2024-10-17, Arne Vajhøj <arne at vajhoej.dk> wrote:
>>>> On 10/17/2024 8:53 AM, Arne Vajhøj wrote:
>>>>> On 10/17/2024 8:37 AM, Simon Clubley wrote:
>>>>>> For one simple but very important example, you have brace matching in
>>>>>> emacs so you can easily check the closing brace matches the correct
>>>>>> opening brace.
>>>>>
>>>>> EVE does not have that out of the box.
>>>>>
>>>>> But then EVE has relative little out of the box.
>>>>>
>>>>> You can add it.
>>>>>
>>>>> Either DIY or grab a copy of Kenneth Faitfield's
>>>>> EVE_MATCH_DELIMITORS.
>>>>>
>>>>> I am afraid there are no online archive of INFO-TPU, but
>>>>> the most valuable pieces will have survived somewhere
>>>>> (I got the above).
>>>>
>>>> Here it is.
>>>
>>> [snip]
>>>
>>> How is this run ? Do you have to manually press a key to do the matching
>>> or does the routine get called automatically as you type (as in emacs) ?
>>
>> As is it is just a command. You can bind that command to a key of
>> your choice.
>>
>> 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.
> 
> It would of course be possible to do a callout in all
> procedures that change current position. But that is a very
> intrusive solution.
> 
> Seems like CTRL/whatever is the best practical.

Nothing in the TPU manual, but something in the TPU$ manual.

This is not pretty, but it seems to work.

procedure eve_auto_match()
     if (current_character = "{") or
        (current_character = "(") or
        (current_character = ")") or
        (current_character = "}") then
         eve_match_delimitors();
     endif
endprocedure;

#include <stdio.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];
     uint16_t cmdlin_len;
     $DESCRIPTOR(cmdlin_desc, cmdlin);
     uint32_t fileio_desc[2] = { (uint32_t)&tpu$fileio, 0 };
     lib$get_foreign(&cmdlin_desc, 0, &cmdlin_len);
     cmdlin_desc.dsc$w_length = cmdlin_len;
     return tpu$cliparse(&cmdlin_desc, fileio_desc, NULL);
}

int main(int argc, char *argv[])
{
     lib$establish(tpu$handler);
     uint32_t cmd_handler_desc[2] = { (uint32_t)&cmd_handler, 0 };
     tpu$initialize(cmd_handler_desc, 0);
     tpu$execute_inifile();
     $DESCRIPTOR(matchdelim_desc, "EVE_AUTO_MATCH()");
     tpu$specify_async_action(&MATCH_DELIM_ACTION, &matchdelim_desc);
     setup_timer();
     tpu$control();
     uint32_t flags = TPU$M_DELETE_CONTEXT;
     tpu$cleanup(&flags);
     return 0;
}

Arne




More information about the Info-vax mailing list