[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] Englische Übersetzung für build



Signed-off-by: Patrick Pokatilo <shyxormz@xxxxxxxxxx>
---
 src/modules/c/build/Makefile.all       |    2 +-
 src/modules/c/build/build.c            |   18 +++++--
 src/modules/c/build/dir.c              |    7 ++-
 src/modules/c/build/lang/Makefile.conf |    1 +
 src/modules/c/build/lang/lang_en.c     |   82 ++++++++++++++++++++++++++++++++
 src/modules/c/build/lang/resstr.h      |   46 ++++++++++++++++++
 src/modules/c/build/main.c             |   13 +++--
 7 files changed, 155 insertions(+), 14 deletions(-)
 create mode 100644 src/modules/c/build/lang/Makefile.conf
 create mode 100644 src/modules/c/build/lang/lang_en.c
 create mode 100644 src/modules/c/build/lang/resstr.h

diff --git a/src/modules/c/build/Makefile.all b/src/modules/c/build/Makefile.all
index 9c2a821..8cf0dd7 100644
--- a/src/modules/c/build/Makefile.all
+++ b/src/modules/c/build/Makefile.all
@@ -3,5 +3,5 @@ source $LOST_BUILDMK_ROOT/config.sh
 
 echo "LD   $1/apps/build"
 
