summaryrefslogtreecommitdiff
path: root/new
diff options
context:
space:
mode:
authorsaurabhb172020-02-26 16:20:48 +0530
committerGitHub2020-02-26 16:20:48 +0530
commitb77f5d9d8097c38159c6f60917995d6af13bbe1c (patch)
tree1392c90227aeea231c1d86371131e04c40382918 /new
parentdadc4d490966a24efe15b5cc533ef8695986048a (diff)
parent003d02608917e7a69d1a98438837e94ccf68352a (diff)
downloadKiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.tar.gz
KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.tar.bz2
KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.zip
Merge pull request #4 from FOSSEE/develop
merging dev into master
Diffstat (limited to 'new')
-rw-r--r--new/CMakeLists.txt251
-rw-r--r--new/Doxyfile1552
-rw-r--r--new/design.h476
-rw-r--r--new/drawing.pngbin0 -> 63275 bytes
-rw-r--r--new/drawing.svg964
-rwxr-xr-xnew/make-dir-lib-source-test-data.sh150
-rwxr-xr-xnew/make-html.sh3
-rw-r--r--new/sch_canvas.cpp148
-rw-r--r--new/sch_canvas.h69
-rw-r--r--new/sch_dir_lib_source.cpp732
-rw-r--r--new/sch_dir_lib_source.h202
-rw-r--r--new/sch_lib.cpp278
-rw-r--r--new/sch_lib.h365
-rw-r--r--new/sch_lib_table.cpp341
-rw-r--r--new/sch_lib_table.h388
-rw-r--r--new/sch_lib_table.keywords6
-rw-r--r--new/sch_lpid.cpp501
-rw-r--r--new/sch_lpid.h245
-rw-r--r--new/sch_part.cpp675
-rw-r--r--new/sch_part.h908
-rw-r--r--new/sch_sweet_parser.cpp1561
-rw-r--r--new/sch_sweet_parser.h132
-rw-r--r--new/sweet.i38
-rw-r--r--new/sweet.keywords81
-rw-r--r--new/sweet_edit.cpp244
-rw-r--r--new/sweet_editor_panel.cpp76
-rw-r--r--new/sweet_editor_panel.fbp938
-rw-r--r--new/sweet_editor_panel.h67
-rw-r--r--new/sweet_spec_for_schematic_parts_EN.fodt732
-rw-r--r--new/test_sch_lib_table.cpp128
-rw-r--r--new/toolchain-mingw32.cmake45
-rw-r--r--new/toolchain-mingw64.cmake35
-rw-r--r--new/utf8.h59
33 files changed, 12390 insertions, 0 deletions
diff --git a/new/CMakeLists.txt b/new/CMakeLists.txt
new file mode 100644
index 0000000..11a686b
--- /dev/null
+++ b/new/CMakeLists.txt
@@ -0,0 +1,251 @@
+
+# This program source code file is part of KICAD, a free EDA CAD application.
+#
+# Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+# Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors#.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you may find one here:
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+# or you may search the http://www.gnu.org website for the version 2 license,
+# or you may write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+# for now, this is a stand alone project
+if( 1 )
+
+ project(kicad-new)
+
+ cmake_minimum_required( VERSION 2.8 FATAL_ERROR )
+
+ set( PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ )
+
+ # message( "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" )
+
+ # Path to local CMake modules.
+ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
+
+ include( CheckFindPackageResult )
+
+ find_package(Doxygen)
+
+ # On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
+ if(APPLE)
+ find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET )
+ else()
+ find_package(wxWidgets COMPONENTS gl adv html core net base xml aui QUIET )
+ endif()
+
+ check_find_package_result( wxWidgets_FOUND "wxWidgets" )
+
+ # make config.h
+ include( PerformFeatureChecks )
+ perform_feature_checks()
+
+ # Include wxWidgets macros.
+ include( ${wxWidgets_USE_FILE} )
+
+ include_directories( ${PROJECT_SOURCE_DIR}/include )
+
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ # Set default flags for Release build.
+ set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG ")
+ set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc")
+
+ # Set default flags for Debug build.
+ set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
+ set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
+ endif(CMAKE_COMPILER_IS_GNUCXX)
+
+ include(Functions)
+
+endif()
+
+
+#================================================
+# Doxygen Output
+#================================================
+if(DOXYGEN_FOUND)
+ add_custom_target( new-docs ${DOXYGEN_EXECUTABLE}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS Doxyfile )
+else(DOXYGEN_FOUND)
+ message( STATUS "WARNING: Doxygen not found - new-docs (Source Docs) target not created" )
+endif()
+
+
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
+include_directories( ${CMAKE_BINARY_DIR} )
+
+#=====<on standby for possible C++ unit testing>================================
+if( false )
+
+ add_executable( test_dir_lib_source
+ sch_dir_lib_source.cpp
+ )
+ target_link_libraries( test_dir_lib_source ${wxWidgets_LIBRARIES} )
+
+ add_executable( test_sch_part sch_part.cpp )
+ target_link_libraries( test_sch_part ${wxWidgets_LIBRARIES} )
+
+ add_executable( test_lpid
+ sch_lpid.cpp
+ )
+ target_link_libraries( test_lpid ${wxWidgets_LIBRARIES} )
+
+endif( false )
+
+#=====</on standby for possible C++ unit testing>===============================
+
+
+make_lexer(
+ ${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table.keywords
+ ${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_lexer.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_keywords.cpp
+ LT
+ )
+
+make_lexer(
+ ${CMAKE_CURRENT_SOURCE_DIR}/sweet.keywords
+ ${CMAKE_CURRENT_SOURCE_DIR}/sweet_lexer.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/sweet_keywords.cpp
+ PR
+ )
+
+
+add_library( sweet SHARED
+ sch_lib_table.cpp
+ sch_lib_table_keywords.cpp
+ sch_lib.cpp
+ sch_lpid.cpp
+ sch_dir_lib_source.cpp
+ sch_part.cpp
+ sch_sweet_parser.cpp
+ sweet_keywords.cpp
+ ${PROJECT_SOURCE_DIR}/common/richio.cpp
+ ${PROJECT_SOURCE_DIR}/common/dsnlexer.cpp
+ )
+target_link_libraries( sweet ${wxWidgets_LIBRARIES} )
+
+# talk to import_export.h
+set_target_properties( sweet PROPERTIES
+ DEFINE_SYMBOL COMPILING_DLL
+ )
+
+add_executable( test_sch_lib_table test_sch_lib_table.cpp )
+if( MINGW )
+ set_target_properties( test_sch_lib_table PROPERTIES
+ LINK_FLAGS -Wl,--enable-auto-import
+ )
+endif()
+target_link_libraries( test_sch_lib_table sweet )
+
+
+if( 1 )
+
+ find_library( gal_LIBRARY "libgal.a"
+ PATHS
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../kicad-gal/build"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../../kicad-gal/build"
+ DOC
+ "Where is the static GAL library"
+ )
+ find_path( gal_ROOT NAMES "README.txt"
+ PATHS
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../kicad-gal"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../../kicad-gal"
+ DOC
+ "Where is the base include directory for the GAL library"
+ )
+
+else()
+
+ # we build the GAL library, therefore we know where it is, no need to find_library() it.
+ set( gal_ROOT "${CMAKE_CURRENT_BINARY_DIR}/gal-src" )
+ set( gal_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/gal-src/libgal.a" )
+
+ include( ExternalProject )
+ ExternalProject_Add( ki_gal
+ # skip the install step, build in source, use from source
+ SOURCE_DIR "${gal_ROOT}"
+ STAMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/gal-stamps"
+ TIMEOUT 120
+ DOWNLOAD_COMMAND bzr export ${gal_ROOT} lp:~kicad-testing-committers/kicad/kicad-gal
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${gal_ROOT}
+ BUILD_IN_SOURCE 1
+ BUILD_COMMAND make
+ INSTALL_COMMAND ""
+ )
+endif()
+
+include_directories( "${gal_ROOT}" )
+
+# Find pkg-config in order find cairo.
+find_package( PkgConfig REQUIRED )
+
+# Find cairo.
+#pkg_search_module( CAIRO REQUIRED cairo>=1.8.1 )
+#include_directories( ${CAIRO_INCLUDE_DIRS} )
+
+
+# Find the OpenGL libraries (gl and glu)
+find_package( OpenGL )
+
+
+# Find GLEW
+pkg_search_module( GLEW REQUIRED glew>=1.5.0 )
+include_directories( ${GLEW_INCLUDE_DIRS} )
+
+
+include_directories( ${gal_ROOT} )
+
+add_executable( sweet_edit sweet_edit.cpp sweet_editor_panel.cpp sch_canvas.cpp )
+
+target_link_libraries( sweet_edit
+ sweet
+ ${OPENGL_LIBRARIES}
+ ${gal_LIBRARY}
+ ${wxWidgets_LIBRARIES}
+ ${GLEW_LIBRARIES}
+ ${GDI_PLUS_LIBRARIES}
+ )
+
+
+#=====<USE_SWIG>============================================================
+# if you want a Python scripting layer on top for unit testing or driving.
+# reference: http://www.swig.org/Doc1.3/Introduction.html#Introduction_build_system
+
+option( USE_SWIG "Use SWIG to build a python scripting interface (default OFF)." OFF)
+if( USE_SWIG )
+
+ find_package( SWIG REQUIRED )
+ include( ${SWIG_USE_FILE} )
+
+ # first install "python-dev" linux package for this:
+ find_package( PythonLibs )
+ include_directories( ${PYTHON_INCLUDE_PATH} )
+
+ set( CMAKE_SWIG_FLAGS "" )
+
+ set_source_files_properties( sweet.i PROPERTIES CPLUSPLUS ON )
+ #set_source_files_properties( sweet.i PROPERTIES SWIG_FLAGS "-includeall" )
+
+ swig_add_module( sweet python sweet.i )
+ swig_link_libraries( sweet ${PYTHON_LIBRARIES} sweet )
+
+ # @todo need a separate interface for each DSNLEXER
+
+endif()
+
diff --git a/new/Doxyfile b/new/Doxyfile
new file mode 100644
index 0000000..2f60321
--- /dev/null
+++ b/new/Doxyfile
@@ -0,0 +1,1552 @@
+# Doxyfile 1.6.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Distributed Library & EESchema Parts List Design"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = YES
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = NO
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = .
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.cpp
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = build
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = YES
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = pdf
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH = .
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS = *.h
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = YES
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/new/design.h b/new/design.h
new file mode 100644
index 0000000..3b3e4b0
--- /dev/null
+++ b/new/design.h
@@ -0,0 +1,476 @@
+
+namespace SCH {
+
+/** @mainpage
+
+This file describes the design of a new Distributed Library System for KiCad's
+EESCHEMA. Many of the concepts can be adapted with modest modification to PCBNEW
+also, in the future.
+
+@author Dick Hollenbeck <dick@softplc.com>
+
+@date October 2010 - January 2011
+
+@section intr_sec Introduction
+
+Schematic <b>parts</b> are frequently needed to complete a circuit design
+schematic. Computer data entry of parts can be a rate limiting step in the
+design of an overall PCB. Having ready made access to all needed parts in a
+design significantly improves the productivity of a circuit designer. Sharing
+parts within an organization is one step in the right direction, but there is
+opportunity to share across organizational boundaries to improve productivity
+even more. Using a part that someone else in another organization has already
+entered into the computer can eliminate the first data input process for that
+part. The more complicated the part and the board, the larger the positive
+impact on productivity because the larger the time savings.
+
+<p> Sharing parts within an organization is best done by directly accessing a
+known internal source for those parts, say on a company network. Sharing parts
+across organizational boundaries is best done using the Internet in real-time.
+Having the ability to search for a part based on arbitrary search criteria can
+speed up the pace at which new parts are found and used.
+
+<p> Electronic component manufacturers need and look for ways to differentiate
+their products from their competitors. With this Distributed Library System
+facility in KiCad, one way for manufacturers to differentiate themselves and
+their parts is to publish a part library on the Internet and save their
+customers the work of doing the data entry of the part into the KiCad design
+system.
+
+<p> Maintaining a comprehensive part library is a fairly labor intensive
+activity. New parts come into the market everyday. By being able to publish a
+superior library on the Internet, it may be possible to make a for profit
+business out of doing this. The KiCad eco-system would benefit should this
+happen, and there could even be competition between such businesses. Or there
+can be library specializations or niches.
+
+<p> Often a found part is close to what is needed but not exactly what is
+needed. This Distributed Library System design incorporates the concept of part
+inheritance using a part description language called <b>Sweet</b>. Sweet is
+based on s-expression syntax. Inheritance is the ability to incrementally change
+an existing part without completely re-designing it. It is sometimes easier to
+modify an existing part than it is to create the new part entirely from scratch.
+
+<p> This Distributed Library System design will have the capability to
+significantly benefit the KiCad eco-system, and that should mean expanding the
+numbers of users and contributors to the project, and hopefully making for a
+better KiCad tool-set for all.
+
+
+@section definitions Definitions
+
+Only new terms or changes in the definition of terms are given here.
+
+<dl>
+
+<dt>S-Expression</dt><dd>This is a syntactical textual envelop in the same vain as
+XML. It may be used to express any number of domain specific grammars. It uses
+parentheses to indicate the start and end of an element. A domain specific
+grammar is a set of rules that dictate what keywords may be used, and in what
+context. A grammar also establishes the allowed places and types of constants.
+There can be any number of grammars which all use s-expressions to hold the
+individual elements within the grammar. A grammar is at a higher level than
+s-expressions, in the same way that a sentence will have grammatical rules which
+are at a higher level than the rules used to spell words. Technically, grammars
+nest within grammars. So once you are inside a grammatical element, it will have
+its own set of rules as to which nested elements it may hold, and once you enter
+one of those nested elements, then that nested element's grammar pertains,
+etc.<p> In the case of the grammar for a part, the grammar itself is being given
+the name Sweet. The name does not extend to the grammar for the schematic,
+only the part grammar.</dd>
+
+<dt>Schematic</dt><dd>This consists of one or more sheets and will be different
+in three ways from existing schematics. <ul>
+
+ <li>All sheets will be in one file, thus the entire schematic is in one file.
+
+ <li>The schematic file will have its own s-expression grammar.
+
+ <li> There will be a <b>parts list</b> within the schematic, and within the
+ parts list will be <b>all</b> the parts for the schematic. yes <b>all</b> of
+ them. See class PARTS_LIST.</ul>
+
+Within the sheets of the schematic will be components.</dd>
+
+<dt>Component</dt><dd>A component is an instantiated part. The keyword for
+component is (comp). A component does not have any of its own properties other
+than: <ul> <li>rerence designator <li>part pointer or reference into the parts
+list <li>location <li>rotation <li>stuff i.e. DNS or do stuff the part
+<li>visual textual effect overrides </ul> Note that the (comp) may not have any
+properties or fields of its own, and that it may not exist without a
+corresponding part in the parts_list. A reason for this is to ensure that a
+BOM can be made simply from the parts_list.</dd>
+
+<dt>Component, again for good measure.</dt><dd>A component is an instantiation
+of a part. A component exists within a schematic which has a parts list
+containing the part from which the component is instantiated. A component has a
+unique reference designator, part ref, its own location, orientation,
+stuff/DNS, and text attributes but <b>not</b> its own text fields/strings (other
+than reference designator). The part which is instantiated must exist in the
+parts list of the same schematic.</dd>
+
+<dt>Inheritance</dt><dd>Is the ability to mimic form and function from another
+entity. In our case we use it only for parts. One part may "inherit from" or
+"extend" another single part.</dd>
+
+<dt>Part</dt><dd>A part is a symbolic schematic circuit element found within an
+EESCHEMA library (or within a parts list). It is re-usable and may be
+instantiated more than once within a schematic. For it to be instantiated, it
+must be copied or inherited into the parts list of the instantiating schematic.
+If inherited into the parts list, then only a concise reference is needed into
+the originating library. If instead it is copied into the parts list, then the
+part is fully autonomous and need have no reference to its original copy.</dd>
+
+<dt>Parts List</dt><dd>A parts list, keyword (parts_list), is an entirely new
+construct. It exists within a schematic and is the complete set of parts used
+within a particular schematic. Each schematic has exactly one parts list
+contained within it. A parts list is also a library source and a library sink
+for the current schematic. A parts list in any schematic may also be a library
+source for any other schematic, but not a library sink. The parts list construct
+makes it almost wholly unnecessary to write to other types of library
+sinks.</dd>
+
+<dt>Library</dt><dd>A library is no longer a file. It is a memory cache of
+parts, consistent with the normal definition of memory cache. Each library is
+backed up with a <b>library source</b>. In rare cases, some libraries may also
+have a <b>library sink</b>.</dd>
+
+<dt>Library Source</dt><dd>A library source is an abstract read only repository
+of parts. The repository itself might exist on the moon. The difference between
+a library source and a library sink is that a source is a readable entity.</dd>
+
+<dt>Library Sink</dt><dd>A library sink is an abstract place that parts can be
+written to for future reading. The difference between a library source and a
+library sink is that a library sink is a writable entity.</dd>
+
+<dt>Symbol</dt><dd>The term "symbol" is not used in a specific way in this
+document. There is no symbol in any of the grammars, so use of it on the
+developers list will not be understood without explanation. Of course it is
+possible to have multiple parts all extend a common base part, and you can think
+of the base part as having most if not all the graphical lines for any
+derivatives. But we do not need to use the term symbol to describe that
+relationship, the term "part" is sufficient.</dd>
+
+<dt>LPID</dt><dd>This stands for "Logical Part ID", and is a reference to any
+part within any known library. The term "logical" is used because the contained
+library name is logical, not a full library name. The LPID consists of 3 main
+portions: logical library name, part name, and revision number.</dd>
+
+<dt>Library Table</dt><dd>This is a lookup table that maps a logical library
+name (i.e. a short name) into a fully specified library name and library type.
+An applicable library table consists of rows from (at least) two sources:<ol>
+<li>A schematic resident library table.
+<li>A personal library table.
+</ol>
+
+These rows from the two sources are conceptually concatonated (although they may
+not be physically concatonated in the implementation, TBD). The schematic
+resident rows take presedence over the personal library table if there are
+logical library names duplicately defined. (Or we will simply ask that any remote
+(i.e. public) libraries use uppercase first letters in logical names, TBD.)
+
+<p> Eventually there will be an external publicly available internet based
+logical library table also, but this will need to be glued down at a hard coded
+URL that we have control over. The internet based library table allows us to
+advertise remote libraries without having to issue an update to KiCad.</dd>
+
+<dt>Query Language</dt><dd>This is a means of searching for something that is
+contained within a container. Since some library sources are remote, it is
+important to be able to ask the library source for a part that matches some
+criteria, for performance reasons.</dd>
+
+</dl>
+
+
+
+@section changes Required Changes
+
+In order fulfill the vision embodied by this Distributed Library System design,
+it will be necessary to change many APIs and file formats within EESCHEMA. In
+fact, the entire schematic file format will be new, based on s-expressions,
+the schematic grammar, and the Sweet language for parts.
+
+Here are some of the changes required: <ul>
+
+<li> All sheets which make up a schematic will go into a single s-expression
+file. The multiple sheet support will still exist, but all the sheets for a
+single schematic are all in a single file.
+
+<li> A "library" is a collection of "parts". The unit of retrieval from a
+library is a part as a textual string in the Sweet language. Sweet is a
+particular "grammar" expressed in s-expression form, and can be used to fully
+describe parts. Because EESCHEMA does not actually see a "library file",
+(remember, EESCHEMA can only ask for a part), the actual file format for a
+library is no longer pertinent nor visible to the core of EESCHEMA. The unit of
+retrieval from the API is the part, so EESCHEMA gets an entire part s-expression
+and must then parse it as a RAM resident Sweet string.
+
+<li>EESCHEMA knows of no library files, instead there is a library API which
+abstracts the actual part storage strategy used within any library
+implementation. The API can be implemented by anyone wanting to provide a
+library under a given storage strategy. The API provides a storage strategy
+abstraction in classes LIB_SOURCE and LIB_SINK. The actual storage strategy used
+in any particular library implementation is not technically part of the
+conceptual core of EESCHEMA. This is an important concept to grasp. Eventually
+the library implementations may be jetisoned into a plug-in structure, but
+initially they are statically linked into EESCHEMA. Should the plug-in strategy
+ever get done, the boundary of the plug-in interface will remain the C++ library
+API as given here (mostly in class LIB_SOURCE). The only reason to introduce a
+plug-in design is to allow proprietary closed source library implementations,
+and this could eventually come about if a part vendor wanted to provide one for
+the KiCad project. If a Texas Instruments type of company wants to maintain a
+KiCad library, we will be positioned to accommodate them. Until then, the
+LIB_SOURCE implementations can be statically linked into EESCHEMA and there is
+no conceptual disruption either way.
+
+<li> Most library implementations are read only. There are only two library
+types that are writable, the "dir" type, and the "parts list". All other types
+are read only from the perspective of the API. Stuffing those read only
+libraries and maintaining them will be done using the normal update mechanisms
+pertinent to the library's respective type of repository. The most common place
+to do incremental enhancements to a part before using it is not in the external
+library, but now in the parts list with this new design.
+
+<li> The design will support classical clipboard usage. The part in the Sweet
+language can be placed onto the clipboard for use by other applications and
+instances of EESCHEMA. Eventually larger blocks of components may also be
+supported on the clipboard, since the Sweet language allows these blocks to be
+descributed textually in a very readable fashion. (Clipboard support beyond part
+manipulation is not currently in this revision of the design however, it can be
+a future separate enhancement. Perhaps someday complete sheets may be passed
+through the clipboard.)
+
+<li> The cumulative set of required changes are significant, and are tantamount
+to saying that EESCHEMA will need its part handling foundations re-written. A
+conversion program will convert everything over to the new architecture. The
+conversion program can simplify things by simply putting all schematic parts
+into a parts list within each schematic.
+
+<li> An Internet connection is required to use some of the library sources. It
+will be possible to omit these library sources and run KiCad by doing a
+configuration change. Eventually, some library sources will spring up and will
+not technically be part of the KiCad project, so they will remain remote, but
+fully usable to those with an internet connection and permission from the
+library source's owner.
+
+<li>By far, even as radical as the distributed library concept is, complete with
+remote access, the most significant conceptual change is the introduction of the
+<b>parts list</b>. This is a special library that exists in a schematic, and is
+the complete record of all parts used within that same schematic. It is
+impossible to put a component into a schematic without that component's part
+first existing within the parts list of that schematic.
+
+<li> Because of inheritance, multi-body-form parts, alternate body styles, see
+also references, and other needs, it is necessary to have a <b>part reference
+mechanism</b>. A component has to reference a part, the one it "is". A part has
+to be able to reference another part, either in the same library or elsewhere.
+Enter the Logical Part ID, or LPID to serve this need. An LPID consists of a
+logical library name, a part name, and an optional revision. It is used to
+reference parts, from anywhere. If the reference is from a sheet's component,
+then the logical library name of the LPID is not needed. Why? Well if you've
+been paying attention you know. A comp can only be based on a part that exists
+within the parts_list of the same schematic in which it resides. Likewise, a
+part within any library that references another part in that <b>same</b> library
+will also omit the logical library name from the LPID, and it must omit it. Why?
+Well because it makes renaming the library easier, for one. Two, the logical
+library name is only a lookup key into a "library table". The library table maps
+the logical library name into an actual library source [and sink, iff writable].
+See LIB_SOURCE and LIB_SINK.
+
+<p> In the case of the component referencing the part that it "is", there is no
+revision number allowed in the LPID. This is because that reference is to the
+part in the parts list, and the parts list only holds a single revision of any
+part (where "revision" is what you understand from version control systems).
+
+<li> There needs to be a new query language designed and each library source
+needs to support it. See LIB_SOURCE::FindParts() for a brief description of one.
+
+</ul>
+
+
+@section philosophy Design Philosophies
+
+<p> Class names are chosen to be as concise as possible. Separate namespaces can be
+used should these same class names be needed in both EESCHEMA and PCBNEW (later).
+However, this design does not yet address PCBNEW. Suggested namespaces are
+SCH for EESCHEMA, and PCB for PCBNEW.
+
+<p> Since most if not all the APIs deal with file or non-volatile storage, only
+8 bit string types are used. For international strings, UTF-8 is used, and
+that is what is currently in use within the KiCad file storage formats.
+
+<p> The typedef <b>STRINGS</b> is used frequently as a holder for multiple
+std::strings. After some research, I chose std::dequeue<STRING> to hold a list of
+STRINGs. I thought it best when considering overall speed, memory
+fragmentation, memory efficiency, and speed of insertion and expansion.
+
+<p> A part description language is introduced called <b>(Sweet)</b>. It supports
+inheritance and its syntax is based on s-expressions.
+
+<p> Since a part can be based on another part using inheritance, it is important
+to understand the idea of library dependencies. A part in one library can be
+dependent on another part in another library, or on another part in the same
+library as itself. There are several library sources, some far away and some
+very close to the schematic. The closest library to the schematic is the
+<b>(parts list)</b> class PARTS_LIST. Circular dependencies are not allowed. All
+dependencies must be resolvable in a straight forward way. This means that a
+part in a remote library cannot be dependent on any part which is not always
+resolvable.
+
+<p> NRVO described:
+ http://msdn.microsoft.com/en-us/library/ms364057%28VS.80%29.aspx
+
+Even with NRVO provided by most C++ compilers, I don't see it being as lean as
+having class LIB keep expanded members STRING fetch and STRINGS vfetch for the
+aResults values. But at the topmost API, client convenience is worth a minor
+sacrifice in speed, so the topmost API does return these complex string objects
+for convenience. So there is a different strategy underneath the hood than what
+is used on the hood ornament. When aResults pointer is passed as an argument, I
+won't refer to this as 'returning' a value, but rather 'fetching' a result to
+distinguish between the two strategies.
+
+<p> Functions named as lookupSomething() or LookupSomething() are to be understood
+as "find and load if needed". This is different than a simple find operation only, in
+that an implied load operation is also done, but only if needed.
+
+
+@section architecture Architecture
+
+This document set later shows some <b>library sources</b> derived from class
+LIB_SOURCE. A library source is the backing to a library. The class name for a
+library in the new design is LIB.
+
+<p>
+<IMG SRC="../drawing.png" ALT="You should see design architecture here">
+
+*/
+
+
+
+/**
+ * @defgroup string_types STRING Types
+ * Provide some string types for use within the API.
+ */
+
+
+/**
+ * @defgroup exception_types Exception Types
+ * Provide some exception types for use within the API.
+ */
+
+
+/**
+ * Class HTTP_LIB_SOURCE
+ * implements a LIB_SOURCE to access a remote document root repository using http protocol.
+ */
+class HTTP_LIB_SOURCE : public LIB_SOURCE
+{
+ friend class LIB_TABLE; ///< constructor the LIB uses these functions.
+
+protected:
+
+ /**
+ * Constructor ( const STRING& aHttpURL )
+ * sets up a LIB_SOURCE using aHttpURI which points to a subversion
+ * repository.
+ * @see LIB_TABLE::LookupPart()
+ *
+ * @param aHttpURL is a full URL of a document root repo directory. Example might
+ * be "http://kicad.org/libs"
+ *
+ * @param aOptions is the options string from the library table. It can be any
+ * string that the LIB_SOURCE can parse and understand, perhaps using comma separation
+ * between options. Options and their syntax is LIB_SOURCE implementation specific.
+ */
+ HTTP_LIB_SOURCE( const STRING& aHttpURL, const STRING& aOptions ) throws( IO_ERROR );
+};
+
+
+/**
+ * Class SVN_LIB_SOURCE
+ * implements a LIB_SOURCE to access a [remote or local] subversion repository
+ * using subversion client protocol.
+ */
+class SVN_LIB_SOURCE : public LIB_SOURCE
+{
+ friend class LIB_TABLE; ///< constructor the LIB uses these functions.
+
+protected:
+
+ /**
+ * Constructor SVN_LIB_SOURCE( const STRING& aSvnURL )
+ * sets up a LIB_SOURCE using aSvnURI which points to a subversion
+ * repository.
+ * @see LIB_TABLE::LookupPart().
+ *
+ * @param aSvnURL is a full URL of a subversion repo directory. Example might
+ * be "svn://kicad.org/repos/library/trunk"
+ *
+ * @param aOptions is the options string from the library table. It can be any
+ * string that the LIB_SOURCE can parse and understand, perhaps using comma separation
+ * between options. Options and their syntax is LIB_SOURCE implementation specific.
+ */
+ SVN_LIB_SOURCE( const STRING& aSvnURL, const STRING& aOptions ) throws( IO_ERROR );
+};
+
+
+/**
+ * Class SCHEMATIC_LIB_SOURCE
+ * implements a LIB_SOURCE in by reading a parts list from schematic file
+ * unrelated to the schematic currently being edited.
+ */
+class SCHEMATIC_LIB_SOURCE : public LIB_SOURCE
+{
+ friend class LIB_TABLE; ///< constructor the LIB uses these functions.
+
+protected:
+
+ /**
+ * Constructor SCHEMATIC_LIB_SOURCE( const STRING& aSchematicFile )
+ * sets up a LIB_SOURCE using aSchematicFile which is a full path and filename
+ * for a schematic not related to the schematic being editing in
+ * this EESCHEMA session.
+ * @see LIB_TABLE::LookupPart().
+ *
+ * @param aSchematicFile is a full path and filename. Example:
+ * "/home/user/kicadproject/design.sch"
+ *
+ * @param aOptions is the options string from the library table. It can be any
+ * string that the LIB_SOURCE can parse and understand, perhaps using comma separation
+ * between options. Options and their syntax is LIB_SOURCE implementation specific.
+ */
+ SCHEMATIC_LIB_SOURCE( const STRING& aSchematicFile, const STRING& aOptions ) throws( IO_ERROR );
+};
+
+
+/**
+ * Class PARTS_LIST
+ * is a LIB which resides in a SCHEMATIC, and it is a table model for a
+ * spread sheet both. When columns are added or removed to/from the spreadsheet,
+ * this is adding or removing fields/properties to/from ALL the contained PARTS.
+ */
+class PARTS_LIST : public LIB
+{
+public:
+
+ /**
+ * Function GetModel
+ * returns a spreadsheet table model that allows both reading and writing to
+ * rows in a spreadsheet. The UI holds the actual screen widgets, but
+ * this is the table model, i.e. the PARTS_LIST is.
+ */
+ SPREADSHEET_TABLE_MODEL* GetModel();
+};
+
+
+
+} // namespace SCH
+
+
+/// @todo remove endsWithRev() in favor of EndsWithRev(), find home for it.
+
+/// @todo add simple unit test infrastructure.
+
+/// @todo review: http://www.sfml-dev.org/tutorials/1.2/graphics-wxwidgets.php
+
+// EOF
diff --git a/new/drawing.png b/new/drawing.png
new file mode 100644
index 0000000..eea6114
--- /dev/null
+++ b/new/drawing.png
Binary files differ
diff --git a/new/drawing.svg b/new/drawing.svg
new file mode 100644
index 0000000..1afc681
--- /dev/null
+++ b/new/drawing.svg
@@ -0,0 +1,964 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1012.09"
+ height="754.09998"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.47 r22583"
+ sodipodi:docname="drawing.svg"
+ inkscape:export-filename="/svn/kicad/new_design/new/drawing.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path3674"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2852"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective2885"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective2932"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective2965"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4115"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Lend-9"
+ style="overflow:visible">
+ <path
+ id="path3674-3"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="matrix(-1.1,0,0,-1.1,-1.1,0)" />
+ </marker>
+ <inkscape:perspective
+ id="perspective4352"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4990"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="575.26689"
+ inkscape:cy="1269.5904"
+ inkscape:document-units="px"
+ inkscape:current-layer="svg2"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1119"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ units="in"
+ inkscape:snap-global="false"
+ objecttolerance="10000"
+ inkscape:snap-midpoints="true"
+ inkscape:snap-bbox="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2955"
+ empspacing="10"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true"
+ spacingx="10px"
+ spacingy="10px"
+ dotted="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <rect
+ style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect3942"
+ width="168.57143"
+ height="41.42857"
+ x="556.42859"
+ y="688.38568" />
+ <rect
+ style="fill:#00bad5;fill-opacity:0.9605735;stroke:#000000;stroke-width:0.95887607;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect4976"
+ width="234.49751"
+ height="98.013084"
+ x="755.58539"
+ y="508.26596" />
+ <rect
+ style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.29770339;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect5805"
+ width="188.37473"
+ height="93.374725"
+ x="793.24127"
+ y="650.91266" />
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-298.25658)" />
+ <rect
+ style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:1.6983366px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="rect2816"
+ width="872.59253"
+ height="273.89703"
+ x="95.277359"
+ y="22.688547"
+ sodipodi:insensitive="true" />
+ <text
+ xml:space="preserve"
+ style="font-size:44.65415192px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
+ x="329.44296"
+ y="69.284828"
+ id="text2818"
+ transform="scale(1.086331,0.92052975)"
+ sodipodi:insensitive="true"><tspan
+ sodipodi:role="line"
+ x="329.44296"
+ y="69.284828"
+ id="tspan2828">schematic</tspan></text>
+ <rect
+ style="fill:#00bad5;fill-rule:evenodd;stroke:#000000;stroke-width:1.41801190000000021px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:0.96057349"
+ id="rect2826"
+ width="452.43915"
+ height="129.58199"
+ x="90.923286"
+ y="508.6037" />
+ <text
+ xml:space="preserve"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="175.85715"
+ y="657.25031"
+ id="text2828"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan2830"
+ x="175.85715"
+ y="657.25031">HTTP_LIB_SOURCE</tspan></text>
+ <g
+ id="g3856">
+ <g
+ transform="translate(18,0)"
+ id="g3851">
+ <rect
+ style="fill:#ff8080;stroke:#000000;stroke-width:0.76680511;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect2833"
+ width="67.913422"
+ height="40.639297"
+ x="130.19307"
+ y="73.140556" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="138.37057"
+ y="97.500824"
+ id="text2835"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ x="138.37057"
+ y="97.500824"
+ id="tspan2839">comp</tspan></text>
+ </g>
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="big blocks" />
+ <g
+ id="g3790"
+ transform="translate(60,-0.71428569)"
+ sodipodi:insensitive="true">
+ <rect
+ y="204.09998"
+ x="77.85714"
+ height="75"
+ width="801.42859"
+ id="rect2988"
+ style="fill:#f4d7d7;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text3786"
+ y="221.24283"
+ x="440"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="221.24283"
+ x="440"
+ id="tspan3788"
+ sodipodi:role="line">parts_list</tspan></text>
+ </g>
+ <g
+ id="g3822">
+ <g
+ transform="translate(-12.857147,6.4285736)"
+ id="g3801">
+ <rect
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect3795"
+ width="56.64537"
+ height="39.502518"
+ x="164.8916"
+ y="222.563" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="172.85715"
+ y="247.6714"
+ id="text3797"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3799"
+ x="172.85715"
+ y="247.6714">part</tspan></text>
+ </g>
+ </g>
+ <g
+ id="g3828"
+ transform="translate(133.32018,-0.3941193)">
+ <g
+ id="g3830"
+ transform="translate(-12.857147,6.4285736)">
+ <rect
+ y="222.563"
+ x="164.8916"
+ height="39.502518"
+ width="56.64537"
+ id="rect3832"
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text3834"
+ y="247.6714"
+ x="172.85715"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="247.6714"
+ x="172.85715"
+ id="tspan3836"
+ sodipodi:role="line">part</tspan></text>
+ </g>
+ </g>
+ <g
+ transform="translate(259.32018,-0.3941193)"
+ id="g3838">
+ <g
+ transform="translate(-12.857147,6.4285736)"
+ id="g3840">
+ <rect
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect3842"
+ width="56.64537"
+ height="39.502518"
+ x="164.8916"
+ y="222.563" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="172.85715"
+ y="247.6714"
+ id="text3844"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3846"
+ x="172.85715"
+ y="247.6714">part</tspan></text>
+ </g>
+ </g>
+ <g
+ id="g3862"
+ transform="translate(130,0)">
+ <g
+ id="g3864"
+ transform="translate(18,0)">
+ <rect
+ y="73.140556"
+ x="130.19307"
+ height="40.639297"
+ width="67.913422"
+ id="rect3866"
+ style="fill:#ff8080;stroke:#000000;stroke-width:0.76680511;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text3868"
+ y="97.500824"
+ x="138.37057"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ id="tspan3870"
+ y="97.500824"
+ x="138.37057"
+ sodipodi:role="line">comp</tspan></text>
+ </g>
+ </g>
+ <g
+ transform="translate(256,0)"
+ id="g3872">
+ <g
+ transform="translate(18,0)"
+ id="g3874">
+ <rect
+ style="fill:#ff8080;stroke:#000000;stroke-width:0.76680511;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect3876"
+ width="67.913422"
+ height="40.639297"
+ x="130.19307"
+ y="73.140556" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="138.37057"
+ y="97.500824"
+ id="text3878"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ x="138.37057"
+ y="97.500824"
+ id="tspan3880">comp</tspan></text>
+ </g>
+ </g>
+ <g
+ id="g3882"
+ transform="translate(471.32018,-0.3941193)">
+ <g
+ id="g3884"
+ transform="translate(-12.857147,6.4285736)">
+ <rect
+ y="222.563"
+ x="164.8916"
+ height="39.502518"
+ width="56.64537"
+ id="rect3886"
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text3888"
+ y="247.6714"
+ x="172.85715"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="247.6714"
+ x="172.85715"
+ id="tspan3890"
+ sodipodi:role="line">part</tspan></text>
+ </g>
+ </g>
+ <rect
+ style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.11650062;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect3894"
+ width="473.64505"
+ height="82.716003"
+ x="493.0127"
+ y="368.03632" />
+ <text
+ xml:space="preserve"
+ style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="684.51794"
+ y="389.21155"
+ id="text3896"
+ sodipodi:linespacing="100%"><tspan
+ sodipodi:role="line"
+ id="tspan3898"
+ x="684.51794"
+ y="389.21155">LIBS manager</tspan></text>
+ <g
+ id="g4102">
+ <path
+ id="path2876"
+ d="M 179.80715,116.16834 180,226.09998"
+ style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend)" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text4098"
+ y="157.6049"
+ x="181.70563"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="157.6049"
+ x="181.70563"
+ id="tspan4100"
+ sodipodi:role="line">is</tspan></text>
+ </g>
+ <g
+ transform="translate(134,-4e-6)"
+ id="g4102-9">
+ <path
+ id="path2876-0"
+ d="M 179.80715,116.16834 180,226.09998"
+ style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend)" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text4098-8"
+ y="157.6049"
+ x="181.70563"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="157.6049"
+ x="181.70563"
+ id="tspan4100-8"
+ sodipodi:role="line">is</tspan></text>
+ </g>
+ <g
+ id="g4144"
+ transform="translate(260,-4e-6)">
+ <path
+ style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend)"
+ d="M 179.80715,116.16834 180,226.09998"
+ id="path4146" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="181.70563"
+ y="157.6049"
+ id="text4148"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4150"
+ x="181.70563"
+ y="157.6049">is</tspan></text>
+ </g>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 439.67732,268.09998 0.32268,46 210,0 0,-40"
+ id="path4152" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="520.22858"
+ y="330.28006"
+ id="text4340"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4342"
+ x="520.22858"
+ y="330.28006">extends</tspan></text>
+ <g
+ id="g3828-4"
+ transform="translate(133.32018,329.60589)">
+ <g
+ id="g3830-8"
+ transform="translate(-12.857147,6.4285736)">
+ <rect
+ y="222.563"
+ x="164.8916"
+ height="39.502518"
+ width="56.64537"
+ id="rect3832-1"
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text3834-0"
+ y="247.6714"
+ x="172.85715"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="247.6714"
+ x="172.85715"
+ id="tspan3836-3"
+ sodipodi:role="line">part</tspan></text>
+ </g>
+ </g>
+ <g
+ transform="translate(-2.67982,329.60589)"
+ id="g4378">
+ <g
+ transform="translate(-12.857147,6.4285736)"
+ id="g4380">
+ <rect
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect4382"
+ width="56.64537"
+ height="39.502518"
+ x="164.8916"
+ y="222.563" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="172.85715"
+ y="247.6714"
+ id="text4384"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4386"
+ x="172.85715"
+ y="247.6714">part</tspan></text>
+ </g>
+ </g>
+ <g
+ transform="translate(267.32018,329.60589)"
+ id="g4388">
+ <g
+ transform="translate(-12.857147,6.4285736)"
+ id="g4390">
+ <rect
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect4392"
+ width="56.64537"
+ height="39.502518"
+ x="164.8916"
+ y="222.563" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="172.85715"
+ y="247.6714"
+ id="text4394"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4396"
+ x="172.85715"
+ y="247.6714">part</tspan></text>
+ </g>
+ </g>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.101;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow2Lend-9)"
+ d="M 180.35714,268.49409 180,554.09998"
+ id="path4398" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 313.67732,268.09998 0,290.49749"
+ id="path4400" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text4774"
+ y="354.28006"
+ x="184.22858"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="354.28006"
+ x="184.22858"
+ id="tspan4776"
+ sodipodi:role="line">extends</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="316.22858"
+ y="354.28006"
+ id="text4778"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4780"
+ x="316.22858"
+ y="354.28006">extends</tspan></text>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 313.9049,598.53648 0,48.73986 137.63329,0.25254 0.25254,-48.73986"
+ id="path4782" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text4970"
+ y="664.28003"
+ x="348.22858"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="664.28003"
+ x="348.22858"
+ id="tspan4972"
+ sodipodi:role="line">extends</tspan></text>
+ <rect
+ style="fill:#00bad5;fill-opacity:0.9605735;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect4974"
+ width="145.46196"
+ height="128.28937"
+ x="564.67529"
+ y="508.6329" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text4978"
+ y="661.25031"
+ x="581.85718"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="661.25031"
+ x="581.85718"
+ id="tspan4980"
+ sodipodi:role="line">DIR_LIB_SOURCE</tspan></text>
+ <text
+ sodipodi:linespacing="125%"
+ id="text4978-6"
+ y="631.6189"
+ x="792.89563"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="631.6189"
+ x="792.89563"
+ id="tspan4980-2"
+ sodipodi:role="line">SCHEMATIC_LIB_SOURCE</tspan></text>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 512.14734,451.05421 -0.50507,55.05331"
+ id="path5007" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 637.91133,451.55929 -0.50507,55.05331"
+ id="path5009" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 849.03322,450.54913 0,55.55839"
+ id="path5011" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 740,298.38569 0,67.14286"
+ id="path5571" />
+ <g
+ id="g5759"
+ transform="translate(457.32018,329.60589)">
+ <g
+ id="g5761"
+ transform="translate(-12.857147,6.4285736)">
+ <rect
+ y="222.563"
+ x="164.8916"
+ height="39.502518"
+ width="56.64537"
+ id="rect5763"
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text5765"
+ y="247.6714"
+ x="172.85715"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="247.6714"
+ x="172.85715"
+ id="tspan5767"
+ sodipodi:role="line">part</tspan></text>
+ </g>
+ </g>
+ <g
+ transform="translate(447.32018,339.60589)"
+ id="g5779">
+ <g
+ transform="translate(-12.857147,6.4285736)"
+ id="g5781">
+ <rect
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect5783"
+ width="56.64537"
+ height="39.502518"
+ x="164.8916"
+ y="222.563" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="172.85715"
+ y="247.6714"
+ id="text5785"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan5787"
+ x="172.85715"
+ y="247.6714">part</tspan></text>
+ </g>
+ </g>
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="567.28571"
+ y="139.38568"
+ id="text5799"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan5801"
+ x="567.28571"
+ y="139.38568">All sheets are in one schematic object</tspan></text>
+ <rect
+ style="fill:#f4d7d7;fill-opacity:1;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect5803"
+ width="123.57143"
+ height="63.57143"
+ x="814.57141"
+ y="673.95709" />
+ <g
+ transform="translate(703.32018,451.60589)"
+ id="g5769">
+ <g
+ transform="translate(-12.857147,6.4285736)"
+ id="g5771">
+ <rect
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect5773"
+ width="56.64537"
+ height="39.502518"
+ x="164.8916"
+ y="222.563" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="172.85715"
+ y="247.6714"
+ id="text5775"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan5777"
+ x="172.85715"
+ y="247.6714">part</tspan></text>
+ </g>
+ </g>
+ <g
+ id="g5789"
+ transform="translate(693.32018,461.60589)">
+ <g
+ id="g5791"
+ transform="translate(-12.857147,6.4285736)">
+ <rect
+ y="222.563"
+ x="164.8916"
+ height="39.502518"
+ width="56.64537"
+ id="rect5793"
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text5795"
+ y="247.6714"
+ x="172.85715"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="247.6714"
+ x="172.85715"
+ id="tspan5797"
+ sodipodi:role="line">part</tspan></text>
+ </g>
+ </g>
+ <text
+ xml:space="preserve"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="826.71429"
+ y="663.95709"
+ id="text5807"
+ sodipodi:linespacing="100%"><tspan
+ sodipodi:role="line"
+ id="tspan5809"
+ x="826.71429"
+ y="663.95709">other schematic</tspan></text>
+ <rect
+ style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect5811"
+ width="154.28572"
+ height="57.142857"
+ x="167.85715"
+ y="676.24286" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="202.85715"
+ y="711.24286"
+ id="text5813"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan5815"
+ x="202.85715"
+ y="711.24286">Internet</tspan></text>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 245,638.38569 -0.71428,37.14286"
+ id="path5817" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="495.57144"
+ y="527.95709"
+ id="text2962"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan2964"
+ x="495.57144"
+ y="527.95709">LIB</tspan></text>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 638.57143,638.38569 -0.71429,47.14286"
+ id="path2966" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="566"
+ y="712.95709"
+ id="text3938"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3940"
+ x="566"
+ y="712.95709">part files in a dir</tspan></text>
+ <text
+ sodipodi:linespacing="125%"
+ id="text3944"
+ y="527.95709"
+ x="669.57141"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="527.95709"
+ x="669.57141"
+ id="tspan3946"
+ sodipodi:role="line">LIB</tspan></text>
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3948"
+ style="fill:black;stroke:none;stroke-opacity:1;stroke-width:1px;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:18px;-inkscape-font-specification:Bitstream Vera Sans;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion3950"><rect
+ id="rect3952"
+ width="240.71428"
+ height="148.57143"
+ x="740"
+ y="508.38568" /></flowRegion><flowPara
+ id="flowPara3954" /></flowRoot> <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="953.57141"
+ y="527.95709"
+ id="text3956"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3958"
+ x="953.57141"
+ y="527.95709">LIB</tspan></text>
+ <g
+ transform="translate(695.32018,305.60589)"
+ id="g3960">
+ <g
+ transform="translate(-12.857147,6.4285736)"
+ id="g3962">
+ <rect
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect3964"
+ width="56.64537"
+ height="39.502518"
+ x="164.8916"
+ y="222.563" />
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="172.85715"
+ y="247.6714"
+ id="text3966"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3968"
+ x="172.85715"
+ y="247.6714">part</tspan></text>
+ </g>
+ </g>
+ <g
+ id="g3970"
+ transform="translate(685.32018,315.60589)">
+ <g
+ id="g3972"
+ transform="translate(-12.857147,6.4285736)">
+ <rect
+ y="222.563"
+ x="164.8916"
+ height="39.502518"
+ width="56.64537"
+ id="rect3974"
+ style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text3976"
+ y="247.6714"
+ x="172.85715"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="247.6714"
+ x="172.85715"
+ id="tspan3978"
+ sodipodi:role="line">part</tspan></text>
+ </g>
+ </g>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="m 877.85714,607.6714 0,41.42858"
+ id="path3980" />
+ <text
+ xml:space="preserve"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="840.89563"
+ y="219.6189"
+ id="text4168"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4170"
+ x="840.89563"
+ y="219.6189">LIB</tspan></text>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.26530874px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
+ d="M 851.17116,365.3959 850.285,225.65964"
+ id="path4172" />
+</svg>
diff --git a/new/make-dir-lib-source-test-data.sh b/new/make-dir-lib-source-test-data.sh
new file mode 100755
index 0000000..84f93c2
--- /dev/null
+++ b/new/make-dir-lib-source-test-data.sh
@@ -0,0 +1,150 @@
+#!/bin/sh
+
+BASEDIR=/tmp/eeschema-lib
+
+CATEGORIES="lions tigers kitties"
+
+PARTS="eyes ears feet"
+
+REVS="rev1 rev5 rev10"
+
+
+REFERENCE="
+ (reference U?
+ (effects (at 12 13 180)(font (size 7 10))(visible yes))
+ )"
+
+LINE="
+ (line
+ (pts (xy 12 13)(xy 12 20))(stroke 1.5)
+ )"
+
+RECT="
+ (rectangle
+ (start 4 5)(end 6 8)(stroke 2.3)(fill transparent)
+ )"
+
+CIRCLE="
+ (circle
+ (center 1 0)(radius 5)(stroke 2.1)(fill none)
+ )"
+
+ARC="
+ (arc
+ (pos 22 33)(radius 12)(start 2 4)(end 13 33)(stroke 2.3)(fill filled)
+ )"
+
+BEZIER="
+ (bezier
+ (fill none)(stroke 2.0)(pts (xy 0 1)(xy 2 4))
+ )"
+
+TEXT="
+ (text (at 23 23 90.0) \"This is some text\" (justify left bottom)(visible yes)(fill filled)
+ (font arial (size 8 12))
+ )"
+
+PIN1="
+ (pin out line (at 7 8 90)
+ (signal #WE (font (size 8 10) bold)(visible no))
+ (pad A23 (font (size 9 11) italic bold))
+ )"
+
+PIN2="
+ (pin in line (at 8 8)(visible yes)
+ (signal #WAIT (visible yes))
+ (pad A24 (visible yes))
+ )"
+
+PIN3="
+ (pin (pad A25))"
+
+PINS="
+ (pin (pad Z12))(pin (pad Y14))(pin (pad Z13))(pin (pad Y15))"
+
+
+PIN_SWAP="
+ (pin_swap A23 A24)"
+
+PIN_RENUM="
+ (pin_renum A24 B24)"
+
+PIN_RENAME="
+ (pin_rename B24 LED)"
+
+PIN_DELETE="
+ (pin_del B24)"
+
+PIN_MERGE="(pin_merge A23 (pads Z12 Y14))(pin_merge A25 (pads Z13 Y15))"
+
+
+PROP1="
+ (property mWatts 12
+ (effects (at 1 34 270)(font (size 5 9) italic bold)(visible no))
+ )"
+
+KEYWORDS="
+ (keywords varistor batcave einstein)"
+
+ALTERNATES="
+ (alternates 7400/7400_b 7400/7400_c)"
+
+
+
+for C in ${CATEGORIES}; do
+
+ mkdir -p $BASEDIR/$C
+
+ for P in ${PARTS}; do
+
+ for R in ${REVS}; do
+ echo "(part $C/$P (value 22)(footprint SM0805)(model Airplane)(datasheet http://favorite.pdf)
+ $REFERENCE
+ $LINE
+ $RECT
+ $CIRCLE
+ $ARC
+ $BEZIER
+ $TEXT
+ $PIN1
+ $PIN2
+ $PIN3
+ $PINS
+ $PROP1
+ $KEYWORDS
+ $ALTERNATES
+ $PIN_SWAP
+ $PIN_RENUM
+ $PIN_RENAME
+ $PIN_DELETE
+ $PIN_MERGE
+ )" > $BASEDIR/$C/$P.part.$R
+ done
+
+ # also make the part without a rev:
+ echo "(part $C/$P (value 22)(footprint SM0805)(model Airplane)(datasheet http://favorite.pdf)
+ $REFERENCE
+ $LINE
+ $RECT
+ $CIRCLE
+ $ARC
+ $BEZIER
+ $TEXT
+ $PIN1
+ $PIN2
+ $PIN3
+ $PINS
+ $PROP1
+ $KEYWORDS
+ $ALTERNATES
+ $PIN_SWAP
+ $PIN_RENUM
+ $PIN_RENAME
+ $PIN_DELETE
+ $PIN_MERGE
+ )" > $BASEDIR/$C/$P.part
+
+ done
+
+done
+
diff --git a/new/make-html.sh b/new/make-html.sh
new file mode 100755
index 0000000..67f03c4
--- /dev/null
+++ b/new/make-html.sh
@@ -0,0 +1,3 @@
+
+# run this from the <kicad>/new directory
+doxygen
diff --git a/new/sch_canvas.cpp b/new/sch_canvas.cpp
new file mode 100644
index 0000000..776306c
--- /dev/null
+++ b/new/sch_canvas.cpp
@@ -0,0 +1,148 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+#include <sch_canvas.h>
+#include <sch_part.h>
+#include <gal/font/newstroke_font.h>
+
+
+#define SWEET_UNIT 50 ///< world units comprizing a sweet grid cell
+
+
+
+namespace SCH {
+
+
+CANVAS::CANVAS( wxWindow* aParent ) :
+ OPENGL_GAL( aParent, NULL, this ) // I am my own PaintListener
+{
+ Connect( EVT_GAL_REDRAW, wxCommandEventHandler( CANVAS::onRedraw ) );
+
+ // Set the world unit length
+ SetWorldUnitLength( 0.01 );
+
+ SetScreenDPI( 100 );
+
+ ComputeWorldScreenMatrix();
+
+ // Set the world unit length
+ // SetLookAtPoint( VECTOR2D( size.x / 2, size.y / 2 ) );
+
+ // Load Font
+ if( !m_font.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize ) )
+ {
+ printf( "Loading of the font failed.\n" );
+ }
+
+ m_font.SetGraphicsAbstractionLayer( this );
+}
+
+
+void CANVAS::onRedraw( wxCommandEvent& event )
+{
+ PaintScene();
+}
+
+
+void CANVAS::PaintScene()
+{
+ BeginDrawing();
+
+ SetBackgroundColor( COLOR4D( 0x6c/255.0, 0x53/255.0, 0x53/255.0, 1.0 ) );
+
+ ClearScreen();
+
+ SetLayerDepth( -10 );
+
+ SetGridSize( VECTOR2D( SWEET_UNIT, SWEET_UNIT ) );
+
+ DrawGrid();
+
+ PaintRectangle();
+
+ SetLayerDepth( 0 );
+
+ Flush();
+ EndDrawing();
+}
+
+
+void CANVAS::PaintRectangle()
+{
+ VECTOR2D worldSize = GetSize();
+
+#if 1
+
+ SetLineWidth( 1 );
+
+ SetIsFill( true );
+ SetIsStroke( true );
+
+ SetFillColor( COLOR4D( 1, 1, 1, 1 ) );
+
+ SetStrokeColor( COLOR4D( 0, 0, 0, 1 ) );
+
+ DrawRectangle( VECTOR2D( worldSize.x/4, worldSize.y/4 ), VECTOR2D( 3*worldSize.x/4, 3*worldSize.y/4 ) );
+
+#else
+
+ D( cout << worldSize << endl; )
+
+ int k = 0;
+ double alpha = 0;
+ for( double y = 0; y < worldSize.y - worldSize.y / 4; y += worldSize.y / 8 )
+ {
+ double index = 1;
+ double y2 = y;
+
+ for( double x = 0; x < worldSize.x - worldSize.x / 4; x += worldSize.x / 8 )
+ {
+ SetLineWidth( index + 1 );
+
+ SetIsFill( ( k == 1 ) || ( k == 2 ) );
+
+ SetIsStroke( ( k == 0 ) || ( k == 2 ) );
+
+ SetFillColor( COLOR4D( 1 - alpha, 1, 1, 1 - alpha ) );
+ SetStrokeColor( COLOR4D( alpha, alpha, 1 - alpha, alpha ) );
+
+ DrawRectangle( VECTOR2D( x, y2 ), VECTOR2D( x + index * 10, y2 + index * 10 ) );
+
+ x += index * 5;
+ y2 += index * 5;
+
+ index += 1;
+ }
+
+ k = ( k + 1 ) % 3;
+ alpha += 0.1;
+ }
+#endif
+
+}
+
+
+
+} // namespace SCH
diff --git a/new/sch_canvas.h b/new/sch_canvas.h
new file mode 100644
index 0000000..37405bd
--- /dev/null
+++ b/new/sch_canvas.h
@@ -0,0 +1,69 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SCH_CANVAS_H_
+#define SCH_CANVAS_H_
+
+#include <gal/opengl/opengl_gal.h>
+#include <gal/common/stroke_font.h>
+
+
+namespace SCH {
+
+class PART;
+
+class CANVAS : public OPENGL_GAL
+{
+
+protected:
+ PART* m_part; ///< which PART to draw
+ STROKE_FONT m_font;
+
+ void onRedraw( wxCommandEvent& event );
+
+public:
+
+ CANVAS( wxWindow* aParent );
+
+ /**
+ * Function SetPart
+ * sets the PART to draw, returns the previous PART.
+ */
+ PART* SetPart( PART* aPart )
+ {
+ PART* ret = m_part;
+ m_part = aPart;
+ return ret;
+ }
+
+ void PaintScene();
+
+ void PaintRectangle();
+};
+
+
+} // namespace SCH
+
+#endif // SCH_PART_H_
+
diff --git a/new/sch_dir_lib_source.cpp b/new/sch_dir_lib_source.cpp
new file mode 100644
index 0000000..c91e1b5
--- /dev/null
+++ b/new/sch_dir_lib_source.cpp
@@ -0,0 +1,732 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010 SoftPLC Corporation, <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+
+/* Note: this LIB_SOURCE implementation relies on the posix specified opendir() and
+ related functions rather than wx functions which might do the same thing. This
+ is because I did not want to become very dependent on wxWidgets at such a low
+ level as this, in case someday this code needs to be used on kde or whatever.
+
+ Mingw and unix, linux, & osx will all have these posix functions.
+ MS Visual Studio may need the posix compatible opendir() functions brought in
+ http://www.softagalleria.net/dirent.php
+ wx has these but they are based on wxString which can be wchar_t based and wx should
+ not be introduced at a level this low.
+
+ Part files: have the general form partname.part[.revN...]
+ Categories: are any subdirectories immediately below the sourceURI, one level only.
+ Part names: [category/]partname[/revN...]
+*/
+
+
+#include <dirent.h>
+#include <sys/stat.h>
+#include <cstring>
+#include <cstdio>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <sch_dir_lib_source.h>
+using namespace SCH;
+
+
+/**
+ * Class DIR_WRAP
+ * provides a destructor which is invoked if an exception is thrown.
+ */
+class DIR_WRAP
+{
+ DIR* dir;
+
+public:
+ DIR_WRAP( DIR* aDir ) : dir( aDir ) {}
+
+ ~DIR_WRAP()
+ {
+ if( dir )
+ closedir( dir );
+ }
+
+ DIR* operator->() { return dir; }
+ DIR* operator*() { return dir; }
+ operator bool () { return dir!=0; }
+};
+
+
+/**
+ * Class FILE_WRAP
+ * provides a destructor which is invoked if an exception is thrown.
+ */
+class FILE_WRAP
+{
+ int fh;
+
+public:
+ FILE_WRAP( int aFileHandle ) : fh( aFileHandle ) {}
+ ~FILE_WRAP()
+ {
+ if( fh != -1 )
+ close( fh );
+ }
+
+ operator int () { return fh; }
+};
+
+
+/**
+ * Function strrstr
+ * finds the last instance of needle in haystack, if any.
+ */
+static const char* strrstr( const char* haystack, const char* needle )
+{
+ const char* ret = 0;
+ const char* next = haystack;
+
+ // find last instance of haystack
+ while( (next = strstr( next, needle )) != 0 )
+ {
+ ret = next;
+ ++next; // don't keep finding the same one.
+ }
+
+ return ret;
+}
+
+#if 1 // @todo switch over to EndsWithRev() global
+
+static inline bool isDigit( char c )
+{
+ return c >= '0' && c <= '9';
+}
+
+
+/**
+ * Function endsWithRev
+ * returns a pointer to the final string segment: "revN[N..]" or NULL if none.
+ * @param start is the beginning of string segment to test, the partname or
+ * any middle portion of it.
+ * @param tail is a pointer to the terminating nul, or one past inclusive end of
+ * segment, i.e. the string segment of interest is [start,tail)
+ * @param separator is the separating byte, expected: '.' or '/', depending on context.
+ */
+static const char* endsWithRev( const char* start, const char* tail, char separator = '/' )
+{
+ bool sawDigit = false;
+
+ while( tail > start && isDigit( *--tail ) )
+ {
+ sawDigit = true;
+ }
+
+ // if sawDigit, tail points to the 'v' here.
+
+ if( sawDigit && tail-3 >= start )
+ {
+ tail -= 3;
+
+ if( tail[0]==separator && tail[1]=='r' && tail[2]=='e' && tail[3]=='v' )
+ {
+ return tail+1; // omit separator, return "revN[N..]"
+ }
+ }
+
+ return 0;
+}
+
+static inline const char* endsWithRev( const STRING& aPartName, char separator = '/' )
+{
+ return endsWithRev( aPartName.c_str(), aPartName.c_str()+aPartName.size(), separator );
+}
+
+#endif
+
+
+// see struct BY_REV
+bool BY_REV::operator() ( const STRING& s1, const STRING& s2 ) const
+{
+ // avoid instantiating new STRINGs, and thank goodness that c_str() is const.
+
+ const char* rev1 = endsWithRev( s1 );
+ const char* rev2 = endsWithRev( s2 );
+
+ int rootLen1 = rev1 ? rev1 - s1.c_str() : s1.size();
+ int rootLen2 = rev2 ? rev2 - s2.c_str() : s2.size();
+
+ int r = memcmp( s1.c_str(), s2.c_str(), min( rootLen1, rootLen2 ) );
+
+ if( r )
+ {
+ return r < 0;
+ }
+
+ if( rootLen1 != rootLen2 )
+ {
+ return rootLen1 < rootLen2;
+ }
+
+ // root strings match at this point, compare the revision number numerically,
+ // and chose the higher numbered version as "less", according to std::set lingo.
+
+ if( bool(rev1) != bool(rev2) )
+ {
+ return bool(rev1) < bool(rev2);
+ }
+
+ if( rev1 && rev2 )
+ {
+ int rnum1 = atoi( rev1+3 );
+ int rnum2 = atoi( rev2+3 );
+
+ // higher numbered revs are "less" so that they bubble to top.
+ return rnum1 > rnum2;
+ }
+
+ return false; // strings are equal, and they don't have a rev
+}
+
+
+bool DIR_LIB_SOURCE::makePartName( STRING* aPartName, const char* aEntry,
+ const STRING& aCategory )
+{
+ const char* cp = strrstr( aEntry, SWEET_EXT );
+
+ // if base name is not empty, contains SWEET_EXT, && cp is not NULL
+ if( cp > aEntry )
+ {
+ const char* limit = cp + strlen( cp );
+
+ // If versioning, then must find a trailing "revN.." type of string.
+ if( useVersioning )
+ {
+ const char* rev = endsWithRev( cp + SWEET_EXTZ, limit, '.' );
+ if( rev )
+ {
+ if( aCategory.size() )
+ *aPartName = aCategory + "/";
+ else
+ aPartName->clear();
+
+ aPartName->append( aEntry, cp - aEntry );
+ aPartName->append( "/" );
+ aPartName->append( rev );
+ return true;
+ }
+ }
+
+ // If using versioning, then all valid partnames must have a rev string,
+ // so we don't even bother to try and load any other partfile down here.
+ else
+ {
+ // if file extension is exactly SWEET_EXT, and no rev
+ if( cp==limit-5 )
+ {
+ if( aCategory.size() )
+ *aPartName = aCategory + "/";
+ else
+ aPartName->clear();
+
+ aPartName->append( aEntry, cp - aEntry );
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+STRING DIR_LIB_SOURCE::makeFileName( const STRING& aPartName )
+{
+ // create a fileName for the sweet string, using a reversible
+ // partname <-> fileName conversion protocol:
+
+ STRING fileName = sourceURI + "/";
+
+ const char* rev = endsWithRev( aPartName );
+
+ if( rev )
+ {
+ int basePartLen = rev - aPartName.c_str() - 1; // omit '/' separator
+ fileName.append( aPartName, 0, basePartLen );
+ fileName += SWEET_EXT;
+ fileName += '.';
+ fileName += rev;
+ }
+ else
+ {
+ fileName += aPartName;
+ fileName += SWEET_EXT;
+ }
+
+ return fileName;
+}
+
+
+void DIR_LIB_SOURCE::readString( STRING* aResult, const STRING& aFileName ) throw( IO_ERROR )
+{
+ FILE_WRAP fw = open( aFileName.c_str(), O_RDONLY );
+
+ if( fw == -1 )
+ {
+ STRING msg = strerror( errno );
+ msg += "; cannot open(O_RDONLY) file " + aFileName;
+ THROW_IO_ERROR( msg );
+ }
+
+ struct stat fs;
+
+ fstat( fw, &fs );
+
+ // sanity check on file size
+ if( fs.st_size > (1*1024*1024) )
+ {
+ STRING msg = aFileName;
+ msg += " seems too big. ( > 1 mbyte )";
+ THROW_IO_ERROR( msg );
+ }
+
+#if 0
+ // I read somewhere on the Internet that std::string chars are not guaranteed
+ // (over time) to be contiguous in future implementations of C++, so this
+ // strategy is here for that eventuality. We buffer through readBuffer here.
+
+ // reuse same readBuffer, which is not thread safe, but the API
+ // is not advertising thread safe (yet, if ever).
+ if( (int) fs.st_size > (int) readBuffer.size() )
+ readBuffer.resize( fs.st_size + 1000 );
+
+ int count = read( fw, &readBuffer[0], fs.st_size );
+ if( count != (int) fs.st_size )
+ {
+ STRING msg = strerror( errno );
+ msg += "; cannot read file " + aFileName;
+ THROW_IO_ERROR( msg );
+ }
+
+ aResult->assign( &readBuffer[0], count );
+#else
+
+ // read into the string directly
+ aResult->resize( fs.st_size );
+
+ int count = read( fw, &(*aResult)[0], fs.st_size );
+ if( count != (int) fs.st_size )
+ {
+ STRING msg = strerror( errno );
+ msg += "; cannot read file " + aFileName;
+ THROW_IO_ERROR( msg );
+ }
+
+ // test trailing nul is there, which should have been put there with resize() above
+ // printf( "'%s'\n", aResult->c_str() ); // checked OK.
+#endif
+
+}
+
+
+void DIR_LIB_SOURCE::cache() throw( IO_ERROR )
+{
+ partnames.clear();
+ categories.clear();
+
+ cacheOneDir( "" );
+}
+
+
+DIR_LIB_SOURCE::DIR_LIB_SOURCE( const STRING& aDirectoryPath,
+ const STRING& aOptions ) throw( IO_ERROR ) :
+ useVersioning( strstr( aOptions.c_str(), "useVersioning" ) )
+{
+ sourceURI = aDirectoryPath;
+ sourceType = "dir";
+
+ if( sourceURI.size() == 0 )
+ {
+ THROW_IO_ERROR( STRING("aDirectoryPath cannot be empty") );
+ }
+
+ // remove any trailing separator, so we can add it back later without ambiguity
+ if( strchr( "/\\", sourceURI[sourceURI.size()-1] ) )
+ sourceURI.erase( sourceURI.size()-1 );
+
+ cache();
+}
+
+
+DIR_LIB_SOURCE::~DIR_LIB_SOURCE()
+{
+}
+
+
+void DIR_LIB_SOURCE::GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory )
+ throw( IO_ERROR )
+{
+ PN_ITER end = aCategory.size() ?
+ partnames.lower_bound( aCategory + char( '/' + 1 ) ) :
+ partnames.end();
+
+ PN_ITER it = aCategory.size() ?
+ partnames.upper_bound( aCategory + "/" ) :
+ partnames.begin();
+
+ aResults->clear();
+
+ if( useVersioning )
+ {
+ STRING partName;
+
+ while( it != end )
+ {
+ const char* rev = endsWithRev( *it );
+
+ // all cached partnames have a rev string in useVersioning mode
+ assert( rev );
+
+ // partName is substring which omits the rev AND the rev separator
+ partName.assign( *it, 0, rev - it->c_str() - 1 );
+
+ aResults->push_back( partName );
+
+ // skip over all other versions of the same partName.
+ it = partnames.lower_bound( partName + char( '/' + 1 ) );
+ }
+
+ }
+
+ else
+ {
+ while( it != end )
+ aResults->push_back( *it++ );
+ }
+}
+
+
+void DIR_LIB_SOURCE::GetRevisions( STRINGS* aResults, const STRING& aPartName )
+ throw( IO_ERROR )
+{
+ aResults->clear();
+
+ if( useVersioning )
+ {
+ STRING partName;
+
+ const char* rev = endsWithRev( aPartName );
+ if( rev )
+ // partName is substring which omits the rev and the separator
+ partName.assign( aPartName, 0, rev - aPartName.c_str() - 1 );
+ else
+ partName = aPartName;
+
+ PN_ITER it = partnames.upper_bound( partName +'/' );
+ PN_ITER end = partnames.lower_bound( partName + char( '/' +1 ) );
+
+ for( ; it != end; ++it )
+ {
+ const char* rev = endsWithRev( *it );
+ assert( rev );
+ aResults->push_back( it->substr( rev - it->c_str() ) );
+ }
+ }
+
+ else
+ {
+ // In non-version mode, there were no revisions read in, only part
+ // files without a revision. But clients higher up expect to see
+ // at least one revision in order for the API to work, so we return
+ // a revision ""
+ aResults->push_back( "" );
+ }
+}
+
+
+void DIR_LIB_SOURCE::ReadPart( STRING* aResult, const STRING& aPartName, const STRING& aRev )
+ throw( IO_ERROR )
+{
+ STRING partName = aPartName;
+ const char* hasRev = endsWithRev( partName );
+
+ if( useVersioning )
+ {
+ if( aRev.size() )
+ {
+ // a supplied rev replaces any in aPartName
+ if( hasRev )
+ partName.resize( hasRev - partName.c_str() - 1 );
+
+ partName += '/';
+ partName + aRev;
+
+ // find this exact revision
+
+ PN_ITER it = partnames.find( partName );
+
+ if( it == partnames.end() ) // part not found
+ {
+ partName += " not found.";
+ THROW_IO_ERROR( partName );
+ }
+
+ readString( aResult, makeFileName( partName ) );
+ }
+
+ else
+ {
+ // There's no rev on partName string. Find the most recent rev, i.e. highest,
+ // which will be first because of the BY_REV compare method, which treats
+ // higher numbered revs as first.
+
+ STRING search = partName + '/';
+
+ // There's no rev on partName string. Find the most recent rev, i.e. highest,
+ // which will be first because of the BY_REV compare method, which treats
+ // higher numbered revs as first.
+ PN_ITER it = partnames.upper_bound( search );
+
+ // verify that this one that is greater than partName is a match and not
+ // some unrelated name that is larger.
+ if( it == partnames.end() ||
+ it->compare( 0, search.size(), search ) != 0 )
+ {
+ partName += " is not present without a revision.";
+ THROW_IO_ERROR( partName );
+ }
+
+ readString( aResult, makeFileName( *it ) );
+ }
+ }
+
+ else // !useVersioning
+ {
+#if 1
+ if( hasRev || aRev.size() )
+ {
+ STRING msg = "this type 'dir' LIB_SOURCE not using 'useVersioning' option, cannot ask for a revision";
+ THROW_IO_ERROR( msg );
+ }
+#else
+ // no revisions allowed, strip it
+ if( hasRev )
+ partName.resize( hasRev - partName.c_str() - 1 );
+#endif
+
+ // find the part name without any revision
+
+ PN_ITER it = partnames.find( partName );
+
+ if( it == partnames.end() ) // part not found
+ {
+ partName += " not found.";
+ THROW_IO_ERROR( partName );
+ }
+
+ readString( aResult, makeFileName( partName ) );
+ }
+}
+
+
+void DIR_LIB_SOURCE::ReadParts( STRINGS* aResults, const STRINGS& aPartNames )
+ throw( IO_ERROR )
+{
+ aResults->clear();
+
+ for( STRINGS::const_iterator n = aPartNames.begin(); n!=aPartNames.end(); ++n )
+ {
+ aResults->push_back( STRING() );
+ ReadPart( &aResults->back(), *n );
+ }
+}
+
+
+void DIR_LIB_SOURCE::GetCategories( STRINGS* aResults ) throw( IO_ERROR )
+{
+ aResults->clear();
+
+ // caller fetches them sorted.
+ for( NAME_CACHE::const_iterator it = categories.begin(); it!=categories.end(); ++it )
+ {
+ aResults->push_back( *it );
+ }
+}
+
+
+#if defined(DEBUG)
+
+void DIR_LIB_SOURCE::Show()
+{
+ printf( "Show categories:\n" );
+ for( NAME_CACHE::const_iterator it = categories.begin(); it!=categories.end(); ++it )
+ printf( " '%s'\n", it->c_str() );
+
+ printf( "\n" );
+ printf( "Show parts:\n" );
+ for( PART_CACHE::const_iterator it = partnames.begin(); it != partnames.end(); ++it )
+ {
+ printf( " '%s'\n", it->c_str() );
+ }
+}
+
+#endif
+
+
+void DIR_LIB_SOURCE::cacheOneDir( const STRING& aCategory ) throw( IO_ERROR )
+{
+ STRING curDir = sourceURI;
+
+ if( aCategory.size() )
+ curDir += "/" + aCategory;
+
+ DIR_WRAP dir = opendir( curDir.c_str() );
+
+ if( !dir )
+ {
+ STRING msg = strerror( errno );
+ msg += "; scanning directory " + curDir;
+ THROW_IO_ERROR( msg );
+ }
+
+ struct stat fs;
+ STRING partName;
+ STRING fileName;
+ dirent* entry;
+
+ while( (entry = readdir( *dir )) != NULL )
+ {
+ if( !strcmp( ".", entry->d_name ) || !strcmp( "..", entry->d_name ) )
+ continue;
+
+ fileName = curDir + "/" + entry->d_name;
+
+ if( !stat( fileName.c_str(), &fs ) )
+ {
+ // is this a valid part name?
+ if( S_ISREG( fs.st_mode ) && makePartName( &partName, entry->d_name, aCategory ) )
+ {
+ std::pair<NAME_CACHE::iterator, bool> pair = partnames.insert( partName );
+
+ if( !pair.second )
+ {
+ STRING msg = partName;
+ msg += " has already been encountered";
+ THROW_IO_ERROR( msg );
+ }
+ }
+
+ // is this an acceptable category name?
+ else if( S_ISDIR( fs.st_mode ) && !aCategory.size() && isCategoryName( entry->d_name ) )
+ {
+ // only one level of recursion is used, controlled by the
+ // emptiness of aCategory.
+ categories.insert( entry->d_name );
+
+ // somebody needs to test Windows (mingw), make sure it can
+ // handle opendir() recursively
+ cacheOneDir( entry->d_name );
+ }
+ else
+ {
+ //D( printf( "ignoring %s\n", entry->d_name );)
+ }
+ }
+ }
+}
+
+
+#if 0 && defined(DEBUG)
+
+void DIR_LIB_SOURCE::Test( int argc, char** argv )
+{
+ STRINGS partnames;
+ STRINGS sweets;
+
+ try
+ {
+ STRINGS::const_iterator pn;
+
+// DIR_LIB_SOURCE uut( argv[1] ? argv[1] : "", "" );
+ DIR_LIB_SOURCE uut( argv[1] ? argv[1] : "", "useVersioning" );
+
+ // show the cached content, only the directory information is cached,
+ // parts are cached in class LIB, not down here.
+ uut.Show();
+
+ uut.GetCategoricalPartNames( &partnames, "lions" );
+
+ printf( "\nGetCategoricalPartNames( aCatagory = 'lions' ):\n" );
+ for( STRINGS::const_iterator it = partnames.begin(); it!=partnames.end(); ++it )
+ {
+ printf( " '%s'\n", it->c_str() );
+ }
+
+ uut.ReadParts( &sweets, partnames );
+
+ printf( "\nSweets for Category = 'lions' parts:\n" );
+ pn = partnames.begin();
+ for( STRINGS::const_iterator it = sweets.begin(); it!=sweets.end(); ++it, ++pn )
+ {
+ printf( " %s: %s", pn->c_str(), it->c_str() );
+ }
+
+ // fetch the part names for ALL categories.
+ uut.GetCategoricalPartNames( &partnames );
+
+ printf( "\nGetCategoricalPartNames( aCategory = '' i.e. ALL):\n" );
+ for( STRINGS::const_iterator it = partnames.begin(); it!=partnames.end(); ++it )
+ {
+ printf( " '%s'\n", it->c_str() );
+ }
+
+ uut.ReadParts( &sweets, partnames );
+
+ printf( "\nSweets for ALL parts:\n" );
+ pn = partnames.begin();
+ for( STRINGS::const_iterator it = sweets.begin(); it!=sweets.end(); ++it, ++pn )
+ {
+ printf( " %s: %s", pn->c_str(), it->c_str() );
+ }
+ }
+
+ catch( std::exception& ex )
+ {
+ printf( "std::exception\n" );
+ }
+
+ catch( const IO_ERROR& ioe )
+ {
+ printf( "exception: %s\n", (const char*) ioe.errorText.ToUTF8() ) );
+ }
+}
+
+
+int main( int argc, char** argv )
+{
+ DIR_LIB_SOURCE::Test( argc, argv );
+ return 0;
+}
+
+#endif
diff --git a/new/sch_dir_lib_source.h b/new/sch_dir_lib_source.h
new file mode 100644
index 0000000..9d39352
--- /dev/null
+++ b/new/sch_dir_lib_source.h
@@ -0,0 +1,202 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef DIR_LIB_SOURCE_H_
+#define DIR_LIB_SOURCE_H_
+
+
+#include <set>
+#include <vector>
+
+#include <sch_lib.h>
+
+
+/// This file extension is an implementation detail specific to this LIB_SOURCE
+/// and to a corresponding LIB_SINK.
+/// Core EESCHEMA should never have to see this.
+#define SWEET_EXT ".part"
+#define SWEET_EXTZ (sizeof(SWEET_EXT)-1)
+
+
+/**
+ * struct BY_REV
+ * is here to provide a custom way to compare STRINGs. Namely, the revN[N..]
+ * string if present, is collated according to a 'higher revision first', but
+ * any part string without a revision, is even 'before' that.
+ */
+struct BY_REV
+{
+ bool operator() ( const STRING& s1, const STRING& s2 ) const;
+};
+
+
+/**
+ * Type PART_CACHE
+ * holds a set of part names in sorted order, according to the sort
+ * order given by struct BY_REV.
+ */
+typedef std::set< STRING, BY_REV > PART_CACHE;
+
+
+/**
+ * Type NAME_CACHE
+ * holds a set of categories in sorted order.
+ */
+typedef std::set< STRING > NAME_CACHE;
+
+
+namespace SCH {
+
+/**
+ * Class DIR_LIB_SOURCE
+ * implements a LIB_SOURCE in a file system directory.
+ *
+ * @author Dick Hollenbeck
+ */
+class DIR_LIB_SOURCE : public LIB_SOURCE
+{
+ friend class LIB_TABLE; ///< constructor is protected, LIB_TABLE can construct
+
+ bool useVersioning; ///< use files with extension ".revNNN..", else not
+
+ /// normal partnames, some of which may be prefixed with a category,
+ /// and some of which may have legal "revN[N..]" type strings.
+ PART_CACHE partnames;
+
+ typedef PART_CACHE::const_iterator PN_ITER;
+
+ /// categories which we expect to find in the set of @a partnames
+ NAME_CACHE categories;
+
+ std::vector<char> readBuffer; ///< used by readString()
+
+ /**
+ * Function cache
+ * [re-]loads the directory cache(s).
+ */
+ void cache() throw( IO_ERROR );
+
+ /**
+ * Function isCategoryName
+ * returns true iff aName is a valid category name.
+ */
+ bool isCategoryName( const char* aName )
+ {
+ return true;
+ }
+
+ /**
+ * Function makePartName
+ * returns true iff aEntry holds a valid part filename, in the form of
+ * "someroot.part[.revNNNN]" where NNN are number characters [0-9]
+ * @param aEntry is the raw directory entry without path information.
+ * @param aCategory is the last portion of the directory path.
+ * @param aPartName is where to put a part name, assuming @a aEntry is legal.
+ * @return bool - true only if aEntry is a legal part file name.
+ */
+ bool makePartName( STRING* aPartName, const char* aEntry, const STRING& aCategory );
+
+ /**
+ * Function readString
+ * reads a Sweet string into aResult. Candidate for virtual function later.
+ */
+ void readString( STRING* aResult, const STRING& aFileName ) throw( IO_ERROR );
+
+ /**
+ * Function cacheOneDir
+ * loads part names [and categories] from a directory given by
+ * "sourceURI + '/' + category"
+ * Categories are only loaded if processing the top most directory because
+ * only one level of categories is supported. We know we are in the
+ * top most directory if aCategory is empty.
+ */
+ void cacheOneDir( const STRING& aCategory ) throw( IO_ERROR );
+
+ /**
+ * Function makeFileName
+ * converts a part name into a filename and returns it.
+ */
+ STRING makeFileName( const STRING& aPartName );
+
+protected:
+
+ /**
+ * Constructor DIR_LIB_SOURCE( const STRING& aDirectoryPath )
+ * sets up a LIB_SOURCE using aDirectoryPath in a file system.
+ * @see LIB_TABLE::LookupPart().
+ *
+ * @param aDirectoryPath is a full file pathname of a directory which contains
+ * the library source of part files. Examples might be "C:\kicad_data\mylib" or
+ * "/home/designer/mylibdir". This is not a URI, but an OS specific path that
+ * can be given to opendir().
+ *
+ * @param aOptions is the options string from the library table, currently
+ * the only supported option, that this LIB_SOURCE knows about is
+ * "useVersioning". If present means support versioning in the directory
+ * tree, otherwise only a single version of each part is recognized, namely the
+ * one without the ".revN[N..]" trailer.
+ */
+ DIR_LIB_SOURCE( const STRING& aDirectoryPath, const STRING& aOptions = "" ) throw( IO_ERROR );
+
+ ~DIR_LIB_SOURCE();
+
+ //-----<LIB_SOURCE implementation functions >------------------------------
+
+ void ReadPart( STRING* aResult, const STRING& aPartName, const STRING& aRev = "" )
+ throw( IO_ERROR );
+
+ void ReadParts( STRINGS* aResults, const STRINGS& aPartNames )
+ throw( IO_ERROR );
+
+ void GetCategories( STRINGS* aResults ) throw( IO_ERROR );
+
+ void GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory = "" )
+ throw( IO_ERROR );
+
+ void GetRevisions( STRINGS* aResults, const STRING& aPartName )
+ throw( IO_ERROR );
+
+ void FindParts( STRINGS* aResults, const STRING& aQuery ) throw( IO_ERROR )
+ {
+ // @todo
+ }
+
+ //-----</LIB_SOURCE implementation functions >------------------------------
+
+#if defined(DEBUG)
+ /**
+ * Function Show
+ * will output a debug dump of contents.
+ */
+ void Show();
+
+public:
+ static void Test( int argc, char** argv );
+
+#endif
+};
+
+} // namespace SCH
+
+#endif // DIR_LIB_SOURCE_H_
diff --git a/new/sch_lib.cpp b/new/sch_lib.cpp
new file mode 100644
index 0000000..a5464fa
--- /dev/null
+++ b/new/sch_lib.cpp
@@ -0,0 +1,278 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <memory> // std::auto_ptr
+#include <wx/string.h>
+
+
+#include <sch_lib.h>
+#include <sch_lpid.h>
+#include <sch_part.h>
+#include <sch_sweet_parser.h>
+#include <sch_lib_table.h>
+
+
+#if 1
+
+#include <map>
+
+/*
+
+The LIB part cache consists of a std::map of partnames without revisions at the
+top level. Each top level map entry can point to another std::map which it owns
+and which holds all the revisions for that part name. At any point in the tree,
+there can be NULL pointers which allow for lazy loading, including the very top
+most root pointer itself, which is PARTS* parts. We use the key to hold the
+partName at one level, and revision at the deeper nested level.
+
+1) Only things which are asked for are done.
+2) Anything we learn we remember.
+
+*/
+
+namespace SCH {
+
+
+/**
+ * Struct LTREV
+ * is for PART_REVS, and provides a custom way to compare rev STRINGs.
+ * Namely, the revN[N..] string if present, is collated according to a
+ * 'higher revision first'.
+ */
+struct LTREV
+{
+ bool operator() ( const STRING& s1, const STRING& s2 ) const
+ {
+ return RevCmp( s1.c_str(), s2.c_str() ) < 0;
+ }
+};
+
+
+/**
+ * Class PART_REVS
+ * contains the collection of revisions for a particular part name, in the
+ * form of cached PARTs. The tuple consists of a rev string and a PART pointer.
+ * The rev string is like "rev1", the PART pointer will be NULL until the PART
+ * gets loaded, lazily.
+ */
+class PART_REVS : public std::map< STRING, PART*, LTREV >
+{
+public:
+ ~PART_REVS()
+ {
+ for( iterator it = begin(); it != end(); ++it )
+ {
+ delete it->second; // second may be NULL, no problem
+ }
+ }
+};
+
+
+/**
+ * Class PARTS
+ * contains the collection of PART_REVS for all PARTs in the lib.
+ * The tuple consists of a part name and a PART_REVS pointer.
+ * The part name does not have the revision attached (of course this is understood
+ * by definition of "part name"). The PART_REVS pointer will be NULL until a client
+ * askes about the revisions for a part name, so the loading is done lazily.
+ */
+class PARTS : public std::map< STRING, PART_REVS* >
+{
+public:
+ ~PARTS()
+ {
+ for( iterator it = begin(); it != end(); ++it )
+ {
+ delete it->second; // second may be NULL, no problem
+ }
+ }
+};
+
+} // namespace SCH
+
+
+#else // was nothing but grief:
+
+#include <boost/ptr_container/ptr_map.hpp>
+
+namespace SCH {
+
+/// PARTS' key is revision, like "rev12", PART pointer may be null until loaded.
+typedef boost::ptr_map< STRING, boost::nullable<PART> > PARTS;
+typedef PARTS::iterator PARTS_ITER;
+typedef PARTS::const_iterator PARTS_CITER;
+
+
+/// PART_REVS' key is part name, w/o rev, PART pointer may be null until loaded.
+typedef boost::ptr_map< STRING, boost::nullable<PARTS> > PART_REVS;
+typedef PART_REVS::iterator PART_REVS_ITER;
+typedef PART_REVS::const_iterator PART_REVS_CITER;
+
+} // namespace SCH
+
+#endif
+
+
+using namespace SCH;
+
+
+LIB::LIB( const STRING& aLogicalLibrary, LIB_SOURCE* aSource, LIB_SINK* aSink ) :
+ logicalName( aLogicalLibrary ),
+ source( aSource ),
+ sink( aSink ),
+ cachedCategories( false ),
+ parts( 0 )
+{
+}
+
+
+LIB::~LIB()
+{
+ delete source;
+ delete sink;
+ delete parts;
+}
+
+
+const PART* LIB::lookupPart( const LPID& aLPID ) throw( IO_ERROR )
+{
+ if( !parts )
+ {
+ parts = new PARTS;
+
+ source->GetCategoricalPartNames( &vfetch );
+
+ // insert a PART_REVS for each part name
+ for( STRINGS::const_iterator it = vfetch.begin(); it!=vfetch.end(); ++it )
+ {
+ D(printf("lookupPart:%s\n", it->c_str() );)
+ (*parts)[*it] = new PART_REVS;
+ }
+ }
+
+ // load all the revisions for this part name, only if it has any
+ PARTS::iterator pi = parts->find( aLPID.GetPartName() );
+
+ PART_REVS* revs = pi != parts->end() ? pi->second : NULL;
+
+ // D(printf("revs:%p partName:%s\n", revs, aLPID.GetPartName().c_str() );)
+
+ // if the key for parts has no aLPID.GetPartName() the part is not in this lib
+ if( revs )
+ {
+ if( revs->size() == 0 ) // assume rev list has not been loaded yet
+ {
+ // load all the revisions for this part.
+ source->GetRevisions( &vfetch, aLPID.GetPartName() );
+
+ // create a PART_REV entry for each revision, but leave the PART* NULL
+ for( STRINGS::const_iterator it = vfetch.begin(); it!=vfetch.end(); ++it )
+ {
+ D(printf("lookupPartRev:%s\n", it->c_str() );)
+ (*revs)[*it] = 0;
+ }
+ }
+
+ PART_REVS::iterator rev;
+
+ // If caller did not say what revision, find the highest numbered one and return that.
+ if( !aLPID.GetRevision().size() && revs->size() )
+ {
+ rev = revs->begin(); // sort order has highest rev first
+
+ if( !rev->second ) // the PART has never been instantiated before
+ {
+ rev->second = new PART( this, LPID::Format( "", aLPID.GetPartName(), rev->first ) );
+ }
+
+ D(printf("lookupPartLatestRev:%s\n", rev->second->partNameAndRev.c_str() );)
+ return rev->second;
+ }
+ else
+ {
+ rev = revs->find( aLPID.GetRevision() );
+
+ if( rev != revs->end() )
+ {
+ if( !rev->second ) // the PART has never been instantiated before
+ {
+ rev->second = new PART( this, aLPID.GetPartNameAndRev() );
+ }
+ return rev->second;
+ }
+ }
+ }
+
+ return 0; // no such part name in this lib
+}
+
+
+PART* LIB::LookupPart( const LPID& aLPID, LIB_TABLE* aLibTable ) throw( IO_ERROR )
+{
+ PART* part = (PART*) lookupPart( aLPID );
+
+ if( !part ) // part does not exist in this lib
+ {
+ wxString msg = wxString::Format( _("part '%s' not found in lib %s" ),
+ wxString::FromUTF8( aLPID.GetPartNameAndRev().c_str() ).GetData(),
+ wxString::FromUTF8( logicalName.c_str() ).GetData() );
+ THROW_IO_ERROR( msg );
+ }
+
+ if( part->body.empty() )
+ {
+ // load body
+ source->ReadPart( &part->body, aLPID.GetPartName(), aLPID.GetRevision() );
+
+#if 0 && defined(DEBUG)
+ const STRING& body = part->body;
+ printf( "body: %s", body.c_str() );
+ if( !body.size() || body[body.size()-1] != '\n' )
+ printf( "\n" );
+#endif
+
+ // @todo consider changing ReadPart to return a "source"
+ SWEET_PARSER sp( part->body, wxString::FromUTF8( aLPID.Format().c_str() ) );
+
+ part->Parse( &sp, aLibTable );
+ }
+
+ return part;
+}
+
+
+#if 0 && defined(DEBUG)
+
+void LIB::Test( int argc, char** argv ) throw( IO_ERROR );
+{
+}
+
+int main( int argc, char** argv )
+{
+ LIB::Test( argc, argv );
+
+ return 0;
+}
+
+#endif
diff --git a/new/sch_lib.h b/new/sch_lib.h
new file mode 100644
index 0000000..9a383c3
--- /dev/null
+++ b/new/sch_lib.h
@@ -0,0 +1,365 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SCH_LIB_H_
+#define SCH_LIB_H_
+
+#include <utf8.h>
+#include <richio.h>
+#include <import_export.h>
+
+
+namespace SCH {
+
+class LPID;
+class PART;
+class LIB_TABLE;
+
+/**
+ * Class LIB_SOURCE
+ * is an abstract class from which implementation specific LIB_SOURCEs
+ * may be derived, one for each kind of library type allowed in the library table.
+ * The class name stems from the fact that this interface only provides READ ONLY
+ * functions.
+ *
+ * @author Dick Hollenbeck
+ */
+class LIB_SOURCE
+{
+ friend class LIB; ///< the LIB uses these functions.
+
+protected: ///< derived classes must implement
+
+ /**
+ * Function GetSourceType
+ * returns the library table entry's type for this library source.
+ */
+ const STRING& GetSourceType() { return sourceType; }
+
+ /**
+ * Function GetSourceURI
+ * returns absolute location of the library source.
+ */
+ const STRING& GetSourceURI() { return sourceURI; }
+
+ //-----<abstract for implementors>---------------------------------------
+
+ /**
+ * Function ReadPart
+ * fetches @a aPartName's s-expression into @a aResult after clear()ing aResult.
+ */
+ virtual void ReadPart( STR_UTF* aResult, const STRING& aPartName, const STRING& aRev = "" )
+ throw( IO_ERROR ) = 0;
+
+ /**
+ * Function ReadParts
+ * fetches the s-expressions for each part given in @a aPartNames, into @a aResults,
+ * honoring the array indices respectfully.
+ * @param aPartNames is a list of part names, one name per list element. If a part name
+ * does not have a version string, then the most recent version is fetched.
+ * @param aResults receives the s-expressions
+ */
+ virtual void ReadParts( STR_UTFS* aResults, const STRINGS& aPartNames )
+ throw( IO_ERROR ) = 0;
+
+ /**
+ * Function GetCategories
+ * fetches all categories present in the library source into @a aResults
+ */
+ virtual void GetCategories( STRINGS* aResults )
+ throw( IO_ERROR ) = 0;
+
+ /**
+ * Function GetCategoricalPartNames
+ * fetches all the part names for @a aCategory, which was returned by GetCategories().
+ *
+ * @param aCategory is a subdividing navigator within the library source,
+ * but may default to empty which will be taken to mean all categories.
+ *
+ * @param aResults is a place to put the fetched result, one category per STRING.
+ */
+ virtual void GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory="" )
+ throw( IO_ERROR ) = 0;
+
+ /**
+ * Function GetRevisions
+ * fetches all revisions for @a aPartName into @a aResults. Revisions are strings
+ * like "rev12", "rev279", and are library source agnostic. These do not have to be
+ * in a contiguous order, but the first 3 characters must be "rev" and subsequent
+ * characters must consist of at least one decimal digit. If the LIB_SOURCE
+ * does not support revisions, it is allowed to return a single "" string as
+ * the only result. This means aPartName is present in the libsource, only once
+ * without a revision. This is a special case.
+ */
+ virtual void GetRevisions( STRINGS* aResults, const STRING& aPartName )
+ throw( IO_ERROR ) = 0;
+
+ /**
+ * Function FindParts
+ * fetches part names for all parts matching the criteria given in @a
+ * aQuery, into @a aResults. The query string is designed to be easily marshalled,
+ * i.e. serialized, so that long distance queries can be made with minimal overhead.
+ * The library source needs to have an intelligent friend on the other end if
+ * the actual library data is remotely located, otherwise it will be too slow
+ * to honor this portion of the API contract.
+ *
+ * @param aQuery is a string holding a domain specific query language expression.
+ * One candidate here is an s-expression that uses (and ..) and (or ..) operators
+ * and uses them as RPN. For example "(and (footprint 0805)(value 33ohm)(category passives))".
+ * The UI can shield the user from this if it wants.
+ *
+ * @param aResults is a place to put the fetched part names, one part per STRING.
+ */
+ virtual void FindParts( STRINGS* aResults, const STRING& aQuery )
+ throw( IO_ERROR ) = 0;
+
+ //-----</abstract for implementors>--------------------------------------
+
+
+protected:
+ STRING sourceType;
+ STRING sourceURI;
+};
+
+
+/**
+ * Class LIB_SINK
+ * is an abstract class from which implementation specific LIB_SINKs
+ * may be derived, one for each kind of library type in the library table that
+ * supports writing. The class name stems from the fact that this interface
+ * only provides WRITE functions.
+ *
+ * @author Dick Hollenbeck
+ */
+class LIB_SINK
+{
+ friend class LIB; ///< only the LIB uses these functions.
+
+protected: ///< derived classes must implement
+
+ /**
+ * Function GetSinkType
+ * returns the library table entry's type for this library sink.
+ */
+ const STRING& GetSinkType() { return sinkType; }
+
+ /**
+ * Function GetSinkURI
+ * returns absolute location of the library sink.
+ */
+ const STRING& GetSinkURI() { return sinkURI; }
+
+ /**
+ * Function WritePart
+ * saves the part to non-volatile storage. @a aPartName may have the revision
+ * portion present. If it is not present, and a overwrite of an existhing
+ * part is done, then LIB::ReloadPart() must be called on this same part
+ * and all parts that inherit it must be reparsed.
+ * @return STRING - if the LIB_SINK support revision numbering, then return a
+ * revision name that was next in the sequence, e.g. "rev22", else "".
+ */
+ virtual STRING WritePart( const STRING& aPartName, const STRING& aSExpression )
+ throw( IO_ERROR ) = 0;
+
+protected:
+ STRING sinkType;
+ STRING sinkURI;
+};
+
+
+class PARTS;
+
+
+/**
+ * Class LIB
+ * is a cache of parts, and because the LIB_SOURCE is abstracted, there
+ * should be no need to extend from this class in any case except for the
+ * PARTS_LIST.
+ *
+ * @author Dick Hollenbeck
+ */
+class MY_API LIB
+{
+ friend class LIB_TABLE; ///< protected constructor, LIB_TABLE may construct
+
+protected: // constructor is not public, called from LIB_TABLE only.
+
+ /**
+ * Constructor LIB
+ * is not public and is only called from class LIB_TABLE
+ *
+ * @param aLogicalLibrary is the name of a well known logical library, and is
+ * known because it already exists in the library table.
+ *
+ * @param aSource is an open LIB_SOURCE whose ownership is
+ * given over to this LIB.
+ *
+ * @param aSink is an open LIB_SINK whose ownership is given over
+ * to this LIB, and it is normally NULL.
+ */
+ LIB( const STRING& aLogicalLibrary, LIB_SOURCE* aSource, LIB_SINK* aSink = NULL );
+
+public:
+
+ ~LIB();
+
+ /**
+ * Function HasSink
+ * returns true if this library has write/save capability. Most LIBs
+ * are read only.
+ */
+ bool HasSink() { return sink != NULL; }
+
+ /**
+ * Function LogicalName
+ * returns the logical name of this LIB.
+ */
+ STRING LogicalName();
+
+ //-----<use delegates: source and sink>---------------------------------
+
+ /**
+ * Function LookupPart
+ * returns a PART given @a aPartName, such as "passives/R". No ownership
+ * is given to the PART, it stays in the cache that is this LIB.
+ *
+ * @param aLPID is the part to lookup. The logicalLibName can be empty in it
+ * since yes, we know which LIB is in play.
+ *
+ * @param aLibTable is the LIB_TABLE view that is in effect for inheritance,
+ * and comes from the big containing SCHEMATIC object.
+ *
+ * @return PART* - The desired PART and will never be NULL. No ownership is
+ * given to caller. PARTs always reside in the cache that is a LIB.
+ *
+ * @throw IO_ERROR if the part cannot be found or loaded.
+ */
+ PART* LookupPart( const LPID& aLPID, LIB_TABLE* aLibTable )
+ throw( IO_ERROR );
+
+ /**
+ * Function ReloadPart
+ * will reload the part assuming the library source has a changed content
+ * for it.
+ */
+ void ReloadPart( PART* aPart ) throw( IO_ERROR );
+
+ /**
+ * Function GetCategories
+ * returns all categories of parts within this LIB into @a aResults.
+ */
+ STRINGS GetCategories() throw( IO_ERROR );
+
+ /**
+ * Function GetCategoricalPartNames
+ * returns the part names for @a aCategory, and at the same time
+ * creates cache entries for the very same parts if they do not already exist
+ * in this LIB (i.e. cache).
+ */
+ STRINGS GetCategoricalPartNames( const STRING& aCategory = "" ) throw( IO_ERROR );
+
+
+ //-----<.use delegates: source and sink>--------------------------------
+
+ /**
+ * Function WritePart
+ * saves the part to non-volatile storage and returns the next new revision
+ * name in the sequence established by the LIB_SINK.
+ */
+ STRING WritePart( PART* aPart ) throw( IO_ERROR );
+
+ void SetPartBody( PART* aPart, const STRING& aSExpression ) throw( IO_ERROR );
+
+ /**
+ * Function GetRevisions
+ * returns the revisions of @a aPartName that are present in this LIB.
+ * The returned STRINGS will look like "rev1", "rev2", etc.
+ */
+ STRINGS GetRevisions( const STRING& aPartName ) throw( IO_ERROR );
+
+ /**
+ * Function FindParts
+ * returns part names for all parts matching the criteria given in @a
+ * aQuery, into @a aResults. The query string is designed to be easily marshalled,
+ * i.e. serialized, so that long distance queries can be made with minimal overhead.
+ * The library source needs to have an intelligent friend on the other end if
+ * the actual library data is remotely located, otherwise it will be too slow
+ * to honor this portion of the API contract.
+ *
+ * @param aQuery is a string holding a domain specific language expression. One candidate
+ * here is an RPN s-expression that uses (and ..) and (or ..) operators. For example
+ * "(and (footprint 0805)(value 33ohm)(category passives))"
+ */
+ STRINGS FindParts( const STRING& aQuery ) throw( IO_ERROR )
+ {
+ // run the query on the cached data first for any PARTS which are fully
+ // parsed (i.e. cached), then on the LIB_SOURCE to find any that
+ // are not fully parsed, then unify the results.
+
+ return STRINGS();
+ }
+
+#if defined(DEBUG)
+ static void Test( int argc, char** argv ) throw( IO_ERROR );
+#endif
+
+protected:
+
+ STR_UTF fetch; // scratch, used to fetch things, grows to worst case size.
+ STR_UTFS vfetch; // scratch, used to fetch things.
+
+ STRING logicalName;
+ LIB_SOURCE* source;
+ LIB_SINK* sink;
+
+ STRINGS categories;
+ bool cachedCategories; /// < is true only after reading categories
+
+
+ /** parts are in various states of readiness:
+ * 1) not even loaded (if cachedParts is false)
+ * 2) present, but without member 'body' having been read() yet.
+ * 3) body has been read, but not parsed yet.
+ * 4) parsed and inheritance if any has been applied.
+ */
+ PARTS* parts;
+
+ /**
+ * Function lookupPart
+ * looks up a PART, returns NULL if cannot find in source. Does not parse
+ * the part. Does not even load the part's Sweet string. No ownership
+ * is given to the PART, it stays in the cache that is this LIB.
+ *
+ * @throw IO_ERROR if there is some kind of communications error reading
+ * the original list of parts.
+ *
+ * @return PART* - the cached PART, or NULL if not found. No ownership transferred.
+ */
+ const PART* lookupPart( const LPID& aLPID ) throw( IO_ERROR );
+};
+
+
+} // namespace SCH
+
+#endif // SCH_LIB_H_
diff --git a/new/sch_lib_table.cpp b/new/sch_lib_table.cpp
new file mode 100644
index 0000000..0e4fbb0
--- /dev/null
+++ b/new/sch_lib_table.cpp
@@ -0,0 +1,341 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <set>
+#include <assert.h>
+
+#include <sch_lib_table_lexer.h>
+#include <sch_lpid.h>
+#include <sch_lib_table.h>
+#include <sch_dir_lib_source.h>
+
+
+using namespace SCH;
+using namespace LT; // tokens, enum T for LIB_TABLE
+
+
+LIB_TABLE::LIB_TABLE( LIB_TABLE* aFallBackTable ) :
+ fallBack( aFallBackTable )
+{
+ // not copying fall back, simply search aFallBackTable separately
+ // if "logicalName not found".
+}
+
+
+void LIB_TABLE::Parse( SCH_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR )
+{
+ /* grammar:
+
+ (lib_table
+ (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
+ (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
+ (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
+ )
+
+ note: "(lib_table" has already been read in.
+ */
+
+ T tok;
+
+ while( ( tok = in->NextTok() ) != T_RIGHT )
+ {
+ // (lib (logical "LOGICAL")(type "TYPE")(full_uri "FULL_URI")(options "OPTIONS"))
+
+ if( tok == T_EOF )
+ in->Expecting( T_RIGHT );
+
+ if( tok != T_LEFT )
+ in->Expecting( T_LEFT );
+
+ if( ( tok = in->NextTok() ) != T_lib )
+ in->Expecting( T_lib );
+
+ in->NeedLEFT();
+
+ if( ( tok = in->NextTok() ) != T_logical )
+ in->Expecting( T_logical );
+
+ in->NeedSYMBOLorNUMBER();
+
+ std::auto_ptr<ROW> row( new ROW( this ) );
+
+ row->SetLogicalName( in->CurText() );
+
+ in->NeedRIGHT();
+ in->NeedLEFT();
+
+ if( ( tok = in->NextTok() ) != T_type )
+ in->Expecting( T_type );
+
+ in->NeedSYMBOLorNUMBER();
+
+ // verify that type is one of: {dir, schematic, subversion, http}
+ if( strcmp( in->CurText(), "dir" ) &&
+ strcmp( in->CurText(), "schematic" ) &&
+ strcmp( in->CurText(), "subversion" ) &&
+ strcmp( in->CurText(), "http" ) )
+ {
+ in->Expecting( "dir|schematic|subversion|http" );
+ }
+
+ row->SetType( in->CurText() );
+
+ in->NeedRIGHT();
+ in->NeedLEFT();
+
+ if( ( tok = in->NextTok() ) != T_full_uri )
+ in->Expecting( T_full_uri );
+
+ in->NeedSYMBOLorNUMBER();
+
+ row->SetFullURI( in->CurText() );
+
+ in->NeedRIGHT();
+ in->NeedLEFT();
+
+ if( ( tok = in->NextTok() ) != T_options )
+ in->Expecting( T_options );
+
+ in->NeedSYMBOLorNUMBER();
+
+ row->SetOptions( in->CurText() );
+
+ in->NeedRIGHT();
+ in->NeedRIGHT(); // terminate the (lib..)
+
+ // all logicalNames within this table fragment must be unique, so we do not
+ // use doReplace in InsertRow(). However a fallBack table can have a
+ // conflicting logicalName and ours will supercede that one since in
+ // FindLib() we search this table before any fall back.
+ if( !InsertRow( row ) )
+ {
+ STRING msg;
+
+ msg += '\'';
+ msg += row->logicalName;
+ msg += '\'';
+ msg += " is a duplicate logical lib name";
+ THROW_IO_ERROR( msg );
+ }
+ }
+}
+
+
+void LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
+ throw( IO_ERROR )
+{
+ out->Print( nestLevel, "(lib_table\n" );
+ for( ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
+ it->second->Format( out, nestLevel+1 );
+ out->Print( nestLevel, ")\n" );
+}
+
+
+void LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
+ throw( IO_ERROR )
+{
+ out->Print( nestLevel, "(lib (logical %s)(type %s)(full_uri %s)(options %s))\n",
+ out->Quotes( logicalName ).c_str(),
+ out->Quotes( libType ).c_str(),
+ out->Quotes( fullURI ).c_str(),
+ out->Quotes( options ).c_str()
+ );
+}
+
+
+STRINGS LIB_TABLE::GetLogicalLibs()
+{
+ // Only return unique logical library names. Use std::set::insert() to
+ // quietly reject any duplicates, which can happen when encountering a duplicate
+ // logical lib name from one of the fall back table(s).
+
+ std::set<STRING> unique;
+ STRINGS ret;
+ const LIB_TABLE* cur = this;
+
+ do
+ {
+ for( ROWS_CITER it = cur->rows.begin(); it!=cur->rows.end(); ++it )
+ {
+ unique.insert( it->second->logicalName );
+ }
+
+ } while( ( cur = cur->fallBack ) != 0 );
+
+ // return a sorted, unique set of logical lib name STRINGS to caller
+ for( std::set<STRING>::const_iterator it = unique.begin(); it!=unique.end(); ++it )
+ ret.push_back( *it );
+
+ return ret;
+}
+
+
+PART* LIB_TABLE::LookupPart( const LPID& aLPID, LIB* aLocalLib )
+ throw( IO_ERROR )
+{
+ LIB* lib = lookupLib( aLPID, aLocalLib );
+
+ return lib->LookupPart( aLPID, this );
+}
+
+
+LIB* LIB_TABLE::lookupLib( const LPID& aLPID, LIB* aFallBackLib )
+ throw( IO_ERROR )
+{
+ if( aLPID.GetLogicalLib().size() )
+ {
+ ROW* row = FindRow( aLPID.GetLogicalLib() );
+ if( !row )
+ {
+ STRING msg = "lib table contains no logical lib '";
+ msg += aLPID.GetLogicalLib();
+ msg += '\'';
+ THROW_IO_ERROR( msg );
+ }
+
+ if( !row->lib )
+ {
+ loadLib( row );
+ }
+
+ assert( row->lib ); // fix loadLib() to throw if cannot load
+
+ return row->lib;
+ }
+
+ if( aFallBackLib )
+ {
+ return aFallBackLib;
+ }
+
+ STRING msg = "lookupLib() requires logicalLibName or a fallback lib";
+ THROW_IO_ERROR( msg );
+}
+
+
+void LIB_TABLE::loadLib( ROW* aRow ) throw( IO_ERROR )
+{
+ assert( !aRow->lib ); // caller should know better.
+
+ const STRING& libType = aRow->GetType();
+
+ if( !libType.compare( "dir" ) )
+ {
+ // autor_ptr wrap source while we create sink, in case sink throws.
+ std::auto_ptr<LIB_SOURCE> source(
+ new DIR_LIB_SOURCE(
+ aRow->GetFullURI(),
+ aRow->GetOptions() ) );
+
+ /* @todo load LIB_SINK
+ std::auto_ptr<LIB_SINK> sink(
+ new DIR_LIB_SINK(
+ aRow->GetFullURI(),
+ aRow->GetOptions() ) );
+ */
+
+ // LIB::LIB( const STRING& aLogicalLibrary, LIB_SOURCE* aSource, LIB_SINK* aSink = NULL );
+ aRow->lib = new LIB( aRow->GetLogicalName(), source.release(), NULL );
+ }
+
+/*
+ else if( !libType.compare( "schematic" ) )
+ {
+ // @todo code and load SCHEMATIC_LIB_SOURCE
+ }
+
+ else if( !libType.compare( "subversion" ) )
+ {
+ // @todo code and load SVN_LIB_SOURCE
+ }
+
+ else if( !libType.compare( "http" ) )
+ {
+ // @todo code and load HTTP_LIB_SOURCE
+ }
+*/
+ else
+ {
+ STRING msg = "cannot load unknown libType: '";
+ msg += libType;
+ msg += '\'';
+ THROW_IO_ERROR( msg );
+ }
+}
+
+
+LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName ) const
+{
+ // this function must be *super* fast, so therefore should not instantiate
+ // anything which would require using the heap. This function is the reason
+ // ptr_map<> was used instead of ptr_set<>, which would have required
+ // instantiating a ROW just to find a ROW.
+ const LIB_TABLE* cur = this;
+
+ do
+ {
+ ROWS_CITER it = cur->rows.find( aLogicalName );
+
+ if( it != cur->rows.end() )
+ {
+ // reference: http://myitcorner.com/blog/?p=361
+ return (LIB_TABLE::ROW*) it->second; // found
+ }
+
+ // not found, search fall back table(s), if any
+ } while( ( cur = cur->fallBack ) != 0 );
+
+ return 0; // not found
+}
+
+
+bool LIB_TABLE::InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace )
+{
+ // this does not need to be super fast.
+
+ ROWS_CITER it = rows.find( aRow->logicalName );
+
+ if( it == rows.end() )
+ {
+ // be careful here, key is needed because aRow can be
+ // release()ed before logicalName is captured.
+ const STRING& key = aRow->logicalName;
+ rows.insert( key, aRow );
+ return true;
+ }
+
+ if( doReplace )
+ {
+ rows.erase( aRow->logicalName );
+
+ // be careful here, key is needed because aRow can be
+ // release()ed before logicalName is captured.
+ const STRING& key = aRow->logicalName;
+ rows.insert( key, aRow );
+ return true;
+ }
+
+ return false;
+}
+
diff --git a/new/sch_lib_table.h b/new/sch_lib_table.h
new file mode 100644
index 0000000..d05dfdb
--- /dev/null
+++ b/new/sch_lib_table.h
@@ -0,0 +1,388 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SCH_LIB_TABLE_H_
+#define SCH_LIB_TABLE_H_
+
+#include <string>
+#include <boost/ptr_container/ptr_map.hpp>
+
+#include <import_export.h>
+#include <sch_lib.h>
+
+class OUTPUTFORMATTER;
+class SCH_LIB_TABLE_LEXER;
+
+
+namespace SCH {
+
+class LPID;
+class PART;
+
+/**
+ * Class LIB_TABLE
+ * holds LIB_TABLE::ROW records, and can be searched in a very high speed
+ * way based on logical library name.
+ * <p>
+ * This class owns the <b>library table</b>, which is like fstab in concept and maps logical
+ * library name to library URI, type, and options. It has the following columns:
+ * <ul>
+ * <li> Logical Library Name
+ * <li> Library Type
+ * <li> Library URI. The full URI to the library source, form dependent on Type.
+ * <li> Options, used for access, such as password
+ * </ul>
+ * <p>
+ * The Library Type can be one of:
+ * <ul>
+ * <li> "dir"
+ * <li> "schematic" i.e. a parts list from another schematic.
+ * <li> "subversion"
+ * <li> "http"
+ * </ul>
+ * <p>
+ * For now, the Library URI types needed to support the various types can be one of those
+ * shown below, which are typical of each type:
+ * <ul>
+ * <li> "file://C:/mylibdir"
+ * <li> "file://home/user/kicadwork/jtagboard.sch"
+ * <li> "svn://kicad.org/partlib/trunk"
+ * <li> "http://kicad.org/partlib"
+ * </ul>
+ * <p>
+ * The applicable library table is built up from several additive rows (table fragments),
+ * and the final table is a (conceptual) merging of the table fragments. Two
+ * anticipated sources of the rows are a personal table, and a schematic resident
+ * table. The schematic resident table rows are considered a higher priority in
+ * the final dynamically assembled library table. A row in the schematic
+ * contribution to the library table takes precedence over the personal table
+ * if there is a collision on logical library name, otherwise the rows simply
+ * combine without issue to make up the applicable library table.
+ *
+ * @author Dick Hollenbeck
+ */
+class MY_API LIB_TABLE
+{
+public:
+
+ /**
+ * Class ROW
+ * holds a record identifying a LIB in the LIB_TABLE.
+ */
+ class ROW
+ {
+ friend class LIB_TABLE;
+
+ public:
+
+ /**
+ * Function GetLogicalName
+ * returns the logical name of this library table entry.
+ */
+ const STRING& GetLogicalName() const
+ {
+ return logicalName;
+ }
+
+ /**
+ * Function GetType
+ * returns the type of LIB represented by this record.
+ */
+ const STRING& GetType() const
+ {
+ return libType;
+ }
+
+ /**
+ * Function GetFullURI
+ * returns the full location specifying URI for the LIB.
+ */
+ const STRING& GetFullURI() const
+ {
+ return fullURI;
+ }
+
+ /**
+ * Function GetOptions
+ * returns the options string, which may hold a password or anything else needed to
+ * instantiate the underlying LIB_SOURCE.
+ */
+ const STRING& GetOptions() const
+ {
+ return options;
+ }
+
+ ~ROW()
+ {
+ delete lib;
+ }
+
+ /**
+ * Function Format
+ * serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
+ * make it look good using multiple lines and indentation.
+ * @param out is an OUTPUTFORMATTER
+ * @param nestLevel is the indentation level to base all lines of the output.
+ * Actual indentation will be 2 spaces for each nestLevel.
+ */
+ void Format( OUTPUTFORMATTER* out, int nestLevel ) const
+ throw( IO_ERROR );
+
+ protected:
+
+ ROW( LIB_TABLE* aOwner ) :
+ owner( aOwner ),
+ lib( 0 )
+ {}
+
+ /**
+ * Function SetLogicalName
+ * changes the logical name of this library, useful for an editor.
+ */
+ void SetLogicalName( const STRING& aLogicalName )
+ {
+ logicalName = aLogicalName;
+ }
+
+ /**
+ * Function SetType
+ * changes the type represented by this record.
+ */
+ void SetType( const STRING& aType )
+ {
+ libType = aType;
+ }
+
+ /**
+ * Function SetFullURI
+ * changes the full URI for the library, useful from a library table editor.
+ */
+ void SetFullURI( const STRING& aFullURI )
+ {
+ fullURI = aFullURI;
+ }
+
+ /**
+ * Function SetOptions
+ * changes the options string for this record, and is useful from
+ * the library table editor.
+ */
+ void SetOptions( const STRING& aOptions )
+ {
+ options = aOptions;
+ }
+
+ private:
+ LIB_TABLE* owner;
+ STRING logicalName;
+ STRING libType;
+ STRING fullURI;
+ STRING options;
+
+ LIB* lib; ///< ownership of the loaded LIB is here
+ };
+
+ /**
+ * Constructor LIB_TABLE
+ * builds a library table by pre-pending this table fragment in front of
+ * @a aFallBackTable. Loading of this table fragment is done by using Parse().
+ *
+ * @param aFallBackTable is another LIB_TABLE which is searched only when
+ * a record is not found in this table. No ownership is taken of aFallBackTable.
+ */
+ LIB_TABLE( LIB_TABLE* aFallBackTable = NULL );
+
+ /**
+ * Function Parse
+ * fills this table fragment from information in the input stream \a aParser, which
+ * is a DSNLEXER customized for the grammar needed to describe instances of this object.
+ * The entire textual element spec is <br>
+ *
+ * <pre>
+ * (lib_table
+ * (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
+ * (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
+ * (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
+ * )
+ * </pre>
+ *
+ * When this function is called, the input token stream given by \a aParser
+ * is assumed to be positioned at the '^' in the following example, i.e. just
+ * after the identifying keyword and before the content specifying stuff.
+ * <br>
+ * (lib_table ^ (....) )
+ *
+ * @param aParser is the input token stream of keywords and symbols.
+ */
+ void Parse( SCH_LIB_TABLE_LEXER* aParser ) throw( IO_ERROR, PARSE_ERROR );
+
+ /**
+ * Function Format
+ * serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
+ * make it look good using multiple lines and indentation.
+ *
+ * @param out is an OUTPUTFORMATTER
+ * @param nestLevel is the indentation level to base all lines of the output.
+ * Actual indentation will be 2 spaces for each nestLevel.
+ */
+ void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ERROR );
+
+ /**
+ * Function LookupPart
+ * finds and loads a PART, and parses it. As long as the part is
+ * accessible in any LIB_SOURCE, opened or not opened, this function
+ * will find it and load it into its containing LIB, even if that means
+ * having to open a LIB in this table that was not previously opened.
+ *
+ * @param aLogicalPartID holds the partName and may also hold the logicalLibName. If
+ * logicalLibName is empty, then @a aFallBackLib should not be NULL.
+ *
+ * @param aFallBackLib is used only if aLogicalPartID has an empty logicalLibName.
+ * This is for the case when an LPID has no logicalLibName because the LPID is using
+ * a partName from the same LIB as was the referring content.
+ *
+ * @return PART* - this will never be NULL, and no ownership is transfered because
+ * all PARTs live in LIBs. You only get to point to them in some LIB. If the PART
+ * cannot be found, then an exception is thrown.
+ *
+ * @throw IO_ERROR if any problem occurs or if the part cannot be found.
+ */
+ PART* LookupPart( const LPID& aLogicalPartID, LIB* aFallBackLib = NULL ) throw( IO_ERROR );
+
+ /**
+ * Function GetLogicalLibs
+ * returns the logical library names, all of them that are in pertinent to
+ * a lookup done on this LIB_TABLE.
+ */
+ STRINGS GetLogicalLibs();
+
+ //----<read accessors>----------------------------------------------------
+ // the returning of a const STRING* tells if not found, but might be too
+ // promiscuous?
+
+ /**
+ * Function GetLibURI
+ * returns the full library path from a logical library name.
+ * @param aLogicalLibraryName is the short name for the library of interest.
+ * @return const STRING* - or NULL if not found.
+ */
+ const STRING* GetLibURI( const STRING& aLogicalLibraryName ) const
+ {
+ const ROW* row = FindRow( aLogicalLibraryName );
+ return row ? &row->fullURI : 0;
+ }
+
+ /**
+ * Function GetLibType
+ * returns the type of a logical library.
+ * @param aLogicalLibraryName is the short name for the library of interest.
+ * @return const STRING* - or NULL if not found.
+ */
+ const STRING* GetLibType( const STRING& aLogicalLibraryName ) const
+ {
+ const ROW* row = FindRow( aLogicalLibraryName );
+ return row ? &row->libType : 0;
+ }
+
+ /**
+ * Function GetLibOptions
+ * returns the options string for \a aLogicalLibraryName.
+ * @param aLogicalLibraryName is the short name for the library of interest.
+ * @return const STRING* - or NULL if not found.
+ */
+ const STRING* GetLibOptions( const STRING& aLogicalLibraryName ) const
+ {
+ const ROW* row = FindRow( aLogicalLibraryName );
+ return row ? &row->options : 0;
+ }
+
+ //----</read accessors>---------------------------------------------------
+
+#if 1 || defined(DEBUG)
+ /// implement the tests in here so we can honor the priviledge levels of the
+ /// accessors, something difficult to do from int main(int, char**)
+ void Test();
+#endif
+
+protected: // only a table editor can use these
+
+ /**
+ * Function InsertRow
+ * adds aRow if it does not already exist or if doReplace is true. If doReplace
+ * is not true and the key for aRow already exists, the function fails and returns false.
+ * The key for the table is the logicalName, and all in this table must be unique.
+ * @param aRow is the new row to insert, or to forcibly add if doReplace is true.
+ * @param doReplace if true, means insert regardless of whether aRow's key already
+ * exists. If false, then fail if the key already exists.
+ * @return bool - true if the operation succeeded.
+ */
+ bool InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace = false );
+
+ /**
+ * Function FindRow
+ * returns a ROW* if aLogicalName is found in this table or in any chained
+ * fallBack table fragment, else NULL.
+ */
+ ROW* FindRow( const STRING& aLogicalName ) const;
+
+private:
+
+ /**
+ * Function lookupLib
+ * finds or loads a LIB based on @a aLogicalPartID or @a aFallBackLib.
+ * If the LIB is already loaded then it is returned as is, else it is loaded.
+ *
+ * @param aLogicalPartID holds the partName and may also hold the logicalLibName. If
+ * logicalLibName is empty, then @a aFallBackLib should not be NULL.
+ *
+ * @param aFallBackLib is used only if aLogicalPartID has an empty logicalLibName.
+ * This is for the case when an LPID has no logicalLibName because the LPID is using
+ * a partName from the same LIB as was the referring content.
+ *
+ * @return LIB* - this will never be NULL, and no ownership is transfered because
+ * all LIBs live in the LIB_TABLEs. You only get to point to them in some LIB_TABLE.
+ * If the LIB cannot be found, then an exception is thrown.
+ *
+ * @throw IO_ERROR if any problem occurs or if the LIB cannot be found or cannot be loaded.
+ */
+ LIB* lookupLib( const LPID& aLogicalPartID, LIB* aFallBackLib = NULL ) throw( IO_ERROR );
+
+ /**
+ * Function loadLib
+ * loads a LIB using information in @a aRow. Call only if LIB not
+ * already loaded.
+ */
+ void loadLib( ROW* aRow ) throw( IO_ERROR );
+
+ typedef boost::ptr_map<STRING, ROW> ROWS;
+ typedef ROWS::iterator ROWS_ITER;
+ typedef ROWS::const_iterator ROWS_CITER;
+
+ ROWS rows;
+ LIB_TABLE* fallBack;
+};
+
+} // namespace SCH
+
+#endif // SCH_LIB_TABLE_H_
diff --git a/new/sch_lib_table.keywords b/new/sch_lib_table.keywords
new file mode 100644
index 0000000..df56bba
--- /dev/null
+++ b/new/sch_lib_table.keywords
@@ -0,0 +1,6 @@
+lib_table
+logical
+type
+full_uri
+options
+lib
diff --git a/new/sch_lpid.cpp b/new/sch_lpid.cpp
new file mode 100644
index 0000000..e475779
--- /dev/null
+++ b/new/sch_lpid.cpp
@@ -0,0 +1,501 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <cstring>
+#include <wx/wx.h> // _()
+
+#include <sch_lpid.h>
+
+using namespace SCH;
+
+static inline bool isDigit( char c )
+{
+ return c >= '0' && c <= '9';
+}
+
+const char* EndsWithRev( const char* start, const char* tail, char separator )
+{
+ bool sawDigit = false;
+
+ while( tail > start && isDigit( *--tail ) )
+ {
+ sawDigit = true;
+ }
+
+ // if sawDigit, tail points to the 'v' here.
+
+ if( sawDigit && tail-3 >= start )
+ {
+ tail -= 3;
+
+ if( tail[0]==separator && tail[1]=='r' && tail[2]=='e' && tail[3]=='v' )
+ {
+ return tail+1; // omit separator, return "revN[N..]"
+ }
+ }
+
+ return 0;
+}
+
+int RevCmp( const char* s1, const char* s2 )
+{
+ int r = strncmp( s1, s2, 3 );
+
+ if( r || strlen(s1)<4 || strlen(s2)<4 )
+ {
+ return r;
+ }
+
+ int rnum1 = atoi( s1+3 );
+ int rnum2 = atoi( s2+3 );
+
+ return -(rnum1 - rnum2); // swap the sign, higher revs first
+}
+
+//----<Policy and field test functions>-------------------------------------
+
+// These all return -1 on success, or >= 0 if there is an error at a
+// particular character offset into their respective arguments. If >=0,
+// then that return value gives the character offset of the error.
+
+static inline int okLogical( const STRING& aField )
+{
+ // std::string::npos is largest positive number, casting to int makes it -1.
+ // Returning that means success.
+ return int( aField.find_first_of( ":/" ) );
+}
+
+static inline int okBase( const STRING& aField )
+{
+ int offset = int( aField.find_first_of( ":/" ) );
+ if( offset != -1 )
+ return offset;
+
+ // cannot be empty
+ if( !aField.size() )
+ return 0;
+
+ return offset; // ie. -1
+}
+
+static inline int okCategory( const STRING& aField )
+{
+ return int( aField.find_first_of( ":/" ) );
+}
+
+static int okRevision( const STRING& aField )
+{
+ char rev[32]; // C string for speed
+
+ if( aField.size() >= 4 )
+ {
+ strcpy( rev, "x/" );
+ strcat( rev, aField.c_str() );
+
+ if( EndsWithRev( rev, rev + strlen(rev) ) == rev+2 )
+ return -1; // success
+ }
+
+ return 0; // first character position "is in error", is best we can do.
+}
+
+//----</Policy and field test functions>-------------------------------------
+
+
+void LPID::clear()
+{
+ logical.clear();
+ category.clear();
+ baseName.clear();
+ partName.clear();
+ revision.clear();
+}
+
+
+int LPID::Parse( const STRING& aLPID )
+{
+ clear();
+
+ const char* rev = EndsWithRev( aLPID );
+ size_t revNdx;
+ size_t partNdx;
+ size_t baseNdx;
+ int offset;
+
+ //=====<revision>=========================================
+ if( rev )
+ {
+ revNdx = rev - aLPID.c_str();
+
+ // no need to check revision, EndsWithRev did that.
+ revision = aLPID.substr( revNdx );
+ --revNdx; // back up to omit the '/' which preceeds the rev
+ }
+ else
+ revNdx = aLPID.size();
+
+ //=====<logical>==========================================
+ if( ( partNdx = aLPID.find( ':' ) ) != aLPID.npos )
+ {
+ offset = SetLogicalLib( aLPID.substr( 0, partNdx ) );
+ if( offset > -1 )
+ {
+ return offset;
+ }
+ ++partNdx; // skip ':'
+ }
+ else
+ partNdx = 0;
+
+ //=====<rawName && category>==============================
+ // "length limited" search:
+ const char* base = (const char*) memchr( aLPID.c_str() + partNdx, '/', revNdx - partNdx );
+
+ if( base )
+ {
+ baseNdx = base - aLPID.c_str();
+ offset = SetCategory( aLPID.substr( partNdx, baseNdx - partNdx ) );
+ if( offset > -1 )
+ {
+ return offset + partNdx;
+ }
+ ++baseNdx; // skip '/'
+ }
+ else
+ {
+ baseNdx = partNdx;
+ }
+
+ //=====<baseName>==========================================
+ offset = SetBaseName( aLPID.substr( baseNdx, revNdx - baseNdx ) );
+ if( offset > -1 )
+ {
+ return offset + baseNdx;
+ }
+
+ return -1;
+}
+
+
+LPID::LPID( const STRING& aLPID ) throw( PARSE_ERROR )
+{
+ int offset = Parse( aLPID );
+
+ if( offset != -1 )
+ {
+ THROW_PARSE_ERROR(
+ _( "Illegal character found in LPID string" ),
+ wxString::FromUTF8( aLPID.c_str() ),
+ aLPID.c_str(),
+ 0,
+ offset
+ );
+ }
+}
+
+
+int LPID::SetLogicalLib( const STRING& aLogical )
+{
+ int offset = okLogical( aLogical );
+ if( offset == -1 )
+ {
+ logical = aLogical;
+ }
+ return offset;
+}
+
+
+int LPID::SetCategory( const STRING& aCategory )
+{
+ int offset = okCategory( aCategory );
+ if( offset == -1 )
+ {
+ category = aCategory;
+
+ // set the partName too
+ if( category.size() )
+ {
+ partName = category;
+ partName += '/';
+ partName += baseName;
+ }
+ else
+ partName = baseName;
+
+ }
+ return offset;
+}
+
+
+int LPID::SetBaseName( const STRING& aBaseName )
+{
+ int offset = okBase( aBaseName );
+ if( offset == -1 )
+ {
+ baseName = aBaseName;
+
+ // set the partName too
+ if( category.size() )
+ {
+ partName = category;
+ partName += '/';
+ partName += baseName;
+ }
+ else
+ partName = baseName;
+ }
+ return offset;
+}
+
+
+int LPID::SetPartName( const STRING& aPartName )
+{
+ STRING category;
+ STRING base;
+ int offset;
+ int separation = int( aPartName.find_first_of( "/" ) );
+
+ if( separation != -1 )
+ {
+ category = aPartName.substr( 0, separation );
+ base = aPartName.substr( separation+1 );
+ }
+ else
+ {
+ // leave category empty
+ base = aPartName;
+ }
+
+ if( (offset = SetCategory( category )) != -1 )
+ return offset;
+
+ if( (offset = SetBaseName( base )) != -1 )
+ {
+ return offset + separation + 1;
+ }
+
+ return -1;
+}
+
+
+int LPID::SetRevision( const STRING& aRevision )
+{
+ int offset = okRevision( aRevision );
+ if( offset == -1 )
+ {
+ revision = aRevision;
+ }
+ return offset;
+}
+
+
+STRING LPID::Format() const
+{
+ STRING ret;
+
+ if( logical.size() )
+ {
+ ret += logical;
+ ret += ':';
+ }
+
+ if( category.size() )
+ {
+ ret += category;
+ ret += '/';
+ }
+
+ ret += baseName;
+
+ if( revision.size() )
+ {
+ ret += '/';
+ ret += revision;
+ }
+
+ return ret;
+}
+
+
+STRING LPID::GetPartNameAndRev() const
+{
+ STRING ret;
+
+ if( category.size() )
+ {
+ ret += category;
+ ret += '/';
+ }
+
+ ret += baseName;
+
+ if( revision.size() )
+ {
+ ret += '/';
+ ret += revision;
+ }
+
+ return ret;
+}
+
+
+STRING LPID::Format( const STRING& aLogicalLib, const STRING& aPartName, const STRING& aRevision )
+ throw( PARSE_ERROR )
+{
+ STRING ret;
+ int offset;
+
+ if( aLogicalLib.size() )
+ {
+ offset = okLogical( aLogicalLib );
+ if( offset != -1 )
+ {
+ THROW_PARSE_ERROR(
+ _( "Illegal character found in logical lib name" ),
+ wxString::FromUTF8( aLogicalLib.c_str() ),
+ aLogicalLib.c_str(),
+ 0,
+ offset
+ );
+ }
+ ret += aLogicalLib;
+ ret += ':';
+ }
+
+ {
+ STRING category;
+ STRING base;
+
+ int separation = int( aPartName.find_first_of( "/" ) );
+
+ if( separation != -1 )
+ {
+ category = aPartName.substr( 0, separation );
+ base = aPartName.substr( separation+1 );
+ }
+ else
+ {
+ // leave category empty
+ base = aPartName;
+ }
+
+ if( (offset = okCategory( category )) != -1 )
+ {
+ THROW_PARSE_ERROR(
+ _( "Illegal character found in category" ),
+ wxString::FromUTF8( aRevision.c_str() ),
+ aRevision.c_str(),
+ 0,
+ offset
+ );
+ }
+
+ if( (offset = okBase( base )) != -1 )
+ {
+ THROW_PARSE_ERROR(
+ _( "Illegal character found in base name" ),
+ wxString::FromUTF8( aRevision.c_str() ),
+ aRevision.c_str(),
+ 0,
+ offset + separation + 1
+ );
+ }
+
+ if( category.size() )
+ {
+ ret += category;
+ ret += '/';
+ }
+
+ ret += base;
+ }
+
+ if( aRevision.size() )
+ {
+ offset = okRevision( aRevision );
+ if( offset != -1 )
+ {
+ THROW_PARSE_ERROR(
+ _( "Illegal character found in revision" ),
+ wxString::FromUTF8( aRevision.c_str() ),
+ aRevision.c_str(),
+ 0,
+ offset
+ );
+ }
+
+ ret += '/';
+ ret += aRevision;
+ }
+
+ return ret;
+}
+
+
+#if 0 && defined(DEBUG)
+
+// build this with Debug CMAKE_BUILD_TYPE
+
+void LPID::Test()
+{
+ static const char* lpids[] = {
+ "me:passives/R/rev0",
+ "passives/R/rev2",
+ ":passives/R/rev3",
+ "C/rev22",
+ "passives/C22",
+ "R",
+ "me:R",
+ // most difficult:
+ "me:/R/rev0",
+ "me:R/rev0",
+ };
+
+ for( unsigned i=0; i<sizeof(lpids)/sizeof(lpids[0]); ++i )
+ {
+ // test some round tripping
+
+ LPID lpid( lpids[i] ); // parse
+
+ // format
+ printf( "input:'%s' full:'%s' base:'%s' partName:'%s' cat:'%s' rev:'%s'\n",
+ lpids[i],
+ lpid.Format().c_str(),
+ lpid.GetBaseName().c_str(),
+ lpid.GetPartName().c_str(),
+ lpid.GetCategory().c_str(),
+ lpid.GetRevision().c_str()
+ );
+ }
+}
+
+
+int main( int argc, char** argv )
+{
+ LPID::Test();
+
+ return 0;
+}
+
+#endif
diff --git a/new/sch_lpid.h b/new/sch_lpid.h
new file mode 100644
index 0000000..97fdf77
--- /dev/null
+++ b/new/sch_lpid.h
@@ -0,0 +1,245 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SCH_LPID_H_
+#define SCH_LPID_H_
+
+#include <utf8.h>
+#include <richio.h>
+
+namespace SCH {
+
+
+/**
+ * Class LPID
+ * (aka GUID) is a Logical Part ID and consists of various portions much like a URI.
+ * It is a container for the separated portions of a logical part id STRING so they
+ * can be accessed individually. The various portions of an LPID are:
+ * logicalLibraryName, category, baseName, and revision. Only the baseName is
+ * mandatory. There is another construct called "partName" which consists of
+ * [category/]baseName. That is the category followed by a slash, but only if
+ * the category is not empty.
+ * <p>
+ * partName = [category/]baseName
+ * <p>
+ * Example LPID string:
+ * "kicad:passives/R/rev6".
+ * <p>
+ * <ul>
+ * <li> "kicad" is the logical library name.
+ * <li> "passives" is the category.
+ * <li> "passives/R" is the partname.
+ * <li> "rev6" is the revision, which is optional. If missing then its
+ * / delimiter should also not be present. A revision must begin with
+ * "rev" and be followed by at least one or more decimal digits.
+ * </ul>
+ * @author Dick Hollenbeck
+ */
+class LPID // aka GUID
+{
+public:
+
+ LPID() {}
+
+ /**
+ * Constructor LPID
+ * takes aLPID string and parses it. A typical LPID string uses a logical
+ * library name followed by a part name.
+ * e.g.: "kicad:passives/R/rev2", or
+ * e.g.: "mylib:R33"
+ */
+ LPID( const STRING& aLPID ) throw( PARSE_ERROR );
+
+ /**
+ * Function Parse
+ * [re-]stuffs this LPID with the information from @a aLPID.
+ * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
+ * character offset into aLPID at which an error was detected.
+ */
+ int Parse( const STRING& aLPID );
+
+ /**
+ * Function GetLogicalLib
+ * returns the logical library portion of a LPID. There is not Set accessor
+ * for this portion since it comes from the library table and is considered
+ * read only here.
+ */
+ const STRING& GetLogicalLib() const
+ {
+ return logical;
+ }
+
+ /**
+ * Function SetCategory
+ * overrides the logical lib name portion of the LPID to @a aLogical, and can be empty.
+ * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
+ * character offset into the parameter at which an error was detected, usually
+ * because it contained '/' or ':'.
+ */
+ int SetLogicalLib( const STRING& aLogical );
+
+ /**
+ * Function GetCategory
+ * returns the category of this part id, "passives" in the example at the
+ * top of the class description.
+ */
+ const STRING& GetCategory() const
+ {
+ return category;
+ }
+
+ /**
+ * Function SetCategory
+ * overrides the category portion of the LPID to @a aCategory and is typically
+ * either the empty string or a single word like "passives".
+ * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
+ * character offset into the parameter at which an error was detected, usually
+ * because it contained '/' or ':'.
+ */
+ int SetCategory( const STRING& aCategory );
+
+ /**
+ * Function GetBaseName
+ * returns the part name without the category.
+ */
+ const STRING& GetBaseName() const
+ {
+ return baseName;
+ }
+
+ /**
+ * Function SetBaseName
+ * overrides the base name portion of the LPID to @a aBaseName
+ * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
+ * character offset into the parameter at which an error was detected, usually
+ * because it contained '/' or ':', or is blank.
+ */
+ int SetBaseName( const STRING& aBaseName );
+
+ /**
+ * Function GetPartName
+ * returns the part name, i.e. category/baseName without revision.
+ */
+ const STRING& GetPartName() const
+ {
+ return partName;
+ }
+
+ /**
+ * Function GetPartNameAndRev
+ * returns the part name with revision if any, i.e. [category/]baseName[/revN..]
+ */
+ STRING GetPartNameAndRev() const;
+
+ /**
+ * Function SetPartName
+ * overrides the part name portion of the LPID to @a aPartName
+ * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
+ * character offset into the parameter at which an error was detected, usually
+ * because it contained more than one '/', or one or more ':', or is blank.
+ * A single '/' is allowed, since that is used to separate the category from the
+ * base name.
+ */
+ int SetPartName( const STRING& aPartName );
+
+ /**
+ * Function GetRevision
+ * returns the revision portion of the LPID.
+ */
+ const STRING& GetRevision() const
+ {
+ return revision;
+ }
+
+ /**
+ * Function SetRevision
+ * overrides the revision portion of the LPID to @a aRevision and must
+ * be in the form "rev<num>" where "<num>" is "1", "2", etc.
+ * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
+ * character offset into the parameter at which an error was detected,
+ * because it did not look like "rev23"
+ */
+ int SetRevision( const STRING& aRevision );
+
+ /**
+ * Function Format
+ * returns the full text of the LPID.
+ */
+ STRING Format() const;
+
+ /**
+ * Function Format
+ * returns a STRING in the proper format as an LPID for a combination of
+ * aLogicalLib, aPartName, and aRevision.
+ * @throw PARSE_ERROR if any of the pieces are illegal.
+ */
+ static STRING Format( const STRING& aLogicalLib, const STRING& aPartName, const STRING& aRevision="" )
+ throw( PARSE_ERROR );
+
+ void clear();
+
+#if defined(DEBUG)
+ static void Test();
+#endif
+
+protected:
+ STRING logical; ///< logical lib name or empty
+ STRING category; ///< or empty
+ STRING baseName; ///< without category
+ STRING revision; ///< "revN[N..]" or empty
+ STRING partName; ///< cannot be set directory, set via SetBaseName() & SetCategory()
+};
+
+} // namespace SCH
+
+/**
+ * Function EndsWithRev
+ * returns a pointer to the final string segment: "revN[N..]" or NULL if none.
+ * @param start is the beginning of string segment to test, the partname or
+ * any middle portion of it.
+ * @param tail is a pointer to the terminating nul, or one past inclusive end of
+ * segment, i.e. the string segment of interest is [start,tail)
+ * @param separator is the separating byte, expected: '.' or '/', depending on context.
+ */
+const char* EndsWithRev( const char* start, const char* tail, char separator = '/' );
+
+static inline const char* EndsWithRev( const STRING& aPartName, char separator = '/' )
+{
+ return EndsWithRev( aPartName.c_str(), aPartName.c_str()+aPartName.size(), separator );
+}
+
+
+/**
+ * Function RevCmp
+ * compares two rev strings in a way like strcmp() except that the highest numbered
+ * revision is considered first in the sort order. The function probably won't work
+ * unless you give it two rev strings.
+ * @param s1 is a rev string like "rev10"
+ * @param s2 is a rev string like "rev1".
+ * @return int - either negative, zero, or positive depending on whether the revision
+ * is greater, equal, or less on the left hand side.
+ */
+int RevCmp( const char* s1, const char* s2 );
+
+#endif // SCH_LPID_H_
diff --git a/new/sch_part.cpp b/new/sch_part.cpp
new file mode 100644
index 0000000..730ded9
--- /dev/null
+++ b/new/sch_part.cpp
@@ -0,0 +1,675 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <wx/wx.h> // _()
+
+#include <sch_part.h>
+#include <sch_sweet_parser.h>
+#include <sch_lpid.h>
+#include <sch_lib_table.h>
+#include <macros.h>
+
+
+
+/**
+ * Function formatAt
+ * outputs a formatted "(at X Y [ANGLE])" s-expression
+ */
+ static void formatAt( OUTPUTFORMATTER* out, const SCH::POINT& aPos, ANGLE aAngle, int indent=0 )
+ throw( IO_ERROR )
+{
+ // if( aPos.x || aPos.y || aAngle )
+ {
+ out->Print( indent, aAngle!=0.0 ? "(at %.6g %.6g %.6g)" : "(at %.6g %.6g)",
+ InternalToLogical( aPos.x ), InternalToLogical( aPos.y ),
+ double( aAngle ) );
+ }
+}
+
+static void formatStroke( OUTPUTFORMATTER* out, STROKE aStroke, int indent=0 )
+ throw( IO_ERROR )
+{
+ if( aStroke == STROKE_DEFAULT )
+ out->Print( indent, "(stroke %.6g)", InternalToWidth( aStroke ) );
+}
+
+
+using namespace SCH;
+
+
+PART::PART( LIB* aOwner, const STRING& aPartNameAndRev ) :
+ owner( aOwner ),
+ contains( 0 ),
+ partNameAndRev( aPartNameAndRev ),
+ extends( 0 ),
+ base( 0 )
+{
+ // Our goal is to have class LIB only instantiate what is needed, so print here
+ // what it is doing. It is the only class where PART can be instantiated.
+ D(printf("PART::PART(%s)\n", aPartNameAndRev.c_str() );)
+
+ for( int i=REFERENCE; i<END; ++i )
+ mandatory[i] = 0;
+}
+
+
+void PART::clear()
+{
+ if( extends )
+ {
+ delete extends;
+ extends = 0;
+ }
+
+ // clear the mandatory fields
+ for( int ndx = REFERENCE; ndx < END; ++ndx )
+ {
+ delete mandatory[ndx];
+ mandatory[ndx] = 0;
+ }
+
+ // delete properties I own, since their container will not destroy them:
+ for( PROPERTIES::iterator it = properties.begin(); it != properties.end(); ++it )
+ delete *it;
+ properties.clear();
+
+ // delete graphics I own, since their container will not destroy them:
+ for( GRAPHICS::iterator it = graphics.begin(); it != graphics.end(); ++it )
+ delete *it;
+ graphics.clear();
+
+ // delete PINs I own, since their container will not destroy them.
+ for( PINS::iterator it = pins.begin(); it != pins.end(); ++it )
+ delete *it;
+ pins.clear();
+
+ alternates.clear();
+
+ keywords.clear();
+
+ pin_merges.clear();
+
+ contains = 0;
+}
+
+
+PROPERTY* PART::FieldLookup( PROP_ID aPropertyId )
+{
+ wxASSERT( unsigned(aPropertyId) < unsigned(END) );
+
+ PROPERTY* p = mandatory[aPropertyId];
+
+ if( !p )
+ {
+ switch( aPropertyId )
+ {
+ case REFERENCE:
+ p = new PROPERTY( this, wxT( "reference" ) );
+ p->text = wxT( "U?" );
+ break;
+
+ case VALUE:
+ p = new PROPERTY( this, wxT( "value" ) );
+ break;
+
+ case FOOTPRINT:
+ p = new PROPERTY( this, wxT( "footprint" ) );
+ break;
+
+ case DATASHEET:
+ p = new PROPERTY( this, wxT( "datasheet" ) );
+ break;
+
+ case MODEL:
+ p = new PROPERTY( this, wxT( "model" ) );
+ break;
+
+ default:
+ ;
+ }
+
+ mandatory[aPropertyId] = p;
+ }
+
+ return p;
+}
+
+
+PROPERTY& PROPERTY::operator = ( const PROPERTY& r )
+{
+ *(BASE_GRAPHIC*) this = (BASE_GRAPHIC&) r;
+
+ name = r.name;
+ text = r.text;
+
+ delete effects;
+
+ if( r.effects )
+ effects = new TEXT_EFFECTS( *r.effects );
+ else
+ effects = 0;
+
+ return *this;
+}
+
+
+PINS::iterator PART::pinFindByPad( const wxString& aPad )
+{
+ PINS::iterator it;
+
+ for( it = pins.begin(); it != pins.end(); ++it )
+ {
+ if( (*it)->pad.text == aPad )
+ break;
+ }
+
+ return it;
+}
+
+
+void PART::PinsFindBySignal( PIN_LIST* aResults, const wxString& aSignal )
+{
+ for( PINS::const_iterator it = pins.begin(); it != pins.end(); ++it )
+ {
+ if( (*it)->signal.text == aSignal )
+ {
+ aResults->push_back( *it );
+ }
+ }
+}
+
+
+bool PART::PinDelete( const wxString& aPad )
+{
+ PINS::iterator it = pinFindByPad( aPad );
+ if( it != pins.end() )
+ {
+ delete *it;
+ pins.erase( it );
+ return true;
+ }
+
+ // there is only one reason this can fail: not found:
+ return false;
+}
+
+
+PART::~PART()
+{
+ clear();
+}
+
+
+void PART::setExtends( LPID* aLPID )
+{
+ delete extends;
+ extends = aLPID;
+}
+
+
+void PART::inherit( const PART& r )
+{
+ // Inherit can be called at any time, even from an interactive text
+ // editor, so cannot assume 'this' object is new. Clear it.
+ clear();
+
+ // copy anything inherited, such as drawables, properties, pins, etc. here
+ contains = r.contains;
+
+ base = &r;
+
+ anchor = r.anchor;
+
+ for( int i=REFERENCE; i<END; ++i )
+ {
+ if( r.mandatory[i] )
+ mandatory[i] = (PROPERTY*) r.mandatory[i]->Clone( this );
+ }
+
+ for( PROPERTIES::const_iterator it = r.properties.begin(); it != r.properties.end(); ++it )
+ properties.push_back( (PROPERTY*) (*it)->Clone( this ) );
+
+ for( GRAPHICS::const_iterator it = r.graphics.begin(); it != r.graphics.end(); ++it )
+ graphics.push_back( (*it)->Clone( this ) );
+
+ for( PINS::const_iterator it = r.pins.begin(); it != r.pins.end(); ++it )
+ pins.push_back( (PIN*) (*it)->Clone( this ) );
+
+ /* not sure about this concept yet:
+ for( PART_REFS::const_iterator it = r.alternates.begin(); it != r.alternates.end(); ++it )
+ alternates.push_back( *it );
+ */
+
+ for( KEYWORDS::const_iterator it = r.keywords.begin(); it != r.keywords.end(); ++it )
+ keywords.insert( *it );
+
+ for( MERGE_SETS::const_iterator it = r.pin_merges.begin(); it != r.pin_merges.end(); ++it )
+ {
+ pin_merges[ *it->first ] = * new MERGE_SET( *it->second );
+ }
+}
+
+
+PART& PART::operator=( const PART& r )
+{
+ // maintain in concert with inherit(), which is a partial assignment operator.
+ inherit( r );
+
+ owner = r.owner;
+ partNameAndRev = r.partNameAndRev;
+ body = r.body;
+ base = r.base;
+
+ setExtends( r.extends ? new LPID( *r.extends ) : 0 );
+
+ return *this;
+}
+
+
+void PART::Parse( SWEET_PARSER* aParser , LIB_TABLE* aTable ) throw( IO_ERROR, PARSE_ERROR )
+{
+ aParser->Parse( this, aTable );
+}
+
+
+bool PART::PropDelete( const wxString& aPropertyName )
+{
+ PROPERTIES::iterator it = propertyFind( aPropertyName );
+ if( it != properties.end() )
+ {
+ delete *it;
+ properties.erase( it );
+ return true;
+ }
+
+ return false;
+}
+
+
+PROPERTIES::iterator PART::propertyFind( const wxString& aPropertyName )
+{
+ PROPERTIES::iterator it;
+ for( it = properties.begin(); it!=properties.end(); ++it )
+ if( (*it)->name == aPropertyName )
+ break;
+ return it;
+}
+
+
+void PART::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ out->Print( indent, "(part %s", partNameAndRev.c_str() );
+
+ if( extends )
+ out->Print( 0, " inherits %s", extends->Format().c_str() );
+
+ out->Print( 0, "\n" );
+
+ for( int i = REFERENCE; i < END; ++i )
+ {
+ PROPERTY* prop = Field( PROP_ID( i ) );
+ if( prop )
+ prop->Format( out, indent+1, ctl );
+ }
+
+ for( PROPERTIES::const_iterator it = properties.begin(); it != properties.end(); ++it )
+ {
+ (*it)->Format( out, indent+1, ctl );
+ }
+
+ if( anchor.x || anchor.y )
+ {
+ out->Print( indent+1, "(anchor (at %.6g %.6g))\n",
+ InternalToLogical( anchor.x ),
+ InternalToLogical( anchor.y ) );
+ }
+
+ if( keywords.size() )
+ {
+ out->Print( indent+1, "(keywords" );
+ for( KEYWORDS::iterator it = keywords.begin(); it != keywords.end(); ++it )
+ out->Print( 0, " %s", out->Quotew( *it ).c_str() );
+ out->Print( 0, ")\n" );
+ }
+
+ for( GRAPHICS::const_iterator it = graphics.begin(); it != graphics.end(); ++it )
+ {
+ (*it)->Format( out, indent+1, ctl );
+ }
+
+ for( PINS::const_iterator it = pins.begin(); it != pins.end(); ++it )
+ {
+ (*it)->Format( out, indent+1, ctl );
+ }
+
+ if( alternates.size() )
+ {
+ out->Print( indent+1, "(alternates" );
+ for( PART_REFS::const_iterator it = alternates.begin(); it!=alternates.end(); ++it )
+ out->Print( 0, " %s", out->Quotes( it->Format() ).c_str() );
+ out->Print( 0, ")\n" );
+ }
+
+ for( MERGE_SETS::const_iterator mit = pin_merges.begin(); mit != pin_merges.end(); ++mit )
+ {
+ out->Print( indent+1, "(pin_merge %s (pads", out->Quotew( mit->first ).c_str() );
+
+ const MERGE_SET& mset = *mit->second;
+ for( MERGE_SET::const_iterator pit = mset.begin(); pit != mset.end(); ++pit )
+ {
+ out->Print( 0, " %s", out->Quotew( *pit ).c_str() );
+ }
+ out->Print( 0, "))\n" );
+ }
+
+ out->Print( indent, ")\n" );
+}
+
+
+//-----< PART objects >------------------------------------------------------
+
+
+void PROPERTY::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ wxASSERT( owner ); // all PROPERTYs should have an owner.
+
+ int i;
+ for( i = PART::REFERENCE; i < PART::END; ++i )
+ {
+ if( owner->Field( PART::PROP_ID(i) ) == this )
+ break;
+ }
+
+ if( i < PART::END ) // is a field not a property
+ out->Print( indent, "(%s", TO_UTF8( name ) );
+ else
+ out->Print( indent, "(property %s", out->Quotew( name ).c_str() );
+
+ if( effects )
+ {
+ out->Print( 0, " %s\n", out->Quotew( text ).c_str() );
+ effects->Format( out, indent+1, ctl | CTL_OMIT_NL );
+ out->Print( 0, ")\n" );
+ }
+ else
+ {
+ out->Print( 0, " %s)\n", out->Quotew( text ).c_str() );
+ }
+}
+
+
+TEXT_EFFECTS* PROPERTY::EffectsLookup()
+{
+ if( !effects )
+ {
+ effects = new TEXT_EFFECTS();
+ }
+
+ return effects;
+}
+
+
+void TEXT_EFFECTS::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ if( propName.IsEmpty() )
+ out->Print( indent, "(effects " );
+ else
+ out->Print( indent, "(effects %s ", out->Quotew( propName ).c_str() );
+
+ formatAt( out, pos, angle );
+
+ font.Format( out, 0, ctl | CTL_OMIT_NL );
+
+ out->Print( 0, "(visible %s))%s",
+ isVisible ? "yes" : "no",
+ ctl & CTL_OMIT_NL ? "" : "\n" );
+}
+
+
+void FONT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ if( italic || bold || !name.IsEmpty() || size.height != FONTZ_DEFAULT || size.width != FONTZ_DEFAULT )
+ {
+ if( name.IsEmpty() )
+ out->Print( indent, "(font " );
+ else
+ out->Print( indent, "(font %s ", out->Quotew( name ).c_str() );
+
+ out->Print( 0, "(size %.6g %.6g)",
+ InternalToFontz( size.height ),
+ InternalToFontz( size.width ) );
+
+ if( italic )
+ out->Print( 0, " italic" );
+
+ if( bold )
+ out->Print( 0, " bold" );
+
+ out->Print( 0, ")%s", (ctl & CTL_OMIT_NL) ? "" : "\n" );
+ }
+}
+
+
+void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ bool hasSignal = !signal.text.IsEmpty();
+ bool hasPad = !pad.text.IsEmpty();
+
+ out->Print( indent, "(pin" );
+
+ if( connectionType != PIN_CONN_DEFAULT )
+ out->Print( 0, " %s", ShowType() );
+
+ if( shape != PIN_SHAPE_DEFAULT )
+ out->Print( 0, " %s", ShowShape() );
+
+ out->Print( 0, " " );
+
+ if( pos.x || pos.y || angle )
+ formatAt( out, pos, angle );
+
+ if( length != PIN_LEN_DEFAULT )
+ out->Print( 0, "(length %.6g)", InternalToLogical( length ) );
+
+ if( !isVisible )
+ out->Print( 0, "(visible %s)", isVisible ? "yes" : "no" );
+
+ if( hasSignal )
+ signal.Format( out, "signal", 0, CTL_OMIT_NL );
+
+ if( hasPad )
+ pad.Format( out, "pad", 0, CTL_OMIT_NL );
+
+ out->Print( 0, ")\n" );
+}
+
+
+PIN::~PIN()
+{
+}
+
+
+void PINTEXT::Format( OUTPUTFORMATTER* out, const char* aElement, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ out->Print( indent, "(%s %s", aElement, out->Quotew( text ).c_str() );
+
+ font.Format( out, 0, CTL_OMIT_NL );
+
+ if( !isVisible )
+ out->Print( 0, " (visible %s)", isVisible ? "yes" : "no" );
+
+ out->Print( 0, ")%s", ctl & CTL_OMIT_NL ? "" : "\n" );
+}
+
+
+void POLY_LINE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ out->Print( indent, "(%s ", pts.size() == 2 ? "line" : "polyline" );
+ formatContents( out, indent, ctl );
+}
+
+
+void POLY_LINE::formatContents( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ formatStroke( out, stroke );
+
+ if( fillType != PR::T_none )
+ out->Print( 0, "(fill %s)", ShowFill( fillType ) );
+
+ out->Print( 0, "\n" );
+
+ if( pts.size() )
+ {
+ const int maxLength = 75;
+ int len = 10;
+
+ len += out->Print( indent+1, "(pts " );
+
+ for( POINTS::const_iterator it = pts.begin(); it != pts.end(); ++it )
+ {
+ if( len > maxLength )
+ {
+ len = 10;
+ out->Print( 0, "\n" );
+ out->Print( indent+2, "(xy %.6g %.6g)",
+ InternalToLogical( it->x ), InternalToLogical( it->y ) );
+ }
+ else
+ out->Print( 0, "(xy %.6g %.6g)",
+ InternalToLogical( it->x ), InternalToLogical( it->y ) );
+ }
+
+ out->Print( 0, ")" );
+ }
+
+ out->Print( 0, ")\n" );
+}
+
+
+void BEZIER::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ out->Print( indent, "(bezier " );
+ formatContents( out, indent, ctl ); // inherited from POLY_LINE
+}
+
+
+void RECTANGLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ // (rectangle (start X Y) (end X Y) [(stroke WIDTH)] (fill FILL_TYPE))
+
+ out->Print( indent, "(rectangle (start %.6g %.6g)(end %.6g %.6g)",
+ InternalToLogical( start.x ), InternalToLogical( start.y ),
+ InternalToLogical( end.x ), InternalToLogical( end.y )
+ );
+
+ formatStroke( out, stroke );
+
+ if( fillType != PR::T_none )
+ out->Print( 0, "(fill %s)", ShowFill( fillType ) );
+
+ out->Print( 0, ")\n" );
+}
+
+
+void CIRCLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ /*
+ (circle (center X Y)(radius LENGTH) [(stroke WIDTH)] (fill FILL_TYPE))
+ */
+
+ out->Print( indent, "(circle (center %.6g %.6g)(radius %.6g)",
+ InternalToLogical( center.x ), InternalToLogical( center.y ),
+ InternalToLogical( radius) );
+
+ formatStroke( out, stroke );
+
+ if( fillType != PR::T_none )
+ out->Print( 0, "(fill %s)", ShowFill( fillType ) );
+
+ out->Print( 0, ")\n" );
+}
+
+
+void ARC::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ /*
+ (arc (pos X Y)(radius RADIUS)(start X Y)(end X Y) [(stroke WIDTH)] (fill FILL_TYPE))
+ */
+
+ out->Print( indent, "(arc (pos %.6g %.6g)(radius %.6g)(start %.6g %.6g)(end %.6g %.6g)",
+ InternalToLogical( pos.x ), InternalToLogical( pos.y ),
+ InternalToLogical( radius),
+ InternalToLogical( start.x ), InternalToLogical( start.y ),
+ InternalToLogical( end.x ), InternalToLogical( end.y )
+ );
+
+ formatStroke( out, stroke );
+
+ if( fillType != PR::T_none )
+ out->Print( 0, "(fill %s)", ShowFill( fillType ) );
+
+ out->Print( 0, ")\n" );
+}
+
+
+void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
+ throw( IO_ERROR )
+{
+ /*
+ (text "This is the text that gets drawn."
+ (at X Y [ANGLE])(justify HORIZONTAL_JUSTIFY VERTICAL_JUSTIFY)(visible YES)(fill FILL_TYPE)
+ (font [FONT] (size HEIGHT WIDTH) [italic] [bold])
+ )
+ */
+
+ out->Print( indent, "(text %s\n", out->Quotew( text ).c_str() );
+
+ formatAt( out, pos, angle, indent+1 );
+
+ if( hjustify != PR::T_left || vjustify != PR::T_bottom )
+ out->Print( 0, "(justify %s %s)",
+ ShowJustify( hjustify ), ShowJustify( vjustify ) );
+
+ if( !isVisible )
+ out->Print( 0, "(visible %s)", isVisible ? "yes" : "no" );
+
+ if( fillType != PR::T_filled )
+ out->Print( 0, "(fill %s)", ShowFill( fillType ) );
+
+ font.Format( out, 0, CTL_OMIT_NL );
+ out->Print( 0, ")\n" );
+}
+
diff --git a/new/sch_part.h b/new/sch_part.h
new file mode 100644
index 0000000..2340ff4
--- /dev/null
+++ b/new/sch_part.h
@@ -0,0 +1,908 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+#ifndef SCH_PART_H_
+#define SCH_PART_H_
+
+#include <sch_lib.h>
+#include <sch_lib_table.h>
+#include <sch_lpid.h>
+//#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
+
+
+#define INTERNAL_PER_LOGICAL 10000 ///< no. internal units per logical unit
+
+
+/**
+ * Function InternalToLogical
+ * converts an internal coordinate to a logical coordinate. Logical coordinates
+ * are defined as the standard distance between pins being equal to one.
+ * Internal coordinates are currently INTERNAL_PER_LOGICAL times that.
+ */
+static inline double InternalToLogical( int aCoord )
+{
+ return double( aCoord ) / INTERNAL_PER_LOGICAL;
+}
+
+
+/**
+ * Function LogicalToInternal
+ * converts a logical coordinate to an internal coordinate. Logical coordinates
+ * are defined as the standard distance between pins being equal to one.
+ * Internal coordinates are currently INTERNAL_PER_LOGICAL times that.
+ */
+static inline int LogicalToInternal( double aCoord )
+{
+ return int( aCoord * INTERNAL_PER_LOGICAL );
+}
+
+static inline int WidthToInternal( double aWidth )
+{
+ // sweet line widths are a "percent of a logical unit"
+ return LogicalToInternal( aWidth ) / 100;
+}
+
+static inline double InternalToWidth( int aWidth )
+{
+ // sweet line widths are a "percent of a logical unit"
+ return InternalToLogical( aWidth ) * 100;
+}
+
+static inline int FontzToInternal( double aFontSize )
+{
+ // sweet font sizes are deci-pins
+ return LogicalToInternal( aFontSize ) / 10;
+}
+
+static inline double InternalToFontz( int aFontSize )
+{
+ // sweet font sizes are deci-pins
+ return InternalToLogical( aFontSize ) * 10;
+}
+
+
+//-----<temporary home for PART sub objects, move after stable>------------------
+
+#include <wx/gdicmn.h>
+#include <deque>
+#include <vector>
+#include <set>
+#include <sweet_lexer.h>
+
+class OUTPUTFORMATTER;
+
+/// Control Bits for Format() functions
+#define CTL_OMIT_NL (1<<0) ///< omit new line in Format()s.
+
+namespace SCH {
+
+class PART;
+class SWEET_PARSER;
+class PROPERTY;
+
+class POINT : public wxPoint
+{
+public:
+ POINT( int x, int y ) :
+ wxPoint( x, y )
+ {}
+
+ POINT( const POINT& r ) :
+ wxPoint( r )
+ {}
+
+ POINT() :
+ wxPoint()
+ {}
+
+ // assume assignment operator is inherited.
+};
+
+};
+
+/// a set of pin padnames that are electrically equivalent for a PART.
+typedef std::set< wxString > MERGE_SET;
+
+/// The key is the VISIBLE_PIN from
+/// (pin_merge VISIBLE_PIN (hide HIDDEN_PIN1 HIDDEN_PIN2...))
+typedef boost::ptr_map< wxString, MERGE_SET > MERGE_SETS;
+
+
+/**
+ * Class FONTZ
+ * is the size of a font, and comes with a constructor which initializes
+ * height and width to special values which defer font size decision to
+ * a higher control.
+ */
+class FONTZ
+{
+public:
+
+#define FONTZ_DEFAULT -1 ///< when size defers to higher control
+
+ FONTZ() :
+ height( FONTZ_DEFAULT ),
+ width( FONTZ_DEFAULT )
+ {}
+
+ int height;
+ int width;
+};
+
+
+typedef float ANGLE;
+typedef int STROKE; ///< will be a class someday, currently only line width
+
+
+namespace SCH {
+
+class FONT
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ wxString name; ///< name or other id such as number, TBD
+ FONTZ size;
+
+ bool italic;
+ bool bold;
+
+public:
+ FONT() :
+ italic( false ),
+ bold( false )
+ {}
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ // trust compiler to write its own assignment operator for this class OK.
+};
+
+
+struct TEXT_EFFECTS
+{
+ POINT pos;
+ ANGLE angle;
+ FONT font;
+ bool isVisible;
+
+ PROPERTY* property; ///< only used from a COMPONENT, specifies PROPERTY in PART
+ wxString propName; ///< only used from a COMPONENT, specifies PROPERTY in PART
+
+ TEXT_EFFECTS() :
+ angle( 0 ),
+ isVisible( false ),
+ property( 0 )
+ {}
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ // trust compiler to write its own assignment operator for this class OK.
+};
+
+
+#define STROKE_DEFAULT -1 ///< defer line width decision to higher control
+
+#define FILL_TYPE_DEFAULT PR::T_none ///< fillType defaut
+
+class BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ PART* owner;
+ PART* birthplace; ///< at which PART in inheritance chain was 'this' added
+
+public:
+ BASE_GRAPHIC( PART* aOwner ) :
+ owner( aOwner ),
+ birthplace( aOwner )
+ {}
+
+ virtual ~BASE_GRAPHIC() {}
+
+ /**
+ * Function Clone
+ * invokes the copy constructor on a heap allocated object of this same
+ * type and creates a deep copy of 'this' into it
+ * @param aOwner is the owner of the returned, new object.
+ */
+ virtual BASE_GRAPHIC* Clone( PART* aOwner ) const = 0;
+
+ static const char* ShowFill( int aFillType )
+ {
+ return SWEET_LEXER::TokenName( PR::T( aFillType ) );
+ }
+
+ /**
+ * Function Format
+ * outputs this object to @a aFormatter in s-expression form.
+ */
+ virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR )
+ {}
+};
+
+
+typedef std::deque<POINT> POINTS;
+
+class POLY_LINE : public BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ STROKE stroke;
+ int fillType; // T_none, T_filled, or T_transparent
+ POINTS pts;
+
+ void formatContents( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+public:
+ POLY_LINE( PART* aOwner ) :
+ BASE_GRAPHIC( aOwner ),
+ stroke( STROKE_DEFAULT ),
+ fillType( PR::T_none )
+ {
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ POLY_LINE* n = new POLY_LINE( *this );
+ n->owner = aOwner;
+ return n;
+ }
+};
+
+
+class BEZIER : public POLY_LINE
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+public:
+ BEZIER( PART* aOwner ) :
+ POLY_LINE( aOwner )
+ {
+ stroke = STROKE_DEFAULT;
+ fillType = PR::T_none;
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ BEZIER* n = new BEZIER( *this );
+ n->owner = aOwner;
+ return n;
+ }
+};
+
+
+class RECTANGLE : public BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ STROKE stroke;
+ int fillType; // T_none, T_filled, or T_transparent
+ POINT start;
+ POINT end;
+
+public:
+ RECTANGLE( PART* aOwner ) :
+ BASE_GRAPHIC( aOwner ),
+ stroke( STROKE_DEFAULT ),
+ fillType( FILL_TYPE_DEFAULT )
+ {
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ RECTANGLE* n = new RECTANGLE( *this );
+ n->owner = aOwner;
+ return n;
+ }
+};
+
+
+class CIRCLE : public BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ POINT center;
+ int radius;
+ STROKE stroke;
+ int fillType; // T_none, T_filled, or T_transparent
+
+public:
+ CIRCLE( PART* aOwner ) :
+ BASE_GRAPHIC( aOwner ),
+ radius( LogicalToInternal( 0.5 ) ),
+ stroke( STROKE_DEFAULT ),
+ fillType( FILL_TYPE_DEFAULT )
+ {
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ CIRCLE* n = new CIRCLE( *this );
+ n->owner = aOwner;
+ return n;
+ }
+};
+
+
+class ARC : public BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ POINT pos;
+ STROKE stroke;
+ int fillType; // T_none, T_filled, or T_transparent
+ int radius;
+ POINT start;
+ POINT end;
+
+public:
+ ARC( PART* aOwner ) :
+ BASE_GRAPHIC( aOwner ),
+ stroke( STROKE_DEFAULT ),
+ fillType( FILL_TYPE_DEFAULT ),
+ radius( LogicalToInternal( 0.5 ) )
+ {
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ ARC* n = new ARC( *this );
+ n->owner = aOwner;
+ return n;
+ }
+};
+
+
+class GR_TEXT : public BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ POINT pos;
+ ANGLE angle;
+
+ int fillType; ///< T_none, T_filled, or T_transparent
+
+ int hjustify; ///< T_center, T_right, or T_left
+ int vjustify; ///< T_center, T_top, or T_bottom
+
+ bool isVisible;
+ wxString text;
+ FONT font;
+
+public:
+ GR_TEXT( PART* aOwner ) :
+ BASE_GRAPHIC( aOwner ),
+ angle( 0 ),
+ fillType( PR::T_filled ),
+ hjustify( PR::T_left ),
+ vjustify( PR::T_bottom ),
+ isVisible( true )
+ {}
+
+ static const char* ShowJustify( int aJustify )
+ {
+ return SWEET_LEXER::TokenName( PR::T( aJustify ) );
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ GR_TEXT* n = new GR_TEXT( *this );
+ n->owner = aOwner;
+ return n;
+ }
+};
+
+
+class PROPERTY : public BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+protected:
+ wxString name;
+ wxString text;
+ TEXT_EFFECTS* effects;
+
+ void clear()
+ {
+ delete effects;
+ effects = 0;
+
+ name = wxEmptyString;
+ text = wxEmptyString;
+ }
+
+public:
+ PROPERTY( PART* aOwner, const wxChar* aName = wxT( "" ) ) :
+ BASE_GRAPHIC( aOwner ),
+ name( aName ),
+ effects( 0 )
+ {}
+
+ PROPERTY( const PROPERTY& r ) :
+ BASE_GRAPHIC( NULL ),
+ effects( 0 )
+ {
+ // use assignment operator
+ *this = r;
+ }
+
+ PROPERTY& operator = ( const PROPERTY& r ); // @todo
+
+ ~PROPERTY()
+ {
+ clear();
+ }
+
+ /**
+ * Function Effects
+ * returns a pointer to the TEXT_EFFECTS object for this PROPERTY, and optionally
+ * will lazily allocate one if it did not exist previously.
+ * @param doAlloc if true, means do an allocation of a new TEXT_EFFECTS if one
+ * currently does not exist, otherwise return NULL if non-existent.
+ */
+ TEXT_EFFECTS* EffectsLookup();
+ TEXT_EFFECTS* Effects() const
+ {
+ return effects;
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ PROPERTY* n = new PROPERTY( *this );
+ n->owner = aOwner;
+ return n;
+ }
+};
+
+
+struct PINTEXT
+{
+ wxString text;
+ FONT font;
+ bool isVisible;
+
+ PINTEXT() :
+ isVisible( true )
+ {}
+
+ void Format( OUTPUTFORMATTER* aFormatter, const char* aElement, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+};
+
+
+#define PIN_LEN_DEFAULT -1 ///< use standard pin length for given type
+#define PIN_SHAPE_DEFAULT PR::T_line ///< use standard pin shape
+#define PIN_CONN_DEFAULT PR::T_in ///< use standard pin connection type
+
+class PIN : public BASE_GRAPHIC
+{
+ friend class PART;
+ friend class SWEET_PARSER;
+
+public:
+ PIN( PART* aOwner ) :
+ BASE_GRAPHIC( aOwner ),
+ angle( 0 ),
+ connectionType( PIN_CONN_DEFAULT ),
+ shape( PIN_SHAPE_DEFAULT ),
+ length( PIN_LEN_DEFAULT ),
+ isVisible( true )
+ {}
+
+ ~PIN();
+
+ const char* ShowType() const
+ {
+ return SWEET_LEXER::TokenName( PR::T( connectionType ) );
+ }
+
+ const char* ShowShape() const
+ {
+ return SWEET_LEXER::TokenName( PR::T( shape ) );
+ }
+
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
+ throw( IO_ERROR );
+
+ BASE_GRAPHIC* Clone( PART* aOwner ) const
+ {
+ PIN* n = new PIN( *this );
+ n->owner = aOwner;
+ return n;
+ }
+
+protected:
+ POINT pos;
+ ANGLE angle;
+
+ PINTEXT pad;
+ PINTEXT signal;
+
+ int connectionType; ///< T_in, T_out, T_inout, T_tristate, T_passive, T_unspecified,
+ ///< T_power_in, T_power_out, T_open_collector, T_open_emitter, or T_unconnected.
+
+ int shape; ///< T_none, T_line, T_inverted, T_clock, T_inverted_clk, T_input_low, T_clock_low,
+ ///< T_falling_edge, T_non_logic.
+
+ int length; ///< length of pin in internal units
+ bool isVisible; ///< pin is visible
+
+ wxString pin_merge; ///< pad of (pin_merge ...) that I am a member of, else empty if none
+};
+
+
+/**
+ * Class PART_REF
+ * is an LPID with a pointer to the "looked up" PART, which is looked up lazily.
+ */
+class PART_REF : public LPID
+{
+public:
+ PART_REF() :
+ LPID(),
+ part(0)
+ {}
+
+ /**
+ * Constructor LPID
+ * takes aLPID string and parses it. A typical LPID string uses a logical
+ * library name followed by a part name.
+ * e.g.: "kicad:passives/R/rev2", or
+ * e.g.: "mylib:R33"
+ */
+ PART_REF( const STRING& aLPID ) throw( PARSE_ERROR ) :
+ LPID( aLPID ),
+ part(0)
+ {
+ }
+
+ /**
+ * Function Lookup
+ * returns the PART that this LPID refers to. Never returns NULL, because
+ * instead an exception would be thrown.
+ * @throw IO_ERROR if any problem occurs or if the part cannot be found.
+ */
+ PART* Lookup( LIB_TABLE* aLibTable, LIB* aFallBackLib ) throw( IO_ERROR )
+ {
+ if( !part )
+ {
+ part = aLibTable->LookupPart( *this, aFallBackLib );
+ }
+ return part;
+ }
+
+protected:
+ PART* part; ///< The looked-up PART,
+ ///< no ownership (duh, PARTs are always owned by a LIB)
+};
+
+typedef std::vector<PART_REF> PART_REFS;
+
+} // namespace SCH
+
+
+//-----</temporary home for PART sub objects, move after stable>-----------------
+
+
+typedef std::set< wxString > KEYWORDS;
+
+namespace SCH {
+
+typedef std::vector< BASE_GRAPHIC* > GRAPHICS;
+typedef std::vector< PROPERTY* > PROPERTIES;
+
+typedef std::vector< PIN* > PINS;
+typedef std::vector< PIN* > PIN_LIST; ///< no ownership, used for searches
+
+
+class LPID;
+class SWEET_PARSER;
+
+
+/**
+ * Class PART
+ * will have to be unified with what Wayne is doing. I want a separate copy
+
+ * here until I can get the state management correct. Since a PART only lives
+ * within a cache called a LIB, its constructor is private (only a LIB
+ * can instantiate one), and it exists in various states of freshness and
+ * completeness relative to the LIB_SOURCE within the LIB.
+ */
+class PART
+{
+ friend class LIB; // is the owner of all PARTS, afterall
+ friend class SWEET_PARSER;
+
+public:
+
+ /**
+ * Enum PROP_ID
+ * is the set of "mandatory" properties within a PART. These are used by
+ * class PART as array indices into PART::mandatory[].
+ */
+ enum PROP_ID
+ {
+ REFERENCE, ///< reference prefix, a template for instantiation at COMPONENT level
+ VALUE, ///< value, e.g. "3.3K"
+ FOOTPRINT, ///< name of PCB module, e.g. "16DIP300"
+ DATASHEET, ///< URI of datasheet
+ MODEL, ///< spice model name
+ END ///< array sentinel, not a valid index
+ };
+
+ virtual ~PART();
+
+ PART& operator = ( const PART& other );
+
+ /**
+ * Function Owner
+ * returns the LIB* owner of this part.
+ */
+ LIB* Owner() { return owner; }
+
+ /**
+ * Function Parse
+ * translates a Sweet string into a binary form that is represented
+ * by the normal fields of this class. Parse is expected to call Inherit()
+ * if this part extends any other.
+ *
+ * @param aParser is an instance of SWEET_PARSER, rewound at the first line.
+ *
+ * @param aLibTable is the LIB_TABLE "view" that is in effect for inheritance,
+ * and comes from the big containing SCHEMATIC object.
+ */
+ void Parse( SWEET_PARSER* aParser, LIB_TABLE* aLibTable ) throw( IO_ERROR, PARSE_ERROR );
+
+ /**
+ * Function Format
+ * outputs this PART in UTF8 encoded s-expression format to @a aFormatter.
+ * @param aFormatter is the output sink to write to.
+ * @param aNestLevel is the initial indent level
+ * @param aControlBits are bit flags ORed together which control how the output
+ * is done.
+ */
+ void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits = 0 ) const
+ throw( IO_ERROR );
+
+ /**
+ * Function PropDelete
+ * deletes the property with aPropertyName if found and returns true, else false
+ * if not found.
+ */
+ bool PropDelete( const wxString& aPropertyName );
+
+ /**
+ * Function Field
+ * returns a pointer to one of the mandatory properties, or NULL
+ * if non-existent. Use FieldLookup() to potentially allocate it.
+ */
+ PROPERTY* Field( PROP_ID aPropertyId ) const
+ {
+ wxASSERT( unsigned(aPropertyId) < unsigned(END) );
+ return mandatory[aPropertyId];
+ }
+
+ /**
+ * Function FieldLookup
+ * returns a pointer to one of the mandatory properties, which is lazily
+ * constructed by this function if need be.
+ * @param aPropertyId tells which field.
+ */
+ PROPERTY* FieldLookup( PROP_ID aPropertyId );
+
+ /**
+ * Function PinFindByPad
+ * finds a PIN based on aPad or returns NULL if not found.
+ * @param aPad is the pin to find
+ * @return PIN* - the found PIN or NULL if not found.
+ */
+ PIN* PinFindByPad( const wxString& aPad )
+ {
+ PINS::iterator it = pinFindByPad( aPad );
+ return it != pins.end() ? *it : NULL;
+ }
+
+ /**
+ * Function PinsFindBySignal
+ * fetches all the pins matching aSignal into aResults.
+ */
+ void PinsFindBySignal( PIN_LIST* aResults, const wxString& aSignal );
+
+ /**
+ * Function PinDelete
+ * deletes the pin with aPad if found and returns true, else false
+ * if not found.
+ */
+ bool PinDelete( const wxString& aPad );
+
+
+/*
+ void SetValue( const wxString& aValue )
+ {
+ value = aValue;
+ }
+ const wxString& GetValue()
+ {
+ return value;
+ }
+
+ void SetFootprint( const wxString& aFootprint )
+ {
+ footprint = aFootprint;
+ }
+ const wxString& GetFootprint()
+ {
+ return footprint;
+ }
+
+ void SetModel( const wxString& aModel )
+ {
+ model = aModel;
+ }
+ const wxString& GetModel()
+ {
+ return model;
+ }
+*/
+
+/*
+ void SetBody( const STR_UTF& aSExpression )
+ {
+ body = aSExpression;
+ }
+*/
+
+
+protected: // not likely to have C++ descendants, but protected none-the-less.
+
+ /// a protected constructor, only a LIB can instantiate a PART.
+ PART( LIB* aOwner, const STRING& aPartNameAndRev );
+
+ /**
+ * Function destroy
+ * clears out this object, deleting everything that this PART owns and
+ * initializing values back to a state as if the object was just constructed
+ * empty.
+ */
+ void clear();
+
+ /**
+ * Function inherit
+ * is a specialized assignment function that copies a specific subset, enough
+ * to fulfill the requirements of the Sweet s-expression language.
+ */
+ void inherit( const PART& aBasePart );
+
+ /**
+ * Function propertyFind
+ * searches for aPropertyName and returns a PROPERTIES::iterator which
+ * is the found item or properties.end() if not found.
+ */
+ PROPERTIES::iterator propertyFind( const wxString& aPropertyName );
+
+ /**
+ * Function pinFindByPad
+ * searches for a PIN with aPad and returns a PROPERTIES::iterator which
+ * is the found item or pins.end() if not found.
+ */
+ PINS::iterator pinFindByPad( const wxString& aPad );
+
+ LIB* owner; ///< which LIB am I a part of (pun if you want)
+ int contains; ///< has bits from Enum PartParts
+
+ STRING partNameAndRev; ///< example "passives/R[/revN..]", immutable.
+
+ LPID* extends; ///< of base part, NULL if none, otherwise I own it.
+ const PART* base; ///< which PART am I extending, if any. no ownership.
+
+ POINT anchor;
+
+ /// encapsulate the old version deletion, take ownership of @a aLPID
+ void setExtends( LPID* aLPID );
+
+ /// s-expression text for the part, initially empty, and read in as this part
+ /// actually becomes cached in RAM.
+ STRING body;
+
+ /// mandatory properties, aka fields. Index into mandatory[] is PROP_ID.
+ PROPERTY* mandatory[END];
+
+ /**
+ * Member properties
+ * holds the non-mandatory properties.
+ */
+ PROPERTIES properties;
+
+ /**
+ * Member graphics
+ * owns : POLY_LINE, RECTANGLE, CIRCLE, ARC, BEZIER, and GR_TEXT objects.
+ */
+ GRAPHICS graphics;
+
+ /**
+ * Member pins
+ * owns all the PINs in pins.
+ */
+ PINS pins;
+
+ /// Alternate body forms.
+ PART_REFS alternates;
+
+ /// searching aids
+ KEYWORDS keywords;
+
+ /**
+ * A pin_merge set is a set of pins that are all electrically equivalent
+ * and whose anchor pin is the only one visible. The visible pin is the
+ * key in the MERGE_SETS boost::ptr_map::map
+ */
+ MERGE_SETS pin_merges;
+};
+
+} // namespace PART
+
+#endif // SCH_PART_
diff --git a/new/sch_sweet_parser.cpp b/new/sch_sweet_parser.cpp
new file mode 100644
index 0000000..f0be7bd
--- /dev/null
+++ b/new/sch_sweet_parser.cpp
@@ -0,0 +1,1561 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <sch_sweet_parser.h>
+#include <sch_part.h>
+#include <sch_lib_table.h>
+#include <sch_lpid.h>
+
+#include <macros.h>
+
+using namespace SCH;
+using namespace PR;
+
+
+#define MAX_INHERITANCE_NESTING 6 ///< max depth of inheritance, no problem going larger
+
+
+static inline int internal( const STRING& aCoord )
+{
+ return LogicalToInternal( strtod( aCoord.c_str(), NULL ) );
+}
+
+static inline int fromWidth( const STRING& aWidth )
+{
+ return WidthToInternal( strtod( aWidth.c_str(), NULL ) );
+}
+
+static inline int fromFontz( const STRING& aFontSize )
+{
+ return FontzToInternal( strtod( aFontSize.c_str(), NULL ) );
+}
+
+
+/**
+ * Enum PartBit
+ * is a set of bit positions that can be used to create flag bits within
+ * PART::contains to indicate what state the PART is in and what it contains, i.e.
+ * whether the PART has been parsed, and what the PART contains, categorically.
+ */
+enum PartBit
+{
+ parsed, ///< have parsed this part already, otherwise 'body' text must be parsed
+ extends, ///< saw "extends" keyword, inheriting from another PART
+ value,
+ anchor,
+ reference,
+ footprint,
+ datasheet,
+ model,
+ keywords,
+};
+
+
+/// Function PB
+/// is a PartBit shifter for PART::contains field.
+static inline const int PB( PartBit oneBitOnly )
+{
+ return ( 1 << oneBitOnly );
+}
+
+
+void SWEET_PARSER::Parse( PART* me, LIB_TABLE* aTable ) throw( IO_ERROR, PARSE_ERROR )
+{
+ T tok;
+
+ libs = aTable;
+
+ // empty everything out, could be re-parsing this object and it may not be empty.
+ me->clear();
+
+#if 0
+ // Be flexible regarding the starting point of the stream.
+ // Caller may not have read the first two tokens out of the
+ // stream: T_LEFT and T_part, so ignore them if seen here.
+ // The 1st two tokens T_LEFT and T_part are then optional in the grammar.
+ if( ( tok = NextTok() ) == T_LEFT )
+ {
+ if( ( tok = NextTok() ) != T_part )
+ Expecting( T_part );
+ }
+
+#else
+ // "( part" are not optional
+ NeedLEFT();
+
+ if( ( tok = NextTok() ) != T_part )
+ Expecting( T_part );
+#endif
+
+ NeedSYMBOLorNUMBER(); // toss NAME_HINT
+ tok = NextTok();
+
+ // extends must be _first_ thing, if it is present at all, after NAME_HINT
+ if( tok == T_extends )
+ {
+ parseExtends( me );
+ tok = NextTok();
+ }
+
+ for( ; tok!=T_RIGHT; tok = NextTok() )
+ {
+ if( tok == T_LEFT )
+ {
+ PROPERTY* prop;
+
+ tok = NextTok();
+
+ // because exceptions are thrown, any 'new' allocation has to be stored
+ // somewhere other than on the stack, ASAP.
+
+ switch( tok )
+ {
+ default:
+ // describe what we expect at this level
+ Expecting(
+ "anchor|value|footprint|model|keywords|alternates\n"
+ "|property\n"
+ " |property_del\n"
+ "|pin\n"
+ " |pin_merge|pin_swap|pin_renum|pin_rename|route_pin_swap\n"
+ "|polyline|line|rectangle|circle|arc|bezier|text"
+ );
+ break;
+
+ case T_anchor:
+ if( contains & PB(anchor) )
+ Duplicate( tok );
+ NeedNUMBER( "anchor x" );
+ me->anchor.x = internal( CurText() );
+ NeedNUMBER( "anchor y" );
+ me->anchor.y = internal( CurText() );
+ contains |= PB(anchor);
+ break;
+
+ case T_line:
+ case T_polyline:
+ POLY_LINE* pl;
+ pl = new POLY_LINE( me );
+ me->graphics.push_back( pl );
+ parsePolyLine( pl );
+ break;
+
+ case T_rectangle:
+ RECTANGLE* rect;
+ rect = new RECTANGLE( me );
+ me->graphics.push_back( rect );
+ parseRectangle( rect );
+ break;
+
+ case T_circle:
+ CIRCLE* circ;
+ circ = new CIRCLE( me );
+ me->graphics.push_back( circ );
+ parseCircle( circ );
+ break;
+
+ case T_arc:
+ ARC* arc;
+ arc = new ARC( me );
+ me->graphics.push_back( arc );
+ parseArc( arc );
+ break;
+
+ case T_bezier:
+ BEZIER* bezier;
+ bezier = new BEZIER( me );
+ me->graphics.push_back( bezier );
+ parseBezier( bezier );
+ break;
+
+ case T_text:
+ GR_TEXT* text;
+ text = new GR_TEXT( me );
+ me->graphics.push_back( text );
+ parseText( text );
+ break;
+
+ case T_property:
+ prop = new PROPERTY( me );
+ // @todo check for uniqueness
+ me->properties.push_back( prop );
+ NeedSYMBOLorNUMBER();
+ prop->name = FromUTF8();
+
+ L_prop:
+ NeedSYMBOLorNUMBER();
+ prop->text = FromUTF8();
+ tok = NextTok();
+ if( tok == T_LEFT )
+ {
+ tok = NextTok();
+ if( tok != T_effects )
+ Expecting( T_effects );
+ parseTextEffects( prop->EffectsLookup() );
+ NeedRIGHT();
+ }
+ else if( tok != T_RIGHT )
+ Expecting( ") | effects" );
+ break;
+
+ case T_property_del:
+ parsePropertyDel( me );
+ break;
+
+ // reference in a PART is incomplete, it is just the prefix of an
+ // unannotated reference. Only components have full reference designators.
+ case T_reference:
+ if( contains & PB(reference) )
+ Duplicate( tok );
+ contains |= PB(reference);
+ prop = me->FieldLookup( PART::REFERENCE );
+ goto L_prop;
+
+ case T_value:
+ if( contains & PB(value) )
+ Duplicate( tok );
+ contains |= PB(value);
+ prop = me->FieldLookup( PART::VALUE );
+ goto L_prop;
+
+ case T_footprint:
+ if( contains & PB(footprint) )
+ Duplicate( tok );
+ contains |= PB(footprint);
+ prop = me->FieldLookup( PART::FOOTPRINT );
+ goto L_prop;
+
+ case T_datasheet:
+ if( contains & PB(datasheet) )
+ Duplicate( tok );
+ contains |= PB(datasheet);
+ prop = me->FieldLookup( PART::DATASHEET );
+ goto L_prop;
+
+ case T_model:
+ if( contains & PB(model) )
+ Duplicate( tok );
+ contains |= PB(model);
+ prop = me->FieldLookup( PART::MODEL );
+ goto L_prop;
+
+ case T_keywords:
+ parseKeywords( me );
+ break;
+
+ case T_alternates:
+ // @todo: do we want to inherit alternates?
+ parseAlternates( me );
+ break;
+
+ case T_pin:
+ // @todo PADNAMEs must be unique
+ PIN* pin;
+ pin = new PIN( me );
+ me->pins.push_back( pin );
+ parsePin( pin );
+ break;
+
+ case T_pin_del:
+ parsePinDel( me );
+ break;
+
+ case T_pin_swap:
+ parsePinSwap( me );
+ break;
+
+ case T_pin_renum:
+ parsePinRenum( me );
+ break;
+
+ case T_pin_rename:
+ parsePinRename( me );
+ break;
+
+ case T_pin_merge:
+ parsePinMerge( me );
+ break;
+
+ /*
+ @todo
+
+ case T_route_pin_swap:
+ break;
+ */
+ }
+ }
+
+ else
+ {
+ switch( tok )
+ {
+ default:
+ Unexpected( tok );
+ }
+ }
+ }
+
+ contains |= PB(parsed);
+
+ me->contains |= contains;
+}
+
+
+void SWEET_PARSER::parseExtends( PART* me )
+{
+ PART* base;
+ int offset;
+
+ if( contains & PB(extends) )
+ Duplicate( T_extends );
+
+ NeedSYMBOLorNUMBER();
+ me->setExtends( new LPID() );
+
+ offset = me->extends->Parse( CurText() );
+ if( offset > -1 ) // -1 is success
+ THROW_PARSE_ERROR( _("invalid extends LPID"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() + offset );
+
+ base = libs->LookupPart( *me->extends, me->Owner() );
+
+ // we could be going in circles here, recursively, or too deep, set limits
+ // and disallow extending from self (even indirectly)
+ int extendsDepth = 0;
+ for( const PART* ancestor = base; ancestor && extendsDepth<MAX_INHERITANCE_NESTING;
+ ++extendsDepth, ancestor = ancestor->base )
+ {
+ if( ancestor == me )
+ {
+ THROW_PARSE_ERROR( _("'extends' may not have self as any ancestor"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+ }
+
+ if( extendsDepth == MAX_INHERITANCE_NESTING )
+ {
+ THROW_PARSE_ERROR( _("max allowed extends depth exceeded"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ me->inherit( *base );
+ me->base = base;
+ contains |= PB(extends);
+}
+
+
+void SWEET_PARSER::parseAlternates( PART* me )
+{
+ T tok;
+ PART_REF lpid;
+ int offset;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( !IsSymbol( tok ) && tok != T_NUMBER )
+ Expecting( "lpid" );
+
+ // lpid.clear(); Parse does this
+
+ offset = lpid.Parse( CurText() );
+ if( offset > -1 )
+ THROW_PARSE_ERROR( _("invalid alternates LPID"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() + offset );
+
+ // PART_REF assignment should be OK, it contains no ownership
+ me->alternates.push_back( lpid );
+ }
+}
+
+
+void SWEET_PARSER::parseKeywords( PART* me )
+{
+ T tok;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( !IsSymbol( tok ) && tok!=T_NUMBER )
+ Expecting( "symbol|number" );
+
+ // just insert them, duplicates are silently removed and tossed.
+ me->keywords.insert( FromUTF8() );
+ }
+}
+
+
+void SWEET_PARSER::parseFont( FONT* me )
+{
+ /*
+ # The FONT value needs to be defined. Currently, EESchema does not support
+ # different fonts. In the future this feature may be implemented and at
+ # that time FONT will have to be defined. Initially, only the font size and
+ # style are required. Italic and bold styles are optional. The font size
+ # height and width are in units yet to be determined.
+ (font [FONT] (size HEIGHT WIDTH) [italic] [bold])
+ */
+
+ // handle the [FONT] 'position dependently', i.e. first
+ T tok = NextTok();
+ bool sawBold = false;
+ bool sawItalic = false;
+ bool sawSize = false;
+
+ if( IsSymbol( tok ) )
+ {
+ me->name = FromUTF8();
+ tok = NextTok();
+ }
+
+ for( ; tok != T_RIGHT; tok = NextTok() )
+ {
+ if( tok == T_LEFT )
+ {
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_size:
+ if( sawSize )
+ Duplicate( T_size );
+ sawSize = true;
+
+ NeedNUMBER( "size height" );
+ me->size.height = fromFontz( CurText() );
+
+ NeedNUMBER( "size width" );
+ me->size.width = fromFontz( CurText() );
+ NeedRIGHT();
+ break;
+
+ default:
+ Expecting( "size" );
+ }
+ }
+ else
+ {
+ switch( tok )
+ {
+ case T_bold:
+ if( sawBold )
+ Duplicate( T_bold );
+ sawBold = true;
+ me->bold = true;
+ break;
+
+ case T_italic:
+ if( sawItalic )
+ Duplicate( T_italic );
+ sawItalic = true;
+ me->italic = true;
+ break;
+
+ default:
+ Unexpected( "bold|italic" );
+ }
+ }
+ }
+}
+
+
+void SWEET_PARSER::parseBool( bool* aBool )
+{
+ T tok = NeedSYMBOL();
+
+ switch( tok )
+ {
+ case T_yes:
+ case T_no:
+ *aBool = (tok == T_yes);
+ break;
+ default:
+ Expecting( "yes|no" );
+ }
+}
+
+
+void SWEET_PARSER::parseStroke( STROKE* me )
+{
+ /*
+ (stroke [WIDTH] [(style [(dashed...)]...)])
+
+ future place holder for arrow heads, dashed lines, all line glamour
+ */
+
+ NeedNUMBER( "stroke" );
+ *me = fromWidth( CurText() );
+ NeedRIGHT();
+}
+
+
+void SWEET_PARSER::parsePinText( PINTEXT* me )
+{
+ /* either:
+ (signal SIGNAL (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
+ or
+ (pad PADNAME (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
+ */
+ T tok;
+ bool sawFont = false;
+ bool sawVis = false;
+
+ // pad or signal text
+ NeedSYMBOLorNUMBER();
+ me->text = FromUTF8();
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok == T_LEFT )
+ {
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_font:
+ if( sawFont )
+ Duplicate( tok );
+ sawFont = true;
+ parseFont( &me->font );
+ break;
+
+ case T_visible:
+ if( sawVis )
+ Duplicate( tok );
+ sawVis = true;
+ parseBool( &me->isVisible );
+ NeedRIGHT();
+ break;
+
+ default:
+ Expecting( "font" );
+ }
+ }
+
+ else
+ {
+ switch( tok )
+ {
+ default:
+ Expecting( T_LEFT );
+ }
+ }
+ }
+}
+
+
+void SWEET_PARSER::parsePin( PIN* me )
+{
+ /*
+ (pin TYPE SHAPE
+ (at X Y [ANGLE])
+ (length LENGTH)
+ (signal NAME (font [FONT] (size HEIGHT WIDTH) [italic] [bold])(visible YES))
+ (pad NUMBER (font [FONT] (size HEIGHT WIDTH) [italic] [bold] (visible YES))
+ (visible YES)
+ )
+ */
+
+ T tok;
+ bool sawShape = false;
+ bool sawType = false;
+ bool sawAt = false;
+ bool sawLen = false;
+ bool sawSignal = false;
+ bool sawPad = false;
+ bool sawVis = false;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok == T_LEFT )
+ {
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_at:
+ if( sawAt )
+ Duplicate( tok );
+ sawAt = true;
+ parseAt( &me->pos, &me->angle );
+ break;
+
+ case T_length:
+ if( sawLen )
+ Duplicate( tok );
+ sawLen = true;
+ NeedNUMBER( "length" );
+ me->length = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ case T_signal:
+ if( sawSignal )
+ Duplicate( tok );
+ sawSignal = true;
+ parsePinText( &me->signal );
+ break;
+
+ case T_pad:
+ if( sawPad )
+ Duplicate( tok );
+ sawPad = true;
+ parsePinText( &me->pad );
+ break;
+
+ case T_visible:
+ if( sawVis )
+ Duplicate( tok );
+ sawVis = true;
+ parseBool( &me->isVisible );
+ NeedRIGHT();
+ break;
+
+ default:
+ Unexpected( tok );
+ }
+ }
+
+ else // not wrapped in parentheses
+ {
+ switch( tok )
+ {
+ case T_in:
+ case T_out:
+ case T_inout:
+ case T_tristate:
+ case T_passive:
+ case T_unspecified:
+ case T_power_in:
+ case T_power_out:
+ case T_open_collector:
+ case T_open_emitter:
+ case T_unconnected:
+ if( sawType )
+ Duplicate( tok );
+ sawType = true;
+ me->connectionType = tok;
+ break;
+
+ case T_none:
+ case T_line:
+ case T_inverted:
+ case T_clock:
+ case T_inverted_clk:
+ case T_input_low:
+ case T_clock_low:
+ case T_falling_edge:
+ case T_non_logic:
+ if( sawShape )
+ Duplicate( tok );
+ sawShape = true;
+ me->shape = tok;
+ break;
+
+ default:
+ Unexpected( tok );
+ }
+ }
+ }
+}
+
+
+void SWEET_PARSER::parsePinDel( PART* me )
+{
+ wxString pad;
+
+ // we do this somewhat unorthodoxically because we want to avoid doing two lookups,
+ // which would need to be done to 1) find pin, and 2) delete pin. Only one
+ // lookup is needed with this scheme.
+
+ NeedSYMBOLorNUMBER();
+ pad = FromUTF8();
+
+ // lookup now while CurOffset() is still meaningful.
+ PINS::iterator it = me->pinFindByPad( pad );
+ if( it == me->pins.end() )
+ {
+ THROW_PARSE_ERROR( _("undefined pin"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+/* enable in future, but not now while testing
+ if( (*it)->birthplace == me )
+ {
+ THROW_PARSE_ERROR( _("pin_del allowed for inherited pins only"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+*/
+
+ NeedRIGHT();
+
+ delete *it; // good thing I'm a friend.
+ me->pins.erase( it );
+}
+
+
+void SWEET_PARSER::parsePinSwap( PART* me )
+{
+ PIN* pin1;
+ PIN* pin2;
+
+ wxString pad;
+
+ NeedSYMBOLorNUMBER();
+ pad = FromUTF8();
+
+ // lookup now while CurOffset() is still meaningful.
+ pin1 = me->PinFindByPad( pad );
+ if( !pin1 )
+ {
+ THROW_PARSE_ERROR( _("undefined pin"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ NeedSYMBOLorNUMBER();
+ pad = FromUTF8();
+
+ pin2 = me->PinFindByPad( pad );
+ if( !pin2 )
+ {
+ THROW_PARSE_ERROR( _("undefined pin"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ NeedRIGHT();
+
+ // swap only the text, but might want to swap entire PIN_TEXTs
+ pin2->pad.text = pin1->pad.text;
+ pin1->pad.text = pad;
+}
+
+
+void SWEET_PARSER::parsePinRenum( PART* me )
+{
+ PIN* pin;
+
+ wxString oldPad;
+ wxString newPad;
+
+ NeedSYMBOLorNUMBER();
+ oldPad = FromUTF8();
+
+ // lookup now while CurOffset() is still meaningful.
+ pin = me->PinFindByPad( oldPad );
+ if( !pin )
+ {
+ THROW_PARSE_ERROR( _("undefined pin"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ NeedSYMBOLorNUMBER();
+ newPad = FromUTF8();
+
+ NeedRIGHT();
+
+ // @todo: check for pad legalities
+ pin->pad.text = newPad;
+}
+
+
+void SWEET_PARSER::parsePinRename( PART* me )
+{
+ PIN* pin;
+
+ wxString pad;
+ wxString newSignal;
+
+ NeedSYMBOLorNUMBER();
+ pad = FromUTF8();
+
+ // lookup now while CurOffset() is still meaningful.
+ pin = me->PinFindByPad( pad );
+ if( !pin )
+ {
+ THROW_PARSE_ERROR( _("undefined pin"),
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ NeedSYMBOLorNUMBER();
+ newSignal = FromUTF8();
+
+ NeedRIGHT();
+
+ pin->signal.text = newSignal;
+}
+
+
+void SWEET_PARSER::parsePinMerge( PART* me )
+{
+ T tok;
+ wxString pad;
+ wxString signal;
+ wxString msg;
+
+ NeedSYMBOLorNUMBER();
+
+ wxString anchorPad = FromUTF8();
+
+ // lookup now while CurOffset() is still good.
+ PINS::iterator pit = me->pinFindByPad( anchorPad );
+ if( pit == me->pins.end() )
+ {
+ msg.Printf( _( "undefined pin %s" ), anchorPad.GetData() );
+ THROW_PARSE_ERROR( msg,
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ if( !(*pit)->pin_merge.IsEmpty() && anchorPad != (*pit)->pin_merge )
+ {
+ msg.Printf( _( "pin %s already in pin_merge group %s" ),
+ anchorPad.GetData(), (*pit)->pin_merge.GetData() );
+
+ THROW_PARSE_ERROR( msg,
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ (*pit)->isVisible = true;
+ (*pit)->pin_merge = anchorPad;
+
+ // allocate or find a MERGE_SET;
+ MERGE_SET& ms = me->pin_merges[anchorPad];
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok == T_LEFT )
+ {
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_signals:
+ {
+ PINS sigPins; // no ownership
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( !IsSymbol( tok ) && tok != T_NUMBER )
+ Expecting( "signal" );
+
+ signal = FromUTF8();
+
+ sigPins.clear();
+
+ me->PinsFindBySignal( &sigPins, signal );
+
+ if( !sigPins.size() )
+ {
+ msg.Printf( _( "no pins with signal %s" ), signal.GetData() );
+ THROW_PARSE_ERROR( msg,
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ for( pit = sigPins.begin(); pit != sigPins.end(); ++pit )
+ {
+ if( !(*pit)->pin_merge.IsEmpty() && anchorPad != (*pit)->pin_merge )
+ {
+ msg.Printf( _( "signal pin %s already in pin_merge group %s" ),
+ pad.GetData(), (*pit)->pin_merge.GetData() );
+
+ THROW_PARSE_ERROR( msg,
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ (*pit)->isVisible = true;
+ (*pit)->pin_merge = anchorPad;
+ ms.insert( pad );
+ }
+ }
+ }
+ break;
+
+ case T_pads:
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( !IsSymbol( tok ) && tok != T_NUMBER )
+ Expecting( "pad" );
+
+ pad = FromUTF8();
+
+ D(printf("pad=%s\n", TO_UTF8( pad ) );)
+
+ // find the PIN and mark it as being in this MERGE_SET or throw
+ // error if already in another MERGET_SET.
+
+ pit = me->pinFindByPad( pad );
+ if( pit == me->pins.end() )
+ {
+ msg.Printf( _( "undefined pin %s" ), pad.GetData() );
+ THROW_PARSE_ERROR( msg,
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ if( !(*pit)->pin_merge.IsEmpty() /* && anchorPad != (*pit)->pin_merge */ )
+ {
+ msg.Printf( _( "pin %s already in pin_merge group %s" ),
+ pad.GetData(), (*pit)->pin_merge.GetData() );
+
+ THROW_PARSE_ERROR( msg,
+ CurSource(),
+ CurLine(),
+ CurLineNumber(),
+ CurOffset() );
+ }
+
+ (*pit)->isVisible = false;
+ (*pit)->pin_merge = anchorPad;
+
+ ms.insert( pad );
+ }
+ break;
+
+ default:
+ Expecting( "pads|signals" );
+ break;
+ }
+ }
+ else
+ {
+ Expecting( T_LEFT );
+ }
+ }
+}
+
+
+void SWEET_PARSER::parsePropertyDel( PART* me )
+{
+ NeedSYMBOLorNUMBER();
+
+ wxString propertyName = FromUTF8();
+
+ if( !me->PropDelete( propertyName ) )
+ {
+ wxString msg;
+ msg.Printf( _( "Unable to find property: %s" ), propertyName.GetData() );
+ THROW_IO_ERROR( msg );
+ }
+ NeedRIGHT();
+}
+
+
+void SWEET_PARSER::parseTextEffects( TEXT_EFFECTS* me )
+{
+ /*
+ (effects [PROPERTY]
+
+ # Position requires X and Y coordinates. Position coordinates can be
+ # non-intergr. Angle is in degrees and defaults to 0 if not defined.
+ (at X Y [ANGLE])
+
+ # The FONT value needs to be defined. Currently, EESchema does not support
+ # different fonts. In the future this feature may be implemented and at
+ # that time FONT will have to be defined. Initially, only the font size and
+ # style are required. Italic and bold styles are optional. The font size
+ # height and width are in units yet to be determined.
+ (font [FONT] (size HEIGHT WIDTH) [italic] [bold])
+
+ # Valid visibility values are yes and no.
+ (visible YES)
+ )
+ */
+
+ bool sawFont = false;
+ bool sawAt = false;
+ bool sawVis = false;
+
+ T tok = NextTok();
+
+ if( IsSymbol( tok ) )
+ {
+ me->propName = FromUTF8();
+ tok = NextTok();
+ }
+
+ for( ; tok != T_RIGHT; tok = NextTok() )
+ {
+ if( tok != T_LEFT )
+ Expecting( T_LEFT );
+
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_at:
+ if( sawAt )
+ Duplicate( tok );
+ sawAt = true;
+ parseAt( &me->pos, &me->angle );
+ break;
+
+ case T_font:
+ if( sawFont )
+ Duplicate( tok );
+ sawFont = true;
+ parseFont( &me->font );
+ break;
+
+ case T_visible:
+ if( sawVis )
+ Duplicate( sawVis );
+ sawVis = true;
+ parseBool( &me->isVisible );
+ NeedRIGHT();
+ break;
+
+ default:
+ Expecting( "at|font|visible" );
+ }
+ }
+}
+
+
+void SWEET_PARSER::parsePolyLine( POLY_LINE* me )
+{
+ /*
+ (polyline|line
+ (pts (xy X Y) (xy X Y) (xy X Y) (xy X Y) (xy X Y))
+
+ # Line widths are in percent of a pin delta
+ [(stroke [WIDTH] [(style [(dashed...)]...)])]
+
+
+ # Valid fill types are none, filled, and transparent.
+ (fill FILL_TYPE)
+ )
+ */
+
+ T tok;
+ int count = 0;
+ bool sawStroke = false;
+ bool sawFill = false;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok != T_LEFT )
+ Expecting( T_LEFT );
+
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_stroke:
+ if( sawStroke )
+ Duplicate( tok );
+ sawStroke = true;
+ parseStroke( &me->stroke );
+ break;
+
+ case T_pts:
+ if( count )
+ Duplicate( tok );
+ for( ; ( tok = NextTok() ) != T_RIGHT; ++count )
+ {
+ if( tok != T_LEFT )
+ Expecting( T_LEFT );
+
+ tok = NeedSYMBOL();
+ if( tok != T_xy )
+ Expecting( T_xy );
+
+ me->pts.push_back( POINT() );
+
+ NeedNUMBER( "x" );
+ me->pts.back().x = internal( CurText() );
+
+ NeedNUMBER( "y" );
+ me->pts.back().y = internal( CurText() );
+
+ NeedRIGHT();
+ }
+ if( count < 2 )
+ Expecting( ">= 2 pts" );
+ break;
+
+ case T_fill:
+ if( sawFill )
+ Duplicate( tok );
+ tok = NeedSYMBOL();
+ switch( tok )
+ {
+ case T_none:
+ case T_filled:
+ case T_transparent:
+ me->fillType = tok;
+ break;
+ default:
+ Expecting( "none|filled|transparent" );
+ }
+ NeedRIGHT();
+ sawFill = true;
+ break;
+
+ default:
+ Expecting( "pts|stroke|fill" );
+ }
+ }
+}
+
+
+void SWEET_PARSER::parseBezier( BEZIER* me )
+{
+ parsePolyLine( me );
+}
+
+
+void SWEET_PARSER::parseRectangle( RECTANGLE* me )
+{
+ /*
+ (rectangle (start X Y) (end X Y) (stroke WIDTH) (fill FILL_TYPE))
+ */
+
+ T tok;
+ bool sawStart = false;
+ bool sawEnd = false;
+ bool sawStroke = false;
+ bool sawFill = false;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok != T_LEFT )
+ Expecting( T_LEFT );
+
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_stroke:
+ if( sawStroke )
+ Duplicate( tok );
+ sawStroke = true;
+ parseStroke( &me->stroke );
+ break;
+
+ case T_fill:
+ if( sawFill )
+ Duplicate( tok );
+ sawFill = true;
+ tok = NeedSYMBOL();
+ switch( tok )
+ {
+ case T_none:
+ case T_filled:
+ case T_transparent:
+ me->fillType = tok;
+ break;
+ default:
+ Expecting( "none|filled|transparent" );
+ }
+ NeedRIGHT();
+ break;
+
+ case T_start:
+ if( sawStart )
+ Duplicate( tok );
+ sawStart = true;
+ NeedNUMBER( "x" );
+ me->start.x = internal( CurText() );
+ NeedNUMBER( "y" );
+ me->start.y = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ case T_end:
+ if( sawEnd )
+ Duplicate( tok );
+ sawEnd = true;
+ NeedNUMBER( "x" );
+ me->end.x = internal( CurText() );
+ NeedNUMBER( "y" );
+ me->end.y = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ default:
+ Expecting( "start|end|stroke|fill" );
+ }
+ }
+}
+
+
+void SWEET_PARSER::parseCircle( CIRCLE* me )
+{
+ /*
+ (circle (center X Y)
+ # Radius length is in units if defined or mils.
+ (radius LENGTH)
+ (stroke WIDTH)
+ (fill FILL_TYPE)
+ )
+ */
+
+ T tok;
+ bool sawCenter = false;
+ bool sawRadius = false;
+ bool sawStroke = false;
+ bool sawFill = false;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok != T_LEFT )
+ Expecting( T_LEFT );
+
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_stroke:
+ if( sawStroke )
+ Duplicate( tok );
+ sawStroke = true;
+ parseStroke( &me->stroke );
+ break;
+
+ case T_fill:
+ if( sawFill )
+ Duplicate( tok );
+ sawFill = true;
+ tok = NeedSYMBOL();
+ switch( tok )
+ {
+ case T_none:
+ case T_filled:
+ case T_transparent:
+ me->fillType = tok;
+ break;
+ default:
+ Expecting( "none|filled|transparent" );
+ }
+ NeedRIGHT();
+ break;
+
+ case T_center:
+ if( sawCenter )
+ Duplicate( tok );
+ sawCenter = true;
+ NeedNUMBER( "center x" );
+ me->center.x = internal( CurText() );
+ NeedNUMBER( "center y" );
+ me->center.y = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ case T_radius:
+ if( sawRadius )
+ Duplicate( tok );
+ sawRadius = true;
+ NeedNUMBER( "radius" );
+ me->radius = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ default:
+ Expecting( "center|radius|stroke|fill" );
+ }
+ }
+}
+
+
+void SWEET_PARSER::parseArc( ARC* me )
+{
+ /*
+ (arc (pos X Y) (radius RADIUS) (start X Y) (end X Y)
+ (stroke WIDTH)
+ (fill FILL_TYPE)
+ )
+ */
+
+ T tok;
+ bool sawPos = false;
+ bool sawStart = false;
+ bool sawEnd = false;
+ bool sawRadius = false;
+ bool sawStroke = false;
+ bool sawFill = false;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok != T_LEFT )
+ Expecting( T_LEFT );
+
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_stroke:
+ if( sawStroke )
+ Duplicate( tok );
+ sawStroke = true;
+ parseStroke( &me->stroke );
+ break;
+
+ case T_fill:
+ if( sawFill )
+ Duplicate( tok );
+ sawFill = true;
+ tok = NeedSYMBOL();
+ switch( tok )
+ {
+ case T_none:
+ case T_filled:
+ case T_transparent:
+ me->fillType = tok;
+ break;
+ default:
+ Expecting( "none|filled|transparent" );
+ }
+ NeedRIGHT();
+ break;
+
+ case T_pos:
+ if( sawPos )
+ Duplicate( tok );
+ sawPos = true;
+ NeedNUMBER( "pos x" );
+ me->pos.x = internal( CurText() );
+ NeedNUMBER( "pos y" );
+ me->pos.y = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ case T_radius:
+ if( sawRadius )
+ Duplicate( tok );
+ sawRadius = true;
+ NeedNUMBER( "radius" );
+ me->radius = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ case T_start:
+ if( sawStart )
+ Duplicate( tok );
+ sawStart = true;
+ NeedNUMBER( "start x" );
+ me->start.x = internal( CurText() );
+ NeedNUMBER( "start y" );
+ me->start.y = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ case T_end:
+ if( sawEnd )
+ Duplicate( tok );
+ sawEnd = true;
+ NeedNUMBER( "end x" );
+ me->end.x = internal( CurText() );
+ NeedNUMBER( "end y" );
+ me->end.y = internal( CurText() );
+ NeedRIGHT();
+ break;
+
+ default:
+ Expecting( "center|radius|stroke|fill" );
+ }
+ }
+}
+
+
+void SWEET_PARSER::parseAt( POINT* pos, float* angle )
+{
+ T tok;
+
+ NeedNUMBER( "at x" );
+ pos->x = internal( CurText() );
+
+ NeedNUMBER( "at y" );
+ pos->y = internal( CurText() );
+
+ tok = NextTok();
+ if( angle && tok == T_NUMBER )
+ {
+ *angle = strtod( CurText(), NULL );
+ tok = NextTok();
+ }
+ if( tok != T_RIGHT )
+ Expecting( T_RIGHT );
+}
+
+
+void SWEET_PARSER::parseText( GR_TEXT* me )
+{
+ /*
+ (text "This is the text that gets drawn."
+ (at X Y [ANGLE])
+
+ # Valid horizontal justification values are center, right, and left. Valid
+ # vertical justification values are center, top, bottom.
+ (justify HORIZONTAL_JUSTIFY VERTICAL_JUSTIFY)
+ (font [FONT] (size HEIGHT WIDTH) [italic] [bold])
+ (visible YES)
+ (fill FILL_TYPE)
+ )
+ */
+
+ T tok;
+ bool sawAt = false;
+ bool sawFill = false;
+ bool sawFont = false;
+ bool sawVis = false;
+ bool sawJust = false;
+ bool sawText = false;
+
+ while( ( tok = NextTok() ) != T_RIGHT )
+ {
+ if( tok == T_LEFT )
+ {
+ tok = NextTok();
+
+ switch( tok )
+ {
+ case T_at:
+ if( sawAt )
+ Duplicate( tok );
+ parseAt( &me->pos, &me->angle );
+ sawAt = true;
+ break;
+
+ case T_fill:
+ if( sawFill )
+ Duplicate( tok );
+ tok = NeedSYMBOL();
+ switch( tok )
+ {
+ case T_none:
+ case T_filled:
+ case T_transparent:
+ me->fillType = tok;
+ break;
+ default:
+ Expecting( "none|filled|transparent" );
+ }
+ NeedRIGHT();
+ sawFill = true;
+ break;
+
+ case T_justify:
+ if( sawJust )
+ Duplicate( tok );
+ tok = NeedSYMBOL();
+ switch( tok )
+ {
+ case T_center:
+ case T_right:
+ case T_left:
+ me->hjustify = tok;
+ break;
+ default:
+ Expecting( "center|right|left" );
+ }
+
+ tok = NeedSYMBOL();
+ switch( tok )
+ {
+ case T_center:
+ case T_top:
+ case T_bottom:
+ me->vjustify = tok;
+ break;
+ default:
+ Expecting( "center|top|bottom" );
+ }
+ NeedRIGHT();
+ sawJust = true;
+ break;
+
+ case T_visible:
+ if( sawVis )
+ Duplicate( tok );
+ parseBool( &me->isVisible );
+ NeedRIGHT();
+ sawVis = true;
+ break;
+
+ case T_font:
+ if( sawFont )
+ Duplicate( tok );
+ sawFont = true;
+ parseFont( &me->font );
+ break;
+
+ default:
+ Expecting( "at|justify|font|visible|fill" );
+ }
+ }
+ else
+ {
+ if( !IsSymbol( tok ) && tok != T_NUMBER )
+ Expecting( T_STRING );
+
+ if( sawText )
+ Duplicate( tok );
+ sawText = true;
+
+ me->text = wxString::FromUTF8( CurText() );
+ }
+ }
+}
+
diff --git a/new/sch_sweet_parser.h b/new/sch_sweet_parser.h
new file mode 100644
index 0000000..d5424f9
--- /dev/null
+++ b/new/sch_sweet_parser.h
@@ -0,0 +1,132 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SCH_SWEET_PARSER_H_
+#define SCH_SWEET_PARSER_H_
+
+#include <utf8.h>
+#include <sweet_lexer.h>
+
+
+typedef int STROKE;
+
+namespace SCH {
+
+class LIB_TABLE;
+class PART;
+class POINT;
+
+
+// GRAPHICS
+class POLY_LINE;
+class RECTANGLE;
+class CIRCLE;
+class ARC;
+class BEZIER;
+class GR_TEXT;
+class PIN;
+class FONT;
+class PROPERTY;
+
+struct PINTEXT;
+struct TEXT_EFFECTS;
+
+
+/**
+ * Class SWEET_PARSER
+ * scans a Sweet string as input and stuffs a PART.
+ * <p>
+ * Most functions in this class throw IO_ERROR and PARSE_ERROR. The IO_ERROR can
+ * happen if there is difficulty reading the input stream.
+ */
+class SWEET_PARSER : public SWEET_LEXER
+{
+ LIB_TABLE* libs;
+ int contains; // separate from PART::contains until done
+ // so we can see what we inherited from base PART
+
+ // all these private functions rely on libs having been set via the public API, Parse( PART*)
+
+ void parseExtends( PART* me );
+
+ void parsePolyLine( POLY_LINE* me );
+ void parseBezier( BEZIER* me );
+ void parseRectangle( RECTANGLE* me );
+ void parseCircle( CIRCLE* me );
+ void parseArc( ARC* me );
+ void parseText( GR_TEXT* me );
+ void parseAt( POINT* pos, float* angle );
+ void parseBool( bool* aBool );
+ void parseFont( FONT* me );
+ void parsePinText( PINTEXT* me );
+ void parseTextEffects( TEXT_EFFECTS* me );
+ void parseKeywords( PART* me );
+ void parseAlternates( PART* me );
+ void parsePropertyDel( PART* me );
+
+ void parsePin( PIN* me );
+ void parsePinDel( PART* me );
+ void parsePinSwap( PART* me );
+ void parsePinRenum( PART* me );
+ void parsePinRename( PART* me );
+ void parsePinMerge( PART* me );
+ void parseStroke( STROKE* me );
+
+public:
+
+ /**
+ * Constructor SWEET_PARSER
+ * takes aSweet string and gets ready to parse it.
+ * @param aSweet is the full description of a PART.
+ * @param aSource is used in error reporting and describes where the Sweet
+ * string came from in any appropriate way.
+ */
+ SWEET_PARSER( const STRING& aSweet, const wxString& aSource = wxEmptyString ) :
+ SWEET_LEXER( aSweet, aSource ),
+ libs( 0 ),
+ contains( 0 )
+ {
+ }
+
+ SWEET_PARSER( LINE_READER* aLineReader ) :
+ SWEET_LEXER( aLineReader ),
+ libs( 0 ),
+ contains( 0 )
+ {
+ }
+
+ /**
+ * Function Parse
+ * stuffs @a aPart with data from this SWEET_LEXER, which has its own
+ * sweet string source.
+ * @param aPart is what is to be stuffed.
+ * @param aTable is the view of the LIBs in play.
+ */
+ void Parse( PART* aPart, LIB_TABLE* aTable ) throw( IO_ERROR, PARSE_ERROR );
+};
+
+} // namespace SCH
+
+#endif // SCH_SWEET_PARSER_H_
+
diff --git a/new/sweet.i b/new/sweet.i
new file mode 100644
index 0000000..2ce1ad9
--- /dev/null
+++ b/new/sweet.i
@@ -0,0 +1,38 @@
+/**
+ * Interface Sweet
+ * is a Python interface file for SWIG. Languages other than Python can
+ * possibly also be supported with little addtional work.
+ */
+%module sweet
+
+%{
+
+#include <dsnlexer.h>
+#include <sch_lib_table_lexer.h>
+#include <sch_lib_table.h>
+#include <sch_lpid.h>
+#include <sweet_lexer.h>
+#include <sch_part.h>
+
+%}
+
+%include "std_string.i"
+%include "std_deque.i"
+%include "utf8.h"
+
+%ignore LINE_READER::operator char* () const;
+
+namespace SCH {
+%ignore PART::operator=( const PART& other );
+}
+
+%include "import_export.h"
+%include "richio.h"
+%include "dsnlexer.h"
+//%include "sch_lib_table_lexer.h"
+%include "sch_lpid.h"
+%include "sch_lib.h"
+%include "sch_lib_table.h"
+%include "sweet_lexer.h"
+
+%include "sch_part.h"
diff --git a/new/sweet.keywords b/new/sweet.keywords
new file mode 100644
index 0000000..88e23fe
--- /dev/null
+++ b/new/sweet.keywords
@@ -0,0 +1,81 @@
+alternates
+anchor
+arc
+at
+bezier
+bold
+bottom
+center
+circle
+clock
+clock_low
+datasheet
+effects
+end
+end_angle
+extends
+falling_edge
+fill
+filled
+font
+footprint
+hide
+in
+inout
+input_low
+inverted
+inverted_clk
+italic
+justify
+keywords
+left
+length
+line
+model
+no
+non_logic
+none
+open_collector
+open_emitter
+out
+pad
+pads
+part
+passive
+pin
+pin_del
+pin_merge
+pin_rename
+pin_renum
+pin_swap
+polyline
+pos
+power_in
+power_out
+property
+property_del
+pts
+radius
+rectangle
+reference
+right
+route_alt_swap
+route_pin_swap
+signal
+signals
+size
+start
+start_angle
+stroke
+text
+top
+transparent
+tristate
+unconnected
+units
+unspecified
+value
+visible
+xy
+yes
+
diff --git a/new/sweet_edit.cpp b/new/sweet_edit.cpp
new file mode 100644
index 0000000..86c2039
--- /dev/null
+++ b/new/sweet_edit.cpp
@@ -0,0 +1,244 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+// wxWidgets imports
+#include <wx/wx.h>
+#include <wx/graphics.h>
+#include <wx/timer.h>
+#include <wx/event.h>
+#include <wx/wxprec.h>
+#include <wx/cmdline.h>
+
+// Graphics Abstraction Layer imports
+#include <gal/common/definitions.h>
+#include <gal/common/graphics_abstraction_layer.h>
+#include <gal/opengl/opengl_gal.h>
+#include <gal/common/stroke_font.h>
+#include <gal/common/color4d.h>
+#include <gal/font/newstroke_font.h>
+
+#include <math/vector2d.h>
+#include <math/matrix3x3.h>
+
+#include <sweet_editor_panel.h>
+
+#define screenSizeX 640
+#define screenSizeY 480
+
+
+
+/**
+ * Class SWEET_EDIT
+ * implements an editor for SWEET, including support for inheritance and
+ * LIB_TABLE configuration.
+ */
+class SWEET_FRAME: public wxFrame
+{
+public:
+ // @brief Constructor
+ SWEET_FRAME( wxWindow* parent, wxWindowID id, const wxString& title,
+ const wxPoint& pos, const wxSize& size );
+
+ // @brief Destructor
+ ~SWEET_FRAME();
+
+private:
+ bool m_isReady;
+ bool m_isPanning;
+
+ SCH::CANVAS* m_gal;
+
+ wxSize m_screenSize;
+ VECTOR2D m_worldSize;
+ VECTOR2D m_startMousePoint;
+ VECTOR2D m_startLookAtPoint;
+
+ /*
+ double m_alpha;
+
+ MATRIX3x3D m_startMatrix;
+
+ STROKE_FONT m_font;
+ */
+
+ // Event handlers
+ void OnMotion( wxMouseEvent& event );
+ void OnMouseWheel( wxMouseEvent& event );
+ void OnRightDown( wxMouseEvent& event );
+ void OnRightUp( wxMouseEvent& event );
+// void OnRedraw( wxCommandEvent& event );
+};
+
+
+SWEET_FRAME::SWEET_FRAME( wxWindow* parent, wxWindowID id, const wxString& title,
+ const wxPoint& pos, const wxSize& size ) :
+ wxFrame( parent, id, title, pos, size ),
+ m_screenSize( size.x, size.y )
+{
+ m_isPanning = false;
+
+ SWEET_EDITOR_PANEL* panel =
+ new SWEET_EDITOR_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), wxSize( -1, -1 ), 0 );
+
+ m_gal = (SCH::CANVAS*) panel->FindWindowByName( wxT( "GLCanvas" ), panel );
+
+ wxASSERT( m_gal );
+
+ m_gal->SetMouseListener( this );
+
+ Connect( wxEVT_MOTION, wxMouseEventHandler( SWEET_FRAME::OnMotion ) );
+ Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( SWEET_FRAME::OnMouseWheel ) );
+ Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( SWEET_FRAME::OnRightDown ) );
+ Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( SWEET_FRAME::OnRightUp ) );
+}
+
+
+SWEET_FRAME::~SWEET_FRAME()
+{
+ delete m_gal;
+}
+
+
+void SWEET_FRAME::OnMotion( wxMouseEvent& event )
+{
+ VECTOR2D mousePoint( event.GetX(), event.GetY() );
+
+ if( event.Dragging() )
+ {
+ if( m_isPanning )
+ {
+ MATRIX3x3D matrix = m_gal->GetWorldScreenMatrix().Inverse();
+ VECTOR2D delta = matrix.GetScale().x * ( m_startMousePoint - mousePoint );
+
+ m_gal->SetLookAtPoint( m_startLookAtPoint + delta );
+
+ m_gal->PaintScene();
+ }
+ }
+ else
+ {
+ m_gal->DrawCursor( mousePoint );
+ }
+}
+
+
+void SWEET_FRAME::OnMouseWheel( wxMouseEvent& event )
+{
+ double zoomScale = ( event.GetWheelRotation() > 0.0 ) ? 1.1 : 0.9;
+
+ m_gal->SetZoomFactor( m_gal->GetZoomFactor() * zoomScale );
+ m_gal->PaintScene();
+}
+
+
+void SWEET_FRAME::OnRightDown( wxMouseEvent& event )
+{
+ m_isPanning = true;
+ m_startMousePoint = VECTOR2D( event.GetX(), event.GetY() );
+ m_startLookAtPoint = m_gal->GetLookAtPoint();
+}
+
+
+void SWEET_FRAME::OnRightUp( wxMouseEvent& event )
+{
+ m_isPanning = false;
+}
+
+
+static const wxCmdLineEntryDesc g_cmdLineDesc[] = {
+ {
+ wxCMD_LINE_PARAM,
+ NULL,
+ NULL,
+ "filename of libtable",
+ wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE
+ },
+ { wxCMD_LINE_NONE }
+};
+
+
+class GAL_TEST_APPLICATION: public wxApp
+{
+public:
+ GAL_TEST_APPLICATION();
+
+private:
+ virtual bool OnInit();
+ virtual int OnExit();
+ virtual int OnRun();
+ virtual void OnInitCmdLine( wxCmdLineParser& aParser );
+ virtual bool OnCmdLineParsed( wxCmdLineParser& aParser );
+};
+
+
+GAL_TEST_APPLICATION::GAL_TEST_APPLICATION()
+{
+}
+
+
+bool GAL_TEST_APPLICATION::OnInit()
+{
+ if ( !wxApp::OnInit() )
+ return false;
+
+ SWEET_FRAME* frame = new SWEET_FRAME( (wxFrame *) NULL,
+ -1, wxT( "SWEET Editor" ),
+ wxPoint( screenSizeX + 10, 0 ),
+ wxSize( screenSizeX, screenSizeY ) );
+
+ frame->Show( true );
+
+ return true;
+}
+
+
+int GAL_TEST_APPLICATION::OnExit()
+{
+ return 0;
+}
+
+
+int GAL_TEST_APPLICATION::OnRun()
+{
+ int exitcode = wxApp::OnRun();
+ return exitcode;
+}
+
+
+void GAL_TEST_APPLICATION::OnInitCmdLine( wxCmdLineParser& parser )
+{
+ parser.SetDesc( g_cmdLineDesc );
+ parser.SetSwitchChars( wxT( "-" ) );
+}
+
+
+bool GAL_TEST_APPLICATION::OnCmdLineParsed( wxCmdLineParser& parser )
+{
+ return true;
+}
+
+
+DECLARE_APP( GAL_TEST_APPLICATION )
+
+IMPLEMENT_APP( GAL_TEST_APPLICATION )
diff --git a/new/sweet_editor_panel.cpp b/new/sweet_editor_panel.cpp
new file mode 100644
index 0000000..db2fbda
--- /dev/null
+++ b/new/sweet_editor_panel.cpp
@@ -0,0 +1,76 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Jun 6 2011)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO "NOT" EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#include <sweet_editor_panel.h>
+
+///////////////////////////////////////////////////////////////////////////
+
+SWEET_EDITOR_PANEL::SWEET_EDITOR_PANEL( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
+{
+ wxBoxSizer* bSizer2;
+ bSizer2 = new wxBoxSizer( wxVERTICAL );
+
+ m_top_bottom = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
+ m_top_bottom->SetSashGravity( 1 );
+ m_top_bottom->Connect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_top_bottomOnIdle ), NULL, this );
+
+ m_panel9 = new wxPanel( m_top_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ wxBoxSizer* bSizer10;
+ bSizer10 = new wxBoxSizer( wxVERTICAL );
+
+ m_splitter3 = new wxSplitterWindow( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
+ m_splitter3->Connect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_splitter3OnIdle ), NULL, this );
+
+ m_scrolledTextWindow = new wxScrolledWindow( m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
+ m_scrolledTextWindow->SetScrollRate( 5, 5 );
+ wxStaticBoxSizer* m_scrolledTextSizer;
+ m_scrolledTextSizer = new wxStaticBoxSizer( new wxStaticBox( m_scrolledTextWindow, wxID_ANY, _("Sweet") ), wxVERTICAL );
+
+ m_sweet_scroll_window = new wxTextCtrl( m_scrolledTextWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxALWAYS_SHOW_SB );
+ m_scrolledTextSizer->Add( m_sweet_scroll_window, 1, wxALL|wxEXPAND, 5 );
+
+ m_scrolledTextWindow->SetSizer( m_scrolledTextSizer );
+ m_scrolledTextWindow->Layout();
+ m_scrolledTextSizer->Fit( m_scrolledTextWindow );
+ m_gal_scrolled_window = new wxScrolledWindow( m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxHSCROLL|wxVSCROLL );
+ m_gal_scrolled_window->SetScrollRate( 5, 5 );
+ wxStaticBoxSizer* m_gal_sizer;
+ m_gal_sizer = new wxStaticBoxSizer( new wxStaticBox( m_gal_scrolled_window, wxID_ANY, _("Visual Part") ), wxVERTICAL );
+
+ m_gal = new SCH::CANVAS( m_gal_scrolled_window );
+ m_gal_sizer->Add( m_gal, 1, wxEXPAND, 5 );
+
+ m_gal_scrolled_window->SetSizer( m_gal_sizer );
+ m_gal_scrolled_window->Layout();
+ m_gal_sizer->Fit( m_gal_scrolled_window );
+ m_splitter3->SplitVertically( m_scrolledTextWindow, m_gal_scrolled_window, 0 );
+ bSizer10->Add( m_splitter3, 1, wxEXPAND, 5 );
+
+ m_panel9->SetSizer( bSizer10 );
+ m_panel9->Layout();
+ bSizer10->Fit( m_panel9 );
+ m_scrolledWindow3 = new wxScrolledWindow( m_top_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
+ m_scrolledWindow3->SetScrollRate( 5, 5 );
+ wxStaticBoxSizer* sbSizer1;
+ sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_scrolledWindow3, wxID_ANY, _("Parsing Errors") ), wxVERTICAL );
+
+ m_htmlWin2 = new wxHtmlWindow( m_scrolledWindow3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
+ sbSizer1->Add( m_htmlWin2, 1, wxALL|wxEXPAND, 5 );
+
+ m_scrolledWindow3->SetSizer( sbSizer1 );
+ m_scrolledWindow3->Layout();
+ sbSizer1->Fit( m_scrolledWindow3 );
+ m_top_bottom->SplitHorizontally( m_panel9, m_scrolledWindow3, 0 );
+ bSizer2->Add( m_top_bottom, 1, wxEXPAND, 5 );
+
+ this->SetSizer( bSizer2 );
+ this->Layout();
+}
+
+SWEET_EDITOR_PANEL::~SWEET_EDITOR_PANEL()
+{
+}
diff --git a/new/sweet_editor_panel.fbp b/new/sweet_editor_panel.fbp
new file mode 100644
index 0000000..29fd265
--- /dev/null
+++ b/new/sweet_editor_panel.fbp
@@ -0,0 +1,938 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<wxFormBuilder_Project>
+ <FileVersion major="1" minor="10" />
+ <object class="Project" expanded="1">
+ <property name="class_decoration"></property>
+ <property name="code_generation">C++</property>
+ <property name="disconnect_events">1</property>
+ <property name="disconnect_mode">source_name</property>
+ <property name="disconnect_python_events">0</property>
+ <property name="embedded_files_path">res</property>
+ <property name="encoding">UTF-8</property>
+ <property name="event_generation">connect</property>
+ <property name="file">sweet_editor_panel</property>
+ <property name="first_id">1000</property>
+ <property name="help_provider">none</property>
+ <property name="internationalize">1</property>
+ <property name="name">MyProject1</property>
+ <property name="namespace"></property>
+ <property name="path">.</property>
+ <property name="precompiled_header"></property>
+ <property name="relative_path">1</property>
+ <property name="skip_python_events">1</property>
+ <property name="use_enum">0</property>
+ <property name="use_microsoft_bom">0</property>
+ <object class="Panel" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_managed">0</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="event_handler">impl_virtual</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">SWEET_EDITOR_PANEL</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="show">1</property>
+ <property name="size">500,300</property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxTAB_TRAVERSAL</property>
+ <event name="OnAuiFindManager"></event>
+ <event name="OnAuiPaneButton"></event>
+ <event name="OnAuiPaneClose"></event>
+ <event name="OnAuiPaneMaximize"></event>
+ <event name="OnAuiPaneRestore"></event>
+ <event name="OnAuiRender"></event>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnInitDialog"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="wxBoxSizer" expanded="1">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer2</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="1">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxSplitterWindow" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_pane_size">0</property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_top_bottom</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="sashgravity">1</property>
+ <property name="sashpos">0</property>
+ <property name="sashsize">-1</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="splitmode">wxSPLIT_HORIZONTAL</property>
+ <property name="style">wxSP_3D</property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnSplitterDClick"></event>
+ <event name="OnSplitterSashPosChanged"></event>
+ <event name="OnSplitterSashPosChanging"></event>
+ <event name="OnSplitterUnsplit"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="splitteritem" expanded="1">
+ <object class="wxPanel" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_panel9</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxTAB_TRAVERSAL</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="wxBoxSizer" expanded="1">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer10</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="1">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxSplitterWindow" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_pane_size">0</property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_splitter3</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="sashgravity">0.0</property>
+ <property name="sashpos">0</property>
+ <property name="sashsize">-1</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="splitmode">wxSPLIT_VERTICAL</property>
+ <property name="style">wxSP_3D</property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnSplitterDClick"></event>
+ <event name="OnSplitterSashPosChanged"></event>
+ <event name="OnSplitterSashPosChanging"></event>
+ <event name="OnSplitterUnsplit"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="splitteritem" expanded="1">
+ <object class="wxScrolledWindow" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_scrolledTextWindow</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="scroll_rate_x">5</property>
+ <property name="scroll_rate_y">5</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxHSCROLL|wxVSCROLL</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="wxStaticBoxSizer" expanded="0">
+ <property name="id">wxID_ANY</property>
+ <property name="label">Sweet</property>
+ <property name="minimum_size"></property>
+ <property name="name">m_scrolledTextSizer</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <event name="OnUpdateUI"></event>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxTextCtrl" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="maxlength">0</property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_sweet_scroll_window</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style">wxTE_MULTILINE</property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="value"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxALWAYS_SHOW_SB</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnText"></event>
+ <event name="OnTextEnter"></event>
+ <event name="OnTextMaxLen"></event>
+ <event name="OnTextURL"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="splitteritem" expanded="0">
+ <object class="wxScrolledWindow" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_gal_scrolled_window</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="scroll_rate_x">5</property>
+ <property name="scroll_rate_y">5</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxFULL_REPAINT_ON_RESIZE|wxHSCROLL|wxVSCROLL</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="wxStaticBoxSizer" expanded="0">
+ <property name="id">wxID_ANY</property>
+ <property name="label">Visual Part</property>
+ <property name="minimum_size"></property>
+ <property name="name">m_gal_sizer</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <event name="OnUpdateUI"></event>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="CustomControl" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="class">SCH::CANVAS</property>
+ <property name="close_button">1</property>
+ <property name="construction">m_gal = new SCH::CANVAS( m_gal_scrolled_window );</property>
+ <property name="context_help"></property>
+ <property name="context_menu">0</property>
+ <property name="declaration">SCH::CANVAS* m_gal;</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="include">#include &lt;sch_canvas.h&gt;</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_gal</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="settings"></property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxFULL_REPAINT_ON_RESIZE</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="splitteritem" expanded="1">
+ <object class="wxScrolledWindow" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_scrolledWindow3</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="scroll_rate_x">5</property>
+ <property name="scroll_rate_y">5</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxHSCROLL|wxVSCROLL</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="wxStaticBoxSizer" expanded="1">
+ <property name="id">wxID_ANY</property>
+ <property name="label">Parsing Errors</property>
+ <property name="minimum_size"></property>
+ <property name="name">sbSizer1</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <event name="OnUpdateUI"></event>
+ <object class="sizeritem" expanded="1">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxHtmlWindow" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_name"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="layer"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_htmlWin2</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="resize">Resizable</property>
+ <property name="row"></property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style">wxHW_SCROLLBAR_AUTO</property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnHtmlCellClicked"></event>
+ <event name="OnHtmlCellHover"></event>
+ <event name="OnHtmlLinkClicked"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+</wxFormBuilder_Project>
diff --git a/new/sweet_editor_panel.h b/new/sweet_editor_panel.h
new file mode 100644
index 0000000..37033f8
--- /dev/null
+++ b/new/sweet_editor_panel.h
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Jun 6 2011)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO "NOT" EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef __sweet_editor_panel__
+#define __sweet_editor_panel__
+
+#include <wx/intl.h>
+
+#include <wx/string.h>
+#include <wx/textctrl.h>
+#include <wx/gdicmn.h>
+#include <wx/font.h>
+#include <wx/colour.h>
+#include <wx/settings.h>
+#include <wx/sizer.h>
+#include <wx/statbox.h>
+#include <wx/scrolwin.h>
+#include <sch_canvas.h>
+#include <wx/splitter.h>
+#include <wx/panel.h>
+#include <wx/html/htmlwin.h>
+
+///////////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Class SWEET_EDITOR_PANEL
+///////////////////////////////////////////////////////////////////////////////
+class SWEET_EDITOR_PANEL : public wxPanel
+{
+ private:
+
+ protected:
+ wxSplitterWindow* m_top_bottom;
+ wxPanel* m_panel9;
+ wxSplitterWindow* m_splitter3;
+ wxScrolledWindow* m_scrolledTextWindow;
+ wxTextCtrl* m_sweet_scroll_window;
+ wxScrolledWindow* m_gal_scrolled_window;
+ SCH::CANVAS* m_gal;
+ wxScrolledWindow* m_scrolledWindow3;
+ wxHtmlWindow* m_htmlWin2;
+
+ public:
+
+ SWEET_EDITOR_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
+ ~SWEET_EDITOR_PANEL();
+
+ void m_top_bottomOnIdle( wxIdleEvent& )
+ {
+ m_top_bottom->SetSashPosition( 0 );
+ m_top_bottom->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_top_bottomOnIdle ), NULL, this );
+ }
+
+ void m_splitter3OnIdle( wxIdleEvent& )
+ {
+ m_splitter3->SetSashPosition( 0 );
+ m_splitter3->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_splitter3OnIdle ), NULL, this );
+ }
+
+};
+
+#endif //__sweet_editor_panel__
diff --git a/new/sweet_spec_for_schematic_parts_EN.fodt b/new/sweet_spec_for_schematic_parts_EN.fodt
new file mode 100644
index 0000000..c149969
--- /dev/null
+++ b/new/sweet_spec_for_schematic_parts_EN.fodt
@@ -0,0 +1,732 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:meta>
+ <meta:creation-date>2011-04-18T01:23:31</meta:creation-date>
+ <meta:editing-duration>PT17M33S</meta:editing-duration>
+ <meta:editing-cycles>4</meta:editing-cycles>
+ <meta:generator>LibreOffice/3.4$Unix LibreOffice_project/340m1$Build-301</meta:generator>
+
+
+
+
+ <dc:date>2011-08-25T22:29:36</dc:date><dc:creator>Dick Hollenbeck</dc:creator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="11" meta:paragraph-count="340" meta:word-count="2770" meta:character-count="17364" meta:non-whitespace-character-count="13943"/></office:meta>
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="ViewAreaTop" config:type="long">65</config:config-item>
+ <config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
+ <config:config-item config:name="ViewAreaWidth" config:type="long">23670</config:config-item>
+ <config:config-item config:name="ViewAreaHeight" config:type="long">12026</config:config-item>
+ <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
+ <config:config-item config:name="ViewLeft" config:type="long">8008</config:config-item>
+ <config:config-item config:name="ViewTop" config:type="long">11061</config:config-item>
+ <config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
+ <config:config-item config:name="VisibleTop" config:type="long">65</config:config-item>
+ <config:config-item config:name="VisibleRight" config:type="long">23668</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="long">12090</config:config-item>
+ <config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
+ <config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item>
+ <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ZoomFactor" config:type="short">205</config:config-item>
+ <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="MathBaselineAlignment" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
+ <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SmallCapsPercentage66" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
+ <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
+ <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
+ <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
+ <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
+ <config:config-item config:name="PrinterName" config:type="string"/>
+ <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
+ <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintFaxName" config:type="string"/>
+ <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
+ <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
+ <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ <office:scripts>
+ <office:script script:language="ooo:Basic">
+ <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <ooo:library-embedded ooo:name="Standard"/>
+ </ooo:libraries>
+ </office:script>
+ </office:scripts>
+ <office:font-face-decls>
+ <style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/>
+ <style:font-face style:name="Bitstream Vera Sans Mono" svg:font-family="&apos;Bitstream Vera Sans Mono&apos;" style:font-adornments="Roman" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <style:font-face style:name="Times New Roman" svg:font-family="&apos;Times New Roman&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <style:font-face style:name="Lucida Sans Unicode" svg:font-family="&apos;Lucida Sans Unicode&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties fo:wrap-option="wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-size-asian="12pt" style:language-asian="zh" style:country-asian="CN" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" style:font-name="Times New Roman" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="12pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Tahoma" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
+ <style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" fo:keep-with-next="always"/>
+ <style:text-properties style:font-name="Arial" fo:font-size="14pt" style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/>
+ </style:style>
+ <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+ <style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0835in"/>
+ </style:style>
+ <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
+ <style:text-properties style:font-name-complex="Tahoma1"/>
+ </style:style>
+ <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties fo:margin-top="0.0835in" fo:margin-bottom="0.0835in" text:number-lines="false" text:line-number="0"/>
+ <style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Tahoma1" style:font-size-complex="12pt" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
+ <style:paragraph-properties text:number-lines="false" text:line-number="0"/>
+ <style:text-properties style:font-name-complex="Tahoma1"/>
+ </style:style>
+ <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
+ <style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties fo:margin-left="0.1965in" fo:margin-right="0in" fo:text-indent="-0.1965in" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/>
+ <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
+ </style:style>
+ <style:style style:name="code0" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="chapter">
+ <style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0201in">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:font-name="Bitstream Vera Sans Mono" fo:font-size="10pt"/>
+ </style:style>
+ <style:style style:name="comment" style:family="paragraph" style:parent-style-name="code0" style:class="chapter">
+ <style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0201in"/>
+ <style:text-properties fo:color="#006b6b"/>
+ </style:style>
+ <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties text:number-lines="false" text:line-number="0"/>
+ </style:style>
+ <style:style style:name="Table_20_Heading" style:display-name="Table Heading" style:family="paragraph" style:parent-style-name="Table_20_Contents" style:class="extra">
+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" text:number-lines="false" text:line-number="0"/>
+ <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:class="text">
+ <style:text-properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text">
+ <style:text-properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="4" style:class="text">
+ <style:text-properties fo:font-size="85%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="85%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="85%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading_20_5" style:display-name="Heading 5" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="5" style:class="text">
+ <style:text-properties fo:font-size="85%" fo:font-weight="bold" style:font-size-asian="85%" style:font-weight-asian="bold" style:font-size-complex="85%" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading_20_6" style:display-name="Heading 6" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="6" style:class="text">
+ <style:text-properties fo:font-size="75%" fo:font-weight="bold" style:font-size-asian="75%" style:font-weight-asian="bold" style:font-size-complex="75%" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
+ <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
+ <style:text-properties style:text-position="super 58%"/>
+ </style:style>
+ <style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text">
+ <style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/>
+ </style:style>
+ <style:style style:name="Visited_20_Internet_20_Link" style:display-name="Visited Internet Link" style:family="text">
+ <style:text-properties fo:color="#800000" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/>
+ </style:style>
+ <text:outline-style style:name="Outline">
+ <text:outline-level-style text:level="1" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.3in" fo:text-indent="-0.3in" fo:margin-left="0.3in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="2" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.4in" fo:text-indent="-0.4in" fo:margin-left="0.4in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="3" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.5in" fo:text-indent="-0.5in" fo:margin-left="0.5in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="4" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.6in" fo:text-indent="-0.6in" fo:margin-left="0.6in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="5" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.7in" fo:text-indent="-0.7in" fo:margin-left="0.7in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="6" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.8in" fo:text-indent="-0.8in" fo:margin-left="0.8in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="7" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.9in" fo:text-indent="-0.9in" fo:margin-left="0.9in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="8" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1in" fo:text-indent="-1in" fo:margin-left="1in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="9" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.1in" fo:text-indent="-1.1in" fo:margin-left="1.1in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="10" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.2in" fo:text-indent="-1.2in" fo:margin-left="1.2in"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ </text:outline-style>
+ <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.1965in" style:num-format="1" text:number-position="left" text:increment="5"/>
+ <style:default-page-layout>
+ <style:page-layout-properties style:writing-mode="lr-tb" style:layout-grid-standard-mode="true"/>
+ </style:default-page-layout>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="code0">
+ <style:text-properties fo:color="#000000"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="code0">
+ <style:text-properties style:use-window-font-color="true"/>
+ </style:style>
+ <style:style style:name="P3" style:family="paragraph" style:parent-style-name="comment">
+ <style:text-properties fo:color="#800000"/>
+ </style:style>
+ <style:style style:name="P4" style:family="paragraph" style:parent-style-name="comment">
+ <style:text-properties fo:color="#008080"/>
+ </style:style>
+ <style:style style:name="P5" style:family="paragraph" style:parent-style-name="code0">
+ <style:paragraph-properties fo:break-before="page"/>
+ </style:style>
+ <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Heading_20_1">
+ <style:paragraph-properties fo:break-before="page"/>
+ </style:style>
+ <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Heading_20_1">
+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
+ </style:style>
+ <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name=""/>
+ <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Heading_20_1">
+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
+ </style:style>
+ <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Heading_20_1" style:list-style-name="">
+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
+ </style:style>
+ <style:style style:name="P11" style:family="paragraph" style:parent-style-name="Heading_20_1">
+ <style:paragraph-properties fo:break-before="page"/>
+ </style:style>
+ <style:style style:name="T1" style:family="text">
+ <style:text-properties fo:color="#0000ff"/>
+ </style:style>
+ <style:style style:name="T2" style:family="text">
+ <style:text-properties fo:color="#800000"/>
+ </style:style>
+ <style:style style:name="T3" style:family="text">
+ <style:text-properties fo:color="#006b6b"/>
+ </style:style>
+ <style:style style:name="T4" style:family="text">
+ <style:text-properties fo:color="#000000"/>
+ </style:style>
+ <style:style style:name="T5" style:family="text">
+ <style:text-properties style:use-window-font-color="true"/>
+ </style:style>
+ <style:style style:name="T6" style:family="text">
+ <style:text-properties style:text-position="super 58%"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in">
+ <style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="none" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text text:use-soft-page-breaks="true">
+ <text:sequence-decls>
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+ </text:sequence-decls>
+ <text:h text:style-name="P7" text:outline-level="1">SWEET <text:s/>S-Expression Grammar Describing a </text:h>
+ <text:h text:style-name="P10" text:outline-level="1">Schematic Part String Format Specification </text:h>
+ <text:h text:style-name="P7" text:outline-level="1"/>
+ <text:h text:style-name="P8" text:outline-level="1">Authors:</text:h>
+ <text:h text:style-name="P8" text:outline-level="1">Wayne Stambaugh</text:h>
+ <text:h text:style-name="P8" text:outline-level="1">Dick Hollenbeck</text:h>
+ <text:h text:style-name="P8" text:outline-level="1"/>
+ <text:h text:style-name="P8" text:outline-level="1"/>
+ <text:h text:style-name="P8" text:outline-level="1">Original Edits: <text:tab/>January 2011</text:h>
+ <text:h text:style-name="P8" text:outline-level="1">Latest Edits:<text:tab/> <text:tab/>August 2011</text:h>
+ <text:h text:style-name="P8" text:outline-level="1"/>
+ <text:h text:style-name="P6" text:outline-level="1">Introduction</text:h>
+ <text:p text:style-name="Text_20_body">The purpose of this document is to define the new format for the Kicad schematic part descriptions, as expressed using the new SWEET grammar. <text:s/>This format supersedes the old file format defined in the file “library_file_format_EN.odt. <text:s/>The idea of component library files is no longer valid. <text:s/>The unit of retrieval from the new distributed library system is the part, not a library. <text:s text:c="2"/>To learn more about the new distributed library system see the design.h document in the Kicad source tree, or better yet, the Doxygen generated material therefrom.</text:p>
+ <text:p text:style-name="Text_20_body">The SWEET grammar format is based on the Specttra DSN lexer<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body>
+ <text:p text:style-name="Footnote">See source files dsnlexer.cpp and dsnlexer.h in the Kicad source code for more information about how the DSN lexer works.</text:p></text:note-body></text:note> work graciously coded and contributed by Dick Hollenbeck. <text:s/>For those not familiar with the DSN format, it is very similar the the LISP programming language in that keywords are delimited by braces. <text:s/>It is also known as an S-expression format. <text:s/>A keyword may have zero or more tokens that behave like parameters for the keyword. <text:s/>Tokens may be defined as additional keywords creating a programming language like structure. <text:s/>The decision to change to this format is driven by a desire to provide a more robust file lexer, a human readable file format, better retrieval error reporting, and improved extensibility. <text:s/>The other driving factor is to provide a more robust format for handling the various requirements of the component library developers.</text:p>
+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Front Matter</text:h>
+ <text:p text:style-name="Text_20_body">This is a living document designed to be kept synchronized with the actual source code. <text:s/>If you modify the lexer, please update this specification as courtesy to other developers. <text:s/>There are many third party tools that are used to generate, manipulate, and parse component library files. <text:s/>Keeping this document current is vital to developers of these tools.</text:p>
+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Formatting</text:h>
+ <text:p text:style-name="Text_20_body">The DSN lexer enforces strict formatting requirements. <text:s/>Files must be encoded in UTF8 format. <text:s/>All lexer keywords are comprised of lower case letters, numbers, and underscores. <text:s/>Tokens may be any alphanumeric character delimited by a white space character. <text:s/>Each new delimited level of keywords is indented to make files easier to read and edit with a plain text editor. <text:s/>Comments are supported as separate lines indented at the same level as the current keyword delimiter and begin with the # character. <text:s/>In line comments are not allowed. <text:s/>There is more information on s-expression support in the Kicad source tree in file Documentation/s-expressions.txt.</text:p>
+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Using this document</text:h>
+ <text:p text:style-name="Text_20_body">This document is nothing more than several well commented part files. <text:s/>You should always be able to copy the text from the opening delimiter “(“ to the closing delimeter “)” into a file and open it with the library part file editor or library part viewer in Kicad&apos;s schematic capture program EESchema. <text:s/>It may not actually draw a useful component or be a very useful part but it should always be syntactically correct. <text:s/>The comments for a specific keyword always appears above the keyword it describes. <text:s/>Keywords defined within brackets [] are optional. <text:s/>A simple syntax coloring scheme has been employed to make this document more readable. <text:s/>Keywords are highlighted in <text:span text:style-name="T1">blue</text:span>, <text:s/>comments are highlighted in <text:span text:style-name="T3">turquoise</text:span>, and strings are highlighted in <text:span text:style-name="T2">red</text:span>.</text:p>
+ <text:h text:style-name="Heading_20_1" text:outline-level="1"><text:soft-page-break/>Logical coordinates.</text:h>
+ <text:p text:style-name="Text_20_body">The SWEET grammar expresses schematic parts using a coordinate system without units of measure. <text:s/>That is, logical coordinates used and are dimensionless. <text:s/>The advantage of having coordinates without units is any item that has an integer (non-fractional) coordinate in x and y, will be “on grid”. <text:s/>This helps ensure all connectable items such as pins, wires, junctions, etc., can be easily connected using normal grid snap. <text:s/>The normal spacing between neighboring part pins is 1 logical unit, and it is dimensionless. <text:s/>In fact, this is the definition of what a logical unit is, the normal spacing between two neighboring pins. <text:s text:c="3"/>Only non-connectable objects (e.g. arcs, text, etc.) should have non-integer coordinates. <text:s/>The zoom factor at time of printing or plotting determines the physical size of any drawing output.</text:p>
+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Line Widths</text:h>
+ <text:p text:style-name="Text_20_body">Line widths are given as a percent of a logical unit. <text:s/>In other words, a line width of 1 means 1/100<text:span text:style-name="T6">th</text:span> of a logical unit. <text:s/>Recall that a logical unit of 1 is the normal spacing between two neighboring schematic pins. <text:s text:c="2"/>So a line width of 50 would mean 50/100 of a pin interval, or half the normal space between two pins. <text:s/>A line width of 50 represents a very wide line indeed, a more normal line width would be about 1-5 <text:s/>(percent).</text:p>
+ <text:h text:style-name="Heading_20_1" text:outline-level="1">An example file showing syntax for all drawable item types.</text:h>
+ <text:p text:style-name="comment"># The schematic part element is the largest entity addressed by the SWEET grammar.</text:p>
+ <text:p text:style-name="comment"># A schematic part can be inherited from another part by using the “extends”</text:p>
+ <text:p text:style-name="comment"># keyword.</text:p>
+ <text:p text:style-name="comment"># The part name is normally the file name, although SWEET parts will not always</text:p>
+ <text:p text:style-name="comment"># exist as mere files. <text:s/>They are actually best thought of as strings held in a</text:p>
+ <text:p text:style-name="comment"># a container called a lib_source. The NAME_HINT is to be used in a manner yet to</text:p>
+ <text:p text:style-name="comment"># be determined, depending on the context from which the SWEET part came from.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T5">NAME_HINT [</text:span><text:span text:style-name="T1">extends</text:span> <text:span text:style-name="T5">LPID]</text:span> </text:p>
+ <text:p text:style-name="P2"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Change the anchor position to something other than 0, 0. <text:s/>Anchor coordinates</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># must be integers.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">anchor</text:span> (<text:span text:style-name="T1">at </text:span>X Y))]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># The reference token is a reserved property. <text:s/>Other reserved properties are</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># value, footprint, datasheet, model, and keywords.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">reference</text:span> <text:span text:style-name="T5">REF</text:span> </text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># Effects define how a property is displayed. <text:s/>If no effect is defined then</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># the property is not displayed. <text:s/>Effects can also be used to override the</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># effects of a property in an inherited part. <text:s/>When (effects...) is used</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># in a COMPONENT to override the effects of a PART, the PROPERTY </text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># specifier must be present.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[<text:bookmark-start text:name="__DdeLink__1991_2022311872"/>(<text:span text:style-name="T1">effects</text:span> [PROPERTY]</text:p>
+ <text:p text:style-name="P3"/>
+ <text:p text:style-name="comment"><text:s text:c="6"/># Position requires an X and Y coordinate. <text:s/>Position coordinates can be</text:p>
+ <text:p text:style-name="comment"><text:s text:c="6"/># non-integer. <text:s/>Angle is in degrees and defaults to 0 if not defined.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="6"/>(<text:span text:style-name="T1">at </text:span>X Y [ANGLE])</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="6"/><text:bookmark-start text:name="__DdeLink__1994_2124759253"/># The FONT value needs to be defined. <text:s/>Currently, EESchema does not support</text:p>
+ <text:p text:style-name="comment"><text:soft-page-break/><text:s text:c="6"/># different fonts. <text:s/>In the future this feature may be implemented and at</text:p>
+ <text:p text:style-name="comment"><text:s text:c="6"/># that time FONT will have to be defined. <text:s/>Initially, only the font size &amp;</text:p>
+ <text:p text:style-name="comment"><text:s text:c="6"/># style are required. <text:s/>Italic and bold styles are optional. <text:s/>The font size</text:p>
+ <text:p text:style-name="comment"><text:s text:c="6"/># height and width are in units yet to be determined. <text:s/>Only a variance</text:p>
+ <text:p text:style-name="comment"><text:s text:c="6"/># from defaults needs to be stated.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="6"/>[(<text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])<text:bookmark-end text:name="__DdeLink__1994_2124759253"/>]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="6"/># Default visibility for fields is no, only a variance from the</text:p>
+ <text:p text:style-name="comment"><text:s text:c="6"/># the default needs to be stated.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="6"/>[(<text:span text:style-name="T1">visible yes</text:span>)]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>)<text:bookmark-end text:name="__DdeLink__1991_2022311872"/>]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Add a new user defined property to this part. <text:s/>Also can be used to override</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># a property defined in an inherited part.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">property</text:span> <text:span text:style-name="T5">NAME VALUE</text:span> </text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="4"/>[(</text:span><text:span text:style-name="T1">effects</text:span> </text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="6"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">X Y [ANGLE])</text:span> </text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="6"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="6"/># Default visibility for fields is no, only a variance from the</text:p>
+ <text:p text:style-name="comment"><text:s text:c="6"/># the default needs to be stated.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="6"/>[(<text:span text:style-name="T1">visible yes</text:span>)]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>)]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)]</text:p>
+ <text:p text:style-name="comment"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Either polyline or line can be used to define a line or series of lines.</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Coordinates can be non-integer.</text:p>
+ <text:p text:style-name="code0"><text:bookmark-start text:name="__DdeLink__1984_2124759253"/><text:s text:c="2"/>(<text:span text:style-name="T1">polyline</text:span> <text:span text:style-name="T5">or</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">line</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">pts</text:span> (<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y))</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># Line widths are in units as defined above.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(stroke [WIDTH] <text:bookmark-start text:name="__DdeLink__2025_599115402"/>[(style [(dashed...)]...)]<text:bookmark-end text:name="__DdeLink__2025_599115402"/>)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># Valid fill types are none, filled, and transparent. <text:s/>Default fill for</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># a poly_line is none. <text:s/>Only a variance from the default needs to be stated.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)<text:bookmark-end text:name="__DdeLink__1984_2124759253"/> </text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="code0"><text:s text:c="2"/><text:bookmark-start text:name="__DdeLink__1986_2124759253"/>(<text:span text:style-name="T1">rectangle </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">start </text:span>X Y) (<text:span text:style-name="T1">end </text:span>X Y) (<text:span text:style-name="T1">stroke </text:span>WIDTH) (<text:span text:style-name="T1">fill </text:span>FILL_TYPE))<text:bookmark-end text:name="__DdeLink__1986_2124759253"/> </text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="code0"><text:s/><text:bookmark-start text:name="__DdeLink__1988_2124759253"/><text:s/>(<text:span text:style-name="T1">circle</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">center</text:span> X Y)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">radius </text:span>LENGTH)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">stroke </text:span>WIDTH)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)<text:bookmark-end text:name="__DdeLink__1988_2124759253"/> </text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="code0"><text:s text:c="2"/><text:bookmark-start text:name="__DdeLink__1990_2124759253"/>(<text:span text:style-name="T1">arc</text:span> <text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">pos</text:span> <text:span text:style-name="T5">X Y) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">RADIUS) (</text:span><text:span text:style-name="T1">start</text:span> X Y) (<text:span text:style-name="T1">end</text:span> X Y)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke </text:span>WIDTH)</text:p>
+ <text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="4"/>(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="3"/>)<text:bookmark-end text:name="__DdeLink__1990_2124759253"/> </text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">bezier</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">pts </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="5"/>(<text:span text:style-name="T1">stroke </text:span>WIDTH)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="code0"><text:bookmark-start text:name="__DdeLink__1992_2124759253"/><text:s text:c="2"/>(<text:span text:style-name="T1">text</text:span> <text:span text:style-name="T2">“This is the text that gets drawn.”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T4"><text:s text:c="4"/>(</text:span><text:span text:style-name="T1">at </text:span><text:span text:style-name="T4">X Y [ANGLE])</text:span> </text:p>
+ <text:p text:style-name="P1"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># Valid horizontal justification values are center, right, and left. <text:s/>Valid</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># vertical justification values are center, top, bottom. <text:s/>Defaults are</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># left and bottom. <text:s/>Only need to state a non-default.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">justify [</text:span>HORIZONTAL_JUSTIFY] [VERTICAL_JUSTIFY])]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># default visibility is yes, only need to state a variance from this default.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">visible no</text:span>)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># default fill type for text is filled, only need to state a non-default</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)<text:bookmark-end text:name="__DdeLink__1992_2124759253"/> </text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># A pin&apos;s type is it&apos;s electrical connection. <text:s/>Valid connection types are</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># input, output, bidirectional, tristate, passive, unspecified, power_in,</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># power_out, open_collector, open_emitter, unconnected. <text:s/>Valid pin shape</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># values are none, line, inverted, clock, inverted_clk, input_low, clock_low,</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># falling_edge, and non_logic.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">TYPE SHAPE</text:span> </text:p>
+ <text:p text:style-name="P2"/>
+ <text:p text:style-name="P4"><text:s text:c="4"/># Pin coordinates must be integers. <text:s/>The angle values 0, 180, 90, and 270</text:p>
+ <text:p text:style-name="P4"><text:s text:c="4"/># replace the current right, left, up, and down specifiers respectively,</text:p>
+ <text:p text:style-name="P4"><text:s text:c="4"/># and are the only angles currently supported.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">at </text:span>X Y [ANGLE])</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># Length of the pin in logical units. <text:s/>This is optional, depending on </text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># SHAPE, which in some cases may imply a fixed length</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">length</text:span> LENGTH)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># Use signal to describe the purpose of the pin. <text:s/>Signals do not have to be</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># uniquely named within a part. <text:s/>Signal can be blank.</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>[</text:span> <text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">signal</text:span> <text:span text:style-name="T2">“NAME” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic][bold]) </text:p>
+ <text:p text:style-name="code0"><text:s text:c="6"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">YES</text:span>))]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="4"/># Use pad to uniquely identify the pin, according to the pin number</text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># in the datasheet for the part. <text:s/>Padnames may not be blank and must be</text:p>
+ <text:p text:style-name="comment"><text:bookmark-start text:name="__DdeLink__2027_599115402"/><text:s text:c="4"/># be unique within the part.</text:p>
+ <text:p text:style-name="code0"><text:bookmark-end text:name="__DdeLink__2027_599115402"/><text:s text:c="2"/><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“NUMBER” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic][bold])</text:p>
+ <text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="6"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">YES</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s/></text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># default visibility for pins is yes, so only a deviation from the </text:p>
+ <text:p text:style-name="comment"><text:s text:c="4"/># the default needs to be stated.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">visible no</text:span>)]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="3"/>)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="P5"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Pin merge is used to group a number of pins that are connected to the same</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># net externally and show only one pin symbolizing the group. <text:s/>The group is</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># called a merge set or merge group. <text:s/>It is typically used to hide all but </text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># one power pin on parts that have a large number of power connections </text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># such as FPGAs and micro-contollers. <text:s/>VISIBLE_PAD is the pad of</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># the one pin which remains visible within the merge set. <text:s/>Pins with pads</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># listed within the (pads...) element are all made invisible, and so</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># are are all pins which may have any of the signal names listed in the </text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># (signals...) element. <text:s/>A pin may only exist within one merge group.</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Any number of (pin_merge...) statements maybe made, including more than</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># one re-stating the same VISIBLE_PAD, which is the anchor pin for the </text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># merge set.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_merge</text:span> VISIBLE_PAD </text:p>
+ <text:p text:style-name="code0"><text:tab/>[(pads HIDDEN_PAD1 …)][(signals HIDDEN_SIGNAL1 …)])]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># The pin swap hinting flag is used to indicate to an external tool ( i.e. an</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># auto router ) that the pins defined are functionally equivalent and</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># interchangeable.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">hint_pin_swap</text:span> NUMBER1 NUMBER2 ...)]</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Inheritance syntax example file.</text:h>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T5">NAME_HINT </text:span><text:span text:style-name="T1">extends</text:span> <text:span text:style-name="T5">LPID</text:span> </text:p>
+ <text:p text:style-name="comment"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Remove pin PAD defined in the base part. <text:s/>Only valid for extended parts.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_del </text:span>PAD)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Swap pin PAD1 and pin PAD2 in the base part. <text:s/></text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Only valid for extended parts.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_swap </text:span>PAD1 PAD2)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Change the pad of pin OLDPAD to NEWPAD in the base part.</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Only valid for extended parts.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_renum</text:span> OLDPAD NEWPAD)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Change the signal of pin PAD to NEWSIGNAL in the base part. <text:s/></text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Only valid for extended parts.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_rename</text:span> PAD NEWSIGNAL)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Remove property NAME from the base part. <text:s/>Only valid for extended parts.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">property_del </text:span>NAME)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Alternates are used to define multiple part per package devices and/or</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># alternate body styles (DeMorgan). <text:s/>Parts must be defined in order. <text:s/>There</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># can more than one alternates defined.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">alternates </text:span>LP<text:span text:style-name="T5">ID [LPID...]</text:span>)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># Add a new property to this part. <text:s/>Also can be use to override a property</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># defined in the base part.</text:p>
+ <text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="6"/>[(<text:span text:style-name="T1">property</text:span> <text:span text:style-name="T5">NAME VALUE</text:span> </text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="4"/>[(</text:span><text:span text:style-name="T1">effects </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">X Y [ANGLE])</text:span> </text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="6"/>(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])</text:p>
+ <text:p text:style-name="code0"><text:s text:c="6"/>(<text:span text:style-name="T1">visible </text:span>YES)]</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)]</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"><text:s text:c="2"/># The alternates swap hinting flag is used to indicate to an external tool</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># that the parts defined in the alternates list are functionally equivalent</text:p>
+ <text:p text:style-name="comment"><text:s text:c="2"/># and interchangeable.</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">hint_alt_swap</text:span> LPID1 LPID2 ...)]</text:p>
+ <text:p text:style-name="Text_20_body">)</text:p>
+ <text:p text:style-name="Text_20_body"/>
+ <text:p text:style-name="comment"># This is an example of a dual input NAND gate A of a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_a”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">reference</text:span> <text:span text:style-name="T2">“U”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">2 0) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">0.4) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">2</text:span> -4) (<text:span text:style-name="T1">start_angle</text:span> -90) (<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">2</text:span> 4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end_angle</text:span> 90)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">polyline</text:span> (<text:span text:style-name="T1">xy</text:span> <text:span text:style-name="T5">2</text:span> 4) (<text:span text:style-name="T1">xy </text:span>-6 4) (<text:span text:style-name="T1">xy </text:span>-6 -4) (<text:span text:style-name="T1">xy </text:span>2 -4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">stroke </text:span>0) (<text:span text:style-name="T1">fill </text:span>none))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 2 3.6 180)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“1” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> -2 3.6)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“2” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">output</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 0)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“3” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> -4 90)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“GND” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> 4 90)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“VCC” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">hint_pin_swap</text:span> <text:span text:style-name="T2">“1”</text:span> <text:span text:style-name="T2">“2”</text:span>)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># All LPIDs below this point assume that the base part is located in the same</text:p>
+ <text:p text:style-name="comment"># library as the parts that are derived from them. <text:s/>See the “Distributed Library</text:p>
+ <text:p text:style-name="comment"># &amp; EESchema Parts List Design Documentation” in the Kicad source file “design.h”</text:p>
+ <text:p text:style-name="comment"># for more information on LPIDs.</text:p>
+ <text:p text:style-name="comment"/>
+ <text:p text:style-name="comment"># This is the B gate of a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_b”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
+ <text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 5)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 6)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># This is the C gate of a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_c”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 8 4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 9 5)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 10 6)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># This is the D gate of a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_b”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 11)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 12)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 13)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># This is a DeMorgan representation of a dual input NAND gate A.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_</text:span> <text:span text:style-name="T2">demorgan</text:span> <text:span text:style-name="T2">_a”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">reference</text:span> <text:span text:style-name="T2">“U”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">-9.3 0) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">0.518) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">-6</text:span> 4) (<text:span text:style-name="T1">start_angle</text:span> 50.4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">-6</text:span> -4) (<text:span text:style-name="T1">end_angle</text:span> -50.4)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">-0.22 2.86) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">7.06) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">0</text:span> -200) (<text:span text:style-name="T1">start_angle</text:span> -88.1)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">6</text:span> 0) (<text:span text:style-name="T1">end_angle</text:span> -24.6)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">-0.2 2.82) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">6.8) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">6</text:span> 0) (<text:span text:style-name="T1">start_angle</text:span> -24.4) (<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">0</text:span> 4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end_angle</text:span> 88.3)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">polyline</text:span> (<text:span text:style-name="T1">xy</text:span> <text:span text:style-name="T5">-6</text:span> 4) (<text:span text:style-name="T1">xy </text:span>0 4) (<text:span text:style-name="T1">xy </text:span>0 -4) (<text:span text:style-name="T1">xy</text:span> <text:span text:style-name="T5">-6</text:span> -4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">stroke </text:span>0) (<text:span text:style-name="T1">fill </text:span>none))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 2 180) (<text:span text:style-name="T1">length</text:span> 6)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“1” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> -2 180) (<text:span text:style-name="T1">length</text:span> 6)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“2” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">output</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 0) (<text:span text:style-name="T1">length</text:span> 7.4)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“3” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> 1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> -4 90) (<text:span text:style-name="T1">length</text:span> 0)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“GND” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="6"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> 4 90) (<text:span text:style-name="T1">length</text:span> 0)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“VCC” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">hint_pin_swap</text:span> 1 2)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># This is the DeMorgan representation of gate B of a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_demorgan_b”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 4)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 5)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 6)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_rename</text:span> 1 <text:span text:style-name="T2">“D”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_rename</text:span> 2 <text:span text:style-name="T2">“E”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_rename</text:span> 3 <text:span text:style-name="T2">“F”</text:span>)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># This is the DeMorgan representation of gate C of a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_demorgan_c”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 8)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 9)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 10)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># This is the DeMorgan representation of gate D of a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_demorgan_d”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 11)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 12)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 13)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># An example of putting it all together to create a 7400.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“7400”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">value</text:span> <text:span text:style-name="T2">“7400”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">alternates</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_b/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_c/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_d/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">alternates</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="8"/><text:span text:style-name="T2">“dual_in_nand_demorgan_b/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_demorgan_c/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_demorgan_d/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">hint_alt_swap</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_b/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_c/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_d/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># A 74LS00 is as simple as this.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“74LS00”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“7400/rev1”</text:span> <text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">value</text:span> <text:span text:style-name="T2">“74LS00”</text:span> <text:span text:style-name="T5">)</text:span>)</text:p>
+ <text:p text:style-name="code0"/>
+ <text:p text:style-name="comment"># This is a so called heavy weight part definition of a Texas Instruments</text:p>
+ <text:p text:style-name="comment"># part number SN74HCT00NSR.</text:p>
+ <text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“SN74HCT00NSR”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“7400/rev1”</text:span> </text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T2"><text:s text:c="2"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">value</text:span> <text:span text:style-name="T2">“SN74HCT00NSR”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">footprint</text:span> <text:span text:style-name="T2">“14-SOP”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">datasheet</text:span> <text:span text:style-name="T2">“http://focus.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=sn74hct00&amp;fileType=pdf”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">keywords</text:span> <text:span text:style-name="T2">“LOGIC” “NAND”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Description”</text:span> <text:span text:style-name="T2">“IC GATE POS-NAND QD 2IN 14-SOP”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Manufacturer”</text:span> <text:span text:style-name="T2">“Texas Instruments”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Vendor”</text:span> <text:span text:style-name="T2">“Digikey”</text:span>)</text:p>
+ <text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Vendor Part Number”</text:span> <text:span text:style-name="T2">“SN74HCT00NSR-ND”</text:span>)</text:p>
+ <text:p text:style-name="code0">)</text:p>
+ <text:p text:style-name="code0"/>
+ </office:text>
+ </office:body>
+</office:document> \ No newline at end of file
diff --git a/new/test_sch_lib_table.cpp b/new/test_sch_lib_table.cpp
new file mode 100644
index 0000000..a385794
--- /dev/null
+++ b/new/test_sch_lib_table.cpp
@@ -0,0 +1,128 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2010-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
+ * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <sch_lib_table.h>
+#include <sch_lib_table_lexer.h>
+#include <sch_lpid.h>
+#include <sch_part.h>
+
+using namespace SCH;
+
+
+// If LIB_TABLE::Test() is conditioned on DEBUG being defined, build with
+// CMAKE_BUILD_TYPE=Debug, otherwise don't worry about it, because it will work
+// on any CMAKE_BUILD_TYPE, including Release.
+void LIB_TABLE::Test()
+{
+ SCH_LIB_TABLE_LEXER slr(
+ "(lib_table \n"
+ " (lib (logical www) (type http) (full_uri http://kicad.org/libs) (options \"\"))\n"
+ " (lib (logical meparts) (type dir) (full_uri /tmp/eeschema-lib) (options useVersioning))\n"
+// " (lib (logical meparts) (type dir) (full_uri /tmp/eeschema-lib) (options \"\"))\n"
+ " (lib (logical old-project) (type schematic)(full_uri /tmp/old-schematic.sch) (options \"\"))\n"
+ ")\n"
+ ,
+
+ wxT( "inline text" ) // source
+ );
+
+ // read the "( lib_table" pair of tokens
+ slr.NextTok();
+ slr.NextTok();
+
+ // parse the rest of input to slr
+ Parse( &slr );
+
+ STRING_FORMATTER sf;
+
+ // format this whole table into sf, it will be sorted by logicalName.
+ Format( &sf, 0 );
+
+ printf( "test 'Parse() <-> Format()' round tripping:\n" );
+ printf( "%s", sf.GetString().c_str() );
+
+ printf( "\ntest a lookup of 'www':\n" );
+ const LIB_TABLE::ROW* www = FindRow( "www" );
+ if( www )
+ {
+ // found, print it just to prove it.
+ sf.Clear();
+
+ www->Format( &sf, 1 );
+ printf( "%s", sf.GetString().c_str() );
+ }
+ else
+ printf( "not found\n" );
+
+ printf( "\nlist of logical libraries:\n" );
+
+ STRINGS logNames = GetLogicalLibs();
+ for( STRINGS::const_iterator it = logNames.begin(); it!=logNames.end(); ++it )
+ {
+ printf( "logicalName: %s\n", it->c_str() );
+ }
+
+ // find a part
+ LPID lpid( "meparts:tigers/ears" );
+
+ PART* part = LookupPart( lpid );
+
+ sf.Clear();
+ part->Format( &sf, 0, 0 );
+
+ printf( "%s", sf.GetString().c_str() );
+}
+
+
+int main( int argc, char** argv )
+{
+ LIB_TABLE lib_table;
+
+ try
+ {
+ // test exceptions:
+ // THROW_PARSE_ERROR( wxT("test problem"), wxT("input"), 23, 46 );
+ //THROW_IO_ERROR( wxT("io test") );
+
+ lib_table.Test();
+ }
+ catch( PARSE_ERROR& ioe ) // most derived class first
+ {
+ printf( "%s\n", (const char*) ioe.errorText.ToUTF8() );
+
+ printf( "%s%s",
+ ioe.inputLine.c_str(),
+ ioe.inputLine.empty() || *ioe.inputLine.rbegin() != '\n' ?
+ "\n" : "" ); // rare not to have \n at end
+
+ printf( "%*s^\n", ioe.byteIndex>=1 ? ioe.byteIndex-1 : 0, "" );
+ }
+ catch( const IO_ERROR& ioe )
+ {
+ printf( "%s\n", (const char*) ioe.errorText.ToUTF8() );
+ }
+
+ return 0;
+}
+
diff --git a/new/toolchain-mingw32.cmake b/new/toolchain-mingw32.cmake
new file mode 100644
index 0000000..3e902ac
--- /dev/null
+++ b/new/toolchain-mingw32.cmake
@@ -0,0 +1,45 @@
+
+# This is a CMake toolchain file so we can using Mingw to build Windows32 binaries.
+# http://vtk.org/Wiki/CMake_Cross_Compiling
+
+# usage
+# cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain-mingw32.cmake ../
+
+set( CMAKE_SYSTEM_NAME Windows )
+set( CMAKE_SYSTEM_PROCESSOR i686 )
+
+#-----<configuration>-----------------------------------------------
+
+# configure only the lines within this <configure> block, typically
+
+set( TC_PATH /usr/bin )
+set( CROSS_COMPILE x86_64-w64-mingw32- )
+
+# specify the cross compiler
+set( CMAKE_C_COMPILER ${TC_PATH}/${CROSS_COMPILE}gcc )
+set( CMAKE_CXX_COMPILER ${TC_PATH}/${CROSS_COMPILE}g++ )
+set( CMAKE_RC_COMPILER ${TC_PATH}/${CROSS_COMPILE}windres )
+
+# One compiler generates either 32 bit or 64 bit code, -m32 says generate 32 bit:
+set( CMAKE_CXX_FLAGS_INIT "-m32" CACHE STRING "C++ flag which generates 32 bit code." )
+set( CMAKE_C_FLAGS_INIT "-m32" CACHE STRING "C flag which generates 32 bit code." )
+set( CMAKE_SHARED_LINKER_FLAGS "-m32" CACHE STRING "Linker flag which finds 32 bit code." )
+set( CMAKE_MODULE_LINKER_FLAGS "-m32" CACHE STRING "Linker flag which finds 32 bit code." )
+set( CMAKE_EXE_LINKER_FLAGS "-m32" CACHE STRING "Linker flag which finds 32 bit code." )
+
+# Tell the 64 bit toolchain to generate a PE32 object file when running windres:
+set( CMAKE_RC_FLAGS "-F pe-i386" CACHE STRING "windres flag which generates 32 bit code." )
+
+
+# where is the target environment
+set( CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 )
+
+#-----</configuration>-----------------------------------------------
+
+# search for programs in the build host directories
+set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
+
+# for libraries and headers in the target directories
+set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
+set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
+
diff --git a/new/toolchain-mingw64.cmake b/new/toolchain-mingw64.cmake
new file mode 100644
index 0000000..bf4a366
--- /dev/null
+++ b/new/toolchain-mingw64.cmake
@@ -0,0 +1,35 @@
+
+# This is a CMake toolchain file so we can run Mingw64 to build a Windows64 binaries.
+# http://vtk.org/Wiki/CMake_Cross_Compiling
+
+# usage
+# cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain-mingw64.cmake ../
+
+
+set( CMAKE_SYSTEM_NAME Windows )
+set( CMAKE_SYSTEM_PROCESSOR x86_64 )
+
+#-----<configuration>-----------------------------------------------
+
+# configure only the lines within this <configure> block, typically
+
+set( TC_PATH /usr/bin )
+set( CROSS_COMPILE x86_64-w64-mingw32- )
+
+# specify the cross compiler
+set( CMAKE_C_COMPILER ${TC_PATH}/${CROSS_COMPILE}gcc )
+set( CMAKE_CXX_COMPILER ${TC_PATH}/${CROSS_COMPILE}g++ )
+set( CMAKE_RC_COMPILER ${TC_PATH}/${CROSS_COMPILE}windres )
+
+# where is the target environment
+set( CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 )
+
+#-----</configuration>-----------------------------------------------
+
+# search for programs in the build host directories
+set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
+
+# for libraries and headers in the target directories
+set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
+set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
+
diff --git a/new/utf8.h b/new/utf8.h
new file mode 100644
index 0000000..046d880
--- /dev/null
+++ b/new/utf8.h
@@ -0,0 +1,59 @@
+
+#ifndef UTF8_H_
+#define UTF8_H_
+
+#include <string>
+#include <deque>
+
+/**
+ * @ingroup string_types
+ * @{
+ */
+
+
+/**
+ * Type STRING
+ * holds a sequence of 8 bit bytes that represent a sequence of variable
+ * length multi-byte international characters, with unspecified encoding.
+ */
+typedef std::string STRING;
+
+/**
+ * Type STRINGS
+ * is an "array like" list of STRINGs
+ */
+typedef std::deque<STRING> STRINGS;
+
+/**
+ * Type STR_UTF
+ * holds a UTF8 encoded sequence of 8 bit bytes that represent a sequence
+ * of variable multi-byte international characters. UTF8 is the chosen encoding
+ * for all KiCad data files so that they can be transported from one nation to another
+ * without ambiguity. Data files are those where KiCad controls the content.
+ * This is not the same thing as filenames, which are not file content.
+ * Filenames may be encoded on disk using an encoding chosen by the host operating
+ * system. Nonetheless, KiCad data file _content_ is always UTF8 encoded, regardless
+ * of host operating system.
+ * STR_UTF is UTF8 encoded, by definition.
+ */
+typedef STRING STR_UTF;
+
+/**
+ * Type STR_UTFS
+ * is an "array like" list of STR_UTFs
+ */
+typedef std::deque<STRING> STR_UTFS;
+
+/** @} string_types */
+
+
+// @todo this does not belong here
+#ifndef D
+#ifdef DEBUG
+#define D(x) x
+#else
+#define D(x) // nothing
+#endif
+#endif
+
+#endif // UTF8_H_