APWTCL Arnulf's Preferred Web Tcl

Check-in [bbfafd8d55]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixes and debug stuff
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:bbfafd8d559fec3a55dffd3e0802d8c3fa88e5ab
User & Date: arnulf 2012-04-19 09:45:08
Context
2012-04-19
09:45
initial version check-in: e043a13a98 user: arnulf tags: trunk
09:45
fixes and debug stuff check-in: bbfafd8d55 user: arnulf tags: trunk
2012-04-18
21:46
fixes and new code check-in: 3f365d7d4a user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/org/apwtcl/lang/CoreCommandPackages.java.

215
216
217
218
219
220
221




222
223
224
225
226
227
228
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ArrayCommand ::array", -1, "CORE_COMMAND_PACKAGES_46"));
    cmds.put("array", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("SplitCommand ::split", -1, "CORE_COMMAND_PACKAGES_47"));
    cmds.put("split", sub_cmds);




    
//print("core!"+cmds.keySet()+"!");    
    packages.put("core", cmds);
  }

  /* ==================== mySelf ================================== */
  public String mySelf() {







>
>
>
>







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ArrayCommand ::array", -1, "CORE_COMMAND_PACKAGES_46"));
    cmds.put("array", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("SplitCommand ::split", -1, "CORE_COMMAND_PACKAGES_47"));
    cmds.put("split", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ForCommand ::for", -1, "CORE_COMMAND_PACKAGES_47"));
    cmds.put("for", sub_cmds);
    
//print("core!"+cmds.keySet()+"!");    
    packages.put("core", cmds);
  }

  /* ==================== mySelf ================================== */
  public String mySelf() {

Changes to src/org/apwtcl/lang/Interp.java.

309
310
311
312
313
314
315

316
317
318
319
320
321
322
     return namespaces.get(frame_ptr.level - uplevel_dist);
  }

  /* ==================== getCommand ===================================== */
  public Command getCommand(ApwtclObj obj_ptr, int flags, ArrayList<ArrayList<ApwtclObj>> extra_args_ptr) {
    String cmd_name = obj_ptr.getString();
    ApwtclObj my_obj_ptr;

//print("interp getCommand cmd_name!"+cmd_name+"!");
//print("cmd_name!"+cmd_name+"!"+((cmd_name.charAt(0) == ':' ) && (cmd_name.charAt(1) == ':')));
    /* FIXME need to also look in global Namespace for aliases with relative path name !! */
    if (!((cmd_name.charAt(0) == ':' ) && (cmd_name.charAt(1) == ':'))) {
      String ns_name = frame_ptr.ns_ptr.full_name;
      if (!ns_name.equals("::")) {
            ns_name = ns_name+"::";







>







309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
     return namespaces.get(frame_ptr.level - uplevel_dist);
  }

  /* ==================== getCommand ===================================== */
  public Command getCommand(ApwtclObj obj_ptr, int flags, ArrayList<ArrayList<ApwtclObj>> extra_args_ptr) {
    String cmd_name = obj_ptr.getString();
    ApwtclObj my_obj_ptr;
    
//print("interp getCommand cmd_name!"+cmd_name+"!");
//print("cmd_name!"+cmd_name+"!"+((cmd_name.charAt(0) == ':' ) && (cmd_name.charAt(1) == ':')));
    /* FIXME need to also look in global Namespace for aliases with relative path name !! */
    if (!((cmd_name.charAt(0) == ':' ) && (cmd_name.charAt(1) == ':'))) {
      String ns_name = frame_ptr.ns_ptr.full_name;
      if (!ns_name.equals("::")) {
            ns_name = ns_name+"::";

Changes to src/org/apwtcl/lang/ItclDelegate.java.

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
  public int delegateCget(String option_name) {
  try {
    ApwtclObj var_obj_ptr;
    ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>();
    ArrayList<ApwtclObj> objv = new ArrayList<ApwtclObj>();
    ApwtclObj option_name_ptr;

print("delegateCget!"+option_name+"!"+to_part+"!");
    if (which.equals(option_name) || which.equals("*")) {
      if (to_part != null) {
        var_obj_ptr = interp.variable_obj_type.getVariable(to_part, FUNCTION_FLAGS_NONE, var_ptr_ptr);
        if (var_obj_ptr == null) {
          interp.setResultString("delegateCget to_part: \""+to_part.getString()+"\" not found");
          return ERROR;
        }
        objv.add(var_obj_ptr);
        objv.add(interp.string_obj_type.newStringObj("cget", -1, "ITCL_DELEGATE_1"));
        option_name_ptr = interp.string_obj_type.newStringObj(option_name, -1, "ITCL_DELEGATE_2");
        option_name_ptr.incrRefCount("ITCL_DELEGATE_3");
        objv.add(option_name_ptr);
        int ret = interp.eval_statement.evalObjVector(objv.size(), objv);
print("delegate cget after evalObjVector");
//        option_name_ptr.decrRefCount("ITCL_DELEGATE_4");
print("delegate cget after evalObjVector2!"+ret+"!");
        return ret;
      } else {
        // FIXME need code here !!
        interp.setResultString("delegateCget no to_part not yet implemented");
        return ERROR;
      }       
    }
................................................................................
  public int delegateConfigure(String option_name, ApwtclObj option_value) {
  try {
    ApwtclObj var_obj_ptr;
    ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>();
    ArrayList<ApwtclObj> objv = new ArrayList<ApwtclObj>();
    ApwtclObj option_name_ptr;

print("delegateConfigure!"+option_name+"!"+option_value+"!"+to_part+"!");
    if (which.equals(option_name) || which.equals("*")) {
      if (to_part != null) {
        var_obj_ptr = interp.variable_obj_type.getVariable(to_part, FUNCTION_FLAGS_NONE, var_ptr_ptr);
        if (var_obj_ptr == null) {
          interp.setResultString("delegateConfigure to_part: \""+to_part.getString()+"\" not found");
          return ERROR;
        }







|













|
|
|







 







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
  public int delegateCget(String option_name) {
  try {
    ApwtclObj var_obj_ptr;
    ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>();
    ArrayList<ApwtclObj> objv = new ArrayList<ApwtclObj>();
    ApwtclObj option_name_ptr;

//print("delegateCget!"+option_name+"!"+to_part+"!");
    if (which.equals(option_name) || which.equals("*")) {
      if (to_part != null) {
        var_obj_ptr = interp.variable_obj_type.getVariable(to_part, FUNCTION_FLAGS_NONE, var_ptr_ptr);
        if (var_obj_ptr == null) {
          interp.setResultString("delegateCget to_part: \""+to_part.getString()+"\" not found");
          return ERROR;
        }
        objv.add(var_obj_ptr);
        objv.add(interp.string_obj_type.newStringObj("cget", -1, "ITCL_DELEGATE_1"));
        option_name_ptr = interp.string_obj_type.newStringObj(option_name, -1, "ITCL_DELEGATE_2");
        option_name_ptr.incrRefCount("ITCL_DELEGATE_3");
        objv.add(option_name_ptr);
        int ret = interp.eval_statement.evalObjVector(objv.size(), objv);
//print("delegate cget after evalObjVector");
        option_name_ptr.decrRefCount("ITCL_DELEGATE_4");
//print("delegate cget after evalObjVector2!"+ret+"!");
        return ret;
      } else {
        // FIXME need code here !!
        interp.setResultString("delegateCget no to_part not yet implemented");
        return ERROR;
      }       
    }
................................................................................
  public int delegateConfigure(String option_name, ApwtclObj option_value) {
  try {
    ApwtclObj var_obj_ptr;
    ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>();
    ArrayList<ApwtclObj> objv = new ArrayList<ApwtclObj>();
    ApwtclObj option_name_ptr;

//print("delegateConfigure!"+option_name+"!"+option_value+"!"+to_part+"!");
    if (which.equals(option_name) || which.equals("*")) {
      if (to_part != null) {
        var_obj_ptr = interp.variable_obj_type.getVariable(to_part, FUNCTION_FLAGS_NONE, var_ptr_ptr);
        if (var_obj_ptr == null) {
          interp.setResultString("delegateConfigure to_part: \""+to_part.getString()+"\" not found");
          return ERROR;
        }

Changes to src/org/apwtcl/lang/Namespace.java.

524
525
526
527
528
529
530

531
532
533
534
535
536
537
...
538
539
540
541
542
543
544




545
546
547
548
549
550
551
          commands = getCommandsFromType(real_ns);
          if (commands.get(simple_name) != null) {
            cmd = commands.get(simple_name);
          }
        }
      }
    } else {

//print("nscmd1!"+cmd_name+"!");
      ArrayList<Namespace> ns_ptr1 = new ArrayList<Namespace>();
      ArrayList<Namespace> ns_ptr2 = new ArrayList<Namespace>();
      ArrayList<Namespace> ctx_ns_ptr = new ArrayList<Namespace>();
      ArrayList<String> simple_name_ptr = new ArrayList<String>();
      interp.variable_obj_type.getNamespaceForQualName(cmd_name, context_ns_ptr, flags, ns_ptr1, ns_ptr2, ctx_ns_ptr, simple_name_ptr);
      Namespace ns1 = ns_ptr1.get(0);
................................................................................
      Namespace ns2 = ns_ptr2.get(0);
      simple_name = simple_name_ptr.get(0);
      simple_name = escapeKey(simple_name);
      /* FIXME!!! only temporary !! for ::itcl::type avoid using the class namespace here !!
       * if there exists a global command with the same name
       */
      if (ns1 != null && ns1.class_type == ITCL_TYPE_CLASS && ns2 != null && ns2 == interp.global_ns_ptr) {




        if (interp.global_ns_ptr.cmd_procs.get(escapeKey(simple_name)) != null) {
          ns1 = null;
        }
      }
      /*
       * Look for the command in the command table of its namespace. Be sure
       * to check both possible search paths: from the specified namespace







>







 







>
>
>
>







524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
...
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
          commands = getCommandsFromType(real_ns);
          if (commands.get(simple_name) != null) {
            cmd = commands.get(simple_name);
          }
        }
      }
    } else {

//print("nscmd1!"+cmd_name+"!");
      ArrayList<Namespace> ns_ptr1 = new ArrayList<Namespace>();
      ArrayList<Namespace> ns_ptr2 = new ArrayList<Namespace>();
      ArrayList<Namespace> ctx_ns_ptr = new ArrayList<Namespace>();
      ArrayList<String> simple_name_ptr = new ArrayList<String>();
      interp.variable_obj_type.getNamespaceForQualName(cmd_name, context_ns_ptr, flags, ns_ptr1, ns_ptr2, ctx_ns_ptr, simple_name_ptr);
      Namespace ns1 = ns_ptr1.get(0);
................................................................................
      Namespace ns2 = ns_ptr2.get(0);
      simple_name = simple_name_ptr.get(0);
      simple_name = escapeKey(simple_name);
      /* FIXME!!! only temporary !! for ::itcl::type avoid using the class namespace here !!
       * if there exists a global command with the same name
       */
      if (ns1 != null && ns1.class_type == ITCL_TYPE_CLASS && ns2 != null && ns2 == interp.global_ns_ptr) {
        /* load the core command if possible first */
        if (interp.command_obj_type.canLoadCommand(simple_name)) {
          interp.command_obj_type.loadCommandIfPossible(simple_name);
        }
        if (interp.global_ns_ptr.cmd_procs.get(escapeKey(simple_name)) != null) {
          ns1 = null;
        }
      }
      /*
       * Look for the command in the command table of its namespace. Be sure
       * to check both possible search paths: from the specified namespace

Changes to src/org/apwtcl/lang/ResolvedCmdName.java.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56















57
58
59
60
    ref_ns_ptr = null;
    ref_ns_id = -1;
    ref_ns_cmd_epoch = -1;
  }

  /* ==================== mySelf ================================== */
  public String mySelf() {
    String str = "ResolvedCmdName!"+id+"!";
    return str;
  } 
      
  /* ==================== toString ===================================== */
  public String toString() {
    return mySelf()+"!";
  }

  /* ==================== toDebugString ===================================== */
  public String toDebugString() {
    StringBuffer str = new StringBuffer(mySelf()+"\n");















    return str.toString();
  }

}







|











>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    ref_ns_ptr = null;
    ref_ns_id = -1;
    ref_ns_cmd_epoch = -1;
  }

  /* ==================== mySelf ================================== */
  public String mySelf() {
    String str = "ResolvedCmdName!"+id+"!"+cmd_ptr+"!";
    return str;
  } 
      
  /* ==================== toString ===================================== */
  public String toString() {
    return mySelf()+"!";
  }

  /* ==================== toDebugString ===================================== */
  public String toDebugString() {
    StringBuffer str = new StringBuffer(mySelf()+"\n");
    str.append("    ref_count: "+ref_count+"\n");
    str.append("    cmd_epoch: "+cmd_epoch+"\n");
    str.append("    ref_ns_oid: "+oid+"\n");
    str.append("    ref_ns_cmd_epoch: "+ref_ns_cmd_epoch+"\n");
    if (cmd_ptr == null) {
      str.append("    cmd_ptr: <null>\n");
    } else {
      str.append("    cmd_ptr: "+cmd_ptr.toDebugString()+"\n");
    }
    if (ref_ns_ptr == null) {
      str.append("    ref_ns_ptr: <null>\n");
    } else {
      str.append("    ref_ns_ptr: "+ref_ns_ptr.toDebugString()+"\n");
    }

    return str.toString();
  }

}

Changes to src/org/apwtcl/lang/cmd/InfoCommand.java.

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
..
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182
183
184
185
186
187
...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
...
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
    interp.setResult(result_ptr);
    print("sub cmds for !info!: "+result_ptr+"!");
    return OK;
  }

  /* ==================== infoArgsCmd ================================== */
  public int infoArgsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into args called");
    Command cmd_ptr;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "procname");
      return ERROR;
    }
    ArrayList<ArrayList<ApwtclObj>> extra_args = new ArrayList<ArrayList<ApwtclObj>>();
................................................................................
    }
    interp.setResult(cmd_ptr.proc.arg_list_obj_ptr);
    return OK;
  }

  /* ==================== infoBodyCmd ================================== */
  public int infoBodyCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into body called");
    Command cmd_ptr;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "procname");
      return ERROR;
    }
    ArrayList<ArrayList<ApwtclObj>> extra_args = new ArrayList<ArrayList<ApwtclObj>>();
................................................................................
    }
    interp.setResult(cmd_ptr.proc.body_obj_ptr);
    return OK;
  }

  /* ==================== infoCommandsCmd ================================== */
  public int infoCommandsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into commands called");
print("info commands not yet implemented");
//    this.requireArgcRange(0, 1, "info commands", "");
//    var pattern = null;
//    var cmd = null;
//    if (args.length > 0) {
//      pattern = args.shift().toString();
//      try {
................................................................................
//print("info commands!"+pattern+"!"+cmd+"!");
//    return interp.mkList(interp.commands[interp.getNamespace()]);
    return ERROR;
  }

  /* ==================== infoCompleteCmd ================================== */
  public int infoCompleteCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into complete called");
    String s = args.get(1).getString();
    int len = args.get(1).getStringLength();
    ArrayList<Character> missing_ptr = new ArrayList<Character>();
    char missing;

    if (args.size() != 2 && args.size() != 3) {
      interp.wrongNumArgs(1, args, "script ?missing?");
................................................................................
      interp.variable_obj_type.setVariable(args.get(2), interp.string_obj_type.newStringObj(Character.toString(missing), 1, "PKG_INFOCMD_1"), var_ptr_ptr);
    }
    return OK;
  }

  /* ==================== infoExistsCmd ================================== */
  public int infoExistsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into exists called");
    ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>();

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "varname");
      return ERROR;
    }
    interp.setResultBool(interp.variable_obj_type.getVariable(args.get(1), FUNCTION_FLAGS_NONE, var_ptr_ptr) != null);

    return OK;
  }

  /* ==================== infoFrameCmd ================================== */
  public int infoFrameCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into frame called");
    if (args.size() != 1 && args.size() != 2) {
      interp.wrongNumArgs(1, args, "?level?");
      return ERROR;
    }
    if (args.size() == 1) {
     interp.setResultInt(interp.frame_ptr.level);
      return OK;
................................................................................
    }
    interp.setResult(result_ptr.get(0));
    return OK;
  }

  /* ==================== infoGlobalsCmd ================================== */
  public int infoGlobalsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into globals called");
    ArrayList<ApwtclObj> lst = new ArrayList<ApwtclObj>();
    HashMap<String, Variable> var_info = interp.global_ns_ptr.variables;

    for (String z: var_info.keySet()) {
      lst.add(interp.string_obj_type.newStringObj(z, -1, "PKG_INFOCMD_2"));
    }
    interp.setResult(interp.list_obj_type.newListObj(lst, lst.size()));
    return OK;
  }

  /* ==================== infoIsensembleCmd ================================== */
  public int infoIsensembleCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into isensemble called");
    Command cmd_ptr;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "procname");
      return ERROR;
    }
    ArrayList<ArrayList<ApwtclObj>> extra_args = new ArrayList<ArrayList<ApwtclObj>>();
