Permalink
Browse files

Recognize wider set of C file extensions (.c .C .cc .cp .cpp .CPP .cx…

…x .c++ .m .M .mm)
  • Loading branch information...
1 parent 5d82751 commit 4f42f83f5841b4d14f1e1d03880756330a0b405f @feeley feeley committed May 19, 2011
Showing with 54 additions and 30 deletions.
  1. +14 −9 gsc/_gsclib.scm
  2. +8 −2 gsc/_host.scm
  3. +4 −8 gsc/_source.scm
  4. +22 −5 gsc/_t-c-1.scm
  5. +3 −3 gsi/main.scm
  6. +1 −1 include/stamp.h
  7. +2 −2 lib/_io.scm
View
@@ -1,8 +1,8 @@
;;;============================================================================
-;;; File: "_gsclib.scm", Time-stamp: <2011-03-20 21:15:32 feeley>
+;;; File: "_gsclib.scm"
-;;; Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 1994-2011 by Marc Feeley, All Rights Reserved.
(include "generic.scm")
@@ -74,7 +74,7 @@
(##path-strip-directory
(##path-strip-extension filename))
expanded-output)
- ".c")))
+ (c#targ-preferred-c-file-extension))))
(c-filename-no-dir-no-ext
(##path-strip-directory
(##path-strip-extension c-filename))))
@@ -175,10 +175,13 @@
root
(generate-next-version-of-object-file root)))))
- (let* ((c-filename
- (##string-append (##path-strip-extension filename) ".c"))
- (input-is-c-file?
- (##string=? filename c-filename))
+ (let* ((input-is-c-file?
+ (##assoc (##path-extension filename) c#targ-c-file-extensions))
+ (c-filename
+ (if input-is-c-file?
+ filename
+ (##string-append (##path-strip-extension filename)
+ (c#targ-preferred-c-file-extension))))
(expanded-output
(##path-normalize output))
(output-filename
@@ -369,7 +372,8 @@
(if (##eq? output (macro-absent-obj))
(##path-directory
(##path-normalize
- (##string-append (##car rev-mods) ".c")))
+ (##string-append (##car rev-mods)
+ (c#targ-preferred-c-file-extension))))
(macro-force-vars (output)
output)))
(baselib
@@ -441,7 +445,8 @@
(if (##eq? output (macro-absent-obj))
(##path-directory
(##path-normalize
- (##string-append (##car rev-mods) ".c")))
+ (##string-append (##car rev-mods)
+ (c#targ-preferred-c-file-extension))))
(macro-force-vars (output)
output)))
(warn?
View
@@ -1,8 +1,8 @@
;;;============================================================================
-;;; File: "_host.scm", Time-stamp: <2009-07-31 10:22:27 feeley>
+;;; File: "_host.scm"
-;;; Copyright (c) 1994-2007 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 1994-2011 by Marc Feeley, All Rights Reserved.
;;;============================================================================
@@ -314,6 +314,10 @@
(string-set! result (- j i) (string-ref path j))
(loop2 (- j 1)))))))))
+(define scheme-file-extensions
+ '((".scm" . #f)
+ (".six" . six)))
+
;; Bytevector data types.
(define s8vect-tag (list 's8vect))
@@ -791,6 +795,8 @@
(define (path-strip-directory path)
(##path-strip-directory path))
+(define scheme-file-extensions ##scheme-file-extensions)
+
(define (make-s8vect n) (##make-s8vector n 0))
(define s8vect? ##s8vector?)
(define s8vect->list ##s8vector->list)
View
@@ -1,8 +1,8 @@
;;;============================================================================
-;;; File: "_source.scm", Time-stamp: <2009-02-16 14:58:03 feeley>
+;;; File: "_source.scm"
-;;; Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 1994-2011 by Marc Feeley, All Rights Reserved.
(include "fixnum.scm")
@@ -321,7 +321,7 @@
(if expanded-filename
(if (equal? (path-extension expanded-filename) "")
- (let loop ((exts scm-file-exts))
+ (let loop ((exts (append (map car scheme-file-extensions) '(""))))
(if (pair? exts)
(let* ((ext (car exts))
(full-name (string-append expanded-filename ext))
@@ -390,10 +390,6 @@
sources)))
-;; Filename extensions to try in order to find source files from module name.
-
-(define scm-file-exts '(".scm" ".six" "")) ; "" means no extension
-
(define (read-source path relative-to-path try-scheme-file-extensions?)
(define (read-source-from-path path)
@@ -1545,7 +1541,7 @@
(if expanded-filename
(if (equal? (path-extension expanded-filename) "")
- (let loop ((exts scm-file-exts))
+ (let loop ((exts (append (map car scheme-file-extensions) '(""))))
(if (pair? exts)
(let* ((ext (car exts))
(full-name (string-append expanded-filename ext))
View
@@ -1,8 +1,8 @@
;;;============================================================================
-;;; File: "_t-c-1.scm", Time-stamp: <2010-06-10 15:24:05 feeley>
+;;; File: "_t-c-1.scm"
-;;; Copyright (c) 1994-2010 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 1994-2011 by Marc Feeley, All Rights Reserved.
(include "fixnum.scm")
@@ -317,7 +317,7 @@
(targ-heap-dump
(or output
- (string-append output-root ".c"))
+ (string-append output-root (targ-preferred-c-file-extension)))
(proc-obj-name (car procs))
c-decls
c-inits
@@ -770,12 +770,12 @@
(path-strip-extension output)))
(out
(or output
- (string-append root ".c")))
+ (string-append root (targ-preferred-c-file-extension))))
(name
(string-append module-prefix
(path-strip-directory root)))
(input-files
- (map (lambda (x) (string-append x ".c")) inputs))
+ (map (lambda (x) (string-append x (targ-preferred-c-file-extension))) inputs))
(input-infos
(map targ-read-linker-info input-files))
(input-mods
@@ -2215,4 +2215,21 @@
(define (targ-name->c-id s)
(scheme-id->c-id s))
+(define targ-c-file-extensions #f)
+(set! targ-c-file-extensions
+ '((".c" . C)
+ (".C" . C++)
+ (".cc" . C++)
+ (".cp" . C++)
+ (".cpp" . C++)
+ (".CPP" . C++)
+ (".cxx" . C++)
+ (".c++" . C++)
+ (".m" . Objective-C)
+ (".M" . Objective-C++)
+ (".mm" . Objective-C++)))
+
+(define (targ-preferred-c-file-extension)
+ (caar targ-c-file-extensions))
+
;;;----------------------------------------------------------------------------
View
@@ -1,8 +1,8 @@
;;;============================================================================
-;;; File: "main.scm", Time-stamp: <2011-01-24 11:54:13 feeley>
+;;; File: "main.scm"
-;;; Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 1994-2011 by Marc Feeley, All Rights Reserved.
;;;----------------------------------------------------------------------------
@@ -113,7 +113,7 @@
(define (compiler-batch-mode options arguments)
(define (c-file? file)
- (##string=? (##path-extension file) ".c"))
+ (##assoc (##path-extension file) c#targ-c-file-extensions))
(define (obj-file? file)
(##string=? (##path-extension file) ##os-obj-extension-string-saved))
View
@@ -3,4 +3,4 @@
*/
#define ___STAMP_YMD 20110519
-#define ___STAMP_HMS 134826
+#define ___STAMP_HMS 175028
View
@@ -1,8 +1,8 @@
;;;============================================================================
-;;; File: "_io.scm", Time-stamp: <2010-01-07 12:06:38 feeley>
+;;; File: "_io.scm"
-;;; Copyright (c) 1994-2010 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 1994-2011 by Marc Feeley, All Rights Reserved.
;;;============================================================================

0 comments on commit 4f42f83

Please sign in to comment.