Arc Forumnew | comments | leaders | submitlogin
3 points by zhtw 5573 days ago | link | parent

If you're interested here is my startup script. It defines "import" macro which is the same as "load" but path is treated related to arc base prefix. "arc" is the startup script itself. Options -l allows to load arc-file before prompth. "boot.scm" is my replacement for as.scm.

arc: #!/bin/sh

  mzscheme=/usr/local/mzscheme372/bin/mzscheme
  pkgbase=/home/avl/pkg

  prog=""

  while [ "$#" -gt 0 ]; do
    if [ "x$1" = "x-l" ]; then
      shift
      [ -f "$1" ] || { echo "No such file ($1)"; exit 1; }
      loadstr="$loadstr (load \"$1\")"
      shift
    else
      [ -f "$1" ] || { echo "No such file ($1)"; exit 1; }
      prog="$1"
      shift
    fi
  done

  if [ -z "$prog" ]; then
    ( echo "$loadstr"; cat; echo " (quit)" ) |
      ( "$mzscheme" -m -f "$pkgbase/arc/boot.scm"; echo )
  else
    ( echo "$loadstr"; echo "(load \"$prog\") (quit)"; ) |
      exec "$mzscheme" -m -f "$pkgbase/arc/boot.scm"
  fi
boot.scm:

  (require mzscheme) ; promise we won't redefine mzscheme bindings

  (define arcbase "/home/avl/pkg/arc/arc3")
  (define arclibs "/home/avl/pkg/arc/lib")

  (define current-dir (path->string (current-directory)))
  (current-directory arcbase)

  (require "arc3/ac.scm") 
  (require "arc3/brackets.scm")
  (use-bracket-readtable)

  (aload "arc.arc")
  (aload "libs.arc") 

  ;(xdef 'curdir current-directory)
  ;(xdef 'pkgbase arclibs)

  (current-directory "/home/avl/pkg/arc")
  (aload "init.arc")
  (current-directory current-dir)

  (tl)
init.arc:

  (load "import.arc")
import.arc:

  ; import is the the same as load but path is threated related to pkgbase

  (def namechain->path (l)
    (tostring (each x l (pr "/" x))))

  (mac import namechain
    `(load (string pkgbase (namechain->path ',namechain) ".arc")))

  ; (import sys stream) -- that's my personal stuff.
So you just need to substitute /home/avl/pkg/arc with the path where your arc3 dir is placed.

And one last thing. If you install rlfe it's convenient to rename "arc" to "real-arc" and start it by "/usr/bin/rlfe real-arc" from "arc".

Hope this will be usefull.



1 point by edeion 5572 days ago | link

Thank you! I'm not using it right now, but it may come in handy sooner or later.

-----