Annotation of OpenXM/src/k097/debug/db.k, Revision 1.1
1.1 ! maekawa 1:
! 2: if (K00_verbose) {
! 3: Println(" debug/db.k (db.ccc), 1997, 3/2 (Sun) : checking debug functions of kxx");
! 4: Println(" Type in test0(). ");
! 5: }
! 6:
! 7: sm1(" /pushVariables {localVariables} def ");
! 8: sm1(" /popVariables {restoreVariables} def ");
! 9: if (K00_verbose) {
! 10: Println(" Overloaded on pushVariables and popVariables.");
! 11: }
! 12: sm1(" [(CatchCtrlC) 1] system_variable ");
! 13: sm1(" [(Strict) 1] system_variable ");
! 14: if (K00_verbose) {
! 15: Println(" ctrl-C signal is caught in KSexecuteString() and <<Warning>> is regarded as an error.");
! 16: }
! 17:
! 18: def test0() {
! 19: sm1(" [(ErrorMessageMode) 2] system_variable ");
! 20: sm1(" [(WarningMessageMode) 2] system_variable ");
! 21: fib(15);
! 22: sm1(" db.where.es "); /* This line will not be executed. */
! 23: }
! 24:
! 25: def void Where() {
! 26: Println("CurrentContext is ...");
! 27: sm1(" [(CurrentContextp)] system_variable {message} primmsg ");
! 28: Println("VariableStack trace is....");
! 29: sm1(" db.where ");
! 30: Println("DebugStack trace is ....");
! 31: sm1(" db.where.ds ");
! 32: Println("To clear VariableStack, DebugStack and ErrorStack, type in Cleards().");
! 33: }
! 34:
! 35: def void Cleards() {
! 36: Print("Clearing DebugStack and ErrorStack...");
! 37: sm1(" db.clear.ds db.clear.es ");
! 38: Println(" ");
! 39: Print("Restoring variables....");
! 40: sm1(" db.restore ");
! 41: sm1(" [ ] localVariables ");
! 42: /* push [ ] for this function, otherwise this function exits with error.*/
! 43: Println("Done");
! 44: }
! 45:
! 46: def fib(n) {
! 47: local ans,a,b;
! 48: Print("fib of "); Println(n);
! 49: if (n < 2) {return(1);}
! 50: a = n-1; b = n-2;
! 51: if (a == 11) {
! 52: a[i] = 2; /* We cause an error. */
! 53: }
! 54: ans = fib(a) + fib(b);
! 55: return(ans);
! 56: }
! 57:
! 58:
! 59:
! 60:
! 61:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>