comparison src/ov-struct.cc @ 6811:3fe394f8502b

[project @ 2007-08-10 19:07:34 by jwe]
author jwe
date Fri, 10 Aug 2007 19:07:35 +0000
parents 2aad75fcc93a
children e8a18d380097
comparison
equal deleted inserted replaced
6810:56a7de3f6451 6811:3fe394f8502b
33 #include "gripes.h" 33 #include "gripes.h"
34 #include "oct-lvalue.h" 34 #include "oct-lvalue.h"
35 #include "ov-list.h" 35 #include "ov-list.h"
36 #include "ov-struct.h" 36 #include "ov-struct.h"
37 #include "unwind-prot.h" 37 #include "unwind-prot.h"
38 #include "utils.h"
38 #include "variables.h" 39 #include "variables.h"
39 40
40 #include "Array-util.h" 41 #include "Array-util.h"
41 42
42 #include "byte-swap.h" 43 #include "byte-swap.h"
613 614
614 std::string key (args(i).string_value ()); 615 std::string key (args(i).string_value ());
615 616
616 if (error_state) 617 if (error_state)
617 return retval; 618 return retval;
619
620 if (! valid_identifier (key))
621 {
622 error ("struct: invalid structure field name `%s'", key.c_str ());
623 return retval;
624 }
618 625
619 // Value may be v, { v }, or { v1, v2, ... } 626 // Value may be v, { v }, or { v1, v2, ... }
620 // In the first two cases, we need to create a cell array of 627 // In the first two cases, we need to create a cell array of
621 // the appropriate dimensions filled with v. In the last case, 628 // the appropriate dimensions filled with v. In the last case,
622 // the cell array has already been determined to be of the 629 // the cell array has already been determined to be of the
939 946
940 if (error_state) 947 if (error_state)
941 return retval; 948 return retval;
942 } 949 }
943 950
951 if (! valid_identifier (field_str))
952 {
953 error ("cell2struct: invalid field name `%s'",
954 field_str.c_str ());
955 break;
956 }
957
944 map.reshape (value_dv); 958 map.reshape (value_dv);
945 959
946 map.assign (field_str, c_value); 960 map.assign (field_str, c_value);
947 } 961 }
948 962