summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-05-23 21:36:54 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-05-24 21:37:54 -0400
commit8b8c0c7c2ac40cd729a9eeb39189c184978b6d57 (patch)
tree09ab71d2b8f13ae47960d5508a5afd3ac135e588 /tools
parentac20f8a73c9898ab66e176ab66f3ef89bb76692d (diff)
downloadrockbox-8b8c0c7c2ac40cd729a9eeb39189c184978b6d57.tar.gz
rockbox-8b8c0c7c2ac40cd729a9eeb39189c184978b6d57.zip
checkwps: Validate translated strings (%Sx)
In verbose mode it will log valid the strings found, otherwise it will only complain when we encounter a missing string. Unfortunately a missing string is not inherently a problem, due to conditional expressions. So all we can do is complain in checkwps or if wps debugging is turned on. Meanwhile, this is the first step in actually enumerating the translated strings used by themes. Change-Id: Ia93b333085e825d5b085c4d372ad8e13aa3e3ba1
Diffstat (limited to 'tools')
-rw-r--r--tools/checkwps/SOURCES1
-rw-r--r--tools/checkwps/checkwps.c9
-rw-r--r--tools/checkwps/checkwps.make39
-rwxr-xr-xtools/configure1
4 files changed, 41 insertions, 9 deletions
diff --git a/tools/checkwps/SOURCES b/tools/checkwps/SOURCES
index c00268fa75..45d59a16a5 100644
--- a/tools/checkwps/SOURCES
+++ b/tools/checkwps/SOURCES
@@ -2,6 +2,7 @@
2../../apps/gui/skin_engine/skin_parser.c 2../../apps/gui/skin_engine/skin_parser.c
3../../apps/gui/skin_engine/skin_backdrops.c 3../../apps/gui/skin_engine/skin_backdrops.c
4../../apps/gui/viewport.c 4../../apps/gui/viewport.c
5../../apps/language.c
5../../apps/misc.c 6../../apps/misc.c
6../../firmware/common/strmemccpy.c 7../../firmware/common/strmemccpy.c
7../../firmware/common/strlcpy.c 8../../firmware/common/strlcpy.c
diff --git a/tools/checkwps/checkwps.c b/tools/checkwps/checkwps.c
index 932dc3884c..dd2115d5ef 100644
--- a/tools/checkwps/checkwps.c
+++ b/tools/checkwps/checkwps.c
@@ -35,7 +35,7 @@
35#include "file.h" 35#include "file.h"
36#include "font.h" 36#include "font.h"
37 37
38bool debug_wps = true; 38bool debug_wps = false;
39int wps_verbose_level = 0; 39int wps_verbose_level = 0;
40char *skin_buffer; 40char *skin_buffer;
41 41
@@ -167,9 +167,9 @@ int remote_getwidth(void) { return LCD_REMOTE_WIDTH; }
167int remote_getheight(void) { return LCD_REMOTE_HEIGHT; } 167int remote_getheight(void) { return LCD_REMOTE_HEIGHT; }
168#endif 168#endif
169 169
170static inline bool backdrop_load(const char *filename, char* backdrop_buffer) 170static inline bool backdrop_load(const char *filename, char* backdrop_buffer)
171{ 171{
172 (void)filename; (void)backdrop_buffer; return true; 172 (void)filename; (void)backdrop_buffer; return true;
173} 173}
174 174
175struct screen screens[NB_SCREENS] = 175struct screen screens[NB_SCREENS] =
@@ -282,6 +282,7 @@ int main(int argc, char **argv)
282 while (argv[1][i] && argv[1][i] == 'v') { 282 while (argv[1][i] && argv[1][i] == 'v') {
283 i++; 283 i++;
284 wps_verbose_level++; 284 wps_verbose_level++;
285 debug_wps = true;
285 } 286 }
286 } 287 }
287 skin_buffer = malloc(SKIN_BUFFER_SIZE); 288 skin_buffer = malloc(SKIN_BUFFER_SIZE);
diff --git a/tools/checkwps/checkwps.make b/tools/checkwps/checkwps.make
index 3004bbc2ed..ce02ce3ffd 100644
--- a/tools/checkwps/checkwps.make
+++ b/tools/checkwps/checkwps.make
@@ -4,14 +4,14 @@
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/ 6# \/ \/ \/ \/ \/
7# $Id$ 7
8# 8ENGLISH := english
9 9
10# Use global GCCOPTS 10# Use global GCCOPTS
11GCCOPTS += -D__PCTOOL__ -DCHECKWPS 11GCCOPTS += -D__PCTOOL__ -DCHECKWPS
12 12
13CHECKWPS_SRC = $(call preprocess, $(TOOLSDIR)/checkwps/SOURCES) 13CHECKWPS_SRC = $(call preprocess, $(TOOLSDIR)/checkwps/SOURCES)
14CHECKWPS_OBJ = $(call c2obj,$(CHECKWPS_SRC)) 14CHECKWPS_OBJ = $(call c2obj,$(CHECKWPS_SRC)) $(BUILDDIR)/lang/lang_core.o
15 15
16OTHER_SRC += $(CHECKWPS_SRC) 16OTHER_SRC += $(CHECKWPS_SRC)
17 17
@@ -29,7 +29,9 @@ INCLUDES = -I$(ROOTDIR)/apps/gui \
29 -I$(ROOTDIR)/lib/rbcodec/metadata \ 29 -I$(ROOTDIR)/lib/rbcodec/metadata \
30 -I$(ROOTDIR)/lib/rbcodec/dsp \ 30 -I$(ROOTDIR)/lib/rbcodec/dsp \
31 -I$(APPSDIR) \ 31 -I$(APPSDIR) \
32 -I$(BUILDDIR) 32 -I$(BUILDDIR) \
33 -I$(BUILDDIR)/lang \
34 $(TARGET_INC)
33 35
34.SECONDEXPANSION: # $$(OBJ) is not populated until after this 36.SECONDEXPANSION: # $$(OBJ) is not populated until after this
35 37
@@ -37,3 +39,32 @@ $(BUILDDIR)/$(BINARY): $$(CHECKWPS_OBJ) $$(CORE_LIBS)
37 @echo LD $(BINARY) 39 @echo LD $(BINARY)
38 $(SILENT)$(HOSTCC) -o $@ $+ $(INCLUDE) $(GCCOPTS) \ 40 $(SILENT)$(HOSTCC) -o $@ $+ $(INCLUDE) $(GCCOPTS) \
39 -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) 41 -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS))
42
43#### Everything below is hacked in from apps.make and lang.make
44
45$(BUILDDIR)/apps/features: $(ROOTDIR)/apps/features.txt
46 $(SILENT)mkdir -p $(BUILDDIR)/apps
47 $(SILENT)mkdir -p $(BUILDDIR)/lang
48 $(call PRINTS,PP $(<F))
49 $(SILENT)$(CC) $(PPCFLAGS) \
50 -E -P -imacros "config.h" -imacros "button.h" -x c $< | \
51 grep -v "^#" | grep -v "^ *$$" > $(BUILDDIR)/apps/features; \
52
53$(BUILDDIR)/apps/genlang-features: $(BUILDDIR)/apps/features
54 $(call PRINTS,GEN $(subst $(BUILDDIR)/,,$@))tr \\n : < $< > $@
55
56$(BUILDDIR)/lang_enum.h: $(BUILDDIR)/lang/lang.h $(TOOLSDIR)/genlang
57
58$(BUILDDIR)/lang/lang.h: $(ROOTDIR)/apps/lang/$(ENGLISH).lang $(BUILDDIR)/apps/features $(TOOLSDIR)/genlang
59 $(call PRINTS,GEN lang.h)
60 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
61 perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $<
62
63$(BUILDDIR)/lang/lang_core.c: $(BUILDDIR)/lang/lang.h $(TOOLSDIR)/genlang
64
65$(BUILDDIR)/lang/lang_core.o: $(BUILDDIR)/lang/lang.h $(BUILDDIR)/lang/lang_core.c
66 $(call PRINTS,CC lang_core.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang/lang_core.c -o $@
67
68$(BUILDDIR)/lang/max_language_size.h: $(BUILDDIR)/lang/lang.h
69 $(call PRINTS,GEN $(subst $(BUILDDIR)/,,$@))
70 $(SILENT)echo "#define MAX_LANGUAGE_SIZE 131072" > $@
diff --git a/tools/configure b/tools/configure
index 1a03f3f010..0f617d7093 100755
--- a/tools/configure
+++ b/tools/configure
@@ -4307,7 +4307,6 @@ fi
4307 uname=`uname` 4307 uname=`uname`
4308 simcc "checkwps" 4308 simcc "checkwps"
4309 toolset=''; 4309 toolset='';
4310 t_cpu='';
4311 GCCOPTS=''; 4310 GCCOPTS='';
4312 rbdir='.' 4311 rbdir='.'
4313 extradefines="$extradefines -DDEBUG" 4312 extradefines="$extradefines -DDEBUG"