Posted to tcl by apw at Tue Aug 07 19:47:40 GMT 2007view raw

  1. int
  2. _Tcl_GetCallFrameInfo(
  3. Tcl_Interp *interp, /* Interpreter in which to look for */
  4. Tcl_CallFrame *framePtr, /* if NULL use framePtr from interp */
  5. Tcl_CallFrameInfo *infoPtr) /* Where to store information */
  6. {
  7. CallFrame *myFramePtr = (CallFrame *)framePtr;
  8.  
  9. if (infoPtr == NULL) {
  10. return TCL_ERROR;
  11. }
  12. if (myFramePtr == NULL) {
  13. if (interp == NULL) {
  14. return TCL_ERROR;
  15. }
  16. myFramePtr = ((Interp *)interp)->varFramePtr;
  17. }
  18. infoPtr->nsPtr = (Tcl_Namespace *)myFramePtr->nsPtr;
  19. infoPtr->flags = myFramePtr->isProcCallFrame;
  20. infoPtr->objc = myFramePtr->objc;
  21. infoPtr->objv = myFramePtr->objv;
  22. infoPtr->callerPtr = (Tcl_CallFrame *)myFramePtr->callerPtr;
  23. infoPtr->callerVarPtr = (Tcl_CallFrame *)myFramePtr->callerVarPtr;
  24. infoPtr->level = myFramePtr->level;
  25. infoPtr->procPtr = (Tcl_Proc)myFramePtr->procPtr;
  26. infoPtr->clientData = myFramePtr->clientData;
  27. #ifdef ARNULF_FOR_ITCL_CODE
  28. infoPtr->resolvePtr = myFramePtr->resolvePtr;
  29. #endif
  30. return TCL_OK;
  31. }
  32.  
  33. int
  34. _Tcl_SetCallFrameInfo(
  35. Tcl_Interp *interp, /* Interpreter in which to look for */
  36. Tcl_CallFrame *framePtr, /* if NULL use framePtr from interp */
  37. CONST Tcl_CallFrameInfo *infoPtr) /* Where to find information */
  38. {
  39. CallFrame *myFramePtr = (CallFrame *)framePtr;
  40.  
  41. if (infoPtr == NULL) {
  42. return TCL_ERROR;
  43. }
  44. if (myFramePtr == NULL) {
  45. if (interp == NULL) {
  46. return TCL_ERROR;
  47. }
  48. myFramePtr = ((Interp *)interp)->varFramePtr;
  49. }
  50. myFramePtr->nsPtr = (Namespace *)infoPtr->nsPtr;
  51. myFramePtr->isProcCallFrame = infoPtr->flags;
  52. myFramePtr->objc = infoPtr->objc;
  53. myFramePtr->objv = infoPtr->objv ;
  54. myFramePtr->procPtr = (Proc *)infoPtr->procPtr;
  55. myFramePtr->clientData = infoPtr->clientData;
  56. #ifdef ARNULF_FOR_ITCL_CODE
  57. myFramePtr->resolvePtr = infoPtr->resolvePtr;
  58. #endif
  59. return TCL_OK;
  60. }
  61.  

Comments

Posted by apw at Tue Aug 07 20:02:14 GMT 2007 [text] [code]

sorry, forgot to add the struct: typedef struct Tcl_CallFrameInfo { Tcl_Namespace *nsPtr; int flags; int objc; Tcl_Obj *CONST *objv; Tcl_CallFrame CONST *callerPtr; Tcl_CallFrame CONST *callerVarPtr; int level; Tcl_Proc procPtr; ClientData clientData; #ifdef ARNULF_FOR_ITCL_CODE Tcl_Resolve *resolvePtr; #endif } Tcl_CallFrameInfo;