[comp.lang.scheme] How to MAKE_FSL from inside Scheme

camp@m2.csc.ti.COM (Clyde Camp) (10/25/90)

>Does anyone have some code that will show me how to call MAKE_FSL from
>inside scheme.  

A utility to do this is part of the PCS utility package I've been
distributing now for several years.

For those of you interested in PCS, a set of these utilities and
detailed documentation is available (free) from:

        Clyde R. Camp
        Texas Instruments, Inc.
        P.O.Box 655474, MS 238
        Dallas, TX  75266

*==========================*** N O T E ***==============================*

 Send two blank, FORMATTED 370K 5-1/4 disks or one 720K 3-1/2 minidisk
             and a SELF-ADDRESSED,  STAMPED envelope. 

 My distribution system is a TIPC so if you don't PRE-FORMAT them, you
 may not be able to read what I send you. And I don't pay postage
 (except for non-US mailings.)

*=======================================================================*


Although written originally for the TIPC, everything except the
graphics works on IBMs and IBM clones.  The directories are:


UTILITY - Various text windowing, file printing and keyboard handlers
which simplify writing application programs (includes a file
pretty-printer and a new top-level read-eval-print loop which uses an
emacs-like line-editor with the capability to scroll through and edit
previous entries)
 
SWI - A convenient mechanism for invoking 8086 ASSY routines via SWI-INT.

HELP - A user-extendable on-line help facility which includes all of
the PCS functions and syntax as well as other information on PCS
specific quirks.  

GRAF - A graphics package for creating graphics "windows" somewhat
analogous to text windows (also for IBMs)

PLOT - A general purpose function plotter (only for TIPCs)

GAME1 - Self explanatory - non-graphics for IBM or TIPC
GAME2 - for TIPC graphics

ERR_STAT - more utilities for controlling the status window, testing
for directories and disabling the gc-message

MENUSHEL - three general purpose menu driven command shells handy for
application development.

=====================================================================

