fixed output of array and byte array literals

This commit is contained in:
hyunghwan.chung 2018-06-13 16:43:19 +00:00
parent 34ee56784d
commit 69bdd55579
3 changed files with 31 additions and 11 deletions

View File

@ -84,6 +84,7 @@ class HttpSocket(SyncSocket)
{ {
var(#get) server := nil. var(#get) server := nil.
var(#get) rid := -1. var(#get) rid := -1.
var bs.
method close method close
{ {
@ -104,7 +105,6 @@ class HttpSocket(SyncSocket)
method getLine method getLine
{ {
} }
method readRequest method readRequest
@ -114,7 +114,7 @@ class HttpSocket(SyncSocket)
method _run_service method _run_service
{ {
| buf | | buf k i |
self timeout: 10. self timeout: 10.
(*while (true) (*while (true)
@ -123,18 +123,32 @@ class HttpSocket(SyncSocket)
}. *) }. *)
buf := ByteArray new: 128. buf := ByteArray new: 128.
'IM RUNNING SERVICE...............' dump. 'IM RUNNING SERVICE...............' dump.
(*
self readBytes: buf. self readBytes: buf.
buf dump. buf dump.
self readBytes: buf. self readBytes: buf.
buf dump. buf dump.
*)
i := 0.
while (i < 3)
{
k := self.bs next: 3 into: buf startingAt: 4.
(buf copyFrom: 4 count: k) dump.
i := i + 1.
}.
self close. self close.
} }
method runService method runService
{ {
self.bs := ByteStream on: self.
[ self _run_service ] on: Exception do: [:ex | [ self _run_service ] on: Exception do: [:ex |
self close. self close.
('EXCEPTION IN HttpSocket ' & ex messageText) dump ('EXCEPTION IN HttpSocket ' & ex messageText) dump

View File

@ -248,10 +248,6 @@ class ByteStream(Object) ### [ByteStreamable, ByteXXX]
^v. ^v.
} }
method nextUint16
{
}
method next: count into: byte_array startingAt: pos method next: count into: byte_array startingAt: pos
{ {
## return the count bytes ## return the count bytes

View File

@ -520,10 +520,15 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
else if (MOO_OBJ_GET_FLAGS_TYPE(oop) == MOO_OBJ_TYPE_BYTE) else if (MOO_OBJ_GET_FLAGS_TYPE(oop) == MOO_OBJ_TYPE_BYTE)
{ {
if (outbfmt(moo, mask, "#[") <= -1) return -1; if (outbfmt(moo, mask, "#[") <= -1) return -1;
for (i = 0; i < MOO_OBJ_GET_SIZE(oop); i++) i = 0;
if (i < MOO_OBJ_GET_SIZE(oop))
{
if (outbfmt(moo, mask, "%d", ((moo_oop_byte_t)oop)->slot[i]) <= -1) return -1;
for (++i; i < MOO_OBJ_GET_SIZE(oop); i++)
{ {
if (outbfmt(moo, mask, " %d", ((moo_oop_byte_t)oop)->slot[i]) <= -1) return -1; if (outbfmt(moo, mask, " %d", ((moo_oop_byte_t)oop)->slot[i]) <= -1) return -1;
} }
}
if (outbfmt(moo, mask, "]") <= -1) return -1; if (outbfmt(moo, mask, "]") <= -1) return -1;
} }
@ -548,11 +553,16 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
else if (c == moo->_array) else if (c == moo->_array)
{ {
if (outbfmt(moo, mask, "#(") <= -1) return -1; if (outbfmt(moo, mask, "#(") <= -1) return -1;
for (i = 0; i < MOO_OBJ_GET_SIZE(oop); i++) i = 0;
if (i < MOO_OBJ_GET_SIZE(oop))
{
if (print_object(moo, mask, ((moo_oop_oop_t)oop)->slot[i], outbfmt) <= -1) return -1;
for (++i; i < MOO_OBJ_GET_SIZE(oop); i++)
{ {
if (outbfmt(moo, mask, " ") <= -1) return -1; if (outbfmt(moo, mask, " ") <= -1) return -1;
if (print_object(moo, mask, ((moo_oop_oop_t)oop)->slot[i], outbfmt) <= -1) return -1; if (print_object(moo, mask, ((moo_oop_oop_t)oop)->slot[i], outbfmt) <= -1) return -1;
} }
}
if (outbfmt(moo, mask, ")") <= -1) return -1; if (outbfmt(moo, mask, ")") <= -1) return -1;
} }
else if (c == moo->_class) else if (c == moo->_class)