• R/O
  • SSH

quipu: Commit

quipu mercurial repository


Commit MetaInfo

Revisión925ba01bc87bf82ec2fed078fb94455bcf7c61c3 (tree)
Tiempo2020-03-27 10:03:03
AutorAgustina Arzille <avarzille@rise...>
CommiterAgustina Arzille

Log Message

Cleanup last merge

Cambiar Resumen

Diferencia incremental

diff -r 87040ad0e562 -r 925ba01bc87b stream.cpp
--- a/stream.cpp Thu Mar 26 21:56:57 2020 -0300
+++ b/stream.cpp Thu Mar 26 22:03:03 2020 -0300
@@ -502,36 +502,6 @@
502502 return (ret);
503503 }
504504
505-#if defined (QP_PLATFORM_UNIX) || defined (QP_PLATFORM_WINDOWS)
506-
507-static int
508-osfd_read (interpreter *interp, stream& strm, void *dst, uint32_t bytes)
509-{
510- return (llio_read (interp, as_osfd (strm.cookie), (char *)dst, bytes));
511-}
512-
513-static int
514-osfd_write (interpreter *interp, stream& strm, const void *src, uint32_t bytes)
515-{
516- return (llio_write (interp, as_osfd (strm.cookie),
517- (const char *)src, bytes));
518-}
519-
520-static bool
521-osfd_seek (interpreter *, stream& strm, spos& pos, int whence)
522-{
523- return (llio_seek (as_osfd (strm.cookie), pos, whence));
524-}
525-
526-static bool
527-osfd_close (interpreter *, stream& strm)
528-{
529- return (llio_close (as_osfd (strm.cookie)));
530-}
531-
532-#endif
533-
534-// XXX: Allow different encodings.
535505 stream* fstream_open (interpreter *interp,
536506 const char *path, const char *mode)
537507 {
@@ -541,7 +511,7 @@
541511 if (!osfd_valid_p (osfd))
542512 return (nullptr);
543513
544- stream::xops ops = { osfd_read, osfd_write, osfd_seek, osfd_close };
514+ stream::xops ops = file_ops (flags);
545515 stream *ret = stream::make (interp, flags,
546516 STRM_BUFSIZ, ops, (void *)(uintptr_t)osfd);
547517
@@ -588,10 +558,7 @@
588558 s.bvec.vo_type = typecode::BVECTOR;
589559 strm.bvec = s.bvec.as_obj ();
590560
591- strm.ops.read = osfd_read;
592- strm.ops.write = osfd_write;
593- strm.ops.seek = osfd_seek;
594- strm.ops.close = osfd_close;
561+ strm.ops = file_ops (STRM_BIN);
595562
596563 s.lk.vo_type = typecode::LOCK;
597564 s.lk.init (true);
@@ -629,6 +596,15 @@
629596 p = init_std_stream (std_streams[2], STRM_WRITE, QP_STDERR_HANDLE);
630597 err_stream = ensure_mask(p, TYPE_SHIFT)->as_obj ();
631598
599+#ifdef QP_PLATFORM_WINDOWS
600+ if (!osfd_valid_p (std_streams[0].cookie) ||
601+ !osfd_valid_p (std_streams[1].cookie) ||
602+ !osfd_valid_p (std_streams[2].cookie) ||
603+ !osfd_valid_p (interp->io_event = CreateEventW (nullptr,
604+ true, false, nullptr)))
605+ return (init_op::result_failed);
606+#endif
607+
632608 // Add the dynamic bindings.
633609 object sym = intern (interp, "*in*", 4, nullptr, symbol::special_flag);
634610 symval(sym) = in_stream;
Show on old repository browser