Home > Community > Forums > PCB SKILL > Problem about teh strcat command

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Problem about teh strcat command 

Last post Mon, Feb 13 2006 8:00 PM by archive. 5 replies.
Started by archive 13 Feb 2006 08:00 PM. Topic has 5 replies and 2420 views
Page 1 of 1 (6 items)
Sort Posts:
  • Mon, Feb 13 2006 8:00 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,950
    Problem about teh strcat command Reply

    I'm a newcomer, and I'm studying the SKILL.
    I wrote some code to report the dummy net pin and single pin( or unconnected pin), then asign the list to a form, browse them one by one. But one problem occured. For some projects, there is a error information for strcat command:
    Error* strcat: argument #1 should be either a string or a symbol

    The part of code is like this:

    let((Pin_List Dummy_Pin_List Single_Pin_List)
    Pin_List=Dummy_Pin_List=Single_Pin_List=nil
    foreach( item Pin_List
    if(item->net->name=="" then
    Dummy_Pin_List=cons(strcat(item->component->name "." item->number) Dummy_Pin_List)
    Dummy_Pin_List=sort(Dummy_Pin_List 'alphalessp)
    else
    if(length(item->branch->children)==1 then
    Single_Pin_List=cons(strcat(item->component->name "." item->number " / " item->net->name) Single_Pin_List)
    Single_Pin_List=sort(Single_Pin_List 'alphalessp)
    );if
    );if
    );foreach
    );let

    Who can help me with this problem. thanks.


    Originally posted in cdnusers.org by leonlee
    • Post Points: 0
  • Mon, Feb 13 2006 8:06 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,950
    RE: Problem about teh strcat command Reply

    of course

    The Pin_List is generateed by below code:

    axlDBRefreshId(axlDBGetDesign())
    axlClearSelSet()
    axlSetFindFilter(?enabled '(noall pins) ?onButtons '(noall pins))
    Pin_List=axlGetSelSet(axlAddSelectAll())


    Originally posted in cdnusers.org by leonlee
    • Post Points: 0
  • Mon, Feb 13 2006 8:20 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,950
    RE: Problem about teh strcat command Reply

    You are getting every pin record in the board database. Some of theins may be mechanical pins which have no number value. Then when you strcat item -> number strcat fails as you are seeing.

    Try adding a conditional that traps null item -> numbers
    For example
    if(item -> number != nil then


    Originally posted in cdnusers.org by AshCan
    • Post Points: 0
  • Mon, Feb 13 2006 8:24 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,950
    RE: Problem about teh strcat command Reply

    OK, thank you very much for your answer.
    I'll try it soon~~~


    Originally posted in cdnusers.org by leonlee
    • Post Points: 0
  • Mon, Feb 13 2006 11:57 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,950
    RE: Problem about teh strcat command Reply

    Another technique to address unwanted nil values is to use OR:
    strcat(x y item->number||"" z)
    Since 'or' stop evaluating on non-nil ("true") values from left to right.

    And not related to your question - you should sort once after
    the foreach statement (for improved performance).


    Originally posted in cdnusers.org by natan
    • Post Points: 0
  • Tue, Feb 14 2006 4:29 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,950
    RE: Problem about teh strcat command Reply

    Ok, the reason is:

    for the mechanical pin, item->component=nil item->nuber=""(null)

    I ignored it~~~


    Originally posted in cdnusers.org by leonlee
    • Post Points: 0
Page 1 of 1 (6 items)
Sort Posts:
Started by archive at 13 Feb 2006 08:00 PM. Topic has 5 replies.