Permalink
Browse files

Updated generator shell script to create header and c file.

  • Loading branch information...
1 parent 545bdf8 commit 1df17ebd728b86f4e7b3862e6e7e2b729e6a45b5 @erichschroeter committed May 13, 2012
Showing with 16 additions and 4 deletions.
  1. +15 −4 res/json-to-H.sh
  2. +1 −0 src/elements.c
View
@@ -2,17 +2,28 @@
#
# Converts the JSON to a C header file to be used as a resource file.
-json() {
+json_h() {
cat << EOF
#ifndef ELEMENTS_H
#define ELEMENTS_H
-char* ELEMENTS_JSON =
-"$(cat elements.json | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/"\n"/g')";
+extern const char* ELEMENTS_JSON;
#endif
EOF
}
-json > ../src/elements.h
+
+json_c() {
+cat << EOF
+#include "elements.h"
+
+extern const char* ELEMENTS_JSON =
+"$(cat elements.json | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/"\n"/g')";
+
+EOF
+}
+
+json_h > ../src/elements.h
+json_c > ../src/elements.c
exit 0
View
@@ -947,3 +947,4 @@ extern const char* ELEMENTS_JSON =
" \"ionizationEnergy\" : \"NULL\""
" }"
"}";
+

0 comments on commit 1df17eb

Please sign in to comment.