]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[script] Add "_t" to all struct names
authorCharlie Brej <cbrej@cs.man.ac.uk>
Sat, 4 Jul 2009 11:06:02 +0000 (12:06 +0100)
committerCharlie Brej <cbrej@cs.man.ac.uk>
Sat, 4 Jul 2009 11:06:02 +0000 (12:06 +0100)
19 files changed:
src/plugins/splash/script/Makefile.am
src/plugins/splash/script/plugin.c
src/plugins/splash/script/script-execute.c
src/plugins/splash/script/script-execute.h
src/plugins/splash/script/script-lib-image.c
src/plugins/splash/script/script-lib-image.h
src/plugins/splash/script/script-lib-math.c
src/plugins/splash/script/script-lib-math.h
src/plugins/splash/script/script-lib-plymouth.c
src/plugins/splash/script/script-lib-plymouth.h
src/plugins/splash/script/script-lib-sprite.c
src/plugins/splash/script/script-lib-sprite.h
src/plugins/splash/script/script-object.c
src/plugins/splash/script/script-object.h
src/plugins/splash/script/script-parse.c
src/plugins/splash/script/script-parse.h
src/plugins/splash/script/script.c
src/plugins/splash/script/script.h
src/plugins/splash/script/~script-lib-plymouth.c [deleted file]

index 0c02f35f430b5385ee65973c6d5e30072911436b..c3966c200451597a2b4c5f3b1d5fbe0d420af633 100644 (file)
@@ -45,7 +45,7 @@ script_la_SOURCES = $(srcdir)/plugin.c                                        \
                     $(srcdir)/ply-scan.h                                      
 
 MAINTAINERCLEANFILES = Makefile.in
-CLEANFILES = *.script.string
+CLEANFILES = *.string
 
 
 EXTRA_DIST = stringify.pl
index ab43ca894c1e42b92ab2602c5909fda58b503da7..8575914f710d20b3b48fd07e66db49de6012b93d 100644 (file)
 
 struct _ply_boot_splash_plugin
 {
-  ply_event_loop_t *loop;
+  ply_event_loop_t      *loop;
   ply_boot_splash_mode_t mode;
-  ply_frame_buffer_t *frame_buffer;
-  ply_window_t *window;
+  ply_frame_buffer_t    *frame_buffer;
+  ply_window_t          *window;
 
   char *script_filename;
   char *image_dir;
 
-  script_state   *script_state;
-  script_op      *script_main_op;
-  script_lib_sprite_data_t *script_sprite_lib;
-  script_lib_image_data_t  *script_image_lib;
-  script_lib_plymouth_data_t  *script_plymouth_lib;
-  script_lib_math_data_t  *script_math_lib;
+  script_state_t                *script_state;
+  script_op_t                   *script_main_op;
+  script_lib_sprite_data_t      *script_sprite_lib;
+  script_lib_image_data_t       *script_image_lib;
+  script_lib_plymouth_data_t    *script_plymouth_lib;
+  script_lib_math_data_t        *script_math_lib;
 
   uint32_t is_animating : 1;
 };
@@ -180,8 +180,8 @@ start_animation (ply_boot_splash_plugin_t *plugin)
   plugin->script_math_lib = script_lib_math_setup (plugin->script_state);
 
   ply_trace ("executing script file");
-  script_return ret = script_execute (plugin->script_state,
-                                      plugin->script_main_op);
+  script_return_t ret = script_execute (plugin->script_state,
+                                        plugin->script_main_op);
   script_obj_unref (ret.object);
   on_timeout (plugin);
 
index 940e151042f239b452290ba968b77904cbfb83e1..45d87c25371ca37bc72467c6ed598c74438eb1c9 100644 (file)
 #include "script-execute.h"
 #include "script-object.h"
 
-static script_obj *script_evaluate (script_state *state,
-                                    script_exp   *exp);
-static script_return script_execute_function_with_parlist (script_state    *state,
-                                                           script_function *function,
-                                                           ply_list_t      *parameter_data);
-
-static script_obj *script_evaluate_apply_function (script_state *state,
-                                                   script_exp   *exp,
-                                                   script_obj   *(*function)(script_obj *, script_obj *))
+static script_obj_t *script_evaluate (script_state_t *state,
+                                      script_exp_t   *exp);
+static script_return_t script_execute_function_with_parlist (script_state_t    *state,
+                                                             script_function_t *function,
+                                                             ply_list_t        *parameter_data);
+
+static script_obj_t *script_evaluate_apply_function (script_state_t *state,
+                                                     script_exp_t   *exp,
+                                                     script_obj_t   *(*function)(script_obj_t *, script_obj_t *))
 {
-  script_obj *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
-  script_obj *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
-  script_obj *obj = function (script_obj_a, script_obj_b);
+  script_obj_t *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
+  script_obj_t *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
+  script_obj_t *obj = function (script_obj_a, script_obj_b);
 
   script_obj_unref (script_obj_a);
   script_obj_unref (script_obj_b);
   return obj;
 }
 
