you can now specifiy an arg vm parser
This commit is contained in:
		
							parent
							
								
									4703ce142a
								
							
						
					
					
						commit
						88aaa91880
					
				|  | @ -80,6 +80,13 @@ For testing load this at a scsh prompt | ||||||
| 		       (else  | 		       (else  | ||||||
| 			(display "error: -o requires argument") (newline) | 			(display "error: -o requires argument") (newline) | ||||||
| 			(usage (car argl))))) | 			(usage (car argl))))) | ||||||
|  | 		((equal? (car args) "--args") | ||||||
|  | 		 (cond ((not (null? (cdr args))) | ||||||
|  | 			(set-options:args-parser options (cadr args)) | ||||||
|  | 			(loop (cddr args))) | ||||||
|  | 		       (else  | ||||||
|  | 			(display "error: --args requires argument") (newline) | ||||||
|  | 			(usage (car argl))))) | ||||||
| 		((equal? (car args) "--temp") | 		((equal? (car args) "--temp") | ||||||
| 		 (cond ((not (null? (cdr args))) | 		 (cond ((not (null? (cdr args))) | ||||||
| 			(set-options:temp-dir options (cadr args)) | 			(set-options:temp-dir options (cadr args)) | ||||||
|  | @ -112,6 +119,11 @@ For testing load this at a scsh prompt | ||||||
| 		 (format #t "error: unknown argument ~a" (car args))  | 		 (format #t "error: unknown argument ~a" (car args))  | ||||||
| 		 (newline) | 		 (newline) | ||||||
| 		 (usage (car argl))))) | 		 (usage (car argl))))) | ||||||
|  | 	(set-options:args-parser | ||||||
|  | 	 options | ||||||
|  | 	 (if (options:args-parser options) | ||||||
|  | 	     (list (options:args-parser options)) | ||||||
|  | 	     '())) | ||||||
| 	(set-options:temp-dir  | 	(set-options:temp-dir  | ||||||
| 	 options | 	 options | ||||||
| 	 (or (options:temp-dir options) | 	 (or (options:temp-dir options) | ||||||
|  | @ -142,6 +154,7 @@ For testing load this at a scsh prompt | ||||||
| 	       "usage: ~a ~%"  | 	       "usage: ~a ~%"  | ||||||
| 	       "          [-i image]~%" | 	       "          [-i image]~%" | ||||||
| 	       "          [-o executable]~%" | 	       "          [-o executable]~%" | ||||||
|  | 	       "          [--args object]~%" | ||||||
| 	       "          [--temp directory]~%" | 	       "          [--temp directory]~%" | ||||||
| 	       "          [--cc command]~%" | 	       "          [--cc command]~%" | ||||||
| 	       "          [--ld command]~%" | 	       "          [--ld command]~%" | ||||||
|  | @ -154,8 +167,9 @@ For testing load this at a scsh prompt | ||||||
| 
 | 
 | ||||||
|     (define-record options |     (define-record options | ||||||
|       (input-image #f)			; the input scheme image file |       (input-image #f)			; the input scheme image file | ||||||
|       (temp-dir #f)			; place for intermediate .c .o files |  | ||||||
|       (output-executable #f)		; the output executable file |       (output-executable #f)		; the output executable file | ||||||
|  |       (args-parser #f)			; .o file for replacement process_args | ||||||
|  |       (temp-dir #f)			; place for intermediate .c .o files | ||||||
|       (cc-command #f)			; command to compile a .c file |       (cc-command #f)			; command to compile a .c file | ||||||
|       (ld-flags #f)			; flags needed to link executable |       (ld-flags #f)			; flags needed to link executable | ||||||
|       (libraries #f)			; linbraries need to link executable |       (libraries #f)			; linbraries need to link executable | ||||||
|  | @ -367,8 +381,9 @@ For testing load this at a scsh prompt | ||||||
| 	    (scsh-emit-descriptor start reloc port) | 	    (scsh-emit-descriptor start reloc port) | ||||||
| 	    (write-char #\; port) | 	    (write-char #\; port) | ||||||
| 	    (newline port))) | 	    (newline port))) | ||||||
| 	(message (append cc '("static.c"))) | 	(let ((command (append cc '("static.c")))) | ||||||
| 	(run  (,@(append cc '("static.c")))))) | 	  (message command) | ||||||
|  | 	  (run (,@command))))) | ||||||
| 
 | 
 | ||||||
| ;;; compile-c-image | ;;; compile-c-image | ||||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||||
|  | @ -404,9 +419,10 @@ For testing load this at a scsh prompt | ||||||
| 		   ;; wait for last compile before starting new one | 		   ;; wait for last compile before starting new one | ||||||
| 		   (if process | 		   (if process | ||||||
| 		       (wait process)) | 		       (wait process)) | ||||||
| 		   (message (append cc (list filename))) | 		   (let ((command (append cc (list filename)))) | ||||||
| 		   (set! process (& (,@(append cc (list filename))))) | 		     (message command) | ||||||
| 		 (chunk-loop (+ 1 c)))) | 		     (set! process (& (,@command)))) | ||||||
|  | 		   (chunk-loop (+ 1 c)))) | ||||||
| 		(else | 		(else | ||||||
| 		 (wait process)))))) | 		 (wait process)))))) | ||||||
| 
 | 
 | ||||||
|  | @ -421,39 +437,25 @@ For testing load this at a scsh prompt | ||||||
| 			(line->list (options:ld-flags options)) | 			(line->list (options:ld-flags options)) | ||||||
| 			`(-o ,(options:output-executable options)))) | 			`(-o ,(options:output-executable options)))) | ||||||
| 	    (libs (line->list (options:libraries options)))) | 	    (libs (line->list (options:libraries options)))) | ||||||
| 	(message (append ld | 	(let ((command (append ld | ||||||
| 			 (let loop ((i 0) | 			       (let loop ((i 0) | ||||||
| 				    (l '())) | 					  (l '())) | ||||||
| 			   (cond ((not (= i n)) | 				 (cond ((not (= i n)) | ||||||
| 				  (loop (+ i 1) | 					(loop (+ i 1) | ||||||
| 					(cons  | 					      (cons  | ||||||
| 					 (format #f "static-i~s.o" i) | 					       (format #f "static-i~s.o" i) | ||||||
| 					 (cons | 					       (cons | ||||||
| 					  (format #f "static-p~s.o" i) | 						(format #f "static-p~s.o" i) | ||||||
| 					  l)))) | 						l)))) | ||||||
| 				 (else  | 				       (else  | ||||||
| 				  (reverse 		 | 					(reverse 		 | ||||||
| 				   (cons "static.o" | 					 (cons "static.o" | ||||||
| 					 l))))) | 					       l))))) | ||||||
| 			 '("@prefix@/lib/scsh/libscshvm.a") | 			       (options:args-parser options) | ||||||
| 			 libs)) | 			       '("-L" "@prefix@/lib/scsh" "-lscshvm") | ||||||
| 	(run (,@(append  | 			       libs))) | ||||||
| 		 ld | 	  (message command) | ||||||
| 		 (let loop ((i 0) | 	  (run (,@command))))) | ||||||
| 			    (l '())) |  | ||||||
| 		   (cond ((not (= i n)) |  | ||||||
| 			  (loop (+ i 1) |  | ||||||
| 				(cons  |  | ||||||
| 				 (format #f "static-i~s.o" i) |  | ||||||
| 				 (cons |  | ||||||
| 				  (format #f "static-p~s.o" i) |  | ||||||
| 				  l)))) |  | ||||||
| 			 (else  |  | ||||||
| 			  (reverse 		 |  | ||||||
| 			   (cons "static.o" |  | ||||||
| 				 l))))) |  | ||||||
| 		 '("@prefix@/lib/scsh/libscshvm.a") |  | ||||||
| 		 libs))))) |  | ||||||
| 
 | 
 | ||||||
| ;;; scsh-emit-initializer | ;;; scsh-emit-initializer | ||||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 bdc
						bdc