• 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. Allegro X PCB Editor
  3. printf() as first line and number formatting

Stats

  • Replies 14
  • Subscribers 160
  • Views 21557
  • Members are here 0
More Content

printf() as first line and number formatting

EvanShultz
EvanShultz over 16 years ago

OK, here's a weird one for you. I want to print some information for the user into the Command window before I do anything else. So, I figured why not make a printf() statement the very first line of code? I suppose it should work - George does it on lines 25-35 of tekTechFileXML.il (from SourceLink). But for me, nothing is printed in the Command window. If I move the exact same statement as the first line of the procedure(), the text is printed to the Command window.

So what's my problem? Well, farther down in the procedure() a subroutine is called which uses axlEnterPath(). And the "Enter first point" prompt from axlEnterPath() comes BEFORE my printf() text, even though the printf() comes first in the code. My mind is boggled. I changed the prompt for axlEnterPath so I know it is this SKILL function that is creating the prompt which is jumping ahead of my printf() text.

Any ideas why this SKILL function can't wait it's turn? Or, better yet, how can I get the string in a printf() statement to show in the Command window if the printf() statement is the very first line of the SKILL routine?

 

 Secondly, I want to print out a table of information which may be integers or floating point numbers. How can I do this while keeping the table nicely lined up? Here is what I've found:

%-10n - displays both number types, but pads with zeros for floating point numbers

%-10g or %g - barfs on integers

%-10L or %L - displays both number types, no padding zeros for fp, but ignores [width] field (as per page 170 of sklangref.pdf)

So, what options do I have? I want similar to %-10n output, but without zero padding. %-10g would seem to be the right choice. I've used %g in other SKILL programs and it gracefully handled both integer and fp numbers - any ideas why it isn't with integers for me now?

  • Sign in to reply
  • Cancel
Parents
  • EvanShultz
    EvanShultz over 16 years ago

     Hi Charlie,

    Hmm, axlMsgPut still doesn't print if it's the first line, but it does print before axlEnterPath (when printf doesn't). So I'm satisfied. So is axlMsgPut best suited for displaying in the Command window and printf is best used for anything else (external file, buffer, etc)? Thanks!

     

    For my second issue, %g doesn't work in the other code I was referring to - it barfs on integers there too. I don't know what I was thinking. So, how can I place either integers or fp numbers in a certain width of field without having zeros padded?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • EvanShultz
    EvanShultz over 16 years ago

     Hi Charlie,

    Hmm, axlMsgPut still doesn't print if it's the first line, but it does print before axlEnterPath (when printf doesn't). So I'm satisfied. So is axlMsgPut best suited for displaying in the Command window and printf is best used for anything else (external file, buffer, etc)? Thanks!

     

    For my second issue, %g doesn't work in the other code I was referring to - it barfs on integers there too. I don't know what I was thinking. So, how can I place either integers or fp numbers in a certain width of field without having zeros padded?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
Cadence Guidelines

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