Changeset 89dcccd4721f29950f4455a999e0f47593678065
- Timestamp:
- 04/11/10 01:48:11 (2 years ago)
- Author:
- Philip Herron <redbrain@…>
- Parents:
- b2bc0049fdf32f673fc66b045a4bb2b3ca350e40
- Children:
- 8f36f3a9825b8570f8db262e1bf3bea0a64e07d5
- git-committer:
- Philip Herron <redbrain@omicron.(none)> / 2010-04-11T01:48:11Z+0100
- Message:
-
more code time for sleep
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rb2bc004
|
r89dcccd
|
|
| 73 | 73 | |
| 74 | 74 | extern crl_symbol_obj * crl_obj_class_dispatch_symbol( const char * , crl_context_table * , |
| 75 | | enum crl_class_ctx_type_t , |
| 76 | | crl_obj_state_t * ); |
| | 75 | enum crl_class_ctx_type_t , crl_obj_state_t *, |
| | 76 | crl_symbol_obj * ); |
| | 77 | |
| | 78 | extern crl_symbol_obj * crl_obj_class_dispatch_functor( const char *, crl_context_table *, |
| | 79 | crl_obj_state_t *, crl_symbol_obj * ); |
| 77 | 80 | |
| 78 | 81 | // -------------------------------------------------------------------------- |
-
|
rb2bc004
|
r89dcccd
|
|
| 40 | 40 | |
| 41 | 41 | crl_symbol_obj * |
| 42 | | crl_obj_class_dispatch_symbol( const char * ident, |
| 43 | | crl_context_table * context, |
| 44 | | enum crl_class_ctx_type_t type, |
| 45 | | crl_obj_state_t * obj ) |
| | 42 | crl_obj_class_dispatch_functor( const char * ident, crl_context_table * context, |
| | 43 | crl_obj_state_t * obj, crl_symbol_obj * call ) |
| 46 | 44 | { |
| 47 | 45 | crl_symbol_obj *retval = NULL; |
| | 46 | |
| | 47 | crl_context_table *object_ctx = (crl_context_table*) |
| | 48 | crl_malloc( sizeof(crl_context_table) ); |
| | 49 | crl_context_init_table( &object_ctx ); |
| | 50 | crl_context_push( (obj->context), object_ctx ); |
| | 51 | |
| | 52 | |
| | 53 | |
| | 54 | |
| 48 | 55 | return retval; |
| 49 | 56 | } |
| | 57 | |
| | 58 | crl_symbol_obj * |
| | 59 | crl_obj_class_dispatch_symbol( const char * ident, crl_context_table * context, |
| | 60 | enum crl_class_ctx_type_t type, crl_obj_state_t * obj, |
| | 61 | crl_symbol_obj * functor_call ) |
| | 62 | { |
| | 63 | crl_symbol_obj *retval = NULL; |
| | 64 | |
| | 65 | switch( type ) |
| | 66 | { |
| | 67 | case T_FUNCTOR: |
| | 68 | retval = crl_obj_class_dispatch_functor( ident, context, obj, |
| | 69 | functor_call ); |
| | 70 | break; |
| | 71 | |
| | 72 | default: |
| | 73 | crl_error("unhandled type!\n"); |
| | 74 | break; |
| | 75 | } |
| | 76 | |
| | 77 | return retval; |
| | 78 | } |
-
|
rb2bc004
|
r89dcccd
|
|
| 1073 | 1073 | if( o ) |
| 1074 | 1074 | { |
| | 1075 | crl_assert( sym->op_a_t == TYPE_SYMBOL ); |
| | 1076 | // dispatch the object __init__ function on construction! |
| | 1077 | crl_symbol_obj *rr = crl_obj_class_dispatch_symbol( "__init__", context, T_FUNCTOR, |
| | 1078 | retval->op_a.object_state, |
| | 1079 | sym->op_a.symbol_table ); |
| | 1080 | if( rr ) |
| | 1081 | { |
| | 1082 | if( rr->op_a_t != TYPE_SYMBOL_NIL ) |
| | 1083 | { |
| | 1084 | crl_warning( "object <%s> __init__ did not return Nil!\n", |
| | 1085 | object_ident ); |
| | 1086 | } |
| | 1087 | } |
| | 1088 | else |
| | 1089 | { |
| | 1090 | crl_fatal("error initilzing object <%s>!\n", object_ident ); |
| | 1091 | } |
| | 1092 | |
| | 1093 | // nothing to do with it... |
| | 1094 | crl_garbage_mark_obj( &rr ); |
| | 1095 | |
| 1075 | 1096 | crl_symbol_init( retval ); |
| 1076 | 1097 | retval->type = SYMBOL_PRIMARY; |
| … |
… |
|
| 1078 | 1099 | retval->op_a.object_state = crl_context_clone_obj_state( o ); |
| 1079 | 1100 | |
| 1080 | | // dispatch the object __init__ function on construction! |
| 1081 | | crl_symbol_obj *rr = crl_obj_class_dispatch_symbol( "__init__", context, T_FUNCTOR, |
| 1082 | | retval->op_a.object_state ); |
| 1083 | | if( rr->op_a_t != TYPE_SYMBOL_NIL ) |
| 1084 | | { |
| 1085 | | crl_warning( "object <%s> __init__ did not return Nil!\n", |
| 1086 | | object_ident ); |
| 1087 | | } |
| 1088 | | // nothing to do with it... |
| 1089 | | crl_garbage_mark_obj( &rr ); |
| 1090 | | |
| 1091 | | |
| | 1101 | // its now initilized! |
| | 1102 | retval->op_a.object_state = CLASS_INIT; |
| 1092 | 1103 | } |
| 1093 | 1104 | else |
-
|
r210169d
|
r89dcccd
|
|
| 23 | 23 | (define-generic-mode 'crules-mode |
| 24 | 24 | '("#") |
| 25 | | '("workflow" "class" "rule" "defun" "each" "break" "where" |
| 26 | | "continue" "return" "in" "for" "while" "until" "import" |
| 27 | | "from" "if" "elif" "else" "print" "true" "false" "eval" |
| 28 | | "let" "null" "this" "at" "defre") |
| | 25 | '("object" "defun" "break" "continue" |
| | 26 | "return" "for" "while" "import" "if" |
| | 27 | "elif" "else" "print" ) |
| 29 | 28 | '(("[a-zA-Z_][a-zA-Z0-9_]+" . font-lock-variable-name-face) |
| 30 | | ("[0-9]+" "true" "false" . font-lock-constant-face) |
| | 29 | ("[0-9]+" "[0-9]+.[0-9]+" |
| | 30 | "true" "false" "nil" . font-lock-constant-face) |
| 31 | 31 | ("\\[.*\\]" . font-lock-type-face)) |
| 32 | 32 | '(".crl\\'") |