# HG changeset patch # User jwe # Date 832792416 0 # Node ID 0158c64f940cbb0bd2802c1fa55f97f13049a7fb # Parent 5e862d11b116221dc8136d40201c3537f4407029 [project @ 1996-05-22 19:13:36 by jwe] diff -r 5e862d11b116 -r 0158c64f940c src/pt-mat.cc --- a/src/pt-mat.cc Wed May 22 18:45:46 1996 +0000 +++ b/src/pt-mat.cc Wed May 22 19:13:36 1996 +0000 @@ -49,6 +49,9 @@ // Zero means it should be considered an error. static int Vempty_list_elements_ok; +// The character to fill with when creating string arrays. +static char Vstring_fill_char; + // General matrices. This list type is much more work to handle than // constant matrices, but it allows us to construct matrices from // other matrices, variables, and functions. @@ -443,7 +446,7 @@ bool found_complex = tmp.is_complex (); if (all_strings) - chm.resize (nr, nc, 0); + chm.resize (nr, nc, Vstring_fill_char); else if (found_complex) cm.resize (nr, nc, 0.0); else @@ -536,11 +539,40 @@ return 0; } +static int +string_fill_char (void) +{ + int status = 0; + + string s = builtin_string_variable ("string_fill_char"); + + switch (s.length ()) + { + case 1: + Vstring_fill_char = s[0]; + break; + + case 0: + Vstring_fill_char = '\0'; + break; + + default: + warning ("string_fill_char must be a single character"); + status = -1; + break; + } + + return status; +} + void symbols_of_pt_mat (void) { DEFVAR (empty_list_elements_ok, "warn", 0, empty_list_elements_ok, "ignore the empty element in expressions like `a = [[], 1]'"); + + DEFVAR (string_fill_char, " ", 0, string_fill_char, + "the character to fill with when creating string arrays."); } /*