• 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. GUI menu to do setShellEnvVar

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 8109
  • 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

GUI menu to do setShellEnvVar

Pedro P
Pedro P over 2 years ago

I need your help to create a GUI that looks like the image bellow.

The basic idea is for the user put the name of the TEST in the open field , then press the button “set TEST env variable” and the skill executes  setShellEnvVar("TEST=whatever is on the field")

can anyone help me with this ?

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    Normally I'd expect you to at least have had a stab at it yourself rather than asking others to do it for you - but here's an example I quickly threw together to show how this can be done.

    /* CCFsetEnvVar.ils
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date        
    Modified   
    By         
    
    Example of a form to set a UNIX env variable.
    
    The code uses SKILL++ semantics and so should keep the .ils suffix
    (this allows us to have local functions within the main function).
    
    Usage: CCFsetEnvVar("TEST")
    
    ***************************************************
    
    SCCS Info: @(#) CCFsetEnvVar.ils 03/11/23.18:42:19 1.1
    
    */
    
    /***************************************************************
    *                                                              *
    *                   CCFsetEnvVar(envVarName)                   *
    *                                                              *
    *      Display a form which sets the given UNIX env var.       *
    *                                                              *
    ***************************************************************/
    
    procedure(CCFsetEnvVar(envVarName)
      /***************************************************************
      *                                                              *
      *    Local function: setEnvVarCB(_field scope @rest _args)     *
      *                                                              *
      *   This retrieves the variable name and value from the form   *
      *                     and sets the env var                     *
      *                                                              *
      ***************************************************************/
      procedure(setEnvVarCB(_field scope @rest _args)
        let(
          (
            (varName scope->envVarName)
            (varValue scope->envValue->value)
          )
          when(varName
            setShellEnvVar(varName varValue)
          )
        )
      )
      /***************************************************************
      *                                                              *
      *            Local function: createSetEnvVarForm()             *
      *                                                              *
      *   Creates the form - the label, button, and value/defValue   *
      *             of the entry field will be set later             *
      *                                                              *
      ***************************************************************/
      procedure(createSetEnvVarForm()
        hiCreateLayoutForm(
          'CCFsetEnvVarForm
          "Set environment variable"
          hiCreateHorizontalBoxLayout(
            'hbox
            ?items
              list(
                list(
                  hiCreateLabel(
                    ?name 'envLabel
                    ?labelText "envName"
                  )
                  'stretch 0
                )
                list(
                  hiCreateStringField(
                    ?name 'envValue
                    ?defValue ""
                  )
                  'stretch 1
                )
                list(
                  hiCreateButton(
                    ?name 'setEnvVar
                    ?buttonText "set env var"
                    ?callback setEnvVarCB
                  )
                  'stretch 0
                )
              )
          )
          ?buttonLayout 'Close
          ?minSize 350:80
        )
      )
      ;----------------------------------------------------------------------
      ; Main body of the function. Create the form if not already
      ; created (the instantiation is necessary because otherwise the
      ; label doesn't get updated the first time around
      ;----------------------------------------------------------------------
      unless(boundp('CCFsetEnvVarForm)
        createSetEnvVarForm()
        hiInstantiateForm(inSkill(CCFsetEnvVarForm))
      )
      let(
        (
          (form inSkill(CCFsetEnvVarForm))
          (envValue getShellEnvVar(envVarName)||"")
        )
        ;--------------------------------------------------------------------
        ; Record the env var name as a property on the form,
        ; and then update the label, button text and the value/default
        ; value of the entry box to be the current value of the env
        ; var
        ;--------------------------------------------------------------------
        form->envVarName=envVarName
        form->envLabel->value=envVarName
        hiSetButtonLabel(
          form->setEnvVar
          lsprintf("set %s env variable" envVarName)
        )
        form->envValue->value=envValue
        form->envValue->defValue=envValue
        hiDisplayForm(form)
      )
    )
    
    

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Pedro P
    Pedro P over 2 years ago in reply to Andrew Beckett

    Hi Andrew, thank you so much for the code, I have been struggling with GUIs for a bit as seen by my older post SKILL GUI - Custom IC Design - Cadence Technology Forums - Cadence Community 

    Your code, is a great framework to help me developing more complex GUIs, using this as a solid base.

    All works as expected, but there is a small typo on the callback

    line 85: should be                 ?callback "setEnvVarCB()"

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AurelBuche
    AurelBuche over 2 years ago in reply to Pedro P

    Hi Pedro,

    There is no typo line 85.

    You just registered the file with a different format suffix than the one used by Andrew

    This is SKILL++ and well understood by Virtuoso only with the file format suffix .ils (Andrew called the file CCFsetEnvVar.ils for this reason)

    In SKILL++ functions are objects like strings, numbers etc. and can be set as variable values

    The fix you wrote won't work unless you modify setEnvVarCB arguments as well

    Hope this helps

    Cheers

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to AurelBuche

    Thanks Aurélien - spot on.

    Pedro P - a little note; your original post didn't mention the problem you'd faced with the callback and you (presumably) edited the post afterwards. There are no notifications sent on edits to existing replies so I didn't see it until Aurélien mentioned it...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to AurelBuche

    Thanks Aurélien - spot on.

    Pedro P - a little note; your original post didn't mention the problem you'd faced with the callback and you (presumably) edited the post afterwards. There are no notifications sent on edits to existing replies so I didn't see it until Aurélien mentioned it...

    Andrew

    • 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