change drracket and framework so they don't rebind printf anymore

(instead binding oprintf to print to the original output port of drracket)
This commit is contained in:
Robby Findler 2011-01-02 10:00:46 -06:00
parent 1be502ed79
commit 7eb3e8c28a
5 changed files with 9 additions and 30 deletions

View File

@ -28,6 +28,7 @@ profile todo:
(for-syntax racket/base)) (for-syntax racket/base))
(define orig (current-output-port)) (define orig (current-output-port))
(define (oprintf . args) (apply fprintf orig args))
(provide debug@) (provide debug@)
(define-unit debug@ (define-unit debug@
@ -39,10 +40,6 @@ profile todo:
[prefix drracket:init: drracket:init^]) [prefix drracket:init: drracket:init^])
(export drracket:debug^) (export drracket:debug^)
(define (printf . args) (apply fprintf orig args))
; ;
; ;
; ; ; ;

View File

@ -1,8 +1,4 @@
#lang racket/unit #lang racket/unit
;; WARNING: printf is rebound in this module to always use the
;; original stdin/stdout of drscheme, instead of the
;; user's io ports, to aid any debugging printouts.
;; (esp. useful when debugging the users's io)
(require "drsig.rkt" (require "drsig.rkt"
string-constants string-constants
@ -36,7 +32,7 @@
(export drracket:language^) (export drracket:language^)
(define original-output-port (current-output-port)) (define original-output-port (current-output-port))
(define (printf . args) (apply fprintf original-output-port args)) (define (oprintf . args) (apply fprintf original-output-port args))
(define-struct text/pos (text start end)) (define-struct text/pos (text start end))
;; text/pos = (make-text/pos (instanceof text% number number)) ;; text/pos = (make-text/pos (instanceof text% number number))

View File

@ -15,11 +15,6 @@ TODO
; =Handler= means in the handler thread of some eventspace; it must ; =Handler= means in the handler thread of some eventspace; it must
; be combined with either =Kernel= or =User= ; be combined with either =Kernel= or =User=
;; WARNING: printf is rebound in this module to always use the
;; original stdin/stdout of drscheme, instead of the
;; user's io ports, to aid any debugging printouts.
;; (esp. useful when debugging the users's io)
(require racket/class (require racket/class
racket/path racket/path
racket/pretty racket/pretty
@ -40,6 +35,10 @@ TODO
(provide rep@ with-stack-checkpoint) (provide rep@ with-stack-checkpoint)
(define orig-output-port (current-output-port))
(define (oprintf . args) (apply fprintf orig-output-port args))
;; run a thunk, and if an exception is raised, make it possible to cut the ;; run a thunk, and if an exception is raised, make it possible to cut the
;; stack so that the surrounding context is hidden ;; stack so that the surrounding context is hidden
(define checkpoints (make-weak-hasheq)) (define checkpoints (make-weak-hasheq))
@ -334,8 +333,6 @@ TODO
;; queue is full): ;; queue is full):
(define output-limit-size 2000) (define output-limit-size 2000)
(define (printf . args) (apply fprintf drracket:init:original-output-port args))
(define setup-scheme-interaction-mode-keymap (define setup-scheme-interaction-mode-keymap
(λ (keymap) (λ (keymap)
(define (beginning-of-line text select?) (define (beginning-of-line text select?)

View File

@ -47,8 +47,8 @@ If the namespace does not, they are colored the unbound color.
"traversals.rkt") "traversals.rkt")
(provide tool@) (provide tool@)
(define o (current-output-port)) (define orig-output-port (current-output-port))
(define (oprintf . args) (apply fprintf o args)) (define (oprintf . args) (apply fprintf orig-output-port args))
(define status-init (string-constant cs-status-init)) (define status-init (string-constant cs-status-init))
(define status-coloring-program (string-constant cs-status-coloring-program)) (define status-coloring-program (string-constant cs-status-coloring-program))
@ -86,8 +86,6 @@ If the namespace does not, they are colored the unbound color.
(drracket:unit:add-to-program-editor-mixin clearing-text-mixin)) (drracket:unit:add-to-program-editor-mixin clearing-text-mixin))
(define (phase2) (void)) (define (phase2) (void))
(define (printf . args) (apply fprintf o args))
;;; ;;; ;;; ;;;;; ;;; ;;; ;;; ;;;;;
; ; ; ; ; ; ; ; ; ;
; ; ; ; ; ; ; ; ; ;

View File

@ -1,10 +1,4 @@
#lang racket/unit #lang racket/unit
#|
WARNING: printf is rebound in the body of the unit to always
print to the original output port.
|#
(require string-constants (require string-constants
racket/unit racket/unit
@ -37,10 +31,7 @@ WARNING: printf is rebound in the body of the unit to always
(init-depend framework:editor^) (init-depend framework:editor^)
(define original-output-port (current-output-port)) (define original-output-port (current-output-port))
(define (printf . args) (define (oprintf . args) (apply fprintf original-output-port args))
(apply fprintf original-output-port args)
(void))
(define-struct range (start end caret-space? style color) #:inspector #f) (define-struct range (start end caret-space? style color) #:inspector #f)
(define-struct rectangle (left top right bottom style color) #:inspector #f) (define-struct rectangle (left top right bottom style color) #:inspector #f)