-$LOST_TOOLS_LD -obuild $LDSCRIPT *.o --start-group $2 --end-group
+$LOST_TOOLS_LD -obuild $LDSCRIPT *.o lang/*.o --start-group $2 --end-group
 $LOST_TOOLS_STRIP -s build -o $1/apps/build
diff --git a/src/modules/c/build/build.c b/src/modules/c/build/build.c
index 9c340f0..cbc00e3 100644
--- a/src/modules/c/build/build.c
+++ b/src/modules/c/build/build.c
@@ -41,6 +41,9 @@
 
 #include "build.h"
 
+#define TMS_MODULE build
+#include <tms.h>
+
 #ifdef __LINUX__
 static const char* cflags = "-m32 -g -O0 -Wall -fno-stack-protector -nostdinc"
     " -fno-leading-underscore -fno-omit-frame-pointer -fno-strict-aliasing"
@@ -230,19 +233,22 @@ static void do_build(struct build_dir* dir, const char* parent_include,
     // Und schliesslich noch die einzelnen Dateien
     // TODO Pruefen, ob sich Abhaengigkeiten veraendert haben
     if (!dont_compile) {
-        printf("%s: Kompilieren (C)...", dir->path);
+        printf(TMS(compile_c, "%s: Kompilieren (C)..."), dir->path);
         fflush(stdout);
         compile(dir->path, dir->src_files[LANG_C], c_compiler, cflags, include);
 
-        printf("\r%s: Kompilieren (Pascal)...\033[K", dir->path);
+        printf(TMS(compile_pascal, "\r%s: Kompilieren (Pascal)...\033[K"),
+            dir->path);
         fflush(stdout);
         compile(dir->path, dir->src_files[LANG_PAS], "fpc", fpcflags, include);
 
-        printf("\r%s: Assemblieren (gas)...\033[K", dir->path);
+        printf(TMS(assemble_gas, "\r%s: Assemblieren (gas)...\033[K"),
+            dir->path);
         fflush(stdout);
         compile(dir->path, dir->src_files[LANG_ASM_GAS], "gcc", gasflags, include);
 
-        printf("\r%s: Assemblieren (yasm)...\033[K", dir->path);
+        printf(TMS(assemble_yasm, "\r%s: Assemblieren (yasm)...\033[K"),
+            dir->path);
         fflush(stdout);
         for (i = 0; (file = list_get_element_at(dir->src_files[LANG_ASM_NASM], i)); i++) {
             do_command(dir->path, "yasm", "%s %s", nasmflags, file->name);
@@ -251,7 +257,7 @@ static void do_build(struct build_dir* dir, const char* parent_include,
 
     // Im Wurzelverzeichnis wird gelinkt (TODO einstellbar machen)
     if (dir->parent == NULL) {
-        printf("\r%s: Linken...\033[K", dir->path);
+        printf(TMS(link, "\r%s: Linken...\033[K"), dir->path);
         fflush(stdout);
 
         objs = get_obj_files(dir->path);
@@ -289,6 +295,6 @@ void build(struct build_dir* root)
     }
     root_path = getcwd(NULL, 0);
     do_build(root, "", "", 0);
-    printf("Fertig gebaut.\n");
+    printf(TMS(done, "Fertig gebaut.\n"));
     free(root_path);
 }
diff --git a/src/modules/c/build/dir.c b/src/modules/c/build/dir.c
index b77c467..fbe790c 100644
--- a/src/modules/c/build/dir.c
+++ b/src/modules/c/build/dir.c
@@ -41,6 +41,9 @@
 
 #include "build.h"
 
+#define TMS_MODULE dir
+#include <tms.h>
+
 /**
  * Durchsucht ein Verzeichnis und speichert alle fuer das Bauen noetige
  * Informationen in dynamisch allozierten Datenstrukturen, die vom Aufrufer
@@ -70,8 +73,8 @@ struct build_dir* scan_directory(struct build_dir* parent, const char* path)
     int ignorenobuild = 0;
 
     if (dir == NULL) {
-        fprintf(stderr, "Verzeichnis %s kann nicht geoeffnet werden.\n",
-            path);
+        fprintf(stderr, TMS(not_open, "Verzeichnis %s kann nicht geoeffnet"
+            "werden.\n"), path);
         return NULL;
     }
 
diff --git a/src/modules/c/build/lang/Makefile.conf b/src/modules/c/build/lang/Makefile.conf
new file mode 100644
index 0000000..594ef2a
--- /dev/null
+++ b/src/modules/c/build/lang/Makefile.conf
@@ -0,0 +1 @@
+CC_FLAGS_APPEND="-Wno-missing-braces"
diff --git a/src/modules/c/build/lang/lang_en.c b/src/modules/c/build/lang/lang_en.c
new file mode 100644
index 0000000..33935a3
--- /dev/null
+++ b/src/modules/c/build/lang/lang_en.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2011 The tyndur Project. All rights reserved.
+ *
+ * This code is derived from software contributed to the tyndur Project
+ * by Patrick Pokatilo.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <tms.h>
+#include "resstr.h"
+
+static int get_number(int n)
+{
+    return (n == 1 ? 0 : 1);
+}
+
+static const struct tms_strings dict[] = {
+    &__tms_build_compile_c,
+    "%s: compiling (C)...",
+
+    &__tms_build_compile_pascal,
+    "\r%s: compiling (pascal)...\033[K",
+
+    &__tms_build_assemble_gas,
+    "\r%s: assembling (gas)...\033[K",
+
+    &__tms_build_assemble_yasm,
+    "\r%s: assembling (yasm)...\033[K",
+
+    &__tms_build_link,
+    "\r%s: linking...\033[K",
+
+    &__tms_build_done,
+    "Build complete.\n",
+    
+    &__tms_dir_not_open,
+    "Can't open directory '%s'.\n",
+
+    &__tms_main_usage,
+    "Usage: %s [-k] [-nc] [-v] [--dry-run] [<root directory>]\n",
+
+    &__tms_main_dir_not_found,
+    "Directory not found\n",
+
+    &__tms_main_dir_not_found_again,
+    "Directory not found\n",
+
+    &__tms_main_runtime,
+    "Runtime: %lld sec. %lld msec.\n",
+
+    0,
+    0,
+};
+
+static const struct tms_lang lang = {
+    .lang = "en",
+    .numbers = 2,
+    .get_number = get_number,
+    .strings = dict,
+};
+
+LANGUAGE(&lang)
diff --git a/src/modules/c/build/lang/resstr.h b/src/modules/c/build/lang/resstr.h
new file mode 100644
index 0000000..7fd6752
--- /dev/null
+++ b/src/modules/c/build/lang/resstr.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011 The tyndur Project. All rights reserved.
+ *
+ * This code is derived from software contributed to the tyndur Project
+ * by Patrick Pokatilo.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL;
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO;
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY;
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RESSTR_H
+#define RESSTR_H
+
+extern void* __tms_build_compile_c;
+extern void* __tms_build_compile_pascal;
+extern void* __tms_build_assemble_gas;
+extern void* __tms_build_assemble_yasm;
+extern void* __tms_build_link;
+extern void* __tms_build_done;
+
+extern void* __tms_dir_not_open;
+
+extern void* __tms_main_usage;
+extern void* __tms_main_dir_not_found;
+extern void* __tms_main_dir_not_found_again;
+extern void* __tms_main_runtime;
+
+#endif
diff --git a/src/modules/c/build/main.c b/src/modules/c/build/main.c
index 8997abe..bcd6920 100644
--- a/src/modules/c/build/main.c
+++ b/src/modules/c/build/main.c
@@ -41,6 +41,9 @@
 
 #include "build.h"
 
+#define TMS_MODULE main
+#include <tms.h>
+
 /**
  * Legt Kuerzel fuer Dateitypen fest, die fuer die Anzeige benutzt werden
  * koennen, waehrend die Datei verarbeitet wird
@@ -79,8 +82,8 @@ int standalone = 0;
 
 static void usage(char* binary)
 {
-    fprintf(stderr, "Aufruf: %s [-k] [-nc] [-v] [--dry-run] [<Wurzelverzeichnis>]\n",
-        binary);
+    fprintf(stderr, TMS(usage, "Aufruf: %s [-k] [-nc] [-v] [--dry-run] "
+        "[<Wurzelverzeichnis>]\n"), binary);
     exit(1);
 }
 
@@ -117,7 +120,7 @@ int main(int argc, char** argv)
     // Ins Wurzelverzeichnis des Projekts wechseln
     if (rootdir_path) {
         if (chdir(argv[i])) {
-            fprintf(stderr, "Verzeichnis nicht gefunden\n");
+            fprintf(stderr, TMS(dir_not_found, "Verzeichnis nicht gefunden\n"));
             return 1;
         }
     }
@@ -125,7 +128,7 @@ int main(int argc, char** argv)
     // Alle zu kompilierenden Dateien, Includeverzeichnisse usw. erfassen
     rootdir = scan_directory(NULL, ".");
     if (rootdir == NULL) {
-        fprintf(stderr, "Verzeichnis nicht gefunden\n");
+        fprintf(stderr, TMS(dir_not_found_again, "Verzeichnis nicht gefunden\n"));
         return 1;
     }
 
@@ -138,6 +141,6 @@ int main(int argc, char** argv)
     msecs = (get_tick_count() - start_time) / 1000;
     secs = msecs / 1000;
     msecs -= secs * 1000;
-    printf("Laufzeit: %lld Sec. %lld Msec.\n", secs, msecs);
+    printf(TMS(runtime, "Laufzeit: %lld Sec. %lld Msec.\n"), secs, msecs);
     return 0;
 }
-- 
1.7.0.4