]> Nishi Git Mirror - gwion.git/commitdiff
:fire: help => scripts
authorfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 4 Oct 2019 11:28:58 +0000 (13:28 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 4 Oct 2019 11:28:58 +0000 (13:28 +0200)
13 files changed:
docs.mk
scripts/afl-dict/keyword.dict [moved from help/afl-dict/keyword.dict with 100% similarity]
scripts/afl-dict/sum [moved from help/afl-dict/sum with 100% similarity]
scripts/afl-dict/symbol.dict [moved from help/afl-dict/symbol.dict with 100% similarity]
scripts/afl.sh [moved from help/afl.sh with 100% similarity]
scripts/doc-config.sh [moved from help/doc-config.sh with 100% similarity]
scripts/gwion-pkg [new file with mode: 0644]
scripts/opcode.sh [moved from help/opcode.sh with 100% similarity]
scripts/struct_check.sh [moved from help/struct_check.sh with 100% similarity]
scripts/supp [moved from help/supp with 100% similarity]
scripts/test.sh [moved from help/test.sh with 99% similarity]
tests/sh/plugin.sh
tests/sh/test.sh

diff --git a/docs.mk b/docs.mk
index 6461e16643fa50fbeb6ced3d5d0d1865443267c5..0bd17945f0a1437afd4e9917900c0b8691eed0ed 100644 (file)
--- a/docs.mk
+++ b/docs.mk
@@ -6,7 +6,7 @@ include docs/config.mk
 mdr_list = $(filter-out docs/09_Benchmarks.mdr, $(shell find docs -type f -name "*.mdr"))
 md_list  = $(mdr_list:.mdr=.md)
 
-_docserver_config       = bash help/doc-config.sh > mkdocs.yml
+_docserver_config       = bash scripts/doc-config.sh > mkdocs.yml
 _docserver_serve = $(call _docserver_config); $(DOCTOOL) -q serve
 _docserver_launch = $(call _docserver_serve)& echo $$! > .server_pid
 _docserver_kill   = [ -f .server_pid ] && (kill $$(cat .server_pid); rm .server_pid) || true
similarity index 100%
rename from help/afl-dict/sum
rename to scripts/afl-dict/sum
similarity index 100%
rename from help/afl.sh
rename to scripts/afl.sh
similarity index 100%
rename from help/doc-config.sh
rename to scripts/doc-config.sh
diff --git a/scripts/gwion-pkg b/scripts/gwion-pkg
new file mode 100644 (file)
index 0000000..a803399
--- /dev/null
@@ -0,0 +1,71 @@
+: "${GWION_PLUG_PATH:=$PWD}"
+declare -A magic_variable=()
+
+read_manifest() {
+  name=$(basename $1 .manifest)
+  magic_variable[$name]=$((magic_variable[$name]))
+  [ -f $1 ] || return
+  while read LINE
+  do
+    [ "${LINE:0:1}" = "#" ] && continue
+    magic_variable[$LINE]=$((magic_variable[$LINE] + 1))
+    find_manifest $LINE.manifest
+  done < $1
+}
+
+find_manifest() {
+  for DIR in $GWION_PLUG_PATH
+  do
+    [ -f DIR/$1 ] || continue
+    read_manifest $1
+    return
+  done
+}
+
+install_plug() {
+  [ -d .gwion-pkg ] || mkdir .gwion-pkg
+  echo "installing $2 $3"
+  index=$(printf "%04i" $3)
+  [ -f .gwion-pkg/${index}_$(basename $1 .manifest).so ] && rm .gwion-pkg/${index}_$(basename $1 .manifest).so
+  ln $PLUG .gwion-pkg/${index}_$(basename $1 .manifest).so
+}
+
+install_manifest() {
+  for DIR in $GWION_PLUG_PATH
+  do
+    [ -d $DIR ] || continue
+    PLUG=$DIR/$(basename $1 .manifest).so
+    if [ -f $PLUG ]
+    then
+      install_plug "$1" "$PLUG" $2
+      return
+    fi
+  done
+}
+
+if [ "$1" = "list" ]
+then # clear
+  [ -d .gwion-pkg ] && ls .gwion-pkg | sort -u | cut -d_ -f 2
+elif [ "$1" = "run" ]
+then # run
+  shift
+  gwion -p .gwion-pkg $@
+elif [ "$1" = "clear" ]
+then rm -rf .gwion-pkg
+else
+for FILE in *.manifest
+do read_manifest $FILE
+done
+
+MAX=0
+for i in "${!magic_variable[@]}"
+do [ "${magic_variable[$i]}" -gt "$MAX" ] && MAX="${magic_variable[$i]}"
+done
+
+
+for i in "${!magic_variable[@]}"
+do
+  install_manifest "$i" $(( MAX - ${magic_variable[$i]}))
+done
+fi
+
similarity index 100%
rename from help/opcode.sh
rename to scripts/opcode.sh
similarity index 100%
rename from help/struct_check.sh
rename to scripts/struct_check.sh
similarity index 100%
rename from help/supp
rename to scripts/supp
similarity index 99%
rename from help/test.sh
rename to scripts/test.sh
index cfb2ad0880af165f0fcdaabd3bd106713fda77b0..c996e29c68f385085e3471394f117d8b74f7d9eb 100644 (file)
@@ -184,7 +184,7 @@ test_gw(){
   if [ "$VALGRIND" == "NO_VALGRIND" ]
   then LANG=C ./"$PRG" "$GWOPT" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |:
   else
-    LANG=C "$VALGRIND" --suppressions=help/supp --log-file="$vlog" \
+    LANG=C "$VALGRIND" --suppressions=scripts/supp --log-file="$vlog" \
     ./"$PRG" "$GWOPT" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |:
   fi
   ret=$?
index 55b0d43a00133df8799329b50ec79064082fc8e0..93616113d65c0ede1cbbeddde29c509d227233a4 100644 (file)
@@ -14,7 +14,7 @@ export GWION_ADD_DIR
 test_plugin() {
        export NAME=$"$1"
        export PRG=$"../../gwion"
-       export SUPP=$"../../help/supp"
+       export SUPP=$"../../scripts/supp"
        make
   if [ -f "$NAME.gw" ]
   then  GWOPT+=-p. test_gw "$NAME.gw" "$n"
index 353e7b6d56c2b33b7763f0dcf70bf16a4a12a0d5..98d4e7645e7ce4535e49260cf6535a3167cfb237 100644 (file)
@@ -15,7 +15,7 @@
 
 : "${DRIVER:=dummy}"
 : "${MODULE:=dummy}"
-: "${SUPP:=help/supp}"
+: "${SUPP:=scripts/supp}"
 
 : "${ASYNC:=4}"
 : "${async:=$ASYNC}"