Merge: Relocate examples
authorJean Privat <jean@pryen.org>
Fri, 28 Aug 2015 13:11:06 +0000 (09:11 -0400)
committerJean Privat <jean@pryen.org>
Fri, 28 Aug 2015 13:11:06 +0000 (09:11 -0400)
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 <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

29 files changed:
examples/languages/langannot.pot [deleted file]
lib/emscripten/emscripten.nit [moved from lib/emscripten.nit with 100% similarity]
lib/emscripten/examples/README.md [moved from examples/emscripten/README.md with 100% similarity]
lib/emscripten/examples/fibonacci/Makefile [moved from examples/emscripten/fibonacci/Makefile with 100% similarity]
lib/emscripten/examples/fibonacci/www/index.html [moved from examples/emscripten/fibonacci/www/index.html with 96% similarity]
lib/emscripten/examples/hello_world/Makefile [moved from examples/emscripten/hello_world/Makefile with 100% similarity]
lib/emscripten/examples/hello_world/www/index.html [moved from examples/emscripten/hello_world/www/index.html with 97% similarity]
lib/gettext/examples/.gitignore [new file with mode: 0644]
lib/gettext/examples/langannot.nit [moved from examples/langannot.nit with 100% similarity]
lib/gettext/examples/languages/en/LC_MESSAGES/langannot.po [moved from examples/languages/en/LC_MESSAGES/langannot.po with 100% similarity]
lib/gettext/examples/languages/fr/LC_MESSAGES/langannot.po [moved from examples/languages/fr/LC_MESSAGES/langannot.po with 100% similarity]
lib/gettext/examples/languages/ja/LC_MESSAGES/langannot.po [moved from examples/languages/ja/LC_MESSAGES/langannot.po with 100% similarity]
lib/gettext/gettext.nit [moved from lib/gettext.nit with 100% similarity]
lib/mpi/examples/Makefile [moved from examples/mpi/Makefile with 100% similarity]
lib/mpi/examples/README.md [moved from examples/mpi/README.md with 100% similarity]
lib/mpi/examples/hosts.example [moved from examples/mpi/hosts.example with 100% similarity]
lib/mpi/examples/src/mpi_simple.nit [moved from examples/mpi/src/mpi_simple.nit with 100% similarity]
lib/mpi/mpi.nit [moved from lib/mpi.nit with 100% similarity]
lib/pnacl/examples/converter/Makefile [moved from examples/pnacl/converter/Makefile with 93% similarity]
lib/pnacl/examples/converter/README.md [moved from examples/pnacl/converter/README.md with 100% similarity]
lib/pnacl/examples/converter/converter.nit [moved from examples/pnacl/converter/converter.nit with 100% similarity]
lib/pnacl/examples/converter/converter/index.html [moved from examples/pnacl/converter/converter/index.html with 89% similarity]
lib/pnacl/examples/converter/converter/js/functions.js [moved from examples/pnacl/converter/converter/js/functions.js with 66% similarity]
lib/pnacl/examples/converter/converter/js/pnacl_js.js [moved from examples/pnacl/converter/converter/js/pnacl_js.js with 100% similarity]
lib/pnacl/pnacl.nit [moved from lib/pnacl.nit with 99% similarity]
tests/Darwin.skip
tests/listfull.sh
tests/niti.skip
tests/nitvm.skip

diff --git a/examples/languages/langannot.pot b/examples/languages/langannot.pot
deleted file mode 100644 (file)
index 9c86286..0000000
+++ /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
@@ -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.
 -->
 <html>
 <head>
@@ -46,7 +46,7 @@
                        var input = $("#in").val();
 
                        // Invoke the full Nit program
-               ret = Module['callMain']([input]);
+                       ret = Module['callMain']([input]);
                }
        </script>
 </head>
@@ -65,7 +65,7 @@
 
        <h2>Program Output</h2>
        <samp id="console"></samp>
-       
+
        <script src="fibonacci.js"></script>
 </div>
 
@@ -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.
 -->
 <html>
 <head>
@@ -41,7 +41,7 @@
 
        <h1>Program output</h1>
        <samp id="console"></samp>
-       
+
        <script src="hello_world.js"></script>
 
 </body>
diff --git a/lib/gettext/examples/.gitignore b/lib/gettext/examples/.gitignore
new file mode 100644 (file)
index 0000000..a05dd58
--- /dev/null
@@ -0,0 +1 @@
+langannot.pot
similarity index 100%
rename from lib/gettext.nit
rename to lib/gettext/gettext.nit
similarity index 100%
rename from lib/mpi.nit
rename to lib/mpi/mpi.nit
similarity index 93%
rename from examples/pnacl/converter/Makefile
rename to lib/pnacl/examples/converter/Makefile
index 1ef5995..8c9dbd7 100644 (file)
@@ -1,4 +1,4 @@
-default: 
+default:
        ../../../bin/nitc --semi-global converter.nit
 
 HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py
@@ -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.
 -->
 <!DOCTYPE html>
 <html>
          <div class="form-group">
            <label for="inputConvert" class="col-sm-2 control-label">Convert</label>
            <div class="col-sm-9">
-               <div class="row">
+               <div class="row">
                  <div id="pre-input" class="col-xs-2">
                    <input id="input" type="text" class="form-control" placeholder="ex: 300" required>
                  </div>
                  <div class="col-xs-3">
                    <select id="from" class="form-control" required>
-                         <option selected="selected" disabled="disabled">Currency</option>
+                         <option selected="selected" disabled="disabled">Currency</option>
                          <option>EUR</option>
                          <option>CAD</option>
                          <option>USD</option>
          <div class="form-group">
            <label for="inputTo" class="col-sm-2 control-label">to</label>
            <div class="col-sm-9">
-                   <div class="row">
+                   <div class="row">
                          <div class="col-xs-2">
                            <input id="rez" type="text" class="form-control" placeholder=".col-xs-2" disabled="disabled" style="visibility: hidden">
                          </div>
                          <div class="col-xs-3">
                            <select id="to" class="form-control" required>
-                               <option selected="selected" disabled="disabled">Currency</option>
-                               <option>EUR</option>
-                               <option>CAD</option>
-                               <option>USD</option>
-                           </select>
+                               <option selected="selected" disabled="disabled">Currency</option>
+                               <option>EUR</option>
+                               <option>CAD</option>
+                               <option>USD</option>
+                           </select>
                          </div>
                        </div>
                    </div>
 // 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);
        }
-  }
 });
similarity index 99%
rename from lib/pnacl.nit
rename to lib/pnacl/pnacl.nit
index 9483d1a..6d41120 100644 (file)
@@ -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
index c762a8f..ed2a3e1 100644 (file)
@@ -6,3 +6,4 @@ neo
 cocoa
 mpi
 emscripten
+ui_test
index 6dafd08..661ac30 100755 (executable)
@@ -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 \
index ad78ced..3e10daa 100644 (file)
@@ -30,3 +30,4 @@ first_letter_last_letter
 fibonacci_word
 shootout_nsieve
 test_ropebuffer
+ui_test
index ad78ced..3e10daa 100644 (file)
@@ -30,3 +30,4 @@ first_letter_last_letter
 fibonacci_word
 shootout_nsieve
 test_ropebuffer
+ui_test