Exemplo n.º 1
0
int GO_system(const char *s)
{
	fputs("GO_system:", stderr);
	fputs(s, stderr);
	fputs("\n", stderr);
	GOL_sysabort(GO_TERM_BUGTRAP);
}
Exemplo n.º 2
0
void *GOL_sysmalloc(size_t size)
{
	void *p;
	if ((p = GOL_memmanalloc(&GOL_sysman, size)) == NULL)
		GOL_sysabort(GO_TERM_SYSRESOVER);
	return p;
}
Exemplo n.º 3
0
int cc1main(struct STR_CC1MAIN *str_cc1main)
{
//	static char execflag = 0;
	int argc;
	UCHAR **argv;
	UCHAR **argv1, **p;
	GO_stdout.p0 = GO_stdout.p = str_cc1main->dest0;
	GO_stdout.p1 = str_cc1main->dest1;
	GO_stdout.dummy = ~0;
	GO_stderr.p0 = GO_stderr.p = str_cc1main->err0;
	GO_stderr.p1 = str_cc1main->err1;
	GO_stderr.dummy = ~0;

	/* 多重実行阻止 (staticを再初期化すればできるが) */
//	if (execflag)
//		return 7;
//	execflag = 1;

	if (setjmp(setjmp_env)) {
		str_cc1main->dest0 = GO_stdout.p;
		str_cc1main->err0 = GO_stderr.p;
		return GOL_abortcode;
	}

	if (str_cc1main->work1 - str_cc1main->work0 < SYSWORK_SIZE * 2)
		return GO_TERM_WORKOVER;
	GOL_memmaninit(&GOL_sysman, SYSWORK_SIZE, str_cc1main->work0);
	GOL_memmaninit(&GOL_memman, str_cc1main->work1 - str_cc1main->work0 - SYSWORK_SIZE,
		str_cc1main->work0 + SYSWORK_SIZE);
	argv = ConvCmdLine1(&argc, str_cc1main->cmdlin);
	p = argv1 = GOL_sysmalloc((argc + 1) * sizeof (char *));
	for (;;) {
		if ((*p = *argv) == NULL)
			break;
		if ((*argv)[0] == '-' && (*argv)[1] == 'o') {
			str_cc1main->outname = &((*argv)[2]);
			if ((*argv)[2] == '\0') {
				if (argv[1] != NULL)
					str_cc1main->outname = (argv++)[1];
			}
			p--;  /* delete -o */
		}
		p++;
		argv++;
	}
	str_cc1main->errcode = main1(p - argv1, argv1);
	GOL_sysabort(GO_TERM_NORMAL);
}
Exemplo n.º 4
0
int main(int argc, UCHAR **argv)
{
	struct bss_alloc *bss0 = (struct bss_alloc *) malloc(sizeof (struct bss_alloc));
	GO_stdout.p0 = GO_stdout.p = bss0->_stdout;
	GO_stdout.p1 = GO_stdout.p0 + SIZ_STDOUT;
	GO_stdout.dummy = ~0;
	GO_stderr.p0 = GO_stderr.p = bss0->_stderr;
	GO_stderr.p1 = GO_stderr.p0 + (SIZ_STDERR - 128); /* わざと少し小さくしておく */
	GO_stderr.dummy = ~0;
//	GOL_memmaninit(&GOL_sysman, SIZ_SYSWRK, bss0->syswrk);
	GOL_memmaninit(&GOL_memman, SIZ_WORK, GOL_work0 = bss0->work);

	GOL_retcode = main1(argc, argv, bss0->work1);
	/* バッファを出力 */
	GOL_sysabort(0);
	return 0; /* ダミー */
}
Exemplo n.º 5
0
int obj2bim_main(struct STR_OBJ2BIM *params)
{
//	static char execflag = 0;
	int argc;
	UCHAR **argv, *tmp0;
	UCHAR **argv1, **p;
	GO_stdout.p0 = GO_stdout.p = params->map0;
	GO_stdout.p1 = params->map1; /* stdoutはmap */
	GO_stdout.dummy = ~0;
	GO_stderr.p0 = GO_stderr.p = params->err0;
	GO_stderr.p1 = params->err1;
	GO_stderr.dummy = ~0;

	/* 多重実行阻止 (staticを再初期化すればできるが) */
//	if (execflag)
//		return 7;
//	execflag = 1;

	if (setjmp(setjmp_env)) {
		params->err0 = GO_stderr.p;
		return GOL_abortcode;
	}

	if (params->work1 - params->work0 < SIZ_SYSWRK + 16 * 1024)
		return GO_TERM_WORKOVER;
	GOL_memmaninit(&GOL_sysman, SIZ_SYSWRK, params->work0);
	GOL_memmaninit(&GOL_memman, params->work1 - params->work0 - SIZ_SYSWRK, params->work0 + SIZ_SYSWRK);
	argv = ConvCmdLine1(&argc, params->cmdlin);

	params->errcode = main0(argc, argv, params);
	params->map0 = GO_stdout.p;

skip:
	/* バッファを出力 */
	GOL_sysabort(0);
}
Exemplo n.º 6
0
void GO_exit(int status)
{
	fputs("GO_exit:mikan-trap!\n", stderr);
	GOL_sysabort(GO_TERM_BUGTRAP);
}
Exemplo n.º 7
0
int GO_fscanf(GO_FILE *stream, const char *format, ...)
{
	fputs("GO_fscanf:mikan-trap!\n", stderr);
	GOL_sysabort(GO_TERM_BUGTRAP);
}
Exemplo n.º 8
0
int GO_sscanf(char *s, const char *format, ...)
{
	fputs("GO_sscanf:mikan-trap!\n", stderr);
	GOL_sysabort(GO_TERM_BUGTRAP);
}
Exemplo n.º 9
0
double GO_strtod(const char *s, char **endp)
{
	fputs("GO_strtod:mikan-trap!\n", stderr);
	GOL_sysabort(GO_TERM_BUGTRAP);
}
Exemplo n.º 10
0
int	GO_atexit(void (*fcn)(void))
{
	fputs("GO_atexit:mikan-trap!\n", stderr);
	GOL_sysabort(GO_TERM_BUGTRAP);
}
Exemplo n.º 11
0
int gas2nask_main(struct STR_GAS2NASK *params)
{
	UCHAR *p0, *f, *src0, i = 0;
	static UCHAR filename[1000];
	struct STR_FLAGS flags;
	int j, size;
	errflag = 0;
	DRVOSA_errcode = 0;
	msgptr = params->err0;
	msgptr1 = params->err1;
	params->outname = NULL;

	for (j = 0; j < 8; j++)
		flags.opt[j] = 0;

	if (setjmp(setjmp_env)) {
		params->err0 = msgptr;
		params->errcode = DRVOSA_errcode;
		return GOL_abortcode;
	}

	p0 = params->cmdlin;
	while (*p0 > ' ')
		p0++;
	for (;;) {
		while (*p0 != '\0' && *p0 <= ' ')
			p0++;
		if (*p0 == '\0')
			break;
		if (*p0 == '-') {
			do {
				p0++;
				if (*p0 == 'a')
					flags.opt[FLAG_a] = 1;
				if (*p0 == 'e')
					flags.opt[FLAG_e] = 1;
				if (*p0 == 'd') {
					j = FLAG_d;
	getparam:
					do {
						p0++;
					} while (*p0 != '\0' && *p0 <= ' ');
					param_p[j] = p0;
					while ('0' <= *p0 && *p0 <= '9')
						p0++;
					flags.opt[j] = p0 - param_p[j];
					p0--; /* 次のループのため */
				}
				if (*p0 == 'b') {
					j = FLAG_b;
					goto getparam;
				}
				if (*p0 == 't') {
					j = FLAG_t;
					goto getparam;
				}
				if (*p0 == 'D') {
					j = FLAG_D;
					goto getparam;
				}
				if (*p0 == 'B') {
					j = FLAG_B;
					goto getparam;
				}
				if (*p0 == 'T') {
					j = FLAG_T;
					goto getparam;
				}
			} while (*p0 > ' ');
			continue;
		}
		f = filename;
		do {
			*f++ = *p0++;
		} while (*p0 > ' ');
		*f = '\0';
		if (i == 0) {
			src0 = osain(filename, &size);
			if (src0 == NULL)
				errout_s_NL("can't open file: ", filename);
		}
		i++;
	}
	if (i != 2) {
		errout("\"gas2nask\"  Copyright(C) 2004 H.Kawai" NL
			"usage : >gas2nask [-a] [-e] input-file output-file" NL
		);
	}
	src0 = convmain(src0, src0 + size, params->dest0, params->dest1, flags);
	if (src0 == NULL)
		GOL_sysabort(GO_TERM_OUTOVER);
	params->outname = filename;
	params->dest0 = src0;

	GOLD_exit(errflag);
}