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

more free SWEET software

parent c2ff1d94
Loading
Loading
Loading
Loading
+50 B (21.5 KiB)

File changed.

No diff preview for this file type.

+42 −0
Original line number Original line Diff line number Diff line
@@ -56,6 +56,28 @@ PIN2="
        (padname A24 (font (size 0.9 1.1) italic bold) (visible yes))
        (padname A24 (font (size 0.9 1.1) italic bold) (visible yes))
    )"
    )"


PIN3="
    (pin (padname A25))"

PINS="
    (pin (padname Z12))(pin (padname Y14))(pin (padname Z13))(pin (padname Y15))"


PIN_SWAP="
    (pin_swap A23 A24)"

PIN_RENUM="
    (pin_renum A24 B24)"

PIN_RENAME="
    (pin_rename #WE LED)"

PIN_DELETE="
    (pin_del B24)"

PIN_MERGE="(pin_merge A23 (hide Z12 Y14))(pin_merge A25 (hide Z13 Y15))"


PROP1="
PROP1="
    (property mWatts 12
    (property mWatts 12
        (effects (at 1 34 270)(font (size .5 1) italic bold)(visible no))
        (effects (at 1 34 270)(font (size .5 1) italic bold)(visible no))
@@ -64,6 +86,10 @@ PROP1="
KEYWORDS="
KEYWORDS="
    (keywords varistor batcave einstein)"
    (keywords varistor batcave einstein)"


ALTERNATES="
    (alternates 7400/7400_b 7400/7400_c)"




for C in ${CATEGORIES}; do
for C in ${CATEGORIES}; do


@@ -81,8 +107,16 @@ for C in ${CATEGORIES}; do
                $TEXT
                $TEXT
                $PIN1
                $PIN1
                $PIN2
                $PIN2
                $PIN3
                $PINS
                $PROP1
                $PROP1
                $KEYWORDS
                $KEYWORDS
                $ALTERNATES
                $PIN_SWAP
                $PIN_RENUM
                $PIN_RENAME
                $PIN_DELETE
                $PIN_MERGE
                )" > $BASEDIR/$C/$P.part.$R
                )" > $BASEDIR/$C/$P.part.$R
        done
        done
        # also make the part without a rev:
        # also make the part without a rev:
@@ -96,8 +130,16 @@ for C in ${CATEGORIES}; do
            $TEXT
            $TEXT
            $PIN1
            $PIN1
            $PIN2
            $PIN2
            $PIN3
            $PINS
            $PROP1
            $PROP1
            $KEYWORDS
            $KEYWORDS
            $ALTERNATES
            $PIN_SWAP
            $PIN_RENUM
            $PIN_RENAME
            $PIN_DELETE
            $PIN_MERGE
            )" > $BASEDIR/$C/$P.part
            )" > $BASEDIR/$C/$P.part
    done
    done
done
done
+7 −1
Original line number Original line Diff line number Diff line
@@ -123,13 +123,19 @@ static int okRevision( const STRING& aField )
//----</Policy and field test functions>-------------------------------------
//----</Policy and field test functions>-------------------------------------




int LPID::Parse( const STRING& aLPID )
void LPID::clear()
{
{
    logical.clear();
    logical.clear();
    category.clear();
    category.clear();
    baseName.clear();
    baseName.clear();
    partName.clear();
    partName.clear();
    revision.clear();
    revision.clear();
}


int LPID::Parse( const STRING& aLPID )
{
    clear();


    const char* rev = EndsWithRev( aLPID );
    const char* rev = EndsWithRev( aLPID );
    size_t      revNdx;
    size_t      revNdx;
+2 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@


namespace SCH {
namespace SCH {



/**
/**
 * Class LPID
 * Class LPID
 * (aka GUID) is a Logical Part ID and consists of various portions much like a URI.
 * (aka GUID) is a Logical Part ID and consists of various portions much like a URI.
@@ -196,6 +197,7 @@ public:
    static STRING Format( const STRING& aLogicalLib, const STRING& aPartName, const STRING& aRevision="" )
    static STRING Format( const STRING& aLogicalLib, const STRING& aPartName, const STRING& aRevision="" )
        throw( PARSE_ERROR );
        throw( PARSE_ERROR );


    void clear();


#if defined(DEBUG)
#if defined(DEBUG)
    static void Test();
    static void Test();
+99 −22
Original line number Original line Diff line number Diff line
@@ -34,7 +34,7 @@


/**
/**
 * Function formatAt
 * Function formatAt
 * returns a formatted "(at X Y [ANGLE])" s-expression
 * outputs a formatted "(at X Y [ANGLE])" s-expression
 */
 */
static void formatAt( OUTPUTFORMATTER* out, const POINT& aPos, ANGLE aAngle, int indent=0 )
static void formatAt( OUTPUTFORMATTER* out, const POINT& aPos, ANGLE aAngle, int indent=0 )
    throw( IO_ERROR )
    throw( IO_ERROR )
@@ -72,6 +72,18 @@ void PART::clear()
        extends = 0;
        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:
    // delete graphics I own, since their container will not destroy them:
    for( GRAPHICS::iterator it = graphics.begin();  it != graphics.end();  ++it )
    for( GRAPHICS::iterator it = graphics.begin();  it != graphics.end();  ++it )
        delete *it;
        delete *it;
@@ -82,21 +94,13 @@ void PART::clear()
        delete *it;
        delete *it;
    pins.clear();
    pins.clear();


    // delete properties I own, since their container will not destroy them:
    alternates.clear();
    for( PROPERTIES::iterator it = properties.begin();  it != properties.end();  ++it )
        delete *it;
    properties.clear();


    keywords.clear();
    keywords.clear();


    contains = 0;
    pin_merges.clear();


    // clear the mandatory fields
    contains = 0;
    for( int ndx = REFERENCE;  ndx < END;  ++ndx )
    {
        delete mandatory[ndx];
        mandatory[ndx] = 0;
    }
}
}




@@ -141,6 +145,49 @@ PROPERTY* PART::FieldLookup( PROP_ID aPropertyId )
    return p;
    return p;
}
}


