• 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. parseFile() with structed object?

Stats

  • Replies 0
  • Subscribers 159
  • Views 12109
  • Members are here 0
More Content

parseFile() with structed object?

stillfish
stillfish over 13 years ago

Dear all,

  I have met some problems on parsing files, and i will take a simple example to describe my question.

  I have an object m1 build like this:

defstruct(myPoint x y)
defstruct(myObject name type listCord)
defun(test ()
  p1 = make_myPoint(?x 1 ?y 2)
  p2 = make_myPoint(?x 3 ?y 4)
  m1 = make_myObject(?name "test" ?type "Poly" ?listCord list(p1 p2))
)
 

   And I saved m1 to a text file with format :

  myObject = {
    name = test
    type = Poly
    listCord = {
        myPoint = {
                    x=1
                    y=2
                }
                myPoint = {
                    x=3
                    y=4
                }
            }
        }

   I try to parse this format to rebuild m1 with parseFile() function but have no good idea to continue..

  parseFile("C:/m1.txt" 'myParseHndl "'\" \t")

  defun(myParseHndl (curLine lineArg result)
     case(car(lineArg)
       ("
myObject" 
        result = make_myObject()
       )
("name"
result->name = nthelem(3 lineArg)
)
("type"
result->type = nthelem(3 lineArg)
)
("
listCord"
result->listCord = myCordParseHndl..........??? 
) 

    )
  

    It seems not possible to call another handle in myParseHndl, and I was stuck here. 
    Is there a good routine for parsing this kind of files or any tips about parsing file ?
    The format of text file is flexible if need to be changed.    

  • Sign in to reply
  • Cancel
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