473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Migrating C Code from OS2 to Windows

Hello, I need some help please.

I need to migrate some applications from OS2 to Windows, the source
code is C. I believe this can be done using Lex and Yacc and have
installed Cygwin with Flex and Bison which I believe are compatible but

I'm having trouble getting Flex to process the C file. I assume that
I need to write some rules for Flex to use but as I'm not familiar
with C I've no idea what the rules should be. Apologies for sounding
like a dunce here but any help would be appreciated.

Jul 19 '06 #1
9 1943
sk**********@googlemail.com wrote:
Hello, I need some help please.

I need to migrate some applications from OS2 to Windows, the source
code is C. I believe this can be done using Lex and Yacc and have
installed Cygwin with Flex and Bison which I believe are compatible
but

I'm having trouble getting Flex to process the C file. I assume that
I need to write some rules for Flex to use but as I'm not familiar
with C I've no idea what the rules should be. Apologies for sounding
like a dunce here but any help would be appreciated.

What makes you think that you need Flex etc, what does the OS/2 code
do/look-like?

--
==============
Not a pedant
==============
Jul 19 '06 #2
sk**********@googlemail.com wrote:
Hello, I need some help please.

I need to migrate some applications from OS2 to Windows, the source
code is C. I believe this can be done using Lex and Yacc
What's wrong with using a C compiler?

If there's something /wrong/ with the C code, you'll get better
help if you tell us what the problem is, rather than what your
attempt at a solution is.

If you're not familiar with C, and the code wasn't written with
portability in mind, moving it from one platform to another could
be rather tricky.

--
Chris "endian sizeof filename UB blackhole" Dollin
A rock is not a fact. A rock is a rock.

Jul 19 '06 #3
sk**********@googlemail.com a écrit :
Hello, I need some help please.

I need to migrate some applications from OS2 to Windows, the source
code is C. I believe this can be done using Lex and Yacc and have
installed Cygwin with Flex and Bison which I believe are compatible but

I'm having trouble getting Flex to process the C file. I assume that
I need to write some rules for Flex to use but as I'm not familiar
with C I've no idea what the rules should be. Apologies for sounding
like a dunce here but any help would be appreciated.
This is a mistake. Lex and Yacc are not needed at all.
What you have to do is

1) Find somebody that has a clue. If you think that lex/yacc
will port a C application from OS2 to Unix it means you
have no clue but really ABSOLUTELY NOTHING!

2) Pay him/her what he/she wants (you have no choice anyway)
Jul 19 '06 #4
Having no knowledge of migrating applications across OS I was given the
advice (rightly or wrongly) that I needed to use Lex and Yacc or
similar to do the job as well as a C compiler. My understanding, which
could well be wrong is that C differs slightly on the different OS,
hence the need for some kind of "translation".

The code is a compiler for a bespoke language called "AB" which
resembles a form of BASIC. A small excerpt of the code follows (the
whole thing is 42kb), thanks for your help:

