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

++new:

    Completed a good portion of /new class DIR_LIB_SOURCE.
    Added an autonomous CMakeLists.txt file to /new, with new-docs target and
    test program target.
parents 78ef3152 80f21358
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,13 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2010-Dec-19 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++new:
    Completed a good portion of /new class DIR_LIB_SOURCE.
    Added an autonomous CMakeLists.txt file to /new, with new-docs target and
    test program target.

2010-dec-15, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
2010-dec-15, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
================================================================================
Gerbview:
Gerbview:
+82 −0
Original line number Original line Diff line number Diff line
/*
 * 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
 */

#ifndef KICAD_EXCEPTIONS_H_
#define KICAD_EXCEPTIONS_H_

/*  Just exceptions
*/


#include <wx/string.h>

/**
 * Struct IO_ERROR
 * is a class used to hold an error message and may be used to throw exceptions
 * containing meaningful error messages.
 * @author Dick Hollenbeck
 */
struct IO_ERROR
{
    wxString    errorText;

    IO_ERROR( const wxChar* aMsg ) :
        errorText( aMsg )
    {
    }

    IO_ERROR( const wxString& aMsg ) :
        errorText( aMsg )
    {
    }

    IO_ERROR( const char* aMsg ) :
        errorText( wxConvertMB2WX( aMsg ) )
    {
    }
};


/**
 * Class PARSE_ERROR
 * contains a filename or source description, a line number, a character offset,
 * and an error message.
 * @author Dick Hollenbeck
 */
struct PARSE_ERROR : public IO_ERROR
{
    wxString    source;         ///< filename typically, unless from RAM
    int         lineNumber;
    int         byteIndex;      ///< char offset, starting from 1, into the problem line.

    PARSE_ERROR( const wxString& aMsg, const wxString& aSource,
                    int aLineNumber, int aByteIndex ) :
        IO_ERROR( aMsg ),
        source( aSource ),
        lineNumber( aLineNumber )
    {
    }
};

#endif  // KICAD_EXCEPTIONS_H_
+4 −3
Original line number Original line Diff line number Diff line
@@ -6,9 +6,10 @@
 */
 */




#ifndef __INCLUDE__KICAD_STRING_H__
#ifndef KICAD_STRING_H_
#define __INCLUDE__KICAD_STRING_H__ 1
#define KICAD_STRING_H_


#include <wx/string.h>


char*    strupper( char* Text );
char*    strupper( char* Text );
char*    strlower( char* Text );
char*    strlower( char* Text );
@@ -102,4 +103,4 @@ int SplitString( wxString strToSplit,
                 wxString* strDigits,
                 wxString* strDigits,
                 wxString* strEnd );
                 wxString* strEnd );


#endif // __INCLUDE__KICAD_STRING_H__
#endif  // KICAD_STRING_H_
+13 −32
Original line number Original line Diff line number Diff line
@@ -37,30 +37,10 @@
// I really did not want to be dependent on wxWidgets in richio
// I really did not want to be dependent on wxWidgets in richio
// but the errorText needs to be wide char so wxString rules.
// but the errorText needs to be wide char so wxString rules.
#include <wx/wx.h>
#include <wx/wx.h>
#include <cstdio>       // FILE
#include <cstdio>
#include <kicad_exceptions.h>





/**
 * Struct IO_ERROR
 * is a class used to hold an error message and may be used to throw exceptions
 * containing meaningful error messages.
 */
struct IO_ERROR
{
    wxString    errorText;

    IO_ERROR( const wxChar* aMsg ) :
        errorText( aMsg )
    {
    }

    IO_ERROR( const wxString& aMsg ) :
        errorText( aMsg )
    {
    }
};

#define LINE_READER_LINE_DEFAULT_MAX        100000
#define LINE_READER_LINE_DEFAULT_MAX        100000
#define LINE_READER_LINE_INITIAL_SIZE       5000
#define LINE_READER_LINE_INITIAL_SIZE       5000


@@ -234,18 +214,19 @@ public:


/**
/**
 * Class OUTPUTFORMATTER
 * Class OUTPUTFORMATTER
 * is an important interface (abstract) class used to output UTF8 text in a convenient
 * is an important interface (abstract) class used to output UTF8 text in
 * way. The primary interface is "printf() - like" but with support for indentation
 * a convenient way. The primary interface is "printf() - like" but
 * control.  The destination of the 8 bit wide text is up to the implementer.
 * with support for indentation control.  The destination of the 8 bit
 * wide text is up to the implementer.
 * <p>
 * <p>
 * The implementer only has to implement the write() function, but can also optionaly
 * The implementer only has to implement the write() function, but can
 * re-implement GetQuoteChar().
 * also optionally re-implement GetQuoteChar().
 * <p>
 * <p>
 * If you want to output a wxString, then use CONV_TO_UTF8() on it before passing
 * If you want to output a wxString, then use CONV_TO_UTF8() on it
 * it as an argument to Print().
 * before passing it as an argument to Print().
 * <p>
 * <p>
 * Since this is an abstract interface, only classes derived from this one
 * Since this is an abstract interface, only classes derived from
 * may actually be used.
 * this one may actually be used.
 */
 */
class OUTPUTFORMATTER
class OUTPUTFORMATTER
{
{
@@ -307,7 +288,7 @@ public:
     * Function Print
     * Function Print
     * formats and writes text to the output stream.
     * formats and writes text to the output stream.
     *
     *
     * @param nestLevel The multiple of spaces to preceed the output with.
     * @param nestLevel The multiple of spaces to precede the output with.
     * @param fmt A printf() style format string.
     * @param fmt A printf() style format string.
     * @param ... a variable list of parameters that will get blended into
     * @param ... a variable list of parameters that will get blended into
     *  the output under control of the format string.
     *  the output under control of the format string.

new/CMakeLists.txt

0 → 100644
+65 −0
Original line number Original line Diff line number Diff line

set( STAND_ALONE true )

if( STAND_ALONE )
    project(kicad-new)

    cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)

    set( PROJECT_SOURCE_DIR ${CMAKE_CURRENT_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 aui adv html core net base xml QUIET)
    endif()

    check_find_package_result( wxWidgets_FOUND "wxWidgets" )

    # 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)

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_SOURCE_DIR} )

add_executable( test_dir_lib_source sch_dir_lib_source.cpp )
#add_executable( test_dir_lib_source EXCLUDE_FROM_ALL sch_dir_lib_source.cpp )

target_link_libraries( test_dir_lib_source ${wxWidgets_LIBRARIES} )
Loading