................................................................................
    }
    interp.setResultBool((cmd_ptr.ensemble != null));
    return OK;
  }

  /* ==================== infoLevelCmd ================================== */
  public int infoLevelCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("into level called");
    if (args.size() != 1 && args.size() != 2) {
      interp.wrongNumArgs(1, args, "?level?");
      return ERROR;
    }
    if (args.size() == 1) {
     interp.setResultInt(interp.frame_ptr.level);
      return OK;
................................................................................
    }
    interp.setResult(result_ptr.get(0));
    return OK;
  }

  /* ==================== infoProcsCmd ================================== */
  public int infoProcsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into procs called");
print("info proces not yet implemented!!");
//    return interp.mkList(interp.procs);
return ERROR;
  }

  /* ==================== infoReturncodesCmd ================================== */
  public int infoReturncodesCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into returncodes called");
    if (args.size() != 1 && args.size() != 2) {
      interp.wrongNumArgs(1, args, "?code?");
      return ERROR;
    }
    if (args.size() == 1) {
      int i;
      ApwtclObj list_obj_ptr = interp.list_obj_type.newListObj(null, 0);
................................................................................
      }
    }
    return OK;
  }

  /* ==================== infoScriptCmd ================================== */
  public int infoScriptCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into script called");
    if (args.size() != 1) {
      interp.wrongNumArgs(1, args, "");
      return ERROR;
    }
    interp.script_obj_type.getScript(interp.current_script_obj);
    interp.setResult(interp.current_script_obj.sourceValue_GetFileNameObj());
    return OK;
  }

  /* ==================== infoSourceCmd ================================== */
  public int infoSourceCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into source called");
    int line;
    ApwtclObj res_obj_ptr;
    ApwtclObj file_name_obj;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "source");
      return ERROR;
