From: Robert D. <rob...@gm...> - 2006-01-27 15:50:23
|
Ray, thanks for your help. I've made some progress. (1) SBCL loads f2cl successfully (although with many complaints), and f2cl::f2cl executes successfully, and SBCL loads the resulting translation successfully. Terrific! (2) Variables mentioned in DATA statements within BLOCK DATA aren't initialized. A function named /BLOCKDATA-<WHATEVER>/ is defined to initialize the data, but it is not automatically called; if I call the block data function by hand, then the variables are initializ= ed. (3) The program of interest at the moment is LBFGS, a minimization program. If I call the blockdata function to initialize the common variables, the LBFGS test program runs successfully. That's really good news. Here is an example which exhibits the problem with initializing common variables. After loading tmp2.lisp, (foo) =3D> OUTPUT 1: BAR IS 0 OUTPUT 2: BAR IS 12345 However, I can force BAR to get initialized -- (/blockdata-mybloc/) Then (foo) =3D> OUTPUT 1: BAR IS 98765 OUTPUT 2: BAR IS 12345 Thanks a lot for your help, Robert Dodier PS. ------------------------------------ tmp2.f -------------------------------= ----- PROGRAM FOO INTEGER BAR COMMON /MYCOMN/BAR WRITE(6,10)BAR 10 FORMAT('OUTPUT 1: BAR IS ',I5) BAR=3D12345 WRITE(6,20)BAR 20 FORMAT('OUTPUT 2: BAR IS ',I5) RETURN END BLOCK DATA MYBLOC INTEGER BAR COMMON /MYCOMN/BAR DATA BAR/98765/ END ----------------------------------- tmp2.lisp -----------------------------= ----- ;;; Compiled by f2cl version 2.0 beta Date: 2006/01/11 22:57:58 ;;; Using Lisp SBCL 0.9.4 ;;; ;;; Options: ((:prune-labels nil) (:auto-save t) (:relaxed-array-decls t) ;;; (:coerce-assigns :as-needed) (:array-type ':array) ;;; (:array-slicing t) (:declare-common t) ;;; (:float-format single-float)) (in-package :common-lisp-user) (defstruct (mycomn (:predicate is-mycomn-p)) (part-0 (make-array 1 :element-type 'f2cl-lib:integer4) :type (simple-array f2cl-lib:integer4 (1)))) (let* () (defparameter *mycomn-common-block* (make-mycomn))) (defun foo () (let () (symbol-macrolet ((bar (aref (mycomn-part-0 *mycomn-common-block*) 0))) (f2cl-lib:with-multi-array-data nil (prog () (declare) (f2cl-lib:fformat 6 ("OUTPUT 1: BAR IS " 1 (("~5D")) "~%") bar) (setf bar 12345) (f2cl-lib:fformat 6 ("OUTPUT 2: BAR IS " 1 (("~5D")) "~%") bar) (go end_label) end_label (return nil)))))) ;;; Compiled by f2cl version 2.0 beta Date: 2006/01/11 22:57:58 ;;; Using Lisp SBCL 0.9.4 ;;; ;;; Options: ((:prune-labels nil) (:auto-save t) (:relaxed-array-decls t) ;;; (:coerce-assigns :as-needed) (:array-type ':array) ;;; (:array-slicing t) (:declare-common t) ;;; (:float-format single-float)) (in-package :common-lisp-user) (defun /blockdata-mybloc/ () (let () (symbol-macrolet ((bar (aref (mycomn-part-0 *mycomn-common-block*) 0))) (setf bar 98765)))) |