Solved

conversion of pascal to c

Posted on 2004-03-20
7
469 Views
Last Modified: 2010-04-16
hi
In the program posted before

 http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_20920285.html

I have problems in converting the followiing to c.p2c was giving some stnage error.If anyone of u trythe code in p2c and tell me what is the problem that would be great.Anyway I started to convert it manualy and i just wanted to know the equivalent code in c.If u want to know more abt the procedures refer to the code in the above thread
1
 unit allint;
interface
uses crt,dos,printer,lpvars,stackm;
what is the equivalent header for this in c

2.
PROCEDURE CreateLpLabel(i:integer);
VAR kf,kr,l,m,n:integer;
when i convert the above procedure into a c function wat about the variables l,m,n......it shuld be passed as paramters or does it mean some other thing

3. procedure AllIntegerGomory;

implementation

and
LpLabels[i] = Copy(Spaces,1,kf) + Copy(SymTab[Variables[i]].lexeme,1,m)
                 + Copy(Spaces,1,kr);

how this should be converted to c????????

thanks
ganesh
0
Comment
Question by:reachganesh
7 Comments
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 250 total points
Comment Utility
1:

#include <stdio.h>
#include <windows.h>

2:
void CreateLpLabel(int i)
{
   int Kf, Kr, L, M, N;

} the above variables only need to be passed as parameters if they are to be used in another part of the program.

3:
 void AllIntegerGomory(void);

4:
  use the functions: strcpy() and strcat()
0
 

Author Comment

by:reachganesh
Comment Utility
Hi there
I was trying to use the p2c converter in this site  http://www.garret.ru/~knizhnik/pascal.html to convert the entire program but it did not work.Can you please have a look at this link(windows version) and tell me how can i use it to convert the code to c.Plz try to use the pascal code in this post
 http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_20920285.html  and lemme know what is the problem
thanks
ganesh
0
 

Author Comment

by:reachganesh
Comment Utility
hi there
What is the difference between procedure and funciton in pascal Will there any difference in converting them to c .I see some of them starting with the begin kayword but some doesn't
PROCEDURE ALLintegerALG;

VAR  C, DENUM,I,J,K,L,NP,NUM,R,R1,S,T : INTEGER;
     kprt,lprt,jprt : integer;
     B, ITER : BOOLEAN;

-------------------------------------------------
FUNCTION EUCLID(U,V :INTEGER):INTEGER;
  VAR W : INTEGER;
  BEGIN
thanks
ganesh
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
The difference between a procedure and function is a function returns a value and can be used in an expression.  A procedure stands alone.

Procedures translate to VOID functions in C.
The begin keyword provides when the code for the function starts.  AllintegerALG has a begin it is quite far below the header.

Pascal programs have a much different syntax from C program thus your problem in converting.

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
This question has been classified abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.

Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help.jsp#hs5

mlmcc
0
 

Expert Comment

by:joseph789
Comment Utility
Can i see some tutorials of Visual basic? The should include Objects, Windows programming, components and file handling
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
joseph789 - Please ask your own questions.  Also it would be better if this question were asked in the Visual Basic forum.

mlmcc
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now