................................................................................
    interp.list_obj_type.listAppendElement(res_obj_ptr, interp.int_obj_type.newIntObj(line));
    interp.setResult(res_obj_ptr);
    return OK;
  }

  /* ==================== infoVarsCmd ================================== */
  public int infoVarsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("into vars called");
print("info vars not yet implemented!!");
//    return interp.mkList(interp.call_frame.get(interp.eval_statement.level));
    return ERROR;
  }

}







|







 







|







 







|







 







|







 







|







>





|







 







|












|







 







|







 







|







|







 







|











|







 







|






72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
..
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
...
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
...
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
...
331
332
333
334
335
336
337
338
339
340
341
342
343
344
    interp.setResult(result_ptr);
    print("sub cmds for !info!: "+result_ptr+"!");
    return OK;
  }

  /* ==================== infoArgsCmd ================================== */
  public int infoArgsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info args called");
    Command cmd_ptr;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "procname");
      return ERROR;
    }
    ArrayList<ArrayList<ApwtclObj>> extra_args = new ArrayList<ArrayList<ApwtclObj>>();
................................................................................
    }
    interp.setResult(cmd_ptr.proc.arg_list_obj_ptr);
    return OK;
  }

  /* ==================== infoBodyCmd ================================== */
  public int infoBodyCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info body called");
    Command cmd_ptr;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "procname");
      return ERROR;
    }
    ArrayList<ArrayList<ApwtclObj>> extra_args = new ArrayList<ArrayList<ApwtclObj>>();
