From 4133bd73d35a0b82346e8f46e29551823f6a1447 Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Mon, 12 May 2008 00:37:55 -0700 Subject: [PATCH] Added copyright notice to pretty-formats.ss --- scheme/ikarus.pretty-formats.ss | 76 +++++++++++++++++++++++++++++++++ scheme/ikarus.pretty-print.ss | 61 +------------------------- 2 files changed, 77 insertions(+), 60 deletions(-) diff --git a/scheme/ikarus.pretty-formats.ss b/scheme/ikarus.pretty-formats.ss index 374e328..57f269c 100644 --- a/scheme/ikarus.pretty-formats.ss +++ b/scheme/ikarus.pretty-formats.ss @@ -1,3 +1,19 @@ +;;; Ikarus Scheme -- A compiler for R6RS Scheme. +;;; Copyright (C) 2006,2007,2008 Abdulaziz Ghuloum +;;; +;;; This program is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License version 3 as +;;; published by the Free Software Foundation. +;;; +;;; This program is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + + (library (ikarus.pretty-formats) (export get-fmt pretty-format) (import (except (ikarus) pretty-format)) @@ -57,3 +73,63 @@ (set-fmt! 'import '(_ tab e ...)) ) + + +#!eof + +(define (test x) + (pretty-print x) + (printf "====================================\n")) + +(test 12) +(test #t) +(test #f) +(test (if #f #f)) +(test '()) +(test "string") +(test "\n") +(test "\r") +(test (string (integer->char 0))) +(test (string (integer->char 240))) +(test 'hello) +(test '(foo bar)) +(test ' + (define pp + (case-lambda + [(x) (pretty x (current-output-port))] + [(x p) + (if (output-port? p) + (pretty x p) + (die 'pretty-print "not an output port" p))]))) + +(test '(384 7384 83947 893478 9137489 3894789 134789314 79817238 + 97314897 318947138974 981374 89137489 1374897 13498713 + 894713894 137894 89137489 1374 891348314 12 17 9000000 . 17)) + +(test '(',,@#''(quote (syntax unquote-splicing . 2) 2))) + +(test '#(1 2 3)) + +(test '#(384 7384 83947 893478 9137489 3894789 134789314 79817238 + 97314897 318947138974 981374 89137489 1374897 13498713 + 894713894 137894 89137489)) + + +(define (test-file x) + (printf "testing file ~s ...\n" x) + (with-input-from-file x + (lambda () + (let f ([i 0]) + (let ([x (read)] [fname (format "tmp.~a.pp" i)]) + (unless (eof-object? x) + (let ([y + (begin + (call-with-output-file fname + (lambda (p) + (pretty-print x p)) + 'replace) + (with-input-from-file fname read))]) + (if (equal? x y) + (f (fxadd1 i)) + (die 'test-file "mismatch" x y))))))))) + diff --git a/scheme/ikarus.pretty-print.ss b/scheme/ikarus.pretty-print.ss index 4f3b731..5031038 100644 --- a/scheme/ikarus.pretty-print.ss +++ b/scheme/ikarus.pretty-print.ss @@ -608,63 +608,4 @@ (pretty x p) (die 'pretty-print "not an output port" p))])) - ) - -#!eof - -(define (test x) - (pretty-print x) - (printf "====================================\n")) - -(test 12) -(test #t) -(test #f) -(test (if #f #f)) -(test '()) -(test "string") -(test "\n") -(test "\r") -(test (string (integer->char 0))) -(test (string (integer->char 240))) -(test 'hello) -(test '(foo bar)) -(test ' - (define pp - (case-lambda - [(x) (pretty x (current-output-port))] - [(x p) - (if (output-port? p) - (pretty x p) - (die 'pretty-print "not an output port" p))]))) - -(test '(384 7384 83947 893478 9137489 3894789 134789314 79817238 - 97314897 318947138974 981374 89137489 1374897 13498713 - 894713894 137894 89137489 1374 891348314 12 17 9000000 . 17)) - -(test '(',,@#''(quote (syntax unquote-splicing . 2) 2))) - -(test '#(1 2 3)) - -(test '#(384 7384 83947 893478 9137489 3894789 134789314 79817238 - 97314897 318947138974 981374 89137489 1374897 13498713 - 894713894 137894 89137489)) - - -(define (test-file x) - (printf "testing file ~s ...\n" x) - (with-input-from-file x - (lambda () - (let f ([i 0]) - (let ([x (read)] [fname (format "tmp.~a.pp" i)]) - (unless (eof-object? x) - (let ([y - (begin - (call-with-output-file fname - (lambda (p) - (pretty-print x p)) - 'replace) - (with-input-from-file fname read))]) - (if (equal? x y) - (f (fxadd1 i)) - (die 'test-file "mismatch" x y))))))))) - +)