Made elf2aout compilable for windows under linux
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
* only. IE: A is equivalent to A0 ... Z$ is equivalent to Z0$
|
||||
*
|
||||
* Statements:
|
||||
* BEEP freq,ms - Generate a BEEP on the PC speaker
|
||||
* CLEAR - Erase variables only
|
||||
* CLOSE#n - Close file (0-9) opened with OPEN
|
||||
* DATA - Enter "inline" data statements
|
||||
@@ -155,7 +154,7 @@
|
||||
#define SAVE 25
|
||||
#define LOAD 26
|
||||
#define DELAY 27
|
||||
#define BEEP 28
|
||||
//#define BEEP 28
|
||||
#define DOS 29
|
||||
#define OUT 30
|
||||
|
||||
@@ -279,11 +278,6 @@ int eval_sub(void);
|
||||
|
||||
WINDOW *win;
|
||||
|
||||
void beep (int i, int t)
|
||||
{
|
||||
printf("BEEP not implemented yet, at line %u\n", line);
|
||||
}
|
||||
|
||||
void delay (int msec)
|
||||
{
|
||||
usleep (msec * 1000);
|
||||
@@ -1371,11 +1365,6 @@ input: if (ii == -1)
|
||||
case SRND:
|
||||
srandom(eval_num());
|
||||
break;
|
||||
case BEEP:
|
||||
i = eval_num();
|
||||
expect(',');
|
||||
beep(i, eval_num());
|
||||
break;
|
||||
case DOS:
|
||||
eval_char();
|
||||
fflush(stdout);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Use UECIDE package from http://uecide.org/download
|
||||
ifndef MIPS_GCC_PREFIX
|
||||
ifdef UECIDE
|
||||
MIPS_GCC_PREFIX = $(UECIDE)/compilers/pic32-tools/bin/pic32-
|
||||
MIPS_GCC_PREFIX = $(UECIDE)/compilers/pic32-tools-452/bin/pic32-
|
||||
MIPS_GCC_FORMAT = elf32-tradlittlemips
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -7,9 +7,9 @@ VERSION = $(RELEASE)-$(BUILD)
|
||||
# chipKIT PIC32 compiler from UECIDE
|
||||
ifdef UECIDE
|
||||
ifndef GCCPREFIX
|
||||
GCCPREFIX = ${UECIDE}/compilers/pic32-tools/bin/pic32-
|
||||
GCCPREFIX = ${UECIDE}/compilers/pic32-tools-452/bin/pic32-
|
||||
LDFLAGS = -Wl,--oformat=elf32-tradlittlemips
|
||||
INCLUDES = -I${UECIDE}/compilers/pic32-tools/lib/gcc/pic32mx/4.5.1/include
|
||||
INCLUDES = -I${UECIDE}/compilers/pic32-tools-452/lib/gcc/pic32mx/4.5.2/include
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CC = gcc -g
|
||||
CC = ${HOSTCC}gcc -g
|
||||
CFLAGS = -O -Wall
|
||||
DESTDIR = /usr/local
|
||||
OBJS = elf2aout.o
|
||||
@@ -16,3 +16,6 @@ clean:
|
||||
|
||||
$(PROG): $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
$(PROG).exe: $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <err.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
@@ -42,6 +44,86 @@
|
||||
#include <stdint.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned int u_int;
|
||||
|
||||
|
||||
void verr(int eval, const char *fmt, va_list ap) {
|
||||
char* __progname = "elf2aout";
|
||||
int sverrno;
|
||||
|
||||
sverrno = errno;
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL) {
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, ": ");
|
||||
}
|
||||
(void)fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void err(int eval, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
verr(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void verrx(int eval, const char *fmt, va_list ap) {
|
||||
char* __progname = "elf2aout";
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL)
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, "\n");
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void errx(int eval, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
verrx(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void vwarn(const char *fmt, va_list ap) {
|
||||
int sverrno = errno;
|
||||
char* __progname = "elf2aout";
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL) {
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, ": ");
|
||||
}
|
||||
(void)fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
}
|
||||
|
||||
void warn(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vwarn(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void vwarnx(const char *fmt, va_list ap) {
|
||||
char* __progname = "elf2aout";
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL)
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
void warnx(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vwarnx(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Header prepended to each a.out file.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user