Mercurial > hg > octave-lyh
comparison src/ov-class.cc @ 7972:5bf4e2c13ed8
make superiorto and inferiorto work
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 25 Jul 2008 14:25:35 -0400 |
parents | 22a18f206121 |
children | 265a821f6555 |
comparison
equal
deleted
inserted
replaced
7971:dd5cc5016487 | 7972:5bf4e2c13ed8 |
---|---|
1095 } | 1095 } |
1096 | 1096 |
1097 return built_in_class_names.find (cn) != built_in_class_names.end (); | 1097 return built_in_class_names.find (cn) != built_in_class_names.end (); |
1098 } | 1098 } |
1099 | 1099 |
1100 static void | |
1101 set_class_relationship (const std::string& sup_class, | |
1102 const std::string& inf_class) | |
1103 { | |
1104 // FIXME | |
1105 | |
1106 warning ("class precedence not implemented"); | |
1107 } | |
1108 | |
1109 DEFUN (superiorto, args, , | 1100 DEFUN (superiorto, args, , |
1110 "-*- texinfo -*-\n\ | 1101 "-*- texinfo -*-\n\ |
1111 @deftypefn {Built-in Function} {} superiorto (@var{class_name})\n\ | 1102 @deftypefn {Built-in Function} {} superiorto (@var{class_name})\n\ |
1112 When called from a class constructor, mark the object currently\n\ | 1103 When called from a class constructor, mark the object currently\n\ |
1113 constructed as having a higher precedence than @var{class_name}.\n\ | 1104 constructed as having a higher precedence than @var{class_name}.\n\ |
1128 { | 1119 { |
1129 if (! is_built_in_class (class_name)) | 1120 if (! is_built_in_class (class_name)) |
1130 { | 1121 { |
1131 std::string this_class_name = fcn->name (); | 1122 std::string this_class_name = fcn->name (); |
1132 | 1123 |
1133 set_class_relationship (this_class_name, class_name); | 1124 if (! symbol_table::set_class_relationship (this_class_name, |
1125 class_name)) | |
1126 error ("superiorto: precedence already set for %s and %s", | |
1127 this_class_name.c_str (), class_name.c_str ()); | |
1134 } | 1128 } |
1135 else | 1129 else |
1136 { | 1130 { |
1137 // User defined classes always have higher precedence | 1131 // User defined classes always have higher precedence |
1138 // than built-in classes. | 1132 // than built-in classes. |
1172 { | 1166 { |
1173 if (! is_built_in_class (class_name)) | 1167 if (! is_built_in_class (class_name)) |
1174 { | 1168 { |
1175 std::string this_class_name = fcn->name (); | 1169 std::string this_class_name = fcn->name (); |
1176 | 1170 |
1177 set_class_relationship (class_name, this_class_name); | 1171 symbol_table::set_class_relationship (class_name, |
1172 this_class_name); | |
1173 | |
1174 if (! symbol_table::set_class_relationship (this_class_name, | |
1175 class_name)) | |
1176 error ("inferiorto: precedence already set for %s and %s", | |
1177 this_class_name.c_str (), class_name.c_str ()); | |
1178 } | 1178 } |
1179 else | 1179 else |
1180 error ("inferiorto: cannot give user-defined class lower precedence than built-in class"); | 1180 error ("inferiorto: cannot give user-defined class lower precedence than built-in class"); |
1181 } | 1181 } |
1182 else | 1182 else |