Bayesean Blog - Desktop, Mobile and IOT Developer Blog


C2PAS32 Convertor Application

Posted on 8th Jun 2018 in Delphi FMX


C2PAS32APPC29.png

This is a wrapper Application of the original freely command line Application made available by ASTON Software. The original application and its rights are retained.

The original application is a CMD process and converting one file is easy enough, but converting multiple files can become cumbersome.

This original C2PAS32 was reworked into an Application that can be compiled as a Win32 or Win64 or set up as a standalone 32 bit or 64bit Windows Application. The original exe remains intact.

The limitation of the Application requires the App to reside in the OS directory typically within the C directory.

How it Works

Your C, CPP, H files can be set up in your project area. To convert, the file is opened and upon conversion, a .pas file is created and placed next to the original file. The conversion process is quick and files can be rapidly converted.  It is designed to do all the work in the background. So when the original file is opened, it immediately copies the original file to the Application exe’s folder where the C2pas32.exe resides. The file is converted and the. Pas file is created in the same directory. Thereafter, the file is seamlessly moved to the original directory.

The convertor remains a convertor and not an IDE to rework the scripts. The views are merely for

Some Tips

The converted .pas file can be opened in a Delphi IDE and debugged / manually converted.

A simple trick! The original C, CPP, H file can be directly opened in the Delphi IDE and action VIEW \ NEW EDIT WINDOW  which will place the C,CPP,H File in a separate window view . Move the windows around so both can be viewed at the same time whilst completing the final manual translation.

 How to Load in Windows 7, 10

Thec2pas32 exe resides in the New Apps executional file folder. Do to the limitation of a DOSCommand Command-line Component, the App must reside in the OS directory typically the c directory.

So with file transfers, Windows will not allow this and the app cannot be placed in the normal windows file structure. Without elevated privileges set in the manifest.

I don’t advise this as windows has set this structure for a reason. The best place to place the app exe is C:\users\your user name\ App Data\Roaming\CtoPAS32\CTOD32APP.exe or in the documents folder.

C2PAS32Appfilestruct10.png

The Application

C2PAS32.gif

The application uses standard controls but uses the freely available Dos Command component (TDosCommand) that can be easily installed through the GETTIT manager. This component is used to process the C232pas file.

 

Using the Application

 The Application opens with an offline information html page.

 

C2PAS32APPstart6.png

Next Step:-

 C2PAS32firstpg2.png

 

Open a File

Options C, CPP , H files.

C2PAS32APPopen2.png

Process the file…

C2PAS32APPfiles33.png

Conversion Efficiency

Refer to the Shootout in the previous Blog post where this C232PAS was found to be the best convertor. This formed the basis for the creation of this Application.

It will retain 95% of the original code.

It will convert 80% of the data of which a total of 60% of the data will not require much manual intervention.

There is no available open source convertor that will translate code 100% efficiently. Even the paid versions do not advertise 100% conversion. So it is best to read up on C/C++ if you have no knowledge of the language before tackling the conversion as it will become a steep learning curve.

This will reduce the time to full conversion.

Download the source form Github

This is placed on my personal Github account

Github ....Greg-Bayes/C2PAS32APP-Delphi

 

Download Code

 

Licence

This is a free to use MIT licence.

 

 

 

 

 

 

 

 


Be the First to Comment...

Add a Comment

9+5

Recent News

Delphi A Professional VCL DBGrid Part Four
Delphi A Professional VCL DBGrid Part Three
Delphi A Professional VCL DBGrid Part Two
Delphi A Professional VCL DBGrid Part One
Delphi VCL Buttons in DBGrid
Two Helper Apps for Delphi LibUSB
Delphi Libusb Library Introduction
Delphi Object directly to a Json string in a REST Client

Categories

Bootstrap 4
Delphi VCL
Delphi FMX
Ajax
Bootstrap 3
CSS
XE4>Delphi > XE4
Delphi < XE4
PHP

Archives

June 2019

Delphi A Professional VCL DBGrid Part Four

May 2019

Delphi A Professional VCL DBGrid Part Three

April 2019

Delphi A Professional VCL DBGrid Part Two

March 2019

Delphi A Professional VCL DBGrid Part One

November 2018

Delphi VCL Buttons in DBGrid

October 2018

Two Helper Apps for Delphi LibUSB

September 2018

Delphi Libusb Library Introduction

August 2018

Delphi Object directly to a Json string in a REST Client
Delphi using Environment Variables in your App

July 2018

Delphi FMX Leaflet Plotter using OSM Maps

June 2018

C2PAS32 Convertor Application
C to Delphi Open Source Convertors Shootout
Delphi command-line programs with DOSCommand

May 2018

Delphi PDF Embedded viewer with PDF.js

March 2018

Delphi FMX - Changing TCharacter to TCharHelper
Make Your Delphi App POP using Javascript!

January 2018

Delphi FMX Dashboard using Chart.JS
Delphi FMX Form Docking

December 2017

PHP Slim REST Server & Delphi Auth Part 5

November 2017

Delphi FMX REST Client App Part 4

October 2017

Delphi VCL REST Pricing Client App Part 3

September 2017

Delphi REST VCL Client Basic Auth Part 2B

August 2017

Delphi REST Client Part 2A
PHP PDO REST Server Part 1

July 2017

PHP REST Server and Delphi Client Intro

June 2017

Delphi SQLite Encryptor-Decryptor Tool
Updating Applications Manifest using Delphi

May 2017

Create a Visual IP Address Geolocation with PHP

March 2017

PHP Downloader using Countdown timer
PHP File Downloader from a Inbox Selection

February 2017

Javascript Image-File Uploader with ThumbViewer

January 2017

Morris Charts and PHP-PDO

December 2016

CSS to create a functional Toggle Button