9.24 ppt-macros

9.24 ppt-macros - ; ; ; ; Kathi Fisler Powerpoint exercise...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
;; Kathi Fisler ;; Powerpoint exercise ;; Stage 4 : macro front-end ;; February 2, 2003 ;;;;;;;;;;;;;;; THE INTERFACE LANGUAGE ;;;;;;;;;;;;;;;;;;;;;;; ;; print-string : string -> void ;; prints string and a newline to the screen (define (print-string str) (printf "~a~n" str)) ;; print-newline : -> void ;; prints a newline on the screen (define (print-newline) (printf "~n")) ;; print-unnumbered-strings : list[string] -> void ;; prints a list of strings to the screen, each prefixed with a - (define (print-unnumbered-strings strlist) (for-each (lambda (str) (printf "- ~a~n" str)) strlist)) ;; print-numbered-strings : list[string] -> void ;; prints a list of strings to the screen, each prefixed with ;; a number (in consecutive increasing order) (define (print-numbered-strings strlist label) (cond [(empty? strlist) void] [(cons? strlist) (begin (printf "~a. ~a~n" label (first strlist)) (print-numbered-strings (rest strlist) (+ 1 label)))])) ;; await-click : -> void ;; mimics a mouse click by waiting for the user to type a character (define (await-click) (read)) ;;;;;;;;;; INTERFACE HELPERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; print-slide-title : string -> void ;; displays title of slide on screen (define (print-slide-title title-str) (print-string (string-append "Title: " title-str)) (print-newline)) ;; print-slide-body : slide-body -> void ;; displays contents of body on screen (define (print-slide-body body) (cond [(string? body) (print-string body)] [(pointlist? body) (cond [(pointlist-numbered? body) (print-numbered-strings (pointlist-points body) 1)] [else (print-unnumbered-strings (pointlist-points body))])])) ;; print-slide : slide -> void ;; displays contents of slide on screen (define (print-slide aslide) (begin (print-string "------------------------------")
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
(print-slide-title (slide-title aslide)) (print-slide-body (slide-body aslide)) (print-string "------------------------------"))) ;; end-show : -> void ;; displays end of show message on screen (define (end-show) (print-string "End of show")) ;;;;;;;;;;;; THE DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; a slide is a (make-slide string slide-body) (define-struct slide (title body)) ;; a slide-body is either ;; - a string (paragraph), or ;; - a (make-pointlist list[string] boolean) (define-struct pointlist (points numbered?)) ;; A cmd is ;; - (make-display (-> slide)) ;; - (make-timecond (time->boolean) section section) (define-struct display (slide)) (define-struct timecond (time-limit within-time over-time)) ;; A talk is a list of sections (define-struct talk (sects))
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

9.24 ppt-macros - ; ; ; ; Kathi Fisler Powerpoint exercise...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online