DATA-C-DUMP did not produce an empty text array (data_text = NULL) when compiling functions (not FASL).

This commit is contained in:
Juan Jose Garcia Ripoll 2011-11-18 17:31:52 +01:00
parent c4966bd006
commit e5de9aa7b1
2 changed files with 15 additions and 13 deletions

View file

@ -2193,7 +2193,7 @@ ecl_init_module(cl_object block, void (*entry_point)(cl_object))
temp_len = block->cblock.temp_data_size;
len = perm_len + temp_len;
if (block->cblock.data_text == 0) {
if (block->cblock.data_text == 0 || block->cblock.data_text_size == 0) {
if (len) {
/* Code from COMPILE uses data in *compiler-constants* */
cl_object v = ECL_SYM_VAL(env,@'si::*compiler-constants*');

View file

@ -78,27 +78,29 @@
(data-string (si::with-ecl-io-syntax
(prin1-to-string data)))
(l (length data-string)))
(subseq data-string 1 (1- l))))))
(subseq data-string 1 (1- l))))
(t
"")))
(defun data-c-dump (filename)
(with-open-file (stream filename :direction :output :if-does-not-exist :create
:if-exists :supersede :external-format :default)
(let ((string (data-dump-array)))
(if (and *compile-in-constants* (plusp (data-size)))
(let ((*wt-string-size* 0)
(*wt-data-column* 80))
(princ "static const char compiler_data_text[] = " stream)
(wt-filtered-data string stream)
(princ #\; stream)
(format stream "~%#define compiler_data_text_size ~D~%"
*wt-string-size*))
(if (and *compile-in-constants* (plusp (length string)))
(let ((*wt-string-size* 0)
(*wt-data-column* 80))
(princ "static const char compiler_data_text[] = " stream)
(wt-filtered-data string stream)
(princ #\; stream)
(print *wt-string-size*)
(format stream "~%#define compiler_data_text_size ~D~%"
*wt-string-size*))
(princ "#define compiler_data_text NULL
#define compiler_data_text_size 0" stream)))))
(defun data-binary-dump (filename &optional (string (unless *compile-in-constants*
(data-dump-array))))
(defun data-binary-dump (filename &optional string)
(unless *compile-in-constants*
(si::add-cdata filename string)))
(si::add-cdata filename (or string (data-dump-array)))))
(defun wt-data-begin (stream)
nil)