Arc Forumnew | comments | leaders | submitlogin
3 points by palsecam 5615 days ago | link | parent

The patch:

   diff -Nurp 3.1orig/ac.scm 3.1/ac.scm
   --- 3.1orig/ac.scm	2009-08-10 00:42:57.000000000 +0200
   +++ 3.1/ac.scm	2009-08-10 18:59:37.000000000 +0200
   @@ -1127,29 +1127,40 @@
    (define last-condition* #f)
    
    (define (tl)
   -  (display "Use (quit) to quit, (tl) to return here after an interrupt.\n")
   -  (tl2))
   +  (let ((interactive? (terminal-port? (current-input-port))))
   +;    (when interactive? (display "Use (quit) or ^D to quit, blah blah...\n"))
   +    (tl2 interactive?)))
    
   -(define (tl2)
   -  (display "arc> ")
   +(define not-interactive-write-evalres? #f)
   +
   +(define (tl2 interactive?)
   +  (when interactive? (display "arc> "))
      (on-err (lambda (c) 
                (set! last-condition* c)
   -            (display "Error: ")
   -            (write (exn-message c))
   -            (newline)
   -            (tl2))
   +	    (parameterize ((current-output-port (current-error-port)))
   +	      (display "Error: ")
   +	      (write (exn-message c))
   +	      (newline))
   +            (tl2 interactive?))
        (lambda ()
          (let ((expr (read)))
   -        (if (eqv? expr ':a)
   -            'done
   -            (let ((val (arc-eval expr)))
   -              (write (ac-denil val))
   -              (namespace-set-variable-value! '_that val)
   -              (namespace-set-variable-value! '_thatexpr expr)
   -              (newline)
   -              (tl2)))))))
   +	(if (eof-object? expr)
   +	    (when interactive? (display "(quit)") (newline))
   +	    (let ((val (arc-eval expr)))
   +	      (when (or interactive? not-interactive-write-evalres?)
   +		    (write (ac-denil val)) 
   +		    (newline))
   +	      (namespace-set-variable-value! '_that val)
   +	      (namespace-set-variable-value! '_thatexpr expr)
   +	      (tl2 interactive?)))))))
   +
   +; 'aload{1} could be rewritten to just call 'tl (that's part of why
   +; we test for EOF in 'tl2 and not in 'ac), but need to modify 'tl 
   +; to take a file as parameter, and not always read stdin.
   +; Can't trick 'aload{1} using 'with-input-from-file, because there 
   +; would be a problem if the loaded file calls 'read.
    
   -(define (aload1 p)
   +(define (aload1 p) 
      (let ((x (read p)))
        (if (eof-object? x)
            #t
   diff -Nurp 3.1orig/as.scm 3.1/as.scm
   --- 3.1orig/as.scm	2009-08-10 00:42:57.000000000 +0200
   +++ 3.1/as.scm	2009-08-10 18:57:13.000000000 +0200
   @@ -1,16 +1,14 @@
   -; mzscheme -m -f as.scm
   -; (tl)
   -; (asv)
   -; http://localhost:8080
   -
    (require mzscheme) ; promise we won't redefine mzscheme bindings
    
    (require "ac.scm") 
    (require "brackets.scm")
    (use-bracket-readtable)
    
   -(aload "arc.arc")
   -(aload "libs.arc") 
   -
   -(tl)
   +(parameterize ((current-directory (current-load-relative-directory)))
   +  (aload "arc.arc")
   +  (aload "libs.arc"))
    
   +(let ((args (vector->list (current-command-line-arguments))))
   +  (if (not (empty? args))  ; cmdline args are script filenames...
   +      (for-each (lambda (f) (aload f)) args)  ; ...execute them!
   +      (tl)))
Also available (for direct d/l) at http://pastebin.com/f56fbe59e


2 points by patchfrus 5609 days ago | link

Hm. Snif. How do I apply this patch? I said patch -p1 < patch, and only garbage was found. Then I said patch -u -p1 < patch and only garbage was found. Is there anything to be found in this patch that is not garbage? LOL.

%patch -p1 < unix-patch-2.txt patch: Only garbage was found in the patch input.

-----

1 point by palsecam 5609 days ago | link

Ooops yes, apparently the file on pastebin is "corrupted", I don't know why. "@@" are missing. Maybe a bad copy/paste, but this is suprising. Anyway:

(Good) patch re-uploaded at http://dabuttonfactory.com/res/arc-unix.patch

> How do I apply this patch?

   mkdir arc && cd arc && \
   curl ycombinator.com/arc/arc3.1.tar | tar -x && \
   mv arc3.1 3.1orig && cp -r 3.1orig 3.1 && \
   curl dabuttonfactory.com/res/arc-unix.patch | patch -p0
But all this is assuming you want to copy my arborescence:

   arc/
     3.1/       # "my" version w/ patchs
     3.1orig/   # "official", ORIGinal version
     3.0/
     ...
Maybe you'd better look at the diff and manually apply the patch. A good way to start looking at Arc guts ;-) This was how I expected interested people to use the diff. But using `patch' directly is a good solution too :-)

-----