Browse Source

Merge pull request #247 from fingolfin/mh/typos

Fix a bunch of typos
Marco Bambini 7 years ago
parent
commit
c34710e158

+ 3 - 3
src/cli/gravity.c

@@ -32,7 +32,7 @@ typedef enum  {
     OP_COMPILE,         // just compile source code and exit
     OP_RUN,             // just run an already compiled file
     OP_COMPILE_RUN,     // compile source code and run it
-    OP_INLINE_RUN,      // compile and execure source passed inline
+    OP_INLINE_RUN,      // compile and execute source passed inline
     OP_REPL,            // run a read eval print loop
     OP_UNITTEST         // unit test mode
 } op_type;
@@ -70,7 +70,7 @@ static const char *load_file (const char *file, size_t *size, uint32_t *fileid,
 	// import "../file2"
 	// import "/full_path_to_file2"
 
-	// it is callback's responsability to resolve file path based on current working directory
+	// it is callback's responsibility to resolve file path based on current working directory
 	// or based on user defined search paths
 	// and returns:
 	// size of file in *size
@@ -78,7 +78,7 @@ static const char *load_file (const char *file, size_t *size, uint32_t *fileid,
 	// content of file as return value of the function
 
 	// fileid will then be used each time an error is reported by the compiler
-	// so it is responsability of this function to map somewhere the association
+	// so it is responsibility of this function to map somewhere the association
 	// between fileid and real file/path name
 
 	// fileid is not used in this example

+ 4 - 4
src/runtime/gravity_core.c

@@ -61,10 +61,10 @@
 // Special note about Null class
 //
 // Every value in gravity is initialized to Null
-// and can partecipate in math operations.
+// and can participate in math operations.
 // This class should be defined in a way to do be
-// less dangerous as possibile and a Null value should
-// be interpreted as a zero number (where possibile).
+// less dangerous as possible and a Null value should
+// be interpreted as a zero number (where possible).
 
 static bool core_inited = false;        // initialize global classes just once
 static uint32_t refcount = 0;           // protect deallocation of global classes
@@ -424,7 +424,7 @@ inline gravity_value_t convert_value2string (gravity_vm *vm, gravity_value_t v)
         return VALUE_FROM_CSTRING(vm, buffer);
     }
     
-    // check if class implements the String method (avoiding infinte loop by checking for convert_object_string)
+    // check if class implements the String method (avoiding infinite loop by checking for convert_object_string)
     gravity_closure_t *closure = gravity_vm_fastlookup(vm, gravity_value_getclass(v), GRAVITY_STRING_INDEX);
 
     // sanity check (and break recursion)

+ 6 - 6
src/runtime/gravity_vm.c

@@ -45,11 +45,11 @@ struct gravity_vm {
 
     // recursion
     gravity_int_t       maxrecursion;                   // maximum recursive depth
-    gravity_int_t       recursioncount;                 // recustion counter
+    gravity_int_t       recursioncount;                 // recursion counter
     
     // anonymous names
     uint32_t            nanon;                          // counter for anonymous classes (used in object_bind)
-    char                temp[64];                       // temprary buffer used for anonymous names generator
+    char                temp[64];                       // temporary buffer used for anonymous names generator
 
     // callbacks
     vm_transfer_cb      transfer;                       // function called each time a gravity_object_t is allocated
@@ -191,7 +191,7 @@ gravity_value_t gravity_vm_keyindex (gravity_vm *vm, uint32_t index) {
 static inline gravity_callframe_t *gravity_new_callframe (gravity_vm *vm, gravity_fiber_t *fiber) {
     #pragma unused(vm)
 
-    // check if there are enought slots in the call frame and optionally create new cframes
+    // check if there are enough slots in the call frame and optionally create new cframes
     if (fiber->framesalloc - fiber->nframes < 1) {
         uint32_t new_size = fiber->framesalloc * 2;
         void *ptr = mem_realloc(NULL, fiber->frames, sizeof(gravity_callframe_t) * new_size);
@@ -250,7 +250,7 @@ static inline bool gravity_check_stack (gravity_vm *vm, gravity_fiber_t *fiber,
         fiber->frames[i].stackstart += offset;
     }
 
-    // adjust upvalues ptr offeset
+    // adjust upvalues ptr offset
     gravity_upvalue_t* upvalue = fiber->upvalues;
     while (upvalue) {
         upvalue->value += offset;
@@ -268,7 +268,7 @@ static inline bool gravity_check_stack (gravity_vm *vm, gravity_fiber_t *fiber,
 
 static gravity_upvalue_t *gravity_capture_upvalue (gravity_vm *vm, gravity_fiber_t *fiber, gravity_value_t *value) {
     // closures and upvalues implementation inspired by Lua and Wren
-     // fiber->upvalues list must be ORDERED by the level of the corrisponding variables in the stack starting from top
+     // fiber->upvalues list must be ORDERED by the level of the corresponding variables in the stack starting from top
 
     // if upvalues is empty then create it
     if (!fiber->upvalues) {
@@ -663,7 +663,7 @@ static bool gravity_vm_exec (gravity_vm *vm) {
                     SETVALUE(r1, VALUE_FROM_BOOL((op == EQ) ? eq_result : !eq_result));
                     DISPATCH();
                 } else if (VALUE_ISA_INT(v2) && VALUE_ISA_INT(v3)) {
-                    // INT optimization expecially useful in loops
+                    // INT optimization especially useful in loops
                     if (v2.n == v3.n) SETVALUE(r1, VALUE_FROM_INT(0));
                     else SETVALUE(r1, VALUE_FROM_INT((v2.n > v3.n) ? 1 : -1));
                 } else {

+ 1 - 1
src/shared/gravity_delegate.h

@@ -69,7 +69,7 @@ typedef struct {
     gravity_precode_callback    precode_callback;       // called at parse time in order to give the opportunity to add custom source code
     gravity_loadfile_callback   loadfile_callback;      // callback to give the opportunity to load a file from an import statement
     gravity_filename_callback   filename_callback;      // called while reporting an error in order to be able to convert a fileid to a real filename
-    gravity_optclass_callback   optional_classes;       // optional classes to be exposed to the semantic checher as extern (to be later registered)
+    gravity_optclass_callback   optional_classes;       // optional classes to be exposed to the semantic checker as extern (to be later registered)
 
     // bridge
     gravity_bridge_initinstance bridge_initinstance;    // init class

+ 2 - 2
src/shared/gravity_opcodes.h

@@ -21,7 +21,7 @@
  */
 
 /*
-        Instructions are 32bit in lenght
+        Instructions are 32bit in length
 
         // 2 registers and 1 register/constant
         +------------------------------------+
@@ -63,7 +63,7 @@ typedef enum {
     //      --------        ----------          ------------------------------------        ----------------------------
     //
                                                 //  *** GENERAL COMMANDS (5) ***
-            RET0 = 0,       //  NONE            //  return nothing from a function          MUST BE THE FIRST OPCODE (because an implict 0 is added
+            RET0 = 0,       //  NONE            //  return nothing from a function          MUST BE THE FIRST OPCODE (because an implicit 0 is added
                                                 //                                          as a safeguard at the end of any bytecode
             HALT,           //  NONE            //  stop VM execution
             NOP,            //  NONE            //  NOP                                     http://en.wikipedia.org/wiki/NOP

+ 8 - 8
src/shared/gravity_value.h

@@ -17,11 +17,11 @@
 
 // Gravity is a dynamically typed language so a variable (gravity_value_t) can hold a value of any type.
 
-// The representation of values in a dynamicly typed language is very important since it can lead to a big
-// difference in terms of performance. Such representation has several contraints:
+// The representation of values in a dynamically typed language is very important since it can lead to a big
+// difference in terms of performance. Such representation has several constraints:
 // - fast access
 // - must represent several kind of values
-// - be able to cope with the gargabe collector
+// - be able to cope with the garbage collector
 // - low memory overhead (when allocating a lot of small values)
 
 // In modern 64bit processor with OS that always returns aligned allocated memory blocks that means that each ptr is 8 bytes.
@@ -32,8 +32,8 @@
 // Other types like classes, instances, functions, lists, and strings are all reference types. They are stored on the heap and
 // the gravity_value_t just stores a pointer to it.
 
-// So each value is a pointer to a FIXED size block of memory (16 bytes). Having all values of the same size greatly reduce the complexitly
-// of a memory pool and since allocating a large amount of values is very commond is a dynamicly typed language like Gravity.
+// So each value is a pointer to a FIXED size block of memory (16 bytes). Having all values of the same size greatly reduce the complexity
+// of a memory pool and since allocating a large amount of values is very common is a dynamically typed language like Gravity.
 // In a future update I could introduce NaN tagging and squeeze value size to 8 bytes (that would mean nearly double performance).
 
 // Internal settings to set integer and float size.
@@ -75,7 +75,7 @@ extern "C" {
 #endif
 
 #ifndef GRAVITY_ENABLE_INT64
-#define GRAVITY_ENABLE_INT64                1           // if 1 enable gravity_int_t to be a 64bit int (intead of a 32bit int)
+#define GRAVITY_ENABLE_INT64                1           // if 1 enable gravity_int_t to be a 64bit int (instead of a 32bit int)
 #endif
 
 #ifndef GRAVITY_COMPUTED_GOTO
@@ -294,7 +294,7 @@ typedef struct {
     gravity_class_t         *isa;           // to be an object
     gravity_gc_t            gc;             // to be collectable by the garbage collector
 
-    gravity_value_r         array;          // dinamic array of values
+    gravity_value_r         array;          // dynamic array of values
 } gravity_list_t;
 
 typedef struct {
@@ -389,7 +389,7 @@ typedef struct {
     gravity_gc_t            gc;             // to be collectable by the garbage collector
 
     char                    *s;             // pointer to NULL terminated string
-    uint32_t                hash;           // string hash (type to be keeped in sync with gravity_hash_size_t)
+    uint32_t                hash;           // string hash (type to be keept in sync with gravity_hash_size_t)
     uint32_t                len;            // actual string length
     uint32_t                alloc;          // bytes allocated for string
 } gravity_string_t;