;;; bootstrap.mhtml: -*- Meta-HTML -*-  Contains definitions in Meta-HTML
;;; that are loaded into the executable image of the library.
;;;
;;; The functions are initialized by a call (in the C code) to
;;; bootstrap_metahtml ().  See makebootstrap.c for more details.
;;;
;;;  Copyright (c) 1996 Brian J. Fox
;;;  Author: Brian J. Fox (bfox@ai.mit.edu) Wed Jan 29 10:14:25 1997.
;;;
<set-var bootstrapper::bootstrap-version = "Standard Bootstrap: v1.2">
<defun bootstrapper::system-initialize>
  <if <not <var-exists mhtml::cookie-eating-clients>>
      <set-var mhtml::cookie-eating-clients[] =
	<prog
	  Mozilla/
	  OmniWeb
	  ANT Fresco
	  Emacs-W3/3
	  GNNworks
	  Luxor
	  NETCOMplete
	  PRODIGY-WB/3
	  Pueblo/2
	  Spyglass Mosiac/3>>>
  <defvar mhtml::module-directories[]
    <prog
      /www/lib
      /www/bin
      /www/metahtml/lib
      /www/metahtml/bin
      <get-var mhtml::server-root>/lib
      <get-var mhtml::document-root>/lib>>
</defun>

<defun bootstrapper::initialize>
  <with-open-stream s *standard-output* mode=write-create>
    <stream-put
     s <concat
	"Meta-HTML has been bootstrapped successfully!!\n"
	"Bootstrapper Version <get-var bootstrapper::bootstrap-version>,\n"
	"For Meta-HTML Version <get-var mhtml::version>.\n">>
  </with-open-stream>
</defun>

<defun powerstrip upper lower>
  <defvar upper "+0">
  <defvar lower "-1">
  <small-caps upper=<get-var upper> lower=<get-var lower>>
    <b>PowerStrip</b>
  </small-caps>
</defun>

<include tagsets/dirfuns.mhtml>
<include tagsets/dump-package.mhtml>
<include tagsets/english-numbers.mhtml>
<include tagsets/general.mhtml>
<include tagsets/make-identifier.mhtml>
<include tagsets/menus.mhtml>
<include tagsets/message.mhtml>
<include tagsets/numbers.mhtml>
<include tagsets/pagecount.mhtml>
<include tagsets/parse-date.mhtml>
<include tagsets/plist.mhtml>
<include tagsets/source.mhtml>
<include tagsets/session.mhtml>
<include tagsets/strings.mhtml>
<include tagsets/locale.mhtml>
<include tagsets/sendmail.mhtml>
<include tagsets/this.mhtml>
<include tagsets/characters.mhtml>
<include tagsets/mhttpd.mhtml>

<defun mhtml::engine-per-page-function>
  mhtml::post-secure>
  ;;;
  ;;; Code that sets up the URL rewriter.  This has to be a per-page function
  ;;; because we haven't computed the URL of the document at the time
  ;;; this engine.conf file is read, so variables such as mhtml::http-prefix
  ;;; aren't set yet, and will be changed at the time the page location is
  ;;; computed.
  <when <get-var rewriter::engine-webpath>>
    <set-var
      mhtml::http-prefix = <get-var mhtml::http-prefix
			     rewriter::engine-webpath>
      mhtml::http-prefix-sans-sid = <get-var mhtml::http-prefix-sans-sid
				      rewriter::engine-webpath>
      mhtml::url-to-dir = <get-var mhtml::http-prefix mhtml::relative-prefix>
      mhtml::url-to-dir-sans-sid = <get-var mhtml::http-prefix-sans-sid
				     mhtml::relative-prefix>
      mhtml::full-url = <get-var mhtml::http-prefix mhtml::location>>
    <copy-var *meta-html*::rewriter::a *meta-html*::a>
    <copy-var *meta-html*::rewriter::img *meta-html*::img>
    <copy-var *meta-html*::rewriter::form *meta-html*::form>
  </when>
</defun>

<defun engine::initialize>
  <set-var mhtml::permanent-cookies = true>
  <set-var mhtml::cgi-directories[0]=/cgi-bin/>
  <set-var mhtml::per-page-function = mhtml::engine-per-page-function>
  <when <get-var mhtml::isp-engine?>>
    <set-var mhttpd::session-database-file =
      <concat /tmp/
	      <subst-in-string <get-var mhtml::include-prefix> "/" "-">
	      -sessions.db>>
    <set-var rewriter::engine-webpath = /<get-var mhtml::program-name>>
  </when>
</defun>