................................................................................
    }
    interp.setResult(cmd_ptr.proc.body_obj_ptr);
    return OK;
  }

  /* ==================== infoCommandsCmd ================================== */
  public int infoCommandsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info commands called");
print("info commands not yet implemented");
//    this.requireArgcRange(0, 1, "info commands", "");
//    var pattern = null;
//    var cmd = null;
//    if (args.length > 0) {
//      pattern = args.shift().toString();
//      try {
................................................................................
//print("info commands!"+pattern+"!"+cmd+"!");
//    return interp.mkList(interp.commands[interp.getNamespace()]);
    return ERROR;
  }

  /* ==================== infoCompleteCmd ================================== */
  public int infoCompleteCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info complete called");
    String s = args.get(1).getString();
    int len = args.get(1).getStringLength();
    ArrayList<Character> missing_ptr = new ArrayList<Character>();
    char missing;

    if (args.size() != 2 && args.size() != 3) {
      interp.wrongNumArgs(1, args, "script ?missing?");
................................................................................
      interp.variable_obj_type.setVariable(args.get(2), interp.string_obj_type.newStringObj(Character.toString(missing), 1, "PKG_INFOCMD_1"), var_ptr_ptr);
    }
    return OK;
  }

  /* ==================== infoExistsCmd ================================== */
  public int infoExistsCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("info exists called!"+args+"!");
    ArrayList<Variable> var_ptr_ptr = new ArrayList<Variable>();

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "varname");
      return ERROR;
    }
    interp.setResultBool(interp.variable_obj_type.getVariable(args.get(1), FUNCTION_FLAGS_NONE, var_ptr_ptr) != null);
