Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Migrating C Code from OS2 to Windows

Reply
Thread Tools

Migrating C Code from OS2 to Windows

 
 
skulkrinbait@googlemail.com
Guest
Posts: n/a
 
      07-19-2006
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.

 
Reply With Quote
 
 
 
 
pemo
Guest
Posts: n/a
 
      07-19-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
==============


 
Reply With Quote
 
 
 
 
Chris Dollin
Guest
Posts: n/a
 
      07-19-2006
(E-Mail Removed) 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.

 
Reply With Quote
 
jacob navia
Guest
Posts: n/a
 
      07-19-2006
(E-Mail Removed) 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)


 
Reply With Quote
 
David West
Guest
Posts: n/a
 
      07-19-2006
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
> ==============


 
Reply With Quote
 
Chris Dollin
Guest
Posts: n/a
 
      07-19-2006
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/

 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      07-19-2006
In article <e9lck5$jfa$(E-Mail Removed)>,
Chris Dollin <(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
pemo
Guest
Posts: n/a
 
      07-19-2006
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
==============


 
Reply With Quote
 
Al Balmer
Guest
Posts: n/a
 
      07-19-2006
On 19 Jul 2006 14:00:57 GMT, (E-Mail Removed) (Richard Tobin)
wrote:

>In article <e9lck5$jfa$(E-Mail Removed)>,
>Chris Dollin <(E-Mail Removed)> wrote:
>
>>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
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      07-19-2006
jacob navia <(E-Mail Removed)> writes:
> (E-Mail Removed) 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) (E-Mail Removed) <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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
public domain C runtime library for Linux/Windows/MSDOS/MVS/CMS/OS2/PDOS kerravon C Programming 0 08-23-2009 03:46 AM
Migrating C Code from OS2 to Windows skulkrinbait@googlemail.com C++ 2 07-19-2006 03:23 PM
Any tips on migrating code from Windows to UNIX Kurt Euler Ruby 2 02-28-2005 07:57 AM
Mystery message: Undefined subroutine &OS2::Bootdrive Shmuel (Seymour J.) Metz Perl Misc 3 09-23-2004 04:43 PM
Using Java CORBA under OS2 jeff Java 0 04-30-2004 06:20 PM



Advertisments