• 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. How to access variables of one procedure function to other...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 8374
  • 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

How to access variables of one procedure function to other procedure function

Sathvik44
Sathvik44 over 2 years ago

Hello,

I have been trying to access the y and z variables from the pointDone to getPoints and am stuck.

How can I access the y and z variables from point done to getpoints?

procedure(pointDone( w done pts )
if( done then
l=pts
x=car(l)
y=car(x)+0.0
z=car(cdr(x))+0.0
printf("Point entered was %L.\n" pts)
else
println("Point entry aborted.")
)
list(y z)
)

enterPoint( ?prompts
list( "Enter a point.")
?doneProc "pointDone"
)

procedure(getPoints()
printf("%f" ?)
)

  • Cancel
  • mbracht
    mbracht over 2 years ago

    Hi,

    The way you implement your pointDone() function these variables are global so they are accessible from everywhere anyway. But...as you probably know you should avoid global variables whenever you can. So the better solution is probably that whatever you want to do with these variables just do it inside the pointDone() function. Since it is a callback function there's no way to capture it's return value.

    Max

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Sathvik44
    Sathvik44 over 2 years ago in reply to mbracht

    Thank you Max

    I have got to know how to solve my problem.

    Can I know how to delete my discussion/question?

    Sathvik

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mbracht
    mbracht over 2 years ago in reply to Sathvik44

    I don't know how to do that...

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 2 years ago

    Hi Sathvik,

    This cannot be done in classic SKILL but is achievable in SKILL++

    Below is an example of what your code could look like

    Cheers

    Aurélien

    inScheme(

    ;; Let defining shared variable amongst contained procedures
    let( (x y z)

    globalProc(pointDone( w done pts )
    if( done then
    l=pts
    x=car(l)
    y=car(x)+0.0
    z=car(cdr(x))+0.0
    printf("Point entered was %L.\n" pts)
    else
    println("Point entry aborted.")
    )
    list(y z)
    )

    enterPoint( ?prompts
    list( "Enter a point.")
    ?doneProc "pointDone"
    )

    globalProc(getPoints()

    ;; Here x, y and z variables are the same as `pointDone' ones
    printf("%f" ?)
    )

    ));inScheme
    • Cancel
    • Vote Up +1 Vote Down
    • Cancel

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