;;; -*- mode: scheme; scheme48-package: (config) -*-
;;;
;;; Scheme48 specific packages
;;;

(define-structure define-record-type*
    (export (define-record-type* :syntax)
            define-record-discloser)
  (open scheme define-record-types)
  (for-syntax (open scheme define-record-type*-expander))
  (begin (define-syntax define-record-type*
           expand-define-record-type*
           (BEGIN DEFINE DEFINE-RECORD-TYPE))))

(define-structure define-record-type*-expander
    (export expand-define-record-type*)
  (open scheme destructuring fluids signals receiving)
  (files s48-records))

(define-structure weak-pair
    (export weak-pair?
            weak-cons
            weak-pair/car?
            weak-car weak-set-car!
            weak-cdr weak-set-cdr!
            weak-memq)
  (open scheme define-record-type* weak)
  (files s48-weak-pair))

(define-structure fixnum
    (export fix:= fix:fixnum?
            fix:< fix:> fix:<= fix:>=
            fix:zero? fix:positive? fix:negative?
            fix:+ fix:- fix:*
            fix:quotient fix:remainder
            fix:1+ fix:1-
            fix:not fix:and fix:andc
            fix:or fix:xor fix:lsh)
  (open scheme bitwise)
  (files s48-fixnum))

(define-structure errors
    (export error syntax-error
	    error:bad-range-argument
	    error:datum-out-of-range
	    error:file-operation
	    error:wrong-type-argument)
  (open scheme (subset signals (error syntax-error)))
  (files s48-errors))

(define-structure aliases
    (export without-interrupts
	    unspecific
	    1+ -1+
	    delq! list-deletor!
	    vector-grow
            subvector-move-left! subvector-move-right!
            substring-move-left! substring-move-right!
            string-head string-tail
            get-environment-variable
            symbol-append symbol-name
            call-with-binary-input-file call-with-binary-output-file
            vector-8b-ref vector-8b-set!)
  (open scheme ascii interrupts util
        (modify posix-process-data (rename (lookup-environment-variable
                                            get-environment-variable)))
        srfi-1 srfi-13 srfi-43)
  (files s48-aliases))

(define-structure define-opt
    (export (define* :syntax))
  (open scheme srfi-1 let-opt)
  (for-syntax (open scheme let-opt (subset signals (syntax-error)) srfi-1))
  (files s48-define-opt))

(define-structure mit-regexp
    (export re-compile-pattern
            re-string-match
            re-substring-match
            re-string-search-forward   ; re-substring-search-forward
            ;; re-string-search-backward re-substring-search-backward
            re-match-start-index
            re-match-end-index
            re-match-extract
            regexp-group)
  (open scheme posix-regexps regexps)
  (files s48-regexp))

(define-structure mit-fileio
    (export file-eq?
            file-exists?)
  (open scheme posix-files)
  (files s48-fileio))

(define-structure pathname
    (export ->pathname
            parse-namestring
            ->namestring
            pathname-simplify

            pathname-directory
            pathname-name
            pathname-type
            pathname-version

            pathname-new-directory
            pathname-new-type
            pathname-default-directory
            pathname-default-name

            pathname?
            pathname=?
            pathname-absolute?
            directory-pathname?
            pathname-wild?
            merge-pathnames
            file-namestring
            directory-namestring
            enough-namestring
            file-pathname
            directory-pathname
            enough-pathname
            directory-pathname-as-file
            pathname-as-directory

            ;; init-file-pathname
            user-homedir-pathname
            system-library-directory-pathname
	    )
  (open scheme define-record-type* ascii
	simple-signals util methods receiving fluids cells
        mit-fileio
	posix-process-data posix-users)
  (files pathname pathname-unix s48-pathname))

(define-structure macro-helpers
    (export command-name->scheme-name
            variable-name->scheme-name
            mode-name->scheme-name
            list-ref/default
            expand-variable-assignment
            expand-variable-definition)
  (open scheme aliases errors)
  (files s48-macros-helpers))

(define-structure fixme
    (export within-editor?
            editor-error
            set-variable-value!
	    procedure-arity-valid?)
  (open scheme aliases errors
        edwin-variable edwin-variable/private)
  (files s48-fixme))

