Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | fixes and changes for apwtcl version as eclipse library. |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1d9ced18e432ac6a32c3ad22d086c3a7 |
User & Date: | arnulf 2014-02-03 09:04:18.353 |
Context
2014-02-06
| ||
19:57 | fixes for makeing loading of gles20 PackageCommand possible. Support of some OBJ_TYPE_DOUBLE functions. check-in: b6251dec71 user: arnulf tags: trunk | |
2014-02-03
| ||
09:04 | fixes and changes for apwtcl version as eclipse library. check-in: 1d9ced18e4 user: arnulf tags: trunk | |
2012-04-20
| ||
22:48 | fixes. This version runs the wtk test suite completely with success check-in: 852e328e3b user: arnulf tags: trunk | |
Changes
Changes to src/org/apwtcl/lang/ApwtclClassLoader.java.
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | /* ==================== ApwtclClassLoader ================================== */ public ApwtclClassLoader(Interp interp, String path) { oid++; id = oid; this.path = path; } /* ==================== mySelf ================================== */ public String mySelf() { String str = "ApwtclClassLoader!"+id+"!"; return str; } | > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /* ==================== ApwtclClassLoader ================================== */ public ApwtclClassLoader(Interp interp, String path) { oid++; id = oid; this.path = path; System.out.println("ApwtclClassLoader!"+path+"!"); } /* ==================== mySelf ================================== */ public String mySelf() { String str = "ApwtclClassLoader!"+id+"!"; return str; } |
︙ | ︙ | |||
54 55 56 57 58 59 60 | /* ==================== myFindClass ===================================== */ public Class<?> myFindClass(String name) { Class<?> my_class = null; String class_name = null; try { class_name = path.replaceAll("/",".")+"."+name; my_class = Class.forName(class_name, false, this); | | | | | | > > | > > > > > > > > > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | /* ==================== myFindClass ===================================== */ public Class<?> myFindClass(String name) { Class<?> my_class = null; String class_name = null; try { class_name = path.replaceAll("/",".")+"."+name; my_class = Class.forName(class_name, false, this); System.out.println("found class!"+name+"!"+my_class+"!"); } catch (Exception e) { System.out.println("not found!"+class_name+"!"+e.getMessage()+"!"); byte[] b = loadClassData(name); System.out.println("name!"+name+"!"); name = path.replaceAll("/",".")+"."+name; System.out.println("name2!"+name+"!"); return defineClass(name, b, 0, b.length); } return my_class; } /* ==================== loadClassData ===================================== */ private byte[] loadClassData(String name) { // File file = new File("/home/arnulf/workspace/apwtcl/bin/"+path+"/"+name+".class"); File file = new File(path+"/"+name+".class"); System.out.println("FF!"+file+"!"+file.canRead()+"!"+file.length()+"!"); int len = (int)file.length(); FileInputStream fin = null; try { fin = new FileInputStream(file); } catch (Exception e) { System.out.println("Exception fin!"+e.getMessage()+"!"); // file = new File(path+"/"+name+".class"); file = new File("/home/arnulf/workspace/apwtcl/bin/"+path+"/"+name+".class"); len = (int)file.length(); try { fin = new FileInputStream(file); } catch (Exception e1) { System.out.println("Exception 2 fin!"+e1.getMessage()+"!"); return null; } } //System.out.println("FFin!"+fin+"!"); byte[] b = new byte[len]; try { fin.read(b); fin.close(); } catch (Exception e) { System.out.println("Exception read!"+e.getMessage()+"!"); } //System.out.println("RES!"+res+"!"); return b; } } |
Changes to src/org/apwtcl/lang/CommandOption.java.
︙ | ︙ | |||
18 19 20 21 22 23 24 | import java.util.ArrayList; import java.util.HashMap; public class CommandOption extends Token implements Debug { private static int oid = 0; private int id; | < < | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | import java.util.ArrayList; import java.util.HashMap; public class CommandOption extends Token implements Debug { private static int oid = 0; private int id; public String opt_name; /* Name of this option */ public int opt_code; /* Defined value for this option */ /* the code has to be a unique bit! within an OptionList */ public int opt_has_value; /* this option has a value =1 or not = 0 or it can have one or not = -1*/ public ArrayList<ApwtclObj> default_value; /* value for that option to be used as default */ public HashMap<String, Integer> allowed_option_values; /* allowed values for that option */ /* ==================== CommandOption ================================== */ public CommandOption(Interp interp, String opt_name, int opt_code, int opt_has_value, ArrayList<ApwtclObj> default_value, HashMap<String, Integer> allowed_option_values) { oid++; id = oid; this.opt_name = opt_name; this.opt_code = opt_code; this.opt_has_value = opt_has_value; this.default_value = default_value; this.allowed_option_values = allowed_option_values; } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/Defines.java.
︙ | ︙ | |||
11 12 13 14 15 16 17 | * * Copyright 2012 Arnulf P. Wiedemann * */ package org.apwtcl.lang; | < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * * Copyright 2012 Arnulf P. Wiedemann * */ package org.apwtcl.lang; import java.util.Hashtable; public class Defines extends Object { public static final int OK = 0; public static final int ERROR = 1; public static final int RETURN = 2; public static final int BREAK = 3; public static final int CONTINUE = 4; |
︙ | ︙ |
Changes to src/org/apwtcl/lang/EvalStatement.java.
︙ | ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 | } switch (my_ret) { case OK: case RETURN: if (my_ret == RETURN) { print("+++substonetoken RETURN!"); } obj_ptr = interp.result; break; case BREAK: /* Stop substituting */ result_ptr.add(null); return BREAK; case CONTINUE: | > | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | } switch (my_ret) { case OK: case RETURN: if (my_ret == RETURN) { print("+++substonetoken RETURN!"); } //print("SUBST!"+interp.result+"!"); obj_ptr = interp.result; break; case BREAK: /* Stop substituting */ result_ptr.add(null); return BREAK; case CONTINUE: |
︙ | ︙ | |||
802 803 804 805 806 807 808 | interp.setEmptyResult(); if (cmd_ptr.is_proc) { //print("call callProcedure!"+objc+"!"+objv+"!"); retcode = interp.command_obj_type.callProcedure(cmd_ptr, file_name_obj, line_no, objc, objv); //print("after callProcedure!"); } else { interp.cmd_priv_data = cmd_ptr.native_fcn.privdata; | | | 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 | interp.setEmptyResult(); if (cmd_ptr.is_proc) { //print("call callProcedure!"+objc+"!"+objv+"!"); retcode = interp.command_obj_type.callProcedure(cmd_ptr, file_name_obj, line_no, objc, objv); //print("after callProcedure!"); } else { interp.cmd_priv_data = cmd_ptr.native_fcn.privdata; // Object ret = null; try { // ret = cmd_ptr.native_fcn.cmd_proc.invoke(cmd_ptr.native_fcn.instance, interp, objv); retcode = (Integer)cmd_ptr.call(interp, objv, /* ensemble_expand */ true); } catch (Exception e) { e.printStackTrace(); System.out.println("Exception call2!"+e.getMessage()+"!"); } |
︙ | ︙ | |||
983 984 985 986 987 988 989 | } } } /* ==================== appendStackTrace ===================================== */ /* Returns 1 if the stack trace information was used or 0 if not */ public void appendStackTrace(String procname, ApwtclObj file_name_obj, int linenr) { | | | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | } } } /* ==================== appendStackTrace ===================================== */ /* Returns 1 if the stack trace information was used or 0 if not */ public void appendStackTrace(String procname, ApwtclObj file_name_obj, int linenr) { if (procname != null && procname.equals("unknown")) { procname = ""; } if (procname == null && file_name_obj.getStringLength() == 0) { /* No useful info here */ return; } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/Helpers.java.
︙ | ︙ | |||
13 14 15 16 17 18 19 | * */ package org.apwtcl.lang; import java.io.File; import java.io.FileInputStream; | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * */ package org.apwtcl.lang; import java.io.File; import java.io.FileInputStream; // import java.lang.reflect.Method; import java.util.ArrayList; public class Helpers extends Defines { /* ==================== Helpers ================================== */ public Helpers() { } |
︙ | ︙ | |||
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | return null; } long len = file.length(); //print("len!"+len+"!"); byte[] bytes = new byte[(int)len]; try { int my_len = file_st.read(bytes); if (my_len != (int)len) { interp.setResultString("cannot read full file: "+url+"! got: "+my_len+" expected: "+len); return null; } } catch (Exception e) { interp.setResultString("no such file: "+url+"!"); return null; } //print("file contents!"+new String(bytes)+"!"); return new String(bytes); } /* ==================== source ===================================== */ public int source(Interp interp, String url) { String response_text; ApwtclObj script; | > < | | | | | | < > | | | < > | | < > | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | return null; } long len = file.length(); //print("len!"+len+"!"); byte[] bytes = new byte[(int)len]; try { int my_len = file_st.read(bytes); file_st.close(); if (my_len != (int)len) { interp.setResultString("cannot read full file: "+url+"! got: "+my_len+" expected: "+len); return null; } } catch (Exception e) { interp.setResultString("no such file: "+url+"!"); return null; } //print("file contents!"+new String(bytes)+"!"); return new String(bytes); } /* ==================== source ===================================== */ public int source(Interp interp, String url) { String response_text; ApwtclObj script; // Method read_file = null; // Method read_fcn = null; // Method read = null; int result = ERROR; // ApwtclObj my_obj_ptr; ApwtclObj xhr_object; interp.curr_file_name = url; url = interp.start_dir+"/"+url; //print("source!"+url+"!win!"+interp.win+"!"); xhr_object = null; if (interp.win != null) { // try { // if(interp.win.ActiveXObject != null) { // Internet Explorer // xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); // } // } catch(Exception e) { // } if (xhr_object == null) { // if(interp.win.XMLHttpRequest != null) { // Firefox // xhr_object = new XMLHttpRequest(); // } else { // XMLHttpRequest not supported by the browser // if (read_file != null) { // response_text = readFile(url); // result = interp.eval_statement.evalObj(interp.string_obj_type.newStringObj(response_text, -1, "BASE_1")); // return result; // } else { // print("Your browser does not support XMLHTTP requests. " + // "Sorry that we cannot deliver this page."); // return result; // } // } } } else { // read_fcn = null; // if (read_file != null) { // read_fcn = read_file; // } // if (read != null) { // read_fcn = read; // } // if (read_fcn != null) { //print("source rhino2!"+url+"!"+interp.current_namespace.full_name+"!"); // response_text = read_fcn(url); response_text = getFileContents(interp, url); //print("source!"+url+"!"+responseText+"!"); //print("responseText!"+responseText+"!"); script = interp.string_obj_type.newStringObj("::set dir "+interp.current_dir+"\n"+response_text, -1, "BASE_2"); |
︙ | ︙ |
Changes to src/org/apwtcl/lang/ItclClass.java.
︙ | ︙ | |||
265 266 267 268 269 270 271 | * Scan through all classes in the hierarchy, from most to * least specific. Add a lookup entry for each variable * into the table. */ for (int i = 0; i < my_classes.size(); i++) { class_ptr = my_classes.get(i); for (String key: class_ptr.variables.keySet()) { | | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | * Scan through all classes in the hierarchy, from most to * least specific. Add a lookup entry for each variable * into the table. */ for (int i = 0; i < my_classes.size(); i++) { class_ptr = my_classes.get(i); for (String key: class_ptr.variables.keySet()) { // int var_type = ITCL_VARIABLE; my_variable_obj = class_ptr.variables.get(key); ItclVariableLookup vlookup = new ItclVariableLookup(interp, my_variable_obj); vlookup.accessible = (my_variable_obj.protection != PROTECTION_PRIVATE || class_ptr == this); if (my_variable_obj.type == ITCL_COMMON) { // var_type = VAR_COMMON; } /* * Create all possible names for this variable and enter * them into the variable resolution table: * var * class::var * namesp1::class::var |
︙ | ︙ |
Changes to src/org/apwtcl/lang/ItclMacro.java.
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* ==================== ItclMacro ================================== */ public ItclMacro(Interp interp, String name, ApwtclObj params, ApwtclObj body) { oid++; id = oid; this.interp = interp; this.macro_name = name; this.arglist = params; this.body = body; } | > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* ==================== ItclMacro ================================== */ public ItclMacro(Interp interp, String name, ApwtclObj params, ApwtclObj body) { oid++; id = oid; this.interp = interp; if (this.interp == null) { } this.macro_name = name; this.arglist = params; this.body = body; } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/ItclObject.java.
︙ | ︙ | |||
116 117 118 119 120 121 122 | return str.toString(); } /* ==================== initItclObject ========================================== */ public int initItclObject() { int ret_code = OK; boolean err = false; | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | return str.toString(); } /* ==================== initItclObject ========================================== */ public int initItclObject() { int ret_code = OK; boolean err = false; // CallFrame result; ArrayList<CallFrame> frame_ptr_ptr = new ArrayList<CallFrame>(); ApwtclObj self_obj_ptr; ApwtclObj value_ptr; ApwtclObj this_obj_ptr; ApwtclObj my_obj_ptr; String inst_ns_name = null; |
︙ | ︙ | |||
479 480 481 482 483 484 485 | return ret_code; } /* ==================== callDestructors ========================================== */ public int callDestructors() { int result = OK; //print("callDestructors for!"+this.name+"!"+this.class_obj.full_name+"!"); | | | | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | return ret_code; } /* ==================== callDestructors ========================================== */ public int callDestructors() { int result = OK; //print("callDestructors for!"+this.name+"!"+this.class_obj.full_name+"!"); // ArrayList<ItclClass> heritage = class_info.ns_ptr.getHeritage(); Command my_destructor = class_info.ns_ptr.getDestructor(class_info.full_name.getString()); /* FIXME need to call the other destructors here !!! */ // int class_type = dict_helpers.getDictInfo("classes", class_info.full_name, "type"); // if (class_type < 0) { // print("now such class. \""+class_name+"\""); // return ERROR; // } // ApwtclObj function_dict = dict_helpers.getDictInfo("classFunctions", class_obj.fullclass_name, "destructor"); // if (function_dict == null) { // print("now such command: \"destructor\" in class. \""+class_obj.full_name+"\""); // return ERROR; // } if (my_destructor != null) { // ArrayList<ApwtclObj> my_args = new ArrayList<ApwtclObj>(); // result = my_destructor.call(interp, my_args); } return result; } /* ==================== checkForInitializedComponents =============================== */ public int checkForInitializedComponents() { |
︙ | ︙ | |||
516 517 518 519 520 521 522 | } /* ==================== initObjectVariables ========================================== */ public int initObjectVariables() { ItclVariable class_var_ptr; Variable var_ptr; ApwtclObj var_name_ptr; | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | } /* ==================== initObjectVariables ========================================== */ public int initObjectVariables() { ItclVariable class_var_ptr; Variable var_ptr; ApwtclObj var_name_ptr; // ApwtclObj var_value_ptr; String var_type; for (String var_name: class_info.resolve_variables.keySet()) { class_var_ptr = class_info.resolve_variables.get(escapeKey(var_name)).var_ptr; switch (class_var_ptr.type) { case ITCL_TYPE_VARIABLE: var_type = "VAR_TYPE_VAR"; |
︙ | ︙ |
Changes to src/org/apwtcl/lang/ItclVariable.java.
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | /* ==================== ItclVariable ================================== */ public ItclVariable(Interp interp, int protection, int type, String var_name, ArrayList<ApwtclObj> args, ItclClass class_info) { oid++; id = oid; this.interp = interp; this.protection = protection; this.type = type; this.var_name = var_name; this.state = VARIABLE_STATE_NO_INIT; this.class_info = class_info; if (args.size() > 0) { init_val = args.get(0); | > > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | /* ==================== ItclVariable ================================== */ public ItclVariable(Interp interp, int protection, int type, String var_name, ArrayList<ApwtclObj> args, ItclClass class_info) { oid++; id = oid; this.interp = interp; if (this.interp == null) { } this.protection = protection; this.type = type; this.var_name = var_name; this.state = VARIABLE_STATE_NO_INIT; this.class_info = class_info; if (args.size() > 0) { init_val = args.get(0); |
︙ | ︙ |
Changes to src/org/apwtcl/lang/ItclVariableLookup.java.
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | /* ==================== ItclVariableLookup ================================== */ public ItclVariableLookup(Interp interp, ItclVariable var_ptr) { oid++; id = oid; this.interp = interp; this.var_ptr = var_ptr; this.usage = 0; this.least_qual_name = null; this.accessible = false; } /* ==================== mySelf ================================== */ | > > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /* ==================== ItclVariableLookup ================================== */ public ItclVariableLookup(Interp interp, ItclVariable var_ptr) { oid++; id = oid; this.interp = interp; if (this.interp == null) { } this.var_ptr = var_ptr; this.usage = 0; this.least_qual_name = null; this.accessible = false; } /* ==================== mySelf ================================== */ |
︙ | ︙ |
Changes to src/org/apwtcl/lang/LoadedClassInfo.java.
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /* ==================== LoadedClassInfo ================================== */ public LoadedClassInfo(Interp interp) { oid++; id = oid; this.interp = interp; this.instance_info = new HashMap<String, Object>(); this.instance_initted = new HashMap<String, Boolean>(); this.class_methods = new HashMap<String, String>(); } /* ==================== mySelf ================================== */ public String mySelf() { | > > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /* ==================== LoadedClassInfo ================================== */ public LoadedClassInfo(Interp interp) { oid++; id = oid; this.interp = interp; if (this.interp == null) { } this.instance_info = new HashMap<String, Object>(); this.instance_initted = new HashMap<String, Boolean>(); this.class_methods = new HashMap<String, String>(); } /* ==================== mySelf ================================== */ public String mySelf() { |
︙ | ︙ |
Changes to src/org/apwtcl/lang/Namespace.java.
︙ | ︙ | |||
39 40 41 42 43 44 45 | public int flags; private int command_path_length; public int cmd_ref_epoch; private String class_command; public HashMap<String, Namespace> children; private HashMap<String, Command> class_functions; | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | public int flags; private int command_path_length; public int cmd_ref_epoch; private String class_command; public HashMap<String, Namespace> children; private HashMap<String, Command> class_functions; // private HashMap<String, Variable> class_variables; public HashMap<String, Command> resolve_commands; public HashMap<String, Variable> resolve_variables; public HashMap<String, Command> cmd_procs; public HashMap<String, Variable> variables; public Resolve variable_resolver; public Resolve command_resolver; private Resolve macro_resolver; |
︙ | ︙ | |||
82 83 84 85 86 87 88 | command_path_array = null; ref_count = 0; cmd_ref_epoch = 0; class_command = null; parent_namespace = null; // null means :: global namespace children = new HashMap<String, Namespace>(); class_functions = new HashMap<String, Command>(); | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | command_path_array = null; ref_count = 0; cmd_ref_epoch = 0; class_command = null; parent_namespace = null; // null means :: global namespace children = new HashMap<String, Namespace>(); class_functions = new HashMap<String, Command>(); // class_variables = new HashMap<String, Variable>(); resolve_commands = new HashMap<String, Command>(); resolve_variables = new HashMap<String, Variable>(); variables = new HashMap<String, Variable>(); cmd_procs = new HashMap<String, Command>(); variable_resolver = null; command_resolver = null; macro_resolver = null; |
︙ | ︙ | |||
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | public int getNamespaceType() { return class_type; } /* ==================== setNamespaceClassCommand ===================================== */ public void setNamespaceClassCommand(String name) { class_command = name; } /* ==================== setFullName ===================================== */ public void setFullName(String full_name) { this.full_name = full_name; } | > > > | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | public int getNamespaceType() { return class_type; } /* ==================== setNamespaceClassCommand ===================================== */ public void setNamespaceClassCommand(String name) { class_command = name; if (class_command == null) { } } /* ==================== setFullName ===================================== */ public void setFullName(String full_name) { this.full_name = full_name; } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/PackageInfo.java.
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* ==================== PackageInfo ================================== */ public PackageInfo(Interp interp, ApwtclObj package_name, ApwtclObj version, ApwtclObj script) { oid++; id = oid; this.interp = interp; this.package_name = package_name; this.version = version; this.script = script; } /* ==================== mySelf ================================== */ public String mySelf() { | > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* ==================== PackageInfo ================================== */ public PackageInfo(Interp interp, ApwtclObj package_name, ApwtclObj version, ApwtclObj script) { oid++; id = oid; this.interp = interp; if (this.interp == null) { } this.package_name = package_name; this.version = version; this.script = script; } /* ==================== mySelf ================================== */ public String mySelf() { |
︙ | ︙ |
Changes to src/org/apwtcl/lang/Proc.java.
︙ | ︙ | |||
32 33 34 35 36 37 38 | public Object instance; /* ==================== Proc ================================== */ public Proc(Interp interp) { oid++; id = oid; | > > > > | | | | | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | public Object instance; /* ==================== Proc ================================== */ public Proc(Interp interp) { oid++; id = oid; this.interp = interp; if (this.interp == null) { } arg_list_obj_ptr = null; body_obj_ptr = null; static_vars = null; prev_cmd = null; upcall = false; cmd_proc = null; instance = null; } /* ==================== mySelf ================================== */ public String mySelf() { String str = "Proc!"+id+"!"; return str; } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/Resolve.java.
︙ | ︙ | |||
151 152 153 154 155 156 157 | return CONTINUE; } /* ==================== resolveVariable ===================================== */ public int resolveVariable(String var_name, Namespace ns_ptr, int flags, ArrayList<Object> result_ptr) { ItclVariableLookup class_var_ptr = null; Variable var_ptr = null; | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | return CONTINUE; } /* ==================== resolveVariable ===================================== */ public int resolveVariable(String var_name, Namespace ns_ptr, int flags, ArrayList<Object> result_ptr) { ItclVariableLookup class_var_ptr = null; Variable var_ptr = null; // ItclVariableLookup vlookup = null; ItclClass class_ptr; boolean special_name = false; ItclObject class_object = interp.frame_ptr.getClassObject(); if (variable_debug != 0) { print("resolveVariable1!"+var_name+"!"+ns_ptr+"!"+flags+"!"+interp.variable_obj_type.getFlagsString(flags)+"!"+class_object+"!"); } if (class_object == null) { |
︙ | ︙ |
Changes to src/org/apwtcl/lang/TclTest.java.
︙ | ︙ | |||
306 307 308 309 310 311 312 | return null; } } /* ==================== getProps ===================================== */ public int getProps() { //FIXME !!! | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | return null; } } /* ==================== getProps ===================================== */ public int getProps() { //FIXME !!! // ArrayList<ApwtclObj> props = new ArrayList<ApwtclObj>(); ApwtclObj result; // Set<String> keys = configure_options.keySet(); // Iterator<String> iter = keys.iterator(); // while (iter.hasNext()) { // String z = iter.next(); // if (configure_options.get(z) != null) { |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/ArrayCommand.java.
︙ | ︙ | |||
13 14 15 16 17 18 19 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; | | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; //import org.apwtcl.lang.CallFrame; //import org.apwtcl.lang.Command; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; import org.apwtcl.lang.Variable; public class ArrayCommand extends Token { |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/FileCommand.java.
︙ | ︙ | |||
15 16 17 18 19 20 21 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; //import org.apwtcl.lang.Variable; public class FileCommand extends Token { /* ==================== initSubCmds ================================== */ public int initSubCmds(Interp interp) { //print("file initSubCmds called"+interp+"!"); interp.command_obj_type.registerNativeSubCommand("::file", "join", "FileCommand"); |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/ForCommand.java.
︙ | ︙ | |||
13 14 15 16 17 18 19 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; | | | | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; //import org.apwtcl.lang.CallFrame; //import org.apwtcl.lang.Command; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; public class ForCommand extends Token { /* ==================== ForCommand ================================== */ public ForCommand() { } /* ==================== forCmd ================================== */ public int forCmd(Interp interp, ArrayList<ApwtclObj> args) { //print("for called!"+args+"!"); int retval; int bool = 1; ArrayList<Integer> bool_ptr = new ArrayList<Integer>(); //ApwtclObj var_name_ptr = null; //ApwtclObj stop_var_name_ptr = null; boolean evalstart = false; boolean evalnext = false; boolean out = false; boolean testcond = false; if (args.size() != 5) { interp.wrongNumArgs(1, args, "start test next body"); |
︙ | ︙ | |||
229 230 231 232 233 234 235 | } } } } } } if (out) { | | | > | < | | < > | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | } } } } } } if (out) { // if (stop_var_name_ptr != null) { // stop_var_name_ptr.decrRefCount("D_PKG_CORE_CMD_3"); // } } // if (var_name_ptr != null) { // var_name_ptr.decrRefCount("D_PKG_CORE_CMD_4"); // } if (retval == CONTINUE || retval == BREAK || retval == OK) { interp.setEmptyResult(); return OK; } return retval; } } |
Changes to src/org/apwtcl/lang/cmd/ForeachCommand.java.
︙ | ︙ | |||
15 16 17 18 19 20 21 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; //import org.apwtcl.lang.Variable; public class ForeachCommand extends Token { /* ==================== ForeachCommand ================================== */ public ForeachCommand() { } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/IncrCommand.java.
︙ | ︙ | |||
42 43 44 45 46 47 48 | ArrayList<Long> increment_ptr = new ArrayList<Long>(); if (interp.int_obj_type.getWide(args.get(2), increment_ptr) != OK) { return ERROR; } increment = increment_ptr.get(0).intValue(); } ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>(); | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ArrayList<Long> increment_ptr = new ArrayList<Long>(); if (interp.int_obj_type.getWide(args.get(2), increment_ptr) != OK) { return ERROR; } increment = increment_ptr.get(0).intValue(); } ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>(); int_obj_ptr = interp.variable_obj_type.getVariable(args.get(1), FUNCTION_FLAGS_UNSHARED, var_ptr_ptr); if (int_obj_ptr == null) { /* Set missing variable to 0 */ wide_value = 0; } else { ArrayList<Long> wide_value_ptr = new ArrayList<Long>(); if (interp.int_obj_type.getWide(int_obj_ptr, wide_value_ptr) != OK) { return ERROR; |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/InterpCommand.java.
︙ | ︙ | |||
16 17 18 19 20 21 22 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.InterpAlias; import org.apwtcl.lang.Token; | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.InterpAlias; import org.apwtcl.lang.Token; //import org.apwtcl.lang.Variable; public class InterpCommand extends Token { /* ==================== InterpCommand ================================== */ public InterpCommand() { } |
︙ | ︙ | |||
88 89 90 91 92 93 94 | } } interp.setResultString(result_str); return OK; } if (args.size() == 5) { /* seems to be the unset, so the argument has to be empty */ | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | } } interp.setResultString(result_str); return OK; } if (args.size() == 5) { /* seems to be the unset, so the argument has to be empty */ // ApwtclObj arg3 = args.get(3); if (!src_path.getString().equals("")) { interp.setResultString("interp alias interp other current interp not yet implemented, src_path must be empty!"); return ERROR; } if (src_path.getString().equals("")) { // src_path = interp; } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/JavadebugCommand.java.
︙ | ︙ | |||
13 14 15 16 17 18 19 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; | | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; //import org.apwtcl.lang.CallFrame; //import org.apwtcl.lang.Command; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; public class JavadebugCommand extends Token { /* ==================== JavadebugCommand ================================== */ |
︙ | ︙ | |||
61 62 63 64 65 66 67 | if (type.equals("expr_parser_debug")) { // interp.eval_statement.expr_parser_debug = val; } if (type.equals("class_command_debug")) { // this.class_command_debug = 1; } print("javadebug set: "+type+"!"+val+"!"); | | | 61 62 63 64 65 66 67 68 69 70 71 | if (type.equals("expr_parser_debug")) { // interp.eval_statement.expr_parser_debug = val; } if (type.equals("class_command_debug")) { // this.class_command_debug = 1; } print("javadebug set: "+type+"!"+val+"!"); return OK; } } |
Changes to src/org/apwtcl/lang/cmd/LinsertCommand.java.
︙ | ︙ | |||
13 14 15 16 17 18 19 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; | | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; //import org.apwtcl.lang.CallFrame; //import org.apwtcl.lang.Command; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; public class LinsertCommand extends Token { /* ==================== LinsertCommand ================================== */ |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/LsetCommand.java.
︙ | ︙ | |||
26 27 28 29 30 31 32 | public LsetCommand() { } /* ==================== lsetCmd ================================== */ public int lsetCmd(Interp interp, ArrayList<ApwtclObj> args) { print("lset called!"+args+"!"); interp.setResultString("lset not yet reimplemented"); | | | 26 27 28 29 30 31 32 33 34 35 36 | public LsetCommand() { } /* ==================== lsetCmd ================================== */ public int lsetCmd(Interp interp, ArrayList<ApwtclObj> args) { print("lset called!"+args+"!"); interp.setResultString("lset not yet reimplemented"); return ERROR; } } |
Changes to src/org/apwtcl/lang/cmd/NamespaceCommand.java.
︙ | ︙ | |||
21 22 23 24 25 26 27 | import org.apwtcl.lang.CallFrame; import org.apwtcl.lang.Command; import org.apwtcl.lang.CommandOptionList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Namespace; import org.apwtcl.lang.Token; | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import org.apwtcl.lang.CallFrame; import org.apwtcl.lang.Command; import org.apwtcl.lang.CommandOptionList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Namespace; import org.apwtcl.lang.Token; //import org.apwtcl.lang.Variable; public class NamespaceCommand extends Token { public static CommandOptionList command_option_list; public static boolean initted = false; public static final int NAMESPACE_ENSEMBLE_OPTION_COMMAND = 1; public static final int NAMESPACE_ENSEMBLE_OPTION_MAP = 2; |
︙ | ︙ | |||
172 173 174 175 176 177 178 | command_option_list.resetOptionValues(); if (command_option_list.parseOptions(args, 1, "namespace ensemble create") != OK) { interp.setResultString(command_option_list.getErrorMsg()); return ERROR; } int option_flags = command_option_list.getOptionFlags(); | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | command_option_list.resetOptionValues(); if (command_option_list.parseOptions(args, 1, "namespace ensemble create") != OK) { interp.setResultString(command_option_list.getErrorMsg()); return ERROR; } int option_flags = command_option_list.getOptionFlags(); //int num_processed_args = command_option_list.getNumProcessedArgs(); if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_MAP) != 0) { map_lst = command_option_list.getOptionValue(NAMESPACE_ENSEMBLE_OPTION_MAP); map_info = map_lst.get(0); map_len = interp.list_obj_type.listLength(map_info); if (map_len % 2 != 0) { interp.setResultString("option -map must have an even number of elements"); |
︙ | ︙ | |||
355 356 357 358 359 360 361 | return ERROR; } if (ens_cmd.ensemble == null) { interp.setResultString("'"+ensemble_ptr.getString()+"' is not an ensemble"); return ERROR; } HashMap<String, Command> ens = ens_cmd.ensemble; | | | | | | | | | | | | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | return ERROR; } if (ens_cmd.ensemble == null) { interp.setResultString("'"+ensemble_ptr.getString()+"' is not an ensemble"); return ERROR; } HashMap<String, Command> ens = ens_cmd.ensemble; // String cmd_name = ensemble_ptr.getString(); // Ensemble ens = cmd.ensemble; ArrayList<ApwtclObj> map_lst = null; ApwtclObj map_info = null; ArrayList<ApwtclObj> parameters_lst = null; // ApwtclObj parameters_info = null; ArrayList<ApwtclObj> prefixes_lst = null; // ApwtclObj prefixes_info = null; ArrayList<ApwtclObj> subcommands_lst = null; // ApwtclObj subcommands_info = null; ArrayList<ApwtclObj> unknown_lst = null; // ApwtclObj unknown_info = null; //ArrayList<ApwtclObj> command_lst = null; //ApwtclObj command_info = null; StringBuffer result = new StringBuffer(""); //String sep = ""; command_option_list.resetOptionValues(); ArrayList<ApwtclObj> my_args = new ArrayList<ApwtclObj>(); for (int j = 1; j < args.size(); j++) { my_args.add(args.get(j)); } if (command_option_list.parseOptions(my_args, 1, "namespace ensemble configure") != OK) { interp.setResultString(command_option_list.getErrorMsg()); return ERROR; } int option_flags = command_option_list.getOptionFlags(); // int num_processed_args = command_option_list.getNumProcessedArgs(); if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_MAP) != 0) { map_lst = command_option_list.getOptionValue(NAMESPACE_ENSEMBLE_OPTION_MAP); if (map_lst == null) { // result.append(sep+ens.get("map")); // sep = " "; } else { //print("map_lst!"+map_lst+"!"); map_info = map_lst.get(0); int map_len = interp.list_obj_type.listLength(map_info); if (map_len % 2 != 0) { interp.setResultString("option -map must have an even number of elements"); return ERROR; |
︙ | ︙ | |||
425 426 427 428 429 430 431 | } //print("ENS!!"+ens+"!"); if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_PARAMETERS) != 0) { parameters_lst = command_option_list.getOptionValue(NAMESPACE_ENSEMBLE_OPTION_PARAMETERS); // parameters = .join(" "); if (parameters_lst == null) { // result.append(sep+ens.get("parameters")); | | | | | | | | | | | | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | } //print("ENS!!"+ens+"!"); if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_PARAMETERS) != 0) { parameters_lst = command_option_list.getOptionValue(NAMESPACE_ENSEMBLE_OPTION_PARAMETERS); // parameters = .join(" "); if (parameters_lst == null) { // result.append(sep+ens.get("parameters")); // sep = " "; } else { /* FIXME need code here !!! */ // parameters_info = parameters_lst.get(0); interp.setResultString("namespace ensemble configure -parameters not yet implemented"); return ERROR; } } if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_PREFIXES) != 0) { prefixes_lst = command_option_list.getOptionValue(NAMESPACE_ENSEMBLE_OPTION_PREFIXES); // parameters = .join(" "); if (prefixes_lst == null) { // result.append(ens.get("prefixes")); // sep = " "; } else { /* FIXME need code here !!! */ //prefixes_info = prefixes_lst.get(0); interp.setResultString("namespace ensemble configure -prefixes not yet implemented"); return ERROR; } } if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_SUBCOMMANDS) != 0) { subcommands_lst = command_option_list.getOptionValue(NAMESPACE_ENSEMBLE_OPTION_SUBCOMMANDS); // parameters = .join(" "); if (subcommands_lst == null) { // result.append(sep+ens.get("subcommands"); // .join(" "); // sep = " "; } else { /* FIXME need code here !!! */ // subcommands_info = subcommands_lst.get(0); interp.setResultString("namespace ensemble configure -subcommands not yet implemented"); return ERROR; } } if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_UNKNOWN) != 0) { unknown_lst = command_option_list.getOptionValue(NAMESPACE_ENSEMBLE_OPTION_UNKNOWN); // parameters = .join(" "); if (unknown_lst == null) { // result.append(sep+ens.get("unknown"); // .join(" "); // sep = " "; } else { /* FIXME need code here !!! */ // unknown_info = unknown_lst.get(0); interp.setResultString("namespace ensemble configure -unknown not yet implemented"); return ERROR; } } if ((option_flags & NAMESPACE_ENSEMBLE_OPTION_NAMESPACE) != 0) { // parameters = .join(" "); // result.append(sep+ens.get("command"); // .join(" "); // sep = " "; } interp.setResultString(result.toString()); return OK; } /* ==================== namespaceEnsembleExistsCmd =========================== */ public int namespaceEnsembleExistsCmd(Interp interp, ArrayList<ApwtclObj> args) { print("namespace ensemble exists called"); interp.setResultString("namespace ensemble exists not yet reimplemented"); return ERROR; // requireMinArgc(args, 0, "namespace exists", ""); // var cmd = interp.global_ns_ptr.getCommand(interp, args[1].toString()); // if (cmd != null) { // if (typeof cmd.ensemble != "undefined") { // return ERROR; // } // } // return OK; } /* ==================== namespaceEvalCmd =========================== */ public int namespaceEvalCmd(Interp interp, ArrayList<ApwtclObj> args) { //print("namespace eval called!"+args+"!"); try { int result; // int word = 0; ApwtclObj obj_ptr; ArrayList<Namespace> namespace_ptr_ptr = new ArrayList<Namespace>(); Namespace namespace_ptr = null; ArrayList<CallFrame> frame_ptr_ptr = null; if (args.size() < 3) { interp.wrongNumArgs(1, args, "name arg ?arg...?"); |
︙ | ︙ | |||
560 561 562 563 564 565 566 | // work = new Array(); if (args.size() == 3) { /* * TIP #280: Make actual argument location available to eval'd script. */ obj_ptr = args.get(2); // invoker = namesp.interp.cmd_frame_ptr; | | | | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | // work = new Array(); if (args.size() == 3) { /* * TIP #280: Make actual argument location available to eval'd script. */ obj_ptr = args.get(2); // invoker = namesp.interp.cmd_frame_ptr; // word = 3; //FIXME argumentGet(objPtr, invoker, word); } else { /* * More than one argument: concatenate them together with spaces * between, then evaluate the result. evalObjEx will delete the * object when it decrements its refcount after eval'ing it. */ ArrayList<ApwtclObj> my_args = new ArrayList<ApwtclObj>(); for (int i = 2; i < args.size(); i++) { my_args.add(args.get(i)); } obj_ptr = interp.default_obj.concatObj(args.size() - 2, my_args); // invoker = null; // word = 0; } /* * TIP #280: Make invoking context available to eval'd script. */ // TclNRAddCallback(NsEval_Callback, namespacePtr, "eval", null, null); //print("EV!"+obj_ptr.toDebugString()+"!"+invoker+"!"+word+"!"); // FIXME need to do TIP #280 code here !!! |
︙ | ︙ | |||
596 597 598 599 600 601 602 | } } /* ==================== namespaceExistsCmd =========================== */ public int namespaceExistsCmd(Interp interp, ArrayList<ApwtclObj> args) { print("namespace exists called"); interp.setResultString("namespace exists not yet reimplemented"); | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | } } /* ==================== namespaceExistsCmd =========================== */ public int namespaceExistsCmd(Interp interp, ArrayList<ApwtclObj> args) { print("namespace exists called"); interp.setResultString("namespace exists not yet reimplemented"); return ERROR; // requireExactArgc(args, 1, "namespace exists", ""); // var ns_name = args.shift().toString(); // try { // var ns = interp.global_ns_ptr.getNamespace(ns_name); // return interp.statement_parser.objectify("1"); // } catch(e) { // return interp.statement_parser.objectify("0"); |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/SetCommand.java.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * Copyright 2012 Arnulf P. Wiedemann * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; import org.apwtcl.lang.Variable; public class SetCommand extends Token { | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Copyright 2012 Arnulf P. Wiedemann * */ package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; import org.apwtcl.lang.Variable; public class SetCommand extends Token { |
︙ | ︙ |
Changes to src/org/apwtcl/lang/cmd/SourceCommand.java.
︙ | ︙ | |||
15 16 17 18 19 20 21 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | package org.apwtcl.lang.cmd; import java.util.ArrayList; import org.apwtcl.lang.Interp; import org.apwtcl.lang.ApwtclObj; import org.apwtcl.lang.Token; //import org.apwtcl.lang.Variable; public class SourceCommand extends Token { /* ==================== SourceCommand ================================== */ public SourceCommand() { } |
︙ | ︙ |
Changes to src/org/apwtcl/lang/objtype/ItclObjType.java.
︙ | ︙ | |||
509 510 511 512 513 514 515 516 517 518 519 520 521 522 | }; if (cmd_obj == null) { break; } } } object_namespace = interp.frame_ptr.ns_ptr; class_info = interp.classes.get(escapeKey(ns_ptr.full_name)); //print("object_namespace!"+object_namespace+"!"+class_info+"!"+ns_ptr.toDebugString()+"!"); if (object_namespace.full_name.equals("::")) { if (!(cmd_name.charAt(0) == ':' && cmd_name.charAt(1) == ':')) { object_name = "::"+cmd_name; } else { object_name = cmd_name; | > | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | }; if (cmd_obj == null) { break; } } } object_namespace = interp.frame_ptr.ns_ptr; //print("NS!"+object_namespace+"!"+escapeKey(ns_ptr.full_name)+"!"); class_info = interp.classes.get(escapeKey(ns_ptr.full_name)); //print("object_namespace!"+object_namespace+"!"+class_info+"!"+ns_ptr.toDebugString()+"!"); if (object_namespace.full_name.equals("::")) { if (!(cmd_name.charAt(0) == ':' && cmd_name.charAt(1) == ':')) { object_name = "::"+cmd_name; } else { object_name = cmd_name; |
︙ | ︙ | |||
646 647 648 649 650 651 652 | dlg_info = class_ptr.delegated_methods.get(escapeKey(fcn_name)); to_part = dlg_info.to_part.getString(); } if (class_ptr.delegated_methods.get("*") != null) { dlg_info = class_ptr.delegated_methods.get("*"); to_part = dlg_info.to_part.getString(); } | | | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | dlg_info = class_ptr.delegated_methods.get(escapeKey(fcn_name)); to_part = dlg_info.to_part.getString(); } if (class_ptr.delegated_methods.get("*") != null) { dlg_info = class_ptr.delegated_methods.get("*"); to_part = dlg_info.to_part.getString(); } //print("++++to_part!"+fcn_name+"!"+to_part+"!"+class_object.class_info+"!"); if (to_part != null) { Variable var_ptr = class_object.variables.get(escapeKey(to_part)); //print("++++to_part2!"+var_ptr.obj_ptr.getString()+"!"); ItclObject obj2 = interp.class_objects.get(escapeKey(var_ptr.obj_ptr.getString())); my_args = new ArrayList<ApwtclObj>(); my_args.add(interp.string_obj_type.newStringObj(obj2.object_name, -1, "ITCL_OBJ_TYPE_4")); my_args.add(interp.string_obj_type.newStringObj(fcn_name, -1, "ITCL_OBJ_TYPE_5")); |
︙ | ︙ |
Changes to src/org/apwtcl/lang/objtype/VariableObjType.java.
︙ | ︙ | |||
826 827 828 829 830 831 832 | public int ptrObjMakeUpvar(Variable other_ptr, ApwtclObj my_name_ptr, int my_flags, int index) { CallFrame var_frame_ptr = interp.var_frame_ptr; ArrayList<String> err_msg = new ArrayList<String>(); boolean p; String my_name; Variable var_ptr = null; | | | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | public int ptrObjMakeUpvar(Variable other_ptr, ApwtclObj my_name_ptr, int my_flags, int index) { CallFrame var_frame_ptr = interp.var_frame_ptr; ArrayList<String> err_msg = new ArrayList<String>(); boolean p; String my_name; Variable var_ptr = null; //print("ptrObjMakeUpvar!"+other_ptr.toDebugString()+"!"+index+"!"+my_name_ptr+"!"); if (index >= 0) { if (!var_frame_ptr.hasLocalVars()) { panic(true, "ptrObjMakeUpvar called with an index outside from a proc"); } // var_ptr = var_frame_ptr.compiled_locals.get(index); // ??? my_name_ptr = localName(interp.var_frame_ptr, index); my_name = my_name_ptr != null ? my_name_ptr.getString() : null; |
︙ | ︙ | |||
880 881 882 883 884 885 886 887 888 889 890 891 892 893 | ll2.add("VARNAME"); ll2.add(my_name_ptr.getString()); interp.setErrorCode(ll2); //print("pOMU3!"); return ERROR; } } if (var_ptr == other_ptr) { interp.setResult(interp.string_obj_type.newStringObj("can't upvar from variable to itself", -1, "VARIABLE_OBJ_TYPE_8")); ArrayList<String> ll3 = new ArrayList<String>(); ll3.add("TCL"); ll3.add("UPVAR"); ll3.add("SELF"); interp.setErrorCode(ll3); | > | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | ll2.add("VARNAME"); ll2.add(my_name_ptr.getString()); interp.setErrorCode(ll2); //print("pOMU3!"); return ERROR; } } //print("LS!"+var_ptr.toDebugString()+"!"+other_ptr.toDebugString()+"!"); if (var_ptr == other_ptr) { interp.setResult(interp.string_obj_type.newStringObj("can't upvar from variable to itself", -1, "VARIABLE_OBJ_TYPE_8")); ArrayList<String> ll3 = new ArrayList<String>(); ll3.add("TCL"); ll3.add("UPVAR"); ll3.add("SELF"); interp.setErrorCode(ll3); |
︙ | ︙ | |||
998 999 1000 1001 1002 1003 1004 | } /* * Check that we are not trying to create a namespace var linked to a * local variable in a procedure. If we allowed this, the local * variable in the shorter-lived procedure frame could go away leaving * the namespace var's reference invalid. */ | < | | | > > | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | } /* * Check that we are not trying to create a namespace var linked to a * local variable in a procedure. If we allowed this, the local * variable in the shorter-lived procedure frame could go away leaving * the namespace var's reference invalid. */ boolean b1 = (array_ptr != null ? (isVarInHash(array_ptr) && getVarNsPtr(array_ptr) != null) : (isVarInHash(other_ptr) && getVarNsPtr(other_ptr) != null)); if (index < 0) { if (!b1 && ((my_flags & (NAMESPACE_LOOKUP_GLOBAL_ONLY | NAMESPACE_LOOKUP_NAMESPACE_ONLY)) != 0) || (var_frame_ptr == null) || !var_frame_ptr.hasLocalVars() || (my_name_ptr.getString().indexOf("::") >= 0)) { interp.setResult(interp.string_obj_type.newStringObj("bad variable name \""+my_name_ptr.getString()+ "\": upvar won't create namespace variable that refers to procedure variable", -1, "VARIABLE_OBJ_TYPE_11")); ArrayList<String> ll = new ArrayList<String>(); ll.add("TCL"); |
︙ | ︙ | |||
1538 1539 1540 1541 1542 1543 1544 | } /* * If this namespace has a variable resolver, then give it first crack at * the variable resolution. It may return a Variable value, it may signal * to continue onward, or it may signal an error. */ if (variable_debug > 0) { | | | 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 | } /* * If this namespace has a variable resolver, then give it first crack at * the variable resolution. It may return a Variable value, it may signal * to continue onward, or it may signal an error. */ if (variable_debug > 0) { print("NS!"+ctx_ns_ptr.full_name+"!variable_resolver!"+ctx_ns_ptr.variable_resolver+"!"); } if ((ctx_ns_ptr.variable_resolver != null || interp.variable_resolver != null) && ((flags & VAR_LOOKUP_AVOID_RESOLVERS) == 0)) { res_ptr = interp.variable_resolver; if (ctx_ns_ptr.variable_resolver != null) { result = ctx_ns_ptr.variable_resolver.resolveVariable(var_name, ctx_ns_ptr, flags, var_obj_ptr); var_obj = (Variable)var_obj_ptr.get(0); |
︙ | ︙ |