-static script_obj *script_evaluate_apply_function_and_assign (script_state *state,
-                                                              script_exp   *exp,
-                                                              script_obj   *(*function)(script_obj *, script_obj *))
+static script_obj_t *script_evaluate_apply_function_and_assign (script_state_t *state,
+                                                                script_exp_t   *exp,
+                                                                script_obj_t   *(*function)(script_obj_t *, script_obj_t *))
 {
-  script_obj *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
-  script_obj *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
-  script_obj *obj = function (script_obj_a, script_obj_b);
+  script_obj_t *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
+  script_obj_t *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
+  script_obj_t *obj = function (script_obj_a, script_obj_b);
 
   script_obj_assign (script_obj_a, obj);
   script_obj_unref (script_obj_a);
@@ -70,13 +70,13 @@ static script_obj *script_evaluate_apply_function_and_assign (script_state *stat
   return obj;
 }
 
-static script_obj *script_evaluate_hash (script_state *state,
-                                         script_exp   *exp)
+static script_obj_t *script_evaluate_hash (script_state_t *state,
+                                           script_exp_t   *exp)
 {
-  script_obj *hash = script_evaluate (state, exp->data.dual.sub_a);
-  script_obj *key  = script_evaluate (state, exp->data.dual.sub_b);
-  script_obj *hash_dereffed = script_obj_deref_direct (hash);
-  script_obj *obj;
+  script_obj_t *hash = script_evaluate (state, exp->data.dual.sub_a);
+  script_obj_t *key  = script_evaluate (state, exp->data.dual.sub_b);
+  script_obj_t *hash_dereffed = script_obj_deref_direct (hash);
+  script_obj_t *obj;
 
   script_obj_deref (&key);
 
@@ -85,13 +85,13 @@ static script_obj *script_evaluate_hash (script_state *state,
   else
     {
       script_obj_reset (hash);
-      script_obj *newhash  = script_obj_new_hash ();
+      script_obj_t *newhash  = script_obj_new_hash ();
       hash->type = SCRIPT_OBJ_TYPE_REF;
       hash->data.obj = newhash;
       script_obj_deref (&hash);
     }
   char *name = script_obj_as_string (key);
-  script_vareable *vareable = ply_hashtable_lookup (hash->data.hash, name);
+  script_vareable_t *vareable = ply_hashtable_lookup (hash->data.hash, name);
 
   if (vareable)
     {
@@ -101,7 +101,7 @@ static script_obj *script_evaluate_hash (script_state *state,
   else
     {
       obj = script_obj_new_null ();
-      vareable = malloc (sizeof (script_vareable));
+      vareable = malloc (sizeof (script_vareable_t));
       vareable->name = name;
       vareable->object = obj;
       ply_hashtable_insert (hash->data.hash, vareable->name, vareable);
@@ -112,19 +112,19 @@ static script_obj *script_evaluate_hash (script_state *state,
   return obj;
 }
 
-static script_obj *script_evaluate_var (script_state *state,
-                                        script_exp   *exp)
+static script_obj_t *script_evaluate_var (script_state_t *state,
+                                          script_exp_t   *exp)
 {
   char *name = exp->data.string;
-  script_obj *obj;
+  script_obj_t *obj;
 
   script_obj_deref (&state->global);
   script_obj_deref (&state->local);
   assert (state->global->type == SCRIPT_OBJ_TYPE_HASH);
   assert (state->local->type == SCRIPT_OBJ_TYPE_HASH);
 
-  script_vareable *vareable = ply_hashtable_lookup (state->local->data.hash,
-                                                    name);
+  script_vareable_t *vareable = ply_hashtable_lookup (state->local->data.hash,
+                                                      name);
   if (!vareable)
     vareable = ply_hashtable_lookup (state->global->data.hash, name);
   if (vareable)
@@ -135,7 +135,7 @@ static script_obj *script_evaluate_var (script_state *state,
     }
   obj = script_obj_new_null ();
 
-  vareable = malloc (sizeof (script_vareable));
+  vareable = malloc (sizeof (script_vareable_t));
   vareable->name = strdup (name);
   vareable->object = obj;
 
@@ -144,11 +144,11 @@ static script_obj *script_evaluate_var (script_state *state,
   return obj;
 }
 
-static script_obj *script_evaluate_assign (script_state *state,
-                                           script_exp   *exp)
+static script_obj_t *script_evaluate_assign (script_state_t *state,
+                                             script_exp_t   *exp)
 {
-  script_obj *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
-  script_obj *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
+  script_obj_t *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
+  script_obj_t *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
 
   script_obj_deref (&script_obj_b);
   script_obj_assign (script_obj_a, script_obj_b);
@@ -157,11 +157,11 @@ static script_obj *script_evaluate_assign (script_state *state,
   return script_obj_a;
 }
 
-static script_obj *script_evaluate_cmp (script_state *state,
-                                        script_exp   *exp)
+static script_obj_t *script_evaluate_cmp (script_state_t *state,
+                                          script_exp_t   *exp)
 {
-  script_obj *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
-  script_obj *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
+  script_obj_t *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
+  script_obj_t *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
 
   script_obj_deref (&script_obj_a);
   script_obj_deref (&script_obj_b);
@@ -360,10 +360,10 @@ static script_obj *script_evaluate_cmp (script_state *state,
   return script_obj_new_int (reply);
 }
 
-static script_obj *script_evaluate_logic (script_state *state,
-                                          script_exp   *exp)
+static script_obj_t *script_evaluate_logic (script_state_t *state,
+                                            script_exp_t   *exp)
 {
-  script_obj *obj = script_evaluate (state, exp->data.dual.sub_a);
+  script_obj_t *obj = script_evaluate (state, exp->data.dual.sub_a);
 
   if ((exp->type == SCRIPT_EXP_TYPE_AND) && !script_obj_as_bool (obj))
     return obj;
@@ -374,11 +374,11 @@ static script_obj *script_evaluate_logic (script_state *state,
   return obj;
 }
 
-static script_obj *script_evaluate_unary (script_state *state,
-                                          script_exp   *exp)
+static script_obj_t *script_evaluate_unary (script_state_t *state,
+                                            script_exp_t   *exp)
 {
-  script_obj *obj = script_evaluate (state, exp->data.sub);
-  script_obj *new_obj;
+  script_obj_t *obj = script_evaluate (state, exp->data.sub);
+  script_obj_t *new_obj;
 
   script_obj_deref (&obj);
   if (exp->type == SCRIPT_EXP_TYPE_NOT)
@@ -429,11 +429,11 @@ static script_obj *script_evaluate_unary (script_state *state,
   return new_obj;
 }
 
-static script_obj *script_evaluate_func (script_state *state,
-                                         script_exp   *exp)
+static script_obj_t *script_evaluate_func (script_state_t *state,
+                                           script_exp_t   *exp)
 {
-  script_obj *func = script_evaluate (state, exp->data.function.name);
-  script_obj *obj = NULL;
+  script_obj_t *func = script_evaluate (state, exp->data.function.name);
+  script_obj_t *obj = NULL;
 
   script_obj_deref (&func);
 
@@ -446,14 +446,14 @@ static script_obj *script_evaluate_func (script_state *state,
     parameter_expressions);
   while (node_expression)
     {
-      script_exp *data_exp = ply_list_node_get_data (node_expression);
-      script_obj *data_obj = script_evaluate (state, data_exp);
+      script_exp_t *data_exp = ply_list_node_get_data (node_expression);
+      script_obj_t *data_obj = script_evaluate (state, data_exp);
       ply_list_append_data (parameter_data, data_obj);
       node_expression = ply_list_get_next_node (parameter_expressions,
                                                 node_expression);
     }
 
-  script_return reply = script_execute_function_with_parlist (
+  script_return_t reply = script_execute_function_with_parlist (
     state,
     func->data.
     function,
@@ -465,7 +465,7 @@ static script_obj *script_evaluate_func (script_state *state,
   ply_list_node_t *node_data = ply_list_get_first_node (parameter_data);
   while (node_data)
     {
-      script_obj *data_obj = ply_list_node_get_data (node_data);
+      script_obj_t *data_obj = ply_list_node_get_data (node_data);
       script_obj_unref (data_obj);
       node_data = ply_list_get_next_node (parameter_data, node_data);
     }
@@ -476,8 +476,8 @@ static script_obj *script_evaluate_func (script_state *state,
   return obj;
 }
 
-static script_obj *script_evaluate (script_state *state,
-                                    script_exp   *exp)
+static script_obj_t *script_evaluate (script_state_t *state,
+                                      script_exp_t   *exp)
 {
   switch (exp->type)
     {
@@ -623,17 +623,17 @@ static script_obj *script_evaluate (script_state *state,
   assert (0);
 }
 
-static script_return script_execute_list (script_state *state,
-                                          ply_list_t   *op_list)                        /* FIXME script_execute returns the return obj */
+static script_return_t script_execute_list (script_state_t *state,
+                                            ply_list_t   *op_list)                        /* FIXME script_execute returns the return obj */
 {
-  script_return reply = {SCRIPT_RETURN_TYPE_NORMAL, NULL};
+  script_return_t reply = {SCRIPT_RETURN_TYPE_NORMAL, NULL};
   ply_list_node_t *node = ply_list_get_first_node (op_list);
 
   for (node = ply_list_get_first_node (op_list);
        node;
        node = ply_list_get_next_node (op_list, node))
     {
-      script_op *op = ply_list_node_get_data (node);
+      script_op_t *op = ply_list_node_get_data (node);
       reply = script_execute (state, op);
       switch (reply.type)
         {
@@ -650,18 +650,18 @@ static script_return script_execute_list (script_state *state,
 }
 
 /* parameter_data list should be freed by caller */
-static script_return script_execute_function_with_parlist (script_state    *state,
-                                                           script_function *function,
-                                                           ply_list_t      *parameter_data)
+static script_return_t script_execute_function_with_parlist (script_state_t    *state,
+                                                             script_function_t *function,
+                                                             ply_list_t      *parameter_data)
 {
-  script_state *sub_state = script_state_init_sub (state);
+  script_state_t *sub_state = script_state_init_sub (state);
   ply_list_t *parameter_names = function->parameters;
   ply_list_node_t *node_name = ply_list_get_first_node (parameter_names);
   ply_list_node_t *node_data = ply_list_get_first_node (parameter_data);
 
   while (node_name && node_data)
     {
-      script_obj *data_obj = ply_list_node_get_data (node_data);
+      script_obj_t *data_obj = ply_list_node_get_data (node_data);
       char *name = ply_list_node_get_data (node_name);
       
       script_obj_hash_add_element (sub_state->local, data_obj, name);
@@ -669,12 +669,12 @@ static script_return script_execute_function_with_parlist (script_state    *stat
       node_data = ply_list_get_next_node (parameter_data, node_data);
     }
 
-  script_return reply;
+  script_return_t reply;
   switch (function->type)
     {
       case SCRIPT_FUNCTION_TYPE_SCRIPT:
         {
-          script_op *op = function->data.script;
+          script_op_t *op = function->data.script;
           reply = script_execute (sub_state, op);
           break;
         }
@@ -690,14 +690,14 @@ static script_return script_execute_function_with_parlist (script_state    *stat
   return reply;
 }
 
-script_return script_execute_function (script_state    *state,
-                                       script_function *function,
-                                       script_obj      *first_arg,
-                                       ...)
+script_return_t script_execute_function (script_state_t    *state,
+                                         script_function_t *function,
+                                         script_obj_t      *first_arg,
+                                         ...)
 {
-  script_return reply;
+  script_return_t reply;
   va_list args;
-  script_obj *arg;
+  script_obj_t *arg;
   ply_list_t *parameter_data = ply_list_new ();
 
   arg = first_arg;
@@ -705,7 +705,7 @@ script_return script_execute_function (script_state    *state,
   while (arg)
     {
       ply_list_append_data (parameter_data, arg);
-      arg = va_arg (args, script_obj *);
+      arg = va_arg (args, script_obj_t *);
     }
   va_end (args);
 
@@ -715,17 +715,17 @@ script_return script_execute_function (script_state    *state,
   return reply;
 }
 
-script_return script_execute (script_state *state,
-                              script_op    *op)
+script_return_t script_execute (script_state_t *state,
+                                script_op_t    *op)
 {
-  script_return reply = {SCRIPT_RETURN_TYPE_NORMAL, NULL};
+  script_return_t reply = {SCRIPT_RETURN_TYPE_NORMAL, NULL};
 
   if (!op) return reply;
   switch (op->type)
     {
       case SCRIPT_OP_TYPE_EXPRESSION:
         {
-          script_obj *obj = script_evaluate (state, op->data.exp);
+          script_obj_t *obj = script_evaluate (state, op->data.exp);
           script_obj_unref (obj);  /* there is always a reply from all expressions (even assigns) which we chuck away */
           break;
         }
@@ -739,7 +739,7 @@ script_return script_execute (script_state *state,
 
       case SCRIPT_OP_TYPE_IF:
         {
-          script_obj *obj = script_evaluate (state, op->data.cond_op.cond);
+          script_obj_t *obj = script_evaluate (state, op->data.cond_op.cond);
           if (script_obj_as_bool (obj))
             reply = script_execute (state, op->data.cond_op.op1);
           else
@@ -751,7 +751,7 @@ script_return script_execute (script_state *state,
       case SCRIPT_OP_TYPE_WHILE:
       case SCRIPT_OP_TYPE_FOR:
         {
-          script_obj *obj;
+          script_obj_t *obj;
           while (1)
             {
               obj = script_evaluate (state, op->data.cond_op.cond);
@@ -768,7 +768,7 @@ script_return script_execute (script_state *state,
                         return reply;
 
                       case SCRIPT_RETURN_TYPE_BREAK:
-                        return (script_return) {SCRIPT_RETURN_TYPE_NORMAL, NULL};
+                        return (script_return_t) {SCRIPT_RETURN_TYPE_NORMAL, NULL};
 
                       case SCRIPT_RETURN_TYPE_CONTINUE:
                         break;
@@ -786,7 +786,7 @@ script_return script_execute (script_state *state,
 
       case SCRIPT_OP_TYPE_FUNCTION_DEF:
         {
-          script_obj *obj = script_evaluate (state, op->data.function_def.name);
+          script_obj_t *obj = script_evaluate (state, op->data.function_def.name);
           script_obj_reset (obj);
           obj->type = SCRIPT_OBJ_TYPE_FUNCTION;
           obj->data.function = op->data.function_def.function;
@@ -796,22 +796,22 @@ script_return script_execute (script_state *state,
 
       case SCRIPT_OP_TYPE_RETURN:
         {
-          script_obj *obj;
+          script_obj_t *obj;
           if (op->data.exp) obj = script_evaluate (state, op->data.exp);
           else obj = script_obj_new_null ();
-          reply = (script_return) {SCRIPT_RETURN_TYPE_RETURN, obj};
+          reply = (script_return_t) {SCRIPT_RETURN_TYPE_RETURN, obj};
           break;
         }
 
       case SCRIPT_OP_TYPE_BREAK:
         {
-          reply = (script_return) {SCRIPT_RETURN_TYPE_BREAK, NULL};
+          reply = (script_return_t) {SCRIPT_RETURN_TYPE_BREAK, NULL};
           break;
         }
 
       case SCRIPT_OP_TYPE_CONTINUE:
         {
-          reply = (script_return) {SCRIPT_RETURN_TYPE_CONTINUE, NULL};
+          reply = (script_return_t) {SCRIPT_RETURN_TYPE_CONTINUE, NULL};
           break;
         }
     }
index 393efd3277f798bd5687a9d4a23c4a3d480bd375..1e5b7dd39e834391ce129bb343fdb96d0ca98c64 100644 (file)
 
 #include "script.h"
 
-script_return script_execute (script_state *state,
-                              script_op    *op);
-script_return script_execute_function (script_state    *state,
-                                       script_function *function,
-                                       script_obj      *first_arg,
-                                       ...);
+script_return_t script_execute (script_state_t *state,
+                                script_op_t    *op);
+script_return_t script_execute_function (script_state_t    *state,
+                                         script_function_t *function,
+                                         script_obj_t      *first_arg,
+                                         ...);
 
 #endif /* SCRIPT_EXECUTE_H */
index 3e30d57e0bdf71f04fe1946e68fd449d81221953..f803ab8147e191515c0d02396508ab9b86987b88 100644 (file)
 #define STRINGIFY_VAR script_lib_image_string
 #include "script-lib-image.string"
 
-static void image_free (script_obj *obj)
+static void image_free (script_obj_t *obj)
 {
   ply_image_t *image = obj->data.native.object_data;
 
   ply_image_free (image);
 }
 
-static script_return image_new (script_state *state,
-                                void         *user_data)
+static script_return_t image_new (script_state_t *state,
+                                  void           *user_data)
 {
   script_lib_image_data_t *data = user_data;
-  script_obj *reply;
+  script_obj_t *reply;
   char *path_filename;
   char *filename = script_obj_hash_get_string (state->local, "filename");
   char *test_string = filename;
@@ -79,11 +79,11 @@ static script_return image_new (script_state *state,
     }
   free (filename);
   free (path_filename);
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN, reply};
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN, reply};
 }
 
-static script_return image_get_width (script_state *state,
-                                      void         *user_data)
+static script_return_t image_get_width (script_state_t *state,
+                                        void           *user_data)
 {
   script_lib_image_data_t *data = user_data;
   ply_image_t *image = script_obj_hash_get_native_of_class (state->local,
@@ -91,14 +91,14 @@ static script_return image_get_width (script_state *state,
                                                             data->class);
 
   if (image)
-    return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+    return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                             script_obj_new_int (ply_image_get_width (image))};
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return image_get_height (script_state *state,
-                                       void         *user_data)
+static script_return_t image_get_height (script_state_t *state,
+                                         void           *user_data)
 {
   script_lib_image_data_t *data = user_data;
   ply_image_t *image = script_obj_hash_get_native_of_class (state->local,
@@ -106,14 +106,14 @@ static script_return image_get_height (script_state *state,
                                                             data->class);
 
   if (image)
-    return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+    return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                             script_obj_new_int (ply_image_get_height (image))};
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return image_rotate (script_state *state,
-                                   void         *user_data)
+static script_return_t image_rotate (script_state_t *state,
+                                     void           *user_data)
 {
   script_lib_image_data_t *data = user_data;
   ply_image_t *image = script_obj_hash_get_native_of_class (state->local,
@@ -124,21 +124,19 @@ static script_return image_rotate (script_state *state,
   if (image)
     {
       ply_image_t *new_image = ply_image_rotate (image,
-                                                 ply_image_get_width (
-                                                   image) / 2,
-                                                 ply_image_get_height (
-                                                   image) / 2,
+                                                 ply_image_get_width (image) / 2,
+                                                 ply_image_get_height (image) / 2,
                                                  angle);
-      return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+      return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                               script_obj_new_native (new_image,
                                                      data->class)};
     }
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return image_scale (script_state *state,
-                                  void         *user_data)
+static script_return_t image_scale (script_state_t *state,
+                                    void           *user_data)
 {
   script_lib_image_data_t *data = user_data;
   ply_image_t *image = script_obj_hash_get_native_of_class (state->local,
@@ -150,15 +148,15 @@ static script_return image_scale (script_state *state,
   if (image)
     {
       ply_image_t *new_image = ply_image_resize (image, width, height);
-      return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+      return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                               script_obj_new_native (new_image,
                                                      data->class)};
     }
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-script_lib_image_data_t *script_lib_image_setup (script_state *state,
+script_lib_image_data_t *script_lib_image_setup (script_state_t *state,
                                                  char         *image_dir)
 {
   script_lib_image_data_t *data = malloc (sizeof (script_lib_image_data_t));
@@ -201,7 +199,7 @@ script_lib_image_data_t *script_lib_image_setup (script_state *state,
                               NULL);
 
   data->script_main_op = script_parse_string (script_lib_image_string);
-  script_return ret = script_execute (state, data->script_main_op);
+  script_return_t ret = script_execute (state, data->script_main_op);
   script_obj_unref (ret.object);
 
   return data;
index 3d8e6182cc22a67c60a480e2f0e47deac533541a..25b30a5c7458841feb10e1343d7144c8e1280b99 100644 (file)
 
 typedef struct
 {
-  script_obj_native_class *class;
-  script_op      *script_main_op;
+  script_obj_native_class_t *class;
+  script_op_t               *script_main_op;
   char *image_dir;
 } script_lib_image_data_t;
 
-script_lib_image_data_t *script_lib_image_setup (script_state *state,
-                                                 char         *image_dir);
+script_lib_image_data_t *script_lib_image_setup (script_state_t *state,
+                                                 char           *image_dir);
 void script_lib_image_destroy (script_lib_image_data_t *data);
 
 #endif /* SCRIPT_LIB_IMAGE */
index 36ab76ca88f191ca23f5f2856baa830dac3c979d..17070352a2a7662a1511485ff496379058d03306 100644 (file)
 
 #include "script-lib-math.string"
 
-static script_return script_lib_math_float_from_float_function (script_state *state,
-                                                                void         *user_data)
+static script_return_t script_lib_math_float_from_float_function (script_state_t *state,
+                                                                  void           *user_data)
 {
   float (*function)(float) = user_data;
   float value = script_obj_hash_get_float (state->local, "value");
   float reply_float = function (value);
-  return (script_return) {
+  return (script_return_t) {
            SCRIPT_RETURN_TYPE_RETURN, script_obj_new_float (reply_float)
   };
 }
 
-static script_return script_lib_math_int_from_float_function (script_state *state,
-                                                              void         *user_data)
+static script_return_t script_lib_math_int_from_float_function (script_state_t *state,
+                                                                void           *user_data)
 {
   int (*function)(float) = user_data;
   float value = script_obj_hash_get_float (state->local, "value");
   int reply_int = function (value);
-  return (script_return) {
+  return (script_return_t) {
            SCRIPT_RETURN_TYPE_RETURN, script_obj_new_int (reply_int)
   };
 }
@@ -65,7 +65,7 @@ static int float_to_int (float value)
   return (int) value;
 }
 
-script_lib_math_data_t *script_lib_math_setup (script_state *state)
+script_lib_math_data_t *script_lib_math_setup (script_state_t *state)
 {
   script_lib_math_data_t *data = malloc (sizeof (script_lib_math_data_t));
 
@@ -101,7 +101,7 @@ script_lib_math_data_t *script_lib_math_setup (script_state *state)
                               NULL);
 
   data->script_main_op = script_parse_string (script_lib_math_string);
-  script_return ret = script_execute (state, data->script_main_op);
+  script_return_t ret = script_execute (state, data->script_main_op);
   script_obj_unref (ret.object);
 
   return data;
index 342239971cbbb9f69be4a68f2b9a643fc0ce09a3..da2ed4a45b73238de2bc1ed981fe687da0fce165 100644 (file)
 
 typedef struct
 {
-  script_op      *script_main_op;
+  script_op_t      *script_main_op;
 } script_lib_math_data_t;
 
-script_lib_math_data_t *script_lib_math_setup (script_state *state);
+script_lib_math_data_t *script_lib_math_setup (script_state_t *state);
 void script_lib_math_destroy (script_lib_math_data_t *data);
 
 #endif /* SCRIPT_LIB_MATH */
index af1aa5adbd202030c5d4abe3cd1b126660b1eb54..6d93beb288345f81604a8cdca0d77c559b270051 100644 (file)
 
 #include "script-lib-plymouth.string"
 
-static script_return plymouth_set_function (script_state *state,
-                                            void         *user_data)
+static script_return_t plymouth_set_function (script_state_t *state,
+                                              void           *user_data)
 {
-  script_obj **script_func = user_data;
-  script_obj *obj = script_obj_hash_get_element (state->local, "function");
+  script_obj_t **script_func = user_data;
+  script_obj_t *obj = script_obj_hash_get_element (state->local, "function");
 
   script_obj_deref (&obj);
   script_obj_unref (*script_func);
@@ -53,12 +53,12 @@ static script_return plymouth_set_function (script_state *state,
       *script_func = NULL;
       script_obj_unref (obj);
     }
-  return (script_return) {
+  return (script_return_t) {
            SCRIPT_RETURN_TYPE_RETURN, script_obj_new_null ()
   };
 }
 
-script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state *state)
+script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *state)
 {
   script_lib_plymouth_data_t *data = malloc (sizeof (script_lib_plymouth_data_t));
 
@@ -120,7 +120,7 @@ script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state *state)
                               "function",
                               NULL);
   data->script_main_op = script_parse_string (script_lib_plymouth_string);
-  script_return ret = script_execute (state, data->script_main_op);
+  script_return_t ret = script_execute (state, data->script_main_op);
   script_obj_unref (ret.object);                /* Throw anything sent back away */
 
   return data;
@@ -140,34 +140,34 @@ void script_lib_plymouth_destroy (script_lib_plymouth_data_t *data)
   free (data);
 }
 
-void script_lib_plymouth_on_refresh (script_state               *state,
+void script_lib_plymouth_on_refresh (script_state_t             *state,
                                      script_lib_plymouth_data_t *data)
 {
-  script_obj *refresh_func_obj = data->script_refresh_func;
+  script_obj_t *refresh_func_obj = data->script_refresh_func;
 
   if (refresh_func_obj
       && (refresh_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_return ret = script_execute_function (state,
+      script_return_t ret = script_execute_function (state,
                                                    refresh_func_obj->data.function,
                                                    NULL);
       script_obj_unref (ret.object);
     }
 }
 
-void script_lib_plymouth_on_boot_progress (script_state               *state,
+void script_lib_plymouth_on_boot_progress (script_state_t             *state,
                                            script_lib_plymouth_data_t *data,
                                            float                       duration,
                                            float                       progress)
 {
-  script_obj *boot_progress_func_obj = data->script_boot_progress_func;
+  script_obj_t *boot_progress_func_obj = data->script_boot_progress_func;
 
   if (boot_progress_func_obj
       && (boot_progress_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_obj *duration_obj = script_obj_new_float (duration);
-      script_obj *progress_obj = script_obj_new_float (progress);
-      script_return ret = script_execute_function (state,
+      script_obj_t *duration_obj = script_obj_new_float (duration);
+      script_obj_t *progress_obj = script_obj_new_float (progress);
+      script_return_t ret = script_execute_function (state,
                                                    boot_progress_func_obj->data.function,
                                                    duration_obj,
                                                    progress_obj,
@@ -178,114 +178,114 @@ void script_lib_plymouth_on_boot_progress (script_state               *state,
     }
 }
 
-void script_lib_plymouth_on_root_mounted (script_state               *state,
+void script_lib_plymouth_on_root_mounted (script_state_t             *state,
                                           script_lib_plymouth_data_t *data)
 {
-  script_obj *root_mounted_func_obj = data->script_root_mounted_func;
+  script_obj_t *root_mounted_func_obj = data->script_root_mounted_func;
 
   if (root_mounted_func_obj
       && (root_mounted_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_return ret = script_execute_function (state,
-                                                   root_mounted_func_obj->data.function,
-                                                   NULL);
+      script_return_t ret = script_execute_function (state,
+                                                     root_mounted_func_obj->data.function,
+                                                     NULL);
       script_obj_unref (ret.object);
     }
 }
 
-void script_lib_plymouth_on_keyboard_input (script_state               *state,
+void script_lib_plymouth_on_keyboard_input (script_state_t             *state,
                                             script_lib_plymouth_data_t *data,
                                             const char                 *keyboard_input)
 {
-  script_obj *keyboard_input_func_obj = data->script_keyboard_input_func;
+  script_obj_t *keyboard_input_func_obj = data->script_keyboard_input_func;
 
   if (keyboard_input_func_obj
       && (keyboard_input_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_obj *keyboard_input_obj = script_obj_new_string (keyboard_input);
-      script_return ret = script_execute_function (state,
-                                                   keyboard_input_func_obj->data.function,
-                                                   keyboard_input_obj,
-                                                   NULL);
+      script_obj_t *keyboard_input_obj = script_obj_new_string (keyboard_input);
+      script_return_t ret = script_execute_function (state,
+                                                     keyboard_input_func_obj->data.function,
+                                                     keyboard_input_obj,
+                                                     NULL);
       script_obj_unref (keyboard_input_obj);
       script_obj_unref (ret.object);
     }
 }
 
-void script_lib_plymouth_on_update_status (script_state               *state,
+void script_lib_plymouth_on_update_status (script_state_t             *state,
                                            script_lib_plymouth_data_t *data,
                                            const char                 *new_status)
 {
-  script_obj *update_status_func_obj = data->script_update_status_func;
+  script_obj_t *update_status_func_obj = data->script_update_status_func;
 
   if (update_status_func_obj
       && (update_status_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_obj *new_status_obj = script_obj_new_string (new_status);
-      script_return ret = script_execute_function (state,
-                                                   update_status_func_obj->data.function,
-                                                   new_status_obj,
-                                                   NULL);
+      script_obj_t *new_status_obj = script_obj_new_string (new_status);
+      script_return_t ret = script_execute_function (state,
+                                                     update_status_func_obj->data.function,
+                                                     new_status_obj,
+                                                     NULL);
       script_obj_unref (new_status_obj);
       script_obj_unref (ret.object);
     }
 }
 
-void script_lib_plymouth_on_display_normal (script_state               *state,
+void script_lib_plymouth_on_display_normal (script_state_t             *state,
                                             script_lib_plymouth_data_t *data)
 {
-  script_obj *display_normal_func_obj = data->script_display_normal_func;
+  script_obj_t *display_normal_func_obj = data->script_display_normal_func;
 
   if (display_normal_func_obj
       && (display_normal_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_return ret = script_execute_function (state,
-                                                   display_normal_func_obj->data.function,
-                                                   NULL);
+      script_return_t ret = script_execute_function (state,
+                                                     display_normal_func_obj->data.function,
+                                                     NULL);
       script_obj_unref (ret.object);
     }
 }
 
-void script_lib_plymouth_on_display_password (script_state               *state,
+void script_lib_plymouth_on_display_password (script_state_t             *state,
                                               script_lib_plymouth_data_t *data,
                                               const char                 *prompt,
                                               int                         bullets)
 {
-  script_obj *display_password_func_obj = data->script_display_password_func;
+  script_obj_t *display_password_func_obj = data->script_display_password_func;
 
   if (display_password_func_obj
       && (display_password_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_obj *prompt_obj = script_obj_new_string (prompt);
-      script_obj *bullets_obj = script_obj_new_int (bullets);
-      script_return ret = script_execute_function (state,
-                                                   display_password_func_obj->data.function,
-                                                   prompt_obj,
-                                                   bullets_obj,
-                                                   NULL);
+      script_obj_t *prompt_obj = script_obj_new_string (prompt);
+      script_obj_t *bullets_obj = script_obj_new_int (bullets);
+      script_return_t ret = script_execute_function (state,
+                                                     display_password_func_obj->data.function,
+                                                     prompt_obj,
+                                                     bullets_obj,
+                                                     NULL);
       script_obj_unref (prompt_obj);
       script_obj_unref (bullets_obj);
       script_obj_unref (ret.object);
     }
 }
 
-void script_lib_plymouth_on_display_question (script_state               *state,
+void script_lib_plymouth_on_display_question (script_state_t             *state,
                                               script_lib_plymouth_data_t *data,
                                               const char                 *prompt,
                                               const char                 *entry_text)
 {
-  script_obj *display_question_func_obj = data->script_display_question_func;
+  script_obj_t *display_question_func_obj = data->script_display_question_func;
 
   if (display_question_func_obj
       && (display_question_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
     {
-      script_obj *prompt_obj = script_obj_new_string (prompt);
-      script_obj *entry_text_obj = script_obj_new_string (entry_text);
-      script_return ret = script_execute_function (state,
-                                                   display_question_func_obj->data.function,
-                                                   prompt_obj,
-                                                   entry_text_obj,
-                                                   NULL);
+      script_obj_t *prompt_obj = script_obj_new_string (prompt);
+      script_obj_t *entry_text_obj = script_obj_new_string (entry_text);
+      script_return_t ret = script_execute_function (state,
+                                                     display_question_func_obj->data.function,
+                                                     prompt_obj,
+                                                     entry_text_obj,
+                                                     NULL);
       script_obj_unref (prompt_obj);
       script_obj_unref (entry_text_obj);
       script_obj_unref (ret.object);
index 19c0e9cf0abf26295f1ade23967f80830e293492..9a75a9a7b208f659fd89bf2416e8ccb2b72adf03 100644 (file)
 
 typedef struct
 {
-  script_op      *script_main_op;
-  script_obj     *script_refresh_func;
-  script_obj     *script_boot_progress_func;
-  script_obj     *script_root_mounted_func;
-  script_obj     *script_keyboard_input_func;
-  script_obj     *script_update_status_func;
-  script_obj     *script_display_normal_func;
-  script_obj     *script_display_password_func;
-  script_obj     *script_display_question_func;
+  script_op_t      *script_main_op;
+  script_obj_t     *script_refresh_func;
+  script_obj_t     *script_boot_progress_func;
+  script_obj_t     *script_root_mounted_func;
+  script_obj_t     *script_keyboard_input_func;
+  script_obj_t     *script_update_status_func;
+  script_obj_t     *script_display_normal_func;
+  script_obj_t     *script_display_password_func;
+  script_obj_t     *script_display_question_func;
 } script_lib_plymouth_data_t;
 
-script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state *state);
+script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *state);
 void script_lib_plymouth_destroy (script_lib_plymouth_data_t *data);
 
-void script_lib_plymouth_on_refresh (script_state               *state,
+void script_lib_plymouth_on_refresh (script_state_t             *state,
                                      script_lib_plymouth_data_t *data);
-void script_lib_plymouth_on_boot_progress (script_state               *state,
+void script_lib_plymouth_on_boot_progress (script_state_t             *state,
                                            script_lib_plymouth_data_t *data,
                                            float                       duration,
                                            float                       progress);
-void script_lib_plymouth_on_root_mounted (script_state               *state,
+void script_lib_plymouth_on_root_mounted (script_state_t             *state,
                                           script_lib_plymouth_data_t *data);
-void script_lib_plymouth_on_keyboard_input (script_state               *state,
+void script_lib_plymouth_on_keyboard_input (script_state_t             *state,
                                             script_lib_plymouth_data_t *data,
                                             const char                 *keyboard_input);
-void script_lib_plymouth_on_update_status (script_state               *state,
+void script_lib_plymouth_on_update_status (script_state_t             *state,
                                            script_lib_plymouth_data_t *data,
                                            const char                 *new_status);
-void script_lib_plymouth_on_display_normal (script_state               *state,
+void script_lib_plymouth_on_display_normal (script_state_t             *state,
                                             script_lib_plymouth_data_t *data);
-void script_lib_plymouth_on_display_password (script_state               *state,
+void script_lib_plymouth_on_display_password (script_state_t             *state,
                                               script_lib_plymouth_data_t *data,
                                               const char                 *prompt,
                                               int                         bullets);
-void script_lib_plymouth_on_display_question (script_state               *state,
+void script_lib_plymouth_on_display_question (script_state_t             *state,
                                               script_lib_plymouth_data_t *data,
                                               const char                 *prompt,
                                               const char                 *entry_text);
index f09536357fb8aa150fa6850422e94c2643bee905..9501ac7228ddf6297494bde66ecc592a75e35a9d 100644 (file)
@@ -44,17 +44,17 @@ static void draw_area (script_lib_sprite_data_t *data,
                        int                       width,
                        int                       height);
 
-static void sprite_free (script_obj *obj)
+static void sprite_free (script_obj_t *obj)
 {
   sprite_t *sprite = obj->data.native.object_data;
   sprite->remove_me = true;
 }
 
-static script_return sprite_new (script_state *state,
-                                 void         *user_data)
+static script_return_t sprite_new (script_state_t *state,
+                                   void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
-  script_obj *reply;
+  script_obj_t *reply;
 
   sprite_t *sprite = calloc (1, sizeof (sprite_t));
 
@@ -73,17 +73,17 @@ static script_return sprite_new (script_state *state,
   ply_list_append_data (data->sprite_list, sprite);
 
   reply = script_obj_new_native (sprite, data->class);
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN, reply};
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN, reply};
 }
 
-static script_return sprite_set_image (script_state *state,
-                                       void         *user_data)
+static script_return_t sprite_set_image (script_state_t *state,
+                                         void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
   sprite_t *sprite = script_obj_hash_get_native_of_class (state->local,
                                                           "sprite",
                                                           data->class);
-  script_obj *script_obj_image = script_obj_hash_get_element (state->local,
+  script_obj_t *script_obj_image = script_obj_hash_get_element (state->local,
                                                               "image");
 
   script_obj_deref (&script_obj_image);
@@ -100,12 +100,12 @@ static script_return sprite_set_image (script_state *state,
     }
   script_obj_unref (script_obj_image);
 
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return sprite_set_x (script_state *state,
-                                   void         *user_data)
+static script_return_t sprite_set_x (script_state_t *state,
+                                     void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
   sprite_t *sprite = script_obj_hash_get_native_of_class (state->local,
@@ -114,12 +114,12 @@ static script_return sprite_set_x (script_state *state,
 
   if (sprite)
     sprite->x = script_obj_hash_get_int (state->local, "value");
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return sprite_set_y (script_state *state,
-                                   void         *user_data)
+static script_return_t sprite_set_y (script_state_t *state,
+                                     void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
   sprite_t *sprite = script_obj_hash_get_native_of_class (state->local,
@@ -128,12 +128,12 @@ static script_return sprite_set_y (script_state *state,
 
   if (sprite)
     sprite->y = script_obj_hash_get_int (state->local, "value");
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return sprite_set_z (script_state *state,
-                                   void         *user_data)
+static script_return_t sprite_set_z (script_state_t *state,
+                                     void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
   sprite_t *sprite = script_obj_hash_get_native_of_class (state->local,
@@ -142,12 +142,12 @@ static script_return sprite_set_z (script_state *state,
 
   if (sprite)
     sprite->z = script_obj_hash_get_int (state->local, "value");
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return sprite_set_opacity (script_state *state,
-                                         void         *user_data)
+static script_return_t sprite_set_opacity (script_state_t *state,
+                                           void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
   sprite_t *sprite = script_obj_hash_get_native_of_class (state->local,
@@ -156,35 +156,35 @@ static script_return sprite_set_opacity (script_state *state,
 
   if (sprite)
     sprite->opacity = script_obj_hash_get_float (state->local, "value");
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
-static script_return sprite_window_get_width (script_state *state,
-                                              void         *user_data)
+static script_return_t sprite_window_get_width (script_state_t *state,
+                                                void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
   ply_frame_buffer_t *frame_buffer = ply_window_get_frame_buffer (data->window);
   ply_frame_buffer_area_t area;
 
   ply_frame_buffer_get_size (frame_buffer, &area);
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_int (area.width)};
 }
 
-static script_return sprite_window_get_height (script_state *state,
-                                               void         *user_data)
+static script_return_t sprite_window_get_height (script_state_t *state,
+                                                 void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
   ply_frame_buffer_t *frame_buffer = ply_window_get_frame_buffer (data->window);
   ply_frame_buffer_area_t area;
 
   ply_frame_buffer_get_size (frame_buffer, &area);
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_int (area.height)};
 }
 
-static uint32_t extract_rgb_color (script_state *state)
+static uint32_t extract_rgb_color (script_state_t *state)
 {
   uint8_t red =   CLAMP (255 * script_obj_hash_get_float (state->local, "red"),   0, 255);
   uint8_t green = CLAMP (255 * script_obj_hash_get_float (state->local, "green"), 0, 255);
@@ -193,25 +193,25 @@ static uint32_t extract_rgb_color (script_state *state)
   return (uint32_t) red << 16 | green << 8 | blue;
 }
 
-static script_return sprite_window_set_background_top_color (script_state *state,
-                                                             void         *user_data)
+static script_return_t sprite_window_set_background_top_color (script_state_t *state,
+                                                               void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
 
   data->background_color_start = extract_rgb_color (state);
   data->full_refresh = true;
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN, 
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN, 
                           script_obj_new_null ()};
 }
 
-static script_return sprite_window_set_background_bottom_color (script_state *state,
-                                                                void         *user_data)
+static script_return_t sprite_window_set_background_bottom_color (script_state_t *state,
+                                                                  void           *user_data)
 {
   script_lib_sprite_data_t *data = user_data;
 
   data->background_color_end = extract_rgb_color (state);
   data->full_refresh = true;
-  return (script_return) {SCRIPT_RETURN_TYPE_RETURN,
+  return (script_return_t) {SCRIPT_RETURN_TYPE_RETURN,
                           script_obj_new_null ()};
 }
 
@@ -271,8 +271,8 @@ draw_area (script_lib_sprite_data_t *data,
   ply_frame_buffer_unpause_updates (frame_buffer);
 }
 
-script_lib_sprite_data_t *script_lib_sprite_setup (script_state *state,
-                                                   ply_window_t *window)
+script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
+                                                   ply_window_t   *window)
 {
   script_lib_sprite_data_t *data = malloc (sizeof (script_lib_sprite_data_t));
 
@@ -351,7 +351,7 @@ script_lib_sprite_data_t *script_lib_sprite_setup (script_state *state,
   data->background_color_start = 0x000000;
   data->background_color_end   = 0x000000;
   data->full_refresh = true;
-  script_return ret = script_execute (state, data->script_main_op);
+  script_return_t ret = script_execute (state, data->script_main_op);
   script_obj_unref (ret.object);
   return data;
 }
index 9c399ec8ae02b803d8df8f59db3ce993222613b5..b365418c65192c39955c3a5a2404e37cec1da7dc 100644 (file)
@@ -28,8 +28,8 @@ typedef struct
 {
   ply_window_t              *window;
   ply_list_t                *sprite_list;
-  script_obj_native_class   *class;
-  script_op                 *script_main_op;
+  script_obj_native_class_t *class;
+  script_op_t               *script_main_op;
   uint32_t                   background_color_start;
   uint32_t                   background_color_end;
   bool                       full_refresh;
@@ -37,24 +37,24 @@ typedef struct
 
 typedef struct
 {
-  int          x;
-  int          y;
-  int          z;
-  float        opacity;
-  int          old_x;
-  int          old_y;
-  int          old_z;
-  int          old_width;
-  int          old_height;
-  float        old_opacity;
-  bool         refresh_me;
-  bool         remove_me;
-  ply_image_t *image;
-  script_obj  *image_obj;
+  int           x;
+  int           y;
+  int           z;
+  float         opacity;
+  int           old_x;
+  int           old_y;
+  int           old_z;
+  int           old_width;
+  int           old_height;
+  float         old_opacity;
+  bool          refresh_me;
+  bool          remove_me;
+  ply_image_t  *image;
+  script_obj_t *image_obj;
 } sprite_t;
 
-script_lib_sprite_data_t *script_lib_sprite_setup (script_state *state,
-                                                   ply_window_t *window);
+script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
+                                                   ply_window_t   *window);
 void script_lib_sprite_refresh (script_lib_sprite_data_t *data);
 void script_lib_sprite_destroy (script_lib_sprite_data_t *data);
 
index b3cad679e0651e933e6c43093652fc4e2facb4e5..ebc0a75b0110a0f3ec88d665cc50080e591f1139 100644 (file)
 #include "script.h"
 #include "script-object.h"
 
-char *script_obj_print (script_obj *obj);
-void script_obj_reset (script_obj *obj);
+char *script_obj_print (script_obj_t *obj);
+void script_obj_reset (script_obj_t *obj);
 
-void script_obj_free (script_obj *obj)
+void script_obj_free (script_obj_t *obj)
 {
   assert (!obj->refcount);
   script_obj_reset (obj);
   free (obj);
 }
 
-void script_obj_ref (script_obj *obj)
+void script_obj_ref (script_obj_t *obj)
 {
   obj->refcount++;
 }
 
-void script_obj_unref (script_obj *obj)
+void script_obj_unref (script_obj_t *obj)
 {
   if (!obj) return;
   assert (obj->refcount > 0);
@@ -64,14 +64,14 @@ static void foreach_free_vareable (void *key,
                                    void *data,
                                    void *user_data)
 {
-  script_vareable *vareable = data;
+  script_vareable_t *vareable = data;
 
   script_obj_unref (vareable->object);
   free (vareable->name);
   free (vareable);
 }
 
-void script_obj_reset (script_obj *obj)
+void script_obj_reset (script_obj_t *obj)
 {
   switch (obj->type)
     {
@@ -126,16 +126,16 @@ void script_obj_reset (script_obj *obj)
   obj->type = SCRIPT_OBJ_TYPE_NULL;
 }
 
-script_obj *script_obj_deref_direct (script_obj *obj)
+script_obj_t *script_obj_deref_direct (script_obj_t *obj)
 {
   while (obj->type == SCRIPT_OBJ_TYPE_REF)
     obj = obj->data.obj;
   return obj;
 }
 
-void script_obj_deref (script_obj **obj_ptr)
+void script_obj_deref (script_obj_t **obj_ptr)
 {
-  script_obj *obj = *obj_ptr;
+  script_obj_t *obj = *obj_ptr;
 
   obj = script_obj_deref_direct (obj);
   script_obj_ref (obj);
@@ -147,7 +147,7 @@ static void foreach_print_vareable (void *key,
                                     void *data,
                                     void *user_data)
 {
-  script_vareable *vareable = data;
+  script_vareable_t *vareable = data;
   char *string = script_obj_print (vareable->object);
   char *reply;
   char *prev = *(char **) user_data;
@@ -159,7 +159,7 @@ static void foreach_print_vareable (void *key,
   *(char **) user_data = reply;
 }
 
-char *script_obj_print (script_obj *obj)
+char *script_obj_print (script_obj_t *obj)
 {
   char *reply;
 
@@ -228,18 +228,18 @@ char *script_obj_print (script_obj *obj)
   return NULL;
 }
 
-script_obj *script_obj_new_null (void)
+script_obj_t *script_obj_new_null (void)
 {
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
 
   obj->type = SCRIPT_OBJ_TYPE_NULL;
   obj->refcount = 1;
   return obj;
 }
 
-script_obj *script_obj_new_int (int number)
+script_obj_t *script_obj_new_int (int number)
 {
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
 
   obj->type = SCRIPT_OBJ_TYPE_INT;
   obj->refcount = 1;
@@ -247,29 +247,29 @@ script_obj *script_obj_new_int (int number)
   return obj;
 }
 
-script_obj *script_obj_new_float (float number)
+script_obj_t *script_obj_new_float (float number)
 {
   if (isnan (number)) return script_obj_new_null ();
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
   obj->type = SCRIPT_OBJ_TYPE_FLOAT;
   obj->refcount = 1;
   obj->data.floatpoint = number;
   return obj;
 }
 
-script_obj *script_obj_new_string (const char *string)
+script_obj_t *script_obj_new_string (const char *string)
 {
   if (!string) return script_obj_new_null ();
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
   obj->type = SCRIPT_OBJ_TYPE_STRING;
   obj->refcount = 1;
   obj->data.string = strdup (string);
   return obj;
 }
 
-script_obj *script_obj_new_hash (void)
+script_obj_t *script_obj_new_hash (void)
 {
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
 
   obj->type = SCRIPT_OBJ_TYPE_HASH;
   obj->data.hash = ply_hashtable_new (ply_hashtable_string_hash,
@@ -278,9 +278,9 @@ script_obj *script_obj_new_hash (void)
   return obj;
 }
 
-script_obj *script_obj_new_function (script_function *function)
+script_obj_t *script_obj_new_function (script_function_t *function)
 {
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
 
   obj->type = SCRIPT_OBJ_TYPE_FUNCTION;
   obj->data.function = function;
@@ -288,9 +288,9 @@ script_obj *script_obj_new_function (script_function *function)
   return obj;
 }
 
-script_obj *script_obj_new_ref (script_obj *sub_obj)
+script_obj_t *script_obj_new_ref (script_obj_t *sub_obj)
 {
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
 
   obj->type = SCRIPT_OBJ_TYPE_REF;
   obj->data.obj = sub_obj;
@@ -298,11 +298,11 @@ script_obj *script_obj_new_ref (script_obj *sub_obj)
   return obj;
 }
 
-script_obj *script_obj_new_native (void                    *object_data,
-                                   script_obj_native_class *class)
+script_obj_t *script_obj_new_native (void                      *object_data,
+                                     script_obj_native_class_t *class)
 {
   if (!object_data) return script_obj_new_null ();
-  script_obj *obj = malloc (sizeof (script_obj));
+  script_obj_t *obj = malloc (sizeof (script_obj_t));
   obj->type = SCRIPT_OBJ_TYPE_NATIVE;
   obj->data.native.class = class;
   obj->data.native.object_data = object_data;
@@ -310,7 +310,7 @@ script_obj *script_obj_new_native (void                    *object_data,
   return obj;
 }
 
-int script_obj_as_int (script_obj *obj)
+int script_obj_as_int (script_obj_t *obj)
 {                                                     /* If in then reply contents, otherwise reply 0 */
   obj = script_obj_deref_direct (obj);
   switch (obj->type)
@@ -340,7 +340,7 @@ int script_obj_as_int (script_obj *obj)
   return 0;
 }
 
-float script_obj_as_float (script_obj *obj)
+float script_obj_as_float (script_obj_t *obj)
 {                                                     /* If in then reply contents, otherwise reply 0 */
   obj = script_obj_deref_direct (obj);
   switch (obj->type)
@@ -370,7 +370,7 @@ float script_obj_as_float (script_obj *obj)
   return NAN;
 }
 
-bool script_obj_as_bool (script_obj *obj)
+bool script_obj_as_bool (script_obj_t *obj)
 {                                                 /* False objects are NULL, 0, "" */
   obj = script_obj_deref_direct (obj);
   switch (obj->type)
@@ -403,7 +403,7 @@ bool script_obj_as_bool (script_obj *obj)
   return false;
 }
 
-char *script_obj_as_string (script_obj *obj)              /* reply is strdupped and may be NULL */
+char *script_obj_as_string (script_obj_t *obj)              /* reply is strdupped and may be NULL */
 {
   obj = script_obj_deref_direct (obj);
   char *reply;
@@ -441,8 +441,8 @@ char *script_obj_as_string (script_obj *obj)              /* reply is strdupped
   return false;
 }
 
-void *script_obj_as_native_of_class (script_obj              *obj,
-                                     script_obj_native_class *class)
+void *script_obj_as_native_of_class (script_obj_t              *obj,
+                                     script_obj_native_class_t *class)
 {
   obj = script_obj_deref_direct (obj);
   if (script_obj_is_native_of_class (obj, class))
@@ -450,7 +450,7 @@ void *script_obj_as_native_of_class (script_obj              *obj,
   return NULL;
 }
 
-void *script_obj_as_native_of_class_name (script_obj *obj,
+void *script_obj_as_native_of_class_name (script_obj_t *obj,
                                           const char *class_name)
 {
   obj = script_obj_deref_direct (obj);
@@ -459,63 +459,63 @@ void *script_obj_as_native_of_class_name (script_obj *obj,
   return NULL;
 }
 
-bool script_obj_is_null (script_obj *obj)
+bool script_obj_is_null (script_obj_t *obj)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_NULL;
 }
 
-bool script_obj_is_int (script_obj *obj)
+bool script_obj_is_int (script_obj_t *obj)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_INT;
 }
 
-bool script_obj_is_float (script_obj *obj)
+bool script_obj_is_float (script_obj_t *obj)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_FLOAT;
 }
 
-bool script_obj_is_number (script_obj *obj)     /* Float or Int */
+bool script_obj_is_number (script_obj_t *obj)     /* Float or Int */
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_INT || obj->type == SCRIPT_OBJ_TYPE_FLOAT;
 }
 
-bool script_obj_is_string (script_obj *obj)
+bool script_obj_is_string (script_obj_t *obj)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_STRING;
 }
 
-bool script_obj_is_hash (script_obj *obj)
+bool script_obj_is_hash (script_obj_t *obj)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_HASH;
 }
 
-bool script_obj_is_function (script_obj *obj)
+bool script_obj_is_function (script_obj_t *obj)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_FUNCTION;
 }
 
-bool script_obj_is_native (script_obj *obj)
+bool script_obj_is_native (script_obj_t *obj)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_NATIVE;
 }
 
-bool script_obj_is_native_of_class (script_obj              *obj,
-                                    script_obj_native_class *class)
+bool script_obj_is_native_of_class (script_obj_t              *obj,
+                                    script_obj_native_class_t *class)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_NATIVE && obj->data.native.class == class;
 }
 
-bool script_obj_is_native_of_class_name (script_obj *obj,
-                                         const char *class_name)
+bool script_obj_is_native_of_class_name (script_obj_t *obj,
+                                         const char   *class_name)
 {
   obj = script_obj_deref_direct (obj);
   return obj->type == SCRIPT_OBJ_TYPE_NATIVE && !strcmp (
@@ -523,8 +523,8 @@ bool script_obj_is_native_of_class_name (script_obj *obj,
            class_name);
 }
 
-void script_obj_assign (script_obj *obj_a,
-                        script_obj *obj_b)
+void script_obj_assign (script_obj_t *obj_a,
+                        script_obj_t *obj_b)
 {
   obj_b = script_obj_deref_direct (obj_b);
   if (obj_a == obj_b) return;                   /* FIXME triple check this */
@@ -564,20 +564,20 @@ void script_obj_assign (script_obj *obj_a,
     }
 }
 
-script_obj *script_obj_hash_get_element (script_obj *hash,
-                                         const char *name)
+script_obj_t *script_obj_hash_get_element (script_obj_t *hash,
+                                           const char   *name)
 {
   assert (hash->type == SCRIPT_OBJ_TYPE_HASH);
-  script_vareable *vareable = ply_hashtable_lookup (hash->data.hash,
-                                                    (void *) name);
-  script_obj *obj;
+  script_vareable_t *vareable = ply_hashtable_lookup (hash->data.hash,
+                                                      (void *) name);
+  script_obj_t *obj;
 
   if (vareable)
     obj = vareable->object;
   else
     {
       obj = script_obj_new_null ();
-      vareable = malloc (sizeof (script_vareable));
+      vareable = malloc (sizeof (script_vareable_t));
       vareable->name = strdup (name);
       vareable->object = obj;
       ply_hashtable_insert (hash->data.hash, vareable->name, vareable);
@@ -586,84 +586,84 @@ script_obj *script_obj_hash_get_element (script_obj *hash,
   return obj;
 }
 
-int script_obj_hash_get_int (script_obj *hash,
-                             const char *name)
+int script_obj_hash_get_int (script_obj_t *hash,
+                             const char   *name)
 {
-  script_obj *obj = script_obj_hash_get_element (hash, name);
+  script_obj_t *obj = script_obj_hash_get_element (hash, name);
   int reply = script_obj_as_int (obj);
 
   script_obj_unref (obj);
   return reply;
 }
 
-float script_obj_hash_get_float (script_obj *hash,
-                                 const char *name)
+float script_obj_hash_get_float (script_obj_t *hash,
+                                 const char   *name)
 {
-  script_obj *obj = script_obj_hash_get_element (hash, name);
+  script_obj_t *obj = script_obj_hash_get_element (hash, name);
   float reply = script_obj_as_float (obj);
 
   script_obj_unref (obj);
   return reply;
 }
 
-bool script_obj_hash_get_bool (script_obj *hash,
-                               const char *name)
+bool script_obj_hash_get_bool (script_obj_t *hash,
+                               const char   *name)
 {
-  script_obj *obj = script_obj_hash_get_element (hash, name);
+  script_obj_t *obj = script_obj_hash_get_element (hash, name);
   bool reply = script_obj_as_bool (obj);
 
   script_obj_unref (obj);
   return reply;
 }
 
-char *script_obj_hash_get_string (script_obj *hash,
-                                  const char *name)
+char *script_obj_hash_get_string (script_obj_t *hash,
+                                  const char   *name)
 {
-  script_obj *obj = script_obj_hash_get_element (hash, name);
+  script_obj_t *obj = script_obj_hash_get_element (hash, name);
   char *reply = script_obj_as_string (obj);
 
   script_obj_unref (obj);
   return reply;
 }
 
-void *script_obj_hash_get_native_of_class (script_obj              *hash,
-                                           const char              *name,
-                                           script_obj_native_class *class)
+void *script_obj_hash_get_native_of_class (script_obj_t              *hash,
+                                           const char                *name,
+                                           script_obj_native_class_t *class)
 {
-  script_obj *obj = script_obj_hash_get_element (hash, name);
+  script_obj_t *obj = script_obj_hash_get_element (hash, name);
   void *reply = script_obj_as_native_of_class (obj, class);
 
   script_obj_unref (obj);
   return reply;
 }
 
-void *script_obj_hash_get_native_of_class_name (script_obj *hash,
-                                                const char *name,
-                                                const char *class_name)
+void *script_obj_hash_get_native_of_class_name (script_obj_t *hash,
+                                                const char   *name,
+                                                const char   *class_name)
 {
-  script_obj *obj = script_obj_hash_get_element (hash, name);
+  script_obj_t *obj = script_obj_hash_get_element (hash, name);
   void *reply = script_obj_as_native_of_class_name (obj, class_name);
 
   script_obj_unref (obj);
   return reply;
 }
 
-void script_obj_hash_add_element (script_obj *hash,
-                                  script_obj *element,
-                                  const char *name)
+void script_obj_hash_add_element (script_obj_t *hash,
+                                  script_obj_t *element,
+                                  const char   *name)
 {
   assert (hash->type == SCRIPT_OBJ_TYPE_HASH);
-  script_obj *obj = script_obj_hash_get_element (hash, name);
+  script_obj_t *obj = script_obj_hash_get_element (hash, name);
   script_obj_assign (obj, element);
   script_obj_unref (obj);
 }
 
-script_obj *script_obj_plus (script_obj *script_obj_a,
-                             script_obj *script_obj_b)
+script_obj_t *script_obj_plus (script_obj_t *script_obj_a,
+                               script_obj_t *script_obj_b)
 {
   if (script_obj_is_string (script_obj_a) || script_obj_is_string (script_obj_b))
     {
-      script_obj *obj;
+      script_obj_t *obj;
       char *string_a = script_obj_as_string (script_obj_a);
       char *string_b = script_obj_as_string (script_obj_b);
       if (string_a && string_b)
@@ -692,8 +692,8 @@ script_obj *script_obj_plus (script_obj *script_obj_a,
   return script_obj_new_null ();
 }
 
-script_obj *script_obj_minus (script_obj *script_obj_a,
-                              script_obj *script_obj_b)
+script_obj_t *script_obj_minus (script_obj_t *script_obj_a,
+                                script_obj_t *script_obj_b)
 {
   if (script_obj_is_number (script_obj_a) && script_obj_is_number (script_obj_b))
     {
@@ -708,8 +708,8 @@ script_obj *script_obj_minus (script_obj *script_obj_a,
   return script_obj_new_null ();
 }
 
-script_obj *script_obj_mul (script_obj *script_obj_a,
-                            script_obj *script_obj_b)
+script_obj_t *script_obj_mul (script_obj_t *script_obj_a,
+                              script_obj_t *script_obj_b)
 {
   if (script_obj_is_number (script_obj_a) && script_obj_is_number (script_obj_b))
     {
@@ -724,8 +724,8 @@ script_obj *script_obj_mul (script_obj *script_obj_a,
   return script_obj_new_null ();
 }
 
-script_obj *script_obj_div (script_obj *script_obj_a,
-                            script_obj *script_obj_b)
+script_obj_t *script_obj_div (script_obj_t *script_obj_a,
+                              script_obj_t *script_obj_b)
 {
   if (script_obj_is_number (script_obj_a) && script_obj_is_number (script_obj_b))
     {
@@ -742,8 +742,8 @@ script_obj *script_obj_div (script_obj *script_obj_a,
   return script_obj_new_null ();
 }
 
-script_obj *script_obj_mod (script_obj *script_obj_a,
-                            script_obj *script_obj_b)
+script_obj_t *script_obj_mod (script_obj_t *script_obj_a,
+                              script_obj_t *script_obj_b)
 {
   if (script_obj_is_number (script_obj_a) && script_obj_is_number (script_obj_b))
     {
index df4cd100da43359bc6d0b3675206fab7d65a1fdf..916a7116e0c919aa94c140808f2818597f18cd81 100644 (file)
 
 #include "script.h"
 
-void script_obj_free (script_obj *obj);
-void script_obj_ref (script_obj *obj);
-void script_obj_unref (script_obj *obj);
-void script_obj_reset (script_obj *obj);
-script_obj *script_obj_deref_direct (script_obj *obj);
-void script_obj_deref (script_obj **obj_ptr);
-char *script_obj_print (script_obj *obj);
-script_obj *script_obj_new_int (int number);
-script_obj *script_obj_new_float (float number);
-script_obj *script_obj_new_string (const char *string);
-script_obj *script_obj_new_null (void);
-script_obj *script_obj_new_hash (void);
-script_obj *script_obj_new_function (script_function *function);
-script_obj *script_obj_new_ref (script_obj *sub_obj);
+void script_obj_free (script_obj_t *obj);
+void script_obj_ref (script_obj_t *obj);
+void script_obj_unref (script_obj_t *obj);
+void script_obj_reset (script_obj_t *obj);
+script_obj_t *script_obj_deref_direct (script_obj_t *obj);
+void script_obj_deref (script_obj_t **obj_ptr);
+char *script_obj_print (script_obj_t *obj);
+script_obj_t *script_obj_new_int (int number);
+script_obj_t *script_obj_new_float (float number);
+script_obj_t *script_obj_new_string (const char *string);
+script_obj_t *script_obj_new_null (void);
+script_obj_t *script_obj_new_hash (void);
+script_obj_t *script_obj_new_function (script_function_t *function);
+script_obj_t *script_obj_new_ref (script_obj_t *sub_obj);
 
-script_obj *script_obj_new_native (void *object_data,
-                                   script_obj_native_class * class );
-int script_obj_as_int (script_obj *obj);
-float script_obj_as_float (script_obj *obj);
-bool script_obj_as_bool (script_obj *obj);
-char *script_obj_as_string (script_obj *obj);
+script_obj_t *script_obj_new_native (void                       *object_data,
+                                     script_obj_native_class_t  *class );
+int script_obj_as_int (script_obj_t *obj);
+float script_obj_as_float (script_obj_t *obj);
+bool script_obj_as_bool (script_obj_t *obj);
+char *script_obj_as_string (script_obj_t *obj);
 
-void *script_obj_as_native_of_class (script_obj * obj,
-                                     script_obj_native_class * class );
-void *script_obj_as_native_of_class_name (script_obj *obj,
-                                          const char *class_name);
-bool script_obj_is_null (script_obj *obj);
-bool script_obj_is_int (script_obj *obj);
-bool script_obj_is_float (script_obj *obj);
-bool script_obj_is_string (script_obj *obj);
-bool script_obj_is_hash (script_obj *obj);
-bool script_obj_is_function (script_obj *obj);
-bool script_obj_is_native (script_obj *obj);
+void *script_obj_as_native_of_class (script_obj_t              *obj,
+                                     script_obj_native_class_t *class );
+void *script_obj_as_native_of_class_name (script_obj_t *obj,
+                                          const char   *class_name);
+bool script_obj_is_null (script_obj_t *obj);
+bool script_obj_is_int (script_obj_t *obj);
+bool script_obj_is_float (script_obj_t *obj);
+bool script_obj_is_string (script_obj_t *obj);
+bool script_obj_is_hash (script_obj_t *obj);
+bool script_obj_is_function (script_obj_t *obj);
+bool script_obj_is_native (script_obj_t *obj);
 
-bool script_obj_is_native_of_class (script_obj * obj,
-                                    script_obj_native_class * class );
-bool script_obj_is_native_of_class_name (script_obj *obj,
-                                         const char *class_name);
-void script_obj_assign (script_obj *obj_a,
-                        script_obj *obj_b);
-script_obj *script_obj_hash_get_element (script_obj *hash,
-                                         const char *name);
-int script_obj_hash_get_int (script_obj *hash,
-                             const char *name);
-float script_obj_hash_get_float (script_obj *hash,
-                                 const char *name);
-bool script_obj_hash_get_bool (script_obj *hash,
-                               const char *name);
-char *script_obj_hash_get_string (script_obj *hash,
-                                  const char *name);
+bool script_obj_is_native_of_class (script_obj_t * obj,
+                                    script_obj_native_class_t *class );
+bool script_obj_is_native_of_class_name (script_obj_t *obj,
+                                         const char   *class_name);
+void script_obj_assign (script_obj_t *obj_a,
+                        script_obj_t *obj_b);
+script_obj_t *script_obj_hash_get_element (script_obj_t *hash,
+                                           const char   *name);
+int script_obj_hash_get_int (script_obj_t *hash,
+                             const char   *name);
+float script_obj_hash_get_float (script_obj_t *hash,
+                                 const char   *name);
+bool script_obj_hash_get_bool (script_obj_t *hash,
+                               const char   *name);
+char *script_obj_hash_get_string (script_obj_t *hash,
+                                  const char   *name);
 
-void *script_obj_hash_get_native_of_class (script_obj * hash,
-                                           const char *name,
-                                           script_obj_native_class * class );
-void *script_obj_hash_get_native_of_class_name (script_obj *hash,
-                                                const char *name,
-                                                const char *class_name);
-void script_obj_hash_add_element (script_obj *hash,
-                                  script_obj *element,
-                                  const char *name);
-script_obj *script_obj_plus (script_obj *script_obj_a_in,
-                             script_obj *script_obj_b_in);
-script_obj *script_obj_minus (script_obj *script_obj_a_in,
-                              script_obj *script_obj_b_in);
-script_obj *script_obj_mul (script_obj *script_obj_a_in,
-                            script_obj *script_obj_b_in);
-script_obj *script_obj_div (script_obj *script_obj_a_in,
-                            script_obj *script_obj_b_in);
-script_obj *script_obj_mod (script_obj *script_obj_a_in,
-                            script_obj *script_obj_b_in);
+void *script_obj_hash_get_native_of_class (script_obj_t *hash,
+                                           const char   *name,
+                                           script_obj_native_class_t *class );
+void *script_obj_hash_get_native_of_class_name (script_obj_t *hash,
+                                                const char   *name,
+                                                const char   *class_name);
+void script_obj_hash_add_element (script_obj_t *hash,
+                                  script_obj_t *element,
+                                  const char   *name);
+script_obj_t *script_obj_plus (script_obj_t *script_obj_a_in,
+                               script_obj_t *script_obj_b_in);
+script_obj_t *script_obj_minus (script_obj_t *script_obj_a_in,
+                                script_obj_t *script_obj_b_in);
+script_obj_t *script_obj_mul (script_obj_t *script_obj_a_in,
+                              script_obj_t *script_obj_b_in);
+script_obj_t *script_obj_div (script_obj_t *script_obj_a_in,
+                              script_obj_t *script_obj_b_in);
+script_obj_t *script_obj_mod (script_obj_t *script_obj_a_in,
+                              script_obj_t *script_obj_b_in);
 
 #endif /* SCRIPT_OBJECT */
index 99d7cf9216b2144e16fb3e8fecb8343bed7d399a..e1d0bf1b22a586f22c4eaa78d86629cda79405bb 100644 (file)
@@ -38,8 +38,8 @@
 
 #define WITH_SEMIES
 
-static script_op *script_parse_op (ply_scan_t *scan);
-static script_exp *script_parse_exp (ply_scan_t *scan);
+static script_op_t *script_parse_op (ply_scan_t *scan);
+static script_exp_t *script_parse_exp (ply_scan_t *scan);
 static ply_list_t *script_parse_op_list (ply_scan_t *scan);
 static void script_parse_op_list_free (ply_list_t *op_list);
 
@@ -52,14 +52,14 @@ static void script_parse_error (ply_scan_token_t *token,
              expected);
 }
 
-static script_exp *script_parse_exp_tm (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_tm (ply_scan_t *scan)
 {
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
-  script_exp *exp = NULL;
+  script_exp_t *exp = NULL;
 
   if (curtoken->type == PLY_SCAN_TOKEN_TYPE_INTEGER)
     {
-      exp = malloc (sizeof (script_exp));
+      exp = malloc (sizeof (script_exp_t));
       exp->type = SCRIPT_EXP_TYPE_TERM_INT;
       exp->data.integer = curtoken->data.integer;
       ply_scan_get_next_token (scan);
@@ -67,7 +67,7 @@ static script_exp *script_parse_exp_tm (ply_scan_t *scan)
     }
   if (curtoken->type == PLY_SCAN_TOKEN_TYPE_FLOAT)
     {
-      exp = malloc (sizeof (script_exp));
+      exp = malloc (sizeof (script_exp_t));
       exp->type = SCRIPT_EXP_TYPE_TERM_FLOAT;
       exp->data.floatpoint = curtoken->data.floatpoint;
       ply_scan_get_next_token (scan);
@@ -75,7 +75,7 @@ static script_exp *script_parse_exp_tm (ply_scan_t *scan)
     }
   if (curtoken->type == PLY_SCAN_TOKEN_TYPE_IDENTIFIER)
     {
-      exp = malloc (sizeof (script_exp));
+      exp = malloc (sizeof (script_exp_t));
       if (!strcmp (curtoken->data.string, "NULL"))
         exp->type = SCRIPT_EXP_TYPE_TERM_NULL;
       else if (!strcmp (curtoken->data.string, "global"))
@@ -92,7 +92,7 @@ static script_exp *script_parse_exp_tm (ply_scan_t *scan)
     }
   if (curtoken->type == PLY_SCAN_TOKEN_TYPE_STRING)
     {
-      exp = malloc (sizeof (script_exp));
+      exp = malloc (sizeof (script_exp_t));
       exp->type = SCRIPT_EXP_TYPE_TERM_STRING;
       exp->data.string = strdup (curtoken->data.string);
       ply_scan_get_next_token (scan);
@@ -123,9 +123,9 @@ static script_exp *script_parse_exp_tm (ply_scan_t *scan)
   return exp;
 }
 
-static script_exp *script_parse_exp_pi (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_pi (ply_scan_t *scan)
 {
-  script_exp *exp = script_parse_exp_tm (scan);
+  script_exp_t *exp = script_parse_exp_tm (scan);
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
 
   while (true)
@@ -133,14 +133,14 @@ static script_exp *script_parse_exp_pi (ply_scan_t *scan)
       if (curtoken->type != PLY_SCAN_TOKEN_TYPE_SYMBOL) break;
       if (curtoken->data.symbol == '(')
         {
-          script_exp *func = malloc (sizeof (script_exp));
+          script_exp_t *func = malloc (sizeof (script_exp_t));
           ply_list_t *parameters = ply_list_new ();
           ply_scan_get_next_token (scan);
           while (true)
             {
               if ((curtoken->type == PLY_SCAN_TOKEN_TYPE_SYMBOL)
                   && (curtoken->data.symbol == ')')) break;
-              script_exp *parameter = script_parse_exp (scan);
+              script_exp_t *parameter = script_parse_exp (scan);
 
               ply_list_append_data (parameters, parameter);
 
@@ -167,20 +167,20 @@ static script_exp *script_parse_exp_pi (ply_scan_t *scan)
           exp->data.function.parameters = parameters;
           continue;
         }
-      script_exp *key;
+      script_exp_t *key;
 
       if (curtoken->data.symbol == '.')
         {
           ply_scan_get_next_token (scan);
           if (curtoken->type == PLY_SCAN_TOKEN_TYPE_IDENTIFIER)
             {
-              key = malloc (sizeof (script_exp));
+              key = malloc (sizeof (script_exp_t));
               key->type = SCRIPT_EXP_TYPE_TERM_STRING;
               key->data.string = strdup (curtoken->data.string);
             }
           else if (curtoken->type == PLY_SCAN_TOKEN_TYPE_INTEGER)       /* errrr, integer keys without being [] bracketed */
             {
-              key = malloc (sizeof (script_exp));                       /* This is broken with floats as obj.10.6 is obj[10.6] and not obj[10][6] */
+              key = malloc (sizeof (script_exp_t));                       /* This is broken with floats as obj.10.6 is obj[10.6] and not obj[10][6] */
               key->type = SCRIPT_EXP_TYPE_TERM_INT;
               key->data.integer = curtoken->data.integer;
             }
@@ -207,7 +207,7 @@ static script_exp *script_parse_exp_pi (ply_scan_t *scan)
           curtoken = ply_scan_get_next_token (scan);
         }
       else break;
-      script_exp *hash = malloc (sizeof (script_exp));
+      script_exp_t *hash = malloc (sizeof (script_exp_t));
       hash->type = SCRIPT_EXP_TYPE_HASH;
       hash->data.dual.sub_a = exp;
       hash->data.dual.sub_b = key;
@@ -216,9 +216,9 @@ static script_exp *script_parse_exp_pi (ply_scan_t *scan)
   return exp;
 }
 
-static script_exp *script_parse_exp_pr (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_pr (ply_scan_t *scan)
 {
-  script_exp_type type;
+  script_exp_type_t type;
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
   ply_scan_token_t *peektoken = ply_scan_peek_next_token (scan);
 
@@ -261,7 +261,7 @@ static script_exp *script_parse_exp_pr (ply_scan_t *scan)
         }
       else
         return script_parse_exp_pi (scan);
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       exp->type = type;
       exp->data.sub = script_parse_exp_pr (scan);
       return exp;
@@ -269,9 +269,9 @@ static script_exp *script_parse_exp_pr (ply_scan_t *scan)
   return script_parse_exp_pi (scan);
 }
 
-static script_exp *script_parse_exp_po (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_po (ply_scan_t *scan)
 {
-  script_exp *exp = script_parse_exp_pr (scan);
+  script_exp_t *exp = script_parse_exp_pr (scan);
 
   while (true)
     {
@@ -284,7 +284,7 @@ static script_exp *script_parse_exp_po (ply_scan_t *scan)
         {
           ply_scan_get_next_token (scan);
           ply_scan_get_next_token (scan);
-          script_exp *new_exp = malloc (sizeof (script_exp));
+          script_exp_t *new_exp = malloc (sizeof (script_exp_t));
           new_exp->type = SCRIPT_EXP_TYPE_POST_INC;
           new_exp->data.sub = exp;
           exp = new_exp;
@@ -294,7 +294,7 @@ static script_exp *script_parse_exp_po (ply_scan_t *scan)
         {
           ply_scan_get_next_token (scan);
           ply_scan_get_next_token (scan);
-          script_exp *new_exp = malloc (sizeof (script_exp));
+          script_exp_t *new_exp = malloc (sizeof (script_exp_t));
           new_exp->type = SCRIPT_EXP_TYPE_POST_DEC;
           new_exp->data.sub = exp;
           exp = new_exp;
@@ -305,9 +305,9 @@ static script_exp *script_parse_exp_po (ply_scan_t *scan)
   return exp;
 }
 
-static script_exp *script_parse_exp_md (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_md (ply_scan_t *scan)
 {
-  script_exp *sub_a = script_parse_exp_po (scan);
+  script_exp_t *sub_a = script_parse_exp_po (scan);
 
   if (!sub_a) return NULL;
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
@@ -319,7 +319,7 @@ static script_exp *script_parse_exp_md (ply_scan_t *scan)
          && !(peektoken->type == PLY_SCAN_TOKEN_TYPE_SYMBOL
               && peektoken->data.symbol == '='))
     {
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       if (curtoken->data.symbol == '*') exp->type = SCRIPT_EXP_TYPE_MUL;
       else if (curtoken->data.symbol == '/') exp->type = SCRIPT_EXP_TYPE_DIV;
       else exp->type = SCRIPT_EXP_TYPE_MOD;
@@ -339,9 +339,9 @@ static script_exp *script_parse_exp_md (ply_scan_t *scan)
   return sub_a;
 }
 
-static script_exp *script_parse_exp_pm (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_pm (ply_scan_t *scan)
 {
-  script_exp *sub_a = script_parse_exp_md (scan);
+  script_exp_t *sub_a = script_parse_exp_md (scan);
 
   if (!sub_a) return NULL;
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
@@ -352,7 +352,7 @@ static script_exp *script_parse_exp_pm (ply_scan_t *scan)
          && !(peektoken->type == PLY_SCAN_TOKEN_TYPE_SYMBOL
               && peektoken->data.symbol == '='))
     {
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       if (curtoken->data.symbol == '+') exp->type = SCRIPT_EXP_TYPE_PLUS;
       else exp->type = SCRIPT_EXP_TYPE_MINUS;
       exp->data.dual.sub_a = sub_a;
@@ -371,9 +371,9 @@ static script_exp *script_parse_exp_pm (ply_scan_t *scan)
   return sub_a;
 }
 
-static script_exp *script_parse_exp_gt (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_gt (ply_scan_t *scan)
 {
-  script_exp *sub_a = script_parse_exp_pm (scan);
+  script_exp_t *sub_a = script_parse_exp_pm (scan);
 
   if (!sub_a) return NULL;
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
@@ -392,7 +392,7 @@ static script_exp *script_parse_exp_gt (ply_scan_t *scan)
           eq = 1;
           curtoken = ply_scan_get_next_token (scan);
         }
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       if      (gt &&  eq) exp->type = SCRIPT_EXP_TYPE_GE;
       else if (gt && !eq) exp->type = SCRIPT_EXP_TYPE_GT;
       else if (!gt &&  eq) exp->type = SCRIPT_EXP_TYPE_LE;
@@ -412,9 +412,9 @@ static script_exp *script_parse_exp_gt (ply_scan_t *scan)
   return sub_a;
 }
 
-static script_exp *script_parse_exp_eq (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_eq (ply_scan_t *scan)
 {
-  script_exp *sub_a = script_parse_exp_gt (scan);
+  script_exp_t *sub_a = script_parse_exp_gt (scan);
 
   if (!sub_a) return NULL;
   while (1)
@@ -431,7 +431,7 @@ static script_exp *script_parse_exp_eq (ply_scan_t *scan)
       ply_scan_get_next_token (scan);
       ply_scan_get_next_token (scan);
 
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       if (ne) exp->type = SCRIPT_EXP_TYPE_NE;
       else exp->type = SCRIPT_EXP_TYPE_EQ;
       exp->data.dual.sub_a = sub_a;
@@ -448,9 +448,9 @@ static script_exp *script_parse_exp_eq (ply_scan_t *scan)
   return sub_a;
 }
 
-static script_exp *script_parse_exp_an (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_an (ply_scan_t *scan)
 {
-  script_exp *sub_a = script_parse_exp_eq (scan);
+  script_exp_t *sub_a = script_parse_exp_eq (scan);
 
   if (!sub_a) return NULL;
   while (1)
@@ -465,7 +465,7 @@ static script_exp *script_parse_exp_an (ply_scan_t *scan)
       ply_scan_get_next_token (scan);
       ply_scan_get_next_token (scan);
 
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       exp->type = SCRIPT_EXP_TYPE_AND;
       exp->data.dual.sub_a = sub_a;
       exp->data.dual.sub_b = script_parse_exp_eq (scan);
@@ -481,9 +481,9 @@ static script_exp *script_parse_exp_an (ply_scan_t *scan)
   return sub_a;
 }
 
-static script_exp *script_parse_exp_or (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_or (ply_scan_t *scan)
 {
-  script_exp *sub_a = script_parse_exp_an (scan);
+  script_exp_t *sub_a = script_parse_exp_an (scan);
 
   if (!sub_a) return NULL;
   while (1)
@@ -498,7 +498,7 @@ static script_exp *script_parse_exp_or (ply_scan_t *scan)
       ply_scan_get_next_token (scan);
       ply_scan_get_next_token (scan);
 
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       exp->type = SCRIPT_EXP_TYPE_OR;
       exp->data.dual.sub_a = sub_a;
       exp->data.dual.sub_b = script_parse_exp_an (scan);
@@ -514,9 +514,9 @@ static script_exp *script_parse_exp_or (ply_scan_t *scan)
   return sub_a;
 }
 
-static script_exp *script_parse_exp_as (ply_scan_t *scan)
+static script_exp_t *script_parse_exp_as (ply_scan_t *scan)
 {
-  script_exp *lhs = script_parse_exp_or (scan);
+  script_exp_t *lhs = script_parse_exp_or (scan);
 
   if (!lhs) return NULL;
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
@@ -532,7 +532,7 @@ static script_exp *script_parse_exp_as (ply_scan_t *scan)
       || ((curtoken->type == PLY_SCAN_TOKEN_TYPE_SYMBOL)
           && (curtoken->data.symbol == '=')))
     {
-      script_exp_type type;
+      script_exp_type_t type;
       if (modify_assign)
         {
           switch (curtoken->data.symbol)
@@ -567,14 +567,14 @@ static script_exp *script_parse_exp_as (ply_scan_t *scan)
       else
         type = SCRIPT_EXP_TYPE_ASSIGN;
       ply_scan_get_next_token (scan);
-      script_exp *rhs = script_parse_exp_as (scan);
+      script_exp_t *rhs = script_parse_exp_as (scan);
       if (!rhs)
         {
           script_parse_error (ply_scan_get_current_token (scan),
                               "An invalid RHS of an expression");
           return NULL;
         }
-      script_exp *exp = malloc (sizeof (script_exp));
+      script_exp_t *exp = malloc (sizeof (script_exp_t));
       exp->type = type;
       exp->data.dual.sub_a = lhs;
       exp->data.dual.sub_b = rhs;
@@ -583,12 +583,12 @@ static script_exp *script_parse_exp_as (ply_scan_t *scan)
   return lhs;
 }
 
-static script_exp *script_parse_exp (ply_scan_t *scan)
+static script_exp_t *script_parse_exp (ply_scan_t *scan)
 {
   return script_parse_exp_as (scan);
 }
 
-static script_op *script_parse_op_block (ply_scan_t *scan)
+static script_op_t *script_parse_op_block (ply_scan_t *scan)
 {
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
 
@@ -606,16 +606,16 @@ static script_op *script_parse_op_block (ply_scan_t *scan)
     }
   curtoken = ply_scan_get_next_token (scan);
 
-  script_op *op = malloc (sizeof (script_op));
+  script_op_t *op = malloc (sizeof (script_op_t));
   op->type = SCRIPT_OP_TYPE_OP_BLOCK;
   op->data.list = sublist;
   return op;
 }
 
-static script_op *script_parse_if_while (ply_scan_t *scan)
+static script_op_t *script_parse_if_while (ply_scan_t *scan)
 {
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
-  script_op_type type;
+  script_op_type_t type;
 
   if (curtoken->type != PLY_SCAN_TOKEN_TYPE_IDENTIFIER)
     return NULL;
@@ -633,7 +633,7 @@ static script_op *script_parse_if_while (ply_scan_t *scan)
     }
   curtoken = ply_scan_get_next_token (scan);
 
-  script_exp *cond = script_parse_exp (scan);
+  script_exp_t *cond = script_parse_exp (scan);
   curtoken = ply_scan_get_current_token (scan);
   if (!cond)
     {
@@ -648,8 +648,8 @@ static script_op *script_parse_if_while (ply_scan_t *scan)
       return NULL;
     }
   ply_scan_get_next_token (scan);
-  script_op *cond_op = script_parse_op (scan);
-  script_op *else_op = NULL;
+  script_op_t *cond_op = script_parse_op (scan);
+  script_op_t *else_op = NULL;
 
   curtoken = ply_scan_get_current_token (scan);
   if ((type == SCRIPT_OP_TYPE_IF)
@@ -659,7 +659,7 @@ static script_op *script_parse_if_while (ply_scan_t *scan)
       ply_scan_get_next_token (scan);
       else_op = script_parse_op (scan);
     }
-  script_op *op = malloc (sizeof (script_op));
+  script_op_t *op = malloc (sizeof (script_op_t));
   op->type = type;
   op->data.cond_op.cond = cond;
   op->data.cond_op.op1 = cond_op;
@@ -667,7 +667,7 @@ static script_op *script_parse_if_while (ply_scan_t *scan)
   return op;
 }
 
-static script_op *script_parse_for (ply_scan_t *scan)
+static script_op_t *script_parse_for (ply_scan_t *scan)
 {
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
 
@@ -684,7 +684,7 @@ static script_op *script_parse_for (ply_scan_t *scan)
     }
   curtoken = ply_scan_get_next_token (scan);
 
-  script_exp *first = script_parse_exp (scan);
+  script_exp_t *first = script_parse_exp (scan);
   if (!first)
     {
       script_parse_error (curtoken, "Expected a valid first expression");
@@ -700,7 +700,7 @@ static script_op *script_parse_for (ply_scan_t *scan)
     }
   ply_scan_get_next_token (scan);
 
-  script_exp *cond = script_parse_exp (scan);
+  script_exp_t *cond = script_parse_exp (scan);
   if (!cond)
     {
       script_parse_error (curtoken, "Expected a valid condition expression");
@@ -715,7 +715,7 @@ static script_op *script_parse_for (ply_scan_t *scan)
     }
   ply_scan_get_next_token (scan);
 
-  script_exp *last = script_parse_exp (scan);
+  script_exp_t *last = script_parse_exp (scan);
   if (!last)
     {
       script_parse_error (curtoken, "Expected a valid last expression");
@@ -729,23 +729,23 @@ static script_op *script_parse_for (ply_scan_t *scan)
       return NULL;
     }
   ply_scan_get_next_token (scan);
-  script_op *op_body = script_parse_op (scan);
+  script_op_t *op_body = script_parse_op (scan);
 
-  script_op *op_first = malloc (sizeof (script_op));
+  script_op_t *op_first = malloc (sizeof (script_op_t));
   op_first->type = SCRIPT_OP_TYPE_EXPRESSION;
   op_first->data.exp = first;
 
-  script_op *op_last = malloc (sizeof (script_op));
+  script_op_t *op_last = malloc (sizeof (script_op_t));
   op_last->type = SCRIPT_OP_TYPE_EXPRESSION;
   op_last->data.exp = last;
 
-  script_op *op_for = malloc (sizeof (script_op));
+  script_op_t *op_for = malloc (sizeof (script_op_t));
   op_for->type = SCRIPT_OP_TYPE_FOR;
   op_for->data.cond_op.cond = cond;
   op_for->data.cond_op.op1 = op_body;
   op_for->data.cond_op.op2 = op_last;
 
-  script_op *op_block = malloc (sizeof (script_op));
+  script_op_t *op_block = malloc (sizeof (script_op_t));
   op_block->type = SCRIPT_OP_TYPE_OP_BLOCK;
   op_block->data.list = ply_list_new ();
   ply_list_append_data (op_block->data.list, op_first);
@@ -754,7 +754,7 @@ static script_op *script_parse_for (ply_scan_t *scan)
   return op_block;
 }
 
-static script_op *script_parse_function (ply_scan_t *scan)
+static script_op_t *script_parse_function (ply_scan_t *scan)
 {
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
 
@@ -770,7 +770,7 @@ static script_op *script_parse_function (ply_scan_t *scan)
                           "A function declaration requires a valid name");
       return NULL;
     }
-  script_exp *name = malloc (sizeof (script_exp));
+  script_exp_t *name = malloc (sizeof (script_exp_t));
   name->type = SCRIPT_EXP_TYPE_TERM_VAR;
   name->data.string = strdup (curtoken->data.string);
 
@@ -819,9 +819,9 @@ static script_op *script_parse_function (ply_scan_t *scan)
 
   curtoken = ply_scan_get_next_token (scan);
 
-  script_op *func_op = script_parse_op (scan);
+  script_op_t *func_op = script_parse_op (scan);
 
-  script_op *op = malloc (sizeof (script_op));
+  script_op_t *op = malloc (sizeof (script_op_t));
   op->type = SCRIPT_OP_TYPE_FUNCTION_DEF;
   op->data.function_def.name = name;
   op->data.function_def.function = script_function_script_new (func_op,
@@ -830,20 +830,20 @@ static script_op *script_parse_function (ply_scan_t *scan)
   return op;
 }
 
-static script_op *script_parse_return (ply_scan_t *scan)
+static script_op_t *script_parse_return (ply_scan_t *scan)
 {
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
 
   if (curtoken->type != PLY_SCAN_TOKEN_TYPE_IDENTIFIER)
     return NULL;
-  script_op_type type;
+  script_op_type_t type;
   if      (!strcmp (curtoken->data.string, "return")) type = SCRIPT_OP_TYPE_RETURN;
   else if (!strcmp (curtoken->data.string, "break")) type = SCRIPT_OP_TYPE_BREAK;
   else if (!strcmp (curtoken->data.string, "continue")) type = SCRIPT_OP_TYPE_CONTINUE;
   else return NULL;
   curtoken = ply_scan_get_next_token (scan);
 
-  script_op *op = malloc (sizeof (script_op));
+  script_op_t *op = malloc (sizeof (script_op_t));
   if (type == SCRIPT_OP_TYPE_RETURN)
     {
       op->data.exp = script_parse_exp (scan);                  /* May be NULL */
@@ -863,10 +863,10 @@ static script_op *script_parse_return (ply_scan_t *scan)
   return op;
 }
 
-static script_op *script_parse_op (ply_scan_t *scan)
+static script_op_t *script_parse_op (ply_scan_t *scan)
 {
   ply_scan_token_t *curtoken = ply_scan_get_current_token (scan);
-  script_op *reply = NULL;
+  script_op_t *reply = NULL;
 
   reply = script_parse_op_block (scan);
   if (reply) return reply;
@@ -882,7 +882,7 @@ static script_op *script_parse_op (ply_scan_t *scan)
 
 /* default is expression */
   {
-    script_exp *exp = script_parse_exp (scan);
+    script_exp_t *exp = script_parse_exp (scan);
     if (!exp) return NULL;
     curtoken = ply_scan_get_current_token (scan);
 #ifdef WITH_SEMIES
@@ -895,7 +895,7 @@ static script_op *script_parse_op (ply_scan_t *scan)
     curtoken = ply_scan_get_next_token (scan);
 #endif
 
-    script_op *op = malloc (sizeof (script_op));
+    script_op_t *op = malloc (sizeof (script_op_t));
     op->type = SCRIPT_OP_TYPE_EXPRESSION;
     op->data.exp = exp;
     return op;
@@ -909,7 +909,7 @@ static ply_list_t *script_parse_op_list (ply_scan_t *scan)
 
   while (1)
     {
-      script_op *op = script_parse_op (scan);
+      script_op_t *op = script_parse_op (scan);
       if (!op) break;
       ply_list_append_data (op_list, op);
     }
@@ -917,7 +917,7 @@ static ply_list_t *script_parse_op_list (ply_scan_t *scan)
   return op_list;
 }
 
-static void script_parse_exp_free (script_exp *exp)
+static void script_parse_exp_free (script_exp_t *exp)
 {
   if (!exp) return;
   switch (exp->type)
@@ -970,7 +970,7 @@ static void script_parse_exp_free (script_exp *exp)
                node;
                node = ply_list_get_next_node (exp->data.function.parameters, node))
             {
-              script_exp *sub = ply_list_node_get_data (node);
+              script_exp_t *sub = ply_list_node_get_data (node);
               script_parse_exp_free (sub);
             }
           ply_list_free (exp->data.function.parameters);
@@ -986,7 +986,7 @@ static void script_parse_exp_free (script_exp *exp)
   free (exp);
 }
 
-void script_parse_op_free (script_op *op)
+void script_parse_op_free (script_op_t *op)
 {
   if (!op) return;
   switch (op->type)
@@ -1058,14 +1058,14 @@ static void script_parse_op_list_free (ply_list_t *op_list)
        node;
        node = ply_list_get_next_node (op_list, node))
     {
-      script_op *op = ply_list_node_get_data (node);
+      script_op_t *op = ply_list_node_get_data (node);
       script_parse_op_free (op);
     }
   ply_list_free (op_list);
   return;
 }
 
-script_op *script_parse_file (const char *filename)
+script_op_t *script_parse_file (const char *filename)
 {
   ply_scan_t *scan = ply_scan_file (filename);
 
@@ -1083,13 +1083,13 @@ script_op *script_parse_file (const char *filename)
       return NULL;
     }
   ply_scan_free (scan);
-  script_op *op = malloc (sizeof (script_op));
+  script_op_t *op = malloc (sizeof (script_op_t));
   op->type = SCRIPT_OP_TYPE_OP_BLOCK;
   op->data.list = list;
   return op;
 }
 
-script_op *script_parse_string (const char *string)
+script_op_t *script_parse_string (const char *string)
 {
   ply_scan_t *scan = ply_scan_string (string);
 
@@ -1100,7 +1100,7 @@ script_op *script_parse_string (const char *string)
     }
   ply_list_t *list = script_parse_op_list (scan);
   ply_scan_free (scan);
-  script_op *op = malloc (sizeof (script_op));
+  script_op_t *op = malloc (sizeof (script_op_t));
   op->type = SCRIPT_OP_TYPE_OP_BLOCK;
   op->data.list = list;
   return op;
index 6ab623cfbdd4586bba54f579a279632e09c3d9be..0c017c4a2730c2758f7f4f0c11396db0744115f8 100644 (file)
@@ -24,8 +24,8 @@
 
 #include "script.h"
 
-script_op *script_parse_file (const char *filename);
-script_op *script_parse_string (const char *string);
-void script_parse_op_free (script_op *op);
+script_op_t *script_parse_file (const char *filename);
+script_op_t *script_parse_string (const char *string);
+void script_parse_op_free (script_op_t *op);
 
 #endif /* SCRIPT_PARSE */
index e5487aaa0dedc5f396ea8f7c3ff0f22b00a7dd4d..db95047c91f1c02d2de7bc6da91c5ad9ca4196cb 100644 (file)
 #include "script-parse.h"
 #include "script-object.h"
 
-script_function *script_function_script_new (script_op  *script,
-                                             void       *user_data,
-                                             ply_list_t *parameter_list)
+script_function_t *script_function_script_new (script_op_t  *script,
+                                               void         *user_data,
+                                               ply_list_t   *parameter_list)
 {
-  script_function *function = malloc (sizeof (script_function));
+  script_function_t *function = malloc (sizeof (script_function_t));
 
   function->type = SCRIPT_FUNCTION_TYPE_SCRIPT;
   function->parameters = parameter_list;
@@ -51,13 +51,11 @@ script_function *script_function_script_new (script_op  *script,
   return function;
 }
 
-script_function *script_function_native_new (
-  script_native_function native_function,
-  void                  *user_data,
-  ply_list_t            *
-                         parameter_list)
+script_function_t *script_function_native_new (script_native_function_t   native_function,
+                                               void                      *user_data,
+                                               ply_list_t                *parameter_list)
 {
-  script_function *function = malloc (sizeof (script_function));
+  script_function_t *function = malloc (sizeof (script_function_t));
 
   function->type = SCRIPT_FUNCTION_TYPE_NATIVE;
   function->parameters = parameter_list;
@@ -67,11 +65,11 @@ script_function *script_function_native_new (
   return function;
 }
 
-void script_add_native_function (script_obj            *hash,
-                                 const char            *name,
-                                 script_native_function native_function,
-                                 void                  *user_data,
-                                 const char            *first_arg,
+void script_add_native_function (script_obj_t            *hash,
+                                 const char              *name,
+                                 script_native_function_t native_function,
+                                 void                    *user_data,
+                                 const char              *first_arg,
                                  ...)
 {
   va_list args;
@@ -87,19 +85,19 @@ void script_add_native_function (script_obj            *hash,
     }
   va_end (args);
 
-  script_function *function = script_function_native_new (native_function,
-                                                          user_data,
-                                                          parameter_list);
-  script_obj *obj = script_obj_new_function (function);
+  script_function_t *function = script_function_native_new (native_function,
+                                                            user_data,
+                                                            parameter_list);
+  script_obj_t *obj = script_obj_new_function (function);
   script_obj_hash_add_element (hash, obj, name);
   script_obj_unref (obj);
 }
 
-script_obj_native_class *script_obj_native_class_new (script_obj_function free_func,
-                                                      const char         *name,
-                                                      void               *user_data)
+script_obj_native_class_t *script_obj_native_class_new (script_obj_function_t free_func,
+                                                        const char           *name,
+                                                        void                 *user_data)
 {
-  script_obj_native_class *class = malloc (sizeof (script_obj_native_class));
+  script_obj_native_class_t *class = malloc (sizeof (script_obj_native_class_t));
 
   class->free_func = free_func;
   class->name = strdup (name);
@@ -107,16 +105,16 @@ script_obj_native_class *script_obj_native_class_new (script_obj_function free_f
   return class;
 }
 
-void script_obj_native_class_destroy (script_obj_native_class *class)
+void script_obj_native_class_destroy (script_obj_native_class_t *class)
 {
   free (class->name);
   free (class);
   return;
 }
 
-script_state *script_state_new (void *user_data)
+script_state_t *script_state_new (void *user_data)
 {
-  script_state *state = malloc (sizeof (script_state));
+  script_state_t *state = malloc (sizeof (script_state_t));
 
   state->global = script_obj_new_hash ();
   script_obj_ref (state->global);
@@ -125,9 +123,9 @@ script_state *script_state_new (void *user_data)
   return state;
 }
 
-script_state *script_state_init_sub (script_state *oldstate)
+script_state_t *script_state_init_sub (script_state_t *oldstate)
 {
-  script_state *newstate = malloc (sizeof (script_state));
+  script_state_t *newstate = malloc (sizeof (script_state_t));
 
   newstate->global = oldstate->global;
   script_obj_ref (newstate->global);
@@ -136,7 +134,7 @@ script_state *script_state_init_sub (script_state *oldstate)
   return newstate;
 }
 
-void script_state_destroy (script_state *state)
+void script_state_destroy (script_state_t *state)
 {
   script_obj_unref (state->global);
   script_obj_unref (state->local);
index f7a76c2bfb0e3f83dd33f31eec6bc9ef6b7194ef..5eb080df9fe190366cd50c7d5fbb055165268e35 100644 (file)
@@ -32,58 +32,58 @@ typedef enum                        /* FIXME add _t to all types */
   SCRIPT_RETURN_TYPE_RETURN,
   SCRIPT_RETURN_TYPE_BREAK,
   SCRIPT_RETURN_TYPE_CONTINUE,
-} script_return_type;
+} script_return_type_t;
 
-struct script_obj;
+struct script_obj_t;
 
 typedef struct
 {
-  script_return_type type;
-  struct script_obj *object;
-} script_return;
+  script_return_type_t type;
+  struct script_obj_t *object;
+} script_return_t;
 
 typedef struct
 {
   void *user_data;
-  struct script_obj *global;
-  struct script_obj *local;
-} script_state;
+  struct script_obj_t *global;
+  struct script_obj_t *local;
+} script_state_t;
 
 typedef enum
 {
   SCRIPT_FUNCTION_TYPE_SCRIPT,
   SCRIPT_FUNCTION_TYPE_NATIVE,
-} script_function_type;
+} script_function_type_t;
 
-typedef script_return (*script_native_function)(script_state *, void *);
+typedef script_return_t (*script_native_function_t)(script_state_t *, void *);
 
-typedef struct script_function
+typedef struct script_function_t
 {
-  script_function_type type;
+  script_function_type_t type;
   ply_list_t *parameters;           /*  list of char* typedef names */
   void *user_data;
   union
   {
-    script_native_function native;
-    struct script_op *script;
+    script_native_function_t native;
+    struct script_op_t *script;
   } data;
   bool freeable;
-} script_function;
+} script_function_t;
 
-typedef void (*script_obj_function)(struct script_obj *);
+typedef void (*script_obj_function_t)(struct script_obj_t *);
 
 typedef struct
 {
-  script_obj_function free_func;
+  script_obj_function_t free_func;
   char *name;
   void *user_data;
-} script_obj_native_class;
+} script_obj_native_class_t;
 
 typedef struct
 {
   void *object_data;
-  script_obj_native_class *class;
-} script_obj_native;
+  script_obj_native_class_t *class;
+} script_obj_native_t;
 
 typedef enum
 {
@@ -95,23 +95,23 @@ typedef enum
   SCRIPT_OBJ_TYPE_HASH,
   SCRIPT_OBJ_TYPE_FUNCTION,
   SCRIPT_OBJ_TYPE_NATIVE,
-} script_obj_type;
+} script_obj_type_t;
 
-typedef struct script_obj
+typedef struct script_obj_t
 {
-  script_obj_type type;
+  script_obj_type_t type;
   int refcount;
   union
   {
     int integer;
     float floatpoint;
     char *string;
-    struct script_obj *obj;
-    script_function *function;
+    struct script_obj_t *obj;
+    script_function_t *function;
     ply_hashtable_t *hash;
-    script_obj_native native;
+    script_obj_native_t native;
   } data;
-} script_obj;
+} script_obj_t;
 
 typedef enum
 {
@@ -150,29 +150,29 @@ typedef enum
   SCRIPT_EXP_TYPE_ASSIGN_MUL,
   SCRIPT_EXP_TYPE_ASSIGN_DIV,
   SCRIPT_EXP_TYPE_ASSIGN_MOD,
-} script_exp_type;
+} script_exp_type_t;
 
-typedef struct script_exp
+typedef struct script_exp_t
 {
-  script_exp_type type;
+  script_exp_type_t type;
   union
   {
     struct
     {
-      struct script_exp *sub_a;
-      struct script_exp *sub_b;
+      struct script_exp_t *sub_a;
+      struct script_exp_t *sub_b;
     } dual;
-    struct script_exp *sub;
+    struct script_exp_t *sub;
     char *string;
     int integer;
     float floatpoint;
     struct
     {
-      struct script_exp *name;
+      struct script_exp_t *name;
       ply_list_t *parameters;
     } function;
   } data;
-} script_exp;
+} script_exp_t;
 
 typedef enum
 {
@@ -185,58 +185,54 @@ typedef enum
   SCRIPT_OP_TYPE_RETURN,
   SCRIPT_OP_TYPE_BREAK,
   SCRIPT_OP_TYPE_CONTINUE,
-} script_op_type;
+} script_op_type_t;
 
-typedef struct script_op
+typedef struct script_op_t
 {
-  script_op_type type;
+  script_op_type_t type;
   union
   {
-    script_exp *exp;
+    script_exp_t *exp;
     ply_list_t *list;
     struct
     {
-      script_exp *cond;
-      struct script_op *op1;
-      struct script_op *op2;
+      script_exp_t *cond;
+      struct script_op_t *op1;
+      struct script_op_t *op2;
     } cond_op;
     struct
     {
-      script_exp *name;
-      script_function *function;
+      script_exp_t *name;
+      script_function_t *function;
     } function_def;
   } data;
-} script_op;
+} script_op_t;
 
 typedef struct
 {
   char *name;
-  script_obj *object;
-} script_vareable;
-
-script_function *script_function_script_new (script_op  *script,
-                                             void       *user_data,
-                                             ply_list_t *parameter_list);
-script_function *script_function_native_new (
-  script_native_function native_function,
-  void                  *user_data,
-  ply_list_t            *
-                         parameter_list);
-void script_add_native_function (script_obj            *hash,
-                                 const char            *name,
-                                 script_native_function native_function,
-                                 void                  *user_data,
-                                 const char            *first_arg,
+  script_obj_t *object;
+} script_vareable_t;
+
+script_function_t *script_function_script_new (script_op_t  *script,
+                                               void         *user_data,
+                                               ply_list_t   *parameter_list);
+script_function_t *script_function_native_new (script_native_function_t  native_function,
+                                               void                     *user_data,
+                                               ply_list_t               *parameter_list);
+void script_add_native_function (script_obj_t            *hash,
+                                 const char              *name,
+                                 script_native_function_t native_function,
+                                 void                    *user_data,
+                                 const char              *first_arg,
                                  ...);
-script_obj_native_class *script_obj_native_class_new (
-  script_obj_function free_func,
-  const char         *name,
-  void               *
-                      user_data);
-
-void script_obj_native_class_destroy (script_obj_native_class * class );
-script_state *script_state_new (void *user_data);
-script_state *script_state_init_sub (script_state *oldstate);
-void script_state_destroy (script_state *state);
+script_obj_native_class_t *script_obj_native_class_new (script_obj_function_t free_func,
+                                                        const char           *name,
+                                                        void                 *user_data);
+
+void script_obj_native_class_destroy (script_obj_native_class_t * class);
+script_state_t *script_state_new (void *user_data);
+script_state_t *script_state_init_sub (script_state_t *oldstate);
+void script_state_destroy (script_state_t *state);
 
 #endif /* SCRIPT_H */
diff --git a/src/plugins/splash/script/~script-lib-plymouth.c b/src/plugins/splash/script/~script-lib-plymouth.c
deleted file mode 100644 (file)
index 512b140..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/* script-lib-plymouth.c - script library for interacting with plymouth
- *
- * Copyright (C) 2009 Charlie Brej <cbrej@cs.man.ac.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Written by: Charlie Brej <cbrej@cs.man.ac.uk>
- */
-#define _GNU_SOURCE
-#include "ply-utils.h"
-#include "script.h"
-#include "script-parse.h"
-#include "script-execute.h"
-#include "script-object.h"
-#include "script-lib-plymouth.h"
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-
-#define STRINGIFY_VAR script_lib_plymouth_string
-
-#include "script-lib-plymouth.string"
-
-static script_return plymouth_set_function (script_state *state,
-                                            void         *user_data)
-{
-  script_obj **script_func = user_data;
-  script_obj *obj = script_obj_hash_get_element (state->local, "function");
-
-  script_obj_deref (&obj);
-  script_obj_unref (*script_func);
-
-  if (obj->type == SCRIPT_OBJ_TYPE_FUNCTION)
-    *script_func = obj;
-  else
-    {
-      *script_func = NULL;
-      script_obj_unref (obj);
-    }
-  return (script_return) {
-           SCRIPT_RETURN_TYPE_RETURN, script_obj_new_null ()
-  };
-}
-
-script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state *state)
-{
-  script_lib_plymouth_data_t *data = malloc (sizeof (script_lib_plymouth_data_t));
-
-  data->script_refresh_func = NULL;
-  data->script_boot_progress_func = NULL;
-  data->script_root_mounted_func = NULL;
-  data->script_keyboard_input_func = NULL;
-  data->script_update_status_func = NULL;
-  data->script_display_normal_func = NULL;
-  data->script_display_password_func = NULL;
-  data->script_display_question_func = NULL;
-
-  script_add_native_function (state->global,
-                              "PlymouthSetRefreshFunction",
-                              plymouth_set_function,
-                              &data->script_refresh_func,
-                              "function",
-                              NULL);
-  script_add_native_function (state->global,
-                              "PlymouthSetBootProgressFunction",
-                              plymouth_set_function,
-                              &data->script_boot_progress_func,
-                              "function",
-                              NULL);
-  script_add_native_function (state->global,
-                              "PlymouthSetRootMountedFunction",
-                              plymouth_set_function,
-                              &data->script_root_mounted_func,
-                              "function",
-                              NULL);
-  script_add_native_function (state->global,
-                              "PlymouthSetKeyboardInputFunction",
-                              plymouth_set_function,
-                              &data->script_keyboard_input_func,
-                              "function",
-                              NULL);
-  script_add_native_function (state->global,
-                              "PlymouthSetUpdateStatusFunction",
-                              plymouth_set_function,
-                              &data->script_update_status_func,
-                              "function",
-                              NULL);
-  script_add_native_function (state->global,
-                              "PlymouthSetDisplayNormalFunction",
-                              plymouth_set_function,
-                              &data->script_display_normal_func,
-                              "function",
-                              NULL);
-  script_add_native_function (state->global,
-                              "PlymouthSetDisplayPasswordFunction",
-                              plymouth_set_function,
-                              &data->script_display_password_func,
-                              "function",
-                              NULL);
-  script_add_native_function (state->global,
-                              "PlymouthSetDisplayQuestionFunction",
-                              plymouth_set_function,
-                              &data->script_display_question_func,
-                              "function",
-                              NULL);
-  data->script_main_op = script_parse_string (script_lib_plymouth_string);
-  script_return ret = script_execute (state, data->script_main_op);
-  script_obj_unref (ret.object);                /* Throw anything sent back away */
-
-  return data;
-}
-
-void script_lib_plymouth_destroy (script_lib_plymouth_data_t *data)
-{
-  script_parse_op_free (data->script_main_op);
-  script_obj_unref (data->script_refresh_func);
-  script_obj_unref (data->script_boot_progress_func);
-  script_obj_unref (data->script_root_mounted_func);
-  script_obj_unref (data->script_keyboard_input_func);
-  script_obj_unref (data->script_update_status_func);
-  script_obj_unref (data->script_display_normal_func);
-  script_obj_unref (data->script_display_password_func);
-  script_obj_unref (data->script_display_question_func);
-  free (data);
-}
-
-void script_lib_plymouth_on_refresh (script_state               *state,
-                                     script_lib_plymouth_data_t *data)
-{
-  script_obj *refresh_func_obj = data->script_refresh_func;
-
-  if (refresh_func_obj
-     && (refresh_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_return ret = script_execute_function (state,
-                                                   refresh_func_obj->data.function,
-                                                   NULL);
-      script_obj_unref (ret.object);
-    }
-}
-
-void script_lib_plymouth_on_boot_progress (script_state               *state,
-                                           script_lib_plymouth_data_t *data,
-                                           float                       duration,
-                                           float                       progress)
-{
-  script_obj *boot_progress_func_obj = data->script_boot_progress_func;
-
-  if (boot_progress_func_obj
-      && (boot_progress_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_obj *duration_obj = script_obj_new_float (duration);
-      script_obj *progress_obj = script_obj_new_float (progress);
-      script_return ret = script_execute_function (state,
-                                                   boot_progress_func_obj->data.function,
-                                                   duration_obj,
-                                                   progress_obj,
-                                                   NULL);
-      script_obj_unref (ret.object);
-      script_obj_unref (duration_obj);
-      script_obj_unref (progress_obj);
-    }
-}
-
-void script_lib_plymouth_on_root_mounted (script_state               *state,
-                                          script_lib_plymouth_data_t *data)
-{
-  script_obj *root_mounted_func_obj = data->script_root_mounted_func;
-
-  if (root_mounted_func_obj
-      && (root_mounted_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_return ret = script_execute_function (state,
-                                                   root_mounted_func_obj->data.function,
-                                                   NULL);
-      script_obj_unref (ret.object);
-    }
-}
-
-void script_lib_plymouth_on_keyboard_input (script_state               *state,
-                                            script_lib_plymouth_data_t *data,
-                                            const char                 *keyboard_input)
-{
-  script_obj *keyboard_input_func_obj = data->script_keyboard_input_func;
-
-  if (keyboard_input_func_obj
-      && (keyboard_input_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_obj *keyboard_input_obj = script_obj_new_string (keyboard_input);
-      script_return ret = script_execute_function (state,
-                                                   keyboard_input_func_obj->data.function,
-                                                   keyboard_input_obj,
-                                                   NULL);
-      script_obj_unref (keyboard_input_obj);
-      script_obj_unref (ret.object);
-    }
-}
-
-void script_lib_plymouth_on_update_status (script_state               *state,
-                                           script_lib_plymouth_data_t *data,
-                                           const char                 *new_status)
-{
-  script_obj *update_status_func_obj = data->script_update_status_func;
-
-  if (update_status_func_obj
-      && (update_status_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_obj *new_status_obj = script_obj_new_string (new_status);
-      script_return ret = script_execute_function (state,
-                                                   update_status_func_obj->data.function,
-                                                   new_status_obj,
-                                                   NULL);
-      script_obj_unref (new_status_obj);
-      script_obj_unref (ret.object);
-    }
-}
-
-void script_lib_plymouth_on_display_normal (script_state               *state,
-                                            script_lib_plymouth_data_t *data)
-{
-  script_obj *display_normal_func_obj = data->script_display_normal_func;
-
-  if (display_normal_func_obj
-      && (display_normal_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_return ret = script_execute_function (state,
-                                                   display_normal_func_obj->data.function,
-                                                   NULL);
-      script_obj_unref (ret.object);
-    }
-}
-
-void script_lib_plymouth_on_display_password (script_state               *state,
-                                              script_lib_plymouth_data_t *data,
-                                              const char                 *prompt,
-                                              int                         bullets)
-{
-  script_obj *display_password_func_obj = data->script_display_password_func;
-
-  if (display_password_func_obj
-      && (display_password_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_obj *prompt_obj = script_obj_new_string (prompt);
-      script_obj *bullets_obj = script_obj_new_int (bullets);
-      script_return ret = script_execute_function (state,
-                                                   display_password_func_obj->data.function,
-                                                   prompt_obj,
-                                                   bullets_obj,
-                                                   NULL);
-      script_obj_unref (prompt_obj);
-      script_obj_unref (bullets_obj);
-      script_obj_unref (ret.object);
-    }
-}
-
-void script_lib_plymouth_on_display_question (script_state               *state,
-                                              script_lib_plymouth_data_t *data,
-                                              const char                 *prompt,
-                                              const char                 *entry_text)
-{
-  script_obj *display_question_func_obj = data->script_display_question_func;
-
-  if (display_question_func_obj
-      && (display_question_func_obj->type == SCRIPT_OBJ_TYPE_FUNCTION))
-    {
-      script_obj *prompt_obj = script_obj_new_string (prompt);
-      script_obj *entry_text_obj = script_obj_new_string (entry_text);
-      script_return ret = script_execute_function (state,
-                                                   display_question_func_obj->data.function,
-                                                   prompt_obj,
-                                                   entry_text_obj,
-                                                   NULL);
-      script_obj_unref (prompt_obj);
-      script_obj_unref (entry_text_obj);
-      script_obj_unref (ret.object);
-    }
-}