CMCC2C C++ to ANSI C Converter

Cancelled Posted Feb 4, 2012 Paid on delivery
Cancelled Paid on delivery

See detailed reqs.

## Deliverables

Hello, This is a dev tool for converting C++ code (MSVC 2010) to pure C equivalent. 1. The program must run on Windows 7, and as many previous versions (back to Windows 2000) as feasible. Note if there is a good reason for only supporting Win7, or any other min OS version in the 2000-7 range, that's fine. Minimum requirement is that the program runs on Windows 7. 2. I have no preference wrt. the language you write this in. Any .NET language is fine (preferably using no more than .NET 2, but again I am flexible here, provided there is a good reason for using a later- or the latest version. Pure C or C++ (with or without x64 compilable support). C++0x is fine. MFC/ATL/STL are fine but please link statically. Any suitable (i.e. unicode-aware) Borland product is also fine, i.e. Delphi or C++ Builder. 2a. In addition, any other library or libraries you want to use are acceptable, _provided_ their licence(s) permit use in free- but closed-source applications. Note, within reason this can include commercial libraries, or libraries for which an unlimited commercial licence may be purchased. (In that case, I would purchase an appropriate licence for the library in question, provided you fully justify its use in the project.) 2b. Note I already have suitable licences for most Chilkat components and a number of other commercial libraries, including the CMarkup XML parser - for C++ only - should you need any of these for any reason. 2c. Note also, this requirement extends to any dev environment and/or compiler you like, again with the caveat that it must be either freely available and suitable for use in freeware closed-source products, or financially justifiable in the case of a commercial product. (Note this excludes the examples of this already mentioned, e.g. Delphi or C++ Builder, as I already have my own copies of these.) 3. The program's executable should be named [url removed, login to view] (and any project/solution and any version information included). 4. The only functionality required is that your solution must be able to convert any C++ source file (with MSVC 2010 as reference C++ environment/compiler) to a functionally-equivalent C source file, with the content of any included headers either reproduced as equivalent C-only headers or simply incorporated into the C source file you produce. I would prefer for the sake of simplicity that you eliminate header file use and only generate C source files, with any content from header files just included directly in your output C source file(s) as needed. 4a. Note, the goal here is that the C source files you produce will be compilable by a pure C compiler, a C++ compiler _or_ an Objective-C compiler. Provided your output files use only ANSI C, this should be a given. Thus, with this program, any C++ project (again MSVC 2010 C++ projects should be used as reference language) becomes instantly portable to C or Obejctive-C in one deterministic step. 5. GUI is optional. If you include one, keep it simple. All you need is the ability to select multiple C++ source files (not header files - see (4)) and a "Go" button. If not including a GUI - or in addition to it - accept a multiple pathnames as command line parameters. Allow use of wildcards "*" and "?" as they behave in DOS. Eliminate any duplicates if more than one path or wildcard path is passed. (You can expect each param to be enclosed in "" and refuse to run if anything else is passed.) 5a. _Important_ Every C++ source file selected by GUI or command line should be considered as atomic and independent, and each should be converted in isolation, i.e. without reference to any other file to be converted. Your output files should be placed in the same directory as the source file (again, do this on a per-file basis and accept multiple files from different locations). The filename for each output file should match the input filename but in place of whatever cpp extension (.cpp, .cc etc.) should be ".cmcc2c.converted.c". 6. How you actually implement this is entirely up to you. You could write it as a 'pseudo-compiler' with a compiler-type architecture, but basically anything goes as long as it works both completely and deterministically. Essentially, all you need to do is recognise anything that is C++-specific and replace it with a 'pure-C' equivalent. For the most part, I have no preference whether the C code you produce is actually equivalent (i.e. produces exactly the same result when compiled) or just equal, i.e. provided the compiled result does the same thing as would be achieved by compiled the C++ code, it doesn't matter if, for instance you replace C++ algorithms or data structures with different ones in the C files outputted, _provided_ what you use in the C version is at least as good as the original. 6a. _Important_ an exception to (6) is C++ classes that are used to implement COM objects. Ideally, every object of a class (as opposed to any other 'C-style' data structure) should be produced by your C code so that it is identical in memory in both size and content. So, for instance, a objects of a C++ class that uses virtual functions by inheritance or directly would have a vftable and pointer to it. Ideally, your C code will produce exactly the same pattern in memory for every object of a class, with all features of C++ classes supported. Note, the key element to this is that the _objects_ are identical to their C++ equivalents, i.e. the actual memory and data used; how this is achieved is less important. In other words, you don't have to always employ a C-struct-with-coded-vtable-and-vftable-if-required in place of a C++ class. That is one approach, but provided the result is the same, you could simply allocate memory, fill it appropriately and execute any ctor/dtor code as appropriate. 7. I will consider the project complete when I can successfully use it with the MS C++ and C compilers for Visual Studio 2010, _and_ the GNU C, C++ _and_ Objective-C compilers on Windows. 8. Finally, a nice-to-have would be for all x64-compatible C++ code to produce x64-compatible C code (or C code that checks for preprocessor macros corresponding to all the compilers mentioned in (7), and produces both win32 and x64 versions of x64-compatible C++ code in the generated C files, although this is not essential. ***Added 05-FEB-2012 22:02 GMT*** 9. You should expect that (cope with) standard Windows headers will be included from (some of) the C++ files to be converted. However, since they only use C anyway, there is no issue in just carrying the #includes over to the output C files. 10. In addition to (9) I do need built-in support for STL. What I suggest here is rather than rewriting the whole of stl in C pseudo-classes or attempting anything like that, just enumerate every stl class and function - or a subset of them that you agree with me - and replace any code that uses stl with something equivalent in C. For example if C++ is encountered that uses an stl map then you would need to use instead a C implemented binary tree (self-balancing, Red-Black or AVL) to achieve comparable performance. For an stl list, you could use a C-style linked list with a typedef'd struct containing pointers forwards and backwards with static or global first and last pointers. You would then essentially expand the templated part of the stl object so that your data structure stores data equivalently to a C++ stl list object. Similar techniques will need to be used for all the stl collection classes, and you would need to replace any use of an stl iterator either with a non-iterator-based loop, or if unavoidable, imitate the behaviour of an stl iterator with a function, or maintain a separate count for example and use indexing... 11. Finally, you should also assume the C standard library will be used or at least its functions used. Again, there is no issue here since the functions are themselves written in- (or at least compilable by) C. ***************************** That's all. Serious bids only please. Many thanks.

.NET Assembly C Programming C# Programming Delphi PHP Python Software Architecture Software Testing Visual Basic

Project ID: #2708242

About the project

5 proposals Remote project Active May 28, 2012

5 freelancers are bidding on average $1908 for this job

MOTASH

See private message.

$2000.05 USD in 160 days
(17 Reviews)
4.7
chetanbhat

See private message.

$2040 USD in 160 days
(1 Review)
2.0
LincyS

See private message.

$2000.05 USD in 160 days
(0 Reviews)
0.0
saadusmanvw

See private message.

$1500.25 USD in 160 days
(0 Reviews)
0.0
kalpaniksolution

See private message.

$2000.05 USD in 160 days
(2 Reviews)
0.0