Changeset 622


Ignore:
Timestamp:
09/04/10 19:16:57 (17 months ago)
Author:
mooneer
Message:

Added inherit_list object to enable primitive multiple inheritance (at least, as allowable by Kite syntax and semantics).

Location:
interpreter/trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • interpreter/trunk/backend/common/kite_lexer.l

    r617 r622  
    9292null { fillBoth(yyscanner); return NULL_VALUE; } 
    9393version { fillBoth(yyscanner); return VERSION_KEYWORD; } 
     94options[ \t\r\n]+set { fillBoth(yyscanner); return OPTIONS_SET; } 
    9495 
    9596"<<" { fillBoth(yyscanner); return LEFT_SHIFT; } 
  • interpreter/trunk/backend/common/kite_parser.y

    r619 r622  
    5454extern int yylex(void *, void *, void *); 
    5555 
     56/* Need to grab dylib path from compiler. TODO: use separate method to manipulate. */ 
     57extern char *kite_dylib_path; 
    5658%} 
    5759 
     
    111113%token REGEX_VALUE_CI 
    112114%token ARRAY_SET 
     115%token OPTIONS_SET 
    113116 
    114117/* Needed since we can't quite lay out the associativity using the rules yet. */ 
     
    182185statement: 
    183186    | data_manipulation_statement 
     187    | options_set_statement 
    184188    | loop_statement 
    185189    | from_statement 
     
    196200    | operator_definition 
    197201    ; 
    198      
     202 
     203options_set_statement:  OPTIONS_SET STRING_VALUE STRING_VALUE { 
     204    if (strcmp("import_path", $<stringValue>2) == 0) 
     205    { 
     206        /* TODO: thread safety */ 
     207        char *old_kite_dylib_path = kite_dylib_path; 
     208#ifndef HAVE_GC_H 
     209        kite_dylib_path = malloc(strlen(old_kite_dylib_path) + strlen($<stringValue>3) + 2); 
     210#else 
     211        kite_dylib_path = GC_malloc(strlen(old_kite_dylib_path) + strlen($<stringValue>3) + 2); 
     212#endif 
     213        strcpy(kite_dylib_path, old_kite_dylib_path); 
     214        strcat(kite_dylib_path, ":"); 
     215        strcat(kite_dylib_path, $<stringValue>3); 
     216    } 
     217    else 
     218    { 
     219        /* TODO: throw exception if no valid option found. */ 
     220    } 
     221}; 
     222 
    199223import_statement:    IMPORT STRING_VALUE     { 
    200224        kite_compiler_t *compiler = (kite_compiler_t*)yyget_extra(parm); 
  • interpreter/trunk/backend/kite-vm-1.0/kite_execute.c

    r619 r622  
    447447        KITE_FIND_ANY_IN_SYMTAB(entry, curr->object_data.properties, name); 
    448448        if (entry) { 
    449             if ((!entry->global && obj != curr) || 
     449            if ((!entry->global && obj != curr && curr->type != OBJ_INSTANCE) || 
    450450                (entry->value && entry->value->type == OBJ_METHOD &&  
    451451                 obj != curr)) { 
  • interpreter/trunk/docs/version.texi

    r621 r622  
    1 @set UPDATED 21 December 2008 
     1@set UPDATED 16 December 2008 
    22@set UPDATED-MONTH December 2008 
    33@set EDITION 1.0.4 
  • interpreter/trunk/modules/Makefile.am

    r594 r622  
    2121        interface/text.kt interface/text/readline.kt interface/text/base64.kt \ 
    2222        interface/text/binary.kt interface/pop3.kt interface/smtp.kt all_modules.kt \ 
    23         System/compile_options.kt System/package/builder.kt local-pkgs/blank.kt 
     23        System/compile_options.kt System/package/builder.kt local-pkgs/blank.kt inherit_list.kt 
    2424 
    2525AM_CFLAGS = -Wdeclaration-after-statement -Wextra -fno-omit-frame-pointer -ISystem/digest/ -I../objs -I../backend/common -fPIC -W -Wall -DCINVOKE_BUILD 
  • interpreter/trunk/modules/System/object.c

    r619 r622  
    777777     
    778778    kite_add_method(thd, this, KITE_GET_STRING_VALUE(name), method); 
     779} 
     780 
     781/***************************************************************************** 
     782 * Call method on given object. 
     783 ****************************************************************************/ 
     784KITE_CLASS_METHOD(Object_callWithObject) 
     785{ 
     786    kite_object_t *method, *a; 
     787 
     788    KITE_GET_METHOD_ARGUMENT(method, 1); 
     789    KITE_GET_METHOD_ARGUMENT(a, 2); 
     790     
     791    if (method->type == OBJ_METHOD) 
     792    { 
     793        kite_vm_call_object(thd, this, method, a); 
     794    } 
     795    else 
     796    { 
     797        kite_vm_call_method(thd, this, KITE_GET_STRING_VALUE(method), a, TRUE); 
     798    } 
    779799} 
    780800 
     
    899919                                  "name", "The method's name.", 
    900920                                  "numargs", "The number of arguments of the given method.")); 
     921    kite_add_method(thread, newclass, "call_with_object", 
     922        kite_new_method_compiled_with_docs(thread, Object_callWithObject, 
     923                                  "Calls the given method with the given arguments.", 2, 
     924                                  "m", "The method object or name to call.", 
     925                                  "args", "The list of method arguments to pass in.")); 
    901926    kite_add_method(thread, newclass, "get_destructor", 
    902927        kite_new_method_compiled_with_docs(thread, Object_getDestructor,  
  • interpreter/trunk/tests/check_tests.sh

    r570 r622  
    1818rm -f $LOC/test.log 
    1919cd $LOC/tmp/lib/kite 
    20 for i in `find $LOC/tests -name '*.kt' | grep -v '.svn'`; do 
     20for i in `find $LOC/tests -name '[A-Za-z]*.kt' | grep -v '.svn'`; do 
    2121        echo -n "$i: " 
    2222        echo "$i:" >>$LOC/test.log 
Note: See TracChangeset for help on using the changeset viewer.