[BACK]Return to main.cpp CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_ntl

File: [local] / OpenXM / src / ox_ntl / main.cpp (download)

Revision 1.2, Sat Nov 8 12:34:00 2003 UTC (20 years, 6 months ago) by iwane
Branch: MAIN
Changes since 1.1: +9 -5 lines

added signal handler - SIGUSR1
move stack functions   oxserv.c ==> oxstack.c
                       oxserv.h ==> oxstack.h
move convert functions ntl.cpp  ==> ntlconv.cpp

/* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.2 2003/11/08 12:34:00 iwane Exp $ */

#include "ox_toolkit.h"
#include "oxserv.h"
#include "oxstack.h"
#include "ntl.h"

#define VERSION 0x00000001
#define ID_STRING "$Revision: 1.2 $"

#if 0
extern "C" {
void dprintf(const char *, ...);
}
#endif

static void
ntl_executeFunction(const char *func, cmo **arg, int argc)
{
	cmo *ans;
	if (strcmp(func, "fctr") == 0) {
		ans = ntl_fctr(arg, argc);
		oxstack_push(ans);
		return ;
	}

	oxstack_push((cmo *)new_cmo_error2((cmo *)new_cmo_string("Unknown Function")));
}



int
main(int argc, char *argv[])
{
	int fd = 3;
	int i;
	int ret;

	OXFILE *oxfp;

	oxfp = oxf_open(fd);

	ox_stderr_init(stderr);

	oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, ntl_executeFunction, NULL);
	oxserv_init(oxfp, VERSION, ID_STRING, "ox_ntl", NULL, NULL);

	for (i = 0;; i++) {
		ret = oxserv_receive(oxfp);
		if (ret != OXSERV_SUCCESS)
			break;
	}

	oxserv_dest();
	oxf_close(oxfp);

	return (0);
}