File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,45 +265,6 @@ using namespace sta;
265265
266266%}
267267
268- // //////////////////////////////////////////////////////////////
269-
270- %inline %{
271-
272- bool
273- is_object (const char *obj)
274- {
275- // _hexaddress_p_type
276- const std::string s (obj);
277- if (s.empty () || s[0 ] != ' _' )
278- return false ;
279- const size_t hex_digits = sizeof (void *) * 2 ;
280- if (s.size () < 1 + hex_digits + 3 )
281- return false ;
282- for (size_t i = 1 ; i < 1 + hex_digits; i++) {
283- if (!std::isxdigit (static_cast <unsigned char >(s[i])))
284- return false ;
285- }
286- if (s.compare (1 + hex_digits, 3 , " _p_" ) != 0 )
287- return false ;
288- for (size_t i = 1 + hex_digits + 3 ; i < s.size (); i++) {
289- char ch = s[i];
290- if (!(std::isalnum (ch) || ch == ' _' ))
291- return false ;
292- }
293- return true ;
294- }
295-
296- // Assumes is_object is true.
297- const char *
298- object_type (const char *obj)
299- {
300- if (is_object (obj))
301- return &obj[1 + sizeof (void *) * 2 + 3 ];
302- return " " ;
303- }
304-
305- %}
306-
307268// //////////////////////////////////////////////////////////////
308269//
309270// SWIG type definitions.
Original file line number Diff line number Diff line change @@ -504,4 +504,39 @@ fuzzy_equal(float value1,
504504 return fuzzyEqual (value1, value2);
505505}
506506
507+ // //////////////////////////////////////////////////////////////
508+
509+ bool
510+ is_object (const char *obj)
511+ {
512+ // _hexaddress_p_type
513+ const std::string s (obj);
514+ if (s.empty () || s[0 ] != ' _' )
515+ return false ;
516+ const size_t hex_digits = sizeof (void *) * 2 ;
517+ if (s.size () < 1 + hex_digits + 3 )
518+ return false ;
519+ for (size_t i = 1 ; i < 1 + hex_digits; i++) {
520+ if (!std::isxdigit (static_cast <unsigned char >(s[i])))
521+ return false ;
522+ }
523+ if (s.compare (1 + hex_digits, 3 , " _p_" ) != 0 )
524+ return false ;
525+ for (size_t i = 1 + hex_digits + 3 ; i < s.size (); i++) {
526+ char ch = s[i];
527+ if (!(std::isalnum (ch) || ch == ' _' ))
528+ return false ;
529+ }
530+ return true ;
531+ }
532+
533+ // Assumes is_object is true.
534+ const char *
535+ object_type (const char *obj)
536+ {
537+ if (is_object (obj))
538+ return &obj[1 + sizeof (void *) * 2 + 3 ];
539+ return " " ;
540+ }
541+
507542%} // inline
You can’t perform that action at this time.
0 commit comments