//print("info exists end!"+interp.getResult()+"!");
    return OK;
  }

  /* ==================== infoFrameCmd ================================== */
  public int infoFrameCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info frame called");
    if (args.size() != 1 && args.size() != 2) {
      interp.wrongNumArgs(1, args, "?level?");
      return ERROR;
    }
    if (args.size() == 1) {
     interp.setResultInt(interp.frame_ptr.level);
      return OK;
................................................................................
    }
    interp.setResult(result_ptr.get(0));
    return OK;
  }

  /* ==================== infoGlobalsCmd ================================== */
  public int infoGlobalsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info globals called");
    ArrayList<ApwtclObj> lst = new ArrayList<ApwtclObj>();
    HashMap<String, Variable> var_info = interp.global_ns_ptr.variables;

    for (String z: var_info.keySet()) {
      lst.add(interp.string_obj_type.newStringObj(z, -1, "PKG_INFOCMD_2"));
    }
    interp.setResult(interp.list_obj_type.newListObj(lst, lst.size()));
    return OK;
  }

  /* ==================== infoIsensembleCmd ================================== */
  public int infoIsensembleCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info isensemble called");
    Command cmd_ptr;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "procname");
      return ERROR;
    }
    ArrayList<ArrayList<ApwtclObj>> extra_args = new ArrayList<ArrayList<ApwtclObj>>();
................................................................................
    }
    interp.setResultBool((cmd_ptr.ensemble != null));
    return OK;
  }

  /* ==================== infoLevelCmd ================================== */
  public int infoLevelCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("info level called");
    if (args.size() != 1 && args.size() != 2) {
      interp.wrongNumArgs(1, args, "?level?");
      return ERROR;
    }
    if (args.size() == 1) {
     interp.setResultInt(interp.frame_ptr.level);
      return OK;
................................................................................
    }
    interp.setResult(result_ptr.get(0));
    return OK;
  }

  /* ==================== infoProcsCmd ================================== */
  public int infoProcsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info procs called");
print("info proces not yet implemented!!");
//    return interp.mkList(interp.procs);
return ERROR;
  }

  /* ==================== infoReturncodesCmd ================================== */
  public int infoReturncodesCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info returncodes called");
    if (args.size() != 1 && args.size() != 2) {
      interp.wrongNumArgs(1, args, "?code?");
      return ERROR;
    }
    if (args.size() == 1) {
      int i;
      ApwtclObj list_obj_ptr = interp.list_obj_type.newListObj(null, 0);
................................................................................
      }
    }
    return OK;
  }

  /* ==================== infoScriptCmd ================================== */
  public int infoScriptCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info script called");
    if (args.size() != 1) {
      interp.wrongNumArgs(1, args, "");
      return ERROR;
    }
    interp.script_obj_type.getScript(interp.current_script_obj);
    interp.setResult(interp.current_script_obj.sourceValue_GetFileNameObj());
    return OK;
  }

  /* ==================== infoSourceCmd ================================== */
  public int infoSourceCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info source called");
    int line;
    ApwtclObj res_obj_ptr;
    ApwtclObj file_name_obj;

    if (args.size() != 2) {
      interp.wrongNumArgs(1, args, "source");
      return ERROR;
................................................................................
    interp.list_obj_type.listAppendElement(res_obj_ptr, interp.int_obj_type.newIntObj(line));
    interp.setResult(res_obj_ptr);
    return OK;
  }

  /* ==================== infoVarsCmd ================================== */
  public int infoVarsCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("info vars called");
print("info vars not yet implemented!!");
//    return interp.mkList(interp.call_frame.get(interp.eval_statement.level));
    return ERROR;
  }

}

Changes to src/org/apwtcl/lang/cmd/ItclCommand.java.

451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
...
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
...
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
...
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
...
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
    interp.frame_ptr = save_frame_ptr;
    interp.var_frame_ptr = save_var_frame_ptr;
    return OK;
  }

  /* ==================== itclInternalClassinfoCmd ================================== */
  public int classinfoCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("itcl internal classinfo called!"+args+"!");
    ApwtclObj class_name = args.get(0);
    String what = args.get(2).getString();
    ItclClass class_ptr = null;
    ApwtclObj list_ptr;

    if (args.size() != 3) {
      interp.wrongNumArgs(1, args, "className");
................................................................................
    if (option_type < 0) {
      interp.setResultString("cget no such option: \""+option_name+"\"");
      return ERROR;
    }
    if (option_type == ITCL_DELEGATE) {
      delegated_class_option_obj = (ItclDelegate)option_ptr.get(0);
      int ret = delegated_class_option_obj.delegateCget(option_name.getString());
print("after delegate cget!"+ret+"!");      
      return ret;
    }
    class_option_obj = (ItclOption)option_ptr.get(0);
    ApwtclObj cget_method = class_option_obj.cget_method;
    if (cget_method == null) {
      /* look if cgetmethodvar is set */
      ApwtclObj cget_method_var = class_option_obj.cget_methodvar;
................................................................................
    return ERROR;
  }
  }

  /* ==================== itclInternalClassconfigureCmd ================================== */
  public int classconfigureCmd(Interp interp, ArrayList<ApwtclObj> args) {
	try {
print("itcl internal classconfigure called!"+args+"!");
    ItclClass class_ptr = null;
    ItclObject class_object;
    ApwtclObj configure_method = null;
    ApwtclObj configure_methodvar = null;
    ApwtclObj option_val = null;
    ApwtclObj option_name;
    ItclOption class_option_obj = null;
................................................................................
      e.printStackTrace();
      return ERROR;
	}
  }

  /* ==================== itclInternalClassconfigurelistCmd =========================== */
  public int classconfigurelistCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("itcl internal classconfigurelist called!"+args+"!");
    int lgth;
    int i;
    ArrayList<ApwtclObj> option_name_ptr = new ArrayList<ApwtclObj>();
    ApwtclObj opt_name;
    ArrayList<ApwtclObj> option_val_ptr = new ArrayList<ApwtclObj>();
    ApwtclObj opt_val;
    ApwtclObj lst_ptr;
