diff --git a/moo/bin/Makefile.am b/moo/bin/Makefile.am index 859dc96..2a99ecd 100644 --- a/moo/bin/Makefile.am +++ b/moo/bin/Makefile.am @@ -29,7 +29,7 @@ moo_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) moo_LDFLAGS = $(LDFLAGS_ALL_COMMON) moo_LDADD = $(LIBADD_LIB_COMMON) -lmoox $(PTHREAD_LIBS) if WIN32 -moo_LDADD += $(SOCKET_LIBS) +moo_LDADD += $(SOCKET_LIBS) -lpsapi endif if ENABLE_STATIC_MODULE moo_DEPENDENCIES = ../lib/libmoo.la diff --git a/moo/bin/Makefile.in b/moo/bin/Makefile.in index 3ef4ab3..85114a2 100644 --- a/moo/bin/Makefile.in +++ b/moo/bin/Makefile.in @@ -91,7 +91,7 @@ host_triplet = @host@ @ENABLE_LIBLTDL_TRUE@am__append_1 = $(LTDL_LIBS) @ENABLE_LIBLTDL_FALSE@am__append_2 = $(DL_LIBS) bin_PROGRAMS = moo$(EXEEXT) -@WIN32_TRUE@am__append_3 = $(SOCKET_LIBS) +@WIN32_TRUE@am__append_3 = $(SOCKET_LIBS) -lpsapi @ENABLE_STATIC_MODULE_FALSE@moo_DEPENDENCIES = $(am__DEPENDENCIES_4) \ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) \ @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_5) diff --git a/moo/lib/Makefile.am b/moo/lib/Makefile.am index 3acff79..9f5285a 100644 --- a/moo/lib/Makefile.am +++ b/moo/lib/Makefile.am @@ -66,7 +66,6 @@ libmoo_la_SOURCES = \ moo-rbt.h \ moo-utl.h \ moo-prv.h \ - moo-std.h \ pack1.h \ unpack.h \ bigint.c \ @@ -98,13 +97,13 @@ libmoo_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD) libmoo_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) libmoo_la_LIBADD = $(LIBADD_LIB_COMMON) -libmoox_la_SOURCES = std.c +libmoox_la_SOURCES = std.c moo-std.h if WIN32 libmoox_la_SOURCES += poll-msw.c poll-msw.h endif libmoox_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD) libmoox_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) -libmoox_la_LIBADD = $(LIBADD_LIB_COMMON) -lmoo +libmoox_la_LIBADD = $(LIBADD_LIB_COMMON) -lmoo if ENABLE_STATIC_MODULE libmoo_la_LIBADD += -lmoo-stdio diff --git a/moo/lib/Makefile.in b/moo/lib/Makefile.in index 788c4ae..9f8d954 100644 --- a/moo/lib/Makefile.in +++ b/moo/lib/Makefile.in @@ -178,7 +178,7 @@ libmoo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libmoo_la_LDFLAGS) $(LDFLAGS) -o $@ libmoox_la_DEPENDENCIES = $(am__DEPENDENCIES_5) -am__libmoox_la_SOURCES_DIST = std.c poll-msw.c poll-msw.h +am__libmoox_la_SOURCES_DIST = std.c moo-std.h poll-msw.c poll-msw.h @WIN32_TRUE@am__objects_1 = libmoox_la-poll-msw.lo am_libmoox_la_OBJECTS = libmoox_la-std.lo $(am__objects_1) libmoox_la_OBJECTS = $(am_libmoox_la_OBJECTS) @@ -450,7 +450,6 @@ libmoo_la_SOURCES = \ moo-rbt.h \ moo-utl.h \ moo-prv.h \ - moo-std.h \ pack1.h \ unpack.h \ bigint.c \ @@ -484,10 +483,10 @@ libmoo_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) libmoo_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_7) \ $(am__append_8) $(am__append_10) $(am__append_12) \ $(am__append_14) -libmoox_la_SOURCES = std.c $(am__append_6) +libmoox_la_SOURCES = std.c moo-std.h $(am__append_6) libmoox_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD) libmoox_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) -libmoox_la_LIBADD = $(LIBADD_LIB_COMMON) -lmoo +libmoox_la_LIBADD = $(LIBADD_LIB_COMMON) -lmoo @ENABLE_STATIC_MODULE_TRUE@libmoo_la_DEPENDENCIES = $(abs_builddir)/../mod/libmoo-stdio.la \ @ENABLE_STATIC_MODULE_TRUE@ $(am__append_9) $(am__append_11) \ @ENABLE_STATIC_MODULE_TRUE@ $(am__append_13) $(am__append_15) diff --git a/moo/mod/_con.c b/moo/mod/_con.c index abd60aa..c367b17 100644 --- a/moo/mod/_con.c +++ b/moo/mod/_con.c @@ -59,17 +59,14 @@ static moo_pfrc_t pf_open (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) HANDLE h; moo_ooi_t immv; - h = GetStdHandle(STD_INPUT_HANDLE); + h = GetStdHandle(STD_OUTPUT_HANDLE); if (h == INVALID_HANDLE_VALUE) return 0; if (h == NULL) { + /* the program doens't have an associated handle for stdin. is it a service? */ } - imm = moo_makeimm (moo, h); - if (imm <= -1) - { - /* error */ - } + MOO_STACK_SETRET (moo, nargs, MOO_SMPTR_TO_OOP(h)); #elif defined(__DOS__) moo->errnum = MOO_ENOIMPL; @@ -88,7 +85,7 @@ static moo_pfrc_t pf_open (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) } else { - con->fd = open ("/dev/tty", O_RDWR, 0); + con->fd = open("/dev/tty", O_RDWR, 0); if (con->fd == -1) { /* TODO: failed to open /dev/stdout */ @@ -99,13 +96,13 @@ static moo_pfrc_t pf_open (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) con->fd_opened = 1; } - term = getenv ("TERM"); - if (term && setupterm (term, con->fd, &err) == OK) + term = getenv("TERM"); + if (term && setupterm(term, con->fd, &err) == OK) { } - con->cup = tigetstr ("cup"); /* TODO: error check */ - con->clear = tigetstr ("clear"); + con->cup = tigetstr("cup"); /* TODO: error check */ + con->clear = tigetstr("clear"); #if 0 { @@ -131,9 +128,16 @@ static moo_pfrc_t pf_open (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) static moo_pfrc_t pf_close (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) { #if defined(_WIN32) + moo_oop_t arg; HANDLE h; - h = MOO_STACK_GETARG (moo, nargs, 0); + con = MOO_STACK_GETARG(moo, nargs, 0); + h = MOO_OOP_TO_SMPTR(con); + + /*if (h != XXX) + { + CloseHandle (h); + }*/ #elif defined(__DOS__) /* TODO */ @@ -153,8 +157,9 @@ static moo_pfrc_t pf_close (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) static moo_pfrc_t pf_write (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) { #if defined(_WIN32) + /* TODO: */ #elif defined(__DOS__) - + /* TODO: */ #else console_t* con; moo_oop_char_t msg;