aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--DEPENDENCIES3
-rwxr-xr-xsrc/splashtool15
-rwxr-xr-xsrc/trim.py35
3 files changed, 26 insertions, 27 deletions
diff --git a/DEPENDENCIES b/DEPENDENCIES
index e6196c6..abc54aa 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -3,8 +3,9 @@ RUNTIME:
nafe: read font files
kbd: default font
sh: 1 source file is written in shell script
- python3: 2 source files are written in Python 3
+ python3: 1 source files are written in Python 3
java-runtime: 1 source file is written in Java
+ awk
BUILDTIME:
java-environment: 1 source file is written in Java
diff --git a/src/splashtool b/src/splashtool
index 6c96aee..95f8975 100755
--- a/src/splashtool
+++ b/src/splashtool
@@ -18,11 +18,22 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
in="$(realpath "$1")"
out="$(realpath "$2")"
d="$(dirname "$(realpath "$0")")"
+# Remove all information we do not need.
+trim ()
+{
+ sed -e 's/\t/ /g' | sed -e '/^[ \t]*\(#\|$\)/d' -e 's/ #.*$//' -e 's/^ *//' -e 's/ *$//' |
+ awk ' BEGIN { text = 0; }
+ { t=tolower($1);
+ if (t=="text") text+=1;
+ if (t=="timeout" || t=="menu" || t=="font" || text==1) print $LINE;
+ if (t=="endtext") text+=1;
+ }'
+}
+
cd "$(dirname "$1")"
-cat "$in" | "$d"/trim.py | "$d"/parse.py | java -cp "$d" Assemble "$out" "$3"
+trim < "$in" | "$d"/parse.py | java -cp "$d" Assemble "$out" "$3"
diff --git a/src/trim.py b/src/trim.py
index c623f74..72a1b3f 100755
--- a/src/trim.py
+++ b/src/trim.py
@@ -24,32 +24,19 @@ firsttext = True
while True:
try:
- line = input().replace('\t', ' ')
+ line = input()
lower = line.lower()
- if line.replace(' ', '').startswith('#') or (len(line.replace(' ', '')) == 0):
- continue
- else:
- if ' # ' in line:
- line = line[:line.find(' # ')]
- lower = lower[:lower.find(' # ')]
- while line.startswith(' '):
- line = line[1:]
- lower = lower[1:]
- while line.endswith(' '):
- line = line[:-1]
- lower = lower[:-1]
-
- if lower.startswith('text '):
- text = True
- if firsttext:
- print(line)
- elif lower == 'endtext':
- text = False
- if firsttext:
- print(line)
- firsttext = False
- elif (text and firsttext) or (lower.split(' ')[0] in ('timeout', 'menu', 'font')):
+ if lower.startswith('text '):
+ text = True
+ if firsttext:
print(line)
+ elif lower == 'endtext':
+ text = False
+ if firsttext:
+ print(line)
+ firsttext = False
+ elif (text and firsttext) or (lower.split(' ')[0] in ('timeout', 'menu', 'font')):
+ print(line)
except:
break