................................................................................
print("WARNING! destroy not yet implemented!");
//interp.setResultString("WARNING! destroy not yet implemented!");
    return OK;
  }

  /* ==================== itclInternalClassinstallCmd =========================== */
  public int classinstallCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("itcl internal classinstall called!"+args+"!");
    ApwtclObj component_ptr = null;
    String component;
    ApwtclObj object_type;
    ApwtclObj object_name;
    ItclObject class_object = interp.frame_ptr.getClassObject();
    ItclClass class_ptr = class_object.class_info;
    ArrayList<ApwtclObj> my_args = null;







|







 







<







 







|







 







|







 







|







451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
...
508
509
510
511
512
513
514

515
516
517
518
519
520
521
...
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
...
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
...
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
    interp.frame_ptr = save_frame_ptr;
    interp.var_frame_ptr = save_var_frame_ptr;
    return OK;
  }

  /* ==================== itclInternalClassinfoCmd ================================== */
  public int classinfoCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("itcl internal classinfo called!"+args+"!");
    ApwtclObj class_name = args.get(0);
    String what = args.get(2).getString();
    ItclClass class_ptr = null;
    ApwtclObj list_ptr;

    if (args.size() != 3) {
      interp.wrongNumArgs(1, args, "className");
................................................................................
    if (option_type < 0) {
      interp.setResultString("cget no such option: \""+option_name+"\"");
      return ERROR;
    }
    if (option_type == ITCL_DELEGATE) {
      delegated_class_option_obj = (ItclDelegate)option_ptr.get(0);
      int ret = delegated_class_option_obj.delegateCget(option_name.getString());

      return ret;
    }
    class_option_obj = (ItclOption)option_ptr.get(0);
    ApwtclObj cget_method = class_option_obj.cget_method;
    if (cget_method == null) {
      /* look if cgetmethodvar is set */
      ApwtclObj cget_method_var = class_option_obj.cget_methodvar;
................................................................................
    return ERROR;
  }
  }

  /* ==================== itclInternalClassconfigureCmd ================================== */
  public int classconfigureCmd(Interp interp, ArrayList<ApwtclObj> args) {
	try {
//print("itcl internal classconfigure called!"+args+"!");
    ItclClass class_ptr = null;
    ItclObject class_object;
    ApwtclObj configure_method = null;
    ApwtclObj configure_methodvar = null;
    ApwtclObj option_val = null;
    ApwtclObj option_name;
    ItclOption class_option_obj = null;
................................................................................
      e.printStackTrace();
      return ERROR;
	}
  }

  /* ==================== itclInternalClassconfigurelistCmd =========================== */
  public int classconfigurelistCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("itcl internal classconfigurelist called!"+args+"!");
    int lgth;
    int i;
    ArrayList<ApwtclObj> option_name_ptr = new ArrayList<ApwtclObj>();
    ApwtclObj opt_name;
    ArrayList<ApwtclObj> option_val_ptr = new ArrayList<ApwtclObj>();
    ApwtclObj opt_val;
    ApwtclObj lst_ptr;
................................................................................
print("WARNING! destroy not yet implemented!");
//interp.setResultString("WARNING! destroy not yet implemented!");
    return OK;
  }

  /* ==================== itclInternalClassinstallCmd =========================== */
  public int classinstallCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("itcl internal classinstall called!"+args+"!");
    ApwtclObj component_ptr = null;
    String component;
    ApwtclObj object_type;
    ApwtclObj object_name;
    ItclObject class_object = interp.frame_ptr.getClassObject();
    ItclClass class_ptr = class_object.class_info;
    ArrayList<ApwtclObj> my_args = null;

Changes to src/org/apwtcl/lang/cmd/LreplaceCommand.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

  /* ==================== LreplaceCommand ================================== */
  public LreplaceCommand() {
  }

  /* ==================== lreplaceCmd ================================== */
  public int lreplaceCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("lreplace called!"+args+"!");
    ArrayList<Integer> first_index_ptr = new ArrayList<Integer>();
    ArrayList<Integer> last_index_ptr = new ArrayList<Integer>();
    int len;
    ArrayList<Integer> range_len_ptr = new ArrayList<Integer>();
    int range_len;
    int first;
    int last;







|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

  /* ==================== LreplaceCommand ================================== */
  public LreplaceCommand() {
  }

  /* ==================== lreplaceCmd ================================== */
  public int lreplaceCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("lreplace called!"+args+"!");
    ArrayList<Integer> first_index_ptr = new ArrayList<Integer>();
    ArrayList<Integer> last_index_ptr = new ArrayList<Integer>();
    int len;
    ArrayList<Integer> range_len_ptr = new ArrayList<Integer>();
    int range_len;
    int first;
    int last;

