convert SKILL list to string

Discussion in 'Cadence' started by Erik Wanta, Dec 18, 2006.

  1. Erik Wanta

    Erik Wanta Guest

    I have a list that I want to convert to a string. I want to convert
    the following
    from:
    (((x:xI5):M4_p):nsmm_dela_dl_nmos_10w_bsim3v3)
    to:
    x:xI5:M4_p:nsmm_dela_dl_nmos_10w_bsim3v3
     
    Erik Wanta, Dec 18, 2006
    #1
    1. Advertisements

  2. Where do you get it from?
    (((x:xI5):M4_p):nsmm_dela_dl_nmos_10w_bsim3v3)

    Are x x15 etc. strings or symbols?

    Bernd
     
    Bernd Fischer, Dec 19, 2006
    #2
    1. Advertisements

  3. Erik Wanta

    Erik Wanta Guest

    Bernd:
    I have a file with really long line length. I am using lineread
    instead of gets to read lines from the file. The example below is one
    of the elements in a list of elements in the output of lineread.
    (((x:xI5):M4_p):nsmm_dela_dl_nmos_10w_bsim3v3) is a list and everything
    in it is a string. I want to generate a string without all the
    parenthesis.
     
    Erik Wanta, Dec 19, 2006
    #3
  4. Erik Wanta

    mohanr Guest

    Erik,

    According to my understanding you just want to remove the "(" and ")"
    from the file. Is this correct ? If yes, then you could use perl/sed to
    remove the "(" and ')" character from the file before reading to skill
    and read the file in skill and continue.

    May be i am missing something..................

    Regards,
    Mohan R
     
    mohanr, Dec 20, 2006
    #4
  5. If I understood you right,

    This is what you have
    aList = list("((x:xI5):M4_p):nsmm_dela_dl_nmos_10w_bsim3v3")
    => ("((x:xI5):M4_p):nsmm_dela_dl_nmos_10w_bsim3v3")

    And this is what you want
    buildString( parseString( car( aList ) "()" ) "" )
    => "x:xI5:M4_p:nsmm_dela_dl_nmos_10w_bsim3v3"

    Bernd
     
    Bernd Fischer, Dec 20, 2006
    #5
  6. Erik Wanta

    Poojan Wagh Guest

    So, you have

    list(list(list("x:xl5") "M4_p") "nsmm_dela_dl_nmos_10w_bsim3v3)

    and you want to convert it into

    "x:xl5:M4_p:nsmm_dela_dl_nmos_10w_bsim3v3"

    Is that correct?
     
    Poojan Wagh, Dec 20, 2006
    #6
  7. Erik Wanta

    Erik Wanta Guest

    Poojan:
    small world

    I have a Russian matryoshka doll situation. I want to collapse the
    shells into one string. The elements in the list are either other
    lists or symbols.

    \i aList
    \t (((x:xI5):M4_p):nsmm_dela_dl_nmos_10w_bsim3v3)
    \p >
    \i type(aList)
    \t list
    \p >
    \i nth(0 aList)
    \t range
    \p >
    \i nth(1 aList)
    \t ((x:xI5):M4_p)
    \p >
    \i nth(2 aList)
    \t nsmm_dela_dl_nmos_10w_bsim3v3
    \p >
    \i nth(3 aList)
    \t nil
    \p >
    \a hiResizeWindow(window(1) list(0:15 897:531))
    \r t
    \i type(nth(2 aList))
    \t symbol
    \p >
    \a hiResizeWindow(window(1) list(0:15 897:531))
    \r t
    \i type(nth(1 aList))
    \t list
    \p >
     
    Erik Wanta, Dec 20, 2006
    #7
  8. Erik Wanta

    Erik Wanta Guest

    I wrote a recursive function to obtain the desired string. I suspect
    there is a slick one line SKILL command using mapcar to do the same.
     
    Erik Wanta, Dec 20, 2006
    #8
  9. Erik,

    I think you need that recursive function to flatten the list - although the :
    operators end up being (range l r).

    I used

    (defun abFlattenList (a)
    (if (listp a) (foreach mapcar elem a (abFlattenList elem)) (list a))
    )

    to flatten it - but I don't think that's quite what you want. Since you already
    have a solution, I didn't experiment further, because I probably would need more
    knowledge of what you're really trying to do...

    Andrew.
     
    Andrew Beckett, Jan 9, 2007
    #9
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.