From: Jean Privat Date: Fri, 28 Aug 2015 13:11:06 +0000 (-0400) Subject: Merge: Relocate examples X-Git-Tag: v0.7.8~65 X-Git-Url: http://nitlanguage.org?hp=1d2db0bb835a500560b25033bdfbf7ce8e1b9c57 Merge: Relocate examples Some short programs in `examples` are related to specific libraries. Therefore to improve coupling and cohesion, these examples are moved into a subdirectory of their associated libs. Basically, it means moving `examples/foo` into `lib/foo/examples` Pull-Request: #1656 Reviewed-by: Alexis Laferrière Reviewed-by: Lucas Bajolet --- diff --git a/examples/languages/langannot.pot b/examples/languages/langannot.pot deleted file mode 100644 index 9c86286..0000000 --- a/examples/languages/langannot.pot +++ /dev/null @@ -1,17 +0,0 @@ -#: langannot::langannot 22--10:32, langannot::langannot 29--7:29 -msgid "This String is a test" -msgstr "" - -#: langannot::langannot 31--7:3 -msgid "Multiline string\n\nexample\n\n\nof the language annotation capacities\n" -msgstr "" - -#: langannot::langannot 39--9:17 -msgid "example" -msgstr "" - -#: langannot::langannot 41--7:34, langannot::langannot 43--7:33 -msgid "This superstring %1 rocks" -msgstr "" - -# Generated file, do not modify diff --git a/lib/emscripten.nit b/lib/emscripten/emscripten.nit similarity index 100% rename from lib/emscripten.nit rename to lib/emscripten/emscripten.nit diff --git a/examples/emscripten/README.md b/lib/emscripten/examples/README.md similarity index 100% rename from examples/emscripten/README.md rename to lib/emscripten/examples/README.md diff --git a/examples/emscripten/fibonacci/Makefile b/lib/emscripten/examples/fibonacci/Makefile similarity index 100% rename from examples/emscripten/fibonacci/Makefile rename to lib/emscripten/examples/fibonacci/Makefile diff --git a/examples/emscripten/fibonacci/www/index.html b/lib/emscripten/examples/fibonacci/www/index.html similarity index 96% rename from examples/emscripten/fibonacci/www/index.html rename to lib/emscripten/examples/fibonacci/www/index.html index a632465..6cb297c 100644 --- a/examples/emscripten/fibonacci/www/index.html +++ b/lib/emscripten/examples/fibonacci/www/index.html @@ -13,7 +13,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. --> @@ -46,7 +46,7 @@ var input = $("#in").val(); // Invoke the full Nit program - ret = Module['callMain']([input]); + ret = Module['callMain']([input]); } @@ -65,7 +65,7 @@

Program Output

- + diff --git a/examples/emscripten/hello_world/Makefile b/lib/emscripten/examples/hello_world/Makefile similarity index 100% rename from examples/emscripten/hello_world/Makefile rename to lib/emscripten/examples/hello_world/Makefile diff --git a/examples/emscripten/hello_world/www/index.html b/lib/emscripten/examples/hello_world/www/index.html similarity index 97% rename from examples/emscripten/hello_world/www/index.html rename to lib/emscripten/examples/hello_world/www/index.html index 0820561..2547945 100644 --- a/examples/emscripten/hello_world/www/index.html +++ b/lib/emscripten/examples/hello_world/www/index.html @@ -13,7 +13,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. --> @@ -41,7 +41,7 @@

Program output

