← Back to team overview

kicad-developers team mailing list archive

PATCH: VRML parser name parsing

 

I've attached a patch to the VRML parser in the VRML plugin.
This patch modifies the behavior of the VRML name parser
so that a name may be immediately succeeded by ] or }.
The previous behavior was to reject a valid name since the
brace or bracket was considered an invalid character within
a name.

- Cirilo
=== modified file 'plugins/3d/vrml/vrml.cpp'
--- plugins/3d/vrml/vrml.cpp	2016-04-03 00:56:41 +0000
+++ plugins/3d/vrml/vrml.cpp	2016-05-15 22:02:12 +0000
@@ -46,7 +46,7 @@
 #define PLUGIN_VRML_MAJOR 1
 #define PLUGIN_VRML_MINOR 3
 #define PLUGIN_VRML_PATCH 2
-#define PLUGIN_VRML_REVNO 0
+#define PLUGIN_VRML_REVNO 1
 
 
 const char* GetKicadPluginName( void )

=== modified file 'plugins/3d/vrml/wrlproc.cpp'
--- plugins/3d/vrml/wrlproc.cpp	2016-04-07 01:41:52 +0000
+++ plugins/3d/vrml/wrlproc.cpp	2016-05-15 22:01:07 +0000
@@ -304,6 +304,7 @@
     while( m_bufpos < ssize && m_buf[m_bufpos] > 0x20 )
     {
         if( '[' == m_buf[m_bufpos] || '{' == m_buf[m_bufpos]
+            || ']' == m_buf[m_bufpos] || '}' == m_buf[m_bufpos]
             || '.' == m_buf[m_bufpos] || '#' == m_buf[m_bufpos]
             || ',' == m_buf[m_bufpos] )
         {

=== modified file 'plugins/3d/vrml/wrlproc.h'
--- plugins/3d/vrml/wrlproc.h	2016-04-03 00:56:41 +0000
+++ plugins/3d/vrml/wrlproc.h	2016-05-15 22:00:09 +0000
@@ -87,7 +87,7 @@
     bool ReadGlob( std::string& aGlob );
     // read a VRML name; is similar to ReadGlob except that it enforces
     // name checking rules, does not allow a comma at the end, and
-    // stops when a left brace or bracket is found.
+    // stops when a left/right brace or bracket is found.
     bool ReadName( std::string& aName );
     bool DiscardNode( void );               // discard node data in a matched '{}' set
     bool DiscardList( void );               // discard list data in a matched '[]' set


Follow ups