?
Solved

conversion of pascal to c

Posted on 2004-03-20
7
Medium Priority
?
479 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 1000 total points
ID: 10645149
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
ID: 10645420
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
ID: 10646425
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 101

Expert Comment

by:mlmcc
ID: 10664424
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 101

Expert Comment

by:mlmcc
ID: 10801151
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
ID: 10861444
Can i see some tutorials of Visual basic? The should include Objects, Windows programming, components and file handling
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10865586
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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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