From 0a14e7b5b346f686dd654784a1b2fe700ce190f5 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 10 Aug 2003 23:36:54 +0000 Subject: [PATCH] .. original commit: 78671f5cc1d716230985f9a3bd6868c91331c57d --- collects/framework/framework.ss | 42 ++++++++++++++++----------------- collects/framework/gui-utils.ss | 4 ++-- collects/framework/test.ss | 25 ++++++++++---------- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/collects/framework/framework.ss b/collects/framework/framework.ss index 862bfe73..471626e3 100644 --- a/collects/framework/framework.ss +++ b/collects/framework/framework.ss @@ -293,7 +293,7 @@ ".") (autosave:register - ((and/f (is-a?/c autosave:autosavable<%>) + ((and/c (is-a?/c autosave:autosavable<%>) (is-a?/c editor<%>)) . -> . void?) @@ -1226,10 +1226,10 @@ (scheme-paren:backward-containing-sexp (opt-> ((is-a?/c text%) - (and/f integer? exact?) - (and/f integer? exact?)) + (and/c integer? exact?) + (and/c integer? exact?)) ((union false? (is-a?/c match-cache:%))) - (union false? (and/f integer? exact?))) + (union false? (and/c integer? exact?))) ((text start end) ((cache #f))) "Returns the beginning of the interior of the (non-atomic) S-expression" @@ -1238,10 +1238,10 @@ (scheme-paren:backward-match (opt-> ((is-a?/c text%) - (and/f integer? exact?) - (and/f integer? exact?)) + (and/c integer? exact?) + (and/c integer? exact?)) ((union false? (is-a?/c match-cache:%))) - (union false? (and/f integer? exact?))) + (union false? (and/c integer? exact?))) ((text start end) ((cache #f))) "Specializes " @@ -1249,7 +1249,7 @@ "to Scheme.") (scheme-paren:balanced? - ((is-a?/c text%) (and/f integer? exact?) (and/f integer? exact?) . -> . boolean?) + ((is-a?/c text%) (and/c integer? exact?) (and/c integer? exact?) . -> . boolean?) (text start end) "Specializes " "@flink paren:balanced?" @@ -1258,10 +1258,10 @@ (scheme-paren:forward-match (opt-> ((is-a?/c text%) - (and/f integer? exact?) - (and/f integer? exact?)) + (and/c integer? exact?) + (and/c integer? exact?)) ((union false? (is-a?/c match-cache:%))) - (union false? (and/f integer? exact?))) + (union false? (and/c integer? exact?))) ((text start end) ((cache #f))) "Specializes" @@ -1339,14 +1339,14 @@ (paren:backward-match (opt-> ((is-a?/c text%) - (and/f integer? exact?) - (and/f integer? exact?) + (and/c integer? exact?) + (and/c integer? exact?) (listof (cons/p string? string?)) (listof (cons/p string? string?)) (listof string?)) (boolean? (union false? (is-a?/c match-cache:%))) - (union false? (and/f integer? exact?))) + (union false? (and/c integer? exact?))) ((text start end parens quotes comments) ((containing? #f) (cache #f))) "Returns the position in \\var{text} that ``opens'' the text ending at " @@ -1389,8 +1389,8 @@ (paren:balanced? ((is-a?/c text%) - (and/f integer? exact?) - (and/f integer? exact?) + (and/c integer? exact?) + (and/c integer? exact?) (listof (cons/p string? string?)) (listof (cons/p string? string?)) (listof string?) @@ -1410,13 +1410,13 @@ (paren:forward-match (opt-> ((is-a?/c text%) - (and/f integer? exact?) - (and/f integer? exact?) + (and/c integer? exact?) + (and/c integer? exact?) (listof (cons/p string? string?)) (listof (cons/p string? string?)) (listof string?)) ((union false? (is-a?/c match-cache:%))) - (union false? (and/f integer? exact?))) + (union false? (and/c integer? exact?))) ((text start end parens quotes comments) ((cache #f))) "This function returns the position in \\var{text} that ``closes'' the" @@ -1447,9 +1447,9 @@ "") (paren:skip-whitespace - ((is-a?/c text%) (and/f integer? exact?) (symbols 'forward 'backward) + ((is-a?/c text%) (and/c integer? exact?) (symbols 'forward 'backward) . -> . - (and/f integer? exact?)) + (and/c integer? exact?)) (text pos dir) "If \\var{dir} is \\rawscm{'forward}, this returns the position of the first" "non-whitespace character in \\var{text} after \\var{pos}. If \\var{dir}" diff --git a/collects/framework/gui-utils.ss b/collects/framework/gui-utils.ss index 603d2a6a..c5a18822 100644 --- a/collects/framework/gui-utils.ss +++ b/collects/framework/gui-utils.ss @@ -15,10 +15,10 @@ (gui-utils:trim-string (string? - (and/f number? positive?) + (and/c number? positive?) . ->d . (lambda (str size) - (and/f string? + (and/c string? (lambda (str) ((string-length str) . <= . size))))) (str size) diff --git a/collects/framework/test.ss b/collects/framework/test.ss index 873cb392..4e485514 100644 --- a/collects/framework/test.ss +++ b/collects/framework/test.ss @@ -3,7 +3,7 @@ (require (lib "mred.ss" "mred") (lib "class.ss") (lib "etc.ss") - (lib "contract.ss")) + (lib "contract.ss")) (define-syntax (provide/contract/docs stx) (syntax-case stx () @@ -80,15 +80,16 @@ ;; ((frame-has? p) f) = ;; f is a frame and it has a child (in it or a subpanel) that responds #t to p (test:button-push - ((union (and/f string? - (lambda (str) - (test:top-level-focus-window-has? - (lambda (c) - (and (is-a? c button%) - (string=? (send c get-label) str) - (send c is-enabled?) - (send c is-shown?)))))) - (and/f (is-a?/c button%) + ((union (lambda (str) + (and (string? str) + (test:top-level-focus-window-has? + (lambda (c) + (and (is-a? c button%) + (string=? (send c get-label) str) + (send c is-enabled?) + (send c is-shown?)))))) + + (and/c (is-a?/c button%) (lambda (btn) (and (send btn is-enabled?) (send btn is-shown?))) @@ -179,8 +180,8 @@ (test:mouse-click (opt-> ((symbols 'left 'middle 'right) - (and/f exact? integer?) - (and/f exact? integer?)) + (and/c exact? integer?) + (and/c exact? integer?)) ((listof (symbols 'alt 'control 'meta 'shift 'noalt 'nocontrol 'nometa 'noshift))) void?) ((button x y)