Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Convert Non-standard C struct data to standard C struct

by BrowserUk (Pope)
on Apr 28, 2013 at 16:11 UTC ( #1031095=note: print w/ replies, xml ) Need Help??


in reply to Change the data to have the format which is like a C struct.

That doesn't look like any "standard C" I've ever seen?

mm struct { a = 1; b = 3; m1 struct = { c = 4; d = 5; } }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: Convert Non-standard C struct data to standard C struct
Download Code
Re^2: Convert Non-standard C struct data to standard C struct
by Laurent_R (Parson) on Apr 28, 2013 at 16:45 UTC

    That doesn't look like any "standard C" I've ever seen?

    Yeah, I agree. I haven't written C code for the last five or six years, but, to me, a standard C struct declaration usually looks more like this:

    struct date { int day; int month; int year; } struct my_record_type { long key; int size; char text[128]; struct date birthdate; }

      Yup! Pre-ANSI C allowed untyped vars to default to ints, but that did not extend to struct members; you cannot initialise struct members individually; and you don't assign the curlies to the tagname


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Yes, and I also chose my example in a way to show how to declare nested structures, which is quite different from the OP's example.

Re^2: Convert Non-standard C struct data to standard C struct
by dwslovedh (Novice) on Apr 29, 2013 at 01:51 UTC
    Yes, sorry for the unclear expression, but I can not find a more proper way to elaborate my problem. I want to change the data to have the format which is like C struct. This is the data I got from other guys which turn the original C struct into this.

      I think a more proper way to elaborate your problem would be to provide an accurate explanation of what the output should look like. Is it supposed to be valid C? Or is it supposed to be exactly the syntax that you provided as an example output? Because if it's supposed to be valid C, what you provided isn't. And if it's not, then why confuse the issue by calling something that isn't C, C?


      Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031095]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-10-26 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (151 votes), past polls