Arne Vajhøj
2024-11-23 00:59:07 UTC
Over on the VSI forum there has been a couple of threads
about how to make GIT use a specific editor (VIM/JED/EDT/EVE)
for editing commit messages.
GIT does not come from the VMS world, so it does things
in a more *nix/portable way with external editor,
input file and output file.
But it made me remember that 30 years ago I had code
for having callable EDT and callable TPU edit data
in memory not in disk file.
The code was written in Macro-32 and it was expecting
lines in a Fortran CHARACTER array. Not so 2020'ish.
And besides there was a bug in the TPU version so it
frequently crashed.
But this is what a source control system really should
be using for such functionality. No need for temporary
disk files.
So on to making it work again. And this time in C.
Which for good or worse probably is the language that
will be used for code wanting to use callable EDT
or TPU to edit in memory only data.
And not that easy. The full callable interface to
TPU may be flexible, but it is also rather obscure.
Result: two wrapper functions memedt and memtpu
with a very simple API.
From my test programs:
char buf[10000];
memedt("A\nBB\nCCC", buf, sizeof(buf));
puts(buf);
and:
char buf[10000];
memtpu("A\nBB\nCCC", buf, sizeof(buf));
puts(buf);
Basically both input and output are C strings with
embedded \n's.
If anyone want a copy then it is here:
https://www.vajhoej.dk/arne/vmsstuff/memedit/
It seems to work, but with just 1 test case for each, then
there are likely cases that does not work.
Arne
about how to make GIT use a specific editor (VIM/JED/EDT/EVE)
for editing commit messages.
GIT does not come from the VMS world, so it does things
in a more *nix/portable way with external editor,
input file and output file.
But it made me remember that 30 years ago I had code
for having callable EDT and callable TPU edit data
in memory not in disk file.
The code was written in Macro-32 and it was expecting
lines in a Fortran CHARACTER array. Not so 2020'ish.
And besides there was a bug in the TPU version so it
frequently crashed.
But this is what a source control system really should
be using for such functionality. No need for temporary
disk files.
So on to making it work again. And this time in C.
Which for good or worse probably is the language that
will be used for code wanting to use callable EDT
or TPU to edit in memory only data.
And not that easy. The full callable interface to
TPU may be flexible, but it is also rather obscure.
Result: two wrapper functions memedt and memtpu
with a very simple API.
From my test programs:
char buf[10000];
memedt("A\nBB\nCCC", buf, sizeof(buf));
puts(buf);
and:
char buf[10000];
memtpu("A\nBB\nCCC", buf, sizeof(buf));
puts(buf);
Basically both input and output are C strings with
embedded \n's.
If anyone want a copy then it is here:
https://www.vajhoej.dk/arne/vmsstuff/memedit/
It seems to work, but with just 1 test case for each, then
there are likely cases that does not work.
Arne