🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.programmer.codewarrior
6 messages
6 total messages Started by David Phillip Oster Tue, 26 Feb 2002 16:47
[Q] How do I use a source code generator?
#1031
Author: David Phillip Oster
Date: Tue, 26 Feb 2002 16:47
32 lines
3013 bytes
What is the best way to use a source code generator with Codewarrior?

Say, I've got something like lex or yacc, that takes source code in a 
little language and generates a new file or stream of c++ source code, 
and that my input file has #includes in it. How do I:

1.) Tell Codewarrior that after it runs the translator on the input 
file, it should run the compiler on the resulting output file?

2.) Tell Codewarrior that the output C file depends on the input file, 
and also the include files?

3.) What if the translator generates both a .cp file, and a .r file?

Should I be writing my translator as a preprocessor plugin?

Should I junk the whole idea of seamless integration with Codewarrior, 
and just use MPW and MPW's makeFiles to do all the non-Codewarrior 
processing, then have it send an appleEvent to codewarrior to build the 
resulting C++?

What part of the Metrowerks documentation should I have read?

-----
This posting was inspired by the article in C/C++ Users Journal, March 
2002 issue, <http://www.cuj.com/> "A Technique for Efficient Logging and 
Monitoring of Real-Time Systems", by Bill Pyritz, which involves adding 
very concise tags to your C++ source code, then running the result 
through a processing program which expands the tags, depending on the 
context, to add verbose logging and tracing code. (Thus keeping the 
logging code out of the main flow of the source code, keeping the source 
code easy to read.)
Re: [Q] How do I use a source code generator?
#1032
Author: David Dunham
Date: Tue, 26 Feb 2002 20:47
20 lines
1800 bytes
In article
<oster-B8530D.08470726022002@newssvr14-ext.news.prodigy.com>, David
Phillip Oster <oster@ieee.org> wrote:

> What is the best way to use a source code generator with Codewarrior?

My guess is you can't easily...

> This posting was inspired by the article 

I've most recently come across the need in Qt, the cross-platform
library. They have their own special pre-processor (since they have
special Objective-C-like method calls), and require Project Builder to
run this. So they haven't figured out how with CodeWarrior...

-- 
David Dunham    A Sharp    david@SPAM_B_GONE.a-sharp.com
http://www.pensee.com/dunham/
    "I say we should listen to the customers and give them what they want."
    "What they want is better products for free." --Scott Adams
Re: [Q] How do I use a source code generator?
#1033
Author: David Phillip Oster
Date: Tue, 26 Feb 2002 21:49
11 lines
1978 bytes
In article 
<oster-B8530D.08470726022002@newssvr14-ext.news.prodigy.com>,
 David Phillip Oster <oster@ieee.org> wrote:

> What is the best way to use a source code generator with Codewarrior?

Oh, and:

4.) If the generated C++ file gets an error from the C++ compiler, how 
do I get the error to refer to the appropriate line of the original 
input file, from which the C++ was generated?
Re: [Q] How do I use a source code generator?
#1034
Author: MW Ron
Date: Wed, 27 Feb 2002 00:13
42 lines
2581 bytes
In article 
<oster-B8530D.08470726022002@newssvr14-ext.news.prodigy.com>,
 David Phillip Oster <oster@ieee.org> wrote:

>What is the best way to use a source code generator with Codewarrior?
>
>Say, I've got something like lex or yacc, that takes source code in a 
>little language and generates a new file or stream of c++ source code, 
>and that my input file has #includes in it. How do I:
>
>1.) Tell Codewarrior that after it runs the translator on the input 
>file, it should run the compiler on the resulting output file?
>
>2.) Tell Codewarrior that the output C file depends on the input file, 
>and also the include files?
>
>3.) What if the translator generates both a .cp file, and a .r file?
>
>Should I be writing my translator as a preprocessor plugin?

either that or use a perl script to do this and use the Perl plugin.

>Should I junk the whole idea of seamless integration with Codewarrior, 
>and just use MPW and MPW's makeFiles to do all the non-Codewarrior 
>processing, then have it send an appleEvent to codewarrior to build the 
>resulting C++?
>
>What part of the Metrowerks documentation should I have read?

You should read the Plugin API Reference.

It seems like this should be something you can do simply, but I'm really 
not up on this stuff.

Ron

-- 
       TOP PICK   HandHeld Computing - issue 4.5
   "The best overall development tool for the Palm OS"

 Metrowerks, maker of CodeWarrior  -  "Software Starts Here"  
Ron Liechty - MWRon@metrowerks.com - http://www.metrowerks.com
Re: [Q] How do I use a source code generator?
#1035
Author: David Phillip Oster
Date: Wed, 27 Feb 2002 16:23
7 lines
1871 bytes
In article <mwron-C88661.19130126022002@enews.newsguy.com>,
 MW Ron <mwron@metrowerks.com> wrote:

> You should read the Plugin API Reference.

Thank you. I'll get on it, and report back here, concisely, what I find 
out.
Re: [Q] How do I use a source code generator?
#1036
Author: Richard Wesley
Date: Wed, 27 Feb 2002 20:56
47 lines
2687 bytes
In article 
<oster-B8530D.08470726022002@newssvr14-ext.news.prodigy.com>,
 David Phillip Oster <oster@ieee.org> wrote:

> What is the best way to use a source code generator with Codewarrior?
> 
> Say, I've got something like lex or yacc, that takes source code in a 
> little language and generates a new file or stream of c++ source code, 
> and that my input file has #includes in it. How do I:
> 
> 1.) Tell Codewarrior that after it runs the translator on the input 
> file, it should run the compiler on the resulting output file?
> 
> 2.) Tell Codewarrior that the output C file depends on the input file, 
> and also the include files?
> 
> 3.) What if the translator generates both a .cp file, and a .r file?
> 
> Should I be writing my translator as a preprocessor plugin?
> 
> Should I junk the whole idea of seamless integration with Codewarrior, 
> and just use MPW and MPW's makeFiles to do all the non-Codewarrior 
> processing, then have it send an appleEvent to codewarrior to build the 
> resulting C++?
> 
> What part of the Metrowerks documentation should I have read?

David -

I did this with Alex's flex/bison plugins last summer and it was pretty 
simple.  CW seems to just get it if you set up the link order correctly.

You _do_ have to add the output file, but it is not a big deal.

HTH,

-- 

- rmgw

http://www.electricfish.com/hawkfish/

----------------------------------------------------------------------------
Richard Wesley           Electric Fish, Inc.       hawkfish@electricfish.com

"You miss too much these days if you stop to think."
                  - U2, "Waiting for the End of the World"
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads