updated many unions to or/c's

svn: r2061

original commit: fddb1fa862b6e0e8e71f011dcdda5309e64635e1
This commit is contained in:
Robby Findler 2006-01-31 19:17:33 +00:00
parent 7fbb670b32
commit 70a100e7f7
7 changed files with 86 additions and 87 deletions

View File

@ -228,7 +228,7 @@
"default preferences.")
(preferences:add-panel
((union string? (cons/c string? (listof string?)))
((or/c string? (cons/c string? (listof string?)))
((is-a?/c area-container-window<%>)
. ->d .
(λ (parent)
@ -494,13 +494,13 @@
(opt->
()
(string?
(union false/c path?)
(or/c false/c path?)
boolean?
string?
(union false/c byte-regexp?)
(or/c false/c byte-regexp?)
string?
(union (is-a?/c top-level-window<%>) false/c))
(union false/c path?))
(or/c (is-a?/c top-level-window<%>) false/c))
(or/c false/c path?))
(()
((name "Untitled")
(directory #f)
@ -518,12 +518,12 @@
(finder:common-get-file
(opt->
()
((union path? false/c)
((or/c path? false/c)
string?
(union byte-regexp? false/c)
(or/c byte-regexp? false/c)
string?
(union false/c (is-a?/c top-level-window<%>)))
(union path? false/c))
(or/c false/c (is-a?/c top-level-window<%>)))
(or/c path? false/c))
(()
((directory #f)
(prompt "Select File")
@ -540,13 +540,13 @@
(opt->
()
(string?
(union false/c path?)
(or/c false/c path?)
boolean?
string?
(union false/c byte-regexp?)
(or/c false/c byte-regexp?)
string?
(union (is-a?/c top-level-window<%>) false/c))
(union false/c path?))
(or/c (is-a?/c top-level-window<%>) false/c))
(or/c false/c path?))
(()
((name "Untitled")
(directory #f)
@ -564,12 +564,12 @@
(finder:std-get-file
(opt->
()
((union path? false/c)
((or/c path? false/c)
string?
(union byte-regexp? false/c)
(or/c byte-regexp? false/c)
string?
(union false/c (is-a?/c top-level-window<%>)))
(union path? false/c))
(or/c false/c (is-a?/c top-level-window<%>)))
(or/c path? false/c))
(()
((directory #f)
(prompt "Select File")
@ -586,13 +586,13 @@
(opt->
()
(string?
(union false/c path?)
(or/c false/c path?)
boolean?
string?
(union false/c byte-regexp?)
(or/c false/c byte-regexp?)
string?
(union (is-a?/c top-level-window<%>) false/c))
(union false/c path?))
(or/c (is-a?/c top-level-window<%>) false/c))
(or/c false/c path?))
(()
((name "Untitled")
(directory #f)
@ -614,12 +614,12 @@
(finder:get-file
(opt->
()
((union path? false/c)
((or/c path? false/c)
string?
(union byte-regexp? string? false/c)
(or/c byte-regexp? string? false/c)
string?
(union false/c (is-a?/c top-level-window<%>)))
(union path? false/c))
(or/c false/c (is-a?/c top-level-window<%>)))
(or/c path? false/c))
(()
((directory #f)
(prompt "Select File")
@ -639,12 +639,12 @@
(finder:common-get-file-list
(opt->
()
((union false/c path?)
((or/c false/c path?)
string?
(union false/c byte-regexp?)
(or/c false/c byte-regexp?)
string?
(union false/c (is-a?/c top-level-window<%>)))
(union (listof path?) false/c))
(or/c false/c (is-a?/c top-level-window<%>)))
(or/c (listof path?) false/c))
(()
((directory #f)
(prompt "Select File")
@ -699,7 +699,7 @@
(handler)
"Extracts the name from a handler.")
(handler:handler-extension
(handler:handler? . -> . (union (path? . -> . boolean?) (listof string?)))
(handler:handler? . -> . (or/c (path? . -> . boolean?) (listof string?)))
(handler)
"Extracts the extension from a handler.")
(handler:handler-handler
@ -708,8 +708,8 @@
"Extracs the handler's handling function")
(handler:insert-format-handler
(string?
(union string? (listof string?) (path? . -> . boolean?))
(path? . -> . (union false/c (is-a?/c frame:editor<%>)))
(or/c string? (listof string?) (path? . -> . boolean?))
(path? . -> . (or/c false/c (is-a?/c frame:editor<%>)))
. -> .
void?)
(name pred handler)
@ -744,9 +744,9 @@
(handler:edit-file
(opt->
((union path? false/c))
((or/c path? false/c))
((-> (is-a?/c frame:editor<%>)))
(union false/c (is-a?/c frame:editor<%>)))
(or/c false/c (is-a?/c frame:editor<%>)))
((filename)
((make-default (λ () ((handler:current-create-new-window) filename)))))
"This function creates a frame or re-uses an existing frame to edit a file. "
@ -790,8 +790,8 @@
(handler:current-create-new-window
(case->
(((union false/c path?) . -> . (is-a?/c frame%)) . -> . void)
(-> ((union false/c string?) . -> . (is-a?/c frame%))))
(((or/c false/c path?) . -> . (is-a?/c frame%)) . -> . void)
(-> ((or/c false/c string?) . -> . (is-a?/c frame%))))
((new-window-handler) ())
"This is a parameter that controls how the framework"
"creates new application windows."
@ -805,7 +805,7 @@
"\\end{schemedisplay}")
(handler:open-file
(-> (union false/c (is-a?/c frame:basic<%>)))
(-> (or/c false/c (is-a?/c frame:basic<%>)))
()
"This function queries the user for a filename and opens the file for"
"editing. It uses "
@ -1298,7 +1298,7 @@
(scheme:text-balanced?
(opt->
((is-a?/c text%))
(number? (union false/c number?))
(number? (or/c false/c number?))
boolean?)
((text)
((start 0) (end #f)))
@ -1516,7 +1516,7 @@
"Builds a printed representation for a style-delta.")
(color-prefs:unmarshall-style
(-> printable/c (union false/c (is-a?/c style-delta%)))
(-> printable/c (or/c false/c (is-a?/c style-delta%)))
(marshalled-style-delta)
"Builds a style delta from its printed representation."
"Returns \\scheme|#f| if the printed form cannot be parsed.")

View File

@ -150,9 +150,9 @@
(string?
string?)
(boolean?
(union false/c
(is-a?/c frame%)
(is-a?/c dialog%)))
(or/c false/c
(is-a?/c frame%)
(is-a?/c dialog%)))
(symbols 'continue 'save 'cancel))
((filename action)
((can-save-now? #f)
@ -175,7 +175,7 @@
string?)
(string?
any/c
(union false/c (is-a?/c frame%) (is-a?/c dialog%))
(or/c false/c (is-a?/c frame%) (is-a?/c dialog%))
(symbols 'app 'caution 'stop))
any/c)
((message true-choice false-choice)

View File

@ -80,7 +80,7 @@
;; ((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 (λ (str)
((or/c (λ (str)
(and (string? str)
(test:top-level-focus-window-has?
(λ (c)
@ -104,7 +104,7 @@
"active frame. Otherwise, it pushes the button argument.")
(test:set-radio-box!
((union string? (is-a?/c radio-box%)) (union string? number?) . -> . void?)
((or/c string? (is-a?/c radio-box%)) (or/c string? number?) . -> . void?)
(radio-box state)
"Sets the radio-box to \\var{state}. If \\var{state} is a"
"string, this function finds the choice with that label and"
@ -122,7 +122,7 @@
"Finds a \\iscmclass{radio-box} that has a label \\var{entry}"
"and sets the radio-box to \\var{entry}.")
(test:set-check-box!
((union string? (is-a?/c check-box%)) boolean? . -> . void?)
((or/c string? (is-a?/c check-box%)) boolean? . -> . void?)
(check-box state)
"Clears the \\iscmclass{check-box} item if \\var{state} is \\rawscm{\\#f}, and sets it"
"otherwise."
@ -132,7 +132,7 @@
"otherwise it uses \\var{check-box} itself.")
(test:set-choice!
((union string? (is-a?/c choice%)) string? . -> . void?)
((or/c string? (is-a?/c choice%)) string? . -> . void?)
(choice str)
"Selects \\var{choice}'s item \\var{str}. If \\var{choice} is a string,"
"this function searches for a \\iscmclass{choice} with a label matching"
@ -140,7 +140,7 @@
(test:keystroke
(opt->
((union char? symbol?))
((or/c char? symbol?))
((listof (symbols 'alt 'control 'meta 'shift 'noalt 'nocontrol 'nometea 'noshift)))
void?)
((key)

View File

@ -7,12 +7,12 @@
(provide/contract
[make-bitmap-label (opt->
(string?
(union path-string?
(or/c path-string?
(is-a?/c bitmap%)))
((is-a?/c font%))
(is-a?/c bitmap%))]
[bitmap-label-maker (string?
(union path-string?
(or/c path-string?
(is-a?/c bitmap%))
. -> .
(any/c . -> . (is-a?/c bitmap%)))])

View File

@ -34,54 +34,54 @@
void?)
((is-a?/c graph-snip<%>)
(is-a?/c graph-snip<%>)
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c brush%))
(union false/c (is-a?/c brush%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c brush%))
(or/c false/c (is-a?/c brush%))
. -> .
void?)
((is-a?/c graph-snip<%>)
(is-a?/c graph-snip<%>)
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c brush%))
(union false/c (is-a?/c brush%))
(union false/c string?)
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c brush%))
(or/c false/c (is-a?/c brush%))
(or/c false/c string?)
. -> .
void?)
((is-a?/c graph-snip<%>)
(is-a?/c graph-snip<%>)
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c brush%))
(union false/c (is-a?/c brush%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c brush%))
(or/c false/c (is-a?/c brush%))
number?
number?
. -> .
void?)
((is-a?/c graph-snip<%>)
(is-a?/c graph-snip<%>)
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c brush%))
(union false/c (is-a?/c brush%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c brush%))
(or/c false/c (is-a?/c brush%))
number?
number?
(union false/c string?)
(or/c false/c string?)
. -> .
void?)))
(add-links/text-colors
((is-a?/c graph-snip<%>)
(is-a?/c graph-snip<%>)
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c pen%))
(union false/c (is-a?/c brush%))
(union false/c (is-a?/c brush%))
(union false/c (is-a?/c color%))
(union false/c (is-a?/c color%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c pen%))
(or/c false/c (is-a?/c brush%))
(or/c false/c (is-a?/c brush%))
(or/c false/c (is-a?/c color%))
(or/c false/c (is-a?/c color%))
number?
number?
(union false/c string?)
(or/c false/c string?)
. -> .
void?)))
@ -351,7 +351,7 @@
(let* ([parents-and-children (append (get-all-parents snip)
(get-all-children snip))]
[rects (eliminate-redundancies (get-rectangles snip parents-and-children))]
[union (union-rects rects)]
[or/c (or/c-rects rects)]
[text-height (call-with-values
(λ () (send dc get-text-extent "Label" #f #f 0))
(λ (w h a s) h))]
@ -366,9 +366,9 @@
(rect-top rect))
text-height)))])
(cond
[(< (rect-area union)
[(< (rect-area or/c)
(apply + (map (lambda (x) (rect-area x)) rects)))
(invalidate-rect union)]
(invalidate-rect or/c)]
[else
(for-each invalidate-rect rects)]))))
@ -414,7 +414,7 @@
sy
(+ (+ sx sw) self-offset)
(+ (+ sy sh) self-offset h)))
(union-rects (list main-snip-rect
(or/c-rects (list main-snip-rect
(snip->rect c/p))))])
(cons rect (loop (cdr c/p-snips))))]))))
@ -432,7 +432,7 @@
(- (rect-bottom rect)
(rect-top rect))))
(define/private (union-rects rects)
(define/private (or/c-rects rects)
(cond
[(null? rects) (make-rect 0 0 0 0)]
[else
@ -928,7 +928,7 @@
(and (< (min p1x p2x) x (max p1x p2x))
(< (min p1y p2y) y (max p1y p2y))))
;; find-intersection : number^8 -> (values (union #f number) (union #f number))
;; find-intersection : number^8 -> (values (or/c #f number) (or/c #f number))
;; calculates the intersection between two line segments,
;; described as pairs of points. Returns #f if they do not intersect
(define (find-intersection x1 y1 x2 y2 x3 y3 x4 y4)
@ -975,7 +975,7 @@
(values int-x int-y)
(values #f #f)))))
;; find-mb : number number number number -> (values (union #f number) (union #f number))
;; find-mb : number number number number -> (values (or/c #f number) (or/c #f number))
;; finds the "m" and "b" constants that describe the
;; lines from (x1, y1) to (x2, y2)
(define (find-mb x1 y1 x2 y2)

View File

@ -11,7 +11,7 @@
(provide/contract
(pasteboard-root ((is-a?/c aligned-pasteboard<%>) . -> . (is-a?/c aligned-pasteboard<%>)))
(pasteboard-parent
((is-a?/c pasteboard%) . -> . (union (is-a?/c editor-canvas%) (is-a?/c editor-snip%) false/c))))
((is-a?/c pasteboard%) . -> . (or/c (is-a?/c editor-canvas%) (is-a?/c editor-snip%) false/c))))
;; gets the top most aligned pasteboard in the tree of pasteboards and containers
(define (pasteboard-root pasteboard)
@ -35,5 +35,4 @@
(send admin get-snip)]
[(is-a? admin editor-admin%)
(send pasteboard get-canvas)]
[else false])))
)
[else false]))))

View File

@ -11,7 +11,7 @@
;; a snip
(define snip? (is-a?/c snip%))
;; a snip to act as the varying argument to a recursive functions
(define linked-snip? (union snip? false/c))
(define linked-snip? (or/c snip? false/c))
;; a function to act on snips being mapped
(define snip-visitor? any/c #;((snip?) (listof any/c) . ->* . (void)))
;; the rest of the lists passed to a snip mapping function
@ -24,7 +24,7 @@
(snip-height (snip? . -> . number?))
(snip-min-width (snip? . -> . number?))
(snip-min-height (snip? . -> . number?))
(snip-parent (snip? . -> . (union editor? false/c)))
(snip-parent (snip? . -> . (or/c editor? false/c)))
(fold-snip ((snip? any/c . -> . any/c) any/c linked-snip? . -> . any/c))
(for-each-snip any/c #;((snip-visitor? linked-snip?) rest-lists? . ->* . (void)))
(map-snip any/c #;((snip-visitor? linked-snip?) rest-lists? . ->* . ((listof any/c))))