From c651917da8ba70dcc01cd67b958907242efd8351 Mon Sep 17 00:00:00 2001 From: bsongis Date: Wed, 18 Jan 2012 21:39:45 +0000 Subject: [PATCH] Some rename to open9x --- src/Makefile | 25 ++++++------ src/diskio.cpp | 2 +- src/drivers.cpp | 2 +- src/file.cpp | 2 +- src/frsky.cpp | 2 +- src/gtests.cpp | 2 +- src/jeti.cpp | 2 +- src/jeti.h | 2 +- src/lcd.h | 2 +- src/logs.cpp | 2 +- src/menus.cpp | 2 +- src/menus.h | 2 +- src/o9xstrings.cpp | 2 +- src/{gruvin9x.cpp => open9x.cpp} | 2 +- src/{gruvin9x.h => open9x.h} | 0 src/pers.cpp | 2 +- src/pulses.cpp | 2 +- src/rtc.cpp | 2 +- src/simpgmspace.cpp | 2 +- src/simu.cpp | 2 +- src/stamp.cpp | 4 +- src/templates.cpp | 2 +- util/parse.py | 65 ++++++++++++++++++++++++++++++++ 23 files changed, 98 insertions(+), 34 deletions(-) rename src/{gruvin9x.cpp => open9x.cpp} (96%) rename src/{gruvin9x.h => open9x.h} (100%) create mode 100644 util/parse.py diff --git a/src/Makefile b/src/Makefile index 89f86d4c4..f26b46226 100644 --- a/src/Makefile +++ b/src/Makefile @@ -139,13 +139,13 @@ F_CPU = 16000000 FORMAT = ihex # Target file name (without extension). -TARGET = gruvin9x +TARGET = open9x # Object files directory OBJDIR = obj # List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = gruvin9x.cpp pulses.cpp stamp.cpp menus.cpp model_menus.cpp general_menus.cpp main_views.cpp statistics_views.cpp pers.cpp file.cpp lcd.cpp drivers.cpp o9xstrings.cpp +CPPSRC = open9x.cpp pulses.cpp stamp.cpp menus.cpp model_menus.cpp general_menus.cpp main_views.cpp statistics_views.cpp pers.cpp file.cpp lcd.cpp drivers.cpp o9xstrings.cpp ifeq ($(EXT), JETI) CPPSRC += jeti.cpp @@ -572,7 +572,6 @@ REMOVEDIR = rm -rf COPY = cp WINSHELL = cmd -# th9x/gruvin9x-specific XBM2LBM = ruby ../util/xbm2lbm.rb AREV = $(shell sh -c "cat .svn/entries | sed -n '4p'") REV = $(shell echo $$(( $(AREV) + 1 ))) @@ -618,8 +617,8 @@ ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(AVRGCCFLAGS) ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) -SUB_VER = ${shell sh -c "grep \"SUB_VERS\" gruvin9x.h | cut -d\ -f3 | egrep -o \"[[:digit:]]\""} -ABUILD_NUM = ${shell sh -c "grep \"BUILD_NUM\" stamp-gruvin9x.h | egrep -o \"[[:digit:]]+\""} +SUB_VER = ${shell sh -c "grep \"SUB_VERS\" open9x.h | cut -d\ -f3 | egrep -o \"[[:digit:]]\""} +ABUILD_NUM = ${shell sh -c "grep \"BUILD_NUM\" stamp-open9x.h | egrep -o \"[[:digit:]]+\""} BUILD_NUM = $(shell echo $$(( $(ABUILD_NUM) + 1 ))) BUILD_DIR = $(shell pwd | awk -F'/' '{print $$((NF-1))}') ifeq "$(USER)" "bryan" @@ -651,14 +650,14 @@ stamp: @echo $(CPPSRC) @echo "Generate Version-stamp:" - @echo "//Automatically generated file (Makefile) - do not edit" > stamp-gruvin9x.h - @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" >> stamp-gruvin9x.h - @echo "#define TIME_STR \"`date +%H:%I:%S`\"" >> stamp-gruvin9x.h - @echo "#define TAG_VERS $(SUB_VER)-$(THEUSER)" >> stamp-gruvin9x.h - @echo "#define SVN_VERS \"$(BUILD_DIR)-r$(REV)\"" >> stamp-gruvin9x.h - @echo "#define MOD_VERS \"$(MODS)\"" >> stamp-gruvin9x.h - @echo "#define BUILD_NUM $(BUILD_NUM)" >> stamp-gruvin9x.h - @cat stamp-gruvin9x.h + @echo "//Automatically generated file (Makefile) - do not edit" > stamp-open9x.h + @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" >> stamp-open9x.h + @echo "#define TIME_STR \"`date +%H:%I:%S`\"" >> stamp-open9x.h + @echo "#define TAG_VERS $(SUB_VER)-$(THEUSER)" >> stamp-open9x.h + @echo "#define SVN_VERS \"$(BUILD_DIR)-r$(REV)\"" >> stamp-open9x.h + @echo "#define MOD_VERS \"$(MODS)\"" >> stamp-open9x.h + @echo "#define BUILD_NUM $(BUILD_NUM)" >> stamp-open9x.h + @cat stamp-open9x.h font.lbm: font_6x1.xbm @echo diff --git a/src/diskio.cpp b/src/diskio.cpp index 9671f3674..f1e089b62 100644 --- a/src/diskio.cpp +++ b/src/diskio.cpp @@ -26,7 +26,7 @@ /* are platform dependent. */ /*-----------------------------------------------------------------------*/ -#include "gruvin9x.h" +#include "open9x.h" #include "diskio.h" /* Definitions for MMC/SDC command */ diff --git a/src/drivers.cpp b/src/drivers.cpp index 2c8487ffe..b9ac8eb8d 100644 --- a/src/drivers.cpp +++ b/src/drivers.cpp @@ -19,7 +19,7 @@ * */ -#include "gruvin9x.h" +#include "open9x.h" uint16_t eeprom_pointer; const char* eeprom_buffer_data; diff --git a/src/file.cpp b/src/file.cpp index 8cd70c8ba..5e620f964 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -20,7 +20,7 @@ #define PROGRESS_VERTICAL_BAR -#include "gruvin9x.h" +#include "open9x.h" #include "stdio.h" #include "inttypes.h" #include "string.h" diff --git a/src/frsky.cpp b/src/frsky.cpp index d3f4d8787..226c8e0cb 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -18,7 +18,7 @@ * */ -#include "gruvin9x.h" +#include "open9x.h" // Enumerate FrSky packet codes #define LINKPKT 0xfe diff --git a/src/gtests.cpp b/src/gtests.cpp index 936af4471..c21b0bcd2 100644 --- a/src/gtests.cpp +++ b/src/gtests.cpp @@ -20,7 +20,7 @@ */ #include -#include "gruvin9x.h" +#include "open9x.h" uint16_t anaIn(uint8_t chan) { diff --git a/src/jeti.cpp b/src/jeti.cpp index ffd8ff158..3b826da4c 100644 --- a/src/jeti.cpp +++ b/src/jeti.cpp @@ -18,7 +18,7 @@ */ #include "jeti.h" -#include "gruvin9x.h" +#include "open9x.h" uint16_t jeti_keys = JETI_KEY_NOCHANGE; uint8_t JetiBuffer[32]; // 32 characters diff --git a/src/jeti.h b/src/jeti.h index b2d74d004..3316ffd6c 100644 --- a/src/jeti.h +++ b/src/jeti.h @@ -19,7 +19,7 @@ #define jeti_h -#include "gruvin9x.h" +#include "open9x.h" #define JETI_KEY_LEFT 0x70 #define JETI_KEY_RIGHT 0xe0 diff --git a/src/lcd.h b/src/lcd.h index d022687e1..c980c63cb 100644 --- a/src/lcd.h +++ b/src/lcd.h @@ -22,7 +22,7 @@ #ifndef lcd_h #define lcd_h -#include "gruvin9x.h" +#include "open9x.h" #define DISPLAY_W 128 #define DISPLAY_H 64 diff --git a/src/logs.cpp b/src/logs.cpp index f9907157c..5d3383999 100644 --- a/src/logs.cpp +++ b/src/logs.cpp @@ -18,7 +18,7 @@ * */ -#include "gruvin9x.h" +#include "open9x.h" #include "ff.h" // "/G9XLOGS/M00_000.TXT\0" max required length = 21 diff --git a/src/menus.cpp b/src/menus.cpp index a417efa0e..d6291724b 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -20,7 +20,7 @@ */ -#include "gruvin9x.h" +#include "open9x.h" #include "templates.h" #include "menus.h" diff --git a/src/menus.h b/src/menus.h index 024eb883c..00d01a048 100644 --- a/src/menus.h +++ b/src/menus.h @@ -23,7 +23,7 @@ #define menus_h #include -#include "gruvin9x.h" +#include "open9x.h" #define IS_THROTTLE(x) (((2-(g_eeGeneral.stickMode&1)) == x) && (x<4)) diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp index 81c9aca09..94e4caa72 100644 --- a/src/o9xstrings.cpp +++ b/src/o9xstrings.cpp @@ -1,4 +1,4 @@ -#include "gruvin9x.h" +#include "open9x.h" #ifdef TRANSLATIONS_FR #include "translations/fr.h" diff --git a/src/gruvin9x.cpp b/src/open9x.cpp similarity index 96% rename from src/gruvin9x.cpp rename to src/open9x.cpp index 48ce76283..346d161d1 100644 --- a/src/gruvin9x.cpp +++ b/src/open9x.cpp @@ -19,7 +19,7 @@ * */ -#include "gruvin9x.h" +#include "open9x.h" #ifdef SPLASH prog_uchar APM spsMarker[] = { "SPS" }; diff --git a/src/gruvin9x.h b/src/open9x.h similarity index 100% rename from src/gruvin9x.h rename to src/open9x.h diff --git a/src/pers.cpp b/src/pers.cpp index 2c54bcee7..c2fcad32e 100644 --- a/src/pers.cpp +++ b/src/pers.cpp @@ -19,7 +19,7 @@ * */ -#include "gruvin9x.h" +#include "open9x.h" #include "templates.h" RlcFile theFile; //used for any file operation diff --git a/src/pulses.cpp b/src/pulses.cpp index 67c151f42..74a703cf7 100644 --- a/src/pulses.cpp +++ b/src/pulses.cpp @@ -19,7 +19,7 @@ * */ -#include "gruvin9x.h" +#include "open9x.h" #ifdef CTP1009 uint16_t pulses2MHz[50] = {0}; diff --git a/src/rtc.cpp b/src/rtc.cpp index 91e28daa6..527c6062d 100644 --- a/src/rtc.cpp +++ b/src/rtc.cpp @@ -22,7 +22,7 @@ /*--------------------------------------------------------------------------*/ /* RTC controls */ -#include "gruvin9x.h" +#include "open9x.h" #if defined (PCBV4) #define SCL_LOW() DDRD |= 0x01 /* SCL = LOW */ diff --git a/src/simpgmspace.cpp b/src/simpgmspace.cpp index 28cbe3b96..6892765c8 100644 --- a/src/simpgmspace.cpp +++ b/src/simpgmspace.cpp @@ -22,7 +22,7 @@ #include #include "simpgmspace.h" #include "lcd.h" -#include "gruvin9x.h" +#include "open9x.h" #include "menus.h" volatile uint8_t pinb=0, pinc=0xff, pind, pine=0xff, ping=0xff, pinh=0xff, pinj=0xff, pinl=0; diff --git a/src/simu.cpp b/src/simu.cpp index f26e78ff9..64ed105e8 100644 --- a/src/simu.cpp +++ b/src/simu.cpp @@ -25,7 +25,7 @@ #include #include "simpgmspace.h" #include "fxkeys.h" -#include "gruvin9x.h" +#include "open9x.h" #include "menus.h" #include #include diff --git a/src/stamp.cpp b/src/stamp.cpp index 6ab1a2df1..b3f0d9fcc 100644 --- a/src/stamp.cpp +++ b/src/stamp.cpp @@ -1,5 +1,5 @@ -#include "gruvin9x.h" -#include "stamp-gruvin9x.h" +#include "open9x.h" +#include "stamp-open9x.h" #define STR2(s) #s #define DEFNUMSTR(s) STR2(s) diff --git a/src/templates.cpp b/src/templates.cpp index 3abd10138..47fb238de 100644 --- a/src/templates.cpp +++ b/src/templates.cpp @@ -46,7 +46,7 @@ * */ -#include "gruvin9x.h" +#include "open9x.h" #include "templates.h" const char stn1[] APM = "Simple 4-CH"; diff --git a/util/parse.py b/util/parse.py new file mode 100644 index 000000000..243c77bc8 --- /dev/null +++ b/util/parse.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +import sys + +filename = sys.argv[1] +print filename +fr = file(filename) +fw = file(filename+".new", "w") +ew = file(filename+".en", "w") +hw = file(filename+".stringsh", "w") +cw = file(filename+".stringsc", "w") + +replacements = {} + +for line in fr.readlines(): + pos_pstr = line.find("PSTR(\"") + MENU = False + if pos_pstr < 0: + pos_pstr = line.find("MENU(\"") + MENU = True + while pos_pstr >= 0: + # print line, + if MENU: + pos_endparenthesis = line.find('"', pos_pstr+7) + else: + pos_endparenthesis = line.find("\")", pos_pstr) + str = line[pos_pstr+6:pos_endparenthesis] + + str_rep = "STR_"+str.upper() + for s in (" ", ".", "[", "]", "-", "!", "/", ")", "(", "%", "+", ":"): + str_rep = str_rep.replace(s, "") + + if "14" in str or "32" in str or "@" in str or len(str_rep) <= 5: + pos_pstr = -1 + else: + if MENU: + glob_str = line[pos_pstr+5:pos_endparenthesis+1] + str_rep = "STR_MENU"+str.upper() + else: + glob_str = line[pos_pstr:pos_endparenthesis+2] + str_rep = "STR_"+str.upper() + for s in (" ", ".", "[", "]", "-", "!", "/", ")", "(", "%", "+", ":"): + str_rep = str_rep.replace(s, "") + + line = line.replace(glob_str, str_rep) + + if str_rep in replacements.keys(): + if replacements[str_rep] != str: + print "!!!!! NON !!!!!" + else: + replacements[str_rep] = str + print glob_str, "=>", str, str_rep + ew.write("#define " + str_rep[1:] + " "*(17-len(str_rep)) + '"%s"\n' % str) + hw.write("extern const PROGMEM char %s[];\n" % str_rep) + cw.write("const prog_char APM %s[] = %s;\n" % (str_rep, str_rep[1:])) + + pos_pstr = line.find("PSTR(\"") + + fw.write(line) + +fw.close() +ew.close() +hw.close() +cw.close() +