[svn:parrot] r40311 - in trunk: . examples/embed

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Jul 28 19:35:42 UTC 2009


Author: NotFound
Date: Tue Jul 28 19:35:41 2009
New Revision: 40311
URL: https://trac.parrot.org/parrot/changeset/40311

Log:
[cage] rename example "lorito" to "cotorra"

Added:
   trunk/examples/embed/cotorra.c   (contents, props changed)
      - copied, changed from r40310, trunk/examples/embed/lorito.c
Deleted:
   trunk/examples/embed/lorito.c
Modified:
   trunk/MANIFEST
   trunk/examples/embed/Makefile
   trunk/examples/embed/Makefile.msvc

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Tue Jul 28 17:40:11 2009	(r40310)
+++ trunk/MANIFEST	Tue Jul 28 19:35:41 2009	(r40311)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Jul 24 04:46:26 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Tue Jul 28 19:34:41 2009 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -644,7 +644,7 @@
 examples/compilers/japhc.c                                  [examples]
 examples/embed/Makefile                                     [examples]
 examples/embed/Makefile.msvc                                [examples]
-examples/embed/lorito.c                                     [examples]
+examples/embed/cotorra.c                                    [examples]
 examples/io/http.pir                                        [examples]
 examples/io/httpd.pir                                       [examples]
 examples/japh/README                                        []doc

Modified: trunk/examples/embed/Makefile
==============================================================================
--- trunk/examples/embed/Makefile	Tue Jul 28 17:40:11 2009	(r40310)
+++ trunk/examples/embed/Makefile	Tue Jul 28 19:35:41 2009	(r40311)
@@ -21,17 +21,17 @@
 INCLUDEDIR = $(shell parrot_config prefix)/include
 CONFIG = $(shell parrot_config prefix)/src/parrot_config
 
-all: lorito$(EXE)
+all: cotorra$(EXE)
 
 #-----------------------------------------------------------------------
 
-lorito$(O): lorito.c
-	$(CC) $(CCFLAGS) -c -I $(INCLUDEDIR) lorito.c
+cotorra$(O): cotorra.c
+	$(CC) $(CCFLAGS) -c -I $(INCLUDEDIR) cotorra.c
 
-lorito$(EXE): lorito$(O)
-	$(LD) $(LD_OUT)lorito$(EXE) lorito$(O) $(CONFIG)$(O) $(LDFLAGS)
+cotorra$(EXE): cotorra$(O)
+	$(LD) $(LD_OUT)cotorra$(EXE) cotorra$(O) $(CONFIG)$(O) $(LDFLAGS)
 
 #-----------------------------------------------------------------------
 
 clean:
-	rm -f lorito$(EXE) lorito$(O)
+	rm -f cotorra$(EXE) cotorra$(O)

Modified: trunk/examples/embed/Makefile.msvc
==============================================================================
--- trunk/examples/embed/Makefile.msvc	Tue Jul 28 17:40:11 2009	(r40310)
+++ trunk/examples/embed/Makefile.msvc	Tue Jul 28 19:35:41 2009	(r40311)
@@ -17,17 +17,17 @@
 O 	= .obj
 EXE 	= .exe
 
-all: lorito$(EXE)
+all: cotorra$(EXE)
 
 #-----------------------------------------------------------------------
 
-lorito$(O): lorito.c
-	$(CC) $(CCFLAGS) -c -I $(INCLUDEDIR) lorito.c
+cotorra$(O): cotorra.c
+	$(CC) $(CCFLAGS) -c -I $(INCLUDEDIR) cotorra.c
 
-lorito$(EXE): lorito$(O)
-	$(LD) -out:lorito$(EXE) lorito$(O) $(LDFLAGS)
+cotorra$(EXE): cotorra$(O)
+	$(LD) -out:cotorra$(EXE) cotorra$(O) $(LDFLAGS)
 
 #-----------------------------------------------------------------------
 
 clean:
-	rm -f lorito$(EXE) lorito$(O)
+	rm -f cotorra$(EXE) cotorra$(O)

Copied and modified: trunk/examples/embed/cotorra.c (from r40310, trunk/examples/embed/lorito.c)
==============================================================================
--- trunk/examples/embed/lorito.c	Tue Jul 28 17:40:11 2009	(r40310, copy source)
+++ trunk/examples/embed/cotorra.c	Tue Jul 28 19:35:41 2009	(r40311)
@@ -3,7 +3,6 @@
 $Id$
 
 A parrot embedding test
-'lorito' is 'little parrot' in spanish
 */
 
 
@@ -21,7 +20,7 @@
 Parrot_Run_core_t getruncore(const char *name);
 
 Parrot_String create_string(Parrot_Interp interp, const char *name);
-int lorito_main(Parrot_Interp interp, int argc, char **argv);
+int cotorra_main(Parrot_Interp interp, int argc, char **argv);
 
 /**********************************************************************/
 
@@ -29,7 +28,7 @@
 
 void fail(const char *msg)
 {
-    fprintf(stderr, "lorito failed: %s\n", msg);
+    fprintf(stderr, "cotorra failed: %s\n", msg);
     exit(EXIT_FAILURE);
 }
 
@@ -79,7 +78,7 @@
 
 /**********************************************************************/
 
