This project is read-only.

Syntax conversion script old to new syntax

Aug 10, 2010 at 11:48 AM
Edited Aug 10, 2010 at 11:49 AM
Hi all, just to have checked this (I noticed that the tutorial with the new syntax is now linked from the main page): does there exist buried somewhere a syntax conversion script from old to new syntax? Preferably stand-alone command-line executable (or perl or sth like that) ... (It's not too hard to hack up one covering most of the code I have at hand but it would probably be reinventing the wheel.) Cheers, Holger
Aug 10, 2010 at 12:32 PM

Yes, there is. The sources for this tool are currently checked into the repository under Vcc\Tools\VccSyntaxConverter; it is working quite nicely for a wide range of constructs. I guess we will start including it into the installer.

Aug 11, 2010 at 4:05 PM

Thx. (The SLN is \svn\vcc\Tools\VccSyntaxCoverter\VccSyntaxCoverter.sln. Thorsten who has VS2010 install running has kindly built it for me.)

Aug 11, 2010 at 4:34 PM

btw, just curious have "groups" been thrown out (they also not mentioned in the tutorial)?

~$ cat dummy.c
#include "vcc.h"
vcc(dynamic_owns) struct A_str {
    unsigned int dummy;  
    vcc(dynamic_owns) def_group(mygroup); };
~$ VccSyntaxCoverter.exe dummy.c
~$ vcc /2 dummy.c.out 
C:\cygwin\home\hbl3\dummy.c.out(4,51) : error VC0020: Invalid expression term 'group'.
C:\cygwin\home\hbl3\dummy.c.out(4,57) : error VC0013: ) expected.
C:\cygwin\home\hbl3\dummy.c.out(4,64) : error VC0020: Invalid expression term ')'.
C:\cygwin\home\hbl3\dummy.c.out(4,57) : error VC0036: Did not expect 'mygroup'.
Exiting with 3 (4 error(s).)


Aug 11, 2010 at 6:25 PM

This seems to be a problem with the syntax converter. It is producing:

_(dynamic_owns) _(group mygroup)

whereas it should be producing:

_(group _(dynamic_owns) mygroup)

Alternatively, the initial input could say:

def_group(vcc(dynamic_owns) mygroup)

If you have lots of code like that I can fix the converter.


Aug 12, 2010 at 9:28 AM


I have included the converter into the installer, so you will not have to go hunting for people with VC2010 anymore :-). It will be in tomorrow's drop.


Aug 12, 2010 at 11:52 AM
Hi, @stobies: thanks :-) @michal: thanks for the explanation. I don't have any problem with fixing the group definitions by hand (not that many). On a quick look I also noticed that (a) doing wrap/unwrap within spec sections is no longer allowed which is probably good (b) the converter chokes on !set_in(a,b) (the output needs one more pair of parentheses, no problem for me to fix this manually where needed) (c) set/giveup_owner are gone, this is good the syntax now given in the tutorial for this feels much nicer (fine with me) (d) the memory reinterpretation functions from_bytes, split_array (and probably also their inversions) have new signatures. As for the memory reinterpretation functions from_bytes(a,\false), split_array(a,b), no problem to fix that manually, but I would have to ask what the new signatures for these are (or where to rtfm/rtfs) ... holger