PINS::iterator PART::pinFindByPadName( const wxString& aPadName )
{
    PINS::iterator it;

    for( it = pins.begin();  it != pins.end();  ++it )
    {
        if( (*it)->padname.text == aPadName )
            break;
    }

    return it;
}


PINS::iterator PART::pinFindBySignal( const wxString& aSignal )
{
    PINS::iterator it;

    for( it = pins.begin();  it != pins.end();  ++it )
    {
        if( (*it)->signal.text == aSignal )
            break;
    }

    return it;
}


bool PART::PinDelete( const wxString& aPadName )
{
    PINS::iterator it = pinFindByPadName( aPadName );
    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()
PART::~PART()
{
{
@@ -185,19 +232,17 @@ void PART::Parse( SWEET_PARSER* aParser , LIB_TABLE* aTable ) throw( IO_ERROR, P
}
}




void PART::PropertyDelete( const wxString& aPropertyName ) throw( IO_ERROR )
bool PART::PropertyDelete( const wxString& aPropertyName )
{
{
    PROPERTIES::iterator it = propertyFind( aPropertyName );
    PROPERTIES::iterator it = propertyFind( aPropertyName );
    if( it == properties.end() )
    if( it != properties.end() )
    {
    {
        wxString    msg;
        msg.Printf( _( "Unable to find property: %s" ), aPropertyName.GetData() );
        THROW_IO_ERROR( msg );
    }

        delete *it;
        delete *it;
        properties.erase( it );
        properties.erase( it );
    return;
        return true;
    }

    return false;
}
}




@@ -258,6 +303,26 @@ void PART::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
        (*it)->Format( out, indent+1, ctl );
        (*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 (hide", 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" );
    out->Print( indent, ")\n" );
}
}


@@ -349,18 +414,30 @@ void FONT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
    throw( IO_ERROR )
    throw( IO_ERROR )
{
{
    bool    hasSignal  = !signal.text.IsEmpty();
    bool    hasPadName = !padname.text.IsEmpty();

    out->Print( indent, "(pin %s %s ", ShowType(), ShowShape() );
    out->Print( indent, "(pin %s %s ", ShowType(), ShowShape() );


    formatAt( out, pos, angle );
    formatAt( out, pos, angle );
    out->Print( 0, "(length %.6g)", InternalToLogical( length ) );
    out->Print( 0, "(length %.6g)", InternalToLogical( length ) );
    out->Print( 0, "(visible %s)\n", isVisible ? "yes" : "no" );
    out->Print( 0, "(visible %s)\n", isVisible ? "yes" : "no" );


    signal.Format(  out, "signal",  indent+1, 0 );
    if( hasSignal )
        signal.Format(  out, "signal",  indent+1, hasPadName ? 0 : CTL_OMIT_NL );

    if( hasPadName )
        padname.Format( out, "padname", indent+1, CTL_OMIT_NL );
        padname.Format( out, "padname", indent+1, CTL_OMIT_NL );

    out->Print( 0, ")\n" );
    out->Print( 0, ")\n" );
}
}




PIN::~PIN()
{
}


void PINTEXT::Format( OUTPUTFORMATTER* out, const char* aElement, int indent, int ctl ) const
void PINTEXT::Format( OUTPUTFORMATTER* out, const char* aElement, int indent, int ctl ) const
    throw( IO_ERROR )
    throw( IO_ERROR )
{
{
Loading