~ubuntu-branches/ubuntu/trusty/librep/trusty

« back to all changes in this revision

Viewing changes to lisp/rep/io/streams.jl

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2001-11-13 15:06:22 UTC
  • Revision ID: james.westby@ubuntu.com-20011113150622-vgmgmk6srj3kldr3
Tags: upstream-0.15.2
ImportĀ upstreamĀ versionĀ 0.15.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#| rep.io.streams bootstrap
 
2
 
 
3
   $Id: streams.jl,v 1.3 2000/08/16 10:54:04 john Exp $
 
4
 
 
5
   Copyright (C) 2000 John Harper <john@dcs.warwick.ac.uk>
 
6
 
 
7
   This file is part of librep.
 
8
 
 
9
   librep is free software; you can redistribute it and/or modify it
 
10
   under the terms of the GNU General Public License as published by
 
11
   the Free Software Foundation; either version 2, or (at your option)
 
12
   any later version.
 
13
 
 
14
   librep is distributed in the hope that it will be useful, but
 
15
   WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
   GNU General Public License for more details.
 
18
 
 
19
   You should have received a copy of the GNU General Public License
 
20
   along with librep; see the file COPYING.  If not, write to
 
21
   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
22
|#
 
23
 
 
24
(declare (in-module rep.io.streams))
 
25
 
 
26
(open-structures '(rep.lang.symbols
 
27
                   rep.data))
 
28
 
 
29
;; Setup format-hooks-alist to a few default'ish things
 
30
(defvar format-hooks-alist '((?D . file-name-directory)
 
31
                             (?F . file-name-nondirectory)))
 
32
 
 
33
(defun prin1-to-string (arg)
 
34
  "Return a string representing ARG."
 
35
  (format nil "%S" arg))
 
36
 
 
37
(defun read-from-string (string #!optional start)
 
38
  "Reads an object from STRING, starting at character number START (default
 
39
is 0)."
 
40
  (read (make-string-input-stream string start)))
 
41
 
 
42
(defun streamp (arg)
 
43
  "Returns true if ARG is some sort of I/O stream."
 
44
  (or (input-stream-p arg) (output-stream-p arg)))
 
45
 
 
46
(export-bindings '(prin1-to-string read-from-string streamp))