- + diff --git a/lib/gettext/examples/.gitignore b/lib/gettext/examples/.gitignore new file mode 100644 index 0000000..a05dd58 --- /dev/null +++ b/lib/gettext/examples/.gitignore @@ -0,0 +1 @@ +langannot.pot diff --git a/examples/langannot.nit b/lib/gettext/examples/langannot.nit similarity index 100% rename from examples/langannot.nit rename to lib/gettext/examples/langannot.nit diff --git a/examples/languages/en/LC_MESSAGES/langannot.po b/lib/gettext/examples/languages/en/LC_MESSAGES/langannot.po similarity index 100% rename from examples/languages/en/LC_MESSAGES/langannot.po rename to lib/gettext/examples/languages/en/LC_MESSAGES/langannot.po diff --git a/examples/languages/fr/LC_MESSAGES/langannot.po b/lib/gettext/examples/languages/fr/LC_MESSAGES/langannot.po similarity index 100% rename from examples/languages/fr/LC_MESSAGES/langannot.po rename to lib/gettext/examples/languages/fr/LC_MESSAGES/langannot.po diff --git a/examples/languages/ja/LC_MESSAGES/langannot.po b/lib/gettext/examples/languages/ja/LC_MESSAGES/langannot.po similarity index 100% rename from examples/languages/ja/LC_MESSAGES/langannot.po rename to lib/gettext/examples/languages/ja/LC_MESSAGES/langannot.po diff --git a/lib/gettext.nit b/lib/gettext/gettext.nit similarity index 100% rename from lib/gettext.nit rename to lib/gettext/gettext.nit diff --git a/examples/mpi/Makefile b/lib/mpi/examples/Makefile similarity index 100% rename from examples/mpi/Makefile rename to lib/mpi/examples/Makefile diff --git a/examples/mpi/README.md b/lib/mpi/examples/README.md similarity index 100% rename from examples/mpi/README.md rename to lib/mpi/examples/README.md diff --git a/examples/mpi/hosts.example b/lib/mpi/examples/hosts.example similarity index 100% rename from examples/mpi/hosts.example rename to lib/mpi/examples/hosts.example diff --git a/examples/mpi/src/mpi_simple.nit b/lib/mpi/examples/src/mpi_simple.nit similarity index 100% rename from examples/mpi/src/mpi_simple.nit rename to lib/mpi/examples/src/mpi_simple.nit diff --git a/lib/mpi.nit b/lib/mpi/mpi.nit similarity index 100% rename from lib/mpi.nit rename to lib/mpi/mpi.nit diff --git a/examples/pnacl/converter/Makefile b/lib/pnacl/examples/converter/Makefile similarity index 93% rename from examples/pnacl/converter/Makefile rename to lib/pnacl/examples/converter/Makefile index 1ef5995..8c9dbd7 100644 --- a/examples/pnacl/converter/Makefile +++ b/lib/pnacl/examples/converter/Makefile @@ -1,4 +1,4 @@ -default: +default: ../../../bin/nitc --semi-global converter.nit HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py diff --git a/examples/pnacl/converter/README.md b/lib/pnacl/examples/converter/README.md similarity index 100% rename from examples/pnacl/converter/README.md rename to lib/pnacl/examples/converter/README.md diff --git a/examples/pnacl/converter/converter.nit b/lib/pnacl/examples/converter/converter.nit similarity index 100% rename from examples/pnacl/converter/converter.nit rename to lib/pnacl/examples/converter/converter.nit diff --git a/examples/pnacl/converter/converter/index.html b/lib/pnacl/examples/converter/converter/index.html similarity index 89% rename from examples/pnacl/converter/converter/index.html rename to lib/pnacl/examples/converter/converter/index.html index 539e4a9..4143033 100644 --- a/examples/pnacl/converter/converter/index.html +++ b/lib/pnacl/examples/converter/converter/index.html @@ -12,7 +12,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. --> @@ -27,13 +27,13 @@
-
+
+ + + + +
diff --git a/examples/pnacl/converter/converter/js/functions.js b/lib/pnacl/examples/converter/converter/js/functions.js similarity index 66% rename from examples/pnacl/converter/converter/js/functions.js rename to lib/pnacl/examples/converter/converter/js/functions.js index 86f44a9..cd7f506 100644 --- a/examples/pnacl/converter/converter/js/functions.js +++ b/lib/pnacl/examples/converter/converter/js/functions.js @@ -17,19 +17,19 @@ // Checks that the text in the input is numeric and not null // and then if two currencies where chosen sends a dictionary to Nit. $( "#button" ).click(function() { - $("#pre-input").removeClass("has-error"); - if (($('#input').val() == "")||($.isNumeric($('#input').val()) == false)) { - $("#pre-input").addClass("has-error"); - } - else - { - if (($('#from').val() != null) && ($('#to').val() != null)) { - var dictionary = { - value: parseFloat($('#input').val()).toFixed(2), - from: $('#from').val(), - to: $('#to').val(), + $("#pre-input").removeClass("has-error"); + if (($('#input').val() == "")||($.isNumeric($('#input').val()) == false)) { + $("#pre-input").addClass("has-error"); + } + else + { + if (($('#from').val() != null) && ($('#to').val() != null)) { + var dictionary = { + value: parseFloat($('#input').val()).toFixed(2), + from: $('#from').val(), + to: $('#to').val(), + } + converterModule.postMessage(dictionary); } - converterModule.postMessage(dictionary); } - } }); diff --git a/examples/pnacl/converter/converter/js/pnacl_js.js b/lib/pnacl/examples/converter/converter/js/pnacl_js.js similarity index 100% rename from examples/pnacl/converter/converter/js/pnacl_js.js rename to lib/pnacl/examples/converter/converter/js/pnacl_js.js diff --git a/lib/pnacl.nit b/lib/pnacl/pnacl.nit similarity index 99% rename from lib/pnacl.nit rename to lib/pnacl/pnacl.nit index 9483d1a..6d41120 100644 --- a/lib/pnacl.nit +++ b/lib/pnacl/pnacl.nit @@ -283,7 +283,7 @@ in "C Header" `{ } static PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, PP_Resource pp_url_loader) { - // TODO + // TODO return PP_FALSE; } @@ -391,8 +391,8 @@ extern class PepperDictionary `{ struct PP_Var* `} var native_value = native_get(native_key) return native_value.to_nit end - - # Set function using PepperVars. + + # Set function using PepperVars. # # Sets the value associated with the specified key. # 'key' must be a String typed PepperVar. @@ -424,11 +424,11 @@ extern class PepperDictionary `{ struct PP_Var* `} fun native_delete(key: PepperVar) `{ g_varDictionaryInterface->Delete(*self, *key); `} - + # Deletes the specified key and its associated value, if the key exists. # # Takes a String. - fun delete(key: String) + fun delete(key: String) do var native_key = key.to_pepper native_delete native_key diff --git a/tests/Darwin.skip b/tests/Darwin.skip index c762a8f..ed2a3e1 100644 --- a/tests/Darwin.skip +++ b/tests/Darwin.skip @@ -6,3 +6,4 @@ neo cocoa mpi emscripten +ui_test diff --git a/tests/listfull.sh b/tests/listfull.sh index 6dafd08..661ac30 100755 --- a/tests/listfull.sh +++ b/tests/listfull.sh @@ -8,10 +8,9 @@ printf "%s\n" "$@" \ ../examples/*/src/*_android.nit \ ../examples/*/src/*_linux.nit \ ../examples/*/src/*_null.nit \ - ../examples/pnacl/converter/converter.nit \ ../examples/nitcorn/src/*.nit \ - ../examples/mpi/src/*.nit \ ../lib/*/examples/*.nit \ + ../lib/*/examples/*/*.nit \ ../contrib/friendz/src/solver_cmd.nit \ ../contrib/neo_doxygen/src/tests/neo_doxygen_*.nit \ ../contrib/pep8analysis/src/pep8analysis.nit \ diff --git a/tests/niti.skip b/tests/niti.skip index ad78ced..3e10daa 100644 --- a/tests/niti.skip +++ b/tests/niti.skip @@ -30,3 +30,4 @@ first_letter_last_letter fibonacci_word shootout_nsieve test_ropebuffer +ui_test diff --git a/tests/nitvm.skip b/tests/nitvm.skip index ad78ced..3e10daa 100644 --- a/tests/nitvm.skip +++ b/tests/nitvm.skip @@ -30,3 +30,4 @@ first_letter_last_letter fibonacci_word shootout_nsieve test_ropebuffer +ui_test