Changes to src/org/apwtcl/lang/cmd/SplitCommand.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

  /* ==================== SplitCommand ================================== */
  public SplitCommand() {
  }

  /* ==================== splitCmd ================================== */
  public int splitCmd(Interp interp, ArrayList<ApwtclObj> args) {
print("split called!"+args+"!");
    ApwtclObj script_obj_ptr;
    String str;
    String split_chars;
    int no_match_start;
    int split_len;
    int str_len;
    ApwtclObj res_obj_ptr;







|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

  /* ==================== SplitCommand ================================== */
  public SplitCommand() {
  }

  /* ==================== splitCmd ================================== */
  public int splitCmd(Interp interp, ArrayList<ApwtclObj> args) {
//print("split called!"+args+"!");
    ApwtclObj script_obj_ptr;
    String str;
    String split_chars;
    int no_match_start;
    int split_len;
    int str_len;
    ApwtclObj res_obj_ptr;

Changes to src/org/apwtcl/lang/objtype/CommandObjType.java.

434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
...
850
851
852
853
854
855
856


857

858
859
860
861
862
863
864

//print("callProcedure CMD!"+cmd_ptr.toDebugString()+"!"+argc+"!"+argv+"!");
    /* Check arity */
//print("req_arity!"+argc+"!"+param_info.req_arity+"!");
    if (argc - 1 < param_info.req_arity ||
        (param_info.args_pos < 0 && argc - 1 > param_info.req_arity + param_info.opt_arity)) {
      setWrongArgs(argv.get(0), cmd_ptr);
print("callProcedure err 1");
      return ERROR;
    }

    /* Check if there are too nested calls */
//print("FR!"+intp.frame_ptr.toDebugString()+"!"+intp.max_nesting_depth+"!");
    if (interp.frame_ptr.level == interp.max_nesting_depth) {
      interp.setResultString("Too many nested calls. Infinite recursion?");
................................................................................
    return null;
  }
  
  /* ==================== canLoadCommand ===================================== */
  public boolean canLoadCommand(String cmd_name) {
//print("canLoadCommand!"+cmd_name+"!"+core_command_packages.hasCommand("core", cmd_name));
    if (core_command_packages.hasCommand("core", cmd_name)) {


      return true;

    }
    return false;
  }
  
  /* ==================== getCommandInfo ===================================== */
  public ApwtclObj getCommandInfo(String cmd_name) {
    return core_command_packages.getCommandInfo("core", cmd_name);







|







 







>
>
|
>







434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
...
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867

//print("callProcedure CMD!"+cmd_ptr.toDebugString()+"!"+argc+"!"+argv+"!");
    /* Check arity */
//print("req_arity!"+argc+"!"+param_info.req_arity+"!");
    if (argc - 1 < param_info.req_arity ||
        (param_info.args_pos < 0 && argc - 1 > param_info.req_arity + param_info.opt_arity)) {
      setWrongArgs(argv.get(0), cmd_ptr);
print("callProcedure err 1!"+cmd_ptr.toDebugString()+"!"+argv+"!");
      return ERROR;
    }

    /* Check if there are too nested calls */
//print("FR!"+intp.frame_ptr.toDebugString()+"!"+intp.max_nesting_depth+"!");
    if (interp.frame_ptr.level == interp.max_nesting_depth) {
      interp.setResultString("Too many nested calls. Infinite recursion?");
................................................................................
    return null;
  }
  
  /* ==================== canLoadCommand ===================================== */
  public boolean canLoadCommand(String cmd_name) {
//print("canLoadCommand!"+cmd_name+"!"+core_command_packages.hasCommand("core", cmd_name));
    if (core_command_packages.hasCommand("core", cmd_name)) {
      /* avoid reloading the command otherwise there are problems !! */
      if (interp.global_ns_ptr.cmd_procs.get(escapeKey(cmd_name)) == null) {
        return true;
      }
    }
    return false;
  }
  
  /* ==================== getCommandInfo ===================================== */
  public ApwtclObj getCommandInfo(String cmd_name) {
    return core_command_packages.getCommandInfo("core", cmd_name);

Changes to src/org/apwtcl/lang/objtype/ItclObjType.java.

567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
...
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
...
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
      case ITCL_CLASS:
      case ITCL_EXTENDED_CLASS:
        break;
      }
    } else {
      Command cmd_ptr = null;
//print("classCommand 3!"+args+"!");
print("classCommand cmd!"+cmd_obj+"!"+cmd_obj.ns_ptr+"!");
      if (cmd_obj.ns_ptr.resolve_commands.get(escapeKey(cmd_name)) != null) {
        cmd_ptr = cmd_obj.ns_ptr.resolve_commands.get(escapeKey(cmd_name));
      }
      if (cmd_ptr == null) {
        Namespace my_ns = interp.global_ns_ptr.getNamespace("::itcl::internal");
        HashMap<String, Command> commands = my_ns.cmd_procs;
        if (commands.get(escapeKey("class"+cmd_name)) != null) {
................................................................................
//print("CMD_PTR!"+cmd_ptr+"!"+itcl.interp.frame_ptr.toDebugString()+"!");
        if (cmd_ptr.is_proc) {
          my_args.add(args.get(1));
          for (int k = 2; k < args.size(); k++) {
            my_args.add(args.get(k));
            args.get(k).incrRefCount("I_ITCL_OBJ_TYPE_5");
          }
print("IOC!"+cmd_ptr+"!"+my_args+"!");
//          retcode = (Integer)cmd_ptr.call(interp, my_args, /* ensemble_expand */ true);
          retcode = (Integer)interp.command_obj_type.callProcedure(cmd_ptr, null, 0, my_args.size(), my_args);
          return retcode;
        } else {
           my_args.add(args.get(0));
           my_args.add(args.get(1));
           for (int k = 2; k < args.size(); k++) {
................................................................................
    return ERROR;
  }
  }


  /* ==================== classObjectCommand ================================== */
  public int classObjectCommand(Namespace ns_ptr, ItclObject class_object, ArrayList<ApwtclObj> args) {
print("classObjectCommand!"+ns_ptr+"!"+class_object+"!"+args+"!");
    ApwtclObj class_object_name = args.get(0);
    ApwtclObj sub_cmd = args.get(1);
    args.remove(0);
    args.remove(0);
    ArrayList<ApwtclObj> my_args = args;
    int ret_code;
    ArrayList<ItclObject> class_object_ptr = new ArrayList<ItclObject>();







|







 







|







 







|







567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
...
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
...
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
      case ITCL_CLASS:
      case ITCL_EXTENDED_CLASS:
        break;
      }
    } else {
      Command cmd_ptr = null;
//print("classCommand 3!"+args+"!");
//print("classCommand cmd!"+cmd_obj+"!"+cmd_obj.ns_ptr+"!");
      if (cmd_obj.ns_ptr.resolve_commands.get(escapeKey(cmd_name)) != null) {
        cmd_ptr = cmd_obj.ns_ptr.resolve_commands.get(escapeKey(cmd_name));
      }
      if (cmd_ptr == null) {
        Namespace my_ns = interp.global_ns_ptr.getNamespace("::itcl::internal");
        HashMap<String, Command> commands = my_ns.cmd_procs;
        if (commands.get(escapeKey("class"+cmd_name)) != null) {
................................................................................
//print("CMD_PTR!"+cmd_ptr+"!"+itcl.interp.frame_ptr.toDebugString()+"!");
        if (cmd_ptr.is_proc) {
          my_args.add(args.get(1));
          for (int k = 2; k < args.size(); k++) {
            my_args.add(args.get(k));
            args.get(k).incrRefCount("I_ITCL_OBJ_TYPE_5");
          }
//print("IOC!"+cmd_ptr+"!"+my_args+"!");
//          retcode = (Integer)cmd_ptr.call(interp, my_args, /* ensemble_expand */ true);
          retcode = (Integer)interp.command_obj_type.callProcedure(cmd_ptr, null, 0, my_args.size(), my_args);
          return retcode;
        } else {
           my_args.add(args.get(0));
           my_args.add(args.get(1));
           for (int k = 2; k < args.size(); k++) {
................................................................................
    return ERROR;
  }
  }


  /* ==================== classObjectCommand ================================== */
  public int classObjectCommand(Namespace ns_ptr, ItclObject class_object, ArrayList<ApwtclObj> args) {
//print("classObjectCommand!"+ns_ptr+"!"+class_object+"!"+args+"!");
    ApwtclObj class_object_name = args.get(0);
    ApwtclObj sub_cmd = args.get(1);
    args.remove(0);
    args.remove(0);
    ArrayList<ApwtclObj> my_args = args;
    int ret_code;
    ArrayList<ItclObject> class_object_ptr = new ArrayList<ItclObject>();

Changes to src/org/apwtcl/lang/objtype/StringObjType.java.

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
...
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197

  /* ==================== getString ================================== */
  /* Return the string representation for obj_ptr. If the object
   * string representation is invalid, calls the method to create
   * a new one starting from the internal representation of the object.
   */
  public String getString(ApwtclObj obj_ptr) {
return obj_ptr.getString();
//    if (obj_ptr.bytes == null) {
      /* Invalid string repr. Generate it. */
//      panic(obj_ptr.obj_type.updateString != "function", "UpdateStringProc called against '"+getObjTypeString(obj_ptr.obj_type));
//      obj_ptr.getString();
//print("OO!"+obj_ptr.toDebugString()+"!");
//      obj_ptr.bytes = new StringBuffer("");
//    }
//    if (obj_ptr.value2 == null) {
//      obj_ptr.strValue_SetCharLength(obj_ptr.len);	
//    }
//    return obj_ptr.bytes.substring(0, obj_ptr.len);
  }

  /* ==================== getStringLength ================================== */
  public int getStringLength(ApwtclObj obj_ptr) {
    return obj_ptr.len;
  }

................................................................................
  /* Higher level API to append strings to objects. */
  public int appendString(ApwtclObj obj_ptr, String str, int len) {
    panic(obj_ptr.isShared(), "appendString called with shared object");
    if (obj_ptr.obj_type != OBJ_TYPE_STRING) {
      setFromAny(obj_ptr);
    }
if (obj_ptr.value2 == null) {

print("VAL2 NULL!"+obj_ptr.toDebugString()+"!");
}
    _appendString(obj_ptr, str, len);
    return OK;
  }
  /* ==================== stringMap ================================== */
  /* does the [string map] operation. On error null is returned,
   * otherwise a new string object with the result, having refcount = 0,







|
<
<
<
<
<
<
<
<
<
<
<







 







>
|







75
76
77
78
79
80
81
82











83
84
85
86
87
88
89
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

  /* ==================== getString ================================== */
  /* Return the string representation for obj_ptr. If the object
   * string representation is invalid, calls the method to create
   * a new one starting from the internal representation of the object.
   */
  public String getString(ApwtclObj obj_ptr) {
    return obj_ptr.getString();











  }

  /* ==================== getStringLength ================================== */
  public int getStringLength(ApwtclObj obj_ptr) {
    return obj_ptr.len;
  }

................................................................................
  /* Higher level API to append strings to objects. */
  public int appendString(ApwtclObj obj_ptr, String str, int len) {
    panic(obj_ptr.isShared(), "appendString called with shared object");
    if (obj_ptr.obj_type != OBJ_TYPE_STRING) {
      setFromAny(obj_ptr);
    }
if (obj_ptr.value2 == null) {
print("appendString value2 == null!");
//print("VAL2 NULL!"+obj_ptr.toDebugString()+"!");
}
    _appendString(obj_ptr, str, len);
    return OK;
  }
  /* ==================== stringMap ================================== */
  /* does the [string map] operation. On error null is returned,
   * otherwise a new string object with the result, having refcount = 0,