]> Nishi Git Mirror - gwion.git/commitdiff
:art: Prefer size_t over m_uint were applicable
authorfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 12 Dec 2018 16:31:38 +0000 (17:31 +0100)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 12 Dec 2018 16:31:38 +0000 (17:31 +0100)
13 files changed:
include/arg.h
include/array.h
include/emit.h
include/env.h
include/func.h
include/gwi.h
include/nspc.h
include/object.h
include/oo.h
include/shreduler_private.h
include/type.h
include/value.h
include/vm.h

index b5dba2f2c5bea7b80b32a1f510b32f48a6e2190f..09c4179acb924b670b35ea00a7184b197e5b66e8 100644 (file)
@@ -3,12 +3,12 @@
 typedef struct {
   int argc;
   char** argv;
-  m_uint quit;
   struct Vector_ add;
   struct Vector_ rem;
   struct Vector_ lib;
   Vector ref;
   m_bool loop;
+  unsigned quit : 1;
 } Arg;
 
 ANN void arg_init(Arg* arg);
index 72e4d7e7fb0d9029b20c96f537839942fc27892e..7b96e5d3a137f0cadd817846ab35e2f7055eb5cb 100644 (file)
@@ -9,10 +9,10 @@ typedef struct ArrayInfo_ {
   M_Object* data;
   union {
     m_int* idx;    // for object array
-    m_uint length; // array init
+    size_t length; // array init
   } d;
-  unsigned is_ref;
-  unsigned is_obj;
+  unsigned is_ref : 1;
+  unsigned is_obj : 1;
 } ArrayInfo;
 
 ANN m_uint     m_vector_size(const M_Vector v);