BOOL CheckCancel( MODULE_TYPE iCompiler )
{
BOOL bRtn = FALSE;
if ( pShared->RelMechData.bCancelRelease )
{
/*
* The compilation process has been cancelled.
*/

if ( iCompiler == MBuildRelease )
{
/* Do not abort this thread, since this is the Main Build
Release Thread... */

AddStatus( INFORMATION , "Abort !" , "Compilation process
aborted by operator" );
}
else
{
/* Exit this thread, this is the compiler thread... */

AddStatus( FATAL , "Abort !" , "Compilation process
aborted by operator" );
}

bRtn = TRUE;
}

return bRtn;
}

-----------

pemo wrote:
>

What makes you think that you need Flex etc, what does the OS/2 code
do/look-like?

--
==============
Not a pedant
==============
Jul 19 '06 #5
David West wrote:
Having no knowledge of migrating applications across OS I was given the
advice (rightly or wrongly) that I needed to use Lex and Yacc or
similar to do the job as well as a C compiler.
Unless there's something else going on that you haven't mentioned yet,
this seems unlikely.
My understanding, which
could well be wrong is that C differs slightly on the different OS,
hence the need for some kind of "translation".
Such translation is probably best done by people, and done in such a
way as to reduce or eliminate the code that "needs to be different".

Unless you understand what the differences /are/, automated
assistance isn't likely to help.
The code is a compiler for a bespoke language called "AB" which
resembles a form of BASIC.
It's /possible/ that whoever said you needed Lex and Yacc thought
that you'd need to rewrite the code to use them as part of the
migration. (You very likely don't.) Or it's possible that the AB
compiler is written using them (Lex and Yacc, or Flex and Bison,
turn descriptions of languages into C code [well, tables for C code])
and migrating it will need to migrate the lexis and grammar.

If that's so, comp.lang.c is the wrong place to ask about the
Lex and Yacc bits. There are more appropriate newsgroups;
I'd try asking in comp.programming or comp.compilers.

The C code you present looks fine (assuming that all the undefined
names are defined in suitable header files). 42Kb of code isn't
much, unless you really meant 42K /lines/. The problems will
come when you try and compiler it, and then when you try and
run it (hopefully there are tests suites you can run to make
sure it's migrated reasonably safely).

--
Chris "seeker" Dollin
"I'm still here and I'm holding the answers" - Karnataka, /Love and Affection/

Jul 19 '06 #6
In article <e9**********@malatesta.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:
>Or it's possible that the AB
compiler is written using them (Lex and Yacc, or Flex and Bison,
turn descriptions of languages into C code [well, tables for C code])
and migrating it will need to migrate the lexis and grammar.
In this case you will quite likely be able to generate the C code on
the old OS and just copy it over.

-- Richard
Jul 19 '06 #7
David West wrote:
Having no knowledge of migrating applications across OS I was given
the advice (rightly or wrongly) that I needed to use Lex and Yacc or
similar to do the job as well as a C compiler. My understanding,
which could well be wrong is that C differs slightly on the different
OS, hence the need for some kind of "translation".

The code is a compiler for a bespoke language called "AB" which
resembles a form of BASIC. A small excerpt of the code follows (the
whole thing is 42kb), thanks for your help:

BOOL CheckCancel( MODULE_TYPE iCompiler )
{
BOOL bRtn = FALSE;
if ( pShared->RelMechData.bCancelRelease )
{
/*
* The compilation process has been cancelled.
*/

if ( iCompiler == MBuildRelease )
{
/* Do not abort this thread, since this is the Main Build
Release Thread... */

AddStatus( INFORMATION , "Abort !" , "Compilation process
aborted by operator" );
}
else
{
/* Exit this thread, this is the compiler thread... */

AddStatus( FATAL , "Abort !" , "Compilation process
aborted by operator" );
}

bRtn = TRUE;
}

return bRtn;
}

-----------

pemo wrote:
>>

What makes you think that you need Flex etc, what does the OS/2 code
do/look-like?
I suspect that the only major problem you might have is if the code uses
OS/2 APIs and that these will have to be ported to use Windows' API calls.

Years ago I work on a 'thing' called WLO [pronounced /Willow/ - The
*W*indows *L*ibraries for *O*S/2] - ok, it went the other way, but the
/mapping layer/ might be of interest to you, e.g., the libraries would
re-direct OS/2 [actually GPI] APIs like gpiFullArc to the Windows' Elipse
function in GDI. The idea here was that one could port a Windows app to
OS/2 via simply linking to these replacement libraries. Of course, you'll
most likely not find something that does this in the other direction -
dunno, been away from this stuff for some time now. So, you'll have to
/port/ any API calls manually - most I suspect will now [2K, XP etc] move
easily - but that's what I always think!

--
==============
Not a pedant
==============
Jul 19 '06 #8
On 19 Jul 2006 14:00:57 GMT, ri*****@cogsci.ed.ac.uk (Richard Tobin)
wrote:
>In article <e9**********@malatesta.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:
>>Or it's possible that the AB
compiler is written using them (Lex and Yacc, or Flex and Bison,
turn descriptions of languages into C code [well, tables for C code])
and migrating it will need to migrate the lexis and grammar.

In this case you will quite likely be able to generate the C code on
the old OS and just copy it over.
OK for the initial port, but not for maintenance. I'd port the highest
level source available.

--
Al Balmer
Sun City, AZ
Jul 19 '06 #9
jacob navia <ja***@jacob.remcomp.frwrites:
sk**********@googlemail.com a écrit :
>Hello, I need some help please.
I need to migrate some applications from OS2 to Windows, the source
code is C. I believe this can be done using Lex and Yacc and have
installed Cygwin with Flex and Bison which I believe are compatible but
I'm having trouble getting Flex to process the C file. I assume that
I need to write some rules for Flex to use but as I'm not familiar
with C I've no idea what the rules should be. Apologies for sounding
like a dunce here but any help would be appreciated.

This is a mistake. Lex and Yacc are not needed at all.
What you have to do is

1) Find somebody that has a clue. If you think that lex/yacc
will port a C application from OS2 to Unix it means you
have no clue but really ABSOLUTELY NOTHING!

2) Pay him/her what he/she wants (you have no choice anyway)
Maybe. Since, as the OP said later, the C application is a compiler
for a custom language (called "AB"), lex and yacc might well be part
of the solution.

Using lex and yacc to port C code in general is absurd, but it could
make sense in this particular case. (No offense, jacob; I'm sure you
hadn't seen the OP's followup when you posted this.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 19 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Juan | last post by:
I'm migrating a VB.Net app to c# and found the following: Private m_State(,) As Integer If anyone knows what is the analogous in c#... is it an array? Thanks, Juan.
6
by: Shai Levi | last post by:
Hi, I'm trying to migrate native c++ class to managed c++ class. The native class header definition looks as: class NativeClass { public: typedef void (CbFunc1)(int n,void* p);
0
by: michael | last post by:
I am migrating C++ unmanaged to managed VC 7.1. I continue to have problems with try catch blocks through-out my code. The compile tells me the the code is unreachable C2407 at the catch portion of...
11
by: Neil | last post by:
We are running SQL 7, using Access 2000 as a front end. Our network person is wanting to migrate to Windows 2003 (we're currently on Windows 2000), and wants to know if we should migrate to SQL...
0
by: murat-mur | last post by:
Hi all, Environment: My PC: MS Windows 2000 pro, DB2 Connect Client 7.1 Gateway: MS Windows 2000 server. DB2 Connect EE. DB2 z/OS V7.1 z/OS 1.6 php 5.1.2 is running on my PC. the below...
34
by: subramanian100in | last post by:
Is there any difference between porting and migrating. Kindly explain
64
by: John | last post by:
Hello there, Im cursing my place of employment...and its taken me a month to realise it... The scenario: Ive just stepped into a role to migrate an access database to VB.Net. The access...
1
by: Søren Alexandersen | last post by:
Hi all. I have some specific questions on migrating a Oracle 8.1.7 database from AIX to Windows. I know something very similar has been asked before, but I can't seem to get some unique...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.