;;; Copyright (C) 1996 Didier VIDAL
;;;
;;; This file is part of Scheme With Types, herein refered as SWiT.
;;;
;;; SWiT is free software; you can redistribute it and/or modify it under
;;; the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; SWiT 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 Library General Public
;;; License for more details.
;;;
;;; You should have received a copy of the GNU Library General Public License
;;; along with SWiT software; see the file COPYING.
;;; If not, write to the Free Software
;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

;;; Define which language used for help
;;; (only english is supported at the moment...)
(define *language* 'english)

;;; Some debugging tools (help, trace and step)
(load "debug.obj")

;;; objects :
(load "objects.obj")

;;; `Object-Swit' implementation of Hash
(load "hash.swt")

;;; Strings (string ports, etc.)
(load "strings.obj")

;;; Strip compile code (default #f)
;(set! *strip* #f)

;;; Disable hard-coding of primitives (default #t)
;(set! *inline* #f)

;;; Null list can be typed just as () ? (default #t)
;(set! *null-list* #f)

;;; Typing  (default #f)
;;; ==> type inference is still *very* incomplete
;;; ==> try it just for fun ;)
;;; ==> turn it off when compiling and/or loading files
;;; ==> it is very slow (it is much quicker to load files without it)
;;; ==> use the function `check-file' to check the types of your definitions
(set! *type* #f)

;;; If typing is enabled, better set *print-length*
;;; and *print-depth* to larger values :
(and *type* 
     (set! *print-length* 100)
     (set! *print-depth* 100))

;;; Standard I/O ports :
(define *stdin* (descr->port 0))
(define *stdout* (descr->port 1))
(define *stderr* (descr->port 2))

;;; Misc.
;;; To define an environment of functions (= a library) :
;;; (see also defclass in "objects.swt")
(defmacro defenv (envname . defines)
  "Macro : (defenv name (define a ...) (define b ...) ...)
gathers a sequence of defines and make them into an environment"
  `(define ,envname (begin ,@defines (closure-env))))

(define (display+ . objs) (for-each display objs))


;;; "Usual" macros
(load "macrosr5-common.swt")

;;;
(defmacro type (expr) 
  `(type->string
    (:type 
     ,`(if (symbol? ',expr)
	   (if (primitive? ,expr)
	       ,expr
	       (getprop ',expr 'src))
	   ',expr))))


;;; slib
;(load "src/slib/swit.init")

;;; Default is #f
;(set! *verbose* #t)
