Commit f3d5c494 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

meet Ralph, a big harry template fieldnames patch

parent 39476ccd
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
eeschema/cmp_library_base.cpp
eeschema/cmp_library_base.h
eeschema/cmp_library_keywords.cpp
eeschema/cmp_library_keywords.h
eeschema/template_fieldnames_keywords.cpp
eeschema/template_fieldnames_keywords.h
pcbnew/dialog_freeroute_exchange_help_html.h
Makefile
CMakeFiles
@@ -9,4 +11,5 @@ Testing
version.h
config.h
install_manifest.txt
Documentation/doxygen
*.cmake
+26 −0
Original line number Diff line number Diff line
@@ -4,6 +4,32 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.

2010-Jun-17 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++eeschema:
    Added "template fieldnames" to eeschema. This is a list of template elements
    consisting of {name, value, visibility} which you want shown in the eeschema
    component fieldname (property) editors (both schematic and library versions
    of the editors). Template fieldnames are forced into the editors'
    presentation of the fields even though those fields may not exist in the
    component. Entering a non-blank value while in a field editor will cause the
    field & value to be retained in the component. Therefore it is unusual to
    provide a non-blank '.value' in a template, because a trip through the field
    editor will invariably add that field to the component since the template
    being applied has initially a non blank 'value'. The current template editor
    is only going to last about a week and it does not support adding non-blank
    template values yet, nor visibility control, only field '.name'. But the
    template fieldnames configuration storage and component field editors do
    know how to handle template.visible and template.value already, in addition
    to template.name. See the file .eeschema in your home directory for the
    configuration storage, keyword: FieldNames. e.g. only field Manufacturer has
    a '.value':

    FieldNames=(templatefields (field (name "Manufacturer")(value "IBM 12")) (field (name "Vendor")) (field (name "Installed")) (field (name "Ralphy") visible))

    DSNLEXER is used to parse the FieldNames record, & OUTPUTFORMATTER to generate it.


2010-jun-15, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
bitmap2component:
+24 −11
Original line number Diff line number Diff line
@@ -39,23 +39,29 @@
# Usage:
#
#     add_custom_command(
#         OUTPUT ${CMAKE_BINARY_DIR}/cmp_library_base.h
#         OUTPUT  ${CMAKE_BINARY_DIR}/cmp_library_keywords.h
#                 ${CMAKE_BINARY_DIR}/cmp_library_keywords.cpp
#         COMMAND ${CMAKE_COMMAND}
#                 -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/token_list_file
#                 -Denum=YOURTOK_T
#                 -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst
#                 -P ${CMAKE_MODULE_PATH}/TokenList2DsnLexer.cmake
#         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst
#    )
#
# Input parameters:
#
#     enum       - The name of the enum to generate, defaults to DSN_T, but
#                  you'll get collisions if you don't override it.
#     inputFile  - The name of the token list file.
#     outputPath - Optional output path to save the generated files.  If not defined,
#                  the output path is the same path as the token list file path.
#


set( tokens "" )
set( lineCount 0 )
set( dsnErrorMsg "DSN token file generator failure:" )


if( NOT EXISTS ${inputFile} )
    message( FATAL_ERROR "${dsnErrorMsg} file ${inputFile} cannot be found." )
endif( NOT EXISTS ${inputFile} )
@@ -64,14 +70,20 @@ if( NOT EXISTS ${outputPath} )
    get_filename_component( outputPath "${inputFile}" PATH )
endif( NOT EXISTS ${outputPath} )

if( NOT DEFINED enum )
    set( enum DSN_T )
endif()
#message( STATUS "enum: ${enum}" )


# Separate the file name without extension from the full file path.
get_filename_component( result "${inputFile}" NAME_WE )

message( STATUS "Extracted file name ${result} from path ${inputFile}" )

# Create include and source file name from the list file name.
set( includeFileName "${outputPath}/${result}_base.h" )
set( sourceFileName "${outputPath}/${result}_base.cpp" )
set( includeFileName "${outputPath}/${result}_keywords.h" )
set( sourceFileName "${outputPath}/${result}_keywords.cpp" )

