;;; -*- Package: USER; Base: 10.; Mode: Lisp; Fonts:(Cptfontb) -*-
;;;
;;; $Header: /ct/interp/iocompat.l,v 1.13 84/06/25 13:57:47 alex Exp $
;;; $Log:	/ct/interp/iocompat.l,v $
;;;Revision 1.13  84/06/25  13:57:47  alex
;;;Add the end of file key.
;;;
;;;Revision 1.12  84/06/11  20:42:51  alex
;;;chnage the max integer to 2**32-1.
;;;
;;;Revision 1.11  84/04/12  14:23:43  alex
;;;Add the predicate is_control_char and local bound the base.
;;;
;;;Revision 1.10  84/02/22  20:49:51  alex
;;;Change the largest integer in ada to 2 ** 23.
;;;
;;;Revision 1.9  84/02/21  20:28:57  alex
;;;Change the largest integer in the interpreter.
;;;
;;;Revision 1.8  84/02/12  22:59:50  alex
;;;dd the function to map some of the ascii control code into lispm code.
;;;
;;;Revision 1.7  84/01/03  17:33:09  alex
;;;Replace the *integer_last* by the constant.
;;;
;;;Revision 1.6  83/12/19  12:25:40  alex
;;;Add the *seqio_eof*.
;;;
;;;Revision 1.5  83/08/08  10:08:10  mark
;;;I just corrected the commentary associated with ada_raise, to
;;;be consistent with the definitions in ds_macs.
;;;
;;;Revision 1.4  83/08/07  17:38:19  mark
;;;Checking in frozen, no other changes.
;;;
;;;Revision 1.3  83/07/04  04:27:00  mark
;;; Cleaned up a few uses of conditionalization and constants that
;;; could be avoided, and polished up some comments.
;;;
;;;
;;;Revision 1.2  83/06/27  14:10:37  penny
;;; Added header and log.
;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;			        IOCOMPAT                             ;;;
;;; John Shelton                                          May 83     ;;;
;;;                                                                  ;;;
;;     Things in this file are for compatibility for the Ada IO      ;;;
;;; package with both FranzLisp and ZetaLisp.  All conditional code  ;;;
;;; should be in here.  The definitions of the standard input and    ;;;
;;; output streams, even though system dependent, are found in       ;;;
;;; io_flavors.  Also found in this file are constants and           ;;;
;;; references to other parts of the ADA system.                     ;;;
;;;                                                                  ;;;
;;; This file is part of a proprietary software project.  Source     ;;;
;;; code and documentation describing implementation details are     ;;;
;;; available on a confidential, non-disclosure basis only.  These   ;;;
;;; materials, including this file in particular, are trade secrets  ;;;
;;; of Computer * Thought Corporation.                               ;;;
;;;                                                                  ;;;
;;; (c) Copyright 1982 and 1983,  Computer * Thought Corporation.    ;;;
;;;     All Rights Reserved.                                         ;;;
;;;                                                                  ;;;
;;; Reference materials:                                             ;;;
;;;   Foderaro and Sklower, The FRANZ LISP Manual, September 1981.   ;;;
;;;   Weinreb and Moon, LISP MACHINE MANUAL, Symbolics, July 1981.   ;;;
;;;   Charniak et al., 1980.  Artificial Intelligence Programming.   ;;;
;;;   Miller, 1982.  The C*T Ada Tutor: Guide to the Implementation. ;;;
;;; The following code assumes familiarity with these materials.     ;;;
;;;                                                                  ;;;
;;;	        ASSUMES CT_LOAD AND SUITABLE FILEMAP                 ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Ensure presence of needed files. 

(eval-when (compile load eval)
  (ct_load 'charmac))			  ;CT char set extensions.

(eval-when (compile load eval) (ct_load 'aip))	  ;AIP macros pkg. 

(eval-when (compile load eval) (ct_load 'compat)) ;Franz/LM compat pkg.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Compiler Declarations and Global Variables -- 

#+franz (declare (macros t))
(declare (ct_includef 'intrpdcl))


(defconst *ada_eol* #+lispm #\return	  ;decimal 141.
		    #+franz #\linefeed)	  ;decimal 10.

(defconst *ada_eop* #\form)		  ;140. on lispm, 12. on franz.

;;; An arbitrary decision to model EOF after unix's CTRL_D
(defconst *ada_eof* 4.)
#+(or 3600 cadr)
(defconst *keyboard_eof* '(#\end #\c-D))
#+franz
(defconst *keyboard_eof* '(#\c-D))

;;; Space is the same, decimal 32., on both systems.
(defconst *ada_space* #\space)

;;; Largest integer in Ada.  This is specified in Ada as COUNT'LAST.
(defconst *ada_max_integer* (1- (expt 2 32)))

					  ; Why these values?  ++mlm
(defconst *ada_default_width* 5)	  ; Default field width.
(defconst *ada_default_base* 10.)	  ; Default base for printing.
(defconst *ada_default_max_columns* 80.)
(defconst *ada_default_max_lines* 66.)

(defconst *seqio_eof* -1)

;;; map the control codes in ASCII into lispm
(defun map_ascii_to_lispm (code)
  (let ((base 10.) (ibase 10.))
    (cond ((and (>= code 32) (<= code 126)) code)
	  (t (ct_selectq code
			 (8  #o207)   ;; back space, need work as cntr-b
			 (9  #o211)   ;; horizontal tab
			 (10 #o215)   ;; line feed
			 (11 0)   ;; vertical tab
			 (12 #o214)   ;; form feed
			 (13 #o215)   ;; cr
			 (otherwise 0) ;; return null for the nonsenses
			 ))))
  )

;;; is a control char ?
(defun is_control_char (ch)
  (let ((base 10.) (ibase 10.))
    (or (< ch 32) (> ch 126)))
  )
			 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; The following was a temporary hack for debugging.  The
;;; correct version of this function is in ds_macs.  All that
;;; ada_raise does is call ds_raise with its first argument,
;;; which should be an exception name in all lowercase, enclosed
;;; in '|vertical bars|.  Ds_raise is also defined in ds_macs.  The
;;; old (debugging) version printed the error message (arg 2)
;;; and then called err, to abort.
;;;
;(defun ada_raise (error &optional string)
;  (ct_if string (print string))
;    (print error)
;    (err t))
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; eof
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
