Synchronisation with code Generation

Synchronisation with code Generation

Post by Iwan Birre » Sat, 02 Aug 2003 09:57:01



Hello,

I am searching for a tool (or idea for a tool), that can generate thread
synchronisation code into my existing c++ code for different Platforms. I
already evaluated openc++ and aspectc++ and they would exactly do what I
want. The only problem is, that the generated source code must look like
hand-written code and not generated. With openc++ and aspectc++ you get code
that is not well human readable, as far as I know.

Anyone an idea how to do that in a nice way?

Thanks
Iwan

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

 
 
 

Synchronisation with code Generation

Post by Julian Smit » Sun, 03 Aug 2003 01:07:30


On 31 Jul 2003 20:57:01 -0400


> Hello,

> I am searching for a tool (or idea for a tool), that can generate thread
> synchronisation code into my existing c++ code for different Platforms. I
> already evaluated openc++ and aspectc++ and they would exactly do what I
> want. The only problem is, that the generated source code must look like
> hand-written code and not generated. With openc++ and aspectc++ you get
> code that is not well human readable, as far as I know.

> Anyone an idea how to do that in a nice way?

One possibility you could look at is my Cmm multimethods system,
http://www.op59.net/cmm/readme.html. This parses C++ into an internal
representation that is fairly strongly typed - e.g. there are separate
classes for for() loops, different declarators (functions, pointers etc) etc.
It uses a simple scheme to preserve all white space from the original source
when outputing code - each lexical element is represented by begin/end
pointers into the original text(which is kept in memory), and the output
routines simply appends whatever white space occurs after the last character.
For example, one of the tests checks that it outputs identical text when
given one of its own preprocessed source files.

You can also rebuild the parser itself as a multimethod programme, and use
multimethods to modify the way in which parse-tree nodes are output.

Cmm is a prototype system though, and is very rough in places - e.g. it
doesn't properly parse expressions, and doesn't do name lookup, so uses
various heuristics to parse ambiguous things like `a * b;'. However it does
give easy access to function bodies, and I sometimes use it to insert
profiling calls to each {...} block of a time-critical programme.

- Julian

--
http://www.op59.net

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

 
 
 

Synchronisation with code Generation

Post by Ira Baxte » Sun, 03 Aug 2003 02:11:37



Quote:> I am searching for a tool (or idea for a tool), that can generate thread
> synchronisation code into my existing c++ code for different Platforms. I
> already evaluated openc++ and aspectc++ and they would exactly do what I
> want. The only problem is, that the generated source code must look like
> hand-written code and not generated. With openc++ and aspectc++ you get
code
> that is not well human readable, as far as I know.

You might consider the DMS Software Reengineering Toolkit.
See http://www.semanticdesigns.com/Products/DMS/DMSToolkit.html.
It is generalized compiler technology which can parse/analyze/transform
many languages, including C++.

You did not say how the code produced by openC++ etc
failed to "look like hand-written code".  You shouldn't expect
machine generated code to look like a person wrote it.
Generated names are likely to be in effect incrementing
counters with the letter "A" glued on the for example;
code generators do not pick imaginitive names.

You might be objecting to loss of comments, literal formats, etc.
I don't know what OpenC++ or AspectC++ do with these.
DMS preserves them if they aren't affected by transforms.

We might argue about whether the code could be *formatted*
as if a very fussy human formatted it.   DMS can do that
as it generates code.

--
Ira D. Baxter, Ph.D., CTO   512-250-1018
Semantic Designs, Inc.      www.semdesigns.com

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

 
 
 

1. Rational Rose Code C++ code generation

Hi,

I am using Rational Rose 2001 and trying to generate C++ code from my model.
This works just fine, but I would like do disable the automatic generation
of get and set methods. I found the switch GenerateGetOperation in the C++
options and set it to false, but nothing changed , I still have the methods
in my code (after new code generation). Can someone telling me what I am
doing wrong.

Thanks,
Ralph Hesse

2. Aminet

3. PRB : Error LNK2001 with Multithreaded DLL code generation option

4. DEBUG - can I compile it?????

5. COM Proxystub Code Generation

6. Automating the process

7. Looking for wave Tone Generation code

8. Building with CW 6 and 7?

9. CIM Studio and Provider Code Generation

10. narrow bridge synchronization&source code

11. better understanding of automatic code generation

12. Visual C++ Compiler, 386-specific code generation, info wanted

13. Thread synchronization C++ sample code