• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Using defmacro badly...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 13322
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using defmacro badly...

markbeck
markbeck over 14 years ago

Greetings all,

I'm trying to do something which I suspect may not be possible, but I figured I should ask.

I wish to create a macro that allows the user to write the contents of the @rest into a file.

e.g.

MyFileMacro( This is what I want to be written to a file)

I found that if I defined the following macro, I can get close:

(defmacro MyFileMacro (@rest body)
    sprintf(t_body "%L" `,body)
    `FunToWriteOutFile(,t_body)
)

This sorta works, but I have to clean up what is sent to `,body before writing it out to a file. `,body appears to be a bunch of function strings and so I end up with lots of '(' and ')' characters.

The issue I'm encountering is when the user enters in characters that are interpreted as a badly formed macro call...

e.g. MyFileMacro( blah{blah} )

This gives me a syntax error since skill is trying to interpret the contents of body before sending it to `,body.

 Basic question:

Is there a way to force the @rest body contents to be identically returned without any interpretation, such that I can then shove it into a string, or just get it to always interpret it as a string?

 Thanks,
Mark

  • Cancel
Parents
  • markbeck
    markbeck over 14 years ago

     Ya, I suspected that this was the case. 

    From a programmer's standpoint, it's easier to deal with strings, however from a user's standpoint, if they have to write out something to a text file that needs quote characters they have to escape them..

    e.g. 

    If I wanted to write out:  The "cat" in the "hat"

    I would have to enter the string as:  "The \\"cat\\" in the \\"hat\\""

    It makes it a bit harder to read the contents...

     Thanks,
    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • markbeck
    markbeck over 14 years ago

     Ya, I suspected that this was the case. 

    From a programmer's standpoint, it's easier to deal with strings, however from a user's standpoint, if they have to write out something to a text file that needs quote characters they have to escape them..

    e.g. 

    If I wanted to write out:  The "cat" in the "hat"

    I would have to enter the string as:  "The \\"cat\\" in the \\"hat\\""

    It makes it a bit harder to read the contents...

     Thanks,
    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information