index 94dd524205b4c8ea096735251549fb822bf6b115..2f1e7b2ef44da0e1795b598b695a7a6650bb3715 100644 (file)
@@ -2,13 +2,13 @@
 #define EMIT_H
 
 typedef struct Frame_ {
-  m_uint curr_offset;
+  size_t curr_offset;
   struct Vector_ stack;
 } Frame;
 
 typedef struct Code_ {
   m_str  name;
-  m_uint stack_depth;
+  size_t stack_depth;
   struct Vector_ instr;
   struct Vector_ stack_cont, stack_break, stack_return;
   Frame* frame;
index 7dcb2fde7ff0fa279d97fd37751b8c4412a7472d..46374828c40c292a37c0080338dd6255a2fa8825 100644 (file)
@@ -5,10 +5,10 @@
 #define NSPC(a) { nspc_push_value(env->curr); SCOPE(a); nspc_pop_value(env->curr); }
 
 struct Switch_ {
-  m_uint   default_case_index;
   struct Vector_ exp;
   Vector vec;
   Map cases;
+  size_t default_case_index;
 };
 
 typedef struct Env_       * Env;
@@ -16,11 +16,9 @@ struct Env_ {
   m_str name;
   Nspc curr;
   Nspc global_nspc;
-  m_uint    scope;
   struct Context_ *context;
   Type      class_def;
   Func      func;
-  m_uint type_xid;
   struct Gwion_ *gwion;
   struct Vector_    nspc_stack;
   struct Vector_    class_stack;
@@ -28,6 +26,8 @@ struct Env_ {
   struct Vector_    conts;
   struct Vector_    known_ctx;
   struct Switch_* sw;
+  size_t scope;
+  size_t type_xid;
 };
 
 ANEW Env new_env();
index 012a767b4263ab11df5e65fa8b1bb77e31e27d6e..813f90e68d4b4c7243aa5fd0a91668d1fbc61a20 100644 (file)
@@ -6,8 +6,8 @@ struct Func_ {
   struct VM_Code_* code;
   Value value_ref;
   Func next;
-  m_uint vt_index;
   struct Instr_* variadic;
+  size_t vt_index;
   ae_flag flag;
   HAS_OBJ
 };
index 1aab9948397e86bb035d6d47ce19a8d622800b1b..cf499d1c1aebcaf060694bed42ce659bfdf66371 100644 (file)
@@ -5,7 +5,7 @@ typedef struct {
   struct Var_Decl_List_ list;
   struct Var_Decl_ var;
   struct Exp_ exp;
-  m_uint array_depth;
+  size_t array_depth;
 } DL_Var;
 
 typedef struct {
@@ -17,8 +17,8 @@ typedef struct {
   m_str    name;
   m_str    type;
   f_xfun   addr;
-  m_uint   narg;
   DL_Value args[DLARG_MAX];
+  uint narg;
 } DL_Func;
 
 typedef struct {
@@ -29,8 +29,8 @@ typedef struct {
 } DL_Oper;
 
 typedef struct {
-  m_uint n;
   m_str* list;
+  size_t n;
 } Templater;
 
 typedef struct {
index a4c482aa01e71b9f5d8541f6d91f5947eaccfc6d..ccf7d636073e7261eab7e674e81d804ac9c36dee 100644 (file)
@@ -2,17 +2,17 @@
 #define __NSPC
 struct Nspc_ {
   m_str     name;
-  m_uint    offset;
   Nspc parent;
   struct VM_Code_*   pre_ctor;
   struct VM_Code_*   dtor;
   m_bit* class_data;
-  m_uint    class_data_size;
   struct Vector_    vtable;
   struct Map_          op_map;
   struct Scope_     value;
   struct Scope_     type;
   struct Scope_     func;
+  size_t offset;
+  size_t class_data_size;
   HAS_OBJ
 };
 
index 28886f279e22f725bdc93466dfa7692950ff1672..20afdbb1e196b45af2a8686a5d6d531673c38b9b 100644 (file)
@@ -3,9 +3,9 @@
 typedef struct M_Object_  * M_Object;
 struct M_Object_ {
   m_bit* data;
-  m_uint ref;
   Type type_ref;
   struct pool* p;
+  size_t ref;
 };
 
 ANN void instantiate_object(const VM_Shred, const Type);
index a9c05d7f982a1fadeb86f3292d609f4fef3f76e4..566898b33a51fe40cd6223f0f9ced679d5ad4690 100644 (file)
@@ -12,7 +12,7 @@ typedef enum {
 } e_obj;
 
 struct VM_Object_ {
-  m_uint ref_count;
+  size_t ref_count;
   e_obj  type;
 } __attribute__((packed));
 
index 58a0a7fd1b8c2d85bca9609c7544059269add9da..f5bd37d194d47a078996bbf754a6b73db4d8d8a9 100644 (file)
@@ -4,8 +4,8 @@ struct  Shreduler_ {
   VM* vm;
   VM_Shred list;
   VM_Shred curr;
-  m_uint shred_ids;
   struct Vector_ shreds;
+  size_t shred_ids;
   m_bool   loop;
 };
 #endif
index 63e25674c997713b0c309307df0d3d11a814ec34..21cd99e4d7ead8d64b485fa7d1286c4ceccf8d5f 100644 (file)
@@ -2,19 +2,19 @@
 #define __TYPE
 
 struct Type_ {
-  m_uint    xid;
-  m_uint    size;
   m_str     name;
   Nspc      nspc;
   Type      parent;
   Nspc      owner;
-  m_uint    array_depth;
   Class_Def def;
   union type_data {
     Func      func;
     Type      base_type;
   } d;
   struct pool* p;
+  size_t xid;
+  size_t size;
+  size_t array_depth;
   ae_flag flag;
   HAS_OBJ
 };
index 4e77f33fc4743543714b1549ca4ab6de7c6d3887..541ae20443214796722576709153a23c848ce45d 100644 (file)
@@ -5,12 +5,12 @@ struct Value_ {
   m_str name;
   Nspc owner;
   Type owner_class;
-  m_uint offset;
   union value_data{
     m_uint* ptr;
     Func func_ref;
   } d;
   struct Gwion_ *gwion;
+  size_t offset;
   ae_flag flag;
   HAS_OBJ
 };
index 7d48548c6b895234063c7019e7ef961bcf912b29..b0f92b5fe463175de8b051db19295ced0ccacac7 100644 (file)
@@ -9,9 +9,9 @@ typedef struct VM_Code_* VM_Code;
 struct VM_Code_ {
   Vector instr;
   m_str name;
-  m_uint stack_depth;
   m_uint native_func;
   void* memoize;
+  size_t stack_depth;
   ae_flag flag;
   HAS_OBJ
 };
@@ -44,7 +44,6 @@ struct VM_Shred_ {
   m_bit* mem;
   m_bit* _reg;
   m_bit* base;
-  m_uint pc, xid;
   m_str name;
   VM* vm;
   VM_Shred prev, next;
@@ -52,6 +51,7 @@ struct VM_Shred_ {
   struct M_Object_* me;
   struct Vector_ child;
   struct Vector_ gc;//, gc1;
+  size_t pc, xid;
   m_float wake_time;
 };
 ANN2(4) ANEW VM_Code new_vm_code(const Vector instr, const m_uint stack_depth, const m_bool need_this, const m_str name);