"(debug-enable 'debug)\n" "(debug-enable 'trace)\n" "(debug-enable 'backtrace)\n" "(use-modules (ice-9 stack-catch))\n" "(define (pd-load-if-exists filename)\n" " (if (access? filename F_OK)\n" " (load filename)))\n" "(define (pd-display . args)\n" " (if (not (null? args))\n" " (begin\n" " (display (car args))\n" " (apply pd-display (cdr args)))\n" " (newline)))\n" "(define (pd-filter proc list)\n" " (if (null? list)\n" " '()\n" " (if (proc (car list))\n" " (cons (car list) (pd-filter proc (cdr list)))\n" " (pd-filter proc (cdr list)))))\n" "(define (pd-for init pred least add proc)\n" " (if (pred init least)\n" " (begin\n" " (proc init)\n" " (pd-for (+ add init) pred least add proc))))\n" "(define (pd-check-number number message)\n" " (if (number? number)\n" " #t\n" " (begin\n" " (pd-display message \": \" number \" is not a number\")\n" " #f)))\n" "(define pd-global-bindings '())\n" "(define (pd-bind-do symbol func bindings)\n" " (if (or (not (symbol? symbol))\n" " (not (procedure? func)))\n" " (begin\n" " (pd-display \"Wrong arguments for pd-bind\")\n" " bindings)\n" " (cons (list symbol \n" " func\n" " (pd-c-bind symbol func))\n" " bindings)))\n" "(define (pd-unbind-do symbol bindings)\n" " (if (not (symbol? symbol))\n" " (begin\n" " (pd-display \"Wrong arguments for pd-unbind\")\n" " bindings)\n" " (let ((binding (assq symbol bindings)))\n" " (pd-c-unbind (caddr binding) symbol)\n" " (pd-filter (lambda (x) (not (eq? symbol (car x))))\n" " bindings))))\n" "(define (pd-bind symbol func)\n" " (set! pd-global-bindings (pd-bind-do symbol func pd-global-bindings)))\n" "(define (pd-unbind symbol)\n" " (set! pd-global-bindings (pd-unbind-do symbol pd-global-bindings)))\n" "(define (pd-send symbol firstarg . args)\n" " (if (or (symbol? symbol)\n" " (number? symbol))\n" " (cond ((> (length args) 0) (pd-c-send-list symbol (cons firstarg args)))\n" " ((list? firstarg) (pd-c-send-list symbol firstarg))\n" " ((number? firstarg) (pd-c-send-number symbol firstarg))\n" " ((string? firstarg) (pd-c-send-string symbol firstarg))\n" " ((eq? 'bang firstarg) (pd-c-send-bang symbol))\n" " ((symbol? firstarg) (pd-c-send-symbol symbol firstarg))\n" " (else\n" " (pd-display \"Unknown argument to pd-outlet-or-send:\" firstarg)))))\n" "(define (pd-get-symbol sym)\n" " (if (not (symbol? sym))\n" " (pd-display sym \" is not a scheme symbol\")\n" " (pd-c-get-symbol sym)))\n" "(define (pd-backtrace-eval string)\n" " (eval-string string))\n" "(define (pd-display-errorfunc key . args)\n" " (let ((dasstack (make-stack #t)))\n" " (display-backtrace dasstack (current-output-port) #f #f)\n" " ;(display (stack-ref (make-stack #t) 1))\n" " ;(display (stack-length (make-stack #t)))\n" " (display key)(newline)\n" " (display args)\n" " (newline))\n" " 0)\n" "(define (pd-backtrace-run thunk)\n" " (stack-catch #t\n" " thunk\n" " pd-display-errorfunc))\n" "(define (pd-backtrace-runx func arg1) \n" " (stack-catch #t\n" " (lambda x\n" " (apply func x))\n" " pd-display-errorfunc))\n" "(define (pd-backtrace-run1 func arg1)\n" " (stack-catch #t\n" " (lambda ()\n" " (func arg1))\n" " pd-display-errorfunc))\n" "(define (pd-backtrace-run2 func arg1 arg2)\n" " (stack-catch #t\n" " (lambda ()\n" " (func arg1 arg2))\n" " pd-display-errorfunc))\n" "(define (pd-backtrace-run3 func arg1 arg2 arg3)\n" " (stack-catch #t\n" " (lambda ()\n" " (func arg1 arg2 arg3))\n" " pd-display-errorfunc))\n" "(define (pd-backtrace-run4 func arg1 arg2 arg3 arg4)\n" " (stack-catch #t\n" " (lambda ()\n" " (func arg1 arg2 arg3 arg4))\n" " pd-display-errorfunc))\n" "(pd-backtrace-run1 pd-load-if-exists \"/etc/.k_guile.scm\")\n" "(pd-backtrace-run1 pd-load-if-exists (string-append (getenv \"HOME\") \"/.k_guile.scm\"))\n"