Emacs mode for SKILL

Discussion in 'Cadence' started by jmss, Aug 17, 2007.

  1. jmss

    jmss Guest

    Hi,

    I've read through many discussions on this topic in the last two weeks
    or so.

    In fact, in my case emacs' lisp-mode is OK for SKILL except when I use
    C function calling syntax instead of Lisp's. This ruins indentation
    completely.

    Is there any small change to make in order to get the correct code
    indentation for SKILL scripts?

    Using the emacs-skill-mode package (which is somewhat hard to find and
    download) demands for root privileges and is kind of an overkill for
    my problem.

    Any insight will be very appreciated.

    Best regards,
    João M. S. Silva
     
    jmss, Aug 17, 2007
    #1
  2. jmss

    Edward Guest


    Hi João,

    I had the same problem. I get around this by using Lisp sexp notation
    for nearly everything. The Cadence SKILL docs recommend sticking with
    only one style or the other, but I cheat a little here and there with
    structures like, "obj~>property~>subproperty."

    But now you have me curious. Which C-function syntaxes do you find to
    be worth the trouble? I haven't found one C-function syntax I like
    better now that I'm familiar with using the Lisp-function syntax.

    Edward
     
    Edward, Aug 18, 2007
    #2
  3. If you are not completely tied to emacs, then maybe nedit can help you
    out. There is a skill mode for nedit available from the nedit
    homepage, just type "skill" in the page search box. If you search this
    group on nedit syntax highlight, you will find more help and advices.
    There is even a little generator to convert the finder short help into
    nedit calltips. Nedit starts fast and is nice as a (set edit "nedit")
    companion in CIW.
    In my opinion the -> and ~> notations are more readable than their
    lisp cousins. A deep access can become very ugly. I would not consider
    this as cheating even if it is.
    I agree even if I bite my butt on those closing parenthesis, specially
    on setq. the infix assignment a= is a bit less error-prone. If Cadence
    would have enforced a space after the ( and before the ) the code
    would have been more readable. A syntactical correct lisp code must
    have more air than a syntactical correct c-like code, which helps
    readability, specially within environments where more people develop
    code. It is, of course, always possible to use the pp() function for
    pretty-printing own code.....
     
    Svenn Are Bjerkem, Aug 18, 2007
    #3
  4. jmss

    jmss Guest

    I had the same problem. I get around this by using Lisp sexp notation
    Ok. I hadn't realized that the ~> notation was C-like.
    The problem is that I'm changing code originally wrote by a co-worker.
    Moreover, it is probable that in the future this same code will be
    changed by someone else. So, changing the function calling syntax
    isn't advisable.

    Right now the code is a bit irregular in indentation, so I would like
    to select all code and 'indent-region' but that doesn't work well with
    the different calling syntaxes.
     
    jmss, Aug 20, 2007
    #4
  5. jmss

    jmss Guest

    If you are not completely tied to emacs, then maybe nedit can help you
    Well, nedit is kind of the standard here but I'm used to emacs (for
    development and comprehensive text editing) or vi (for fast jobs).
    Well, it is relatively easy to insert a blank space after the ( and
    before the ) with a regular expression replacement. What intrigues me
    most is why there isn't a simple 2 minute fix for the indentation
    problem, but I guess that messes with the syntactic analyser of emacs
    mode which is not trivial to tweak.
     
    jmss, Aug 20, 2007
    #5
  6. jmss

    Edward Guest

    This is unfortunate. However, if this is likely to come up often in
    the course of your work, you might consider writing your own format
    translator. That way you can translate code from the faux C-style to
    mostly Lispish, indent the code, and then translate it back. I
    already do something like this with regexp-replace (Emacs) when I
    decide to adopt a useful swath of code in SKILL's less-than-useful
    format.

    Of course, this may require more work/risk than you're willing to
    take on for a simple one-off, but it could prove useful as a tool for
    long-term development. Additionally, I thought I read somewhere that
    SKILL translates to sexp notation before executing anyway. Perhaps
    Mr. Beckett or someone with more experience can point out a way to tap
    that functionality.
    Now that I think of it, there is a fellow on the group who works for
    a company that sells & supports something akin to SKILL mode. Wish I
    could remember the name now. However, I think he is more interested
    in corporate sales than sales to individuals.

    Good luck,

    Edward
     
    Edward, Aug 20, 2007
    #6
  7. jmss

    jmss Guest

    This is unfortunate. However, if this is likely to come up often in
    I just tried that but more unfortunately the function calling syntax
    is not always the same throughout the code, not even the amount of
    space used :\
    I found out that the emacs automatic indentation, although somehow
    exaggerated, is not so bad. Now I have an highlighting problem
    concerning the vertical OR bars. Is looks like emacs thinks everything
    between | | are comments. But I'll manage that.

    Looks like the skill-mode package would really be unnecessary.

    Thanks for your help.
    João M. S. Silva
     
    jmss, Aug 21, 2007
    #7
  8. Did you try the pretty-print function pp()? Give it a function of
    yours, and it will format it, unfortunately not anymore in lisp, but a
    quite readable c-style code. (Nice space before and after = and the
    closing )'s nicely aligned with the opening ones.
     
    Svenn Are Bjerkem, Aug 21, 2007
    #8
  9. jmss

    jmss Guest

    Did you try the pretty-print function pp()? Give it a function of
    Yes. The only problem I see with it is that it receives functions but
    not files. So if I wanted to prettify an entire file I would have to
    make some manual work.

    Emacs Lisp mode is not perfect but it's the best I can get with the
    amount of effort I can afford. So I'll stick to it until it gives me
    problems.

    Anyway, SKILL will probably be replaced by Python in the future. Isn't
    it?

    Thanks for you help.
     
    jmss, Aug 21, 2007
    #9
  10. Why do you think that? IMHO, there is too much Skill internally at Cadence
    and externally at customers' sites to think about replacing it.
     
    Jean-Marc Bourguet, Aug 22, 2007
    #10
  11. jmss

    jmss Guest

    Why do you think that? IMHO, there is too much Skill internally at Cadence
    You are certainly right.

    I'm relatively new to SKILL but, for instance, the way one designs
    forms in SKILL (with the x,y coordinates, etc.) is somewhat archaic.
    In some time, I think it will be better to start developing in python,
    affording to loose some time in the migration process, than to loose
    some time with SKILL forms or training someone to learn Lisp/SKILL.

    I don't know. I'm just speculating.
     
    jmss, Aug 22, 2007
    #11
  12. Andrew Beckett clearly states that SKILL will not be replaced. It may
    get augmented with other scripting languages, but not replaced. This
    quesiton came up on this group earlier, and I am suprised that this
    question came up again so quickly.

    SKILL is not about forms, SKILL is about design automation. Python is
    wrapping the crappy GUI toolkits like GTK into a "pythonic" object
    layer hiding the gory deatils from you.
     
    Svenn Are Bjerkem, Aug 22, 2007
    #12
  13. jmss

    Guest Guest

    The form design has nothing to do with the Skill language. Were the form
    design to be updated, it would not require a language change, and moving the
    API to another language would just entail having the same API in another
    language.

    Note that 1D forms don't require an x/y position, you just don't get 2D
    placement -- everything is vertically laid out in the order specified.

    Please don't confuse the base language with the provided APIs.

    -Pete Zakel
    ()

    "Hell hath no fury like a bureaucrat scorned."

    -Milton Friedman
     
    Guest, Aug 22, 2007
    #13
  14. You can get it in LISP format by doing:

    sstatus(printinfix nil)
    pp(yourFuncName)

    The parser effectively converts all infix-style (i.e. C-style) syntax into LISP
    first. You can see this by doing:

    expr='(1+2*3-4)
    procedure(abRecursivePrint(lst "l")
    printf("(")
    foreach(item lst
    if(listp(item) then
    abRecursivePrint(item)
    else
    printf("%L " item)
    )
    )
    printf(")\n")
    t
    )

    abRecursivePrint(expr)

    outputs:

    (difference (plus 1 (times 2 3 )
    )
    4 )


    (not particularly nicely formatted - just gives you the idea)

    Once the function is first executed, it's converted into a byte-code
    representation - and then pp() decompiles that byte code back into
    familiar syntax (or at least something approximating to familar syntax ;-> )

    Regards,

    Andrew.
     
    Andrew Beckett, Sep 16, 2007
    #14
  15. jmss

    jmss Guest

    You can get it in LISP format by doing:

    (...)
    I used a regular expression replacement in emacs to switch from
    function( to (function and further replaced the &&, ||, etc. symbols
    with the corresponding expressions and then I ran emacs indent-region.

    It is now ok.
     
    jmss, Sep 20, 2007
    #15
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.