Related articles |
---|
LRGEN 9.0: fast LALR parser generator paul@paulbmann.com (Paul B Mann) (2010-07-30) |
Re: LRGEN 9.0: fast LALR parser generator paul@paulbmann.com (Paul Mann) (2010-07-30) |
From: | Paul Mann <paul@paulbmann.com> |
Newsgroups: | comp.compilers |
Date: | Fri, 30 Jul 2010 10:31:38 -0700 (PDT) |
Organization: | Compilers Central |
References: | 10-07-041 |
Keywords: | code |
Posted-Date: | 30 Jul 2010 20:34:27 EDT |
A user was trying to compile the DFAC code on Linux.
Here is what I took from some code in another product that
compiles on Linux, when DOS is not defined.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#include <math.h>
#ifdef DOS
#include <io.h>
#else
#include <unistd.h>
#endif
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
It looks like <io.h> should be <unistd.h> on Linux.
Here is another code piece that might be useful:
#ifdef DOS
fd = _open (filename, O_BINARY); // DOS version.
#else
fd = _open (filename, 0); // Linux version.
#endif
About the '_open' warnings. I think on Linux you have to
use 'open' instead.
Paul B Mann
[Yeah, those are some of the usual Windows non-standard bits. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.