| |
321 |
321 |
|
| |
322 |
322 |
|
| |
323 |
323 |
|
| |
324 |
324 |
|
| |
325 |
325 |
|
| |
326 |
326 |
|
| |
327 |
327 |
|
| |
328 |
328 |
|
| |
329 |
329 |
|
| |
330 |
330 |
|
| |
331 |
331 |
extern int |
| |
332 |
332 |
NsfAsmProc(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { |
| |
333 |
333 |
AsmProcClientData *cd = clientData; |
| |
334 |
334 |
int result; |
| |
335 |
335 |
|
| |
336 |
336 |
assert(cd); |
| |
337 |
337 |
assert(cd->proc); |
| |
338 |
338 |
|
| |
339 |
339 |
|
| |
340 |
340 |
if (likely(cd->paramDefs && cd->paramDefs->paramsPtr)) { |
| |
341 |
|
ParseContext *pcPtr = (ParseContext *) NsfTclStackAlloc(interp, sizeof(ParseContext), "parse context"); |
| |
|
341 |
ParseContext *pcPtr; |
| |
342 |
342 |
ALLOC_ON_STACK(Tcl_Obj*, objc, tov); |
| |
343 |
343 |
|
| |
344 |
344 |
fprintf(stderr, "not implemented yet\n"); |
| |
345 |
|
pcPtr = (ParseContext *)tov; |
| |
346 |
345 |
#if 0 |
| |
|
346 |
pcPtr = (ParseContext *) NsfTclStackAlloc(interp, sizeof(ParseContext), "parse context"); |
| |
347 |
347 |
|
| |
348 |
348 |
|
| |
349 |
349 |
|
| |
350 |
350 |
|
| |
351 |
351 |
|
| |
352 |
352 |
|
| |
353 |
353 |
memcpy(tov, objv, sizeof(Tcl_Obj *)*(objc)); |
| |
354 |
354 |
|
| |
355 |
355 |
|
| |
356 |
356 |
|
| |
357 |
357 |
result = ProcessMethodArguments(pcPtr, interp, NULL, 0, |
| |
358 |
358 |
cd->paramDefs, objv[0], |
| |
359 |
359 |
objc, tov); |
| |
360 |
360 |
|
| |
361 |
361 |
if (likely(result == TCL_OK)) { |
| |
362 |
362 |
result = InvokeShadowedProc(interp, cd->procName, cd->cmd, pcPtr); |
| |
363 |
363 |
} else { |
| |
364 |
364 |
|
| |
365 |
365 |
|
| |
366 |
366 |
ParseContextRelease(pcPtr); |
|
| |
387 |
387 |
|
| |
388 |
388 |
|
| |
389 |
389 |
|
| |
390 |
390 |
|
| |
391 |
391 |
static int |
| |
392 |
392 |
NsfAsmProcAddParam(Tcl_Interp *interp, NsfParsedParam *parsedParamPtr, |
| |
393 |
393 |
Tcl_Obj *nameObj, Tcl_Obj *bodyObj, int with_ad) { |
| |
394 |
394 |
fprintf(stderr, "NsfAsmProcAddParam not implemented yet\n"); |
| |
395 |
395 |
|
| |
396 |
396 |
|
| |
397 |
397 |
return TCL_OK; |
| |
398 |
398 |
} |
| |
399 |
399 |
|
| |
400 |
400 |
static int |
| |
401 |
401 |
NsfAsmProcAddArgs(Tcl_Interp *interp, Tcl_Obj *argumentsObj, |
| |
402 |
402 |
Tcl_Obj *nameObj, Tcl_Obj *bodyObj, int with_ad) { |
| |
403 |
403 |
int argc, result; |
| |
404 |
404 |
Tcl_Obj **argv; |
| |
405 |
405 |
AsmCompiledProc *asmProc; |
| |
406 |
406 |
AsmProcClientData *cd; |
| |
407 |
|
Tcl_Command cmd; |
| |
408 |
407 |
CONST char *procName = ObjStr(nameObj); |
| |
409 |
408 |
|
| |
410 |
409 |
if (unlikely(Tcl_ListObjGetElements(interp, argumentsObj, &argc, &argv) != TCL_OK)) { |
| |
411 |
410 |
return NsfPrintError(interp, "argument list invalid '%s'", ObjStr(argumentsObj)); |
| |
412 |
411 |
} |
| |
413 |
412 |
|
| |
414 |
413 |
result = AsmAssemble(NULL, interp, nameObj, argc, bodyObj, &asmProc); |
| |
415 |
414 |
if (unlikely(result != TCL_OK)) { |
| |
416 |
415 |
return result; |
| |
417 |
416 |
} |
| |
418 |
417 |
|
| |
419 |
418 |
cd = NEW(AsmProcClientData); |
| |
420 |
419 |
cd->object = NULL; |
| |
421 |
420 |
cd->proc = asmProc; |
| |
422 |
421 |
cd->paramDefs = NULL; |
| |
423 |
422 |
cd->with_ad = with_ad; |
| |
424 |
423 |
|
| |
425 |
|
cmd = Tcl_CreateObjCommand(interp, procName, NsfAsmProc, |
| |
|
424 |
Tcl_CreateObjCommand(interp, procName, NsfAsmProc, |
| |
426 |
425 |
cd, NsfAsmProcDeleteProc); |
| |
427 |
426 |
return TCL_OK; |
| |
428 |
427 |
} |
| |
429 |
428 |
|
| |
430 |
429 |
|
| |
431 |
430 |
|
| |
432 |
431 |
|
| |
433 |
432 |
|
| |
434 |
433 |
|
| |
435 |
434 |
|
| |
436 |
435 |
|
| |
437 |
436 |
|
| |
438 |
437 |
|
| |
439 |
438 |
|
| |
440 |
439 |
|
| |
441 |
440 |
|
| |
442 |
441 |
|
| |
443 |
442 |
static int |
| |
444 |
443 |
NsfAsmMethodCreateCmd(Tcl_Interp *interp, NsfObject *defObject, |
| |
445 |
444 |
int withInner_namespace, int withPer_object, NsfObject *regObject, |