[comp.lsi] 1986 Berkeley tools: Preprocessor problem w/ Meg input file

dlandis@enlog.Wichita.NCR.COM (Dave Landis) (03/10/88)

I'm attempting a port of the 1986 Berkeley tools to a Mentor DN3000.
I've successfully run 'make' on the meg subdirectory, but I run into
problems when I try the example in the documentation.   It goes something
like this:

INPUTS:  INIT OP1 OP2 SWR MACK;
OUTPUTS: WAIT MINIT MRD SACK MWR DLI;

-- Define the encoding for the processor operations
-- The C preprocessor does textual substitions on these macros.
#define OP  OP1 OP2
#define NOP   0   0
#define HALT  0   1
#define READ  1   0
#define WRITE 1   1
#define XOP   ?    ?
.
.
.
When I type

	meg multibus.in

I get the error message

	"unexpected token IDENTIFIER on line 6"

Has anyone experienced anything like this before?   If so, how did
you fix it?  For now, I'll just have to live with substitions where
these macros occur, but I'd love to use the preprocessor.

Thanks in advance, 

Dave Landis
NCR Corp.
3718 N. Rock Road
Wichita, KS 67220
(316)-688-8861

nclee@sbcs.sunysb.edu (Nai Chi Lee) (03/13/88)

In article <192@enlog.Wichita.NCR.COM>, dlandis@enlog.Wichita.NCR.COM (Dave Landis) writes:
> 
> INPUTS:  INIT OP1 OP2 SWR MACK;
> OUTPUTS: WAIT MINIT MRD SACK MWR DLI;
> 
> -- Define the encoding for the processor operations
> -- The C preprocessor does textual substitions on these macros.
> #define OP  OP1 OP2
> #define NOP   0   0
> .
> .
> I get the error message
> 
> 	"unexpected token IDENTIFIER on line 6"

The reason is: Meg don't know what in the world is "#define" !

You must run "cpp" (the C-preprocessor) on your input file 
to perform those "#define" subsitution first. Do it like this:

	/lib/cpp -P in-file-name > temp-file
	meg -e temp-file > out-file-name

--
Nai Chi Lee

"It is difficult to make something foolproof because fools are so ingenious."
[Anon]