The code to do what the poster wants looks like the following (yeah, I
know it could be cleaned up, but it works and its free so don't knock it)

(define ***default-file*** "")            ; file to be processed
(define ***default-editor*** "edit.com")  ; dos editor of your choice
(define ***default-memory-size*** 8190)   ; memory to save for dos-call
(define ***default-fsl*** "make_fsl")     ; make_fsl executable
(define ld)				  ; load
(define ed)				  ; edit 
(define el)				  ; edit-load 
(define ec)				  ; edit-compile 
(define cf)				  ; compile-fasl
(define ef)				  ; edit-compile-fasl 
(define fsl)				  ; fasl
(define cmp)				  ; compile

;;
;; All procs take optional filename which then becomes the default for
;;  future invocations (reduce them keystrokes!!)
;;

(let ((beep 
       (lambda () 
	 (display (integer->char 7))))
      (extract 
       (lambda (filename)
	 (letrec ((max-index (-1+ (string-length filename)))
		  (loop (lambda (index)
			  (cond ((>? index max-index) #!false)
				((char=? (string-ref filename index) #\.) 
				 index)
				(else (loop (1+ index))))))
		  (split (loop 0)))
	   (if (null? split)
	       (list filename)
	       (cons (substring filename 0 split)
		     (substring filename (1+ split) (1+ max-index))))))))
  (set! ed 
	(lambda file
	  (let ((file-name (if (null? file) ***default-file*** (car file))))
	    (if (string? file-name)
		(begin 
		  (set! ***default-file*** file-name)
		  (dos-call "" 
			    (string-append ***default-editor*** " " file-name)
			    ***default-memory-size***))
		(error "ED file-name not a string: " file-name)))))

  (set! ld 
	(lambda file
	  (let ((load-file (if (null? file) ***default-file*** (car file))))
	    (if (and (string? load-file) (file-exists? load-file))
		(begin 
		  (set! ***default-file*** load-file)
		  (load load-file) )
		(if (string?  load-file)
		    (error "LD file-name does not exist: " load-file)
		    (error "LD file-name not a string: " load-file) )))))

  (set! cmp 
	(lambda file
	  (let ((file-name (if (null? file) ***default-file*** (car file))))
	    (if (and (string? file-name) (file-exists? file-name))
		(let* ((name (car (extract file-name)))
		       (objdest (string-append name ".so")) )
		  (set! ***default-file*** file-name)
		  (mapcar display
			  (list "Compiling file " file-name " ==> " objdest))
		  (compile-file file-name objdest)
		  (display "   COMPLETE")
		  (newline))
		(if (string?  file-name)
		    (error "CMP file-name does not exist: " file-name)
		    (error "CMP file-name not a string: " file-name) )))))

  (set! fsl 
	(lambda file
	  (let ((file-name (if (null? file) ***default-file*** (car file))) )
	    (if (and (string? file-name) (file-exists? file-name))
		(let* ((name (car (extract  file-name)))
		       (fsldest (string-append name ".fsl")))
		  (mapcar display
			  (list "FSLing file " file-name " ==> " fsldest))
		  (dos-call "" (string-append ***default-fsl*** " "
					      file-name
					      " "
					      fsldest
					      " /copyright")
			       ***default-memory-size***)
		  (display "    COMPLETE")
		  (newline))
		(if (string?  file-name)
		    (error "FSL file-name does not exist: " file-name)
		    (error "FSL file-name not a string: " file-name) )))))

  (set! el
	(lambda file
	  (let ((file-name (if (null? file) ***default-file*** (car file))))
	    (if (string? file-name)
		(begin (set! ***default-file*** file-name)
                       (ed file-name)
                       (ld file-name)
                       (beep))
		(error "EL file-name not a string: " file-name) ))))

  (set! ec
	(lambda file
	  (let  ((file-name (if (null? file) ***default-file*** (car file))) )
	    (if (string? file-name)
		(begin (set! ***default-file*** file-name)
		       (ed file-name)
                       (cmp file-name)
                       (beep) )
		(error "EL file-name not a string: " file-name) ))))

  (set! cf
	(lambda file
          (let  ((file-name (if (null? file) ***default-file*** (car file))) )
            (if (and (string? file-name) (file-exists? file-name))
                (let* ((name (car (extract file-name)))
                       (fslsrc (string-append name ".so")) )
                   (set! ***default-file*** file-name)
                   (cmp file-name)
                   (fsl fslsrc)
                   (beep) )
                (if (string? file-name)
                    (error "CF file does not exist: " file-name)
                    (error "CF file-name not a string: " file-name))))))

  (set! ef
	(lambda file
          (let ((file-name (if (null? file) ***default-file*** (car file))) )
            (if (string? file-name)
                (begin (set! ***default-file*** file-name)
                       (ed file-name)
                       (cf file-name)
                       (beep))
                (error "EF file-name not a string: " file-name))))))

-- 

==============================================================================
Clyde Camp         			|                          
Texas Instruments, Incorporated		|

rusty@fe2o3.laurel.md.us (Rusty Haddock) (10/26/90)

In article <9010242122.AA15471@m2.csc.ti.com> camp@ti-csl.csc.ti.com writes:
   >
   >>Does anyone have some code that will show me how to call MAKE_FSL from
   >>inside scheme.  
   >
   >A utility to do this is part of the PCS utility package I've been
   >distributing now for several years.

While I know Clyde means well the original poster only needs to use
the following line:

	(dos-call "make_fsl" "foo.so foo.fsl" 4096)

Naturally, error detection would be a good thing to use
if this is going to be embedding within other code.

I could say something out about massively sugar-coating
code but I won't.

		-Rusty-
-- 
Rusty Haddock		o  rusty@fe2o3.LAUREL.MD.US
Laurel, Maryland	o  {uunet,rutgers}!mimsy.umd.edu!fe2o3!rusty

    -=> This .signature protected by Smith & Wesson <=-