[Info-vax] Can C #includes like this be made to work onVMS?
Arne Vajhøj
arne at vajhoej.dk
Tue Oct 15 19:48:41 EDT 2024
On 10/15/2024 3:54 PM, Arne Vajhøj wrote:
> Writing some DCL that does an edit/edt/comm with a substitute on
> all .c files in a directory tree is not that hard to write.
Demo:
$ type z*.c
DKA0:[arne]z1.c;1
#include "a/something.h"
DKA0:[arne]z2.c;1
#include "a/something.h"
DKA0:[arne]z3.c;1
#include "a/something.h"
$ type ab.com
$ loop:
$ fnm = f$search("z*.c")
$ if fnm .eqs. "" then goto endloop
$ define/user sys$input sys$command
$ edit/edt/comm=ab.edt 'fnm'
$ goto loop
$ endloop:
$ exit
$ type ab.edt
s\#include "a/\#include "b/\w
ex
$ @ab
...
$ type z*.c
DKA0:[arne]z1.c;2
#include "b/something.h"
DKA0:[arne]z2.c;2
#include "b/something.h"
DKA0:[arne]z3.c;2
#include "b/something.h"
$ type bc.com
$ loop:
$ fnm = f$search("z*.c")
$ if fnm .eqs. "" then goto endloop
$ define/user sys$input sys$command
$ edit/tpu/init=bc.eve 'fnm'
$ goto loop
$ endloop:
$ exit
$ type bc.eve
all replace "#include ""b/" "#include ""c/"
exit
$ @bc
...
$ type z*.c
DKA0:[arne]z1.c;3
#include "c/something.h"
DKA0:[arne]z2.c;3
#include "c/something.h"
DKA0:[arne]z3.c;3
#include "c/something.h"
$ type cd.com
$ loop:
$ fnm = f$search("z*.c")
$ if fnm .eqs. "" then goto endloop
$ define/user sys$input sys$command
$ edit/tpu/comm=cd.tpu 'fnm'
$ goto loop
$ endloop:
$ exit
$ type cd.tpu
eve_all_replace("#include ""c/", "#include ""d/");
eve_exit();
$ @cd
...
$ type z*.c
DKA0:[arne]z1.c;4
#include "d/something.h"
DKA0:[arne]z2.c;4
#include "d/something.h"
DKA0:[arne]z3.c;4
#include "d/something.h"
Arne
PS: Yes - both gawk and Perl can probably do it in way fewer lines.
More information about the Info-vax
mailing list