-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakeReplaceBas.tmp
More file actions
50 lines (45 loc) · 1.88 KB
/
Copy pathMakeReplaceBas.tmp
File metadata and controls
50 lines (45 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# MakeReplaceBas.tmp - Makefile (template) for MakeReplaceBas.
$(error out-of-date)
# 4/19/25. wmk. (automated) path corrections.
#
# This makefile is edited by DoSed.sh with <basmodule> <xbafile> substituted
# throughout. <basmodule> will be the name of a .bas source file with no
# filename extension; <xbafile> will be the complete name of an XBA file with
# the .xba filename extension.
#
# Modification History.
# ---------------------
# 4/19/25. wmk. (automated) Modification History sorted.
# 5/4/22. wmk. (automated) path corrections.
# 4/24/22. wmk. *pathbase* env var included.
# 3/8/22. wmk. original makefile; adapted from MakeExtractBas;
# 3/8/22. add ampersand conversion to sed; note & conversion must come
# 3/8/22. first to avoid screwing up other XML & fields.
ifndef AWK
AWK = mawk
endif
.PHONY : Always JustDoIt
.ONESHELL : ;
projpath = $(codebase)/Projects-Geany/BadAssLibrary
# <filepath>/<filebase>.sql
#=======================================================
Always : JustDoIt
cd $(projpath)
cp <basmodule>.bas $$TEMP_PATH/scratch.bas
sed -i "s?\&?\&\;?g;s?'?\&apos\;?g;s?\"?\"\;?g" $$TEMP_PATH/scratch.bas
# delete 1st and last lines of new .bas
sed -i "/\/\ <basmodule>.bas/d;/\/\*\*\//d" $$TEMP_PATH/scratch.bas
cp <xbafile> scratch.xba
sed -i "1,4d" scratch.xba
# find module.bas in scratch.xba file; read lines from stripped .bas file
mawk "/\/\/ <basmodule>.bas/{f=1;print;while(getline < \"$$TEMP_PATH/scratch.bas\")\
{print}}/\/\*\*\//{f=0}!f" scratch.xba > new<xbafile>
sed -i '1i newline\;' new<xbafile>
sed -i "1r ModuleHdr.xba" new<xbafile>
sed -i "1d" new<xbafile>
mv <xbafile> old<xbafile>
mv new<xbafile> ./<xbafile>
echo "module <basmodule>.bas replaced into local <xbafile>..."
echo "use PutXBAModule.sh to copy the new <xbafile> over GitHub/<xbafile> after changes checked."
#=======================================================
JustDoIt: ;