-int lorito_main(Parrot_Interp interp, int argc, char **argv)
+int cotorra_main(Parrot_Interp interp, int argc, char **argv)
 {
     char *source;
     Parrot_PackFile pf;
@@ -170,7 +169,7 @@
 
     Parrot_set_executable_name(interp, create_string(interp, argv[0]));
 
-    r = lorito_main(interp, argc, argv);
+    r = cotorra_main(interp, argc, argv);
 
     Parrot_destroy(interp);
     return r;

Deleted: trunk/examples/embed/lorito.c
==============================================================================
--- trunk/examples/embed/lorito.c	Tue Jul 28 19:35:41 2009	(r40310)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,184 +0,0 @@
-/*
-Copyright (C) 2009, Parrot Foundation.
-$Id$
-
-A parrot embedding test
-'lorito' is 'little parrot' in spanish
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "parrot/embed.h"
-#include "parrot/extend.h"
-
-/**********************************************************************/
-
-void fail(const char *msg);
-unsigned int getuintval(const char *s);
-Parrot_Run_core_t getruncore(const char *name);
-
-Parrot_String create_string(Parrot_Interp interp, const char *name);
-int lorito_main(Parrot_Interp interp, int argc, char **argv);
-
-/**********************************************************************/
-
-/* Auxiliary generic functions */
-
-void fail(const char *msg)
-{
-    fprintf(stderr, "lorito failed: %s\n", msg);
-    exit(EXIT_FAILURE);
-}
-
-unsigned int getuintval(const char *s)
-{
-    char *aux;
-    unsigned long int n = strtoul(s, &aux, 0);
-    if (*aux != '\0')
-        fail("Invalid number");
-    return n;
-}
-
-struct runcoreinfo {
-    Parrot_Run_core_t id;
-    const char *name;
-};
-
-Parrot_Run_core_t getruncore(const char *name)
-{
-    static const struct runcoreinfo cores [] = {
-        { PARROT_SLOW_CORE,     "slow" },
-        { PARROT_FAST_CORE,     "fast" },
-        { PARROT_CGOTO_CORE,    "cgoto" },
-        { PARROT_JIT_CORE,      "jit" },
-        { PARROT_GC_DEBUG_CORE, "gcdebug" },
-        { PARROT_SWITCH_CORE,   "switch" }
-    };
-    static const unsigned int n = sizeof (cores)/sizeof (struct runcoreinfo);
-    unsigned int i;
-    for (i= 0; i < n; ++i) {
-        if (strcmp(name, cores[i].name) == 0)
-            break;
-    }
-    if (i >= n)
-        fail("Invalid runcore");
-    return cores[i].id;
-}
-
-/**********************************************************************/
-
-/* Auxiliary parrot functions */
-
-Parrot_String create_string(Parrot_Interp interp, const char *name)
-{
-    return Parrot_new_string(interp, name, strlen(name), (const char *) NULL, 0);
-}
-
-/**********************************************************************/
-
-int lorito_main(Parrot_Interp interp, int argc, char **argv)
-{
-    char *source;
-    Parrot_PackFile pf;
-    const char *stname = NULL;
-    const char *exec = NULL;
-    int i;
-
-    /* Incompatible options are not checked yet */
-    for (i = 1; i < argc; ++i) {
-        if (strcmp(argv[i], "--trace") == 0) {
-            ++i;
-            if (i >= argc)
-                fail("Option needs argument");
-            Parrot_set_trace(interp, getuintval(argv[i]));
-        }
-        if (strcmp(argv[i], "--warnings") == 0) {
-            ++i;
-            if (i >= argc)
-                fail("Option needs argument");
-            Parrot_setwarnings(interp, getuintval(argv[i]));
-        }
-        else if (strcmp(argv[i], "-e") == 0) {
-            ++i;
-            if (i >= argc)
-                fail("Option needs argument");
-            exec = argv[i];
-        }
-        else if (strcmp(argv[i], "--start") == 0) {
-            ++i;
-            if (i >= argc)
-                fail("Option needs argument");
-            stname = argv[i];
-        }
-        else if (strcmp(argv[i], "--runcore") == 0) {
-            ++i;
-            if (i >= argc)
-                fail("Option needs argument");
-            Parrot_set_run_core(interp, getruncore(argv[i]));
-        }
-        else
-            break;
-    }
-
-    if (exec) {
-        Parrot_String compiler = create_string(interp, "PIR");
-        Parrot_String errstr;
-        Parrot_PMC code = Parrot_compile_string(interp, compiler, exec, &errstr);
-        void *discard = Parrot_call_sub(interp, code, "v");
-        return 0;
-    }
-
-    if (i >= argc)
-        fail("No file to load");
-    source = argv[i];
-
-    pf = Parrot_pbc_read(interp, source, 0);
-    if (! pf)
-        fail("Cannot load file");
-
-    Parrot_pbc_load(interp, pf);
-    Parrot_pbc_fixup_loaded(interp);
-
-    if (stname) {
-        Parrot_PMC rootns = Parrot_get_root_namespace(interp);
-        Parrot_String parrotname = create_string(interp, "parrot");
-        Parrot_PMC parrotns = Parrot_PMC_get_pmc_strkey(interp, rootns, parrotname);
-        Parrot_String name = create_string(interp, stname);
-        Parrot_PMC start = Parrot_PMC_get_pmc_strkey(interp, parrotns, name);
-        void *discard;
-        discard = Parrot_call_sub(interp, start, "v");
-    }
-    else {
-        Parrot_runcode(interp, argc - i, argv + i);
-    }
-
-    return 0;
-}
-
-int main(int argc, char **argv)
-{
-    Parrot_Interp interp;
-    int r;
-
-    Parrot_set_config_hash();
-    interp = Parrot_new(NULL);
-    if (! interp)
-        fail("Cannot create parrot interpreter");
-
-    Parrot_set_executable_name(interp, create_string(interp, argv[0]));
-
-    r = lorito_main(interp, argc, argv);
-
-    Parrot_destroy(interp);
-    return r;
-}
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */


More information about the parrot-commits mailing list