# Create tag for generating header file.
string( TOUPPER "${result}" fileNameTag )
@@ -91,7 +103,7 @@ set( includeFileHeader

namespace DSN {

enum DSN_T {
enum ${enum} {

    // these first few are negative special ones for syntax, and are
    // inherited from DSNLEXER.
@@ -122,7 +134,7 @@ set( sourceFileHeader
#include \"fctsys.h\"
#include \"macros.h\"

#include \"${result}_base.h\"
#include \"${result}_keywords.h\"


namespace DSN {
@@ -130,7 +142,6 @@ namespace DSN {
#define TOKDEF(x)    { #x, T_##x }

const KEYWORD ${result}_keywords[] = {

"
)

@@ -193,6 +204,8 @@ endforeach( token ${tokens} )
file( APPEND "${includeFileName}"
"};

extern const KEYWORD  ${result}_keywords[];
extern const unsigned ${result}_keyword_count;

}   // End namespace DSN

+42 −0
Original line number Diff line number Diff line
@@ -182,6 +182,16 @@ const char* DSNLEXER::GetTokenText( int aTok )
}


wxString DSNLEXER::GetTokenString( int aTok )
{
    wxString    ret;

    ret << wxT("'") << CONV_FROM_UTF8( GetTokenText(aTok) ) << wxT("'");

    return ret;
}


void DSNLEXER::ThrowIOError( wxString aText, int charOffset ) throw (IOError)
{
    // append to aText, do not overwrite
@@ -193,6 +203,38 @@ void DSNLEXER::ThrowIOError( wxString aText, int charOffset ) throw (IOError)
}


void DSNLEXER::Expecting( int aTok ) throw( IOError )
{
    wxString    errText( _("Expecting") );
    errText << wxT(" ") << GetTokenString( aTok );
    ThrowIOError( errText, CurOffset() );
}


void DSNLEXER::Expecting( const wxString& text ) throw( IOError )
{
    wxString    errText( _("Expecting") );
    errText << wxT(" '") << text << wxT("'");
    ThrowIOError( errText, CurOffset() );
}


void DSNLEXER::Unexpected( int aTok ) throw( IOError )
{
    wxString    errText( _("Unexpected") );
    errText << wxT(" ") << GetTokenString( aTok );
    ThrowIOError( errText, CurOffset() );
}


void DSNLEXER::Unexpected( const wxString& text ) throw( IOError )
{
    wxString    errText( _("Unexpected") );
    errText << wxT(" '") << text << wxT("'");
    ThrowIOError( errText, CurOffset() );
}


/**
 * Function isspace
 * strips the upper bits of the int to ensure the value passed to ::isspace() is
+20 −4
Original line number Diff line number Diff line
@@ -124,6 +124,8 @@ set(EESCHEMA_SRCS
    symbdraw.cpp
    symbedit.cpp
    edit_graphic_bodyitem_text.cpp
    template_fieldnames_keywords.cpp
    template_fieldnames.cpp
    tool_lib.cpp
    tool_sch.cpp
    tool_viewlib.cpp
@@ -155,20 +157,34 @@ endif(APPLE)
# Generate DSN lexer header and source files for the component library file
# format.
add_custom_command(
    OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_base.h
    OUTPUT  ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.h
            ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.cpp
    COMMAND ${CMAKE_COMMAND}
        -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst
        -P ${CMAKE_MODULE_PATH}/TokenList2DsnLexer.cmake
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst
    COMMENT "creating ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_base.h(.cpp)
    COMMENT "creating ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.h(.cpp)
       from ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst"
    )

set_source_files_properties( cmp_library_lexer.cpp
    PROPERTIES
        OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_base.h
        OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_keywords.h
    )


add_custom_command(
    OUTPUT  ${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames_keywords.h
            ${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames_keywords.cpp
    COMMAND ${CMAKE_COMMAND}
        -Denum=TFIELD_T
        -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames.lst
        -P ${CMAKE_MODULE_PATH}/TokenList2DsnLexer.cmake
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames.lst
    COMMENT "creating ${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames_keywords.h(.cpp)
       from ${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames.lst"
    )


add_executable(eeschema WIN32 MACOSX_BUNDLE ${EESCHEMA_SRCS} ${EESCHEMA_EXTRA_SRCS}
    ${EESCHEMA_RESOURCES})

Loading