Changeset 1140:46c1f6a93b0d
- Timestamp:
- 05/02/12 21:40:28 (13 months ago)
- Author:
- Raymond Toy <toy.raymond@…>
- Branch:
- default
- Message:
-
Don't declare strings as (simple-array character). In general that's
incorrect for literal strings because they can be base-strings or
strings, depending on the implementation. (Ecl does this).
Thus, just declare them as simple-strings which includes all string
types.
- Location:
- src
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1135
|
r1140
|
|
| 204 | 204 | (flet ((relax-1 (decl) |
| 205 | 205 | (cond ((and *relaxed-array-decls* (subtypep decl 'array)) |
| 206 | | (destructuring-bind (a n l) |
| | 206 | (destructuring-bind (a &optional n l) |
| 207 | 207 | decl |
| 208 | | `(,a ,n ,(mapcar (constantly '*) l)))) |
| | 208 | (if (subtypep a 'string) |
| | 209 | `(a ,(mapcar (constantly '*) l)) |
| | 210 | `(,a ,n ,(mapcar (constantly '*) l))))) |
| 209 | 211 | (t |
| 210 | 212 | decl)))) |
| … |
… |
|
| 1076 | 1078 | (do-file) |
| 1077 | 1079 | (do-output outport)))) |
| 1078 | | |
| 1079 | 1080 | |
| 1080 | 1081 | (defun translate-and-write-subprog (prog-list outport output-path |
| … |
… |
|
| 1152 | 1153 | ;; external. |
| 1153 | 1154 | (setf fun (fixup-f2cl-lib fun (cons (cadr fort-fun) *external-function-names*))) |
| 1154 | | |
| | 1155 | |
| 1155 | 1156 | (special-print fun outport) |
| 1156 | 1157 | (format outport "~2&(in-package #-gcl #:cl-user #+gcl \"CL-USER\")~%#+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))~%") |
-
|
r1135
|
r1140
|
|
| 1440 | 1440 | (eq 'type (first decl)) |
| 1441 | 1441 | (subtypep (second decl) 'array)) |
| 1442 | | (destructuring-bind (a n l) |
| | 1442 | (destructuring-bind (a &optional n l) |
| 1443 | 1443 | (second decl) |
| 1444 | | `(type (,a ,n ,(mapcar #'(lambda (x) |
| 1445 | | (declare (ignore x)) |
| 1446 | | '*) |
| 1447 | | l)) |
| 1448 | | ,@(rest (rest decl))))) |
| | 1444 | (if (subtypep a 'string) |
| | 1445 | `(type (,a *) |
| | 1446 | ,@(rest (rest decl))) |
| | 1447 | `(type (,a ,n ,(mapcar #'(lambda (x) |
| | 1448 | (declare (ignore x)) |
| | 1449 | '*) |
| | 1450 | l)) |
| | 1451 | ,@(rest (rest decl)))))) |
| 1449 | 1452 | (t |
| 1450 | 1453 | decl))) |
| … |
… |
|
| 2554 | 2557 | ;;(format t "scalar, no length spec = ~A~%" decl) |
| 2555 | 2558 | (if (equal (cadr type) '(*)) |
| 2556 | | `(declare (type (simple-array character (*)) ,(car decl))) |
| 2557 | | `(declare (type (simple-array character (,(cadr type))) ,(car decl))))) |
| | 2559 | `(declare (type (simple-string) ,(car decl))) |
| | 2560 | `(declare (type (simple-string ,(cadr type)) ,(car decl))))) |
| 2558 | 2561 | ((atom (cadr decl)) |
| 2559 | 2562 | ;; scalar, length spec. |
| … |
… |
|
| 2565 | 2568 | ;; unspecified length spec |
| 2566 | 2569 | ;;(format t "unspecified length spec = ~A~%" decl) |
| 2567 | | `(declare (type (simple-array character (*)) ,(car decl)))) |
| | 2570 | `(declare (type (simple-string) ,(car decl)))) |
| 2568 | 2571 | (t |
| 2569 | 2572 | ;; array, no length spec. |
| … |
… |
|
| 2572 | 2575 | ;;(format t "decl-bounds = ~S~%" (decl-bounds (rest decl))) |
| 2573 | 2576 | `(declare (type (,*array-type* |
| 2574 | | (simple-array character ,(if (second type) |
| 2575 | | `(,(second type)) |
| 2576 | | '(*))) |
| | 2577 | (string ,(if (second type) |
| | 2578 | (second type) |
| | 2579 | '*)) |
| 2577 | 2580 | ,(decl-bounds (rest decl))) ,(car decl))))))) |
| 2578 | 2581 | |