From e5de9aa7b1f4e654e1753fc4cf9e4a120cc8f0d6 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Fri, 18 Nov 2011 17:31:52 +0100 Subject: [PATCH] DATA-C-DUMP did not produce an empty text array (data_text = NULL) when compiling functions (not FASL). --- src/c/read.d | 2 +- src/cmp/cmpwt.lsp | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/c/read.d b/src/c/read.d index 0cd6cd9e8..8b8db42fa 100644 --- a/src/c/read.d +++ b/src/c/read.d @@ -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*'); diff --git a/src/cmp/cmpwt.lsp b/src/cmp/cmpwt.lsp index e8e91ef7d..4b3252ba4 100644 --- a/src/cmp/cmpwt.lsp +++ b/src/cmp/cmpwt.lsp @@ -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)