;;;; Copyright 2002, Jonathan Bachrach.  See file TERMS.

(use goo/boot)
(use goo/fun)
(use goo/class)
(use goo/macros)
(use goo/types)
(use goo/any)
(use goo/mag)
(use goo/log)
(use goo/chr)
(use goo/math)
(use goo/functional)
(use goo/loc)
(use goo/sym)
(use goo/conditions)
(use goo/cols)
(use goo/packer)
(use goo/io/write)
(use goo/io/read)
(use goo/io/port)
(use goo/late-macros)

(export
 ;; Section 1.1/2.1: Special forms.
 IF SEQ SET FUN LET DEF LOC ESC FIN D. DV DDV DM DG DP DP! DC MACRO-EXPAND
 SUP APP-SUP QUOTE
 CT CT-ALSO DS USE USE/MANGLE USE/EXPORT USE/INCLUDE USE/LIBRARY EXPORT 

 ;; Section 1.2/2.2: Macros.
 DF TRY REP MIF AND OR CASE CASE-BY COND MATCH UNLESS WHEN ASSERT
 FOR WHILE UNTIL OPF PUSHF POPF INCF DECF SWAPF ROTF OR/SET
 OP PUB EXPORTED
 PACKING-WITH PACKING-IN PACKING PACKING-AS PACK-IN PACK PACKED
 <PACKER> PACKER PACKER-FAB PACKER-ADD PACKER-RES
 RENEW     ;; TODO: TEMPORARY

 ;; Section 1.3: Read macros.
 quasiquote
 
 ;; Section 3.1: Any.
 <any> as new class-of clone
 
 ;; Section ?.?: Type.
 <type>
 <class>     class-parents class-children class-direct-props
             class-ancestors              class-props
             class-name
 <singleton> type-object
 <subclass>  type-class
 <union>     union-elts
 <product>   product-elts

 ;; Section 3.2: Comparables.
 == = < ~= ~== > <= >= min max subtype? isa? may-isa? 
 
 ;; Section 3.4: Booleans.
 <log> not
 
 ;; Section 3.5: Characters.
 <chr> lower? upper? to-lower to-upper alpha?
 digit? to-digit eof-object?
 
 ;; Section 3.6: Numbers.
 ;; Not included: gcd, lcm (which seem to be missing).
 <num> + 1+ - 1- * / floor ceil round trunc floor/ ceil/ round/
 trunc/ mod mod+ modincf rem div pos? zero? neg? neg abs *print-base*
 num-to-str num-to-str-base str-to-num
 log logn pow sqrt isqrt sin cos tan asin acos atan atan2 sinh cosh tanh $pi $e
 <int> #| ^ & ~ bit? even? odd? << >> >>> $max-int $min-int
 <flo> flo-bits
 <loc> loc-val loc-val-setter address-of
 
 ;; Section 3.7: Collections.
 <col> <col.> len elt elt-or elts low-elt dup col-res col-res-type
 nul? nul elt-default elt-type key-type key-test fab fabs fill any?
 all? fold fold+ find find-or del zap do do2 do3 map map2 do-keyed
 map-keyed mem? keys items zap find find-or 
 <col!> del! elt! add! zap! fill! into
 elt-setter low-elt-setter len-setter len/fill-setter 
 <range-error> range-error-collection range-error-key
 ;; 3.7.1: Iteration protocol.
 <enum> enum fin? nxt now now-setter now-key
 ;; 3.7.2: Maps.
 <map> col ;; <assocs> assocs-test
 <tab> tab-growth-factor tab-growth-threshold tab-shrink-threshold
 tab-hash id-hash ;; $permanent-hash-state tab-gc-state 
 <str-tab> case-insensitive-string-hash case-insensitive-string-equal
 <set>
 ;; 3.7.3: Sequences.
 <seq> <seq.> add 1st 2nd 3rd last pos rev cat cat2 sub sub* push pop
 pick reject ins del-vals del-dups finds sort sort-by 
 prefix? suffix? repeat split join
 <seq!>  add! rev! cat! sub-setter sub*-setter 
 push! pop! del-vals! del-dups! sort! sort-by!
 ;; 3.7.4 Tuples.
 <tup> tup
 ;; 3.7.5 (the first one): Lists.
 <lst> <list> head head-setter tail tail-setter lst list pair nil push! pop!
 ;; 3.7.5 (the second one): Optionals.
 <opts>
 ;; 3.7.6 (the first one): Flat sequences.
 <flat> <str> str to-str <vec> vec 
 low-elt low-elt-setter
 ;; 3.7.6 (the second one):  Ranges.
 <range> range range-by from below
 ;; 3.7.7: Steps.
 <step> first-then
 <each> each
 <zip> zip unzip
 <cycle> cycle
 
 ;; Section 3.8: Symbols.
 <sym> as cat-sym gensym fab-setter-name var-name var-type

 ;; Section 3.9: Props.
 <prop> prop-owner prop-getter prop-setter prop-type prop-init
 prop-value prop-value-setter prop-bound? find-getter find-setter add-prop

 ;; Section 3.10: Functions.
 <fun> fun-name fun-names fun-specs fun-nary? fun-arity fun-val
 identity compose curry rcurry always app 
 <gen> fun-mets gen-add-met ord-app-mets
 <met> met-app?

 ;; Section 3.11: Conditions.
 <condition> default-handler sig <simple-condition> condition-message
 condition-arguments <serious-condition> <error> error <simple-error>
 <handler> handler-function fab-handler handler-matches?
 <restart>
 <type-error> type-error-value type-error-type 
 <as-error>
 <call-error> call-error-function call-error-arguments
 <return-type-error> <argument-type-error>
 <arity-error> <narity-error> narity-error arity-error 
 <ambiguous-method-error> <no-applicable-methods-error>
 <no-next-methods-error> no-next-methods-error
 <unknown-function-error>
 <unbound-error> 
 <unbound-variable-error> unbound-variable-error-variable
 <compiler-error> <syntax-error>
 <macro-error> macro-error-name macro-error-arguments
 <stack-overflow> <internal-error> internal-error
 <assert-error> assert-error
 <property-error> <property-unbound-error>
 <property-not-found-error> <property-type-error>
 property-error-generic property-error-owner
 <arithmetic-error>
 <keyboard-interrupt>

 ;; Section 3.12: Ports.
 <port> <in-port> get gets peek ready? port-line
 in out open close with-port
 <out-port> newline force-out put puts
 <file-port> <file-in-port> <file-out-port> 
 <io-error> <file-opening-error> file-opening-error-filename
 <str-port> port-contents <str-in-port> port-index
 <str-out-port> port-to-str

 ;; Section 3.13: In.
 read read-from-string
 ;; TODO - Defined in top, where we can't export it: read-file

 ;; Section 3.14: Output.
 write emit writeln write-to-string msg post say msg-to-str
 *max-print-length* *max-print-depth*

 ;; Section 3.15: System.
 app-filename app-args

 ;; Section 3.16: Top level.
 ;; See goo/eval.

 ;; Undocumented stuff.  This was all found by a process of trial and
 ;; error, but it needs to be here.
 match-atom match-nul-list match-unquote match-sublist
 %pair fab-pair %next-methods %define-method %prop %prop-unbound-error
 <handler-info>
 $default-handler-info
 <simple-handler-info>
 handler-info-message
 handler-info-arguments
 napp

 ;; Stuff which should be documented.
 need-implementation bound? dlet t+ t= t< t? t*
 describe-condition
 )

;; TODO: TEMPORARY
(export 
  any2?
  all2?)

;; TODO: DEPRECATED
(export
  empty? empty)

;; TODO: HYGIENE
(export
  fab-class
  pe-msg
  macro-error
  %prop
  %fun-reg
  @not @==
  @checked-next-methods
  prop-value-at
  prop-value-at-setter
  )
