diff --git a/BACKUP/Makefile b/BACKUP/Makefile deleted file mode 100644 index b00cf05..0000000 --- a/BACKUP/Makefile +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - -# all: test_typechecking.tc -all: test_bitcoinpayment.tc - -# z3: session.dats test_typechecking.dats - # patsopt -tc --constraint-export -d $< | patsolve_smt2 --printfile ./set.smt2 -i | tee ./constraints | z3 -t:2000 -smt2 -in 2>&1 | tee output | em -fgreen "^unsat" | em "^sat|^timeout|^unknown" #| grep -B1 "unknown" - - - -%.tc: %.dats - patsopt -tc --constraint-export -d $< | patsolve_smt2 --printfile ./set.smt2 -i | tee ./constraints | z3 -t:2000 -smt2 -in 2>&1 | tee output | em -fgreen "^unsat" | em "^sat|^timeout|^unknown" - - -constraints.xx: - z3 -t:2000 -smt2 -in 2>&1 | tee output | em -fgreen "^unsat" | em "^sat|^timeout|^unknown" - - -redisd: - docker run --name redisd -d redis - -redis-cli: - docker run -it --rm --link redisd:redis redis redis-cli -h redis -p 6379 \ No newline at end of file diff --git a/BACKUP/README.md b/BACKUP/README.md deleted file mode 100644 index ebfee1f..0000000 --- a/BACKUP/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# ats-sessions -Session Types Library for ATS diff --git a/BACKUP/address.sats b/BACKUP/address.sats deleted file mode 100644 index 104501e..0000000 --- a/BACKUP/address.sats +++ /dev/null @@ -1,11 +0,0 @@ - - -abstype address - - -fun addr_make (string): addres s - -fun print_addr (address): void -fun eq_addr_addr (address, address): bool -overload print with print_addr -overload = with eq_addr_addr \ No newline at end of file diff --git a/BACKUP/ats/Makefile b/BACKUP/ats/Makefile deleted file mode 100644 index 4e941b1..0000000 --- a/BACKUP/ats/Makefile +++ /dev/null @@ -1,16 +0,0 @@ - -PATSOPT=patsopt -CC=gcc -CFLAGS += -g -std=c99 -D_GNU_SOURCE -I$(PATSHOME) -I$(PATSHOME)/ccomp/runtime -I$(PATSHOME)/contrib/atscntrb -DATS_MEMALLOC_LIBC - -%_dats.c: %.dats - $(PATSOPT) -o $@ -d $< - -%_sats.c: %.sats - $(PATSOPT) -o $@ -s $< - -a.out: json_dats.c thread_dats.c transport_dats.c main_dats.c uuid_dats.c - $(CC) $(CFLAGS) -ljansson -lpthread -lnng $^ -o $@ - -clean: - rm -rf *ats.c \ No newline at end of file diff --git a/BACKUP/ats/a.out b/BACKUP/ats/a.out deleted file mode 100755 index cee6b27..0000000 Binary files a/BACKUP/ats/a.out and /dev/null differ diff --git a/BACKUP/ats/a.out.dSYM/Contents/Info.plist b/BACKUP/ats/a.out.dSYM/Contents/Info.plist deleted file mode 100644 index 3679a65..0000000 --- a/BACKUP/ats/a.out.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.a.out - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/BACKUP/ats/a.out.dSYM/Contents/Resources/DWARF/a.out b/BACKUP/ats/a.out.dSYM/Contents/Resources/DWARF/a.out deleted file mode 100644 index 51f9416..0000000 Binary files a/BACKUP/ats/a.out.dSYM/Contents/Resources/DWARF/a.out and /dev/null differ diff --git a/BACKUP/ats/endpoint.dats b/BACKUP/ats/endpoint.dats deleted file mode 100644 index 01abc08..0000000 --- a/BACKUP/ats/endpoint.dats +++ /dev/null @@ -1,34 +0,0 @@ -#define ATS_DYNLOADFLAG 0 - -staload "./endpoint.sats" - - -local (************************) - -#include "share/atspre_staload_libats_ML.hats" - -typedef list (a:t@ype) = list0 a -typedef peer = (string (* uuid *), int (* role *)) - -datavtype ep_t (t:transport) = Ep of (transport t, - set int (* full *), set int (* self *), - uuid (* session *), uuid (* self *), - list peer) - - -assume endpoint = [t:transport] ep_t t - -in (************************) - - -implement ep_request (ep) = let - val @Ep (trans, full, self, idss, idself, peers) = ep - - - - val _ = fold@ep -in -end - - -end (************************) \ No newline at end of file diff --git a/BACKUP/ats/endpoint.sats b/BACKUP/ats/endpoint.sats deleted file mode 100644 index 0438582..0000000 --- a/BACKUP/ats/endpoint.sats +++ /dev/null @@ -1,28 +0,0 @@ -staload "./uuid.sats" -staload "libats/ML/SATS/basis.sats" - -absvtype endpoint (transport) = ptr - -fun ep_make (): endpoint - -//fun ep_get_id (!endpoint): uuid -//fun ep_set_id (!endpoint, uuid): void - -fun ep_set_roles (!endpoint, set int): void -fun ep_get_roles (!endpoint): set int - -fun {t:transport} ep_set_transport (transport t): void - -fun ep_accept (!endpoint, set int): bool -fun ep_request (!endpoint): bool - -fun ep_close (endpoint): void -fun ep_wait (endpoint): void - -fun ep_broadcast (!endpoint, msg): void -fun ep_receive (!endpoint): msg - -fun _ep_encode (!endpoint, msg_ss): msg_ep -fun _ep_decode (!endpoint, msg_ep): msg_ss - -fun ep_cut (endpoint, endpoint): endpoint \ No newline at end of file diff --git a/BACKUP/ats/json.dats b/BACKUP/ats/json.dats deleted file mode 100644 index ec2e485..0000000 --- a/BACKUP/ats/json.dats +++ /dev/null @@ -1,59 +0,0 @@ -#define ATS_DYNLOADFLAG 0 - -staload "./json.sats" - -local (*********************) - -#include "share/atspre_staload.hats" -staload JSON = "contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats" -staload _ = "contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats" -staload UN = "prelude/SATS/unsafe.sats" - -macdef JSON_DECODE_ANY = $extval (int, "JSON_DECODE_ANY") - -assume json = $JSON.JSONptr1 - -in (*********************) - -implement json_loads (str) = let - var err: $JSON.json_error_t - val json = $JSON.json_loads ($UN.strptr2string str, JSON_DECODE_ANY, err) - val _ = assert_errmsg ($JSON.JSONptr_isnot_null json, "json_loads failed.") -in - json -end - -implement json_loadb {n} {l} (pf | buf, size) = let - var err: $JSON.json_error_t - val json = $JSON.json_loadb (pf | buf, i2sz size, JSON_DECODE_ANY, err) - val _ = assert_errmsg ($JSON.JSONptr_isnot_null json, "json_loadb failed.") -in - json -end - -implement json_dumps (json) = let - val str = $JSON.json_dumps (json, $JSON.JSON_ENCODE_ANY) - val _ = assert_errmsg (isneqz str, "json_dump failed.") - val _ = $JSON.json_decref json -in - str -end - -implement json_free (json) = $JSON.json_decref json - -implement to_json (str) = let - val json = $JSON.json_string str - val _ = assert_errmsg ($JSON.JSONptr_isnot_null json, "to_json failed.") -in - json -end - -implement from_json (json) = let - val (pf | s) = $JSON.json_string_value json - val str = copy s - prval _ = minus_addback (pf, s | json) -in - str -end - -end (*********************) \ No newline at end of file diff --git a/BACKUP/ats/json.sats b/BACKUP/ats/json.sats deleted file mode 100644 index 7b4aaf6..0000000 --- a/BACKUP/ats/json.sats +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Simple interface for converting datatypes to json - */ - -absvtype json - -fun {a:vt@ype} to_json (!a): json -fun {a:vt@ype} from_json (!json): a - -vtypedef cstring = [l:addr|l>null] strptr l - -fun json_loads (!cstring): json -fun json_loadb {n:nat} {l:addr|l>null} (!(@[byte][n] @ l) | ptr l, int n): json -fun json_dumps (json): cstring -fun json_free (json): void - diff --git a/BACKUP/ats/json_dats.c b/BACKUP/ats/json_dats.c deleted file mode 100644 index 2f71728..0000000 --- a/BACKUP/ats/json_dats.c +++ /dev/null @@ -1,875 +0,0 @@ -/* -** -** The C code is generated by [ATS/Postiats-0-3-12] -** The starting compilation time is: 2018-7-12: 16h:37m -** -*/ - -/* -** include runtime header files -*/ -#ifndef _ATS_CCOMP_HEADER_NONE_ -#include "pats_ccomp_config.h" -#include "pats_ccomp_basics.h" -#include "pats_ccomp_typedefs.h" -#include "pats_ccomp_instrset.h" -#include "pats_ccomp_memalloc.h" -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -#include "pats_ccomp_memalloca.h" -#include "pats_ccomp_exception.h" -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -#endif /* _ATS_CCOMP_HEADER_NONE_ */ - - -/* -** include prelude cats files -*/ -#ifndef _ATS_CCOMP_PRELUDE_NONE_ -// -#include "prelude/CATS/basics.cats" -#include "prelude/CATS/integer.cats" -#include "prelude/CATS/pointer.cats" -#include "prelude/CATS/integer_long.cats" -#include "prelude/CATS/integer_size.cats" -#include "prelude/CATS/integer_short.cats" -#include "prelude/CATS/bool.cats" -#include "prelude/CATS/char.cats" -#include "prelude/CATS/float.cats" -#include "prelude/CATS/integer_ptr.cats" -#include "prelude/CATS/integer_fixed.cats" -#include "prelude/CATS/memory.cats" -#include "prelude/CATS/string.cats" -#include "prelude/CATS/strptr.cats" -// -#include "prelude/CATS/fprintf.cats" -// -#include "prelude/CATS/filebas.cats" -// -#include "prelude/CATS/list.cats" -#include "prelude/CATS/option.cats" -#include "prelude/CATS/array.cats" -#include "prelude/CATS/arrayptr.cats" -#include "prelude/CATS/arrayref.cats" -#include "prelude/CATS/matrix.cats" -#include "prelude/CATS/matrixptr.cats" -// -#endif /* _ATS_CCOMP_PRELUDE_NONE_ */ -/* -** for user-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER_ -// -#include _ATS_CCOMP_PRELUDE_USER_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER_ */ -/* -** for user2-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER2_ -// -#include _ATS_CCOMP_PRELUDE_USER2_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER2_ */ - -/* -staload-prologues(beg) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/basics.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats: 1533(line=44, offs=1) -- 1572(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_long.dats: 1602(line=49, offs=1) -- 1641(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_size.dats: 1597(line=49, offs=1) -- 1636(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_short.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/char.dats: 1610(line=48, offs=1) -- 1649(line=48, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/float.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/string.dats: 1631(line=50, offs=1) -- 1670(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1629(line=50, offs=1) -- 1668(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1691(line=54, offs=1) -- 1738(line=54, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_ptr.dats: 1601(line=49, offs=1) -- 1640(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_fixed.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/memory.dats: 1410(line=38, offs=1) -- 1449(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1607(line=49, offs=1) -- 1646(line=50, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1669(line=54, offs=1) -- 1715(line=55, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1738(line=59, offs=1) -- 1783(line=60, offs=38) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1865(line=66, offs=1) -- 1912(line=66, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1390(line=36, offs=1) -- 1440(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/stat.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1756(line=58, offs=1) -- 1805(line=60, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 15937(line=927, offs=1) -- 15974(line=928, offs=30) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1529(line=44, offs=1) -- 1568(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1569(line=46, offs=1) -- 1615(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1538(line=44, offs=1) -- 1577(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1578(line=46, offs=1) -- 1624(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_mergesort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_quicksort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/array.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_bsearch.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_quicksort.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayptr.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayref.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrix.dats: 1535(line=44, offs=1) -- 1574(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixptr.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixref.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream_vt.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/tostring.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/checkast.dats: 1531(line=44, offs=1) -- 1570(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1394(line=38, offs=1) -- 1433(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1456(line=43, offs=1) -- 1488(line=43, offs=33) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -staload-prologues(end) -*/ -/* -typedefs-for-tyrecs-and-tysums(beg) -*/ -/* -typedefs-for-tyrecs-and-tysums(end) -*/ -/* -dynconlst-declaration(beg) -*/ -/* -dynconlst-declaration(end) -*/ -/* -dyncstlst-declaration(beg) -*/ -ATSdyncst_mac(atscntrb_jansson_json_loads) -ATSdyncst_mac(atspre_assert_errmsg_bool1) -ATSdyncst_mac(atspre_ptr_isnot_null) -ATSdyncst_mac(atscntrb_jansson_json_loadb) -ATSdyncst_mac(atspre_g1int2uint_int_size) -ATSdyncst_mac(atscntrb_jansson_json_dumps) -ATSdyncst_mac(atspre_gt_ptr1_ptr1) -ATSdyncst_mac(the_atsptr_null) -ATSdyncst_mac(atscntrb_jansson_json_decref) -ATSdyncst_mac(atscntrb_jansson_json_string) -ATSdyncst_mac(atscntrb_jansson_json_string_value) -/* -dyncstlst-declaration(end) -*/ -/* -dynvalist-implementation(beg) -*/ -/* -dynvalist-implementation(end) -*/ -/* -exnconlst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -ATSextern() -atsvoid_t0ype -the_atsexncon_initize -( - atstype_exnconptr d2c, atstype_string exnmsg -) ; -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -/* -exnconlst-declaration(end) -*/ -/* -extypelst-declaration(beg) -*/ -/* -extypelst-declaration(end) -*/ -/* -assumelst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_ASSUME_CHECK_NONE_ -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 371(line=14, offs=1) -- 399(line=14, offs=29) -*/ -ATSassume(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json) ; -#endif // #ifndef(_ATS_CCOMP_ASSUME_CHECK_NONE_) -/* -assumelst-declaration(end) -*/ -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loads(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loadb(atstkind_type(atstype_ptrk), atstkind_t0ype(atstype_int)) ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_dumps(atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] - -#if(0) -#if(0) -ATSextern() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__strptr_isnot_null__3(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__strptr_isnot_null__3__1(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; - -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_free(atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] - -#if(0) -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__to_json__6(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -#if(0) -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__from_json__7(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 453(line=18, offs=22) -- 662(line=24, offs=4) -*/ -/* -local: -global: json_loads$0$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loads(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret0, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmpref1, json_error_t) ; -ATStmpdec(tmp2, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp3) ; -ATStmpdec(tmp4, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 442(line=18, offs=11) -- 662(line=24, offs=4) -*/ -ATSINSflab(__patsflab_json_loads): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 461(line=18, offs=30) -- 662(line=24, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 471(line=19, offs=6) -- 474(line=19, offs=9) -*/ -/* -ATSINStmpdec(tmpref1) ; -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 508(line=20, offs=13) -- 570(line=20, offs=75) -*/ -ATSINSmove(tmp2, atscntrb_jansson_json_loads(ATSPMVcastfn(strptr2string, atstkind_type(atstype_ptrk), ATSPMVrefarg0(arg0)), ATSPMVextval(JSON_DECODE_ANY), ATSPMVrefarg1(ATSPMVptrof(tmpref1)))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 595(line=21, offs=25) -- 624(line=21, offs=54) -*/ -ATSINSmove(tmp4, atspre_ptr_isnot_null(ATSPMVrefarg0(tmp2))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 580(line=21, offs=10) -- 647(line=21, offs=77) -*/ -ATSINSmove_void(tmp3, atspre_assert_errmsg_bool1(tmp4, ATSPMVstring("json_loads failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 653(line=23, offs=2) -- 657(line=23, offs=6) -*/ -ATSINSmove(tmpret0, tmp2) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 461(line=18, offs=30) -- 662(line=24, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret0) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loads] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 693(line=26, offs=30) -- 909(line=32, offs=4) -*/ -/* -local: -global: json_loadb$1$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loadb(atstkind_type(atstype_ptrk) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret5, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmpref6, json_error_t) ; -ATStmpdec(tmp7, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp8, atstkind_t0ype(atstype_size)) ; -// ATStmpdec_void(tmp9) ; -ATStmpdec(tmp10, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 674(line=26, offs=11) -- 909(line=32, offs=4) -*/ -ATSINSflab(__patsflab_json_loadb): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 712(line=26, offs=49) -- 909(line=32, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 722(line=27, offs=6) -- 725(line=27, offs=9) -*/ -/* -ATSINStmpdec(tmpref6) ; -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 786(line=28, offs=41) -- 795(line=28, offs=50) -*/ -ATSINSmove(tmp8, atspre_g1int2uint_int_size(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 758(line=28, offs=13) -- 818(line=28, offs=73) -*/ -ATSINSmove(tmp7, atscntrb_jansson_json_loadb(arg0, tmp8, ATSPMVextval(JSON_DECODE_ANY), ATSPMVrefarg1(ATSPMVptrof(tmpref6)))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 843(line=29, offs=25) -- 872(line=29, offs=54) -*/ -ATSINSmove(tmp10, atspre_ptr_isnot_null(ATSPMVrefarg0(tmp7))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 828(line=29, offs=10) -- 895(line=29, offs=77) -*/ -ATSINSmove_void(tmp9, atspre_assert_errmsg_bool1(tmp10, ATSPMVstring("json_loadb failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 901(line=31, offs=2) -- 905(line=31, offs=6) -*/ -ATSINSmove(tmpret5, tmp7) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 712(line=26, offs=49) -- 909(line=32, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret5) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loadb] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 932(line=34, offs=22) -- 1109(line=40, offs=4) -*/ -/* -local: -global: json_dumps$2$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_dumps(atstkind_type(atstype_ptrk) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret11, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp12, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp13) ; -ATStmpdec(tmp14, atstkind_t0ype(atstype_bool)) ; -// ATStmpdec_void(tmp17) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 921(line=34, offs=11) -- 1109(line=40, offs=4) -*/ -ATSINSflab(__patsflab_json_dumps): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 941(line=34, offs=31) -- 1109(line=40, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 957(line=35, offs=12) -- 1003(line=35, offs=58) -*/ -ATSINSmove(tmp12, atscntrb_jansson_json_dumps(ATSPMVrefarg0(arg0), ATSPMVextval(JSON_ENCODE_ANY))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1030(line=36, offs=27) -- 1040(line=36, offs=37) -*/ -ATSINSmove(tmp14, ATSLIB_056_prelude__strptr_isnot_null__3__1(ATSPMVrefarg0(tmp12))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1015(line=36, offs=12) -- 1062(line=36, offs=59) -*/ -ATSINSmove_void(tmp13, atspre_assert_errmsg_bool1(tmp14, ATSPMVstring("json_dump failed."))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1074(line=37, offs=12) -- 1096(line=37, offs=34) -*/ -ATSINSmove_void(tmp17, atscntrb_jansson_json_decref(arg0)) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1102(line=39, offs=2) -- 1105(line=39, offs=5) -*/ -ATSINSmove(tmpret11, tmp12) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 941(line=34, offs=31) -- 1109(line=40, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret11) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_dumps] */ - -#if(0) -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1986(line=72, offs=18) -- 2020(line=72, offs=52) -*/ -/* -local: -global: strptr_isnot_null$3$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = -tmpsub = None() -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__strptr_isnot_null__3(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret15, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats({$PATSPRE}/DATS/strptr.dats): 1969(line=72, offs=1) -- 2020(line=72, offs=52) -*/ -ATSINSflab(__patsflab_strptr_isnot_null): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats({$PATSPRE}/DATS/strptr.dats): 1995(line=72, offs=27) -- 2019(line=72, offs=51) -*/ -ATSINSmove(tmpret15, atspre_gt_ptr1_ptr1(ATSPMVcastfn(strptr2ptr, atstkind_type(atstype_ptrk), ATSPMVrefarg0(arg0)), the_atsptr_null)) ; - -ATSfunbody_end() -ATSreturn(tmpret15) ; -} /* end of [ATSLIB_056_prelude__strptr_isnot_null__3] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1986(line=72, offs=18) -- 2020(line=72, offs=52) -*/ -/* -local: -global: strptr_isnot_null$3$1(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = -tmparg = -tmpsub = Some() -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__strptr_isnot_null__3__1(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret15__1, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats({$PATSPRE}/DATS/strptr.dats): 1969(line=72, offs=1) -- 2020(line=72, offs=52) -*/ -ATSINSflab(__patsflab_strptr_isnot_null): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats({$PATSPRE}/DATS/strptr.dats): 1995(line=72, offs=27) -- 2019(line=72, offs=51) -*/ -ATSINSmove(tmpret15__1, atspre_gt_ptr1_ptr1(ATSPMVcastfn(strptr2ptr, atstkind_type(atstype_ptrk), ATSPMVrefarg0(arg0)), the_atsptr_null)) ; - -ATSfunbody_end() -ATSreturn(tmpret15__1) ; -} /* end of [ATSLIB_056_prelude__strptr_isnot_null__3__1] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 1131(line=42, offs=21) -- 1162(line=42, offs=52) -*/ -/* -local: -global: json_free$5$0(level=0) -local: -global: -*/ -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_free(atstkind_type(atstype_ptrk) arg0) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret18) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1121(line=42, offs=11) -- 1162(line=42, offs=52) -*/ -ATSINSflab(__patsflab_json_free): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1140(line=42, offs=30) -- 1162(line=42, offs=52) -*/ -ATSINSmove_void(tmpret18, atscntrb_jansson_json_decref(arg0)) ; - -ATSfunbody_end() -ATSreturn_void(tmpret18) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_free] */ - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 1190(line=44, offs=27) -- 1335(line=49, offs=4) -*/ -/* -local: -global: to_json$6$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Ecst(string_type) -tmpsub = None() -*/ -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__to_json__6(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret19, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp20, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp21) ; -ATStmpdec(tmp22, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1174(line=44, offs=11) -- 1335(line=49, offs=4) -*/ -ATSINSflab(__patsflab_to_json): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1198(line=44, offs=35) -- 1335(line=49, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1215(line=45, offs=13) -- 1236(line=45, offs=34) -*/ -ATSINSmove(tmp20, atscntrb_jansson_json_string(arg0)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1264(line=46, offs=28) -- 1293(line=46, offs=57) -*/ -ATSINSmove(tmp22, atspre_ptr_isnot_null(ATSPMVrefarg0(tmp20))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1249(line=46, offs=13) -- 1321(line=46, offs=85) -*/ -ATSINSmove_void(tmp21, atspre_assert_errmsg_bool1(tmp22, ATSPMVstring("to_json failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1327(line=48, offs=2) -- 1331(line=48, offs=6) -*/ -ATSINSmove(tmpret19, tmp20) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1198(line=44, offs=35) -- 1335(line=49, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret19) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__to_json__6] */ -#endif // end of [TEMPLATE] - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 1366(line=51, offs=30) -- 1495(line=57, offs=4) -*/ -/* -local: -global: from_json$7$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Eexi(l(4274); S2Eapp(S2Ecst(>); S2Evar(l(4274)), S2Ecst(null)); S2Eapp(S2Ecst(strptr_addr_vtype); S2Evar(l(4274)))) -tmpsub = None() -*/ -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__from_json__7(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret23, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp24, atstkind_type(atstype_ptrk)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1347(line=51, offs=11) -- 1495(line=57, offs=4) -*/ -ATSINSflab(__patsflab_from_json): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1375(line=51, offs=39) -- 1495(line=57, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1396(line=52, offs=17) -- 1424(line=52, offs=45) -*/ -ATSINSmove(tmp24, atscntrb_jansson_json_string_value(ATSPMVrefarg0(arg0))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1436(line=53, offs=12) -- 1442(line=53, offs=18) -*/ -ATSINSmove(tmpret23, PMVtmpltcst(strptr1_copy<>)(ATSPMVrefarg0(tmp24))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/json.dats: 1375(line=51, offs=39) -- 1495(line=57, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret23) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__from_json__7] */ -#endif // end of [TEMPLATE] - -#if(0) -/* -** for initialization(dynloading) -*/ -ATSdynloadflag_minit(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_dats__dynloadflag) ; -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_dats__dynload() -{ -ATSfunbody_beg() -ATSdynload(/*void*/) -ATSdynloadflag_sta( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_dats__dynloadflag -) ; -ATSif( -ATSCKiseqz( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_dats__dynloadflag -) -) ATSthen() { -ATSdynloadset(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_dats__dynloadflag) ; -/* -dynexnlst-initize(beg) -*/ -/* -dynexnlst-initize(end) -*/ -/* local */ -/* in of [local] */ -/* end of [local] */ -} /* ATSendif */ -ATSfunbody_end() -ATSreturn_void(tmpret_void) ; -} /* end of [*_dynload] */ -#endif // end of [#if(0)] - -/* ****** ****** */ - -/* end-of-compilation-unit */ diff --git a/BACKUP/ats/main.dats b/BACKUP/ats/main.dats deleted file mode 100644 index 0456406..0000000 --- a/BACKUP/ats/main.dats +++ /dev/null @@ -1,95 +0,0 @@ -#include "share/atspre_staload.hats" - -%{^ -#include -#include -#include -%} - -staload "./transport.sats" -staload "./json.sats" -staload "./thread.sats" -staload "./uuid.sats" - -staload _ = "./transport.dats" -staload _ = "./json.dats" -staload _ = "./thread.dats" - -staload "libats/libc/SATS/unistd.sats" - -implement main0 () = let - -// val uuid1 = uuid_generate () -// val uuid2 = uuid_copy uuid1 - -// var uuidstr: uuid_string -// val () = uuid_unparse (uuid2, uuidstr) - -// val _ = println! ($UNSAFE.cast{string} uuidstr) -// val uuid3 = uuid_parse uuidstr - -// val _ = println! (uuid_equal (uuid1, uuid3)) - -// val _ = uuid_free uuid1 -// val _ = uuid_free uuid2 -// val _ = uuid_free uuid3 - - - val (tbroker, sock) = trans_nn_broker ("inproc://bus") - - fun t1 (): void = let - val trans = trans_make () - val _ = println! "t1 connecting" - val _ = trans_connect (trans, "inproc://bus") - val _ = sleep 2 - val json = to_json "hello" - val _ = println! "t1 sending" - val _ = trans_send (trans, json) - val _ = println! "t1 sent" - in - trans_term trans - end - - fun t2 (): void = let - val trans = trans_make () - val _ = println! "t2 connecting" - val _ = trans_connect (trans, "inproc://bus") - val _ = println! "t2 receiving" - val json = trans_recv (trans) - val _ = println! "t2 received" - val resp = from_json json - val _ = println! resp - val _ = free resp - val _ = json_free json - val _ = sleep 1 - in - trans_term trans - end - - fun t3 (): void = let - val trans = trans_make () - val _ = trans_connect (trans, "inproc://bus") - - fun echo (json): void = let - val resp = from_json json - val _ = println! resp - val _ = free resp - val _ = json_free json - in - end - - val _ = trans_recv (trans, llam json => echo json) - in - trans_term trans - end - - val tid1 = thread_spawn (llam () => t1 ()) - val _ = sleep 1 - val tid2 = thread_spawn (llam () => t2 ()) - val _ = thread_join tid1 - val _ = thread_join tid2 - - val _ = trans_term sock - val _ = thread_join tbroker -in -end \ No newline at end of file diff --git a/BACKUP/ats/main_dats.c b/BACKUP/ats/main_dats.c deleted file mode 100644 index f86ed90..0000000 --- a/BACKUP/ats/main_dats.c +++ /dev/null @@ -1,623 +0,0 @@ -/* -** -** The C code is generated by [ATS/Postiats-0-3-12] -** The starting compilation time is: 2018-7-12: 16h:37m -** -*/ - -/* -** include runtime header files -*/ -#ifndef _ATS_CCOMP_HEADER_NONE_ -#include "pats_ccomp_config.h" -#include "pats_ccomp_basics.h" -#include "pats_ccomp_typedefs.h" -#include "pats_ccomp_instrset.h" -#include "pats_ccomp_memalloc.h" -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -#include "pats_ccomp_memalloca.h" -#include "pats_ccomp_exception.h" -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -#endif /* _ATS_CCOMP_HEADER_NONE_ */ - - -/* -** include prelude cats files -*/ -#ifndef _ATS_CCOMP_PRELUDE_NONE_ -// -#include "prelude/CATS/basics.cats" -#include "prelude/CATS/integer.cats" -#include "prelude/CATS/pointer.cats" -#include "prelude/CATS/integer_long.cats" -#include "prelude/CATS/integer_size.cats" -#include "prelude/CATS/integer_short.cats" -#include "prelude/CATS/bool.cats" -#include "prelude/CATS/char.cats" -#include "prelude/CATS/float.cats" -#include "prelude/CATS/integer_ptr.cats" -#include "prelude/CATS/integer_fixed.cats" -#include "prelude/CATS/memory.cats" -#include "prelude/CATS/string.cats" -#include "prelude/CATS/strptr.cats" -// -#include "prelude/CATS/fprintf.cats" -// -#include "prelude/CATS/filebas.cats" -// -#include "prelude/CATS/list.cats" -#include "prelude/CATS/option.cats" -#include "prelude/CATS/array.cats" -#include "prelude/CATS/arrayptr.cats" -#include "prelude/CATS/arrayref.cats" -#include "prelude/CATS/matrix.cats" -#include "prelude/CATS/matrixptr.cats" -// -#endif /* _ATS_CCOMP_PRELUDE_NONE_ */ -/* -** for user-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER_ -// -#include _ATS_CCOMP_PRELUDE_USER_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER_ */ -/* -** for user2-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER2_ -// -#include _ATS_CCOMP_PRELUDE_USER2_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER2_ */ - -/* -staload-prologues(beg) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/basics.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats: 1533(line=44, offs=1) -- 1572(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_long.dats: 1602(line=49, offs=1) -- 1641(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_size.dats: 1597(line=49, offs=1) -- 1636(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_short.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/char.dats: 1610(line=48, offs=1) -- 1649(line=48, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/float.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/string.dats: 1631(line=50, offs=1) -- 1670(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1629(line=50, offs=1) -- 1668(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1691(line=54, offs=1) -- 1738(line=54, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_ptr.dats: 1601(line=49, offs=1) -- 1640(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_fixed.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/memory.dats: 1410(line=38, offs=1) -- 1449(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1607(line=49, offs=1) -- 1646(line=50, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1669(line=54, offs=1) -- 1715(line=55, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1738(line=59, offs=1) -- 1783(line=60, offs=38) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1865(line=66, offs=1) -- 1912(line=66, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1390(line=36, offs=1) -- 1440(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/stat.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1756(line=58, offs=1) -- 1805(line=60, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 15937(line=927, offs=1) -- 15974(line=928, offs=30) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1529(line=44, offs=1) -- 1568(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1569(line=46, offs=1) -- 1615(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1538(line=44, offs=1) -- 1577(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1578(line=46, offs=1) -- 1624(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_mergesort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_quicksort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/array.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_bsearch.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_quicksort.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayptr.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayref.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrix.dats: 1535(line=44, offs=1) -- 1574(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixptr.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixref.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream_vt.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/tostring.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/checkast.dats: 1531(line=44, offs=1) -- 1570(line=45, offs=32) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.sats: 1(line=1, offs=1) -- 24(line=1, offs=24) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 92(line=8, offs=1) -- 118(line=8, offs=27) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.sats: 1(line=1, offs=1) -- 24(line=1, offs=24) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 119(line=9, offs=1) -- 140(line=9, offs=22) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 141(line=10, offs=1) -- 164(line=10, offs=24) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 166(line=12, offs=1) -- 205(line=12, offs=40) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 206(line=13, offs=1) -- 231(line=13, offs=26) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 28(line=3, offs=1) -- 49(line=3, offs=22) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 119(line=8, offs=1) -- 193(line=8, offs=75) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 194(line=9, offs=1) -- 268(line=9, offs=75) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1394(line=38, offs=1) -- 1433(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1456(line=43, offs=1) -- 1488(line=43, offs=33) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 269(line=10, offs=1) -- 310(line=10, offs=42) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 232(line=14, offs=1) -- 259(line=14, offs=28) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 57(line=7, offs=1) -- 80(line=7, offs=24) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 28(line=3, offs=1) -- 49(line=3, offs=22) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 119(line=8, offs=1) -- 193(line=8, offs=75) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 194(line=9, offs=1) -- 268(line=9, offs=75) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1394(line=38, offs=1) -- 1433(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1456(line=43, offs=1) -- 1488(line=43, offs=33) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 269(line=10, offs=1) -- 310(line=10, offs=42) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 57(line=7, offs=1) -- 80(line=7, offs=24) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/unistd.sats: 1395(line=36, offs=1) -- 1443(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/unistd.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/unistd.sats: 1803(line=61, offs=1) -- 1852(line=63, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -staload-prologues(end) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/main.dats: 39(line=3, offs=1) -- 124(line=7, offs=3) -*/ -ATSextcode_beg() -#include -#include -#include -ATSextcode_end() -/* -typedefs-for-tyrecs-and-tysums(beg) -*/ -/* -typedefs-for-tyrecs-and-tysums(end) -*/ -/* -dynconlst-declaration(beg) -*/ -/* -dynconlst-declaration(end) -*/ -/* -dyncstlst-declaration(beg) -*/ -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_generate, (), atstkind_type(atstype_ptrk)) ; -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_copy, (atsrefarg0_type(atstkind_type(atstype_ptrk))), atstkind_type(atstype_ptrk)) ; -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_unparse, (atsrefarg0_type(atstkind_type(atstype_ptrk)), atsrefarg1_type(atstyarr_type(atstkind_t0ype(atstype_char)))), atsvoid_t0ype) ; -ATSdyncst_mac(atspre_print_string) -ATSdyncst_mac(atspre_print_newline) -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_parse, (atsrefarg1_type(atstyarr_type(atstkind_t0ype(atstype_char)))), atstkind_type(atstype_ptrk)) ; -ATSdyncst_mac(atspre_print_bool) -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_equal, (atsrefarg0_type(atstkind_type(atstype_ptrk)), atsrefarg0_type(atstkind_type(atstype_ptrk))), atstkind_t0ype(atstype_bool)) ; -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_free, (atstkind_type(atstype_ptrk)), atsvoid_t0ype) ; -/* -dyncstlst-declaration(end) -*/ -/* -dynvalist-implementation(beg) -*/ -/* -dynvalist-implementation(end) -*/ -/* -exnconlst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -ATSextern() -atsvoid_t0ype -the_atsexncon_initize -( - atstype_exnconptr d2c, atstype_string exnmsg -) ; -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -/* -exnconlst-declaration(end) -*/ -/* -extypelst-declaration(beg) -*/ -/* -extypelst-declaration(end) -*/ -/* -assumelst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_ASSUME_CHECK_NONE_ -#endif // #ifndef(_ATS_CCOMP_ASSUME_CHECK_NONE_) -/* -assumelst-declaration(end) -*/ -#if(0) -ATSextern() -atsvoid_t0ype -mainats_void_0() ; -#endif // end of [QUALIFIED] - -/* -/Users/hwwu/Git/ats-sessions/ats/main.dats: 364(line=20, offs=17) -- 1846(line=79, offs=4) -*/ -/* -local: -global: mainats_void_0$0$0(level=0) -local: -global: -*/ -ATSextern() -atsvoid_t0ype -mainats_void_0() -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret0) ; -ATStmpdec(tmp1, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp2, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmpref3[37], atstkind_t0ype(atstype_char)) ; -// ATStmpdec_void(tmp4) ; -// ATStmpdec_void(tmp5) ; -// ATStmpdec_void(tmp6) ; -ATStmpdec(tmp7, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp8) ; -ATStmpdec(tmp9, atstkind_t0ype(atstype_bool)) ; -// ATStmpdec_void(tmp10) ; -// ATStmpdec_void(tmp11) ; -// ATStmpdec_void(tmp12) ; -// ATStmpdec_void(tmp13) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 358(line=20, offs=11) -- 1846(line=79, offs=4) -*/ -ATSINSflab(__patsflab_main_void_0): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 369(line=20, offs=22) -- 1846(line=79, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 388(line=22, offs=14) -- 404(line=22, offs=30) -*/ -ATSINSmove(tmp1, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_generate()) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 418(line=23, offs=14) -- 433(line=23, offs=29) -*/ -ATSINSmove(tmp2, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_copy(ATSPMVrefarg0(tmp1))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 440(line=25, offs=6) -- 447(line=25, offs=13) -*/ -/* -ATSINStmpdec(tmpref3) ; -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 471(line=26, offs=11) -- 500(line=26, offs=40) -*/ -ATSINSmove_void(tmp4, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_unparse(ATSPMVrefarg0(tmp2), ATSPMVrefarg1(ATSPMVptrof(tmpref3[0])))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 511(line=28, offs=10) -- 550(line=28, offs=49) -*/ -ATSINSmove_void(tmp5, atspre_print_string(ATSPMVcastfn(cast, atstkind_type(atstype_ptrk), tmpref3))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 511(line=28, offs=10) -- 550(line=28, offs=49) -*/ -ATSINSmove_void(tmp6, atspre_print_newline()) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 564(line=29, offs=14) -- 582(line=29, offs=32) -*/ -ATSINSmove(tmp7, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_parse(ATSPMVrefarg1(ATSPMVptrof(tmpref3[0])))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 603(line=31, offs=20) -- 628(line=31, offs=45) -*/ -ATSINSmove(tmp9, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_equal(ATSPMVrefarg0(tmp1), ATSPMVrefarg0(tmp7))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 593(line=31, offs=10) -- 629(line=31, offs=46) -*/ -ATSINSmove_void(tmp8, atspre_print_bool(tmp9)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 593(line=31, offs=10) -- 629(line=31, offs=46) -*/ -ATSINSmove_void(tmp10, atspre_print_newline()) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 641(line=34, offs=10) -- 656(line=34, offs=25) -*/ -ATSINSmove_void(tmp11, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_free(tmp1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 667(line=35, offs=10) -- 682(line=35, offs=25) -*/ -ATSINSmove_void(tmp12, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_free(tmp2)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 692(line=36, offs=10) -- 707(line=36, offs=25) -*/ -ATSINSmove_void(tmp13, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_free(tmp7)) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 1839(line=78, offs=1) -- 1846(line=79, offs=4) -*/ -ATSINSmove_void(tmpret0, ATSPMVempty()) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/main.dats: 369(line=20, offs=22) -- 1846(line=79, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn_void(tmpret0) ; -} /* end of [mainats_void_0] */ - -/* -** for initialization(dynloading) -*/ -ATSdynloadflag_minit(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_main_056_dats__dynloadflag) ; -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_main_056_dats__dynload() -{ -ATSfunbody_beg() -ATSdynload(/*void*/) -ATSdynloadflag_sta( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_main_056_dats__dynloadflag -) ; -ATSif( -ATSCKiseqz( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_main_056_dats__dynloadflag -) -) ATSthen() { -ATSdynloadset(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_main_056_dats__dynloadflag) ; -/* -dynexnlst-initize(beg) -*/ -/* -dynexnlst-initize(end) -*/ -} /* ATSendif */ -ATSfunbody_end() -ATSreturn_void(tmpret_void) ; -} /* end of [*_dynload] */ - -/* -** the ATS runtime -*/ -#ifndef _ATS_CCOMP_RUNTIME_NONE_ -#include "pats_ccomp_runtime.c" -#include "pats_ccomp_runtime_memalloc.c" -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -#include "pats_ccomp_runtime2_dats.c" -#ifndef _ATS_CCOMP_RUNTIME_TRYWITH_NONE_ -#include "pats_ccomp_runtime_trywith.c" -#endif /* _ATS_CCOMP_RUNTIME_TRYWITH_NONE_ */ -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -#endif /* _ATS_CCOMP_RUNTIME_NONE_ */ - -/* -** the [main] implementation -*/ -int -main -( -int argc, char **argv, char **envp -) { -int err = 0 ; -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_main_056_dats__dynload() ; -ATSmainats_void_0(err) ; -return (err) ; -} /* end of [main] */ - -/* ****** ****** */ - -/* end-of-compilation-unit */ diff --git a/BACKUP/ats/roles.sats b/BACKUP/ats/roles.sats deleted file mode 100644 index 10d372e..0000000 --- a/BACKUP/ats/roles.sats +++ /dev/null @@ -1,5 +0,0 @@ - - - -abstype roles - diff --git a/BACKUP/ats/test.c b/BACKUP/ats/test.c deleted file mode 100644 index 8200148..0000000 --- a/BACKUP/ats/test.c +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -void work(void* arg) { - nng_aio* aio = *(nng_aio**)arg; - int ret = nng_aio_result(aio); - - if (ret != 0) { - printf("Error: %s\n", nng_strerror(ret)); - return; - } - - nng_msg* msg = nng_aio_get_msg(aio); - printf("Server received: %s\n", nng_msg_body(msg)); - nng_msg_free(msg); - - // this is a defered free - nng_aio_free(aio); -} - - -int server(const char* url) { - - nng_socket sock; - int ret; - - assert(nng_bus0_open(&sock) == 0); - - nng_aio* aio; - assert(nng_aio_alloc(&aio, work, &aio) == 0); - - assert(nng_listen(sock, url, NULL, 0) == 0); - printf("Server connected\n"); - - nng_recv_aio(sock, aio); - nng_aio_wait(aio); - // assert(nng_aio_result(aio) == 0); - // nng_msg* msg = nng_aio_get_msg(aio); - - // printf("Server received: %s", nng_msg_body(msg)); - // nng_msg_free(msg); - - // nng_aio_free(aio); - - // char* msg; - // size_t size; - - // nng_recv(sock, &msg, &size, NNG_FLAG_ALLOC); - // printf("Message received: %s\n", msg); - // free(msg); - - nng_close(sock); - return 0; -} - -int client(const char* url) { - nng_socket sock; - int ret; - - assert(nng_bus0_open(&sock) == 0); - assert(nng_dial(sock, url, NULL, 0) == 0); - printf("Client connected\n"); - - char* data = "hello"; - printf("Client sent: %s\n", data); - nng_send(sock, data, strlen(data), 0); - - nng_msleep(1000); - nng_close(sock); - return 0; -} - -int main(int argc, char** argv) { - assert(argc == 3); - - switch (argv[1][0]) { - case 'c': client(argv[2]); break; - case 's': server(argv[2]); break; - } - - return 0; -} \ No newline at end of file diff --git a/BACKUP/ats/thread.dats b/BACKUP/ats/thread.dats deleted file mode 100644 index 21411e6..0000000 --- a/BACKUP/ats/thread.dats +++ /dev/null @@ -1,55 +0,0 @@ -#define ATS_DYNLOADFLAG 0 - -%{^ -#include -%} - -staload "./thread.sats" - -local - -#include "share/atspre_staload.hats" - -abst@ype pthread_t = $extype "pthread_t" -assume tid = pthread_t - -in - -implement thread_self () = - $extfcall (tid, "pthread_self") - -implement thread_spawn (f) = let - staload UN = "prelude/SATS/unsafe.sats" - - fun apply (f: () - void): ptr = let - val _ = f () - val _ = cloptr_free ($UN.castvwtp0{cloptr0} f) - in - the_null_ptr - end - - extern fun pthread_create (&pthread_t? >> _, - int, - (()- void) -> ptr, - () - void): int = "mac#pthread_create" - var tid: tid - val g = $UN.castvwtp1{cloptr0} f - val ret = pthread_create (tid, 0, apply, f) -in - if ret != 0 - then let - val _ = cloptr_free ($UN.castvwtp0{cloptr0} g) - val _ = assert_errmsg (ret = 0, "thread_spawn_env: failed") - in tid end - else let - val _ = $UN.castvwtp0{void} g - in tid end -end - -implement thread_join (tid) = let - val ret = $extfcall (int, "pthread_join", tid, 0) -in - assert_errmsg (ret = 0, "thread_join failed.") -end - -end \ No newline at end of file diff --git a/BACKUP/ats/thread.sats b/BACKUP/ats/thread.sats deleted file mode 100644 index 88f078d..0000000 --- a/BACKUP/ats/thread.sats +++ /dev/null @@ -1,15 +0,0 @@ - - -abst@ype tid - -fun thread_self (): tid -fun thread_join (tid): void -fun thread_spawn (() - void): tid - -//abstype condvar - -//fun condvar_make (): condvar -//fun condvar_signal (condvar): void -//fun condvar_broadcast (condvar): void -//fun condvar_wait (condvar): void - diff --git a/BACKUP/ats/thread_dats.c b/BACKUP/ats/thread_dats.c deleted file mode 100644 index ed25139..0000000 --- a/BACKUP/ats/thread_dats.c +++ /dev/null @@ -1,887 +0,0 @@ -/* -** -** The C code is generated by [ATS/Postiats-0-3-12] -** The starting compilation time is: 2018-7-12: 16h:37m -** -*/ - -/* -** include runtime header files -*/ -#ifndef _ATS_CCOMP_HEADER_NONE_ -#include "pats_ccomp_config.h" -#include "pats_ccomp_basics.h" -#include "pats_ccomp_typedefs.h" -#include "pats_ccomp_instrset.h" -#include "pats_ccomp_memalloc.h" -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -#include "pats_ccomp_memalloca.h" -#include "pats_ccomp_exception.h" -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -#endif /* _ATS_CCOMP_HEADER_NONE_ */ - - -/* -** include prelude cats files -*/ -#ifndef _ATS_CCOMP_PRELUDE_NONE_ -// -#include "prelude/CATS/basics.cats" -#include "prelude/CATS/integer.cats" -#include "prelude/CATS/pointer.cats" -#include "prelude/CATS/integer_long.cats" -#include "prelude/CATS/integer_size.cats" -#include "prelude/CATS/integer_short.cats" -#include "prelude/CATS/bool.cats" -#include "prelude/CATS/char.cats" -#include "prelude/CATS/float.cats" -#include "prelude/CATS/integer_ptr.cats" -#include "prelude/CATS/integer_fixed.cats" -#include "prelude/CATS/memory.cats" -#include "prelude/CATS/string.cats" -#include "prelude/CATS/strptr.cats" -// -#include "prelude/CATS/fprintf.cats" -// -#include "prelude/CATS/filebas.cats" -// -#include "prelude/CATS/list.cats" -#include "prelude/CATS/option.cats" -#include "prelude/CATS/array.cats" -#include "prelude/CATS/arrayptr.cats" -#include "prelude/CATS/arrayref.cats" -#include "prelude/CATS/matrix.cats" -#include "prelude/CATS/matrixptr.cats" -// -#endif /* _ATS_CCOMP_PRELUDE_NONE_ */ -/* -** for user-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER_ -// -#include _ATS_CCOMP_PRELUDE_USER_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER_ */ -/* -** for user2-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER2_ -// -#include _ATS_CCOMP_PRELUDE_USER2_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER2_ */ - -/* -staload-prologues(beg) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/basics.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats: 1533(line=44, offs=1) -- 1572(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_long.dats: 1602(line=49, offs=1) -- 1641(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_size.dats: 1597(line=49, offs=1) -- 1636(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_short.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/char.dats: 1610(line=48, offs=1) -- 1649(line=48, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/float.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/string.dats: 1631(line=50, offs=1) -- 1670(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1629(line=50, offs=1) -- 1668(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1691(line=54, offs=1) -- 1738(line=54, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_ptr.dats: 1601(line=49, offs=1) -- 1640(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_fixed.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/memory.dats: 1410(line=38, offs=1) -- 1449(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1607(line=49, offs=1) -- 1646(line=50, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1669(line=54, offs=1) -- 1715(line=55, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1738(line=59, offs=1) -- 1783(line=60, offs=38) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1865(line=66, offs=1) -- 1912(line=66, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1390(line=36, offs=1) -- 1440(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/stat.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1756(line=58, offs=1) -- 1805(line=60, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 15937(line=927, offs=1) -- 15974(line=928, offs=30) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1529(line=44, offs=1) -- 1568(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1569(line=46, offs=1) -- 1615(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1538(line=44, offs=1) -- 1577(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1578(line=46, offs=1) -- 1624(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_mergesort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_quicksort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/array.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_bsearch.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_quicksort.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayptr.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayref.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrix.dats: 1535(line=44, offs=1) -- 1574(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixptr.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixref.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream_vt.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/tostring.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/checkast.dats: 1531(line=44, offs=1) -- 1570(line=45, offs=32) -*/ -/* -staload-prologues(end) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 28(line=3, offs=1) -- 55(line=5, offs=3) -*/ -ATSextcode_beg() -#include -ATSextcode_end() -/* -typedefs-for-tyrecs-and-tysums(beg) -*/ -/* -typedefs-for-tyrecs-and-tysums(end) -*/ -/* -dynconlst-declaration(beg) -*/ -/* -dynconlst-declaration(end) -*/ -/* -dyncstlst-declaration(beg) -*/ -ATSdyncst_mac(atspre_cloptr_free) -ATSdyncst_mac(the_atsptr_null) -ATSdyncst_mac(pthread_create) -ATSdyncst_mac(atspre_g0int2int_int_int) -ATSdyncst_mac(atspre_g0int_neq_int) -ATSdyncst_mac(atspre_assert_errmsg_bool0) -ATSdyncst_mac(atspre_g0int_eq_int) -/* -dyncstlst-declaration(end) -*/ -/* -dynvalist-implementation(beg) -*/ -/* -dynvalist-implementation(end) -*/ -/* -exnconlst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -ATSextern() -atsvoid_t0ype -the_atsexncon_initize -( - atstype_exnconptr d2c, atstype_string exnmsg -) ; -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -/* -exnconlst-declaration(end) -*/ -/* -extypelst-declaration(beg) -*/ -/* -extypelst-declaration(end) -*/ -/* -assumelst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_ASSUME_CHECK_NONE_ -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 169(line=14, offs=1) -- 191(line=14, offs=23) -*/ -ATSassume(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__tid) ; -#endif // #ifndef(_ATS_CCOMP_ASSUME_CHECK_NONE_) -/* -assumelst-declaration(end) -*/ -#if(0) -ATSextern() -pthread_t -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_self() ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -pthread_t -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_spawn(atstype_cloptr) ; -#endif // end of [QUALIFIED] - -ATSstatic() -atstkind_type(atstype_ptrk) -apply_2(atstype_cloptr) ; - -#if(0) -#if(0) -ATSextern() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__neq_g0int_int__3(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__neq_g0int_int__3__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; - -#if(0) -#if(0) -ATSextern() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__7(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__7__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; - -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_join(pthread_t) ; -#endif // end of [QUALIFIED] - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__7__2(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; - -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 220(line=18, offs=23) -- 258(line=19, offs=33) -*/ -/* -local: -global: thread_self$0$0(level=0) -local: -global: -*/ -ATSextern() -pthread_t -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_self() -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret0, pthread_t) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 208(line=18, offs=11) -- 258(line=19, offs=33) -*/ -ATSINSflab(__patsflab_thread_self): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 227(line=19, offs=2) -- 258(line=19, offs=33) -*/ -ATSINSmove(tmpret0, ATSextfcall(pthread_self, ())) ; -ATSfunbody_end() -ATSreturn(tmpret0) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_self] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 283(line=21, offs=24) -- 952(line=47, offs=4) -*/ -/* -local: -global: thread_spawn$1$0(level=0) -local: -global: -*/ -ATSextern() -pthread_t -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_spawn(atstype_cloptr arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret1, pthread_t) ; -ATStmpdec(tmpref5, pthread_t) ; -ATStmpdec(tmp6, atstkind_t0ype(atstype_int)) ; -ATStmpdec(tmp7, atstkind_t0ype(atstype_bool)) ; -// ATStmpdec_void(tmp12) ; -// ATStmpdec_void(tmp13) ; -ATStmpdec(tmp14, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 270(line=21, offs=11) -- 952(line=47, offs=4) -*/ -ATSINSflab(__patsflab_thread_spawn): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 289(line=21, offs=30) -- 952(line=47, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 648(line=35, offs=6) -- 651(line=35, offs=9) -*/ -/* -ATSINStmpdec(tmpref5) ; -*/ -/* (*nothing*) */ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 702(line=37, offs=12) -- 735(line=37, offs=45) -*/ -ATSINSmove(tmp6, pthread_create(ATSPMVrefarg1(ATSPMVptrof(tmpref5)), ATSPMVi0nt(0), ATSPMVfunlab(apply_2), arg0)) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 744(line=39, offs=5) -- 752(line=39, offs=13) -*/ -ATSINSmove(tmp7, ATSLIB_056_prelude__neq_g0int_int__3__1(tmp6, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 741(line=39, offs=2) -- 948(line=46, offs=14) -*/ -ATSif( -tmp7 -) ATSthen() { -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 759(line=40, offs=7) -- 890(line=43, offs=14) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 775(line=41, offs=12) -- 813(line=41, offs=50) -*/ -ATSINSmove_void(tmp12, atspre_cloptr_free(ATSPMVcastfn(castvwtp0, atstkind_type(atstype_ptrk), ATSPMVcastfn(castvwtp1, atstkind_type(atstype_ptrk), ATSPMVrefarg0(arg0))))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 840(line=42, offs=27) -- 847(line=42, offs=34) -*/ -ATSINSmove(tmp14, ATSLIB_056_prelude__eq_g0int_int__7__1(tmp6, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 825(line=42, offs=12) -- 876(line=42, offs=63) -*/ -ATSINSmove_void(tmp13, atspre_assert_errmsg_bool0(tmp14, ATSPMVstring("thread_spawn_env: failed"))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 883(line=43, offs=7) -- 886(line=43, offs=10) -*/ -ATSINSmove(tmpret1, tmpref5) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 759(line=40, offs=7) -- 890(line=43, offs=14) -*/ -/* -INSletpop() -*/ -} ATSelse() { -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 897(line=44, offs=7) -- 948(line=46, offs=14) -*/ -/* -letpush(beg) -*/ -/* (*nothing*) */ -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 941(line=46, offs=7) -- 944(line=46, offs=10) -*/ -ATSINSmove(tmpret1, tmpref5) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 897(line=44, offs=7) -- 948(line=46, offs=14) -*/ -/* -INSletpop() -*/ -} /* ATSendif */ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 289(line=21, offs=30) -- 952(line=47, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret1) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_spawn] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 341(line=24, offs=6) -- 474(line=29, offs=5) -*/ -/* -local: -global: apply_2$0(level=1) -local: -global: -*/ -ATSstatic() -atstkind_type(atstype_ptrk) -apply_2(atstype_cloptr arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret2, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp3) ; -// ATStmpdec_void(tmp4) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 341(line=24, offs=6) -- 474(line=29, offs=5) -*/ -ATSINSflab(__patsflab_apply_2): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 381(line=24, offs=46) -- 474(line=29, offs=5) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 396(line=25, offs=11) -- 400(line=25, offs=15) -*/ -ATSINSmove_void(tmp3, ATSfunclo_clo(ATSPMVrefarg0(arg0), (atstype_cloptr), atsvoid_t0ype)(ATSPMVrefarg0(arg0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 411(line=26, offs=11) -- 449(line=26, offs=49) -*/ -ATSINSmove_void(tmp4, atspre_cloptr_free(ATSPMVcastfn(castvwtp0, atstkind_type(atstype_ptrk), arg0))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 457(line=28, offs=3) -- 469(line=28, offs=15) -*/ -ATSINSmove(tmpret2, the_atsptr_null) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 381(line=24, offs=46) -- 474(line=29, offs=5) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret2) ; -} /* end of [apply_2] */ - -#if(0) -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12337(line=639, offs=3) -- 12377(line=639, offs=43) -*/ -/* -local: -global: neq_g0int_int$3$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = tk(4625) -tmparg = S2Evar(tk(4625)) -tmpsub = None() -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__neq_g0int_int__3(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret8, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp9, atstkind_t0ype(atstyvar_type(tk))) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12321(line=638, offs=1) -- 12377(line=639, offs=43) -*/ -ATSINSflab(__patsflab_neq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12364(line=639, offs=30) -- 12375(line=639, offs=41) -*/ -ATSINSmove(tmp9, PMVtmpltcst(g0int2int)(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12346(line=639, offs=12) -- 12377(line=639, offs=43) -*/ -ATSINSmove(tmpret8, PMVtmpltcst(g0int_neq)(arg0, tmp9)) ; - -ATSfunbody_end() -ATSreturn(tmpret8) ; -} /* end of [ATSLIB_056_prelude__neq_g0int_int__3] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12337(line=639, offs=3) -- 12377(line=639, offs=43) -*/ -/* -local: -global: neq_g0int_int$3$1(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = tk(4625) -tmparg = S2Evar(tk(4625)) -tmpsub = Some(tk(4625) -> S2Eextkind(atstype_int)) -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__neq_g0int_int__3__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret8__1, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp9__1, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12321(line=638, offs=1) -- 12377(line=639, offs=43) -*/ -ATSINSflab(__patsflab_neq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12364(line=639, offs=30) -- 12375(line=639, offs=41) -*/ -ATSINSmove(tmp9__1, atspre_g0int2int_int_int(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12346(line=639, offs=12) -- 12377(line=639, offs=43) -*/ -ATSINSmove(tmpret8__1, atspre_g0int_neq_int(arg0, tmp9__1)) ; - -ATSfunbody_end() -ATSreturn(tmpret8__1) ; -} /* end of [ATSLIB_056_prelude__neq_g0int_int__3__1] */ - -#if(0) -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$7$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = tk(4624) -tmparg = S2Evar(tk(4624)) -tmpsub = None() -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__7(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret15, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp16, atstkind_t0ype(atstyvar_type(tk))) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp16, PMVtmpltcst(g0int2int)(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret15, PMVtmpltcst(g0int_eq)(arg0, tmp16)) ; - -ATSfunbody_end() -ATSreturn(tmpret15) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__7] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$7$1(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = tk(4624) -tmparg = S2Evar(tk(4624)) -tmpsub = Some(tk(4624) -> S2Eextkind(atstype_int)) -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__7__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret15__1, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp16__1, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp16__1, atspre_g0int2int_int_int(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret15__1, atspre_g0int_eq_int(arg0, tmp16__1)) ; - -ATSfunbody_end() -ATSreturn(tmpret15__1) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__7__1] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 976(line=49, offs=23) -- 1095(line=53, offs=4) -*/ -/* -local: -global: thread_join$10$0(level=0) -local: -global: -*/ -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_join(pthread_t arg0) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret19) ; -ATStmpdec(tmp20, atstkind_t0ype(atstype_int)) ; -ATStmpdec(tmp21, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 964(line=49, offs=11) -- 1095(line=53, offs=4) -*/ -ATSINSflab(__patsflab_thread_join): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 984(line=49, offs=31) -- 1095(line=53, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 1000(line=50, offs=12) -- 1039(line=50, offs=51) -*/ -ATSINSmove(tmp20, ATSextfcall(pthread_join, (arg0, ATSPMVi0nt(0)))) ; -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 1060(line=52, offs=17) -- 1067(line=52, offs=24) -*/ -ATSINSmove(tmp21, ATSLIB_056_prelude__eq_g0int_int__7__2(tmp20, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 1045(line=52, offs=2) -- 1091(line=52, offs=48) -*/ -ATSINSmove_void(tmpret19, atspre_assert_errmsg_bool0(tmp21, ATSPMVstring("thread_join failed."))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/thread.dats: 984(line=49, offs=31) -- 1095(line=53, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn_void(tmpret19) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_join] */ - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$7$2(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = tk(4624) -tmparg = S2Evar(tk(4624)) -tmpsub = Some(tk(4624) -> S2Eextkind(atstype_int)) -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__7__2(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret15__2, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp16__2, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp16__2, atspre_g0int2int_int_int(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret15__2, atspre_g0int_eq_int(arg0, tmp16__2)) ; - -ATSfunbody_end() -ATSreturn(tmpret15__2) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__7__2] */ - -#if(0) -/* -** for initialization(dynloading) -*/ -ATSdynloadflag_minit(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_dats__dynloadflag) ; -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_dats__dynload() -{ -ATSfunbody_beg() -ATSdynload(/*void*/) -ATSdynloadflag_sta( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_dats__dynloadflag -) ; -ATSif( -ATSCKiseqz( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_dats__dynloadflag -) -) ATSthen() { -ATSdynloadset(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_dats__dynloadflag) ; -/* -dynexnlst-initize(beg) -*/ -/* -dynexnlst-initize(end) -*/ -/* local */ -/* in of [local] */ -/* end of [local] */ -} /* ATSendif */ -ATSfunbody_end() -ATSreturn_void(tmpret_void) ; -} /* end of [*_dynload] */ -#endif // end of [#if(0)] - -/* ****** ****** */ - -/* end-of-compilation-unit */ diff --git a/BACKUP/ats/transport.dats b/BACKUP/ats/transport.dats deleted file mode 100644 index 85ef1b1..0000000 --- a/BACKUP/ats/transport.dats +++ /dev/null @@ -1,145 +0,0 @@ -#define ATS_DYNLOADFLAG 0 - -%{^ -#include -#include -%} - -staload "./transport.sats" -staload "./json.sats" -staload "./thread.sats" - -staload UN = "prelude/SATS/unsafe.sats" -staload _ = "./json.dats" -staload _ = "./thread.dats" - - -local (***********************) - -#include "share/atspre_staload.hats" -typedef nng_socket = $extype "nng_socket" -vtypedef cstring = [l:addr|l>null] strptr l - -extern fun to_nng_socket (t: !transport nn): nng_socket -implement to_nng_socket (t) = !($UN.castvwtp1{ref(nng_socket)} t) - -extern fun from_nng_socket (sock: nng_socket): transport nn -implement from_nng_socket (sock) = $UN.castvwtp0{transport nn} (ref sock) - -in (***********************) - -implement trans_make () = let - var sock: nng_socket - extern fun nng_bus0_open (sock: &nng_socket? >> _): int = "mac#nng_bus0_open" - val ret = nng_bus0_open sock - val _ = assert_errmsg (ret = 0, "trans_make (nanomsg) failed.") -in - from_nng_socket sock -end - -implement trans_term (t) = let - val ret = $extfcall (int, "nng_close", to_nng_socket t) - val _ = assert_errmsg (ret = 0, "trans_close (nanomsg) failed.") -in - $UN.castvwtp0{void} t -end - -implement trans_listen (t, addr) = let - val ret = $extfcall (int, "nng_listen", to_nng_socket t, addr, 0, 0) - val _ = assert_errmsg (ret = 0, "trans_listen (nanomsg) failed.") -in -end - -implement trans_connect (t, addr) = let - val ret = $extfcall (int, "nng_dial", to_nng_socket t, addr, 0, 0) - val _ = assert_errmsg (ret = 0, "trans_connect (nanomsg) failed.") -in -end - -implement trans_send (t, json) = let - val str = json_dumps json - val len = length str - val ret = $extfcall (int, "nng_send", to_nng_socket t, $UN.strptr2string str, len, 0) - val _ = assert_errmsg (ret = 0, "trans_send (nanomsg) failed.") - val _ = free str -in -end - -implement trans_recv_sync (t) = let - - var buffer: ptr - var size: size_t - - extern fun nng_recv (nng_socket, &ptr >> ptr l, &size_t? >> size_t n, int): - #[n:nat] #[l:agz] (@[byte][n] @ l | int) = "mac#nng_recv" - - macdef NNG_FLAG_ALLOC = $extval (int, "NNG_FLAG_ALLOC") - val (pf | ret) = nng_recv (to_nng_socket t, buffer, size, NNG_FLAG_ALLOC) - val _ = assert_errmsg (ret = 0, "trans_recv (nanomsg) failed.") - - val json = json_loadb (pf | buffer, sz2i size) - - extern fun nng_free {n:nat} {l:agz} (@[byte][n] @ l | ptr l, size_t n): void = "mac#nng_free" - val _ = nng_free (pf | buffer, size) - -in - json -end - -implement trans_recv_async (t, cont) = let - typedef nng_aio = $extype "nng_aio" - typedef nng_aio_ref = ref nng_aio - - extern fun nng_aio_result (nng_aio_ref): int = "mac#nng_aio_result" - extern fun nng_aio_alloc (&nng_aio_ref? >> _, (ref nng_aio_ref) - void, ptr): void = "mac#nng_aio_alloc" - extern fun nng_recv_aio (nng_socket, nng_aio_ref): void = "mac#nng_recv_aio" - extern fun nng_aio_free (nng_aio_ref): void = "mac#nng_aio_free" - - fun work (aio: ref nng_aio_ref, cont: json - void): void = let - val aio = !aio - val ret = nng_aio_result aio - val _ = assert_errmsg (ret = 0, "trans_recv_async failed.") - - val msg = $extfcall (ptr, "nng_aio_get_msg", aio) - val str = $extfcall (cstring, "nng_msg_body", msg) - val json = json_loads str - val _ = $extfcall (void, "nng_msg_free", msg) - val _ = $UN.cast2void str - - val _ = cont json - val _ = cloptr_free ($UN.castvwtp0{cloptr0} cont) - in - nng_aio_free aio (* defered free *) - end - - var aio: nng_aio_ref - val _ = nng_aio_alloc (aio, llam aio => work (aio, cont), addr@aio) - val _ = nng_recv_aio (to_nng_socket t, aio) -in -end - -%{ - nng_socket empty = NNG_SOCKET_INITIALIZER; -%} - -implement trans_nn_broker (addr) = let - var sock: nng_socket - - (* open a bus socket *) - extern fun nng_bus0_open_raw (sock: &nng_socket? >> _): int = "mac#nng_bus0_open_raw" - val ret = nng_bus0_open_raw sock - val _ = assert_errmsg (ret = 0, "trans_nn_broker (nanomsg) failed.") - val sock = sock - - (* listen *) - val ret = $extfcall (int, "nng_listen", sock, addr, 0, 0) - val _ = assert_errmsg (ret = 0, "trans_nn_broker (nanomsg) failed.") - - (* make it a device *) - val empty = $extval (nng_socket, "empty") - val tid = thread_spawn (llam () => $extfcall (void, "nng_device", sock, empty)) -in - (tid, from_nng_socket sock) -end - -end (***********************) \ No newline at end of file diff --git a/BACKUP/ats/transport.sats b/BACKUP/ats/transport.sats deleted file mode 100644 index 7ffd00b..0000000 --- a/BACKUP/ats/transport.sats +++ /dev/null @@ -1,21 +0,0 @@ -staload "./thread.sats" - -datasort transport = nn | redis - -absvtype transport (t:transport) = ptr - -fun {t:transport} trans_make (): transport t -fun {t:transport} trans_term (transport t): void - -fun {t:transport} trans_listen (!transport t, string): void -fun {t:transport} trans_connect (!transport t, string): void -//fun {t:transport} trans_disconnect (!transport sublt, string): void - -fun {a:vt@ype} {t:transport} trans_send (!transport t, a): void -fun {a:vt@ype} {t:transport} trans_recv_sync (!transport t): a -fun {a:vt@ype} {t:transport} trans_recv_async (!transport t, a - void): void - -overload trans_recv with trans_recv_sync -overload trans_recv with trans_recv_async - -fun trans_nn_broker (string): (tid, transport nn) \ No newline at end of file diff --git a/BACKUP/ats/transport_dats.c b/BACKUP/ats/transport_dats.c deleted file mode 100644 index 5285c47..0000000 --- a/BACKUP/ats/transport_dats.c +++ /dev/null @@ -1,1585 +0,0 @@ -/* -** -** The C code is generated by [ATS/Postiats-0-3-12] -** The starting compilation time is: 2018-7-12: 16h:37m -** -*/ - -/* -** include runtime header files -*/ -#ifndef _ATS_CCOMP_HEADER_NONE_ -#include "pats_ccomp_config.h" -#include "pats_ccomp_basics.h" -#include "pats_ccomp_typedefs.h" -#include "pats_ccomp_instrset.h" -#include "pats_ccomp_memalloc.h" -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -#include "pats_ccomp_memalloca.h" -#include "pats_ccomp_exception.h" -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -#endif /* _ATS_CCOMP_HEADER_NONE_ */ - - -/* -** include prelude cats files -*/ -#ifndef _ATS_CCOMP_PRELUDE_NONE_ -// -#include "prelude/CATS/basics.cats" -#include "prelude/CATS/integer.cats" -#include "prelude/CATS/pointer.cats" -#include "prelude/CATS/integer_long.cats" -#include "prelude/CATS/integer_size.cats" -#include "prelude/CATS/integer_short.cats" -#include "prelude/CATS/bool.cats" -#include "prelude/CATS/char.cats" -#include "prelude/CATS/float.cats" -#include "prelude/CATS/integer_ptr.cats" -#include "prelude/CATS/integer_fixed.cats" -#include "prelude/CATS/memory.cats" -#include "prelude/CATS/string.cats" -#include "prelude/CATS/strptr.cats" -// -#include "prelude/CATS/fprintf.cats" -// -#include "prelude/CATS/filebas.cats" -// -#include "prelude/CATS/list.cats" -#include "prelude/CATS/option.cats" -#include "prelude/CATS/array.cats" -#include "prelude/CATS/arrayptr.cats" -#include "prelude/CATS/arrayref.cats" -#include "prelude/CATS/matrix.cats" -#include "prelude/CATS/matrixptr.cats" -// -#endif /* _ATS_CCOMP_PRELUDE_NONE_ */ -/* -** for user-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER_ -// -#include _ATS_CCOMP_PRELUDE_USER_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER_ */ -/* -** for user2-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER2_ -// -#include _ATS_CCOMP_PRELUDE_USER2_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER2_ */ - -/* -staload-prologues(beg) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.sats: 1(line=1, offs=1) -- 24(line=1, offs=24) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 28(line=3, offs=1) -- 49(line=3, offs=22) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 119(line=8, offs=1) -- 193(line=8, offs=75) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 194(line=9, offs=1) -- 268(line=9, offs=75) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1394(line=38, offs=1) -- 1433(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/DATS/jansson.dats: 1456(line=43, offs=1) -- 1488(line=43, offs=33) -*/ -/* -/Users/hwwu/Programs/atsgit/contrib/atscntrb/atscntrb-hx-libjansson/SATS/jansson.sats: 991(line=28, offs=1) -- 1057(line=33, offs=3) -*/ - -// -#include \ -"atscntrb-hx-libjansson/CATS/jansson.cats" -// -/* -/Users/hwwu/Git/ats-sessions/ats/json.dats: 269(line=10, offs=1) -- 310(line=10, offs=42) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/thread.dats: 57(line=7, offs=1) -- 80(line=7, offs=24) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/basics.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats: 1533(line=44, offs=1) -- 1572(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_long.dats: 1602(line=49, offs=1) -- 1641(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_size.dats: 1597(line=49, offs=1) -- 1636(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_short.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/char.dats: 1610(line=48, offs=1) -- 1649(line=48, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/float.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/string.dats: 1631(line=50, offs=1) -- 1670(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1629(line=50, offs=1) -- 1668(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1691(line=54, offs=1) -- 1738(line=54, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_ptr.dats: 1601(line=49, offs=1) -- 1640(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_fixed.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/memory.dats: 1410(line=38, offs=1) -- 1449(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1607(line=49, offs=1) -- 1646(line=50, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1669(line=54, offs=1) -- 1715(line=55, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1738(line=59, offs=1) -- 1783(line=60, offs=38) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1865(line=66, offs=1) -- 1912(line=66, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1390(line=36, offs=1) -- 1440(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/stat.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1756(line=58, offs=1) -- 1805(line=60, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 15937(line=927, offs=1) -- 15974(line=928, offs=30) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1529(line=44, offs=1) -- 1568(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1569(line=46, offs=1) -- 1615(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1538(line=44, offs=1) -- 1577(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1578(line=46, offs=1) -- 1624(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_mergesort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_quicksort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/array.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_bsearch.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_quicksort.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayptr.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayref.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrix.dats: 1535(line=44, offs=1) -- 1574(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixptr.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixref.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream_vt.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/tostring.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/checkast.dats: 1531(line=44, offs=1) -- 1570(line=45, offs=32) -*/ -/* -staload-prologues(end) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 28(line=3, offs=1) -- 90(line=6, offs=3) -*/ -ATSextcode_beg() -#include -#include -ATSextcode_end() -/* -typedefs-for-tyrecs-and-tysums(beg) -*/ -typedef -ATSstruct { -pthread_t atslab__0 ; -atstkind_type(atstype_ptrk) atslab__1 ; -} postiats_tyrec_0 ; -/* -typedefs-for-tyrecs-and-tysums(end) -*/ -/* -dynconlst-declaration(beg) -*/ -/* -dynconlst-declaration(end) -*/ -/* -dyncstlst-declaration(beg) -*/ -ATSdyncst_mac(atspre_ptr_alloc_tsz) -ATSdyncst_mac(nng_bus0_open) -ATSdyncst_mac(atspre_assert_errmsg_bool0) -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__from_nng_socket, (nng_socket), atstkind_type(atstype_ptrk)) ; -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket, (atsrefarg0_type(atstkind_type(atstype_ptrk))), nng_socket) ; -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_dumps, (atstkind_type(atstype_ptrk)), atstkind_type(atstype_ptrk)) ; -ATSdyncst_mac(atspre_strptr_free) -ATSdyncst_mac(nng_recv) -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loadb, (atstkind_type(atstype_ptrk), atstkind_t0ype(atstype_int)), atstkind_type(atstype_ptrk)) ; -ATSdyncst_mac(atspre_g1uint2int_size_int) -ATSdyncst_mac(nng_free) -ATSdyncst_mac(nng_bus0_open_raw) -ATSdyncst_mac(atspre_g0int2int_int_int) -ATSdyncst_mac(atspre_g0int_eq_int) -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_spawn, (atstype_cloptr), pthread_t) ; -/* -dyncstlst-declaration(end) -*/ -/* -dynvalist-implementation(beg) -*/ -/* -dynvalist-implementation(end) -*/ -/* -exnconlst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -ATSextern() -atsvoid_t0ype -the_atsexncon_initize -( - atstype_exnconptr d2c, atstype_string exnmsg -) ; -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -/* -exnconlst-declaration(end) -*/ -/* -extypelst-declaration(beg) -*/ -/* -extypelst-declaration(end) -*/ -/* -assumelst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_ASSUME_CHECK_NONE_ -#endif // #ifndef(_ATS_CCOMP_ASSUME_CHECK_NONE_) -/* -assumelst-declaration(end) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 2471(line=89, offs=1) -- 2520(line=91, offs=3) -*/ -ATSextcode_beg() - nng_socket empty = NNG_SOCKET_INITIALIZER; -ATSextcode_end() -#if(0) -ATSextern() -nng_socket -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__from_nng_socket(nng_socket) ; -#endif // end of [QUALIFIED] - -#if(0) -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ref_make_elt__3(atstyvar_type(a)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -ATSstatic() -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ref_make_elt__3__1(nng_socket) ; - -#if(0) -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ptr_alloc__5() ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -ATSstatic() -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ptr_alloc__5__1() ; - -#if(0) -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_make__7() ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -#if(0) -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_term__8(atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -#if(0) -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_listen__9(atsrefarg0_type(atstkind_type(atstype_ptrk)), atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -#if(0) -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_connect__10(atsrefarg0_type(atstkind_type(atstype_ptrk)), atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -#if(0) -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_send__11(atsrefarg0_type(atstkind_type(atstype_ptrk)), atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -#if(0) -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_recv__12(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -#if(0) -ATSextern() -postiats_tyrec_0 -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_nn_broker(atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] - -#if(0) -#if(0) -ATSextern() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__14(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__14__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__14__2(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; - -ATSstatic() -atsvoid_t0ype -__patsfun_19(nng_socket, nng_socket) ; - -ATSclosurerize_beg(__patsfun_19, (nng_socket, nng_socket), (), atsvoid_t0ype) -typedef -ATSstruct { -atstype_funptr cfun ; -nng_socket env0 ; -nng_socket env1 ; -} __patsfun_19__closure_t0ype ; -ATSstatic() -atsvoid_t0ype -__patsfun_19__cfun -( -__patsfun_19__closure_t0ype *p_cenv -) -{ -ATSFCreturn_void(__patsfun_19(p_cenv->env0, p_cenv->env1)) ; -} /* end of [cfun] */ -ATSstatic() -atstype_cloptr -__patsfun_19__closureinit -( -__patsfun_19__closure_t0ype *p_cenv, nng_socket env0, nng_socket env1 -) -{ -p_cenv->env0 = env0 ; -p_cenv->env1 = env1 ; -p_cenv->cfun = __patsfun_19__cfun ; -return p_cenv ; -} /* end of [closureinit] */ -ATSstatic() -atstype_cloptr -__patsfun_19__closurerize -( -nng_socket env0, nng_socket env1 -) -{ -return __patsfun_19__closureinit(ATS_MALLOC(sizeof(__patsfun_19__closure_t0ype)), env0, env1) ; -} /* end of [closurerize] */ -ATSclosurerize_end() -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 501(line=24, offs=25) -- 542(line=24, offs=66) -*/ -/* -local: -global: to_nng_socket$0$0(level=0) -local: -global: -*/ -ATSextern() -nng_socket -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret0, nng_socket) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 487(line=24, offs=11) -- 542(line=24, offs=66) -*/ -ATSINSflab(__patsflab_to_nng_socket): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 507(line=24, offs=31) -- 542(line=24, offs=66) -*/ -ATSINSmove(tmpret0, ATSderef(ATSPMVcastfn(castvwtp1, atstkind_type(atstype_ptrk), ATSPMVrefarg0(arg0)), nng_socket)) ; -ATSfunbody_end() -ATSreturn(tmpret0) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 631(line=27, offs=27) -- 690(line=27, offs=86) -*/ -/* -local: -global: from_nng_socket$1$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__from_nng_socket(nng_socket arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret1, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp2, atstkind_type(atstype_ptrk)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 615(line=27, offs=11) -- 690(line=27, offs=86) -*/ -ATSINSflab(__patsflab_from_nng_socket): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 669(line=27, offs=65) -- 689(line=27, offs=85) -*/ -ATSINSmove(tmp2, ATSLIB_056_prelude__ref_make_elt__3__1(arg0)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 640(line=27, offs=36) -- 690(line=27, offs=86) -*/ -ATSINSmove(tmpret1, ATSPMVcastfn(castvwtp0, atstkind_type(atstype_ptrk), tmp2)) ; -ATSfunbody_end() -ATSreturn(tmpret1) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__from_nng_socket] */ - -#if(0) -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats: 1613(line=51, offs=3) -- 1748(line=60, offs=4) -*/ -/* -local: -global: ref_make_elt$3$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = a(5435) -tmparg = S2Evar(a(5435)) -tmpsub = None() -*/ -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ref_make_elt__3(atstyvar_type(a) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret3, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp4, atstkind_type(atstype_ptrk)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1598(line=50, offs=1) -- 1748(line=60, offs=4) -*/ -ATSINSflab(__patsflab_ref_make_elt): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1620(line=51, offs=10) -- 1748(line=60, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1647(line=54, offs=17) -- 1661(line=54, offs=31) -*/ -ATSINSmove(tmp4, PMVtmpltcst(ptr_alloc)()) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1703(line=58, offs=3) -- 1711(line=58, offs=11) -*/ -ATSINSstore(ATSderef(tmp4, atstyvar_type(a)), arg0) ; -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1715(line=59, offs=3) -- 1744(line=59, offs=32) -*/ -ATSINSmove(tmpret3, ATSPMVcastfn(ref_make_viewptr, atstkind_type(atstype_ptrk), tmp4)) ; -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1620(line=51, offs=10) -- 1748(line=60, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret3) ; -} /* end of [ATSLIB_056_prelude__ref_make_elt__3] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats: 1613(line=51, offs=3) -- 1748(line=60, offs=4) -*/ -/* -local: -global: ref_make_elt$3$1(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = a(5435) -tmparg = S2Evar(a(5435)) -tmpsub = Some(a(5435) -> S2Eextype(nng_socket)) -*/ -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ref_make_elt__3__1(nng_socket arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret3__1, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp4__1, atstkind_type(atstype_ptrk)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1598(line=50, offs=1) -- 1748(line=60, offs=4) -*/ -ATSINSflab(__patsflab_ref_make_elt): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1620(line=51, offs=10) -- 1748(line=60, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1647(line=54, offs=17) -- 1661(line=54, offs=31) -*/ -ATSINSmove(tmp4__1, ATSLIB_056_prelude__ptr_alloc__5__1()) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1703(line=58, offs=3) -- 1711(line=58, offs=11) -*/ -ATSINSstore(ATSderef(tmp4__1, nng_socket), arg0) ; -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1715(line=59, offs=3) -- 1744(line=59, offs=32) -*/ -ATSINSmove(tmpret3__1, ATSPMVcastfn(ref_make_viewptr, atstkind_type(atstype_ptrk), tmp4__1)) ; -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/reference.dats({$PATSPRE}/DATS/reference.dats): 1620(line=51, offs=10) -- 1748(line=60, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret3__1) ; -} /* end of [ATSLIB_056_prelude__ref_make_elt__3__1] */ - -#if(0) -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats: 3717(line=184, offs=10) -- 3749(line=184, offs=42) -*/ -/* -local: -global: ptr_alloc$5$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = a(4750) -tmparg = S2Evar(a(4750)) -tmpsub = None() -*/ -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ptr_alloc__5() -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret7, atstkind_type(atstype_ptrk)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats({$PATSPRE}/DATS/pointer.dats): 3708(line=184, offs=1) -- 3749(line=184, offs=42) -*/ -ATSINSflab(__patsflab_ptr_alloc): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats({$PATSPRE}/DATS/pointer.dats): 3722(line=184, offs=15) -- 3749(line=184, offs=42) -*/ -ATSINSmove(tmpret7, atspre_ptr_alloc_tsz(ATSPMVsizeof(atstyvar_type(a)))) ; - -ATSfunbody_end() -ATSreturn(tmpret7) ; -} /* end of [ATSLIB_056_prelude__ptr_alloc__5] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats: 3717(line=184, offs=10) -- 3749(line=184, offs=42) -*/ -/* -local: -global: ptr_alloc$5$1(level=2) -local: -global: -*/ -ATSstatic() -/* -imparg = a(4750) -tmparg = S2Evar(a(4750)) -tmpsub = Some(a(4750) -> S2Eextype(nng_socket)) -*/ -atstkind_type(atstype_ptrk) -ATSLIB_056_prelude__ptr_alloc__5__1() -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret7__1, atstkind_type(atstype_ptrk)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats({$PATSPRE}/DATS/pointer.dats): 3708(line=184, offs=1) -- 3749(line=184, offs=42) -*/ -ATSINSflab(__patsflab_ptr_alloc): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats({$PATSPRE}/DATS/pointer.dats): 3722(line=184, offs=15) -- 3749(line=184, offs=42) -*/ -ATSINSmove(tmpret7__1, atspre_ptr_alloc_tsz(ATSPMVsizeof(nng_socket))) ; - -ATSfunbody_end() -ATSreturn(tmpret7__1) ; -} /* end of [ATSLIB_056_prelude__ptr_alloc__5__1] */ - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 750(line=31, offs=26) -- 987(line=38, offs=4) -*/ -/* -local: -global: trans_make$7$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Eapp(S2Ecst(nn); ) -tmpsub = None() -*/ -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_make__7() -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret9, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmpref10, nng_socket) ; -ATStmpdec(tmp11, atstkind_t0ype(atstype_int)) ; -// ATStmpdec_void(tmp12) ; -ATStmpdec(tmp13, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 735(line=31, offs=11) -- 987(line=38, offs=4) -*/ -ATSINSflab(__patsflab_trans_make): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 755(line=31, offs=31) -- 987(line=38, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 765(line=32, offs=6) -- 769(line=32, offs=10) -*/ -/* -ATSINStmpdec(tmpref10) ; -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 872(line=34, offs=12) -- 890(line=34, offs=30) -*/ -ATSINSmove(tmp11, nng_bus0_open(ATSPMVrefarg1(ATSPMVptrof(tmpref10)))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 917(line=35, offs=27) -- 924(line=35, offs=34) -*/ -ATSINSmove(tmp13, PMVtmpltcst(eq_g0int_int)(tmp11, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 902(line=35, offs=12) -- 957(line=35, offs=67) -*/ -ATSINSmove_void(tmp12, atspre_assert_errmsg_bool0(tmp13, ATSPMVstring("trans_make (nanomsg) failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 963(line=37, offs=2) -- 983(line=37, offs=22) -*/ -ATSINSmove(tmpret9, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__from_nng_socket(tmpref10)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 755(line=31, offs=31) -- 987(line=38, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret9) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_make__7] */ -#endif // end of [TEMPLATE] - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 1014(line=40, offs=26) -- 1180(line=45, offs=4) -*/ -/* -local: -global: trans_term$8$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Eapp(S2Ecst(nn); ) -tmpsub = None() -*/ -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_term__8(atstkind_type(atstype_ptrk) arg0) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret14) ; -ATStmpdec(tmp15, atstkind_t0ype(atstype_int)) ; -ATStmpdec(tmp16, nng_socket) ; -// ATStmpdec_void(tmp17) ; -ATStmpdec(tmp18, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 999(line=40, offs=11) -- 1180(line=45, offs=4) -*/ -ATSINSflab(__patsflab_trans_term): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1020(line=40, offs=32) -- 1180(line=45, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1065(line=41, offs=41) -- 1080(line=41, offs=56) -*/ -ATSINSmove(tmp16, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket(ATSPMVrefarg0(arg0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1036(line=41, offs=12) -- 1081(line=41, offs=57) -*/ -ATSINSmove(tmp15, ATSextfcall(nng_close, (tmp16))) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1108(line=42, offs=27) -- 1115(line=42, offs=34) -*/ -ATSINSmove(tmp18, PMVtmpltcst(eq_g0int_int)(tmp15, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1093(line=42, offs=12) -- 1149(line=42, offs=68) -*/ -ATSINSmove_void(tmp17, atspre_assert_errmsg_bool0(tmp18, ATSPMVstring("trans_close (nanomsg) failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1155(line=44, offs=2) -- 1176(line=44, offs=23) -*/ -ATSINSmove_void(tmpret14, ATSPMVcastfn(castvwtp0, atsvoid_t0ype, arg0)) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1020(line=40, offs=32) -- 1180(line=45, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn_void(tmpret14) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_term__8] */ -#endif // end of [TEMPLATE] - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 1209(line=47, offs=28) -- 1372(line=51, offs=4) -*/ -/* -local: -global: trans_listen$9$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Eapp(S2Ecst(nn); ) -tmpsub = None() -*/ -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_listen__9(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0, atstkind_type(atstype_ptrk) arg1) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret19) ; -ATStmpdec(tmp20, atstkind_t0ype(atstype_int)) ; -ATStmpdec(tmp21, nng_socket) ; -// ATStmpdec_void(tmp22) ; -ATStmpdec(tmp23, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1192(line=47, offs=11) -- 1372(line=51, offs=4) -*/ -ATSINSflab(__patsflab_trans_listen): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1221(line=47, offs=40) -- 1372(line=51, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1267(line=48, offs=42) -- 1282(line=48, offs=57) -*/ -ATSINSmove(tmp21, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket(ATSPMVrefarg0(arg0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1237(line=48, offs=12) -- 1295(line=48, offs=70) -*/ -ATSINSmove(tmp20, ATSextfcall(nng_listen, (tmp21, arg1, ATSPMVi0nt(0), ATSPMVi0nt(0)))) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1322(line=49, offs=27) -- 1329(line=49, offs=34) -*/ -ATSINSmove(tmp23, PMVtmpltcst(eq_g0int_int)(tmp20, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1307(line=49, offs=12) -- 1364(line=49, offs=69) -*/ -ATSINSmove_void(tmp22, atspre_assert_errmsg_bool0(tmp23, ATSPMVstring("trans_listen (nanomsg) failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1365(line=50, offs=1) -- 1372(line=51, offs=4) -*/ -ATSINSmove_void(tmpret19, ATSPMVempty()) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1221(line=47, offs=40) -- 1372(line=51, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn_void(tmpret19) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_listen__9] */ -#endif // end of [TEMPLATE] - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 1402(line=53, offs=29) -- 1564(line=57, offs=4) -*/ -/* -local: -global: trans_connect$10$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Eapp(S2Ecst(nn); ) -tmpsub = None() -*/ -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_connect__10(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0, atstkind_type(atstype_ptrk) arg1) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret24) ; -ATStmpdec(tmp25, atstkind_t0ype(atstype_int)) ; -ATStmpdec(tmp26, nng_socket) ; -// ATStmpdec_void(tmp27) ; -ATStmpdec(tmp28, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1384(line=53, offs=11) -- 1564(line=57, offs=4) -*/ -ATSINSflab(__patsflab_trans_connect): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1414(line=53, offs=41) -- 1564(line=57, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1458(line=54, offs=40) -- 1473(line=54, offs=55) -*/ -ATSINSmove(tmp26, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket(ATSPMVrefarg0(arg0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1430(line=54, offs=12) -- 1486(line=54, offs=68) -*/ -ATSINSmove(tmp25, ATSextfcall(nng_dial, (tmp26, arg1, ATSPMVi0nt(0), ATSPMVi0nt(0)))) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1513(line=55, offs=27) -- 1520(line=55, offs=34) -*/ -ATSINSmove(tmp28, PMVtmpltcst(eq_g0int_int)(tmp25, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1498(line=55, offs=12) -- 1556(line=55, offs=70) -*/ -ATSINSmove_void(tmp27, atspre_assert_errmsg_bool0(tmp28, ATSPMVstring("trans_connect (nanomsg) failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1557(line=56, offs=1) -- 1564(line=57, offs=4) -*/ -ATSINSmove_void(tmpret24, ATSPMVempty()) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1414(line=53, offs=41) -- 1564(line=57, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn_void(tmpret24) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_connect__10] */ -#endif // end of [TEMPLATE] - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 1597(line=59, offs=32) -- 1844(line=66, offs=4) -*/ -/* -local: -global: trans_send$11$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Ecst(json); S2Eapp(S2Ecst(nn); ) -tmpsub = None() -*/ -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_send__11(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0, atstkind_type(atstype_ptrk) arg1) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret29) ; -ATStmpdec(tmp30, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp31, atstkind_t0ype(atstype_ssize)) ; -ATStmpdec(tmp32, atstkind_t0ype(atstype_int)) ; -ATStmpdec(tmp33, nng_socket) ; -// ATStmpdec_void(tmp34) ; -ATStmpdec(tmp35, atstkind_t0ype(atstype_bool)) ; -// ATStmpdec_void(tmp36) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1576(line=59, offs=11) -- 1844(line=66, offs=4) -*/ -ATSINSflab(__patsflab_trans_send): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1609(line=59, offs=44) -- 1844(line=66, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1625(line=60, offs=12) -- 1640(line=60, offs=27) -*/ -ATSINSmove(tmp30, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_dumps(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1652(line=61, offs=12) -- 1662(line=61, offs=22) -*/ -ATSINSmove(tmp31, PMVtmpltcst(strptr_length<>)(ATSPMVrefarg0(tmp30))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1702(line=62, offs=40) -- 1717(line=62, offs=55) -*/ -ATSINSmove(tmp33, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket(ATSPMVrefarg0(arg0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1674(line=62, offs=12) -- 1749(line=62, offs=87) -*/ -ATSINSmove(tmp32, ATSextfcall(nng_send, (tmp33, ATSPMVcastfn(strptr2string, atstkind_type(atstype_ptrk), ATSPMVrefarg0(tmp30)), tmp31, ATSPMVi0nt(0)))) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1776(line=63, offs=27) -- 1783(line=63, offs=34) -*/ -ATSINSmove(tmp35, PMVtmpltcst(eq_g0int_int)(tmp32, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1761(line=63, offs=12) -- 1816(line=63, offs=67) -*/ -ATSINSmove_void(tmp34, atspre_assert_errmsg_bool0(tmp35, ATSPMVstring("trans_send (nanomsg) failed."))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1828(line=64, offs=12) -- 1836(line=64, offs=20) -*/ -ATSINSmove_void(tmp36, atspre_strptr_free(tmp30)) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1837(line=65, offs=1) -- 1844(line=66, offs=4) -*/ -ATSINSmove_void(tmpret29, ATSPMVempty()) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1609(line=59, offs=44) -- 1844(line=66, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn_void(tmpret29) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_send__11] */ -#endif // end of [TEMPLATE] - -#if(0) -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 1877(line=68, offs=32) -- 2469(line=87, offs=4) -*/ -/* -local: -global: trans_recv$12$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = -tmparg = S2Ecst(json); S2Eapp(S2Ecst(nn); ) -tmpsub = None() -*/ -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_recv__12(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret37, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmpref38, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmpref39, atstkind_t0ype(atstype_size)) ; -ATStmpdec(tmp40, atstkind_t0ype(atstype_int)) ; -ATStmpdec(tmp41, nng_socket) ; -// ATStmpdec_void(tmp42) ; -ATStmpdec(tmp43, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp44, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp45, atstkind_t0ype(atstype_int)) ; -// ATStmpdec_void(tmp46) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1856(line=68, offs=11) -- 2469(line=87, offs=4) -*/ -ATSINSflab(__patsflab_trans_recv): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1883(line=68, offs=38) -- 2469(line=87, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1894(line=70, offs=6) -- 1900(line=70, offs=12) -*/ -/* -ATSINStmpdec(tmpref38) ; -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1911(line=71, offs=6) -- 1915(line=71, offs=10) -*/ -/* -ATSINStmpdec(tmpref39) ; -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2155(line=77, offs=29) -- 2170(line=77, offs=44) -*/ -ATSINSmove(tmp41, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__to_nng_socket(ATSPMVrefarg0(arg0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2145(line=77, offs=19) -- 2201(line=77, offs=75) -*/ -ATSINSmove(tmp40, nng_recv(tmp41, ATSPMVrefarg1(ATSPMVptrof(tmpref38)), ATSPMVrefarg1(ATSPMVptrof(tmpref39)), ATSPMVextval(NNG_FLAG_ALLOC))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2228(line=78, offs=27) -- 2235(line=78, offs=34) -*/ -ATSINSmove(tmp43, PMVtmpltcst(eq_g0int_int)(tmp40, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2213(line=78, offs=12) -- 2268(line=78, offs=67) -*/ -ATSINSmove_void(tmp42, atspre_assert_errmsg_bool0(tmp43, ATSPMVstring("trans_recv (nanomsg) failed."))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2308(line=80, offs=38) -- 2317(line=80, offs=47) -*/ -ATSINSmove(tmp45, atspre_g1uint2int_size_int(tmpref39)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2283(line=80, offs=13) -- 2318(line=80, offs=48) -*/ -ATSINSmove(tmp44, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_json_056_sats__json_loadb(tmpref38, tmp45)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2424(line=83, offs=10) -- 2452(line=83, offs=38) -*/ -ATSINSmove_void(tmp46, nng_free(tmpref38, tmpref39)) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2461(line=86, offs=2) -- 2465(line=86, offs=6) -*/ -ATSINSmove(tmpret37, tmp44) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 1883(line=68, offs=38) -- 2469(line=87, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret37) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_recv__12] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 2548(line=93, offs=27) -- 3151(line=111, offs=4) -*/ -/* -local: -global: trans_nn_broker$13$0(level=0) -local: -global: -*/ -ATSextern() -postiats_tyrec_0 -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_nn_broker(atstkind_type(atstype_ptrk) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret47, postiats_tyrec_0) ; -ATStmpdec(tmpref48, nng_socket) ; -ATStmpdec(tmp49, atstkind_t0ype(atstype_int)) ; -// ATStmpdec_void(tmp50) ; -ATStmpdec(tmp51, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp56, nng_socket) ; -ATStmpdec(tmp57, atstkind_t0ype(atstype_int)) ; -// ATStmpdec_void(tmp58) ; -ATStmpdec(tmp59, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp62, pthread_t) ; -ATStmpdec(tmp64, atstkind_type(atstype_ptrk)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2532(line=93, offs=11) -- 3151(line=111, offs=4) -*/ -ATSINSflab(__patsflab_trans_nn_broker): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2557(line=93, offs=36) -- 3151(line=111, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2567(line=94, offs=6) -- 2571(line=94, offs=10) -*/ -/* -ATSINStmpdec(tmpref48) ; -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2708(line=98, offs=12) -- 2730(line=98, offs=34) -*/ -ATSINSmove(tmp49, nng_bus0_open_raw(ATSPMVrefarg1(ATSPMVptrof(tmpref48)))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2757(line=99, offs=27) -- 2764(line=99, offs=34) -*/ -ATSINSmove(tmp51, ATSLIB_056_prelude__eq_g0int_int__14__1(tmp49, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2742(line=99, offs=12) -- 2802(line=99, offs=72) -*/ -ATSINSmove_void(tmp50, atspre_assert_errmsg_bool0(tmp51, ATSPMVstring("trans_nn_broker (nanomsg) failed."))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2815(line=100, offs=13) -- 2819(line=100, offs=17) -*/ -ATSINSmove(tmp56, tmpref48) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2846(line=103, offs=12) -- 2893(line=103, offs=59) -*/ -ATSINSmove(tmp57, ATSextfcall(nng_listen, (tmp56, arg0, ATSPMVi0nt(0), ATSPMVi0nt(0)))) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2920(line=104, offs=27) -- 2927(line=104, offs=34) -*/ -ATSINSmove(tmp59, ATSLIB_056_prelude__eq_g0int_int__14__2(tmp57, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2905(line=104, offs=12) -- 2965(line=104, offs=72) -*/ -ATSINSmove_void(tmp58, atspre_assert_errmsg_bool0(tmp59, ATSPMVstring("trans_nn_broker (nanomsg) failed."))) ; - -/* (*nothing*) */ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 3045(line=108, offs=12) -- 3114(line=108, offs=81) -*/ -ATSINSmove(tmp62, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_thread_056_sats__thread_spawn(ATSPMVcfunlab(1, __patsfun_19, (tmp56, ATSPMVextval(empty))))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 3126(line=110, offs=8) -- 3146(line=110, offs=28) -*/ -ATSINSmove(tmp64, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__from_nng_socket(tmp56)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 3120(line=110, offs=2) -- 3147(line=110, offs=29) -*/ -ATSINSmove_fltrec_beg() -ATSINSstore_fltrec_ofs(tmpret47, postiats_tyrec_0, atslab__0, tmp62) ; -ATSINSstore_fltrec_ofs(tmpret47, postiats_tyrec_0, atslab__1, tmp64) ; -ATSINSmove_fltrec_end() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 2557(line=93, offs=36) -- 3151(line=111, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret47) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_sats__trans_nn_broker] */ - -#if(0) -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$14$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = tk(4638) -tmparg = S2Evar(tk(4638)) -tmpsub = None() -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__14(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret52, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp53, atstkind_t0ype(atstyvar_type(tk))) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp53, PMVtmpltcst(g0int2int)(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret52, PMVtmpltcst(g0int_eq)(arg0, tmp53)) ; - -ATSfunbody_end() -ATSreturn(tmpret52) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__14] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$14$1(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = tk(4638) -tmparg = S2Evar(tk(4638)) -tmpsub = Some(tk(4638) -> S2Eextkind(atstype_int)) -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__14__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret52__1, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp53__1, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp53__1, atspre_g0int2int_int_int(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret52__1, atspre_g0int_eq_int(arg0, tmp53__1)) ; - -ATSfunbody_end() -ATSreturn(tmpret52__1) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__14__1] */ - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$14$2(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = tk(4638) -tmparg = S2Evar(tk(4638)) -tmpsub = Some(tk(4638) -> S2Eextkind(atstype_int)) -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__14__2(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret52__2, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp53__2, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp53__2, atspre_g0int2int_int_int(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret52__2, atspre_g0int_eq_int(arg0, tmp53__2)) ; - -ATSfunbody_end() -ATSreturn(tmpret52__2) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__14__2] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/transport.dats: 3059(line=108, offs=26) -- 3113(line=108, offs=80) -*/ -/* -local: -global: __patsfun_19$0(level=1) -local: sock$4771(1)(HSEs2exp(S2Eextype(nng_socket))), empty$4773(1)(HSEs2exp(S2Eextype(nng_socket))) -global: sock$4771(1)(HSEs2exp(S2Eextype(nng_socket))), empty$4773(1)(HSEs2exp(S2Eextype(nng_socket))) -*/ -ATSstatic() -atsvoid_t0ype -__patsfun_19(nng_socket env0, nng_socket env1) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret63) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 3059(line=108, offs=26) -- 3113(line=108, offs=80) -*/ -ATSINSflab(__patsflab___patsfun_19): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/transport.dats: 3070(line=108, offs=37) -- 3113(line=108, offs=80) -*/ -ATSINSmove_void(tmpret63, ATSextfcall(nng_device, (env0, env1))) ; -ATSfunbody_end() -ATSreturn_void(tmpret63) ; -} /* end of [__patsfun_19] */ - -#if(0) -/* -** for initialization(dynloading) -*/ -ATSdynloadflag_minit(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__dynloadflag) ; -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__dynload() -{ -ATSfunbody_beg() -ATSdynload(/*void*/) -ATSdynloadflag_sta( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__dynloadflag -) ; -ATSif( -ATSCKiseqz( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__dynloadflag -) -) ATSthen() { -ATSdynloadset(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_transport_056_dats__dynloadflag) ; -/* -dynexnlst-initize(beg) -*/ -/* -dynexnlst-initize(end) -*/ -/* local */ -/* in of [local] */ -/* end of [local] */ -} /* ATSendif */ -ATSfunbody_end() -ATSreturn_void(tmpret_void) ; -} /* end of [*_dynload] */ -#endif // end of [#if(0)] - -/* ****** ****** */ - -/* end-of-compilation-unit */ diff --git a/BACKUP/ats/uuid.dats b/BACKUP/ats/uuid.dats deleted file mode 100644 index 8e17966..0000000 --- a/BACKUP/ats/uuid.dats +++ /dev/null @@ -1,77 +0,0 @@ -#define ATS_DYNLOADFLAG 0 -staload "./uuid.sats" - -local (*************************) - -%{^ -#include -#include -%} - -%{ - -unsigned char* uuid_alloc() { - unsigned char* ptr = (unsigned char*)malloc(sizeof(uuid_t)); - return ptr; -} - -void uuid_free(uuid_t ptr) { - free(ptr); -} - -%} - -#include "share/atspre_staload.hats" - -//typedef uuid_t = @[byte][16] - -(* unsafe types for linux uuid api *) -extern fun _generate (!uuid): void = "mac#uuid_generate" -extern fun _copy (!uuid, !uuid): void = "mac#uuid_copy" -extern fun _parse (&uuid_string, !uuid): int = "mac#uuid_parse" -extern fun _unparse (!uuid, &uuid_string? >> _): void = "mac#uuid_unparse" - -extern fun uuid_alloc (): uuid -implement uuid_alloc () = let - val uuid = $extfcall (uuid, "uuid_alloc") - val _ = assert_errmsg ($UNSAFE.castvwtp1{ptr} (uuid) > the_null_ptr, "uuid_generate failed.") -in - uuid -end - -in (*************************) - -implement uuid_generate () = let - val uuid = uuid_alloc () - val _ = _generate uuid -in - uuid -end - -implement uuid_copy (src) = let - val target = uuid_alloc () - val _ = _copy (target, src) -in - target -end - -implement uuid_equal (a, b) = let - extern fun uuid_compare (!uuid, !uuid): int = "mac#uuid_compare" -in - uuid_compare (a, b) = 0 -end - -implement uuid_free (uuid) = - $extfcall (void, "uuid_free", $UNSAFE.castvwtp0{ptr} uuid) - -implement uuid_parse (buf) = let - val uuid = uuid_alloc () - val ret = _parse (buf, uuid) - val _ = assert_errmsg (ret = 0, "uuid_parse failed.") -in - uuid -end - -implement uuid_unparse (uuid, buf) = _unparse (uuid, buf) - -end (*************************) \ No newline at end of file diff --git a/BACKUP/ats/uuid.sats b/BACKUP/ats/uuid.sats deleted file mode 100644 index 21c4678..0000000 --- a/BACKUP/ats/uuid.sats +++ /dev/null @@ -1,11 +0,0 @@ - -absvtype uuid = ptr -typedef uuid_string = @[char][37] - -fun uuid_generate (): uuid -fun uuid_equal (!uuid, !uuid): bool -fun uuid_copy (!uuid): uuid -fun uuid_free (uuid): void - -fun uuid_parse (&uuid_string): uuid -fun uuid_unparse (!uuid, &uuid_string? >> _): void \ No newline at end of file diff --git a/BACKUP/ats/uuid_dats.c b/BACKUP/ats/uuid_dats.c deleted file mode 100644 index a7c5e34..0000000 --- a/BACKUP/ats/uuid_dats.c +++ /dev/null @@ -1,912 +0,0 @@ -/* -** -** The C code is generated by [ATS/Postiats-0-3-12] -** The starting compilation time is: 2018-7-12: 16h:37m -** -*/ - -/* -** include runtime header files -*/ -#ifndef _ATS_CCOMP_HEADER_NONE_ -#include "pats_ccomp_config.h" -#include "pats_ccomp_basics.h" -#include "pats_ccomp_typedefs.h" -#include "pats_ccomp_instrset.h" -#include "pats_ccomp_memalloc.h" -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -#include "pats_ccomp_memalloca.h" -#include "pats_ccomp_exception.h" -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -#endif /* _ATS_CCOMP_HEADER_NONE_ */ - - -/* -** include prelude cats files -*/ -#ifndef _ATS_CCOMP_PRELUDE_NONE_ -// -#include "prelude/CATS/basics.cats" -#include "prelude/CATS/integer.cats" -#include "prelude/CATS/pointer.cats" -#include "prelude/CATS/integer_long.cats" -#include "prelude/CATS/integer_size.cats" -#include "prelude/CATS/integer_short.cats" -#include "prelude/CATS/bool.cats" -#include "prelude/CATS/char.cats" -#include "prelude/CATS/float.cats" -#include "prelude/CATS/integer_ptr.cats" -#include "prelude/CATS/integer_fixed.cats" -#include "prelude/CATS/memory.cats" -#include "prelude/CATS/string.cats" -#include "prelude/CATS/strptr.cats" -// -#include "prelude/CATS/fprintf.cats" -// -#include "prelude/CATS/filebas.cats" -// -#include "prelude/CATS/list.cats" -#include "prelude/CATS/option.cats" -#include "prelude/CATS/array.cats" -#include "prelude/CATS/arrayptr.cats" -#include "prelude/CATS/arrayref.cats" -#include "prelude/CATS/matrix.cats" -#include "prelude/CATS/matrixptr.cats" -// -#endif /* _ATS_CCOMP_PRELUDE_NONE_ */ -/* -** for user-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER_ -// -#include _ATS_CCOMP_PRELUDE_USER_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER_ */ -/* -** for user2-supplied prelude -*/ -#ifdef _ATS_CCOMP_PRELUDE_USER2_ -// -#include _ATS_CCOMP_PRELUDE_USER2_ -// -#endif /* _ATS_CCOMP_PRELUDE_USER2_ */ - -/* -staload-prologues(beg) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/basics.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/pointer.dats: 1533(line=44, offs=1) -- 1572(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_long.dats: 1602(line=49, offs=1) -- 1641(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_size.dats: 1597(line=49, offs=1) -- 1636(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_short.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/char.dats: 1610(line=48, offs=1) -- 1649(line=48, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/float.dats: 1636(line=50, offs=1) -- 1675(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/string.dats: 1631(line=50, offs=1) -- 1670(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1629(line=50, offs=1) -- 1668(line=50, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/strptr.dats: 1691(line=54, offs=1) -- 1738(line=54, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_ptr.dats: 1601(line=49, offs=1) -- 1640(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer_fixed.dats: 1603(line=49, offs=1) -- 1642(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/memory.dats: 1410(line=38, offs=1) -- 1449(line=39, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1607(line=49, offs=1) -- 1646(line=50, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1669(line=54, offs=1) -- 1715(line=55, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 1596(line=49, offs=1) -- 1635(line=49, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1738(line=59, offs=1) -- 1783(line=60, offs=38) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 1865(line=66, offs=1) -- 1912(line=66, offs=48) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1390(line=36, offs=1) -- 1440(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/stat.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/stat.sats: 1756(line=58, offs=1) -- 1805(line=60, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/filebas.dats: 15937(line=927, offs=1) -- 15974(line=928, offs=30) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1390(line=36, offs=1) -- 1437(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/stdio.cats" -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/stdio.sats: 1950(line=69, offs=1) -- 1999(line=71, offs=34) -*/ -/* -/Users/hwwu/Programs/atsgit/libats/libc/SATS/sys/types.sats: 1390(line=36, offs=1) -- 1441(line=39, offs=3) -*/ - -#include \ -"libats/libc/CATS/sys/types.cats" -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1529(line=44, offs=1) -- 1568(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list.dats: 1569(line=46, offs=1) -- 1615(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1538(line=44, offs=1) -- 1577(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/list_vt.dats: 1578(line=46, offs=1) -- 1624(line=47, offs=39) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_mergesort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/list_vt_quicksort.dats: 1546(line=44, offs=1) -- 1585(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/array.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_bsearch.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/SHARE/array_quicksort.dats: 1531(line=44, offs=1) -- 1570(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayptr.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/arrayref.dats: 1532(line=44, offs=1) -- 1571(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrix.dats: 1535(line=44, offs=1) -- 1574(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixptr.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/matrixref.dats: 1538(line=44, offs=1) -- 1577(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/stream_vt.dats: 1523(line=44, offs=1) -- 1562(line=44, offs=40) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/tostring.dats: 1528(line=44, offs=1) -- 1567(line=45, offs=32) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/unsafe.dats: 1532(line=44, offs=1) -- 1566(line=44, offs=35) -*/ -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/checkast.dats: 1531(line=44, offs=1) -- 1570(line=45, offs=32) -*/ -/* -staload-prologues(end) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 85(line=6, offs=1) -- 134(line=9, offs=3) -*/ -ATSextcode_beg() -#include -#include -ATSextcode_end() -/* -typedefs-for-tyrecs-and-tysums(beg) -*/ -/* -typedefs-for-tyrecs-and-tysums(end) -*/ -/* -dynconlst-declaration(beg) -*/ -/* -dynconlst-declaration(end) -*/ -/* -dyncstlst-declaration(beg) -*/ -ATSdyncst_mac(atspre_assert_errmsg_bool0) -ATSdyncst_mac(atspre_gt_ptr0_ptr0) -ATSdyncst_mac(the_atsptr_null) -ATSdyncst_extfun(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__uuid_alloc, (), atstkind_type(atstype_ptrk)) ; -ATSdyncst_mac(uuid_generate) -ATSdyncst_mac(uuid_copy) -ATSdyncst_mac(atspre_g0int2int_int_int) -ATSdyncst_mac(atspre_g0int_eq_int) -ATSdyncst_mac(uuid_compare) -ATSdyncst_mac(uuid_parse) -ATSdyncst_mac(uuid_unparse) -/* -dyncstlst-declaration(end) -*/ -/* -dynvalist-implementation(beg) -*/ -/* -dynvalist-implementation(end) -*/ -/* -exnconlst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_EXCEPTION_NONE_ -ATSextern() -atsvoid_t0ype -the_atsexncon_initize -( - atstype_exnconptr d2c, atstype_string exnmsg -) ; -#endif // end of [_ATS_CCOMP_EXCEPTION_NONE_] -/* -exnconlst-declaration(end) -*/ -/* -extypelst-declaration(beg) -*/ -/* -extypelst-declaration(end) -*/ -/* -assumelst-declaration(beg) -*/ -#ifndef _ATS_CCOMP_ASSUME_CHECK_NONE_ -#endif // #ifndef(_ATS_CCOMP_ASSUME_CHECK_NONE_) -/* -assumelst-declaration(end) -*/ -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 136(line=11, offs=1) -- 294(line=22, offs=3) -*/ -ATSextcode_beg() - -unsigned char* uuid_alloc() { - unsigned char* ptr = (unsigned char*)malloc(sizeof(uuid_t)); - return ptr; -} - -void uuid_free(uuid_t ptr) { - free(ptr); -} - -ATSextcode_end() -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__uuid_alloc() ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_generate() ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_copy(atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -atstkind_t0ype(atstype_bool) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_equal(atsrefarg0_type(atstkind_type(atstype_ptrk)), atsrefarg0_type(atstkind_type(atstype_ptrk))) ; -#endif // end of [QUALIFIED] - -#if(0) -#if(0) -ATSextern() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__4(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ; -#endif // end of [QUALIFIED] -#endif // end of [TEMPLATE] - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__4__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; - -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_free(atstkind_type(atstype_ptrk)) ; -#endif // end of [QUALIFIED] - -#if(0) -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_parse(atsrefarg1_type(atstyarr_type(atstkind_t0ype(atstype_char)))) ; -#endif // end of [QUALIFIED] - -ATSstatic() -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__4__2(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; - -#if(0) -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_unparse(atsrefarg0_type(atstkind_type(atstype_ptrk)), atsrefarg1_type(atstyarr_type(atstkind_t0ype(atstype_char)))) ; -#endif // end of [QUALIFIED] - -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 718(line=35, offs=22) -- 880(line=40, offs=4) -*/ -/* -local: -global: uuid_alloc$0$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__uuid_alloc() -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret0, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp1, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp2) ; -ATStmpdec(tmp3, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 707(line=35, offs=11) -- 880(line=40, offs=4) -*/ -ATSINSflab(__patsflab_uuid_alloc): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 723(line=35, offs=27) -- 880(line=40, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 740(line=36, offs=13) -- 770(line=36, offs=43) -*/ -ATSINSmove(tmp1, ATSextfcall(uuid_alloc, ())) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 795(line=37, offs=25) -- 839(line=37, offs=69) -*/ -ATSINSmove(tmp3, atspre_gt_ptr0_ptr0(ATSPMVcastfn(castvwtp1, atstkind_type(atstype_ptrk), ATSPMVrefarg0(tmp1)), the_atsptr_null)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 780(line=37, offs=10) -- 865(line=37, offs=95) -*/ -ATSINSmove_void(tmp2, atspre_assert_errmsg_bool0(tmp3, ATSPMVstring("uuid_generate failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 871(line=39, offs=2) -- 875(line=39, offs=6) -*/ -ATSINSmove(tmpret0, tmp1) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 723(line=35, offs=27) -- 880(line=40, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret0) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__uuid_alloc] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 941(line=44, offs=25) -- 1014(line=49, offs=4) -*/ -/* -local: -global: uuid_generate$1$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_generate() -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret4, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp5, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp6) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 927(line=44, offs=11) -- 1014(line=49, offs=4) -*/ -ATSINSflab(__patsflab_uuid_generate): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 946(line=44, offs=30) -- 1014(line=49, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 963(line=45, offs=13) -- 976(line=45, offs=26) -*/ -ATSINSmove(tmp5, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__uuid_alloc()) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 986(line=46, offs=10) -- 1000(line=46, offs=24) -*/ -ATSINSmove_void(tmp6, uuid_generate(ATSPMVrefarg0(tmp5))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1005(line=48, offs=2) -- 1009(line=48, offs=6) -*/ -ATSINSmove(tmpret4, tmp5) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 946(line=44, offs=30) -- 1014(line=49, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret4) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_generate] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1036(line=51, offs=21) -- 1122(line=56, offs=4) -*/ -/* -local: -global: uuid_copy$2$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_copy(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret7, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp8, atstkind_type(atstype_ptrk)) ; -// ATStmpdec_void(tmp9) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1026(line=51, offs=11) -- 1122(line=56, offs=4) -*/ -ATSINSflab(__patsflab_uuid_copy): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1044(line=51, offs=29) -- 1122(line=56, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1063(line=52, offs=15) -- 1076(line=52, offs=28) -*/ -ATSINSmove(tmp8, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__uuid_alloc()) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1086(line=53, offs=10) -- 1105(line=53, offs=29) -*/ -ATSINSmove_void(tmp9, uuid_copy(ATSPMVrefarg0(tmp8), ATSPMVrefarg0(arg0))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1111(line=55, offs=2) -- 1117(line=55, offs=8) -*/ -ATSINSmove(tmpret7, tmp8) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1044(line=51, offs=29) -- 1122(line=56, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret7) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_copy] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1145(line=58, offs=22) -- 1256(line=62, offs=4) -*/ -/* -local: -global: uuid_equal$3$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_t0ype(atstype_bool) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_equal(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0, atsrefarg0_type(atstkind_type(atstype_ptrk)) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret10, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp15, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1134(line=58, offs=11) -- 1256(line=62, offs=4) -*/ -ATSINSflab(__patsflab_uuid_equal): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1154(line=58, offs=31) -- 1256(line=62, offs=4) -*/ -/* -letpush(beg) -*/ -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1229(line=61, offs=2) -- 1248(line=61, offs=21) -*/ -ATSINSmove(tmp15, uuid_compare(ATSPMVrefarg0(arg0), ATSPMVrefarg0(arg1))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1229(line=61, offs=2) -- 1252(line=61, offs=25) -*/ -ATSINSmove(tmpret10, ATSLIB_056_prelude__eq_g0int_int__4__1(tmp15, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1154(line=58, offs=31) -- 1256(line=62, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret10) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_equal] */ - -#if(0) -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$4$0(level=0) -local: -global: -*/ -ATSextern() -/* -imparg = tk(4624) -tmparg = S2Evar(tk(4624)) -tmpsub = None() -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__4(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret11, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp12, atstkind_t0ype(atstyvar_type(tk))) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp12, PMVtmpltcst(g0int2int)(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret11, PMVtmpltcst(g0int_eq)(arg0, tmp12)) ; - -ATSfunbody_end() -ATSreturn(tmpret11) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__4] */ -#endif // end of [TEMPLATE] - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$4$1(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = tk(4624) -tmparg = S2Evar(tk(4624)) -tmpsub = Some(tk(4624) -> S2Eextkind(atstype_int)) -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__4__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret11__1, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp12__1, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp12__1, atspre_g0int2int_int_int(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret11__1, atspre_g0int_eq_int(arg0, tmp12__1)) ; - -ATSfunbody_end() -ATSreturn(tmpret11__1) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__4__1] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1278(line=64, offs=21) -- 1347(line=65, offs=60) -*/ -/* -local: -global: uuid_free$8$0(level=0) -local: -global: -*/ -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_free(atstkind_type(atstype_ptrk) arg0) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret16) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1268(line=64, offs=11) -- 1347(line=65, offs=60) -*/ -ATSINSflab(__patsflab_uuid_free): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1289(line=65, offs=2) -- 1347(line=65, offs=60) -*/ -ATSINSmove_void(tmpret16, ATSextfcall(uuid_free, (ATSPMVcastfn(castvwtp0, atstkind_type(atstype_ptrk), arg0)))) ; -ATSfunbody_end() -ATSreturn_void(tmpret16) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_free] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1370(line=67, offs=22) -- 1507(line=73, offs=4) -*/ -/* -local: -global: uuid_parse$9$0(level=0) -local: -global: -*/ -ATSextern() -atstkind_type(atstype_ptrk) -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_parse(atsrefarg1_type(atstyarr_type(atstkind_t0ype(atstype_char))) arg0) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret17, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp18, atstkind_type(atstype_ptrk)) ; -ATStmpdec(tmp19, atstkind_t0ype(atstype_int)) ; -// ATStmpdec_void(tmp20) ; -ATStmpdec(tmp21, atstkind_t0ype(atstype_bool)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1359(line=67, offs=11) -- 1507(line=73, offs=4) -*/ -ATSINSflab(__patsflab_uuid_parse): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1378(line=67, offs=30) -- 1507(line=73, offs=4) -*/ -/* -letpush(beg) -*/ -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1395(line=68, offs=13) -- 1408(line=68, offs=26) -*/ -ATSINSmove(tmp18, _057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__uuid_alloc()) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1420(line=69, offs=12) -- 1438(line=69, offs=30) -*/ -ATSINSmove(tmp19, uuid_parse(ATSPMVrefarg1(arg0), ATSPMVrefarg0(tmp18))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1463(line=70, offs=25) -- 1470(line=70, offs=32) -*/ -ATSINSmove(tmp21, ATSLIB_056_prelude__eq_g0int_int__4__2(tmp19, ATSPMVi0nt(0))) ; - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1448(line=70, offs=10) -- 1493(line=70, offs=55) -*/ -ATSINSmove_void(tmp20, atspre_assert_errmsg_bool0(tmp21, ATSPMVstring("uuid_parse failed."))) ; - -/* -letpush(end) -*/ - -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1499(line=72, offs=2) -- 1503(line=72, offs=6) -*/ -ATSINSmove(tmpret17, tmp18) ; -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1378(line=67, offs=30) -- 1507(line=73, offs=4) -*/ -/* -INSletpop() -*/ -ATSfunbody_end() -ATSreturn(tmpret17) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_parse] */ - -/* -/Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42) -*/ -/* -local: -global: eq_g0int_int$4$2(level=1) -local: -global: -*/ -ATSstatic() -/* -imparg = tk(4624) -tmparg = S2Evar(tk(4624)) -tmpsub = Some(tk(4624) -> S2Eextkind(atstype_int)) -*/ -atstkind_t0ype(atstype_bool) -ATSLIB_056_prelude__eq_g0int_int__4__2(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) -{ -/* tmpvardeclst(beg) */ -ATStmpdec(tmpret11__2, atstkind_t0ype(atstype_bool)) ; -ATStmpdec(tmp12__2, atstkind_t0ype(atstype_int)) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12244(line=634, offs=1) -- 12298(line=635, offs=42) -*/ -ATSINSflab(__patsflab_eq_g0int_int): -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12285(line=635, offs=29) -- 12296(line=635, offs=40) -*/ -ATSINSmove(tmp12__2, atspre_g0int2int_int_int(arg1)) ; - -/* -emit_instr: loc0 = /Users/hwwu/Programs/atsgit/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12268(line=635, offs=12) -- 12298(line=635, offs=42) -*/ -ATSINSmove(tmpret11__2, atspre_g0int_eq_int(arg0, tmp12__2)) ; - -ATSfunbody_end() -ATSreturn(tmpret11__2) ; -} /* end of [ATSLIB_056_prelude__eq_g0int_int__4__2] */ - -/* -/Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1532(line=75, offs=24) -- 1566(line=75, offs=58) -*/ -/* -local: -global: uuid_unparse$11$0(level=0) -local: -global: -*/ -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_unparse(atsrefarg0_type(atstkind_type(atstype_ptrk)) arg0, atsrefarg1_type(atstyarr_type(atstkind_t0ype(atstype_char))) arg1) -{ -/* tmpvardeclst(beg) */ -// ATStmpdec_void(tmpret24) ; -/* tmpvardeclst(end) */ -ATSfunbody_beg() -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1519(line=75, offs=11) -- 1566(line=75, offs=58) -*/ -ATSINSflab(__patsflab_uuid_unparse): -/* -emit_instr: loc0 = /Users/hwwu/Git/ats-sessions/ats/uuid.dats: 1546(line=75, offs=38) -- 1566(line=75, offs=58) -*/ -ATSINSmove_void(tmpret24, uuid_unparse(ATSPMVrefarg0(arg0), ATSPMVrefarg1(arg1))) ; - -ATSfunbody_end() -ATSreturn_void(tmpret24) ; -} /* end of [_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_sats__uuid_unparse] */ - -#if(0) -/* -** for initialization(dynloading) -*/ -ATSdynloadflag_minit(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__dynloadflag) ; -ATSextern() -atsvoid_t0ype -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__dynload() -{ -ATSfunbody_beg() -ATSdynload(/*void*/) -ATSdynloadflag_sta( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__dynloadflag -) ; -ATSif( -ATSCKiseqz( -_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__dynloadflag -) -) ATSthen() { -ATSdynloadset(_057_Users_057_hwwu_057_Git_057_ats_055_sessions_057_ats_057_uuid_056_dats__dynloadflag) ; -/* -dynexnlst-initize(beg) -*/ -/* -dynexnlst-initize(end) -*/ -/* local */ -/* in of [local] */ -/* end of [local] */ -} /* ATSendif */ -ATSfunbody_end() -ATSreturn_void(tmpret_void) ; -} /* end of [*_dynload] */ -#endif // end of [#if(0)] - -/* ****** ****** */ - -/* end-of-compilation-unit */ diff --git a/BACKUP/c/endpoint.h b/BACKUP/c/endpoint.h deleted file mode 100644 index ba4d415..0000000 --- a/BACKUP/c/endpoint.h +++ /dev/null @@ -1,16 +0,0 @@ -#include "./roles.h" - - - - -typedef void* endpoint; -typedef void* address; - -typedef int result; - - - -endpoint endpoint_make(roleset ) - -result_t endpt_request(endpt_ptr endpt, addr_ptr addr); -result_t endpt_accept(endpt_ptr endpt, addr_ptr addr); \ No newline at end of file diff --git a/BACKUP/c/msg.h b/BACKUP/c/msg.h deleted file mode 100644 index d0e6c64..0000000 --- a/BACKUP/c/msg.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "./utils.h" - diff --git a/BACKUP/c/roles.h b/BACKUP/c/roles.h deleted file mode 100644 index c6575ca..0000000 --- a/BACKUP/c/roles.h +++ /dev/null @@ -1,19 +0,0 @@ -#include "./utils.h" - -/** - * Roles are immutable. - */ - -typedef int role; -typedef int[] roleset; - - -roleset roleset_make(int count, ...); -void roleset_free(roleset rs); - -bool roleset_empty(roleset rs); -bool roleset_has(roleset rs, role r); -bool roleset_equals(roleset rs1, roleset rs2); - - -bool roleset_intersect diff --git a/BACKUP/c/test b/BACKUP/c/test deleted file mode 100755 index da503de..0000000 Binary files a/BACKUP/c/test and /dev/null differ diff --git a/BACKUP/c/test.c b/BACKUP/c/test.c deleted file mode 100644 index fe7664b..0000000 --- a/BACKUP/c/test.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "stdio.h" -#include "assert.h" -#include "stdlib.h" - -#include "nanomsg/nn.h" -#include "nanomsg/bus.h" -#include "nanomsg/ws.h" - -#include "jansson.h" - - - - - -// json_t* receive(int sock) { -// char *buf = NULL; -// int recv = nn_recv(sock, &buf, NN_MSG, 0); -// assert(recv > 0); - -// json_t *obj = json_loads(buf, 0, NULL); -// nn_freemsg(buf); - -// return obj -// } - -// void send(int sock, json_t* payload) { -// char* buf = json_dumps(payload, ) -// } - - - - -int main(int argc, char **argv) { - int sock = nn_socket(AF_SP, NN_BUS); - assert(sock >= 0); - nn_bind(sock, "ipc:///tmp/device1.ipc"); - nn_device(sock, -1); - - int err = nn_errno(); - return 0; -} \ No newline at end of file diff --git a/BACKUP/c/transport.h b/BACKUP/c/transport.h deleted file mode 100644 index 936e1d3..0000000 --- a/BACKUP/c/transport.h +++ /dev/null @@ -1,10 +0,0 @@ - - - - -struct transport_t { - (void *) (*connect) (void* this, void *addr); - (void *) (*disconnect) (void* this, void *addr); - (void *) (*send) (void* this, void *json); - (void *) (*receive) (void* this) -}; diff --git a/BACKUP/c/utils.h b/BACKUP/c/utils.h deleted file mode 100644 index fdf49b6..0000000 --- a/BACKUP/c/utils.h +++ /dev/null @@ -1,9 +0,0 @@ - - - -typedef int bool; -#define true 0 -#define ok 0 -#define false -1 -#define fail -1 -#define err -1 \ No newline at end of file diff --git a/BACKUP/consensus.sats b/BACKUP/consensus.sats deleted file mode 100644 index 8f1d065..0000000 --- a/BACKUP/consensus.sats +++ /dev/null @@ -1,13 +0,0 @@ -staload "./socket.sats" - - -abstype partyid - -datatype raftstate = -| Follower -| Candidate -| Leader - -fun elect (!socket): partyid - -fun serverloop (raftstate): void \ No newline at end of file diff --git a/BACKUP/constraints b/BACKUP/constraints deleted file mode 100644 index e69de29..0000000 diff --git a/BACKUP/endpoint.dats b/BACKUP/endpoint.dats deleted file mode 100644 index 38002ff..0000000 --- a/BACKUP/endpoint.dats +++ /dev/null @@ -1,46 +0,0 @@ -//staload "./endpoint.sats" -//staload "./mailbox.sats" -//staload "./socket.sats" -//staload "./thread.sats" -//staload "./payload.sats" -//staload "./uuid.sats" - - -//assume endpoint = $rec{sock=socket, mbox=mailbox, self=set(roles), id=uuid, rtstype=} - - -//datatype epcommand = -//| EPInit -//| EPSend -//| EPRecv -//| EPLink -//| EPClose - -//implement {} endpoint_create (socket) = let -// val mailbox = mailbox_create () -// val uuid = uuid () - -//// fun endpoint_loop (): = let -//// val _ = mailbox_get - -//// in -//// endpoint_loop () -//// end -//in -// $rec{sock=socket, mbox=mailbox, self=emp, id=uuid} -//end - - - -//implement {a} endpoint_send (!ep, payload) = let -// val payload = payload_encode<$tup{uuid,payload(a)}> ($tup(ep.id, payload)) -// val _ = sock_send (ep.sock, payload) -// val _ = mbox_put (ep.mbox, payload) -//in -//end - -//implement {a} endpoint_receive (!ep) = let -// val payload = sock_receive (ep.sock) -// val $tup(uuid, payload) = payload_decode<$tup{uuid,payload(a)}> (payload) -// val - diff --git a/BACKUP/endpoint.sats b/BACKUP/endpoint.sats deleted file mode 100644 index e28b33d..0000000 --- a/BACKUP/endpoint.sats +++ /dev/null @@ -1,28 +0,0 @@ - - - - -(* endpoint version *) -datasort epver = redis | nanomsg - -(* endpoint *) -absvtype endpoint (epver) = ptr - - -fun {v:epver} endpt_make (id:string, roles:roleset): endpoint (epver) -fun {v:epver} endpt_free (endpoint v): void - -fun {v:epver} endpt_id (!endpoint v): string -fun {v:epver} endpt_roles (!endpoint v): roleset - -fun {v:epver} endpt_accept (!endpoint v, addr:string): bool -fun {v:epver} endpt_request (!endpoint v, addr:string): bool - -fun {v:epver} {a:vt@ype} endpt_send (!endpoint v, a): void -fun {v:epver} {a:vt@ype} endpt_recv (!endpoint v): a - -fun {v:epver} {a:vt@ype} endpt_cut (endpoint v, endpoint v): endpoint v - -fun {v:epver} endpt_dbg_seqnum (!endpoint v): int - - diff --git a/BACKUP/endpoint_redis.dats b/BACKUP/endpoint_redis.dats deleted file mode 100644 index c6d46f9..0000000 --- a/BACKUP/endpoint_redis.dats +++ /dev/null @@ -1,13 +0,0 @@ -staload "./endpoint.sats" - -assume endpoint (redis) = $rec{id=string, roles=roleset} - -implement endpt_make (id, roles) = - $rec{id=id, roles=roles} - -//implememt endpt_free (ep) = - -implement endpt_accept (ep, addr) = let - -in -end diff --git a/BACKUP/frontend/libsession.dats b/BACKUP/frontend/libsession.dats deleted file mode 100644 index e69de29..0000000 diff --git a/BACKUP/js/endpoint.js b/BACKUP/js/endpoint.js deleted file mode 100644 index 3c43087..0000000 --- a/BACKUP/js/endpoint.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict" - -import { Socket } from "./socket.js" -import { Mailbox } from "./mbox.js" -import { Msg } from "./msg.js" - -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)) -} - -class Endpoint { - /** - * local states: - * - id: endpoint id - * - roles: self roles within the session - * - peers: peer roles and peer endpoint id's - * - mbox: message box for received msgs - * - sock: pre-connected socket in "bus/broadcast" mode - */ - - - /** - * Construct an endpoint that wraps around a pre-connected - * broadcasting socket. - * @param {Socket} sock - * @param {[int]} roles - */ - constructor(sock, roles) { - this.id = uuidv4(); - this.roles = roles.sort(); - this.peers = {} // a map where peers[role] = peer_uuid - this.mbox = new Mailbox() - this.sock = sock - this.state = "init" // init | ready | active | closing - - this.sock.onmessage = msg => { - if (Object.values(this.peers).includes(msg.sender)) { - this.mbox.put(msg) - } - } - - } - - init(fullroles) { - - // save old continuation - let old_onmessage = this.sock.onmessage - - // remove self roles from full roles - let others = fullroles.filter(key => !this.roles.includes(key)).map(key => key.toString()).sort() - - // callback to gather all init replies - let on_init_reply = msg => { - - // skip init reply that is not for myself - if (this.id != msg.payload.init) { - return - } - - // skip when there's overlapping roles - let roles = msg.payload.roles - if (!roles.every(role => !(role in this.peers))) { - return - } - - // add role => uuid mappings - for ( const role of roles ) { - this.peers[role] = msg.sender - } - - // check for the presence of all roles in the session - let keys = Object.keys(this.peers).sort() - if (keys.length == others.length && - keys.reduce((acc, cur, idx) => acc && (cur == others[idx]), true)) { - - this.state = "active" - } - } - - // callback to reply init requests - let on_init = msg => { - let reply = new Msg("init-reply", this.id, { - roles: this.roles, - init: msg.sender - }) - this.sock.send(reply) - } - - // announce self with id and roles until initialization is finished - let msg = new Msg("init", this.id, this.roles) - let interval = setInterval(() => this.sock.send(msg), 1000) - - this.sock.onmessage = msg => { - // skip non-init/non-init-reply messages - if (!["init", "init-reply"].includes(msg.label)) { - return - } - - switch (msg.label) { - case "init": - on_init(msg) - break - case "init-reply": - on_init_reply(msg) - break - } - } - - // wait until the state has changed away from "init" - return new Promise(async resolve => { - let sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) - while (this.state == "init") { - await sleep(1) - } - - this.sock.onmessage = old_onmessage - clearInterval(interval) - - resolve() - }) - } - - /** - * Broadcast a payload to all - * @param {anything} payload - * @return {void} - */ - broadcast(payload) { - let msg = new Msg("send", this.id, payload) - this.sock.send(msg) - } - - /** - * Receive a message from a particular sender. - * @param {role} sender - * @return {anything} - */ - async receive(sender) { - let msg = await this.mbox.match("send", this.peers[sender]) - return msg - } -} - -export { Endpoint } diff --git a/BACKUP/js/index.html b/BACKUP/js/index.html deleted file mode 100644 index eb79435..0000000 --- a/BACKUP/js/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - diff --git a/BACKUP/js/index.js b/BACKUP/js/index.js deleted file mode 100644 index 3e9e666..0000000 --- a/BACKUP/js/index.js +++ /dev/null @@ -1,3 +0,0 @@ - - -export { main } \ No newline at end of file diff --git a/BACKUP/js/mbox.js b/BACKUP/js/mbox.js deleted file mode 100644 index c5d913f..0000000 --- a/BACKUP/js/mbox.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict" - -import { Msg } from "./msg.js" - -class Mailbox { - constructor() { - this.worker = new Worker("mboxworker.js") - } - - put(msg) { - this.worker.postMessage(new Msg("put", undefined, msg)) - } - - async get() { - let request = new Promise(resolve => { - this.worker.onmessage = resolve - this.worker.postMessage(new Msg("get", undefined, undefined)) - }) - - let response = await request - return response.data - } - - async match(label, sender) { - let request = new Promise(resolve => { - this.worker.onmessage = resolve - this.worker.postMessage(new Msg("match", undefined, { - label: label, - sender: sender - })) - }) - - let response = await request - return response.data - } - - close() { - this.worker.postMessage(new Msg("close", undefined, undefined)) - } -} - -export { Mailbox } \ No newline at end of file diff --git a/BACKUP/js/mboxworker.js b/BACKUP/js/mboxworker.js deleted file mode 100644 index abb1e4c..0000000 --- a/BACKUP/js/mboxworker.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict" - -import { Msg } from "./msg.js" - -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -class MailboxWorker { - constructor() { - this.mbox = [] - setInterval((mbox) => console.log(mbox), 1000, this.mbox) - } - - on_put(msg) { - this.mbox.push(msg.payload) - } - - async on_get() { - while (!this.mbox.length) { - await sleep(1) - } - return this.mbox.shift() - } - - async on_match(msg) { - let label = msg.payload.label, - sender = msg.payload.sender - while (true) { - let index = this.mbox.findIndex(m => m.label == label && m.sender == sender) - while (index < 0) { - await sleep(1) - } - return this.mbox.splice(index, 1)[0] - } - } - - on_close() { - delete this.mbox - close() - } - - async dispatch(msg) { - switch (msg.label) { - case "put": - this.on_put(msg) - break - case "get": - postMessage(await this.on_get()) - break - case "match": - postMessage(await this.on_match(msg)) - break - case "close": - this.on_close() - break - } - } -} - -let worker = new MailboxWorker() -self.onmessage = e => worker.dispatch(e.data) \ No newline at end of file diff --git a/BACKUP/js/msg.js b/BACKUP/js/msg.js deleted file mode 100644 index f203f81..0000000 --- a/BACKUP/js/msg.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict" - -class Msg { - constructor(label, sender, payload) { - this.label = label - this.sender = sender - this.payload = payload - } -} - -export { Msg } \ No newline at end of file diff --git a/BACKUP/js/socket.js b/BACKUP/js/socket.js deleted file mode 100644 index c25dde7..0000000 --- a/BACKUP/js/socket.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict" - -class Socket { - constructor(proto) { - this.proto = proto - } - - bind(addr) { - throw "not supported" - } - - connect(addr) { - try { - this.sock = new WebSocket(addr, this.proto) - } catch ( e ) { - console.log(e) - } - } - - close() { - this.sock.close() - } - - set onmessage(handler) { - this.sock.onmessage = e => { - let reader = new FileReader() - reader.onloadend = () => { - console.log(`recv: ${reader.result}`) - handler(JSON.parse(reader.result)) - } - reader.readAsText(e.data) - } - } - - get onmessage() { - return this.sock.onmessage - } - - send(payload) { - console.log(`send: ${JSON.stringify(payload)}`) - this.sock.send(JSON.stringify(payload)) - } -} - - -export { Socket } \ No newline at end of file diff --git a/BACKUP/libsession.sats b/BACKUP/libsession.sats deleted file mode 100644 index 51af9cf..0000000 --- a/BACKUP/libsession.sats +++ /dev/null @@ -1,139 +0,0 @@ -staload "../util/set.sats" - -sortdef role = int -sortdef roles = set - -(* session types *) -datasort stype = -| pinit of (role) -| pend of (role) -| pmsg of (role, role, vt@ype) -| pbcast of (role, t@ype) -| pseq of (stype, stype) -| pmult of (role, stype, stype) -| paddi of (role, stype, stype) -| pneg of (role, stype) -| pquan of (role, int -> stype) -| pquan2 of (role, stype -> stype) - -stadef :: = pseq - - -absvtype session (roles, stype) = ptr - -(* session api *) -fun {} session_send_cont - {self:roles} {from,to:role|mem(self,from)*not(mem(self,to))} {a:vt@ype} {s:stype} - (!session(self,pmsg(from,to,a)::s) >> session(self,s), a): void - -fun {} session_recv_cont - {self:roles} {from,to:role|not(mem(self,from))*mem(self,to)} {a:vt@ype} {s:stype} - (!session(self,pmsg(from,to,a)::s) >> session(self,s)): a - -fun {} session_send - {self:roles} {from,to:role|mem(self,from)*not(mem(self,to))} {a:vt@ype} - (session(self,pmsg(from,to,a)), a): void - -fun {} session_recv - {self:roles} {from,to:role|not(mem(self,from))*mem(self,to)} {a:vt@ype} - (session(self,pmsg(from,to,a))): a - -fun {} session_bcast_cont - {self:roles} {from:role|mem(self,from)} {a:t@ype} {s:stype} - (!session(self,pbcast(from,a)::s) >> session(self,s), a): void - -fun {} session_brecv_cont - {self:roles} {from:role|not(mem(self,from))} {a:t@ype} {s:stype} - (!session(self,pbcast(from,a)::s) >> session(self,s)): a - -fun {} session_bcast - {self:roles} {from:role|mem(self,from)} {a:t@ype} - (session(self,pbcast(from,a)), a): void - -fun {} session_brecv - {self:roles} {from:role|not(mem(self,from))} {a:t@ype} - (session(self,pbcast(from,a))): a - -fun {} session_close - {self:roles} {r:role|mem(self,r)} - (session(self,pend(r))): void - -fun {} session_wait - {self:roles} {r:role|not(mem(self,r))} - (session(self,pend(r))): void - - -castfn session_exify - {self:roles} {r:role|not(mem(self,r))} {fp:int->stype} - (session(self,pquan(r,fp))): [n:int] session(self,fp(n)) - -castfn session_unify - {self:roles} {r:role|mem(self,r)} {fp:int->stype} - (session(self,pquan(r,fp))): {n:int} session(self,fp(n)) - -(* need to perform runtime check *) - -fun {} session_skip_cont - {self:roles} {s,ss:stype} - (!session(self,s::ss)>>session(self,ss)): void - -fun {} session_skip - {self:roles} {s:stype} - (session(self,s)): void - -//fun {} session_create -// {self:roles} {s:stype} -// (set self, rtstype s, session(~self,s) - void): session (self, s) - - -(* session combinators *) -fun {} session_seq - {self:roles} {s1,s2:stype} {a:vt@ype} - (!session(self,s1::s2) >> session(self,s2), session(self,s1) - a): a - -fun {} session_mconj - {self:roles} {r:role|mem(self,r)} {s1,s2:stype} - (session(self,pmult(r,s1,s2))): @(session(self,s1), session(self,s2)) - -fun {} session_mdisj - {self:roles} {r:role|not(mem(self,r))} {s1,s2:stype} - (session(self,pmult(r,s1,s2)), session(self,s1) - void, session(self,s2) - void): void - -datavtype choice (stype, p:stype, q:stype) = -| Left (p, p, q) of () -| Right (q, p, q) of () - -fun {} session_aconj - {self:roles} {r:role|mem(self,r)} {s,s1,s2:stype} - (!session(self,paddi(r,s1,s2)) >> session(self,s), choice(s,s1,s2)): void - -fun {} session_adisj - {self:roles} {r:role|not(mem(self,r))} {s1,s2:stype} - (!session(self,paddi(r,s1,s2)) >> session(self,s)): #[s:stype] choice (s,s1,s2) - -fun {} session_cut - {rs1,rs2:roles|disj(~rs1,~rs2)} {s:stype} - (session(rs1,s), session(rs2,s)): session(rs1*rs2,s) - -fun {} session_emp - {s:stype} - (session(emp,s)): void - -//fun {} session_full -// {full:roles} {s:stype} -// (set full, rtstype s): session (full, s) - -fun {} session_split - {rs1,rs2:roles|disj(rs1,rs2)} {s:stype} - (session(rs1+rs2,s), session(rs1,s) - void, session(rs2,s) - void): void - -typedef negation_t = {rs1:roles} set rs1 -> [rs2:roles] set rs2 - -fun {} session_neg - {self:roles} {r:role|mem(self,r)} {s:stype} - (!session(self,pneg(r,s)) >> session(rs,s), negation_t): #[rs:roles] set rs - -fun {} session_neg_follow - {self:roles} {r:role|not(mem(self,r))} {s:stype} - (!session(self,pneg(r,s)) >> session(rs,s)): #[rs:roles] set rs - diff --git a/BACKUP/mailbox.sats b/BACKUP/mailbox.sats deleted file mode 100644 index bd2cf8f..0000000 --- a/BACKUP/mailbox.sats +++ /dev/null @@ -1,13 +0,0 @@ - -absvtype mailbox - -fun mbox_create (): mailbox -fun mbox_destroy (mailbox): void - -fun {a:vt@ype} mbox_put (!mailbox, a): void -fun {a:vt@ype} mbox_get (!mailbox): maybe a -fun {a:vt@ype} mbox_match (!mailbox, a - bool): maybe a - -fun mbox_count {n:nat} (!mailbox n): int n - - diff --git a/BACKUP/maybe.sats b/BACKUP/maybe.sats deleted file mode 100644 index ac3dd90..0000000 --- a/BACKUP/maybe.sats +++ /dev/null @@ -1,5 +0,0 @@ - - -datavtype maybe (a:vt@ype) = -| Just (a) of (a) -| None (a) of () \ No newline at end of file diff --git a/BACKUP/node/.gitignore b/BACKUP/node/.gitignore deleted file mode 100644 index 5a7ae84..0000000 --- a/BACKUP/node/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -./node_modules/ - -node_modules/ diff --git a/BACKUP/node/Makefile b/BACKUP/node/Makefile deleted file mode 100644 index e202264..0000000 --- a/BACKUP/node/Makefile +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -test: *.js - rm -rf /tmp/*.ipc - node index.js "A" & node index.js "B" & node index.js "C" - diff --git a/BACKUP/node/collections.js b/BACKUP/node/collections.js deleted file mode 100644 index 8ba76ad..0000000 --- a/BACKUP/node/collections.js +++ /dev/null @@ -1,174 +0,0 @@ -"use strict" - -/** - * Extensions to Array - */ - -Array.prototype.foldr = function (base, fn) { - const fold = (base, index) => { - if (index == this.length) - return base - return fn(this[index], fold(base, index+1)) - } - return fold(base, 0) -} - -Array.prototype.foldl = function (base, fn) { - const fold = (base, index) => { - if (index == this.length) - return base - return fold(fn(this[index], base), index+1) - } - return fold(base, 0) -} - -Array.prototype.clone = function () { - return this.slice(0) -} - - - -/** - * Extensions to Set - */ - -Set.prototype.every = function (fn) { - for (const e of this) { - if (!fn(e)) return false - } - return true -} - -Set.prototype.some = function (fn) { - for (const e of this) { - if (fn(e)) return true - } - return false -} - -Set.prototype.clone = function () { - return new Set(this) -} - -Set.prototype.different = function (other) { - this.forEach(e => {if (other.has(e)) this.delete(e)}) - return this -} - -Set.prototype.intersect = function (other) { - this.forEach(e => {if (!other.has(e)) this.delete(e)}) - return this -} - -Set.prototype.union = function (other) { - other.forEach(e => this.add(e)) - return this -} - -Set.prototype.toJSON = function () { - return [...this] -} - -Set.prototype.foldr = function (base, fn) { - const tmp = [...this] - const fold = (base, index) => { - if (index == this.size) - return base - return fn(tmp[index], fold(base, index+1)) - } - return fold(base, 0) -} - -Set.prototype.foldl = function (base, fn) { - const tmp = [...this] - const fold = (base, index) => { - if (index == this.size) - return base - return fold(fn(tmp[index], base), index+1) - } - return fold(base, 0) -} - -Set.prototype.deleteall = function (fn) { - this.forEach(e => {if (fn(e)) this.delete(e)}) -} - -Set.prototype.find = function (fn) { - for (const e of this) { - if (fn(e)) return e - } - return null -} - -Set.intersect = function (a, b) { - let ret = a.clone() - ret.intersect(b) - return ret -} - -Set.union = function (a, b) { - let ret = a.clone() - ret.union(b) - return ret -} - - -/** - * Extensions to Map - */ - -Map.prototype.clone = function () { - return new Map(this) -} - -Map.prototype.every = function (fn) { - for (const [key, value] of this) { - if (!fn(value, key)) return false - } - return true -} - -Map.prototype.some = function (fn) { - for (const [key, value] of this) { - if (fn(value, key)) return true - } - return false -} - -Map.prototype.foldr = function (base, fn) { - const iter = this.entries() - const fold = base => { - const item = iter.next() - if (item.done) - return base - - // item.value = [key, val] - return fn(item.value[1], item.value[0], fold(base)) - } - return fold(base) -} - -Map.prototype.foldl = function (base, fn) { - const iter = this.entries() - const fold = base => { - const item = iter.next() - if (item.done) - return base - - // item.value = [key, val] - return fold(fn(item.value[1], item.value[0], base)) - } - return fold(base) -} - -Map.prototype.haskey = function (key) { - return this.has(key) -} - -Map.prototype.hasvalue = function (value) { - return this.some((v, k) => v === value) -} - -Map.prototype.toJSON = function () { - return [...this] -} diff --git a/BACKUP/node/endpoint.js b/BACKUP/node/endpoint.js deleted file mode 100644 index 4beea91..0000000 --- a/BACKUP/node/endpoint.js +++ /dev/null @@ -1,582 +0,0 @@ -"use strict" - -const nanomsg = require("nanomsg") -const uuidv4 = require("uuid/v4") -const util = require("util") - -const Mailbox = require("./mailbox.js") -const Sock = require("./socket.js") -const Msg = require("./msg.js") -const _ = require("./collections.js") -const Logger = require("./recorder.js") - -/** - * @ignore - */ -const sleep = ms => new Promise((resolve, reject) => setTimeout(resolve, ms)) - -/** - * An endpoint is an abstraction over sockets that provides session initiation, - * broadcasting, and linking/forwarding capabilities. - */ -class Endpoint { - - /** - * Construct an endpoint. - * - * @param {String} brokeraddr - The address of the broker device. - * @param {Array} roles - The roles - */ - constructor(brokeraddr, roles) { - - /** - * @type {uuid} - */ - this.id = uuidv4() - - /** - * A set of roles played by this endpoint. - * @type {Set} - */ - this.roles = new Set(roles) - - /** - * A mapping from roles to endpoint id's. - * @type {Map} - */ - this.peers = new Map() - - /** - * @type {Mailbox} - */ - this.mbox = new Mailbox(this) - - /** - * @type {String} - */ - this.brokeraddr = brokeraddr - - /** - * The broker loopback device, provided by the nanomsg. - * @type {nanomsg.Device} - */ - this.broker = null - - /** - * @type {Sock} - */ - this.sock = null - - /** - * @type {("init"|"ready"|"active"|"linking"|"closing")} - */ - this.state = "init" - - /** - * The default message handler. - * @param {Msg} msg - * @returns {Void} - */ - this.handler = msg => { - switch (this.state) { - case "init": - switch (msg.label) { - case "init": - if (this.roles.has(0)) - this.mbox.put(msg) - break - case "ready": - if (msg.receivers.includes(this.id)) - this.mbox.put(msg) - break - } - break - case "linking": - if (msg.receivers.includes(this.id)) - this.mbox.put(msg) - break - default: - if (this.peers.hasvalue(msg.sender) && msg.receivers.includes(this.id)) - this.mbox.put(msg) - break - } - } - - Logger.endpoint(this) - } - - /** - * @typedef {Object} Endpoint.JSON - * @property {uuid} id - * @property {Mailbox.JSON} mbox - * @property {Array} roles - * @property {Array>} peers - * @property {String} state - * @property {String} brokeraddr - */ - - /** - * @return {Endpoint.JSON} - */ - toJSON() { - return { - id: this.id, - mbox: this.mbox.toJSON(), - roles: this.roles.toJSON(), - peers: this.peers.toJSON(), - state: this.state, - brokeraddr: this.brokeraddr - } - } - - /** - * Synchronize with peers by waiting on all replys with the same - * label as the given message. - * - * @protected - * @param {Msg} msg - A message used to sync with peers. - * @param {Boolean} broadcast=true - Set to false to only wait on the replies, - * without sending the request. - * @return {Void} - */ - async _sync(msg, broadcast=true) { - if (broadcast) this._broadcast(msg) - - const label = msg.label - const responses = new Set([this.id]) - while (!this.peers.every((uuid, role) => responses.has(uuid))) { - const reply = this.mbox.match(new Msg(label, null, null)) - responses.add(reply.sender) - } - } - - /** - * Respond to a sync message, using a null payload and the original label. - * - * @protected - * @param {Msg} msg - * @return {Void} - */ - async _onsync(msg) { - const reply = new Msg(msg.label, this.id, null, [msg.sender]) - this.sock.send(reply) - Logger.send(reply) - } - - /** - * Coordinate the session initiation as a leader. - * - * @protected - * @param {Array} fullroles - The full set of roles. - * @return {Void} - * - * ##### Out-going Messages: - * ready {@link Msg.ReadyRequest} - * go {@link Msg.Go} - * - * ##### In-coming Messages: - * init {@link Msg.Init} - * ready {@link Msg.ReadyReply} - */ - async _init_leader(fullroles) { - // Init state. - this.peers.clear() - this.roles.forEach(role => this.peers.set(role, this.id)) - - // Gather all `init` messages. - while (!fullroles.every(role => this.peers.get(role))) { - const msg = await this.mbox.match(new Msg("init", null, null)) - - // Skip roles that intersect with our session. - const roles = new Set(msg.payload) - if (roles.some(role => this.peers.haskey(role))) continue - - // Add peer. - roles.forEach(role => this.peers.set(role, msg.sender)) - } - - // Ready state. - // Make sure everyone receives the peers map. - this.state = "ready" - await this._sync(Msg.Ready(this, this.peers)) - - // Active state. - this.state = "active" - this._broadcast(Msg.Go(this)) - Logger.endpoint(this) - } - - /** - * Coordinate the session initiation as a follower. - * - * @protected - * @param {Array} fullroles - * @return {Void} - * - * ##### Out-going Messages: - * init {@link Msg.Init} - * ready {@link Msg.ReadyReply} - * - * ##### In-coming Messages: - * ready {@link Msg.ReadyRequest} - * go {@link Msg.Go} - */ - async _init_follower(fullroles) { - // Init state - this.peers.clear() - - // Annouce itself. - const ping = setInterval(() => this._broadcast(Msg.Init(this)), 1000) - - // Getting the `ready` message. - const ready = await this.mbox.match(new Msg("ready", null, null)) - clearInterval(ping) - - this.state = "ready" - this.peers = new Map(ready.payload) - - // Reply `ready` to the leader, and wait for the `go`. - this._onsync(ready) - const go = await this.mbox.match(new Msg("go", ready.sender, null)) - - this.state = "active" - Logger.endpoint(this) - } - - /** - * Initiate a session. - * - * @param {Array} fullroles - The full set of roles. - * @return {Void} - */ - async init(fullroles) { - if (this.roles.has(0)) { - // Create a broker socket. - const brokersock = new Sock("bus", null, {raw: true}) - brokersock.bind(this.brokeraddr) - - // Make it a loopback device. - this.broker = nanomsg.device(brokersock.sock) - this.broker.on("error", e => { - console.error(e, e.stack.split("\n")) - }) - - // Connect to the broker. - this.sock = new Sock("bus", this) - this.sock.onmessage = this.handler - this.sock.connect(this.brokeraddr) - - // Init. - await this._init_leader(fullroles) - - } else { - // Connect to the broker. - this.sock = new Sock("bus", this) - this.sock.onmessage = this.handler - this.sock.connect(this.brokeraddr) - - // Init. - await this._init_follower(fullroles) - } - - // Remove left-over `init` - // this.mbox.clear(new Msg("init", null, null)) - } - - - /** - * Broadcast to all peers. For internal use. - * - * @protected - * @param {Msg} msg - * @return {Void} - */ - _broadcast(msg) { - this.sock.send(msg) - Logger.send(this, msg) - } - - /** - * Broadcast a payload to all peers. - * @param {Object} payload - JSON serializable object. - * @return {Void} - */ - broadcast(payload) { - const msg = new Msg("send", this.id, payload, new Set(this.peers.values())) - this._broadcast(msg) - } - - /** - * Receive a message from a particular sender. - * - * @param {Int} sender - The role of the sender. - * @return {Object} The message payload. - * - * ##### In-coming Messages: - * send {@link Msg.Send} - * link {@link Msg.LinkRequest} - */ - async receive(sender) { - const msg = await this.mbox.matchany([new Msg("send", this.peers.get(sender), null), - new Msg("link", null, null)]) - Logger.recv(this, msg) - switch (msg.label) { - case "send": - return msg.payload - case "link": - await this.onlink(msg) - return await this.receive(sender) - } - } - - /** - * Close all the sockets and mailboxes. - * - * Note that the device is not closed, since it can only be closed by `nanomsg.term()`. - * Also, when the roles are empty, the endpoint can be closed without syncing. - * - * @return {Void} - * - * ##### Out-going Messages: - * go {@link Msg.Go} - * - * ##### In-coming Messages: - * close {@link Msg.Close} - * link {@link Msg.LinkRequest} - */ - async close() { - - this.state = "closing" - Logger.endpoint(this) - - // When the role set is empty, we can directly close without syncing. - if (this.roles.size == 0) { - await sleep(5) - this.sock.close() - this.mbox.close() - Logger.closeendpoint(this) - return - } - - // Direct all followers into closing state. - await this._sync(Msg.Close(this)) - - const responses = new Set([this.id]) - - // Loop until every one is ready to be closed. - while (!this.peers.every((uuid, role) => responses.has(uuid))) { - const msg = await this.mbox.matchany([new Msg("close", null, null), - new Msg("link", null, null)]) - switch (msg.label) { - case "close": - responses.add(msg.sender) - continue - case "link": - await this.onlink(msg) - this.state = "closing" - Logger.endpoint(this) - continue - } - } - - // Close. - this._broadcast(Msg.Go(this)) - - // This delay is necessary since NN_LINGER is marked as "not implemented" by - // the nanomsg library. - await sleep(10) - - this.sock.close() - this.mbox.close() - - Logger.closeendpoint(this) - } - - /** - * Synchonoursly close the endpoint as a follower. This operation tries to sync - * with the broker (role 0) with a close message. When the broker collects all the "close", - * it will let all clients close. - * - * @param {Int} closer - The role of the closing endpoint. - * @return {Void} - * - * ##### Out-going Messages: - * close {@link Msg.Close) - * - * ##### In-coming Messages: - * go {@link Msg.Close} - * link {@link Msg.LinkRequest} - */ - async wait(closer) { - this.state = "closing" - this._send(null, closer, "close") - Logger.endpoint(this) - - // Wait for the closing signal. - const msg = await this.mbox.matchany([new Msg("go", this.peers.get(closer), null), - new Msg("link", null, null)]) - - switch (msg.label) { - case "go": - this.sock.close() - this.mbox.close() - Logger.closeendpoint(this) - break - case "link": - await this.onlink(msg) - await this.wait(closer) - break - } - } - - /** - * Cut with Spill. - * - * @param {Endpoint} ep1 - * @param {Endpoint} ep2 - * @return {Endpoint} - * - * Given `EP1` of roles `R1` and `EP2` with roles `R2`, - * the function will perform a cut-with-spill by: - * - * 1. Choose the (possibly) non-empty mailbox one as `KEEP`, and the other as `KILL`. - * 2. Set `KEEP` role to be `R1 \intersect R2`. - * 3. Connects the network involving `KILL` with the network involving `KEEP`. - * 4. Updates the peers in the combined network. - * - * During a cut of two endpoints, we are in the following situation (case-sensitive): - * - * {ep1, ...} <=> EP1 <- to be cut with -> EP2 <=> {ep2, ...} - * - * And at most one of (`EP1`, `EP2`)'s mailbox must be empty since: - * - * 1. All of the `ep` and `EP` should now be blocked on receive (or similar). - * 2. And based on the protocol, no two endpoints in the same session - * can send at the same time. - * 3. There must be someone that has performed all the send and - * then is blocked at a receive (or similar). - * 4. All others start from a receive. - * 5. As a result, if someone from `{ep1, ...}` sends, then `EP1` has non-empty mailbox. - * And correspondingly, `EP2` must contain the sending role, and therefore `EP2` has - * an empty mailbox, no matter the receiving role is in `EP2` or not. - * 6. This sending operation(s), should be considered incomplete, and should be replayed - * after the new session is formed. - * - * ##### In-coming Messages: - * link {@link Msg.LinkReply} - * linkready {@link Msg.LinkReadyReply} - * - * ##### Out-going Messages: - * link {@link Msg.LinkRequest} - * linkready {@link Msg.LinkReadyRequest} - * go {@link Msg.Go} - * - */ - static async link(ep1, ep2) { - // Direct all parties into the `linking` state. - await ep1._sync(Msg.Link(ep1)) - await ep2._sync(Msg.Link(ep2)) - - keep.state = "linking" - Logger.endpoint(keep) - - kill.state = "linking" - Logger.endpoint(kill) - - // We re-use the endpoint with non-empty mailbox - // for easier replay of "receive", etc. - const [kill, keep] = (await ep1.mbox.isempty()) ? [ep1, ep2] : [ep2, ep1] - - // New roles and new peers. - const roles = Set.intersect(ep1.roles, ep2.roles) - const peers = new Map() - - roles.forEach(role => peers.set(role, keep.id)) - ep1.peers.forEach((uuid, role) => { - if (!ep1.roles.has(role)) peers.set(role, uuid) - }) - ep2.peers.forEach((uuid, role) => { - if (!ep2.roles.has(role)) peers.set(role, uuid) - }) - - // Update to new peers. The new peer map includes essentially every one except `kill`. - keep.roles = roles - keep.peers = peers - Logger.endpoint(keep) - - // Broadcast new peers and broker addresses. - const mails = keep.mbox.mails() - keep._broadcast(Msg.LinkReady(keep, peers, [])) - kill._broadcast(Msg.LinkReady(keep, peers, mails)) - - // Wait until everyone is ready. - keep._sync(Msg.LinkReady(keep, peers, []), false) - - // Kill the endpoint manually. - kill.peers = new Map() - kill.roles = new Set() - await kill.close() - - // Activate. - keep.state = "active" - Logger.endpoint(keep) - - // Go. - keep._broadcast(Msg.Go(keep)) - return keep - } - - /** - * Respond to the `link` request. - * - * @param {Msg.LinkRequest} msg - * @return {Void} - * - * Handling the `link` message. The states to be changed include: - * - * * `peers`: Since we linked two endpoints, the peer map changed. - * * `brokeraddr`: - * Before linking, there were two leaders, and as a result, two devices. - * After linking, they will all be connected to one of the device, - * that originally belongs to the `KEEP`'s leader. - * - * ##### In-coming Messages - * link {@link Msg.LinkRequest} - * linkready {@link Msg.LinkReadyRequest} - * go {@link Msg.Go} - * - * ##### Out-going Messages - * link {@link Msg.LinkReply} - * linkready {@link Msg.LinkReadyReply} - */ - async onlink(link) { - // Sycn with the LinkRequest message. - this.state = "linking" - Logger.endpoint(this) - this._onsync(link) - - // Wait for the LinkReadyRequest message. - const linkready = await this.mbox.match(new Msg("linkready", link.sender, null)) - - // Doing the update. - this.peers = new Map(linkready.payload.peers) - if (linkready.payload.brokeraddr != this.brokeraddr) { - this.sock.disconnect(this.brokeraddr) - this.brokeraddr = linkready.payload.brokeraddr - this.sock.connect(this.brokeraddr) - } - - // Put forwarded mails in the mailbox. - linkready.payload.mails.forEach(m => this.mbox.put(m)) - - // Reply only back to the KEEP endpoint. - linkready.sender = linkready.payload.replyto - this._onsync(linkready) - - // Waiting for `go`. - await this.mbox.match(new Msg("go", null, null)) - this.state = "active" - Logger.endpoint(this) - } -} -module.exports = Endpoint \ No newline at end of file diff --git a/BACKUP/node/index.js b/BACKUP/node/index.js deleted file mode 100644 index 7b92769..0000000 --- a/BACKUP/node/index.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict" - -const nanomsg = require("nanomsg") -const fs = require("fs") -const chalk = require("chalk") -const util = require("util") - -const Endpoint = require("./endpoint.js") - -const sleep = ms => new Promise((resolve, reject) => setTimeout(resolve, ms)) - -async function test_subbus() { - - try { fs.unlinkSync("/tmp/devicea.ipc") } catch (e) { console.error(e) } - try { fs.unlinkSync("/tmp/deviceb.ipc") } catch (e) { console.error(e) } - - const epa = new Endpoint("ipc:///tmp/devicea.ipc", [0]) - const epb = new Endpoint("ipc:///tmp/devicea.ipc", [1]) - const epc = new Endpoint("ipc:///tmp/devicea.ipc", [2,3]) - - const epd = new Endpoint("ipc:///tmp/deviceb.ipc", [3]) - const epe = new Endpoint("ipc:///tmp/deviceb.ipc", [0,1,2]) - - const full = [0, 1, 2, 3] - - const proca = epa.init(full).then(async () => { - epa.broadcast("hello") - await epa.close() - console.info(chalk.red("Proc A closed.")) - }) - - const procb = epb.init(full).then(async () => { - const r = await epb.receive(0) - console.info(chalk.red("Proc B received: " + r)) - await epb.wait(0) - console.info(chalk.red("Proc B closed.")) - }) - - // const procc = epc.init(full).then(async () => { - // const r = await epc.receive(0) - // return await epc.wait(0) - // }) - - const procd = epd.init(full).then(async () => { - const r = await epd.receive(0) - console.info(chalk.yellow("Proc D received: " + r)) - await epd.wait(0) - console.info(chalk.yellow("Proc D closed.")) - }) - - const proc = Promise.all([epe.init(full), epc.init(full)]) - .then(async () => { - const ep = await Endpoint.link(epc, epe) - const r = await ep.receive(0) - console.info(chalk.green("Proc Link received: " + r)) - await ep.wait(0) - console.info(chalk.green("Proc Link closed.")) - }) - - const logger = require("./recorder.js") - setTimeout(() => { - console.log(JSON.stringify(logger.events())) - nanomsg.term() - process.exit() - }, 3000) - - await Promise.all([proca, procb, procd, proc]) - nanomsg.term() - console.info("Program exited.") - process.exit() -} - -try { - test_subbus() -} catch (e) { - console.log(e) - process.exit(1) -} - - diff --git a/BACKUP/node/jsdoc.conf b/BACKUP/node/jsdoc.conf deleted file mode 100644 index 52d3350..0000000 --- a/BACKUP/node/jsdoc.conf +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": ["plugins/markdown"], - "opts": { - "template": "node_modules/minami" - } -} \ No newline at end of file diff --git a/BACKUP/node/mailbox.js b/BACKUP/node/mailbox.js deleted file mode 100644 index a714010..0000000 --- a/BACKUP/node/mailbox.js +++ /dev/null @@ -1,347 +0,0 @@ -"use strict" - -const nanomsg = require("nanomsg") -const uuidv4 = require("uuid/v4") - -const _ = require("./collections.js") -const Sock = require("./socket.js") -const Msg = require("./msg.js") -const Logger = require("./recorder.js") - - -/** - * @ignore - */ -const sleep = ms => new Promise((resolve, reject) => setTimeout(resolve, ms)) - -/** - * A `MailboxWorker` that actually holds the "concurrent" buffer. - * - * The "concurrency" is achieved by queueing callbacks for mailbox commands - * like "put" and "match". Many commands may arraive concurrently, but will be - * serialized by the NodeJS core. Callbacks will then be invoked in order, and - * will not be interrupted unless the callback yields at `await`. - * - * @package - */ -class MailboxWorker { - - /** - * @param {Mailbox} parent - The owning mailbox. - * @param {String} addr - Socket address to connect to. - * @return {MailboxWorker} - */ - constructor(parent, addr) { - /** - * @type {Mailbox} - */ - this.parent = parent - - /** - * @type {Array} - */ - this.mbox = [] - - /** - * @type {Sock} - */ - this.sock = new Sock("pair") - - this.sock.connect(addr) - this.sock.onmessage = msg => this.dispatch(msg) - } - - /** - * Handles the "put" command. - * - * @param {Mailbox.Put} msg - * @return {Void} - */ - onput(msg) { - this.mbox.push(msg.payload) - Logger.mailbox(this.parent) - } - - /* - * @callback Mailbox.Predicate - * @param {Msg} m - The message to check. - * @return {Boolean} `true` if the message matches the pattern. - */ - - /** - * Build a pattern checking function out of a given example. - * - * @protected - * @param {Msg} msg - An example message, showing the label/sender to match. - * @return {Mailbox.Predicate} - */ - _condition(msg) { - const label = msg.label - const sender = msg.sender - - if (label && sender) - return m => m.label == label && m.sender == sender - else if (label) - return m => m.label == label - else if (sender) - return m => m.sender == sender - else - throw new Error("No conditions given when trying to match a message from the mailbox.") - } - - /** - * Build an alternative patterns checking function out of a list of given examples. - * - * @protected - * @param {Array} msgs - An array of example messages. - * @return {Mailbox.Predicate} A function that checks if the message matches any of the patterns. - */ - _conditions(msgs) { - const base = m => false - const fn = (msg, conds) => { return m => this._condition(msg)(m) || conds(m) } - const conds = msgs.foldr(base, fn) - - return conds - } - - /** - * Handles "match" command. - * - * @param {Mailbox.Match} msg - * @return {Msg} Return the earliest message that matches any of the example messages. - */ - async onmatch(msg) { - const conds = this._conditions(msg.payload) - - while (true) { - let index = this.mbox.findIndex(conds) - while (index < 0) { - await sleep(1) - index = this.mbox.findIndex(conds) - } - - const ret = this.mbox.splice(index, 1)[0] - Logger.mailbox(this.parent) - return ret - } - } - - /** - * Close the mailbox. - * - * @return {Void} - */ - onclose() { - delete this.mbox - this.sock.close() - } - - /** - * Clear all the messages that match the pattern. - * - * @param {Mailbox.Clear} msg - * @return {Void} - */ - onclear(msg) { - const cond = this._condition(msg.payload) - this.mbox = this.mbox.filter(m => !cond(m)) - - Logger.mailbox(this.parent) - } - - /** - * Dispatch commands. - * - * This function "returns" by sending a reply message. - * - * @param {(Mailbox.Put|Mailbox.Match|Mailbox.Close|Mailbox.Clear|Mailbox.Size)} msg - * @return {Void|Msg} - */ - async dispatch(msg) { - switch (msg.label) { - case "put": - this.onput(msg) - break - case "match": - this.sock.send(await this.onmatch(msg)) - break - case "close": - this.onclose() - break - case "size": - this.sock.send(this.mbox.length) - break - case "clear": - this.onclear(msg) - break - } - } -} - - -/** - * An Erlang-style concurrent mailbox that supports pattern matching. - */ -class Mailbox { - - /** - * @param {Endpoint} ep - The endpoint who owns the mailbox. - * @return {Mailbox} - */ - constructor(ep) { - /** - * @type {Endpoint} - */ - this.endpoint = ep - - /** - * @type {String} - */ - this.addr = `inproc://${uuidv4()}` - - /** - * @type {Sock} - */ - this.sock = new Sock("pair") - this.sock.bind(this.addr) - - /** - * @type {MailboxWorker} - */ - this.worker = new MailboxWorker(this, this.addr) - - Logger.mailbox(this) - } - - /** - * @typedef {Msg} Mailbox.Match - * @property {"match"} label - * @property {Array} payload - The messages to match. - */ - - /** - * @typedef {Msg} Mailbox.Put - * @property {"put"} label - * @property {Msg} payload - The message to put. - */ - - /** - * @typedef {Msg} Mailbox.Clear - * @property {"clear"} label - * @property {Msg} payload - The message to match and clear. - */ - - /** - * @typedef {Msg} Mailbox.Size - * @property {"size"} label - */ - - /** - * @typedef {Msg} Mailbox.Close - * @property {"close"} label - */ - - /** - * Put a message into the mailbox. - * - * @param {Msg} msg - * @return {Void} - */ - put(msg) { - this.sock.send(new Msg("put", null, msg)) - } - - /** - * Get the earliest message that matches the given example. - * The example message will show the intended label and/or sender. - * - * @async - * @param {Msg} msg - An example message showing the intended label and/or sender. - * @return {Msg} - */ - match(msg) { - return this.matchany([msg]) - } - - /** - * Get the earliest message that matches one of the given examples. - * - * @async - * @param {Array} msgs - * @return {Msg} - */ - matchany(msgs) { - let request = new Promise((resolve, reject) => { - this.sock.onmessage = msg => resolve(msg) - this.sock.send(new Msg("match", null, msgs)) - }) - - return request - } - - /** - * Delete all the messages that match the given example. - * - * @param {Msg} msg - * @return {Void} - */ - clear(msg) { - this.sock.send(new Msg("clear", null, msg)) - } - - /** - * Close the mailbox. - * - * @return {Void} - */ - close() { - this.sock.send(new Msg("close", null, null)) - this.sock.close() - - Logger.closemailbox(this) - } - - /** - * Check if the mailbox is empty. - * - * @return {Boolean} `true` if the mailbox is empty, `false` otherwise. - */ - isempty() { - return new Promise((resolve, reject) => { - this.sock.onmessage = msg => resolve(msg == 0) - this.sock.send(new Msg("size", null, null)) - }) - } - - /** - * Get a copy of all the mails in the mailbox. - * - * @return {Array} - */ - mails() { - return this.worker.mbox.clone() - } - - /** - * @typedef {Object} Mailbox.JSON - * @property {String} id - The address of the mailbox, which is uniquely generated as an uuid. - * @property {uuid} endpoint - The id of the owning endpoint. - * @property {Array} mails - */ - - /** - * @return {Mailbox.JSON} - */ - toJSON() { - return { - id: this.addr, - endpoint: this.endpoint.id, - mails: this.worker.mbox.clone() - } - } - -} - -module.exports = Mailbox - - diff --git a/BACKUP/node/msg.js b/BACKUP/node/msg.js deleted file mode 100644 index cdb1381..0000000 --- a/BACKUP/node/msg.js +++ /dev/null @@ -1,210 +0,0 @@ -/** - * A common message format. - */ -class Msg { - - /** - * @param {("init"|"ready"|"link"|"linkready"|"go"|"send"|"close")} label - * @param {uuid} sender - * @param {Object} payload - * @param {Array} receivers=null - * @return {Msg} - */ - constructor(label, sender, payload, receivers = []) { - this.label = label - this.sender = sender - this.payload = payload - this.receivers = receivers - } - - /** - * Broadcasting message for announcing the existence of an endpoint. - * Used to initiate a session. - * - * @typedef {Msg} Msg.Init - * @property {"init"} label - * @property {uuid} sender - Announce the endpoint id. - * @property {Array} payload - The roles played by the endpoint. - * @property {Array} receivers - Empty array. - */ - - /** - * Init message. - * @param {Endpoint} ep - * @return {Msg.Init} - */ - static Init(ep) { - return new Msg("init", ep.id, ep.roles) - } - - /** - * This message is for the leader to get all followers ready by supplying the peer map. - * - * @typedef {Msg} Msg.ReadyRequest - * @property {"ready"} label - * @property {uuid} sender - * @property {Map} payload - The peers map as determined by the leader. - * @property {Array} receivers - All the intended receivers - */ - - /** - * The follower announce to the leader that it is ready. - * - * @typedef {Msg} Msg.ReadyReply - * @property {"ready"} label - * @property {uuid} sender - * @property {null} payload - The peers map as determined by the leader. - * @property {Array} receivers - One element array containing the leader's id. - */ - - /** - * ReadyRequest message. - * @param {Endpoint} ep - * @param {Map} peers - * @return {Msg.ReadyRequest} - */ - static Ready(ep, peers) { - return new Msg("ready", ep.id, peers, new Set(peers.values())) - } - - /** - * This message is for the leader to green light all followers. - * - * @typedef {Msg} Msg.Go - * @property {"go"} label - * @property {uuid} sender - * @property {null} payload - * @property {Array} receivers - All the intended receivers - */ - - /** - * Go message. - * @param {Endpoint} ep - * @return {Msg.Go} - */ - static Go(ep) { - return new Msg("go", ep.id, null, new Set(ep.peers.values())) - } - - /** - * The primary data message being exchanged. - * - * @typedef {Msg} Msg.Send - * @property {"send"} label - * @property {uuid} sender - * @property {Object} payload - JSON serializable object. - * @property {Array} receivers - */ - - /** - * Ack for the previous "send", used to implement synchrounus "send". - * - * @typedef {Msg} Msg.Recv - * @property {"recv"} label - * @property {uuid} sender - * @property {null} payload - JSON serializable object. - * @property {Array} receivers - One element array that contains the sender's uuid. - */ - - /** - * The message to direct everyone into the linking state. - * - * @typedef {Msg} Msg.LinkRequest - * @property {"link"} label - * @property {uuid} sender - * @property {null} payload - * @property {Array} receivers - */ - - /** - * The message to acknowledge that it is in the linking state. - * - * @typedef {Msg} Msg.LinkReply - * @property {"link"} label - * @property {uuid} sender - * @property {null} payload - * @property {Array} receivers - One element array containing the original requester. - */ - - /** - * LinkRequest message. - * @param {Endpoint} ep - */ - static Link(ep) { - return new Msg("link", ep.id, null, new Set(ep.peers.values())) - } - - /** - * The message to updates the peer map. - * - * @typedef {Msg} Msg.LinkReadyRequest - * @property {"linkready"} label - * @property {uuid} sender - * @property {Array} receivers - * - * @property {Object} payload - * @property {String} payload.brokeraddr - The new broker address to connect to. - * @property {Map} payload.peers - The new peer map. - * @property {uuid} payload.replyto - The coordinator for this link. - */ - - /** - * The message to acknowledge that the the follower is updated. - * - * @typedef {Msg} Msg.LinkReadyReply - * @property {"linkready"} label - * @property {uuid} sender - * @property {null} payload - * @property {Array} receivers - One element array containing the link initiator. - */ - - /** - * LinkReady message. - * @param {Endpoint} keep - The endpoint to keep in a link. - * @param {Map} peers - * @param {Array} mails - * @return {Msg.LinkReady} - */ - static LinkReady(keep, peers, mails) { - return new Msg("linkready", - keep.id, - {brokeraddr: keep.brokeraddr, peers: peers, replyto: keep.id, mails: mails}, - new Set(peers.values())) - } - - - /** - * The message is used by the leader to request to close. - * - * @typedef {Msg} Msg.CloseRequest - * @property {"close"} label - * @property {uuid} sender - * @property {null} payload - * @property {Array} receivers - */ - - /** - * The message is used by followers to acknowledge to close. - * - * @typedef {Msg} Msg.CloseReply - * @property {"close"} label - * @property {uuid} sender - * @property {null} payload - * @property {Array} receivers - A single element array containing the closer's endpoint id. - */ - - /** - * CloseRequest - * @param {Endpoint} ep - * @return {Msg.CloseRequest} - */ - static Close(ep) { - return new Msg("close", ep.id, null, new Set(ep.peers.values())) - } -} - - - - - -module.exports = Msg \ No newline at end of file diff --git a/BACKUP/node/out/Consensus.html b/BACKUP/node/out/Consensus.html deleted file mode 100644 index b8f524d..0000000 --- a/BACKUP/node/out/Consensus.html +++ /dev/null @@ -1,848 +0,0 @@ - - - - - - Consensus - Documentation - - - - - - - - - - - - - - - - - -
- -

Consensus

- - - - - - - -
- -
- -

- Consensus -

- -

Simple leader election.

- - -
- -
-
- - -
- - -

Constructor

- - -

new Consensus(sock, id, metadata, callback)

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
sock - - -Socket - - - - -

a pre-connected bus socket

- -
id - - -uuid - - - - -

the uuid of myself

- -
metadata - - -object - - - - -

anything that's attached to this id

- -
callback - - -function - - - - -

invoked when it becomes leader, or when leader sends first command

- -
- - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

on_message(msg)

- - - - - -
-

On consensus messages or leader commands

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg - - - - - - -
- - - - - - - - - - - - - - - - -
- - -
- - - -

on_timeout()

- - - - - -
-

Election timeouts

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - -

ping()

- - - - - -
-

Send ping messages to gossip what metadata I have

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - -

reset_timer()

- - - - - -
-

Reset the election timer

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - -

syncmeta(meta, receivers)

- - - - - -
-

As a leader, send out a sync command to sync metadata about all the members.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
meta - - -Object - - - - -

metadata to by synced

- -
receivers - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Wed Dec 27 2017 11:46:58 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/Endpoint.html b/BACKUP/node/out/Endpoint.html deleted file mode 100644 index 2138cd8..0000000 --- a/BACKUP/node/out/Endpoint.html +++ /dev/null @@ -1,3070 +0,0 @@ - - - - - - Endpoint - Documentation - - - - - - - - - - - - - - - - - -
- -

Endpoint

- - - - - - - -
- -
- -

- Endpoint -

- -

An endpoint is an abstraction over sockets that provides session initiation, -broadcasting, and linking/forwarding capabilities.

- - -
- -
-
- - -
- - -

Constructor

- - -

new Endpoint(brokeraddr, roles)

- - - - - -
-

Construct an endpoint.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brokeraddr - - -String - - - - -

The address of the broker device.

- -
roles - - -Array.<Int> - - - - -

The roles

- -
- - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - -

Members

- - - -
-

broker :nanomsg.Device

- - - - -
-

The broker loopback device, provided by the nanomsg.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -nanomsg.Device - - -
  • -
- - - - - -
- - - -
-

brokeraddr :String

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -String - - -
  • -
- - - - - -
- - - -
-

id :uuid

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -uuid - - -
  • -
- - - - - -
- - - -
-

mbox :Mailbox

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

peers :Map.<Int, uuid>

- - - - -
-

A mapping from roles to endpoint id's.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Map.<Int, uuid> - - -
  • -
- - - - - -
- - - -
-

roles :Set.<Int>

- - - - -
-

A set of roles played by this endpoint.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Set.<Int> - - -
  • -
- - - - - -
- - - -
-

sock :Sock

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

state :"init"|"ready"|"active"|"linking"|"closing"

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -"init" -| - -"ready" -| - -"active" -| - -"linking" -| - -"closing" - - -
  • -
- - - - - -
- - - - - -

Methods

- - - -
- - - - - - - - - -
-

Cut with Spill.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
ep1 - - -Endpoint - - - - - - -
ep2 - - -Endpoint - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Endpoint - - -
-
- - -
-

Given EP1 of roles R1 and EP2 with roles R2, -the function will perform a cut-with-spill by:

-
    -
  1. Choose the (possibly) non-empty mailbox one as KEEP, and the other as KILL.
  2. -
  3. Set KEEP role to be R1 \intersect R2.
  4. -
  5. Connects the network involving KILL with the network involving KEEP.
  6. -
  7. Updates the peers in the combined network.
  8. -
-

During a cut of two endpoints, we are in the following situation (case-sensitive):

-
{ep1, ...} <=> EP1  <- to be cut with -> EP2 <=> {ep2, ...}

And at most one of (EP1, EP2)'s mailbox must be empty since:

-
    -
  1. All of the ep and EP should now be blocked on receive (or similar).
  2. -
  3. And based on the protocol, no two endpoints in the same session -can send at the same time.
  4. -
  5. There must be someone that has performed all the send and -then is blocked at a receive (or similar).
  6. -
  7. All others start from a receive.
  8. -
  9. As a result, if someone from {ep1, ...} sends, then EP1 has non-empty mailbox. -And correspondingly, EP2 must contain the sending role, and therefore EP2 has -an empty mailbox, no matter the receiving role is in EP2 or not.
  10. -
  11. This sending operation(s), should be considered incomplete, and should be replayed -after the new session is formed.
  12. -
-
In-coming Messages:
link: Msg.LinkReply
Out-going Messages:
link: Msg.LinkRequest
-go:   Msg.Go
-
- - -
- - - -
- - -
- - - -

(async, protected) _init_follower(fullroles) → {Void}

- - - - - -
-

Coordinate the session initiation as a follower.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fullroles - - -Array.<Int> - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - -
-
Out-going Messages:
init  Msg.Init
-ready Msg.ReadyReply
In-coming Messages:
ready Msg.ReadyRequest
-go    Msg.Go
-
- - -
- - - -
- - -
- - - -

(async, protected) _init_leader(fullroles) → {Void}

- - - - - -
-

Coordinate the session initiation as a leader.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fullroles - - -Array.<Int> - - - - -

The full set of roles.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - -
-
Out-going Messages:
ready Msg.ReadyRequest
-go    Msg.Go
In-coming Messages:
init  Msg.Init
-ready Msg.ReadyReply
-
- - -
- - - -
- - -
- - - -

(protected) _send(payload, receiver, label) → {Void}

- - - - - -
-

Send a message to a specific receiver.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
payload - - -Object - - - - - - -

JSON serializable object.

- -
receiver - - -uuid - - - - - - -

A single receiver. This is the uuid, since during link, the - endpoint may send to an out-of-session party.

- -
label - - -String - - - - - - "send" - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

broadcast(payload, label) → {void}

- - - - - -
-

Broadcast a payload to all peers.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
payload - - -Object - - - - - - -

JSON serializable object.

- -
label - - -String - - - - - - "send" - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -void - - -
-
- - - -
- - - -
- - -
- - - -

(async) close() → {Void}

- - - - - -
-

Close all the sockets and mailboxes.

-

Note that the device is not closed, since it can only be closed by nanomsg.term().

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - -
-
Out-going Messages:
go    Msg.Go
In-coming Messages:
close Msg.Close
-link  Msg.LinkRequest
-
- - -
- - - -
- - -
- - - -

handler(msg) → {Void}

- - - - - -
-

The default message handler.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

(async) init(fullroles) → {Void}

- - - - - -
-

Initiate a session.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fullroles - - -Array.<Int> - - - - -

The full set of roles.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - - - - - - - -
-

Respond to the link request.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg.LinkRequest - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - -
-

Handling the link message. The states to be changed include:

-
    -
  • peers: Since we linked two endpoints, the peer map changed.
  • -
  • brokeraddr: - Before linking, there were two leaders, and as a result, two devices. - After linking, they will all be connected to one of the device, - that originally belongs to the KEEP's leader.
  • -
-
In-coming Messages
link Msg.LinkRequest
-go   Msg.Go
Out-going Messages
link Msg.LinkReply
-
- - -
- - - -
- - -
- - - -

(async) receive(sender) → {Object}

- - - - - -
-

Receive a message from a particular sender.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
sender - - -Int - - - - -

The role of the sender.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Object - - -
-
- - -
-

The message payload.

-
In-coming Messages:
send Msg.Send
-link Msg.LinkRequest
-
- - -
- - - -
- - -
- - - -

toJSON() → {Endpoint.JSON}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Endpoint.JSON - - -
-
- - - -
- - - -
- - -
- - - -

(async) wait(closer) → {Void}

- - - - - -
-

Synchonoursly close the endpoint as a follower. This operation tries to sync -with the broker (role 0) with a close message. When the broker collects all the "close", -it will let all clients close.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
closer - - -Int - - - - -

The role of the closing endpoint.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - -
-
Out-going Messages:
close Messages:
go    link  {@link Msg.LinkRequest
-
- - -
- - - -
- - - - -

Type Definitions

- - - -
-

JSON

- - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -uuid - - - -
mbox - - -Mailbox.JSON - - - -
roles - - -Array.<Int> - - - -
peers - - -Array.<Tuple.<Int, uuid>> - - - -
state - - -String - - - -
brokeraddr - - -String - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Object - - -
  • -
- - - - - -
- - - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/Mailbox.html b/BACKUP/node/out/Mailbox.html deleted file mode 100644 index b06e664..0000000 --- a/BACKUP/node/out/Mailbox.html +++ /dev/null @@ -1,2428 +0,0 @@ - - - - - - Mailbox - Documentation - - - - - - - - - - - - - - - - - -
- -

Mailbox

- - - - - - - -
- -
- -

- Mailbox -

- -

An Erlang-style concurrent mailbox that supports pattern matching.

- - -
- -
-
- - -
- - -

Constructor

- - -

new Mailbox(ep)

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
ep - - -Endpoint - - - - -

The endpoint who owns the mailbox.

- -
- - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - -

Members

- - - -
-

addr :String

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -String - - -
  • -
- - - - - -
- - - -
-

endpoint :Endpoint

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

sock :Sock

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

worker :MailboxWorker

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - - - -

Methods

- - - -
- - - -

clear(msg) → {Void}

- - - - - -
-

Delete all the messages that match the given example.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

close() → {Void}

- - - - - -
-

Close the mailbox.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

isempty() → {Boolean}

- - - - - -
-

Check if the mailbox is empty.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Boolean - - -
-
- - -
-

true if the mailbox is empty, false otherwise.

-
- - -
- - - -
- - -
- - - -

mails() → {Array.<Msg>}

- - - - - -
-

Get a copy of all the mails in the mailbox.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Array.<Msg> - - -
-
- - - -
- - - -
- - -
- - - -

(async) match(msg) → {Msg}

- - - - - -
-

Get the earliest message that matches the given example. -The example message will show the intended label and/or sender.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg - - - - -

An example message showing the intended label and/or sender.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Msg - - -
-
- - - -
- - - -
- - -
- - - -

(async) matchany(msgs) → {Msg}

- - - - - -
-

Get the earliest message that matches one of the given examples.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msgs - - -Array.<Msg> - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Msg - - -
-
- - - -
- - - -
- - -
- - - -

put(msg) → {Void}

- - - - - -
-

Put a message into the mailbox.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

toJSON() → {Mailbox.JSON}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Mailbox.JSON - - -
-
- - - -
- - - -
- - - - -

Type Definitions

- - - -
-

Clear

- - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"clear" - - - -
payload - - -Msg - - - -

The message to match and clear.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

Close

- - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"close" - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

JSON

- - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - -

The address of the mailbox, which is uniquely generated as an uuid.

endpoint - - -uuid - - - -

The id of the owning endpoint.

mails - - -Array.<Msg> - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Object - - -
  • -
- - - - - -
- - - -
-

Match

- - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"match" - - - -
payload - - -Array.<Msg> - - - -

The messages to match.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

Put

- - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"put" - - - -
payload - - -Msg - - - -

The message to put.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

Size

- - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"size" - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/MailboxWorker.html b/BACKUP/node/out/MailboxWorker.html deleted file mode 100644 index 9f0033d..0000000 --- a/BACKUP/node/out/MailboxWorker.html +++ /dev/null @@ -1,1538 +0,0 @@ - - - - - - MailboxWorker - Documentation - - - - - - - - - - - - - - - - - -
- -

MailboxWorker

- - - - - - - -
- -
- -

- MailboxWorker -

- -

A MailboxWorker that actually holds the "concurrent" buffer.

-

The "concurrency" is achieved by queueing callbacks for mailbox commands -like "put" and "match". Many commands may arraive concurrently, but will be -serialized by the NodeJS core. Callbacks will then be invoked in order, and -will not be interrupted unless the callback yields at await.

- - -
- -
-
- - -
- - -

Constructor

- - -

(package) new MailboxWorker(parent, addr)

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
parent - - -Mailbox - - - - -

The owning mailbox.

- -
addr - - -String - - - - -

Socket address to connect to.

- -
- - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - -

Members

- - - -
-

mbox :Array

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

parent :Mailbox

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

sock :Sock

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - - - -

Methods

- - - -
- - - -

(protected) _condition(msg) → {Mailbox.Predicate}

- - - - - -
-

Build a pattern checking function out of a given example.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg - - - - -

An example message, showing the label/sender to match.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Mailbox.Predicate - - -
-
- - - -
- - - -
- - -
- - - -

(protected) _conditions(msgs) → {Mailbox.Predicate}

- - - - - -
-

Build an alternative patterns checking function out of a list of given examples.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msgs - - -Array.<Msg> - - - - -

An array of example messages.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Mailbox.Predicate - - -
-
- - -
-

A function that checks if the message matches any of the patterns.

-
- - -
- - - -
- - -
- - - -

(async) dispatch(msg) → {Void|Msg}

- - - - - -
-

Dispatch commands.

-

This function "returns" by sending a reply message.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Mailbox.Put -| - -Mailbox.Match -| - -Mailbox.Close -| - -Mailbox.Clear -| - -Mailbox.Size - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void -| - -Msg - - -
-
- - - -
- - - -
- - -
- - - -

onclear(msg) → {Void}

- - - - - -
-

Clear all the messages that match the pattern.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Mailbox.Clear - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

onclose() → {Void}

- - - - - -
-

Close the mailbox.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

(async) onmatch(msg) → {Msg}

- - - - - -
-

Handles "match" command.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Mailbox.Match - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Msg - - -
-
- - -
-

Return the earliest message that matches any of the example messages.

-
- - -
- - - -
- - -
- - - -

onput(msg) → {Void}

- - - - - -
-

Handles the "put" command.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Mailbox.Put - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/Msg.html b/BACKUP/node/out/Msg.html deleted file mode 100644 index fdcf45d..0000000 --- a/BACKUP/node/out/Msg.html +++ /dev/null @@ -1,2070 +0,0 @@ - - - - - - Msg - Documentation - - - - - - - - - - - - - - - - - -
- -

Msg

- - - - - - - -
- -
- -

- Msg -

- -

A common message format.

- - -
- -
-
- - -
- - -

Constructor

- - -

new Msg(label, sender, payload, receivers)

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
label - - -"init" -| - -"ready" -| - -"go" -| - -"send" -| - -"link" -| - -"close" - - - - - - - - -
sender - - -uuid - - - - - - - - -
payload - - -Object - - - - - - - - -
receivers - - -Array.<uuid> - - - - - - null - - - - -
- - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - -

Type Definitions

- - - -
-

Close

- - - - -
-

The message is used by followers to request to close.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"close" - - - -
sender - - -uuid - - - -
payload - - -null - - - -
receivers - - -Array.<uuid> - - - -

A single element array containing the closer's endpoint id.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

Go

- - - - -
-

This message is for the leader to green light all followers.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"go" - - - -
sender - - -uuid - - - -
payload - - -null - - - -
receivers - - -Array.<uuid> - - - -

All the intended receivers

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

Init

- - - - -
-

Broadcasting message for announcing the existence of an endpoint. -Used to initiate a session.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"init" - - - -
sender - - -uuid - - - -

Announce the endpoint id.

payload - - -Array.<Int> - - - -

The roles played by the endpoint.

receivers - - -Array.<uuid> - - - -

Empty array.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

LinkReply

- - - - -
-

The message to acknowledge that the sender is ready to go after a link.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"link" - - - -
sender - - -uuid - - - -
payload - - -null - - - -
receivers - - -Array.<uuid> - - - -

One element array containing the link initiator.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

LinkRequest

- - - - -
-

The message to initiate a link operation.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Properties
- -
NameTypeDescription
label - - -"link" - - - -
sender - - -uuid - - - -
receivers - - -Array.<uuid> - - - -
payload - - -Object - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brokeraddr - - -String - - - -

The new broker address to connect to.

peers - - -Map.<Int, uuid> - - - -

The new peer map.

replyto - - -uuid - - - -

The coordinator for this link.

- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

ReadyReply

- - - - -
-

The follower announce to the leader that it is ready.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"ready" - - - -
sender - - -uuid - - - -
payload - - -Map.<Int, uuid> - - - -

The peers map as determined by the leader.

receivers - - -Array.<uuid> - - - -

One element array containing the leader's id.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

ReadyRequest

- - - - -
-

This message is for the leader to get all followers ready by supplying the peer map.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"ready" - - - -
sender - - -uuid - - - -
payload - - -Map.<Int, uuid> - - - -

The peers map as determined by the leader.

receivers - - -Array.<uuid> - - - -

All the intended receivers

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - -
-

Send

- - - - -
-

The primary data message being exchanged.

-
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -"send" - - - -
sender - - -uuid - - - -
payload - - -Object - - - -

JSON serializable object.

receivers - - -Array.<uuid> - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -Msg - - -
  • -
- - - - - -
- - - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/SessionEvent.html b/BACKUP/node/out/SessionEvent.html deleted file mode 100644 index f97eb18..0000000 --- a/BACKUP/node/out/SessionEvent.html +++ /dev/null @@ -1,553 +0,0 @@ - - - - - - SessionEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

SessionEvent

- - - - - - - -
- -
- -

- SessionEvent -

- -

A session event with label, data, and timestamp.

-

{ep, {id, state, peer, roles}}

- - -
- -
-
- - -
- - -

Constructor

- - -

new SessionEvent()

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

(static) Recv(f, t, msg)

- - - - - -
-

[Recv description]

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
f - - -uuid - - - - -

[description]

- -
t - - -uuid - - - - -

[description]

- -
msg - - -Msg - - - - -

[description]

- -
- - - - - - - - - - - - - - - - -
- - -
- - - -

(static) Send(f, ts, msg)

- - - - - -
-

[Send description]

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
f - - -uuid - - - - -

[description]

- -
ts - - -Array.<uuid> - - - - -

[description]

- -
msg - - -Msg - - - - -

[description]

- -
- - - - - - - - - - - - - - - - -
- - - - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/Sock.html b/BACKUP/node/out/Sock.html deleted file mode 100644 index 832eb13..0000000 --- a/BACKUP/node/out/Sock.html +++ /dev/null @@ -1,1481 +0,0 @@ - - - - - - Sock - Documentation - - - - - - - - - - - - - - - - - -
- -

Sock

- - - - - - - -
- -
- -

- Sock -

- -

A warpper for socket implementations.

- - -
- -
-
- - -
- - -

Constructor

- - -

new Sock(proto, ep, opts)

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
proto - - -String - - - - - - -

SP protocol string. Could be "bus", "pair", etc.

- -
ep - - -Endpoint - - - - - - -

Owning endpoint.

- -
opts - - -Object - - - - - - {} - - -

Options for the socket. e.g. {raw: true}

- -
- - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - -

Members

- - - -
-

endpoint :Endpoint

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

handler :Sock.Handler

- - - - -
-

A copy of the installed handler.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
- - - - - - -
- - - -
-

onmessage

- - - - -
-

Set/Get the message handler.

-

When installing, all previously installed handler will be replaced.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - -
- - - -
-

sock :nanomsg.Socket

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - -
Type:
-
    -
  • - -nanomsg.Socket - - -
  • -
- - - - - -
- - - - - -

Methods

- - - -
- - - -

bind(addr) → {Int}

- - - - - -
-

Bind the address.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
addr - - -String - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Int - - -
-
- - -
-

A nanomsg endpoint id. Returns -1 on error.

-
- - -
- - - -
- - -
- - - -

close() → {Void}

- - - - - -
-

Close the socket.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - -
- - - -

connect(addr) → {Int}

- - - - - -
-

Connect to an address.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
addr - - -String - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Int - - -
-
- - -
-

A nanomsg endpoint id. Returns -1 on error.

-
- - -
- - - -
- - -
- - - -

disconnect(addr) → {Int}

- - - - - -
-

Disconnect from an address.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
addr - - -String - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Int - - -
-
- - -
-

A nanomsg endpoint id. Returns -1 if the address is not previously connected.

-
- - -
- - - -
- - -
- - - -

send(payload) → {Int}

- - - - - -
-

Send a payload via the sokcet.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
payload - - -Object - - - - -

A JSON-serializable payload.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Int - - -
-
- - -
-

Actual bytes sent.

-
- - -
- - - -
- - - - -

Type Definitions

- - - -
- - - -

Handler(msg) → {Void}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
msg - - -Msg - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Void - - -
-
- - - -
- - - -
- - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/collections.js.html b/BACKUP/node/out/collections.js.html deleted file mode 100644 index 97b2600..0000000 --- a/BACKUP/node/out/collections.js.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - collections.js - Documentation - - - - - - - - - - - - - - - - - -
- -

collections.js

- - - - - - - -
-
-
"use strict"
-
-/**
- * Extensions to Array
- */
-
-Array.prototype.foldr = function (base, fn) {
-	const fold = (base, index) => {
-		if (index == this.length) 
-			return base
-		return fn(this[index], fold(base, index+1))
-	}
-	return fold(base, 0)
-}
-
-Array.prototype.foldl = function (base, fn) {
-	const fold = (base, index) => {
-		if (index == this.length)
-			return base 
-		return fold(fn(this[index], base), index+1)
-	}
-	return fold(base, 0)
-}
-
-Array.prototype.clone = function () {
-	return this.slice(0)
-}
-
-
-
-/**
- * Extensions to Set
- */
-
-Set.prototype.every = function (fn) {
-	for (const e of this) {
-		if (!fn(e))	return false 
-	}
-	return true 
-}
-
-Set.prototype.some = function (fn) {
-	for (const e of this) {
-		if (fn(e)) return true
-	}
-	return false 
-}
-
-Set.prototype.clone = function () {
-	return new Set(this)
-}
-
-Set.prototype.different = function (other) { 
-	this.forEach(e => {if (other.has(e)) this.delete(e)})
-	return this 
-}
-
-Set.prototype.intersect = function (other) {
-	this.forEach(e => {if (!other.has(e)) this.delete(e)})
-	return this
-}
-
-Set.prototype.union = function (other) {
-	other.forEach(e => this.add(e))
-	return this
-}
-
-Set.prototype.toJSON = function () {
-	return [...this]
-}
-
-Set.prototype.foldr = function (base, fn) {
-	const tmp = [...this]
-	const fold = (base, index) => {
-		if (index == this.size) 
-			return base
-		return fn(tmp[index], fold(base, index+1))
-	}
-	return fold(base, 0)
-}
-
-Set.prototype.foldl = function (base, fn) {
-	const tmp = [...this]
-	const fold = (base, index) => {
-		if (index == this.size)
-			return base 
-		return fold(fn(tmp[index], base), index+1)
-	}
-	return fold(base, 0)
-}
-
-Set.prototype.deleteall = function (fn) {
-	this.forEach(e => {if (fn(e)) this.delete(e)})
-}
-
-Set.prototype.find = function (fn) {
-	for (const e of this) {
-		if (fn(e)) return e
-	}
-	return null
-}
-
-Set.intersect = function (a, b) {
-	let ret = a.clone()
-	ret.intersect(b)
-	return ret
-}
-
-Set.union = function (a, b) {
-	let ret = a.clone()
-	ret.union(b)
-	return ret
-}
-
-
-/**
- * Extensions to Map
- */
-
-Map.prototype.clone = function () {
-	return new Map(this)
-}
-
-Map.prototype.every = function (fn) {
-	for (const [key, value] of this) {
-		if (!fn(value, key)) return false
-	}
-	return true 
-}
-
-Map.prototype.some = function (fn) {
-	for (const [key, value] of this) {
-		if (fn(value, key)) return true 
-	}
-	return false
-}
-
-Map.prototype.foldr = function (base, fn) {
-	const iter = this.entries()
-	const fold = base => {
-		const item = iter.next()
-		if (item.done) 
-			return base
-
-		// item.value = [key, val]
-		return fn(item.value[1], item.value[0], fold(base))
-	}
-	return fold(base)
-}
-
-Map.prototype.foldl = function (base, fn) {
-	const iter = this.entries()
-	const fold = base => {
-		const item = iter.next()
-		if (item.done) 
-			return base
-
-		// item.value = [key, val]
-		return fold(fn(item.value[1], item.value[0], base))
-	}
-	return fold(base)
-}
-
-Map.prototype.haskey = function (key) {
-	return this.has(key)
-}
-
-Map.prototype.hasvalue = function (value) {
-	return this.some((v, k) => v === value)
-}
-
-Map.prototype.toJSON = function () {
-	return [...this]
-}
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - diff --git a/BACKUP/node/out/consensus.js.html b/BACKUP/node/out/consensus.js.html deleted file mode 100644 index 7337962..0000000 --- a/BACKUP/node/out/consensus.js.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - consensus.js - Documentation - - - - - - - - - - - - - - - - - -
- -

consensus.js

- - - - - - - -
-
-
"use strict"
-
-let Msg = require("./msg.js")
-let Socket = require("./socket.js")
-
-
-/**
- * Simple leader election. 
- */
-class Consensus {
-
-	/**
-	 * @param  {Socket}   sock     a pre-connected bus socket
-	 * @param  {uuid}     id       the uuid of myself
-	 * @param  {object}   metadata anything that's attached to this id
-	 * @param  {Function} callback invoked when it becomes leader, or when leader sends first command
-	 */
-	constructor(sock, id, metadata, callback) {
-		this.sock     = sock
-
-		this.id       = id
-		this.meta     = metadata   // may contain roles and stype
-
-		this.state    = "follower" // follower | candidate | leader
-		this.members  = {}
-
-		this.members[this.id] = this.meta
-
-		this.timer    = this.reset_timer()
-		this.pinger   = setInterval(() => this.ping(), 150)
-		this.callback = callback
-
-		// this will remove all other handlers
-		// and use ours exclusively
-		this.sock.onmessage = msg => this.on_message(msg)
-	}
-
-	/**
-	 * Send ping messages to gossip what metadata I have
-	 */
-	ping() {
-		this.sock.send(new Msg("ping", this.id, {meta: this.meta}))
-	}
-
-	/**
-	 * Reset the election timer
-	 */
-	reset_timer() {
-		clearTimeout(this.timer)
-
-		if (this.state != "leader") {
-			// [150, 300) ms recommended timeouts from RAFT
-			this.timer = setTimeout(() => this.on_timeout(), Math.random() * 150 + 150) 
-		} else {
-			// 150 ms for leader heartbeat
-			this.timer = setTimeout(() => this.on_timeout(), 150)
-		}
-	}
-
-	/**
-     * As a leader, send out a sync command to sync metadata about all the members.
-	 * @param  {Object}        meta      metadata to by synced
-	 * @param  {Array of uuid} receivers intended receivers
-	 */
-	syncmeta(meta, receivers) {
-		this.meta = meta
-		this.sock.send(new Msg("sync", this.id, {meta: this.meta, receivers: receivers}))
-	}
-
-	/**
-	 * Election timeouts
-	 */
-	on_timeout() {
-		switch (this.state) {
-		// if a follower times out, it becomes candidate
-		// if there is a leader, the heartbeat should keep it within follower
-		case "follower":
-			this.state = "candidate"
-			this.sock.send(new Msg("candidate", this.id, {meta: this.meta}))
-			this.reset_timer()
-			break 
-
-		// if a candidate times out, it becomes leader
-		// if there is a leader, the hearbeat should force it to become a follower
-		case "candidate":
-			this.sock.send(new Msg("leader", this.id, {meta: this.meta}))
-			this.state = "leader"
-			this.reset_timer()
-			break
-
-		// if a leader times out, it heartbeats
-		case "leader":
-			this.sock.send(new Msg("leader", this.id, {meta: this.meta}))
-			this.reset_timer()
-			this.callback(this)
-			break
-		}
-	}
-
-	/**
-	 * On consensus messages or leader commands
-	 * @param  {Msg} msg 
-	 */
-	on_message(msg) {
-
-		switch (msg.label) {
-		// ping message to update members list
-		// reset timer if it comes from a smaller id
-		case "ping":
-			this.members[msg.sender] = msg.payload.meta
-			if (msg.sender < this.id) {
-				this.state = "follower"
-				this.reset_timer()
-			}
-			break 
-
-		// if the sender is smaller, help it become leader
-		// otherwise, promote myself to be the leader
-		case "candidate": 
-			// if the candidate is smaller than me
-			if (msg.sender < this.id) {
-				this.state = "follower"
-			} else {
-				this.state = "candidate"
-				this.sock.send(new Msg("candidate", this.id, {meta: this.meta}))
-			}
-			this.reset_timer()
-			break		
-
-		// as long as I'm not a leader, I will be follower.
-		// If I'm also a leader, we need to compare our id
-		case "leader":
-			if (this.state == "leader") {
-				if (msg.sender < this.id) {
-					// I should not be the leader
-					this.state = "follower"
-				} else {
-					// I should, but let's re-elect
-					this.state = "candidate"
-					this.sock.send(new Msg("candidate", this.id, {meta: this.meta}))
-				} 
-			} else {
-				// just follow the leader
-				this.state = "follower"
-			}
-			this.reset_timer()
-			break 
-
-		// the leader sends out this command
-		case "sync":
-			if (this.state != "leader" && msg.payload.receivers.includes(this.id)) {
-				this.meta = msg.payload.meta 
-				clearTimeout(this.timer)
-				clearInterval(this.pinger)
-				this.callback(this)
-			}
-		}
-	}
-}
-
-module.exports = Consensus
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Wed Dec 27 2017 11:46:58 GMT-0500 (EST) using the Minami theme. -
- - - - - diff --git a/BACKUP/node/out/endpoint.js.html b/BACKUP/node/out/endpoint.js.html deleted file mode 100644 index e1ea0b0..0000000 --- a/BACKUP/node/out/endpoint.js.html +++ /dev/null @@ -1,600 +0,0 @@ - - - - - - endpoint.js - Documentation - - - - - - - - - - - - - - - - - -
- -

endpoint.js

- - - - - - - -
-
-
"use strict"
-
-const nanomsg = require("nanomsg")
-const uuidv4  = require("uuid/v4")
-const util    = require("util")
-
-const Mailbox = require("./mailbox.js")
-const Sock    = require("./socket.js")
-const Msg     = require("./msg.js")
-const _       = require("./collections.js")
-const Logger  = require("./recorder.js")
-
-/**
- * @ignore
- */
-const sleep = ms => new Promise((resolve, reject) => setTimeout(resolve, ms))
-
-/**
- * An endpoint is an abstraction over sockets that provides session initiation, 
- * broadcasting, and linking/forwarding capabilities. 
- */
-class Endpoint {
-
-    /**
-     * Construct an endpoint.
-     * 
-     * @param  {String}     brokeraddr - The address of the broker device.
-     * @param  {Array<Int>} roles      - The roles 
-     */
-    constructor(brokeraddr, roles) {
-
-        /**
-         * @type {uuid}
-         */
-        this.id = uuidv4()
-
-        /**
-         * A set of roles played by this endpoint.
-         * @type {Set<Int>}
-         */
-        this.roles = new Set(roles)
-
-        /**
-         * A mapping from roles to endpoint id's.
-         * @type {Map<Int, uuid>}
-         */
-        this.peers = new Map()
-
-        /**
-         * @type {Mailbox}
-         */
-        this.mbox = new Mailbox(this)
-
-        /**
-         * @type {String}
-         */
-        this.brokeraddr = brokeraddr
-
-        /**
-         * The broker loopback device, provided by the nanomsg. 
-         * @type {nanomsg.Device}
-         */
-        this.broker = null
-
-        /**
-         * @type {Sock}
-         */
-        this.sock = null
-
-        /**
-         * @type {("init"|"ready"|"active"|"linking"|"closing")}
-         */
-        this.state = "init"
-
-        /**
-         * The default message handler.
-         * @param   {Msg}  msg
-         * @returns {Void}
-         */
-        this.handler = msg => {
-            switch (this.state) {
-                case "init":
-                    switch (msg.label) {
-                        case "init": 
-                            this.mbox.put(msg)
-                            break
-                        case "ready": 
-                            if (msg.receivers.length > 0 && !msg.receivers.includes(this.id)) return
-                            this.mbox.put(msg)
-                            break
-                    }
-                    break
-                default:
-                    if (!this.peers.hasvalue(msg.sender)) return
-                    if (msg.receivers.length > 0 && !msg.receivers.includes(this.id)) return
-                    this.mbox.put(msg)
-            }
-        }
-
-        Logger.endpoint(this)
-    }
-
-    /**
-     * @typedef  {Object}                 Endpoint.JSON
-     * @property {uuid}                   id 
-     * @property {Mailbox.JSON}           mbox
-     * @property {Array<Int>}             roles
-     * @property {Array<Tuple<Int,uuid>>} peers
-     * @property {String}                 state
-     * @property {String}                 brokeraddr
-     */
-    
-    /**
-     * @return {Endpoint.JSON} 
-     */
-    toJSON() {
-        return {
-            id: this.id,
-            mbox: this.mbox.toJSON(),
-            roles: this.roles.toJSON(),
-            peers: this.peers.toJSON(),
-            state: this.state,
-            brokeraddr: this.brokeraddr
-        }
-    }
-
-    /**
-     * Coordinate the session initiation as a leader.
-     *
-     * @protected 
-     * @param  {Array<Int>} fullroles - The full set of roles. 
-     * @return {Void}
-     *
-     * ##### Out-going Messages:
-     *     ready {@link Msg.ReadyRequest}
-     *     go    {@link Msg.Go}
-     *     
-     * ##### In-coming Messages:
-     *     init  {@link Msg.Init}
-     *     ready {@link Msg.ReadyReply}
-     */
-    async _init_leader(fullroles) {
-        // Init state.
-        this.peers.clear()
-        this.roles.forEach(role => this.peers.set(role, this.id))
-        Logger.endpoint(this)
-
-        // Gather all `init` messages.
-        while (!fullroles.every(role => this.peers.get(role))) {
-            const msg = await this.mbox.match(new Msg("init", null, null))
-
-            // Skip roles that intersect with our session.
-            const roles = new Set(msg.payload)
-            if (roles.some(role => this.peers.haskey(role))) continue
-
-            // Add peer.
-            roles.forEach(role => this.peers.set(role, msg.sender))
-        }
-
-        // Ready state.
-        this.state = "ready"
-        Logger.endpoint(this)
-
-        // Make sure everyone receives the peers map.
-        const responses = new Set([this.id])
-
-        this.broadcast(this.peers, "ready")
-        while (!this.peers.every((uuid, role) => responses.has(uuid))) {
-            const msg = await this.mbox.match(new Msg("ready", null, null))
-            responses.add(msg.sender)
-        }
-
-        // Active state.
-        this.state = "active"
-        this.broadcast(null, "go")
-        Logger.endpoint(this)
-    }
-
-    /**
-     * Coordinate the session initiation as a follower.
-     *
-     * @protected
-     * @param  {Array<Int>} fullroles 
-     * @return {Void}
-     *
-     * ##### Out-going Messages:
-     *     init  {@link Msg.Init}
-     *     ready {@link Msg.ReadyReply}
-     *
-     * ##### In-coming Messages:
-     *     ready {@link Msg.ReadyRequest}
-     *     go    {@link Msg.Go}
-     */
-    async _init_follower(fullroles) {
-        // Init state
-        this.peers.clear()
-        Logger.endpoint(this)
-
-        // Annouce itself.
-        const ping = setInterval(() => this.broadcast(this.roles, "init"), 1000)
-
-        // Getting the `ready` message.
-        const ready = await this.mbox.match(new Msg("ready", null, null))
-        clearInterval(ping)
-        
-        this.state = "ready"
-        this.peers = new Map(ready.payload)
-        Logger.endpoint(this)
-
-        // Reply `ready` to the leader.
-        this._send(null, 0, "ready")
-
-        // Getting `go` message.  
-        const leader = this.peers.get(0)
-        const go = await this.mbox.match(new Msg("go", leader, null))
-
-        this.state = "active"
-        Logger.endpoint(this)
-    }
-
-    /**
-     * Initiate a session.
-     * 
-     * @param  {Array<Int>} fullroles - The full set of roles.
-     * @return {Void}           
-     */
-    async init(fullroles) {
-        if (this.roles.has(0)) {
-            // Create a broker socket.
-            const brokersock = new Sock("bus", null, {raw: true})
-            brokersock.bind(this.brokeraddr)
-
-            // Make it a loopback device.
-            this.broker = nanomsg.device(brokersock.sock)
-            this.broker.on("error", e => {
-                console.error(e, e.stack.split("\n"))
-            })
-
-            // Connect to the broker.
-            this.sock = new Sock("bus", this)
-            this.sock.onmessage = this.handler
-            this.sock.connect(this.brokeraddr)
-
-            // Init.
-            await this._init_leader(fullroles)
-
-        } else {
-            // Connect to the broker.
-            this.sock = new Sock("bus", this)
-            this.sock.onmessage = this.handler
-            this.sock.connect(this.brokeraddr)
-
-            // Init.
-            await this._init_follower(fullroles)
-        }
-        this.mbox.clear(new Msg("init", null, null))
-    }
-
-    /**
-     * Broadcast a payload to all peers.
-     * @param  {Object} payload      - JSON serializable object.
-     * @param  {String} label="send"
-     * @return {void}         
-     */
-    broadcast(payload, label = "send") {
-        const msg = new Msg(label, this.id, payload)
-        this.sock.send(msg)
-        Logger.send(this, msg)
-    }
-
-    /**
-     * Send a message to a specific receiver.
-     *
-     * @protected
-     * @param  {Object} payload      - JSON serializable object.
-     * @param  {uuid}   receiver     - A single receiver. This is the uuid, since during link, the 
-     *                                 endpoint may send to an out-of-session party.
-     * @param  {String} label="send" 
-     * @return {Void}          
-     */
-    _send(payload, receiver, label = "send") {
-        const uuid = this.peers.get(receiver)
-        const msg = new Msg(label, this.id, payload, [uuid])
-        this.sock.send(msg)
-        Logger.send(this, msg)
-    }
-
-    /**
-     * Receive a message from a particular sender.
-     *
-     * @param  {Int}     sender - The role of the sender.
-     * @return {Object}  The message payload.       
-     * 
-     * ##### In-coming Messages:
-     *     send {@link Msg.Send}
-     *     link {@link Msg.LinkRequest}
-     */
-    async receive(sender) {
-        const msg = await this.mbox.matchany([new Msg("send", this.peers.get(sender), null),
-                                              new Msg("link", null, null)])
-        Logger.recv(this, msg)
-        switch (msg.label) {
-            case "send":
-                return msg.payload
-            case "link":
-                await this.onlink(msg)
-                return await this.receive(sender)
-        }
-    }
-
-    /**
-     * Close all the sockets and mailboxes.
-     *
-     * Note that the device is not closed, since it can only be closed by `nanomsg.term()`.
-     *
-     * @return {Void}
-     *
-     * ##### Out-going Messages:
-     *     go    {@link Msg.Go}
-     *
-     * ##### In-coming Messages:
-     *     close {@link Msg.Close}
-     *     link  {@link Msg.LinkRequest}
-     * 
-     */
-    async close() {
-        let responses = new Set([this.id])
-        this.state = "closing"
-        Logger.endpoint(this)
-
-        // Loop until every one is ready to be closed.
-        while (!this.peers.every((uuid, role) => responses.has(uuid))) {
-            const msg = await this.mbox.matchany([new Msg("close", null, null),
-                                                  new Msg("link",  null, null)])
-            switch (msg.label) {
-                case "close":
-                    responses.add(msg.sender)
-                    continue
-                case "link":
-                    await this.onlink(msg)
-                    this.state = "closing"
-                    Logger.endpoint(this)
-                    continue
-            }
-        }
-
-        // Close.
-        this.broadcast(null, "go")
-        this.sock.close()
-        this.mbox.close()
-
-        Logger.closeendpoint(this)
-    }
-
-    /**
-     * Synchonoursly close the endpoint as a follower. This operation tries to sync
-     * with the broker (role 0) with a close message. When the broker collects all the "close", 
-     * it will let all clients close. 
-     *
-     * @param  {Int}  closer - The role of the closing endpoint.
-     * @return {Void}
-     * 
-     * ##### Out-going Messages:
-     *     close {@link Msg.Close)
-     *
-     * ##### In-coming Messages:
-     *     go    {@link Msg.Close}
-     *     link  {@link Msg.LinkRequest}
-     */
-    async wait(closer) {
-        this.state = "closing"
-        this._send(null, closer, "close")
-        Logger.endpoint(this)
-        
-        // Wait for the closing signal.
-        const msg = await this.mbox.matchany([new Msg("go", this.peers.get(closer), null),
-                                              new Msg("link", null, null)])
-
-        switch (msg.label) {
-            case "go":
-                this.sock.close()
-                this.mbox.close()
-                Logger.closeendpoint(this)
-                break
-            case "link":
-                await this.onlink(msg)
-                await this.wait(closer)
-                break
-        }
-    }
-
-    /**
-     * Cut with Spill.
-     * 
-     * @param  {Endpoint} ep1 
-     * @param  {Endpoint} ep2 
-     * @return {Endpoint}     
-     * 
-     * Given `EP1` of roles `R1` and `EP2` with roles `R2`, 
-     * the function will perform a cut-with-spill by:
-     *
-     *  1. Choose the (possibly) non-empty mailbox one as `KEEP`, and the other as `KILL`. 
-     *  2. Set `KEEP` role to be `R1 \intersect R2`.
-     *  3. Connects the network involving `KILL` with the network involving `KEEP`.
-     *  4. Updates the peers in the combined network.
-     *
-     * During a cut of two endpoints, we are in the following situation (case-sensitive): 
-     *
-     *     {ep1, ...} <=> EP1  <- to be cut with -> EP2 <=> {ep2, ...}
-     *
-     * And at most one of (`EP1`, `EP2`)'s mailbox must be empty since:
-     * 
-     *  1. All of the `ep` and `EP` should now be blocked on receive (or similar).
-     *  2. And based on the protocol, no two endpoints in the same session 
-     *     can send at the same time.
-     *  3. There must be someone that has performed all the send and 
-     *     then is blocked at a receive (or similar).
-     *  4. All others start from a receive.
-     *  5. As a result, if someone from `{ep1, ...}` sends, then `EP1` has non-empty mailbox.
-     *     And correspondingly, `EP2` must contain the sending role, and therefore `EP2` has 
-     *     an empty mailbox, no matter the receiving role is in `EP2` or not.
-     *  6. This sending operation(s), should be considered incomplete, and should be replayed 
-     *     after the new session is formed. 
-     *
-     * ##### In-coming Messages:
-     *     link: {@link Msg.LinkReply}
-     *
-     * ##### Out-going Messages:
-     *     link: {@link Msg.LinkRequest}
-     *     go:   {@link Msg.Go}
-     *     
-     */
-    static async link(ep1, ep2) {
-        // We re-use the endpoint with non-empty mailbox 
-        // for easier replay of "receive", etc.
-        const [kill, keep] = (await ep1.mbox.isempty()) ? [ep1, ep2] : [ep2, ep1]
-
-        // New roles and new peers.
-        const roles = Set.intersect(ep1.roles, ep2.roles)
-        const peers = new Map()
-
-        roles.forEach(role => peers.set(role, keep.id))
-        ep1.peers.forEach((uuid, role) => {
-            if (!ep1.roles.has(role)) peers.set(role, uuid)
-        })
-        ep2.peers.forEach((uuid, role) => {
-            if (!ep2.roles.has(role)) peers.set(role, uuid)
-        })
-
-        // Update to new peers. The new peer map includes essentially every one except `kill`.
-        keep.roles = roles
-        keep.peers = peers
-        keep.state = "linking"
-        Logger.endpoint(keep)
-
-        const responses = new Set([keep.id])
-        const mails     = keep.mbox.mails()
-
-        // Broadcast new peers and broker addresses.
-        keep.broadcast({
-            brokeraddr: keep.brokeraddr,
-            peers: peers,
-            replyto: keep.id,
-            mails: []
-        }, "link")
-
-        kill.broadcast({
-            brokeraddr: keep.brokeraddr,
-            peers: peers,
-            replyto: keep.id,
-            mails: mails
-        }, "link")
-
-        // Wait until everyone is ready.
-        while (!keep.peers.every((uuid, role) => responses.has(uuid))) {
-            const msg = await keep.mbox.match(new Msg("link", null, null))
-            responses.add(msg.sender)
-        }
-
-        keep.state = "active"
-        Logger.endpoint(keep)
-        
-        // Kill the endpoint manually.
-        kill.peers = new Map()
-        kill.roles = new Set()
-        await kill.close()
-
-        // Go.        
-        keep.broadcast(null, "go")
-        return keep
-    }
-
-    /**
-     * Respond to the `link` request. 
-     *
-     * @param  {Msg.LinkRequest} msg 
-     * @return {Void}
-     * 
-     * Handling the `link` message. The states to be changed include:
-     * 
-     * * `peers`: Since we linked two endpoints, the peer map changed.
-     * * `brokeraddr`: 
-     *      Before linking, there were two leaders, and as a result, two devices.
-     *      After linking, they will all be connected to one of the device, 
-     *      that originally belongs to the `KEEP`'s leader. 
-     *
-     * ##### In-coming Messages
-     *     link {@link Msg.LinkRequest}
-     *     go   {@link Msg.Go}
-     *
-     * ##### Out-going Messages
-     *     link {@link Msg.LinkReply}
-     * 
-     */
-    async onlink(msg) {
-        this.state = "linking"
-        this.peers = new Map(msg.payload.peers)
-        Logger.endpoint(this)
-
-        // Update broker address.
-        if (msg.payload.brokeraddr != this.brokeraddr) {
-            this.sock.disconnect(this.brokeraddr)
-            this.brokeraddr = msg.payload.brokeraddr
-            this.sock.connect(msg.payload.brokeraddr)
-        }
-
-        // Put forwarded mails in the mailbox.
-        msg.payload.mails.forEach(m => this.mbox.put(m))
-
-        // Reply only back to the KEEP endpoint.
-        const reply = new Msg("link", this.id, null, [msg.payload.replyto])
-        this.sock.send(reply)
-        Logger.send(this, reply)
-        
-        // Waiting for `go`.
-        const go = await this.mbox.match(new Msg("go", null, null))
-        this.state = "active"
-        Logger.endpoint(this)
-    }
-}
-module.exports = Endpoint
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - diff --git a/BACKUP/node/out/fonts/OpenSans-Bold-webfont.eot b/BACKUP/node/out/fonts/OpenSans-Bold-webfont.eot deleted file mode 100644 index 5d20d91..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Bold-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Bold-webfont.svg b/BACKUP/node/out/fonts/OpenSans-Bold-webfont.svg deleted file mode 100644 index 3ed7be4..0000000 --- a/BACKUP/node/out/fonts/OpenSans-Bold-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-Bold-webfont.woff b/BACKUP/node/out/fonts/OpenSans-Bold-webfont.woff deleted file mode 100644 index 1205787..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Bold-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.eot b/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.eot deleted file mode 100644 index 1f639a1..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.svg b/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.svg deleted file mode 100644 index 6a2607b..0000000 --- a/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.woff b/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.woff deleted file mode 100644 index ed760c0..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-BoldItalic-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Italic-webfont.eot b/BACKUP/node/out/fonts/OpenSans-Italic-webfont.eot deleted file mode 100644 index 0c8a0ae..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Italic-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Italic-webfont.svg b/BACKUP/node/out/fonts/OpenSans-Italic-webfont.svg deleted file mode 100644 index e1075dc..0000000 --- a/BACKUP/node/out/fonts/OpenSans-Italic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-Italic-webfont.woff b/BACKUP/node/out/fonts/OpenSans-Italic-webfont.woff deleted file mode 100644 index ff652e6..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Italic-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Light-webfont.eot b/BACKUP/node/out/fonts/OpenSans-Light-webfont.eot deleted file mode 100644 index 1486840..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Light-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Light-webfont.svg b/BACKUP/node/out/fonts/OpenSans-Light-webfont.svg deleted file mode 100644 index 11a472c..0000000 --- a/BACKUP/node/out/fonts/OpenSans-Light-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-Light-webfont.woff b/BACKUP/node/out/fonts/OpenSans-Light-webfont.woff deleted file mode 100644 index e786074..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Light-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.eot b/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.eot deleted file mode 100644 index 8f44592..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.svg b/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.svg deleted file mode 100644 index 431d7e3..0000000 --- a/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.svg +++ /dev/null @@ -1,1835 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.woff b/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.woff deleted file mode 100644 index 43e8b9e..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-LightItalic-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Regular-webfont.eot b/BACKUP/node/out/fonts/OpenSans-Regular-webfont.eot deleted file mode 100644 index 6bbc3cf..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Regular-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Regular-webfont.svg b/BACKUP/node/out/fonts/OpenSans-Regular-webfont.svg deleted file mode 100644 index 25a3952..0000000 --- a/BACKUP/node/out/fonts/OpenSans-Regular-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-Regular-webfont.woff b/BACKUP/node/out/fonts/OpenSans-Regular-webfont.woff deleted file mode 100644 index e231183..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Regular-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.eot b/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.eot deleted file mode 100644 index d8375dd..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.svg b/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.svg deleted file mode 100644 index eec4db8..0000000 --- a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.ttf b/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.ttf deleted file mode 100644 index b329084..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.ttf and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.woff b/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.woff deleted file mode 100644 index 28d6ade..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-Semibold-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.eot b/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.eot deleted file mode 100644 index 0ab1db2..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.eot and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.svg b/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.svg deleted file mode 100644 index 7166ec1..0000000 --- a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.ttf b/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.ttf deleted file mode 100644 index d2d6318..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.ttf and /dev/null differ diff --git a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.woff b/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.woff deleted file mode 100644 index d4dfca4..0000000 Binary files a/BACKUP/node/out/fonts/OpenSans-SemiboldItalic-webfont.woff and /dev/null differ diff --git a/BACKUP/node/out/global.html b/BACKUP/node/out/global.html deleted file mode 100644 index b51eafc..0000000 --- a/BACKUP/node/out/global.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - Global - Documentation - - - - - - - - - - - - - - - - - -
- -

Global

- - - - - - - -
- -
- -

- -

- - -
- -
-
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -

Type Definitions

- - - -
- - - -

Predicate(m) → {Boolean}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
m - - -Msg - - - - -

The message to check.

- -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Boolean - - -
-
- - -
-

true if the message matches the pattern.

-
- - -
- - - -
- - - - -
- -
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Wed Dec 27 2017 12:37:34 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/index.html b/BACKUP/node/out/index.html deleted file mode 100644 index 59f4af4..0000000 --- a/BACKUP/node/out/index.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - Home - Documentation - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - \ No newline at end of file diff --git a/BACKUP/node/out/mailbox.js.html b/BACKUP/node/out/mailbox.js.html deleted file mode 100644 index 353f11f..0000000 --- a/BACKUP/node/out/mailbox.js.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - mailbox.js - Documentation - - - - - - - - - - - - - - - - - -
- -

mailbox.js

- - - - - - - -
-
-
"use strict"
-
-const nanomsg = require("nanomsg")
-const uuidv4  = require("uuid/v4")
-
-const _      = require("./collections.js")
-const Sock   = require("./socket.js")
-const Msg    = require("./msg.js")
-const Logger = require("./recorder.js")
-
-
-/**
- * @ignore
- */
-const sleep = ms => new Promise((resolve, reject) => setTimeout(resolve, ms))
-
-/**
- * A `MailboxWorker` that actually holds the "concurrent" buffer.
- * 
- * The "concurrency" is achieved by queueing callbacks for mailbox commands
- * like "put" and "match". Many commands may arraive concurrently, but will be
- * serialized by the NodeJS core. Callbacks will then be invoked in order, and 
- * will not be interrupted unless the callback yields at `await`. 
- *
- * @package
- */
-class MailboxWorker {
-
-    /**
-     * @param  {Mailbox} parent - The owning mailbox.           
-     * @param  {String}  addr   - Socket address to connect to.
-     * @return {MailboxWorker}
-     */
-    constructor(parent, addr) {
-        /**
-         * @type {Mailbox}
-         */
-        this.parent = parent
-
-        /**
-         * @type {Array}
-         */
-        this.mbox = []
-
-        /**
-         * @type {Sock}
-         */
-        this.sock = new Sock("pair")
-
-        this.sock.connect(addr)
-        this.sock.onmessage = msg => this.dispatch(msg)
-    }
-    
-    /**
-     * Handles the "put" command.
-     * 
-     * @param  {Mailbox.Put} msg 
-     * @return {Void}
-     */
-    onput(msg) {
-        this.mbox.push(msg.payload)
-        Logger.mailbox(this.parent)
-    }
-    
-    /*    
-     * @callback Mailbox.Predicate
-     * @param  {Msg}  m - The message to check.
-     * @return {Boolean} `true` if the message matches the pattern.
-     */
-    
-    /**
-     * Build a pattern checking function out of a given example.
-     *
-     * @protected
-     * @param  {Msg} msg  - An example message, showing the label/sender to match.
-     * @return {Mailbox.Predicate} 
-     */
-    _condition(msg) {
-        const label  = msg.label
-        const sender = msg.sender
-        
-        if (label && sender) 
-            return m => m.label == label && m.sender == sender
-        else if (label)
-            return m => m.label == label 
-        else if (sender)
-            return m => m.sender == sender
-        else 
-            throw new Error("No conditions given when trying to match a message from the mailbox.")
-    }
-
-    /**
-     * Build an alternative patterns checking function out of a list of given examples. 
-     *
-     * @protected
-     * @param  {Array<Msg>} msgs - An array of example messages.
-     * @return {Mailbox.Predicate} A function that checks if the message matches any of the patterns.
-     */
-    _conditions(msgs) {
-        const base  = m => false 
-        const fn    = (msg, conds) => { return m => this._condition(msg)(m) || conds(m) }
-        const conds = msg.payload.foldr(base, fn)
-
-        return conds
-    }
-
-    /**
-     * Handles "match" command.
-     *
-     * @param  {Mailbox.Match} msg 
-     * @return {Msg} Return the earliest message that matches any of the example messages.      
-     */
-    async onmatch(msg) {
-        const conds = this._conditions(msg.payload)
-
-        while (true) {
-            let index = this.mbox.findIndex(conds)
-            while (index < 0) {
-                await sleep(1)
-                index = this.mbox.findIndex(conds)
-            }
-            
-            const ret = this.mbox.splice(index, 1)[0]
-            Logger.mailbox(this.parent)
-            return ret
-        }
-    }
-
-    /**
-     * Close the mailbox.
-     * 
-     * @return {Void}
-     */
-    onclose() {
-        delete this.mbox
-        this.sock.close()
-    }
-
-    /**
-     * Clear all the messages that match the pattern.
-     * 
-     * @param  {Mailbox.Clear} msg
-     * @return {Void}
-     */
-    onclear(msg) {
-        const cond = this._condition(msg.payload)
-        this.mbox = this.mbox.filter(m => !cond(m))
-
-        Logger.mailbox(this.parent)
-    }
-
-    /**
-     * Dispatch commands. 
-     *
-     * This function "returns" by sending a reply message.
-     * 
-     * @param  {(Mailbox.Put|Mailbox.Match|Mailbox.Close|Mailbox.Clear|Mailbox.Size)} msg 
-     * @return {Void|Msg}
-     */
-    async dispatch(msg) {
-        switch (msg.label) {
-            case "put":
-                this.onput(msg)
-                break
-            case "match":
-                this.sock.send(await this.onmatch(msg))
-                break
-            case "close":
-                this.onclose()
-                break
-            case "size":
-                this.sock.send(this.mbox.length)
-                break
-            case "clear":
-                this.onclear(msg)
-                break
-        }
-    }
-}
-
-
-/**
- * An Erlang-style concurrent mailbox that supports pattern matching.
- */
-class Mailbox {
-
-    /**
-     * @param  {Endpoint} ep - The endpoint who owns the mailbox.
-     * @return {Mailbox} 
-     */
-    constructor(ep) {
-        /**
-         * @type {Endpoint}
-         */
-        this.endpoint = ep
-
-        /**
-         * @type {String}
-         */
-        this.addr = `inproc://${uuidv4()}`
-
-        /**
-         * @type {Sock}
-         */
-        this.sock = new Sock("pair")
-        this.sock.bind(this.addr)
-
-        /**
-         * @type {MailboxWorker}
-         */
-        this.worker = new MailboxWorker(this, this.addr)
-
-        Logger.mailbox(this)
-    }
-
-    /**
-     * @typedef  {Msg}        Mailbox.Match
-     * @property {"match"}    label
-     * @property {Array<Msg>} payload - The messages to match.
-     */
-    
-    /** 
-     * @typedef  {Msg}   Mailbox.Put
-     * @property {"put"} label
-     * @property {Msg}   payload - The message to put.
-     */
-    
-    /**
-     * @typedef  {Msg}     Mailbox.Clear
-     * @property {"clear"} label
-     * @property {Msg}     payload - The message to match and clear.
-     */
-    
-    /**
-     * @typedef  {Msg}    Mailbox.Size
-     * @property {"size"} label
-     */
-    
-    /**
-     * @typedef  {Msg}     Mailbox.Close
-     * @property {"close"} label
-     */
-
-    /**
-     * Put a message into the mailbox.
-     * 
-     * @param  {Msg}  msg 
-     * @return {Void}     
-     */
-    put(msg) {
-        this.sock.send(new Msg("put", null, msg))
-    }
-
-    /**
-     * Get the earliest message that matches the given example.
-     * The example message will show the intended label and/or sender.
-     *
-     * @async
-     * @param  {Msg} msg - An example message showing the intended label and/or sender.
-     * @return {Msg} 
-     */
-    match(msg) {
-        return this.matchany([msg])
-    }
-
-    /**
-     * Get the earliest message that matches one of the given examples. 
-     *
-     * @async
-     * @param  {Array<Msg>} msgs
-     * @return {Msg} 
-     */
-    matchany(msgs) {
-        let request = new Promise((resolve, reject) => {
-            this.sock.onmessage = msg => resolve(msg)
-            this.sock.send(new Msg("match", null, msgs))
-        })
-
-        return request
-    }
-
-    /**
-     * Delete all the messages that match the given example.
-     * 
-     * @param  {Msg}  msg 
-     * @return {Void}
-     */
-    clear(msg) {
-        this.sock.send(new Msg("clear", null, msg))
-    }
-
-    /**
-     * Close the mailbox.
-     * 
-     * @return {Void}
-     */
-    close() {
-        this.sock.send(new Msg("close", null, null))
-        this.sock.close()
-
-        Logger.closemailbox(this)
-    }
-
-    /**
-     * Check if the mailbox is empty.
-     * 
-     * @return {Boolean} `true` if the mailbox is empty, `false` otherwise.
-     */
-    isempty() {
-        return new Promise((resolve, reject) => {
-            this.sock.onmessage = msg => resolve(msg == 0)
-            this.sock.send(new Msg("size", null, null))            
-        })
-    }
-
-    /**
-     * Get a copy of all the mails in the mailbox.
-     * 
-     * @return {Array<Msg>}
-     */
-    mails() {
-        return this.worker.mbox.clone()
-    }
-    
-    /**
-     * @typedef  {Object} Mailbox.JSON
-     * @property {String} id       - The address of the mailbox, which is uniquely generated as an uuid.
-     * @property {uuid}   endpoint - The id of the owning endpoint.
-     * @property {Array<Msg>} mails
-     */
-    
-    /**
-     * @return {Mailbox.JSON}
-     */
-    toJSON() {
-        return {
-            id:       this.addr,
-            endpoint: this.endpoint.id,
-            mails:    this.worker.mbox.clone()
-        }
-    }
-
-}
-
-module.exports = Mailbox
-
-
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - diff --git a/BACKUP/node/out/msg.js.html b/BACKUP/node/out/msg.js.html deleted file mode 100644 index 4192756..0000000 --- a/BACKUP/node/out/msg.js.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - msg.js - Documentation - - - - - - - - - - - - - - - - - -
- -

msg.js

- - - - - - - -
-
-
/**
- * A common message format.
- */
-class Msg {
-
-    /**
-     * @param  {("init"|"ready"|"go"|"send"|"link"|"close")} label 
-     * @param  {uuid}         sender   
-     * @param  {Object}       payload  
-     * @param  {Array<uuid>}  receivers=null 
-     * @return {Msg}         
-     */
-    constructor(label, sender, payload, receivers = []) {
-        this.label = label
-        this.sender = sender
-        this.payload = payload
-        this.receivers = receivers
-    }   
-}
-
-/**
- * Broadcasting message for announcing the existence of an endpoint. 
- * Used to initiate a session.
- * 
- * @typedef  {Msg}           Msg.Init
- * @property {"init"}        label
- * @property {uuid}          sender    - Announce the endpoint id.
- * @property {Array<Int>}    payload   - The roles played by the endpoint.
- * @property {Array<uuid>}   receivers - Empty array.
- */
-
-/**
- * This message is for the leader to get all followers ready by supplying the peer map.
- * 
- * @typedef  {Msg}           Msg.ReadyRequest
- * @property {"ready"}       label
- * @property {uuid}          sender
- * @property {Map<Int,uuid>} payload   - The peers map as determined by the leader.
- * @property {Array<uuid>}   receivers - All the intended receivers
- */
-
-/**
- * The follower announce to the leader that it is ready.
- * 
- * @typedef  {Msg}           Msg.ReadyReply
- * @property {"ready"}       label
- * @property {uuid}          sender
- * @property {Map<Int,uuid>} payload   - The peers map as determined by the leader.
- * @property {Array<uuid>}   receivers - One element array containing the leader's id.
- */
-
-/**
- * This message is for the leader to green light all followers.
- * 
- * @typedef  {Msg}           Msg.Go
- * @property {"go"}          label
- * @property {uuid}          sender
- * @property {null}          payload   
- * @property {Array<uuid>}   receivers - All the intended receivers
- */
-
-/**
- * The primary data message being exchanged. 
- *
- * @typedef  {Msg}         Msg.Send
- * @property {"send"}      label
- * @property {uuid}        sender
- * @property {Object}      payload   - JSON serializable object.
- * @property {Array<uuid>} receivers
- */
-
-/**
- * The message to initiate a link operation.
- *
- * @typedef  {Msg}           Msg.LinkRequest
- * @property {"link"}        label
- * @property {uuid}          sender
- * @property {Array<uuid>}   receivers    
- *  
- * @property {Object}        payload
- * @property {String}        payload.brokeraddr - The new broker address to connect to.
- * @property {Map<Int,uuid>} payload.peers      - The new peer map.
- * @property {uuid}          payload.replyto    - The coordinator for this link.
- */
-
-/**
- * The message to acknowledge that the sender is ready to go after a link.
- *
- * @typedef  {Msg}           Msg.LinkReply
- * @property {"link"}        label
- * @property {uuid}          sender
- * @property {null}          payload   
- * @property {Array<uuid>}   receivers - One element array containing the link initiator.
- */
-
-/**
- * The message is used by followers to request to close.
- *
- * @typedef  {Msg}         Msg.Close
- * @property {"close"}     label
- * @property {uuid}        sender
- * @property {null}        payload 
- * @property {Array<uuid>} receivers - A single element array containing the closer's endpoint id.     
- */
-
-
-module.exports = Msg
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - diff --git a/BACKUP/node/out/recorder.js.html b/BACKUP/node/out/recorder.js.html deleted file mode 100644 index 4148e0b..0000000 --- a/BACKUP/node/out/recorder.js.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - recorder.js - Documentation - - - - - - - - - - - - - - - - - -
- -

recorder.js

- - - - - - - -
-
-
"use strict"
-
-const nanomsg = require("nanomsg")
-const uuidv4  = require("uuid/v4")
-const _       = require("./collections.js")
-const util    = require("util")
-
-const Msg      = require("./msg.js")
-const Endpoint = require("./endpoint.js")
-const Mailbox  = require("./mailbox.js")
-
-const sleep  = ms   => new Promise((resolve, reject) => setTimeout(resolve, ms))
-
-
-/**
- * A session event with label, data, and timestamp.
- *
- * {ep, {id, state, peer, roles}}
- * 
- */
-class SessionEvent {
-	constructor(label, data) {
-		this.label = label 
-		this.data  = data 
-		this.time  = new Date()
-	}
-
-	static Endpoint(ep) {
-		return new SessionEvent("endpoint", ep)
-	}
-
-	static CloseEndpoint(ep) {
-		return new SessionEvent("closeendpoint", ep)	
-	}
-
-	static Mailbox(mbox) {
-		return new SessionEvent("mailbox", mbox)
-	}
-
-	static CloseMailbox(mbox) {
-		return new SessionEvent("closemailbox", mbox)
-	}
-
-	/**
-	 * [Send description]
-	 * @param {uuid}        f   [description]
-	 * @param {Array<uuid>} ts  [description]
-	 * @param {Msg}         msg [description]
-	 */
-	static Send(f, ts, msg) {
-		return new SessionEvent("send", {msg: msg, from: f, to: ts.clone()})
-	}
-
-	/**
-	 * [Recv description]
-	 * @param {uuid} f   [description]
-	 * @param {uuid} t   [description]
-	 * @param {Msg}  msg [description]
-	 */
-	static Recv(f, t, msg) {
-		return new SessionEvent("recv", {msg: msg, from: f, to: t})
-	}
-
-
-}
-
-
-class SessionRecorderWorker {
-	constructor(addr) {
-		this.events    = []
-
-		this.sock = nanomsg.socket("pair")
-		this.sock.setEncoding("utf8")
-		this.sock.connect(addr)
-
-		this.sock.on("data", msg => {
-			msg = JSON.parse(msg)
-			this.dispatch(msg)
-		})
-	}
-
-	dispatch(msg) {
-		switch (msg.label) {
-		case "endpoint": 
-			this.events.push(SessionEvent.Endpoint(msg.payload))
-			break 
-		case "closeendpoint":
-			this.events.push(SessionEvent.CloseEndpoint(msg.payload))
-			break
-		case "mailbox":
-			this.events.push(SessionEvent.Mailbox(msg.payload))
-			break
-		case "closemailbox":
-			this.events.push(SessionEvent.CloseMailbox(msg.payload))
-			break
-		case "send": 
-			this.send(msg.payload.endpoint, msg.payload.msg)
-			break 
-		case "recv": 
-			this.recv(msg.payload.endpoint, msg.payload.msg)
-			break 
-		}
-	}
-
-	send(ep, msg) {
-		const f = ep.id 
-		const peers = new Map(ep.peers).foldr([], (uuid, role, base) => { 
-			if (uuid != f) base.push(uuid)
-			return base
-		})
-
-		this.events.push(SessionEvent.Send(f, msg.receivers.length > 0 ? msg.receivers : peers, msg))
-	}
-
-	recv(ep, msg) {
-		const f = msg.sender 
-		const t = ep.id 
-
-		this.events.push(SessionEvent.Recv(f, t, msg))
-	}
-}
-
-class SessionRecorder {
-	constructor() {
-		const addr = `inproc://${uuidv4()}`
-		this.sock = nanomsg.socket("pair")
-		this.sock.setEncoding("utf8")
-		this.sock.bind(addr)
-		this.worker = new SessionRecorderWorker(addr)
-	}
-
-	endpoint(ep) {
-		this.sock.send(JSON.stringify(new Msg("endpoint", null, ep)))
-	}
-
-	closeendpoint(ep) {
-		this.sock.send(JSON.stringify(new Msg("closeendpoint", null, ep)))
-	}
-
-	mailbox(mbox) {
-		this.sock.send(JSON.stringify(new Msg("mailbox", null, mbox)))
-	}
-
-	closemailbox(mbox) {
-		this.sock.send(JSON.stringify(new Msg("closemailbox", null, mbox)))
-	}
-
-	send(ep, msg) {
-		this.sock.send(JSON.stringify(new Msg("send", null, {endpoint: ep, msg: msg})))
-	}
-
-	recv(ep, msg) {
-		this.sock.send(JSON.stringify(new Msg("recv", null, {endpoint: ep, msg: msg})))
-	}
-
-	events() {
-		return this.worker.events
-	}
-}
-
-const instance = new SessionRecorder()
-module.exports = instance
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - diff --git a/BACKUP/node/out/scripts/linenumber.js b/BACKUP/node/out/scripts/linenumber.js deleted file mode 100644 index 8d52f7e..0000000 --- a/BACKUP/node/out/scripts/linenumber.js +++ /dev/null @@ -1,25 +0,0 @@ -/*global document */ -(function() { - var source = document.getElementsByClassName('prettyprint source linenums'); - var i = 0; - var lineNumber = 0; - var lineId; - var lines; - var totalLines; - var anchorHash; - - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; - - for (; i < totalLines; i++) { - lineNumber++; - lineId = 'line' + lineNumber; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } - } - } -})(); diff --git a/BACKUP/node/out/scripts/prettify/Apache-License-2.0.txt b/BACKUP/node/out/scripts/prettify/Apache-License-2.0.txt deleted file mode 100644 index d645695..0000000 --- a/BACKUP/node/out/scripts/prettify/Apache-License-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/BACKUP/node/out/scripts/prettify/lang-css.js b/BACKUP/node/out/scripts/prettify/lang-css.js deleted file mode 100644 index 041e1f5..0000000 --- a/BACKUP/node/out/scripts/prettify/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/BACKUP/node/out/scripts/prettify/prettify.js b/BACKUP/node/out/scripts/prettify/prettify.js deleted file mode 100644 index eef5ad7..0000000 --- a/BACKUP/node/out/scripts/prettify/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p - - - - - socket.js - Documentation - - - - - - - - - - - - - - - - - -
- -

socket.js

- - - - - - - -
-
-
"use strict"
-
-const nanomsg = require("nanomsg")
-const assert  = require("assert")
-
-const _       = require("./collections.js")
-const Logger  = require("./recorder.js")
-
-/**
- * A warpper for socket implementations.
- */
-class Sock {
-
-	/**
-	 * @param  {String}   proto   - SP protocol string. Could be "bus", "pair", etc.
-	 * @param  {Endpoint} ep      - Owning endpoint.
-	 * @param  {Object}   opts={} - Options for the socket. e.g. `{raw: true}`
-	 * @return {Sock}       
-	 */
-	constructor(proto, ep, opts={}) {
-
-		/**
-		 * @callback Sock.Handler
-		 * @param  {Msg}  msg
-		 * @return {Void}
-		 */
-
-		/**
-		 * A copy of the installed handler.
-		 * @type {Sock.Handler}
-		 */
-		this.handler  = null
-
-		/**
-		 * @type {Endpoint}
-		 */	
-		this.endpoint = ep
-
-		/**
-		 * @type {nanomsg.Socket}
-		 */
-		this.sock     = nanomsg.socket(proto, opts)
-		this.sock.setEncoding("utf8")
-
-		this.sock.on("error", e => {
-			this.sock.close()
-			console.error(e, "\n", e.stack.split("\n"))
-		})
-	}
-
-	/**
-	 * Bind the address.
-	 * @param  {String} addr 
-	 * @return {Int}    A nanomsg endpoint id. Returns -1 on error. 
-	 */
-	bind(addr) {
-		try {
-			const eid = this.sock.bind(addr)
-			assert(this.sock.bound[addr] >= 0)
-			return eid 
-		} catch(e) {
-			this.sock.close()
-			console.error(e, e.stack.split("\n"))
-			return -1
-		}
-	}
-
-	/**
-	 * Connect to an address.
-	 * @param  {String} addr 
-	 * @return {Int}    A nanomsg endpoint id. Returns -1 on error. 
-	 */
-	connect(addr) {
-		try {
-			const eid = this.sock.connect(addr)
-			assert(this.sock.connected[addr] >= 0) 
-			return eid 
-		} catch(e) {
-			this.sock.close()
-			console.error(e, e.stack.split("\n"))
-			return -1
-		}
-	}
-
-	/**
-	 * Disconnect from an address.
-	 * @param  {String} addr 
-	 * @return {Int}    A nanomsg endpoint id. Returns -1 if the address is not previously connected.
-	 */
-	disconnect(addr) {
-		if (addr in this.sock.connected) {
-			const eid = this.sock.connected[addr]
-			this.sock.shutdown(eid)
-			return eid
-		}
-		
-		return -1
-	}
-
-	/**
-	 * Close the socket.
-	 * @return {Void} 
-	 */
-	close() {
-		return this.sock.close()
-	}
-
-	/**
-	 * Set/Get the message handler.
-	 * 
-	 * When installing, all previously installed handler will be replaced.
-	 * 
-	 * @param  {Sock.Handler} handler 
-	 * @return {Void}         
-	 */
-	set onmessage(handler) {
-		this.sock.removeAllListeners("data")
-		this.handler = handler
-		this.sock.on("data", msg => {
-			this.handler(JSON.parse(msg))
-		})
-	}
-
-	get onmessage() {
-		return this.handler
-	}
-
-	/**
-	 * Send a payload via the sokcet.
-	 * @param  {Object} payload - A JSON-serializable payload.
-	 * @return {Int}    Actual bytes sent.
-	 */
-	send(payload) {
-		const sent = this.sock.send(JSON.stringify(payload))
-		assert(sent > 0)
-		return sent
-	}
-}
-
-module.exports = Sock
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Thu Dec 28 2017 11:24:51 GMT-0500 (EST) using the Minami theme. -
- - - - - diff --git a/BACKUP/node/out/styles/jsdoc-default.css b/BACKUP/node/out/styles/jsdoc-default.css deleted file mode 100644 index dafb9ab..0000000 --- a/BACKUP/node/out/styles/jsdoc-default.css +++ /dev/null @@ -1,694 +0,0 @@ -@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,500i,500,600,600i|Roboto); - -* { - box-sizing: border-box -} - -html, body { - height: 100%; - width: 100%; -} - -body { - color: #4d4e53; - background-color: white; - margin: 0 auto; - padding: 0; - font-family: 'Source Sans Pro', Helvetica, sans-serif; - font-size: 16px; - line-height: 160%; -} - -a, -a:active { - color: #0095dd; - text-decoration: none; -} - -a:hover { - text-decoration: underline -} - -p, ul, ol, blockquote { - margin-bottom: 1em; -} - -h1, h2, h3, h4, h5, h6 { - font-family: 'Roboto', sans-serif; -} - -h1, h2, h3, h4, h5, h6 { - color: #000; - font-weight: 400; - margin: 0; -} - -h1 { - font-weight: 300; - font-size: 48px; - margin: 1em 0 .5em; -} - -h1.page-title {margin-bottom: 10px;font-size: 34px;font-weight: 300;border-bottom: solid 2px #ddd;padding: .5em 0 .5em;margin-top: 0;} - -h2 { - font-size: 32px; - margin: 1.2em 0 .8em; - font-weight: bold; -} - -h3 { - /* margin-top: 1em; */ - /* margin-bottom: 16px; */ - /* font-weight: bold; */ - padding: 0; - margin: 1em 0 .6em; - font-size: 28px; - /* border-bottom: 1px solid #eee; */ - /* padding-bottom: 15px; */ -} - -h4 { - font-size: 18px; - margin: 1em 0 .2em; - color: #4d4e53; - /* border-bottom: 1px solid #eee; */ - /*padding-bottom: 8px;*/ - padding: 8px; - background-color: lightyellow; -} - -h5, .container-overview .subsection-title { - font-size: 120%; - /* letter-spacing: -0.01em; */ - margin: 20px 0 5px; -} - -h6 { - font-size: 100%; - letter-spacing: -0.01em; - margin: 6px 0 3px 0; - font-style: italic; -} - -tt, code, kbd, samp { - font-family: Consolas, Monaco, 'Andale Mono', monospace; - background: #f4f4f4; - padding: 1px 5px; - border-radius: 5px; - font-size: 14px; -} - -blockquote { - display: block; - border-left: 4px solid #eee; - margin: 0; - padding-left: 1em; - color: #888; -} - -.class-description { - font-size: 130%; - line-height: 140%; - margin-bottom: 1em; - margin-top: 1em; -} - -.class-description:empty { - margin: 0 -} - -/** Container **/ -#main { - float: right; - min-width: 360px; - width: calc(100% - 250px); - padding: 0 30px 20px 30px; -} - -header { - display: block -} - -section { - display: block; - background-color: #fff; - padding: 0; -} - -.variation { - display: none -} - -.signature-attributes { - font-size: 60%; - color: #aaa; - font-style: italic; - font-weight: lighter; -} - -/** Readme **/ - -.readme { - font-size: 16px; -} - -.readme h1, -.readme h2, -.readme h3, -.readme h4, -.readme h5 { - margin-top: 1em; - margin-bottom: 16px; - font-weight: bold; - padding: 0; -} - -.readme h1 { - font-size: 2em; - padding-bottom: 0.3em; -} - -.readme h2 { - font-size: 1.75em; - padding-bottom: 0.3em; -} - -.readme h3 { - font-size: 1.5em; - background-color: transparent; -} - -.readme h4 { - font-size: 1.25em; -} - -.readme h5 { - font-size: 1em; -} - -.readme img { - max-width: 100%; -} - -.readme ul, .readme ol { - padding-left: 2em; -} - -.readme pre > code { - font-size: 0.85em; -} - -.readme table { - margin-bottom: 1em; - border-collapse: collapse; - border-spacing: 0; -} - -.readme table tr { - background-color: #fff; - border-top: 1px solid #ccc; -} - -.readme table th, -.readme table td { - padding: 6px 13px; - border: 1px solid #ddd; -} - -.readme table tr:nth-child(2n) { - background-color: #f8f8f8; -} - -/** Nav **/ -nav { - float: left; - display: block; - width: 250px; - background: #fff; - overflow: auto; - position: fixed; - height: 100%; - padding: 10px; - border-right: 1px solid #eee; - /* box-shadow: 0 0 3px rgba(0,0,0,0.1); */ -} - -nav li { - list-style: none; - padding: 0; - margin: 0; -} - -.nav-heading { - margin-top: 10px; - font-weight: bold; -} - -.nav-heading a { - color: #888; - font-size: 14px; - display: inline-block; -} - -.nav-item-type { - /* margin-left: 5px; */ - width: 18px; - height: 18px; - display: inline-block; - text-align: center; - border-radius: 0.2em; - margin-right: 5px; - font-weight: bold; - line-height: 20px; - font-size: 13px; -} - -.type-function { - background: #B3E5FC; - color: #0288D1; -} - -.type-class { - background: #D1C4E9; - color: #4527A0; -} - -.type-member { - background: #C8E6C9; - color: #388E3C; -} - -.type-module { - background: #E1BEE7; - color: #7B1FA2; -} - - -/** Footer **/ -footer { - color: hsl(0, 0%, 28%); - margin-left: 250px; - display: block; - padding: 30px; - font-style: italic; - font-size: 90%; - border-top: 1px solid #eee; -} - -.ancestors { - color: #999 -} - -.ancestors a { - color: #999 !important; - text-decoration: none; -} - -.clear { - clear: both -} - -.important { - font-weight: bold; - color: #950B02; -} - -.yes-def { - text-indent: -1000px -} - -.type-signature { - color: #aaa -} - -.name, .signature { - font-family: Consolas, Monaco, 'Andale Mono', monospace -} - -.details { - margin-top: 14px; - border-left: 2px solid #DDD; - line-height: 30px; -} - -.details dt { - width: 120px; - float: left; - padding-left: 10px; -} - -.details dd { - margin-left: 70px -} - -.details ul { - margin: 0 -} - -.details ul { - list-style-type: none -} - -.details li { - margin-left: 30px -} - -.details pre.prettyprint { - margin: 0 -} - -.details .object-value { - padding-top: 0 -} - -.description { - margin-bottom: 1em; - margin-top: 1em; -} - -.code-caption { - font-style: italic; - font-size: 107%; - margin: 0; -} - -.prettyprint { - font-size: 13px; - border: 1px solid #ddd; - border-radius: 3px; - box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.05); - overflow: auto; -} - -.prettyprint.source { - width: inherit -} - -.prettyprint code { - font-size: 12px; - line-height: 18px; - display: block; - background-color: #fff; - color: #4D4E53; -} - -.prettyprint code:empty:before { - content: ''; -} - -.prettyprint > code { - padding: 15px -} - -.prettyprint .linenums code { - padding: 0 15px -} - -.prettyprint .linenums li:first-of-type code { - padding-top: 15px -} - -.prettyprint code span.line { - display: inline-block -} - -.prettyprint.linenums { - padding-left: 70px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.prettyprint.linenums ol { - padding-left: 0 -} - -.prettyprint.linenums li { - border-left: 3px #ddd solid -} - -.prettyprint.linenums li.selected, .prettyprint.linenums li.selected * { - background-color: lightyellow -} - -.prettyprint.linenums li * { - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; -} - -.params, .props { - border-spacing: 0; - border: 1px solid #ddd; - border-collapse: collapse; - border-radius: 3px; - box-shadow: 0 1px 3px rgba(0,0,0,0.1); - width: 100%; - font-size: 14px; - /* margin-left: 15px; */ -} - -.params .name, .props .name, .name code { - color: #4D4E53; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 100%; -} - -.params td, .params th, .props td, .props th { - margin: 0px; - text-align: left; - vertical-align: top; - padding: 10px; - display: table-cell; -} - -.params td { - border-top: 1px solid #eee -} - -.params thead tr, .props thead tr { - background-color: #fff; - font-weight: bold; -} - -.params .params thead tr, .props .props thead tr { - background-color: #fff; - font-weight: bold; -} - -.params td.description > p:first-child, .props td.description > p:first-child { - margin-top: 0; - padding-top: 0; -} - -.params td.description > p:last-child, .props td.description > p:last-child { - margin-bottom: 0; - padding-bottom: 0; -} - -dl.param-type { - /* border-bottom: 1px solid hsl(0, 0%, 87%); */ - margin: 0; - padding: 0; - font-size: 16px; -} - -.param-type dt, .param-type dd { - display: inline-block -} - -.param-type dd { - font-family: Consolas, Monaco, 'Andale Mono', monospace; - display: inline-block; - padding: 0; - margin: 0; - font-size: 14px; -} - -.disabled { - color: #454545 -} - -/* navicon button */ -.navicon-button { - display: none; - position: relative; - padding: 2.0625rem 1.5rem; - transition: 0.25s; - cursor: pointer; - user-select: none; - opacity: .8; -} -.navicon-button .navicon:before, .navicon-button .navicon:after { - transition: 0.25s; -} -.navicon-button:hover { - transition: 0.5s; - opacity: 1; -} -.navicon-button:hover .navicon:before, .navicon-button:hover .navicon:after { - transition: 0.25s; -} -.navicon-button:hover .navicon:before { - top: .825rem; -} -.navicon-button:hover .navicon:after { - top: -.825rem; -} - -/* navicon */ -.navicon { - position: relative; - width: 2.5em; - height: .3125rem; - background: #000; - transition: 0.3s; - border-radius: 2.5rem; -} -.navicon:before, .navicon:after { - display: block; - content: ""; - height: .3125rem; - width: 2.5rem; - background: #000; - position: absolute; - z-index: -1; - transition: 0.3s 0.25s; - border-radius: 1rem; -} -.navicon:before { - top: .625rem; -} -.navicon:after { - top: -.625rem; -} - -/* open */ -.nav-trigger:checked + label:not(.steps) .navicon:before, -.nav-trigger:checked + label:not(.steps) .navicon:after { - top: 0 !important; -} - -.nav-trigger:checked + label .navicon:before, -.nav-trigger:checked + label .navicon:after { - transition: 0.5s; -} - -/* Minus */ -.nav-trigger:checked + label { - transform: scale(0.75); -} - -/* × and + */ -.nav-trigger:checked + label.plus .navicon, -.nav-trigger:checked + label.x .navicon { - background: transparent; -} - -.nav-trigger:checked + label.plus .navicon:before, -.nav-trigger:checked + label.x .navicon:before { - transform: rotate(-45deg); - background: #FFF; -} - -.nav-trigger:checked + label.plus .navicon:after, -.nav-trigger:checked + label.x .navicon:after { - transform: rotate(45deg); - background: #FFF; -} - -.nav-trigger:checked + label.plus { - transform: scale(0.75) rotate(45deg); -} - -.nav-trigger:checked ~ nav { - left: 0 !important; -} - -.nav-trigger:checked ~ .overlay { - display: block; -} - -.nav-trigger { - position: fixed; - top: 0; - clip: rect(0, 0, 0, 0); -} - -.overlay { - display: none; - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - width: 100%; - height: 100%; - background: hsla(0, 0%, 0%, 0.5); - z-index: 1; -} - -.section-method { - margin-bottom: 30px; - padding-bottom: 30px; - border-bottom: 1px solid #eee; -} - -@media only screen and (min-width: 320px) and (max-width: 680px) { - body { - overflow-x: hidden; - } - - nav { - background: #FFF; - width: 250px; - height: 100%; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: -250px; - z-index: 3; - padding: 0 10px; - transition: left 0.2s; - } - - .navicon-button { - display: inline-block; - position: fixed; - top: 1.5em; - right: 0; - z-index: 2; - } - - #main { - width: 100%; - min-width: 360px; - } - - #main h1.page-title { - margin: 1em 0; - } - - #main section { - padding: 0; - } - - footer { - margin-left: 0; - } -} - -@media only print { - nav { - display: none; - } - - #main { - float: none; - width: 100%; - } -} diff --git a/BACKUP/node/out/styles/prettify-jsdoc.css b/BACKUP/node/out/styles/prettify-jsdoc.css deleted file mode 100644 index 834a866..0000000 --- a/BACKUP/node/out/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: hsl(104, 100%, 24%); - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} diff --git a/BACKUP/node/out/styles/prettify-tomorrow.css b/BACKUP/node/out/styles/prettify-tomorrow.css deleted file mode 100644 index 81e74d1..0000000 --- a/BACKUP/node/out/styles/prettify-tomorrow.css +++ /dev/null @@ -1,132 +0,0 @@ -/* Tomorrow Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* Pretty printing styles. Used with prettify.js. */ -/* SPAN elements with the classes below are added by prettyprint. */ -/* plain text */ -.pln { - color: #4d4d4c; } - -@media screen { - /* string content */ - .str { - color: hsl(104, 100%, 24%); } - - /* a keyword */ - .kwd { - color: hsl(240, 100%, 50%); } - - /* a comment */ - .com { - color: hsl(0, 0%, 60%); } - - /* a type name */ - .typ { - color: hsl(240, 100%, 32%); } - - /* a literal value */ - .lit { - color: hsl(240, 100%, 40%); } - - /* punctuation */ - .pun { - color: #000000; } - - /* lisp open bracket */ - .opn { - color: #000000; } - - /* lisp close bracket */ - .clo { - color: #000000; } - - /* a markup tag name */ - .tag { - color: #c82829; } - - /* a markup attribute name */ - .atn { - color: #f5871f; } - - /* a markup attribute value */ - .atv { - color: #3e999f; } - - /* a declaration */ - .dec { - color: #f5871f; } - - /* a variable name */ - .var { - color: #c82829; } - - /* a function name */ - .fun { - color: #4271ae; } } -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { - color: #060; } - - .kwd { - color: #006; - font-weight: bold; } - - .com { - color: #600; - font-style: italic; } - - .typ { - color: #404; - font-weight: bold; } - - .lit { - color: #044; } - - .pun, .opn, .clo { - color: #440; } - - .tag { - color: #006; - font-weight: bold; } - - .atn { - color: #404; } - - .atv { - color: #060; } } -/* Style */ -/* -pre.prettyprint { - background: white; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 12px; - line-height: 1.5; - border: 1px solid #ccc; - padding: 10px; } -*/ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; } - -/* IE indents via margin-left */ -li.L0, -li.L1, -li.L2, -li.L3, -li.L4, -li.L5, -li.L6, -li.L7, -li.L8, -li.L9 { - /* */ } - -/* Alternate shading for lines */ -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - /* */ } diff --git a/BACKUP/node/package-lock.json b/BACKUP/node/package-lock.json deleted file mode 100644 index a760b4d..0000000 --- a/BACKUP/node/package-lock.json +++ /dev/null @@ -1,1015 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "@types/node": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.1.tgz", - "integrity": "sha512-SrmAO+NhnsuG/6TychSl2VdxBZiw/d6V+8j+DFo8O3PwFi+QeYXWHhAw+b170aSc6zYab6/PjEWRZHIDN9mNUw==" - }, - "abab": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", - "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" - }, - "acorn": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", - "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==" - }, - "acorn-globals": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz", - "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", - "requires": { - "acorn": "5.2.1" - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" - } - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "requires": { - "color-convert": "1.9.1" - } - }, - "array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "requires": { - "tweetnacl": "0.14.5" - } - }, - "bindings": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", - "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=" - }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "requires": { - "hoek": "4.2.0" - } - }, - "browser-process-hrtime": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", - "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "color-convert": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "requires": { - "delayed-stream": "1.0.0" - } - }, - "commander": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz", - "integrity": "sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA==" - }, - "content-type-parser": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", - "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "requires": { - "boom": "5.2.0" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "requires": { - "hoek": "4.2.0" - } - } - } - }, - "cssom": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", - "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=" - }, - "cssstyle": { - "version": "0.2.37", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", - "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", - "requires": { - "cssom": "0.3.2" - } - }, - "d3": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/d3/-/d3-4.12.0.tgz", - "integrity": "sha512-ibAzFJrj1uuX+wIy29baTx9JebA5i670UKlp+H3c9pg0w8PKl8jpj4zf64MmLPVBXm2vA1i29obnWuM/rmyfWA==", - "requires": { - "d3-array": "1.2.1", - "d3-axis": "1.0.8", - "d3-brush": "1.0.4", - "d3-chord": "1.0.4", - "d3-collection": "1.0.4", - "d3-color": "1.0.3", - "d3-dispatch": "1.0.3", - "d3-drag": "1.2.1", - "d3-dsv": "1.0.8", - "d3-ease": "1.0.3", - "d3-force": "1.1.0", - "d3-format": "1.2.1", - "d3-geo": "1.9.0", - "d3-hierarchy": "1.1.5", - "d3-interpolate": "1.1.6", - "d3-path": "1.0.5", - "d3-polygon": "1.0.3", - "d3-quadtree": "1.0.3", - "d3-queue": "3.0.7", - "d3-random": "1.1.0", - "d3-request": "1.0.6", - "d3-scale": "1.0.7", - "d3-selection": "1.2.0", - "d3-shape": "1.2.0", - "d3-time": "1.0.8", - "d3-time-format": "2.1.1", - "d3-timer": "1.0.7", - "d3-transition": "1.1.1", - "d3-voronoi": "1.1.2", - "d3-zoom": "1.7.1" - } - }, - "d3-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.1.tgz", - "integrity": "sha512-CyINJQ0SOUHojDdFDH4JEM0552vCR1utGyLHegJHyYH0JyCpSeTPxi4OBqHMA2jJZq4NH782LtaJWBImqI/HBw==" - }, - "d3-axis": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-1.0.8.tgz", - "integrity": "sha1-MacFoLU15ldZ3hQXOjGTMTfxjvo=" - }, - "d3-brush": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-1.0.4.tgz", - "integrity": "sha1-AMLyOAGfJPbAoZSibUGhUw/+e8Q=", - "requires": { - "d3-dispatch": "1.0.3", - "d3-drag": "1.2.1", - "d3-interpolate": "1.1.6", - "d3-selection": "1.2.0", - "d3-transition": "1.1.1" - } - }, - "d3-chord": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-1.0.4.tgz", - "integrity": "sha1-fexPC6iG9xP+ERxF92NBT290yiw=", - "requires": { - "d3-array": "1.2.1", - "d3-path": "1.0.5" - } - }, - "d3-collection": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.4.tgz", - "integrity": "sha1-NC39EoN8kJdPM/HMCnha6lcNzcI=" - }, - "d3-color": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-1.0.3.tgz", - "integrity": "sha1-vHZD/KjlOoNH4vva/6I2eWtYUJs=" - }, - "d3-dispatch": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-1.0.3.tgz", - "integrity": "sha1-RuFJHqqbWMNY/OW+TovtYm54cfg=" - }, - "d3-drag": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-1.2.1.tgz", - "integrity": "sha512-Cg8/K2rTtzxzrb0fmnYOUeZHvwa4PHzwXOLZZPwtEs2SKLLKLXeYwZKBB+DlOxUvFmarOnmt//cU4+3US2lyyQ==", - "requires": { - "d3-dispatch": "1.0.3", - "d3-selection": "1.2.0" - } - }, - "d3-dsv": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-1.0.8.tgz", - "integrity": "sha512-IVCJpQ+YGe3qu6odkPQI0KPqfxkhbP/oM1XhhE/DFiYmcXKfCRub4KXyiuehV1d4drjWVXHUWx4gHqhdZb6n/A==", - "requires": { - "commander": "2.12.2", - "iconv-lite": "0.4.19", - "rw": "1.3.3" - } - }, - "d3-ease": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.3.tgz", - "integrity": "sha1-aL+8NJM4o4DETYrMT7wzBKotjA4=" - }, - "d3-force": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-1.1.0.tgz", - "integrity": "sha512-2HVQz3/VCQs0QeRNZTYb7GxoUCeb6bOzMp/cGcLa87awY9ZsPvXOGeZm0iaGBjXic6I1ysKwMn+g+5jSAdzwcg==", - "requires": { - "d3-collection": "1.0.4", - "d3-dispatch": "1.0.3", - "d3-quadtree": "1.0.3", - "d3-timer": "1.0.7" - } - }, - "d3-format": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.2.1.tgz", - "integrity": "sha512-U4zRVLDXW61bmqoo+OJ/V687e1T5nVd3TAKAJKgtpZ/P1JsMgyod0y9br+mlQOryTAACdiXI3wCjuERHFNp91w==" - }, - "d3-geo": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-1.9.0.tgz", - "integrity": "sha512-94YbAT+q5E/p+XEd4VKiNkQNicrrON3l6eoW70sC8aHjUGoBDJ/Ht8Z/hvhGJJTi2zhYBvUd34Mfqv4TG7we9A==", - "requires": { - "d3-array": "1.2.1" - } - }, - "d3-hierarchy": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-1.1.5.tgz", - "integrity": "sha1-ochFxC+Eoga88cAcAQmOpN2qeiY=" - }, - "d3-interpolate": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.1.6.tgz", - "integrity": "sha512-mOnv5a+pZzkNIHtw/V6I+w9Lqm9L5bG3OTXPM5A+QO0yyVMQ4W1uZhR+VOJmazaOZXri2ppbiZ5BUNWT0pFM9A==", - "requires": { - "d3-color": "1.0.3" - } - }, - "d3-path": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.5.tgz", - "integrity": "sha1-JB6xhJvZ6egCHA0KeZ+KDo5EF2Q=" - }, - "d3-polygon": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-1.0.3.tgz", - "integrity": "sha1-FoiOkCZGCTPysXllKtN4Ik04LGI=" - }, - "d3-quadtree": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-1.0.3.tgz", - "integrity": "sha1-rHmH4+I/6AWpkPKOG1DTj8uCJDg=" - }, - "d3-queue": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/d3-queue/-/d3-queue-3.0.7.tgz", - "integrity": "sha1-yTouVLQXwJWRKdfXP2z31Ckudhg=" - }, - "d3-random": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-1.1.0.tgz", - "integrity": "sha1-ZkLlBsb6OmSFldKyRpeIqNElKdM=" - }, - "d3-request": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/d3-request/-/d3-request-1.0.6.tgz", - "integrity": "sha512-FJj8ySY6GYuAJHZMaCQ83xEYE4KbkPkmxZ3Hu6zA1xxG2GD+z6P+Lyp+zjdsHf0xEbp2xcluDI50rCS855EQ6w==", - "requires": { - "d3-collection": "1.0.4", - "d3-dispatch": "1.0.3", - "d3-dsv": "1.0.8", - "xmlhttprequest": "1.8.0" - } - }, - "d3-scale": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-1.0.7.tgz", - "integrity": "sha512-KvU92czp2/qse5tUfGms6Kjig0AhHOwkzXG0+PqIJB3ke0WUv088AHMZI0OssO9NCkXt4RP8yju9rpH8aGB7Lw==", - "requires": { - "d3-array": "1.2.1", - "d3-collection": "1.0.4", - "d3-color": "1.0.3", - "d3-format": "1.2.1", - "d3-interpolate": "1.1.6", - "d3-time": "1.0.8", - "d3-time-format": "2.1.1" - } - }, - "d3-selection": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-1.2.0.tgz", - "integrity": "sha512-xW2Pfcdzh1gOaoI+LGpPsLR2VpBQxuFoxvrvguK8ZmrJbPIVvfNG6pU6GNfK41D6Qz15sj61sbW/AFYuukwaLQ==" - }, - "d3-shape": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.2.0.tgz", - "integrity": "sha1-RdAVOPBkuv0F6j1tLLdI/YxB93c=", - "requires": { - "d3-path": "1.0.5" - } - }, - "d3-time": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.0.8.tgz", - "integrity": "sha512-YRZkNhphZh3KcnBfitvF3c6E0JOFGikHZ4YqD+Lzv83ZHn1/u6yGenRU1m+KAk9J1GnZMnKcrtfvSktlA1DXNQ==" - }, - "d3-time-format": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.1.1.tgz", - "integrity": "sha512-8kAkymq2WMfzW7e+s/IUNAtN/y3gZXGRrdGfo6R8NKPAA85UBTxZg5E61bR6nLwjPjj4d3zywSQe1CkYLPFyrw==", - "requires": { - "d3-time": "1.0.8" - } - }, - "d3-timer": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.7.tgz", - "integrity": "sha512-vMZXR88XujmG/L5oB96NNKH5lCWwiLM/S2HyyAQLcjWJCloK5shxta4CwOFYLZoY3AWX73v8Lgv4cCAdWtRmOA==" - }, - "d3-transition": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-1.1.1.tgz", - "integrity": "sha512-xeg8oggyQ+y5eb4J13iDgKIjUcEfIOZs2BqV/eEmXm2twx80wTzJ4tB4vaZ5BKfz7XsI/DFmQL5me6O27/5ykQ==", - "requires": { - "d3-color": "1.0.3", - "d3-dispatch": "1.0.3", - "d3-ease": "1.0.3", - "d3-interpolate": "1.1.6", - "d3-selection": "1.2.0", - "d3-timer": "1.0.7" - } - }, - "d3-voronoi": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/d3-voronoi/-/d3-voronoi-1.1.2.tgz", - "integrity": "sha1-Fodmfo8TotFYyAwUgMWinLDYlzw=" - }, - "d3-zoom": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-1.7.1.tgz", - "integrity": "sha512-sZHQ55DGq5BZBFGnRshUT8tm2sfhPHFnOlmPbbwTkAoPeVdRTkB4Xsf9GCY0TSHrTD8PeJPZGmP/TpGicwJDJQ==", - "requires": { - "d3-dispatch": "1.0.3", - "d3-drag": "1.2.1", - "d3-interpolate": "1.1.6", - "d3-selection": "1.2.0", - "d3-transition": "1.1.1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "1.0.0" - } - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.0.tgz", - "integrity": "sha512-WpwuBlZ2lQRFa4H/4w49deb9rJLot9KmqrKKjMc9qBl7CID+DdC2swoa34ccRl+anL2B6bLp6TjFdIdnzekMBQ==" - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "requires": { - "jsbn": "0.1.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "escodegen": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", - "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", - "requires": { - "esprima": "3.1.3", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.5.7" - } - }, - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", - "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" - } - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "1.0.0" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "requires": { - "ajv": "5.5.2", - "har-schema": "2.0.0" - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" - }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "hoek": "4.2.0", - "sntp": "2.1.0" - } - }, - "hoek": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" - }, - "html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", - "requires": { - "whatwg-encoding": "1.0.3" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "immutable": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", - "integrity": "sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "jsdom": { - "version": "11.5.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.5.1.tgz", - "integrity": "sha512-89ztIZ03aYK9f1uUrLXLsZndRge/JnZjzjpaN+lrse3coqz+8PR/dX4WLHpbF5fIKTXhDjFODOJw2328lPJ90g==", - "requires": { - "abab": "1.0.4", - "acorn": "5.2.1", - "acorn-globals": "4.1.0", - "array-equal": "1.0.0", - "browser-process-hrtime": "0.1.2", - "content-type-parser": "1.0.2", - "cssom": "0.3.2", - "cssstyle": "0.2.37", - "domexception": "1.0.0", - "escodegen": "1.9.0", - "html-encoding-sniffer": "1.0.2", - "left-pad": "1.2.0", - "nwmatcher": "1.4.3", - "parse5": "3.0.3", - "pn": "1.0.0", - "request": "2.83.0", - "request-promise-native": "1.0.5", - "sax": "1.2.4", - "symbol-tree": "3.2.2", - "tough-cookie": "2.3.3", - "webidl-conversions": "4.0.2", - "whatwg-encoding": "1.0.3", - "whatwg-url": "6.4.0", - "xml-name-validator": "2.0.1" - } - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "left-pad": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.2.0.tgz", - "integrity": "sha1-0wpzxrggHY99jnlWupYWCHpo4O4=" - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" - } - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" - }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" - }, - "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" - }, - "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", - "requires": { - "mime-db": "1.30.0" - } - }, - "minami": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/minami/-/minami-1.2.3.tgz", - "integrity": "sha1-mbbc37LwpU2hycj3qjoyd4eq+fg=", - "dev": true - }, - "nan": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.4.0.tgz", - "integrity": "sha1-+zxZ1F/k7/4hXwuJD4rfbrMtIjI=" - }, - "nanomsg": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/nanomsg/-/nanomsg-4.0.0.tgz", - "integrity": "sha1-EAuTGxwbatSl8RpJNp2Nv8bdXmI=", - "requires": { - "bindings": "1.2.1", - "nan": "2.4.0" - } - }, - "nwmatcher": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", - "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==" - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" - } - }, - "parse5": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", - "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", - "requires": { - "@types/node": "8.5.1" - } - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "pn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pn/-/pn-1.0.0.tgz", - "integrity": "sha1-HPWjCw2AbNGPiPxBprXUrWFbO6k=" - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", - "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.3.1", - "har-validator": "5.0.3", - "hawk": "6.0.2", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", - "oauth-sign": "0.8.2", - "performance-now": "2.1.0", - "qs": "6.5.1", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.3", - "tunnel-agent": "0.6.0", - "uuid": "3.1.0" - } - }, - "request-promise-core": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", - "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", - "requires": { - "lodash": "4.17.4" - } - }, - "request-promise-native": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", - "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", - "requires": { - "request-promise-core": "1.1.1", - "stealthy-require": "1.1.1", - "tough-cookie": "2.3.3" - } - }, - "rw": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", - "integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=" - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" - }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "requires": { - "hoek": "4.2.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, - "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - } - }, - "stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "requires": { - "has-flag": "2.0.0" - } - }, - "symbol-tree": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", - "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=" - }, - "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", - "requires": { - "punycode": "1.4.1" - } - }, - "tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", - "requires": { - "punycode": "2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" - } - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "5.1.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "requires": { - "prelude-ls": "1.1.2" - } - }, - "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - } - }, - "webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" - }, - "whatwg-encoding": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", - "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", - "requires": { - "iconv-lite": "0.4.19" - } - }, - "whatwg-url": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.4.0.tgz", - "integrity": "sha512-Z0CVh/YE217Foyb488eo+iBv+r7eAQ0wSTyApi9n06jhcA3z6Nidg/EGvl0UFkg7kMdKxfBzzr+o9JF+cevgMg==", - "requires": { - "lodash.sortby": "4.7.0", - "tr46": "1.0.1", - "webidl-conversions": "4.0.2" - } - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" - }, - "xml-name-validator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz", - "integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=" - }, - "xmlhttprequest": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", - "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" - } - } -} diff --git a/BACKUP/node/recorder.js b/BACKUP/node/recorder.js deleted file mode 100644 index 4fbd0f3..0000000 --- a/BACKUP/node/recorder.js +++ /dev/null @@ -1,162 +0,0 @@ -"use strict" - -const nanomsg = require("nanomsg") -const uuidv4 = require("uuid/v4") -const _ = require("./collections.js") -const util = require("util") - -const Msg = require("./msg.js") -const Endpoint = require("./endpoint.js") -const Mailbox = require("./mailbox.js") - -const sleep = ms => new Promise((resolve, reject) => setTimeout(resolve, ms)) - - -/** - * A session event with label, data, and timestamp. - * - * {ep, {id, state, peer, roles}} - * - */ -class SessionEvent { - constructor(label, data) { - this.label = label - this.data = data - this.time = new Date() - } - - static Endpoint(ep) { - return new SessionEvent("endpoint", ep) - } - - static CloseEndpoint(ep) { - return new SessionEvent("closeendpoint", ep) - } - - static Mailbox(mbox) { - return new SessionEvent("mailbox", mbox) - } - - static CloseMailbox(mbox) { - return new SessionEvent("closemailbox", mbox) - } - - /** - * [Send description] - * @param {uuid} f [description] - * @param {Array} ts [description] - * @param {Msg} msg [description] - */ - static Send(f, ts, msg) { - return new SessionEvent("send", {msg: msg, from: f, to: ts.clone()}) - } - - /** - * [Recv description] - * @param {uuid} f [description] - * @param {uuid} t [description] - * @param {Msg} msg [description] - */ - static Recv(f, t, msg) { - return new SessionEvent("recv", {msg: msg, from: f, to: t}) - } - - -} - - -class SessionRecorderWorker { - constructor(addr) { - this.events = [] - - this.sock = nanomsg.socket("pair") - this.sock.setEncoding("utf8") - this.sock.connect(addr) - - this.sock.on("data", msg => { - msg = JSON.parse(msg) - this.dispatch(msg) - }) - } - - dispatch(msg) { - switch (msg.label) { - case "endpoint": - this.events.push(SessionEvent.Endpoint(msg.payload)) - break - case "closeendpoint": - this.events.push(SessionEvent.CloseEndpoint(msg.payload)) - break - case "mailbox": - this.events.push(SessionEvent.Mailbox(msg.payload)) - break - case "closemailbox": - this.events.push(SessionEvent.CloseMailbox(msg.payload)) - break - case "send": - this.send(msg.payload.endpoint, msg.payload.msg) - break - case "recv": - this.recv(msg.payload.endpoint, msg.payload.msg) - break - } - } - - send(ep, msg) { - const f = ep.id - const peers = new Map(ep.peers).foldr([], (uuid, role, base) => { - if (uuid != f) base.push(uuid) - return base - }) - - this.events.push(SessionEvent.Send(f, msg.receivers.length > 0 ? msg.receivers : peers, msg)) - } - - recv(ep, msg) { - const f = msg.sender - const t = ep.id - - this.events.push(SessionEvent.Recv(f, t, msg)) - } -} - -class SessionRecorder { - constructor() { - const addr = `inproc://${uuidv4()}` - this.sock = nanomsg.socket("pair") - this.sock.setEncoding("utf8") - this.sock.bind(addr) - this.worker = new SessionRecorderWorker(addr) - } - - endpoint(ep) { - this.sock.send(JSON.stringify(new Msg("endpoint", null, ep))) - } - - closeendpoint(ep) { - this.sock.send(JSON.stringify(new Msg("closeendpoint", null, ep))) - } - - mailbox(mbox) { - this.sock.send(JSON.stringify(new Msg("mailbox", null, mbox))) - } - - closemailbox(mbox) { - this.sock.send(JSON.stringify(new Msg("closemailbox", null, mbox))) - } - - send(ep, msg) { - this.sock.send(JSON.stringify(new Msg("send", null, {endpoint: ep, msg: msg}))) - } - - recv(ep, msg) { - this.sock.send(JSON.stringify(new Msg("recv", null, {endpoint: ep, msg: msg}))) - } - - events() { - return this.worker.events - } -} - -const instance = new SessionRecorder() -module.exports = instance \ No newline at end of file diff --git a/BACKUP/node/renderer.js b/BACKUP/node/renderer.js deleted file mode 100644 index c8bb276..0000000 --- a/BACKUP/node/renderer.js +++ /dev/null @@ -1,339 +0,0 @@ -"use strict" - -// d3.selection.prototype.moveToFront = function () { -// console.log(this) -// return this.each(() => { this.parentNode.appendChild(this) }) -// } - -// d3.selection.prototype.moveToBack = function () { -// return this.each(() => { -// const firstChild = this.parentNode.firstChild -// if (firstChild) { this.parentNode.insertBefore(this, firstChild) } -// }) -// } - -class DataManager { - constructor() { - this.nodes = [] - this.links = [] - this.event = [] - - this.nodecmp = (a, b) => a.id == b.id - this.linkcmp = (a, b) => { - if (a.kind != b.kind) - return false - - if ((a.source == b.source && a.target == b.target) || - (a.source == b.target && a.target == b.source)) - return true - - return false - } - } - - endpoints() { return this.nodes.filter(n => n.kind == "endpoint") } - mailboxes() { return this.nodes.filter(n => n.kind == "mailbox") } - mboxlinks() { return this.links.filter(n => n.kind == "mailbox") } - msglinks() { return this.links.filter(n => n.kind == "msg") } - peerlinks() { return this.links.filter(n => n.kind == "peer") } - - deactivate() { - this.links = this.links.filter(l => l.kind != "msg") - this.nodes.filter(n => n.active == true).forEach(n => n.active = false) - this.links.filter(l => l.active == true).forEach(l => l.active = false) - } - - onnode(node, cmp = this.nodecmp) { - let index = this.nodes.findIndex(n => cmp(n, node)) - if (index < 0) index = this.nodes.length - - this.nodes[index] = Object.assign(this.nodes[index] || {}, node) - return index - } - - onlink(link, cmp = this.linkcmp) { - let index = this.links.findIndex(l => cmp(l, link)) - if (index < 0) index = this.links.length - - this.links[index] = Object.assign(this.links[index] || {}, link) - return index - } - - onendpoint(ev) { - const ep = ev.data - const index = this.onnode(ep) - Object.assign(this.nodes[index], { kind: "endpoint", active: true }) - - // If there is a change in the peer map. - if (ep.peers && - !ep.peers.every(([_, peer]) => this.links.some(l => { - const link = {kind: "peer", source: ep.id, target: peer} - return this.linkcmp(l, link) - }))) { - - // remove existing peer links - this.links = this.links.filter(l => !(l.kind == "peer" && [l.source, l.target].includes(ep.id))) - - ep.peers.forEach(([_, peer]) => { - if (peer != ep.id) { - const link = {kind: "peer", source: ep.id, target: peer, time: ev.time.getTime(), active: true} - this.onlink(link) - } - }) - } - - // If the endpoint is gone. - if (ep.state == "term") { - const mbox = this.nodes.find(n => n.endpoint == ep.id) - - this.nodes = this.nodes.filter(n => ![ep.id, mbox.id].includes(n.id)) - this.links = this.links.filter(l => !([l.source, l.target].includes(ep.id))) - this.links = this.links.filter(l => !([l.source, l.target].includes(mbox.id))) - } - } - - onmailbox(ev) { - const mbox = ev.data - let index = this.onnode(mbox) - Object.assign(this.nodes[index], { kind: "mailbox", active: true }) - - // If the endpoint is not yet created, fake one first. - if (this.nodes.findIndex(n => n.id == mbox.endpoint) < 0) - this.onendpoint({data: {id: mbox.endpoint, roles: []}}) - - // If there's no such link, create it. - const link = {kind: "mailbox", source: mbox.endpoint, target: mbox.id, time: ev.time.getTime(), active: true} - if (!this.links.some(l => this.linkcmp(l, link))) - this.onlink(link) - } - - onsend(ev) { - ev.data.to.forEach(t => { - const link = {kind: "msg", source: ev.data.from, target: t, msg: ev.data.msg, time: ev.time.getTime(), active: true} - this.onlink(link) - this.nodes.find(n => n.id == ev.data.from).active = true - }) - } - - onrecv(ev) { - const link = {kind: "msg", source: ev.data.from, target: ev.data.to, msg: ev.data.msg, time: ev.time.getTime(), active: true} - this.onlink(link) - this.nodes.find(n => n.id == ev.data.to).active = true - } - - oncloseendpoint(ev) { - const ep = ev.data - - this.nodes = this.nodes.filter(n => n.id != ep.id) - this.links = this.links.filter(l => ![l.source.id, l.target.id].includes(ep.id)) - } - - onclosemailbox(ev) { - const mbox = ev.data - - console.log(this.links) - this.nodes = this.nodes.filter(n => n.id != mbox.id) - this.links = this.links.filter(l => ![l.source.id, l.target.id].includes(mbox.id)) - console.log(this.links) - - } - - on(ev) { - this.deactivate() - this.event[0] = ev - - switch (ev.label) { - case "endpoint": - this.onendpoint(ev) - break - case "mailbox": - this.onmailbox(ev) - break - case "send": - this.onsend(ev) - break - case "recv": - this.onrecv(ev) - break - case "closeendpoint": - this.oncloseendpoint(ev) - break - case "closemailbox": - this.onclosemailbox(ev) - break - } - } -} - - -class SVGManager { - constructor(svg, log) { - this.svg = svg - this.log = log - - this.reset() - } - - reset() { - this.svg.selectAll("*").remove() - this.log.html(null) - - this.peerlinks = this.svg.append("g").attr("class", "peerlinks").property("__data__", {zindex: 1}) - this.mboxlinks = this.svg.append("g").attr("class", "mboxlinks").property("__data__", {zindex: 2}) - this.msglinks = this.svg.append("g").attr("class", "msglinks").property("__data__", {zindex: 3}) - this.mailboxes = this.svg.append("g").attr("class", "mailboxes").property("__data__", {zindex: 4}) - this.endpoints = this.svg.append("g").attr("class", "endpoints").property("__data__", {zindex: 5}) - } - - zindex() { - this.svg.selectAll("g").sort((a, b) => a.zindex - b.zindex) - this.svg.selectAll("text").raise() - } - - circle(svg, data) { - const nodes = svg.selectAll("circle").data(data, d => d.id) - nodes.enter().append("circle").attr("r", 10) - nodes.exit().remove() - - const labels = svg.selectAll("text").data(data, d => d.id) - labels.enter().append("text") - labels.exit().remove() - - nodes.attr("cx", d => d.x).attr("cy", d => d.y) - labels.attr("x", d => d.x + 10).attr("y", d => d.y - 10) - - return [nodes, labels] - } - - line(svg, data) { - const links = svg.selectAll("line").data(data) - links.enter().append("line") - links.exit().remove() - links.attr("x1", d => d.source.x).attr("y1", d => d.source.y).attr("x2", d => d.target.x).attr("y2", d => d.target.y) - - return links - } - - renderEndpoints(data) { - const [nodes, labels] = this.circle(this.endpoints, data) - - nodes.classed("endpoint", true).classed("active", d => d.active) - labels.text(d => `[${d.roles}]@${d.state}`) - } - - renderMailboxes(data) { - const [nodes, labels] = this.circle(this.mailboxes, data) - - nodes.classed("mailbox", true).classed("active", d => d.active) - labels.text(d => JSON.stringify(d.mails.map(m => m.label))) - } - - renderMboxlinks(data) { - const links = this.line(this.mboxlinks, data) - links.classed("mboxlink", true).classed("active", d => d.active) - } - - renderMsglinks(data) { - const links = this.line(this.msglinks, data) - links.classed("msglink", true).classed("active", d => d.active) - - const labels = this.msglinks.selectAll("text").data(data, d => d.id) - labels.enter().append("text").merge(labels) - .text(d => d.msg.label) - .attr("x", d => (d.source.x + d.target.x)/2 + 10) - .attr("y", d => (d.source.y + d.target.y)/2 - 10) - - labels.exit().remove() - - } - - renderPeerlinks(data) { - const links = this.line(this.peerlinks, data) - links.classed("peerlink", true).classed("active", d => d.active) - } - - renderLogs(data) { - const text = this.log.selectAll("code").data(data) - text.enter().append("code").merge(text).classed("json", true).text(d => JSON.stringify(d, null, 2)) - } -} - -class SessionRenderer { - constructor(events, svg, log) { - - this.events = events - this.step = -1 - - // The force simulation layout. - this.force = d3.forceSimulation() - .force("charge", d3.forceManyBody().strength(-1000)) - .force("collide", d3.forceCollide(d => d.r * 4).iterations(16)) - .force("x", d3.forceX()) - .force("y", d3.forceY()) - .force("mailbox", d3.forceLink().id(d => d.id)) - .force("msg", d3.forceLink().id(d => d.id)) - .force("peer", d3.forceLink().id(d => d.id)) - - this.dm = new DataManager() - this.sm = new SVGManager(d3.select(svg), d3.select(log)) - } - - resize(w, h) { - this.force.force("center", d3.forceCenter(w/2, h/2)) - this.force.restart() - this.force.alpha(1) - } - - reset(events) { - this.sm.reset() - this.dm = new DataManager() - - this.step = -1 - this.events = events - } - - ontick() { - const sm = this.sm - const dm = this.dm - - sm.renderPeerlinks(dm.peerlinks()) - sm.renderMboxlinks(dm.mboxlinks()) - sm.renderMsglinks(dm.msglinks()) - sm.renderMailboxes(dm.mailboxes()) - sm.renderEndpoints(dm.endpoints()) - - sm.zindex() - } - - onend() { - this.sm.zindex() - } - - forward() { - - this.step += 1 - - const ev = this.events[this.step] - console.log(ev) - this.dm.on(ev) - - this.sm.renderPeerlinks(this.dm.peerlinks()) - this.sm.renderMboxlinks(this.dm.mboxlinks()) - this.sm.renderMsglinks(this.dm.msglinks()) - this.sm.renderMailboxes(this.dm.mailboxes()) - this.sm.renderEndpoints(this.dm.endpoints()) - this.sm.renderLogs(this.dm.event) - - - this.force.nodes(this.dm.nodes) - this.force.force("mailbox").id(d => d.id).links(this.dm.mboxlinks()) - this.force.force("msg").id(d => d.id).links(this.dm.msglinks()) - this.force.force("peer").id(d => d.id).links(this.dm.peerlinks()) - - this.force.on("tick", () => this.ontick()) - this.force.restart() - this.force.alpha(1) - } -} - -export { SessionRenderer } \ No newline at end of file diff --git a/BACKUP/node/socket.js b/BACKUP/node/socket.js deleted file mode 100644 index 4d34e90..0000000 --- a/BACKUP/node/socket.js +++ /dev/null @@ -1,141 +0,0 @@ -"use strict" - -const nanomsg = require("nanomsg") -const assert = require("assert") - -const _ = require("./collections.js") -const Logger = require("./recorder.js") - -/** - * A warpper for socket implementations. - */ -class Sock { - - /** - * @param {String} proto - SP protocol string. Could be "bus", "pair", etc. - * @param {Endpoint} ep - Owning endpoint. - * @param {Object} opts={} - Options for the socket. e.g. `{raw: true}` - * @return {Sock} - */ - constructor(proto, ep, opts={}) { - - /** - * @callback Sock.Handler - * @param {Msg} msg - * @return {Void} - */ - - /** - * A copy of the installed handler. - * @type {Sock.Handler} - */ - this.handler = null - - /** - * @type {Endpoint} - */ - this.endpoint = ep - - /** - * @type {nanomsg.Socket} - */ - this.sock = nanomsg.socket(proto, opts) - this.sock.setEncoding("utf8") - - this.sock.on("error", e => { - this.sock.close() - console.error(e, "\n", e.stack.split("\n")) - }) - } - - /** - * Bind the address. - * @param {String} addr - * @return {Int} A nanomsg endpoint id. Returns -1 on error. - */ - bind(addr) { - try { - const eid = this.sock.bind(addr) - assert(this.sock.bound[addr] >= 0) - return eid - } catch(e) { - this.sock.close() - console.error(e, e.stack.split("\n")) - return -1 - } - } - - /** - * Connect to an address. - * @param {String} addr - * @return {Int} A nanomsg endpoint id. Returns -1 on error. - */ - connect(addr) { - try { - const eid = this.sock.connect(addr) - assert(this.sock.connected[addr] >= 0) - return eid - } catch(e) { - this.sock.close() - console.error(e, e.stack.split("\n")) - return -1 - } - } - - /** - * Disconnect from an address. - * @param {String} addr - * @return {Int} A nanomsg endpoint id. Returns -1 if the address is not previously connected. - */ - disconnect(addr) { - if (addr in this.sock.connected) { - const eid = this.sock.connected[addr] - this.sock.shutdown(eid) - return eid - } - - return -1 - } - - /** - * Close the socket. - * @return {Void} - */ - close() { - return this.sock.close() - } - - /** - * Set/Get the message handler. - * - * When installing, all previously installed handler will be replaced. - * - * @param {Sock.Handler} handler - * @return {Void} - */ - set onmessage(handler) { - this.sock.removeAllListeners("data") - this.handler = handler - this.sock.on("data", msg => { - this.handler(JSON.parse(msg)) - }) - } - - get onmessage() { - return this.handler - } - - /** - * Send a payload via the sokcet. - * - * @param {Object} payload - A JSON-serializable payload. - * @return {Int} Actual bytes sent. - */ - send(payload) { - const sent = this.sock.send(JSON.stringify(payload)) - assert(sent > 0) - return sent - } -} - -module.exports = Sock \ No newline at end of file diff --git a/BACKUP/node/test.js b/BACKUP/node/test.js deleted file mode 100644 index fe00c05..0000000 --- a/BACKUP/node/test.js +++ /dev/null @@ -1,117 +0,0 @@ -"use strict" - -const nanomsg = require("nanomsg") -const fs = require("fs") -const chalk = require("chalk") -const uuidv4 = require("uuid/v4") -const util = require("util") - -const Endpoint = require("./endpoint.js") - -const C = 1 -const S = 0 - -async function create(fn, file=`/tmp/${uuidv4()}.ipc`) { - try { fs.unlinkSync(file) } catch (e) {} - - const addr = "ipc://" + file - const server = new Endpoint(addr, [S]) - const client = new Endpoint(addr, [C]) - - server.init([S, C]).then(async () => { await fn(server) }) - await client.init([S, C]) - return client -} - - -async function empty() { - const server = async (out) => { - const choice = await out.receive(C) - switch (choice) { - case "right": - await out.close() - break - case "left": - const x = await out.receive(C) - const tail = await empty() - const inp = await elem(tail, x) - console.log("here") - - const ep = await Endpoint.link(inp, out) - await ep.close() - break - } - } - - return await create(server) -} - -async function elem(tail, e) { - const server = async (out, inp) => { - const choice = await out.receive(C) - switch (choice) { - case "right": - out.broadcast(e) - const ep = await Endpoint.link(out, inp) - await ep.close() - break - case "left": - const y = await out.receive(C) - inp.broadcast("left") - inp.broadcast(y) - await server(out, inp) - break - } - } - - return await create(out => { - console.debug("Here in the elem") - server(out, tail) - }) -} - -async function enq(queue, x) { - queue.broadcast("left") - queue.broadcast(x) -} - -async function deq(queue) { - queue.broadcast("right") - return await queue.receive(S) -} - -async function free(queue) { - queue.broadcast("right") - await queue.wait(S) -} - -async function main() { - let queue = await empty() - let x = 0 - - await enq(queue, 1) - await enq(queue, 2) - x = await deq(queue) - console.info(x) - x = await deq(queue) - console.info(x) - await free(queue) - - - nanomsg.term() - process.exit() -} - - -const logger = require("./recorder.js") -setTimeout(() => { - console.log(JSON.stringify(logger.events())) - nanomsg.term() - process.exit() -}, 10000) - -try { - main() -} catch (e) { - console.log(util.inspect(e)) -} \ No newline at end of file diff --git a/BACKUP/node/util.js b/BACKUP/node/util.js deleted file mode 100644 index d498724..0000000 --- a/BACKUP/node/util.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict" - -// nodejs util library -let util = require("util") - -util.sleep = ms => - new Promise((resolve, reject) => setTimeout(resolve, ms)) - -util.waituntil = async (cond) => { - while (!cond) { - await new Promise((resolve, reject) => setTimeout(resolve, 1)) - } -} - -module.exports = util \ No newline at end of file diff --git a/BACKUP/node/visualizer.css b/BACKUP/node/visualizer.css deleted file mode 100644 index 3b73289..0000000 --- a/BACKUP/node/visualizer.css +++ /dev/null @@ -1,126 +0,0 @@ -.gutter { - background-color: #eee; - background-repeat: no-repeat; - background-position: 50%; -} - -.gutter.gutter-vertical { - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=') -} - -.gutter.gutter-horizontal { - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==') -} - -.split { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - - overflow-y: auto; - overflow-x: hidden; -} - -.split, .gutter.gutter-horizontal { - float: left; - height: 100%; - -} - - - -/* svg related */ - -svg { - height: 100%; - width: 100%; -} - -.endpoint { - fill: orange; -} - -.mailbox { - fill: lightblue; -} - -.mboxlink { - stroke: gray; - stroke-width: 1px; -} - -.msglink { - stroke: gray; - stroke-width: 3px; -} - -.active, -.msglink.active, -.mboxlink.active { - stroke: red; - stroke-width: 3px; -} - -.peerlink { - stroke: orange; - stroke-width: 6px; -} - -.peerlink.active { - stroke: red; -} - -text { - font-family: inconsolata; - font-size: 12pt; -} - -/* layout related */ - -body { - position: absolute; - height: 100%; - width: 100%; - top: 0; - left: 0; -} - -code { - background-color: transparent !important; -} - -#main { - padding-top:52px; - height: 100vh; - width: 100vw -} - -#left, #right { - height: 100%; -} - -#input { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - - font-family: inconsolata; - - min-width: calc( 100% - 10px); !important; - max-width: none; - width: calc( 100% - 10px); - - max-height: none; - - margin-left: 10px; - margin-top: 10px; - - resize: none; - background-color: #eee; -} - -#output { - width: 100%; - margin: 0; - background-color: #eee; -} \ No newline at end of file diff --git a/BACKUP/node/visualizer.html b/BACKUP/node/visualizer.html deleted file mode 100644 index d9e46f8..0000000 --- a/BACKUP/node/visualizer.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - Session Visulizer - - - - - - - - - -
- - -
- -
-
- - - -
- - - - \ No newline at end of file diff --git a/BACKUP/node2/.gitignore b/BACKUP/node2/.gitignore deleted file mode 100644 index 3c3629e..0000000 --- a/BACKUP/node2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/BACKUP/node2/Makefile b/BACKUP/node2/Makefile deleted file mode 100644 index e202264..0000000 --- a/BACKUP/node2/Makefile +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -test: *.js - rm -rf /tmp/*.ipc - node index.js "A" & node index.js "B" & node index.js "C" - diff --git a/BACKUP/node2/collection.js b/BACKUP/node2/collection.js deleted file mode 100644 index 12e461c..0000000 --- a/BACKUP/node2/collection.js +++ /dev/null @@ -1,222 +0,0 @@ -"use strict" - -/** - * Extensions to Array - */ - -Array.prototype.foldr = function (base, fn) { - const fold = (base, index) => { - if (index == this.length) - return base - return fn(this[index], fold(base, index+1)) - } - return fold(base, 0) -} - -Array.prototype.foldl = function (base, fn) { - const fold = (base, index) => { - if (index == this.length) - return base - return fold(fn(this[index], base), index+1) - } - return fold(base, 0) -} - -Array.prototype.clone = function () { - return this.slice(0) -} - -Array.prototype.dedup = function () { - const set = new Set(this) - return set.toJSON() -} - - - -/** - * Extensions to Set - */ - - -Set.prototype.isSupersetOf = function (other) { - return other.every(e => this.has(e)) -} - -Set.prototype.isSubsetOf = function (other) { - return this.every(e => other.has(e)) -} - -Set.prototype.equal = function (other) { - return this.isSubsetOf(other) && this.isSupersetOf(other) -} - -Set.prototype.filter = function (fn) { - return new Set(this.toJSON().filter(fn)) -} - -Set.prototype.every = function (fn) { - for (const e of this) { - if (!fn(e)) return false - } - return true -} - -Set.prototype.some = function (fn) { - for (const e of this) { - if (fn(e)) return true - } - return false -} - -Set.prototype.clone = function () { - return new Set(this) -} - -Set.prototype.different = function (other) { - this.forEach(e => {if (other.has(e)) this.delete(e)}) - return this -} - -Set.prototype.intersect = function (other) { - this.forEach(e => {if (!other.has(e)) this.delete(e)}) - return this -} - -Set.prototype.union = function (other) { - other.forEach(e => this.add(e)) - return this -} - -Set.prototype.toJSON = function () { - return [...this] -} - -Set.prototype.foldr = function (base, fn) { - const tmp = [...this] - const fold = (base, index) => { - if (index == this.size) - return base - return fn(tmp[index], fold(base, index+1)) - } - return fold(base, 0) -} - -Set.prototype.foldl = function (base, fn) { - const tmp = [...this] - const fold = (base, index) => { - if (index == this.size) - return base - return fold(fn(tmp[index], base), index+1) - } - return fold(base, 0) -} - -Set.prototype.map = function (fn) { - const tmp = [...this] - const mapped = tmp.map((val, x, y) => fn(val)) - - return new Set(mapped) -} - -Set.prototype.deleteall = function (fn) { - this.forEach(e => {if (fn(e)) this.delete(e)}) -} - -Set.prototype.find = function (fn) { - for (const e of this) { - if (fn(e)) return e - } - return null -} - -// Set.is - -Set.intersect = function (a, b) { - let ret = a.clone() - ret.intersect(b) - return ret -} - -Set.union = function (a, b) { - let ret = a.clone() - ret.union(b) - return ret -} - -Set.minus = function (a, b) { - let ret = a.clone() - ret.different(b) - return ret -} - -/** - * Extensions to Map - */ - -Map.prototype.clone = function () { - return new Map(this) -} - -Map.prototype.every = function (fn) { - for (const [key, value] of this) { - if (!fn(value, key)) return false - } - return true -} - -Map.prototype.some = function (fn) { - for (const [key, value] of this) { - if (fn(value, key)) return true - } - return false -} - -Map.prototype.foldr = function (base, fn) { - const iter = this.entries() - const fold = base => { - const item = iter.next() - if (item.done) - return base - - // item.value = [key, val] - return fn(item.value[1], item.value[0], fold(base)) - } - return fold(base) -} - -Map.prototype.foldl = function (base, fn) { - const iter = this.entries() - const fold = base => { - const item = iter.next() - if (item.done) - return base - - // item.value = [key, val] - return fold(fn(item.value[1], item.value[0], base)) - } - return fold(base) -} - -Map.prototype.override = function (other) { - other.forEach((v, k) => this.set(k, v)) -} - -Map.prototype.extend = function (other) { - other.forEach((v, k) => this.has(k) ? null : this.set(k, v)) -} - -Map.prototype.haskey = function (key) { - return this.has(key) -} - -Map.prototype.hasvalue = function (value) { - return this.some((v, k) => v === value) -} - -Map.prototype.toJSON = function () { - return [...this] -} - -Map.prototype.uniqueValues = function () { - return (new Set(this.values())).toJSON() -} diff --git a/BACKUP/node2/endpoint.js b/BACKUP/node2/endpoint.js deleted file mode 100644 index 77002ca..0000000 --- a/BACKUP/node2/endpoint.js +++ /dev/null @@ -1,645 +0,0 @@ -"use strict" - -const assert = require('assert') -const uuid = require('uuid/v4') - -const transport = require('./transport.js') -const _ = require('./collection.js') -const util = require('./util.js') -const Msg = require('./msg.js') -const recorder = require('./recorder.js') - - -class Endpoint { - constructor(name, roles) { - this.name = name - this.id = `${name}/${uuid()}` - this.roles = roles - - /** - * A mapping from roles to endpoint id's - * @type {Map} - */ - this.peers = new Map() - this.roles.forEach(r => this.peers.set(r, this.id)) - - /** - * State. - * - * 'init': Initiating a private session. Receving all possible messages on the network, no filtering. - * 'acp': Atomic committing protocol. Possibly changing peer maps. Can receive NoSenderCheck messages. - * 'ready': Only receive session-private messages. - * - * @type {String} - */ - this.state = 'init' - this.trans = transport.Nanomsg(this) - this.broker = null - this.buffer = [] - } - - toJSON() { - return { - id : this.id, - name : this.name, - roles : this.roles.toJSON(), - peers : this.peers.toJSON(), - state : this.state, - buffer : this.buffer.map(m => JSON.stringify(m)), - trans : this.trans.toJSON() - } - } - - /** - * [accept description] - * - * 2PC transaction manager - * - * @param {[type]} address [description] - * @param {[type]} full [description] - * @return {[type]} [description] - */ - async accept(address, full) { - assert(this.state == 'init') - this.trans.connect(address) - - // Stop receiving out-of-session messages. - this.state = `${this.state}/accepting` - - // 2PC: vote. - const vote = new Msg('vote', this.id, [], {roles: this.roles, name: this.name}) - const yes = await this.sync('yes', full, {msg: vote, repeat: true, type: 'role'}) - - // Update our peer map. - yes.forEach(({sender, payload}) => payload.roles.forEach(r => this.peers.set(r, sender))) - - // 2PC: commit. - const commit = new Msg('commit', this.id, this.peers.uniqueValues(), this.peers) - await this.sync('committed', this.peers.uniqueValues(), {msg: commit}) - - // Go. - this.buffer.length = 0 - this.trans.flush() - this.send(new Msg('go', this.id, this.peers.uniqueValues(), null)) - } - - /** - * [request description] - * - * 2PC follower. - * - * @param {[type]} address [description] - * @return {[type]} [description] - */ - async request(address) { - assert(this.state == 'init') - this.trans.connect(address) - - // 2PC-1: Wait for voting - const req = await this.receive(util.pattern('vote', null, msg => msg.payload.name == this.name)) - - // Stop receiving out-of-session messages. - // But make sure we can communicate with the sender. - this.state = `${this.state}/requesting` - req.payload.roles.forEach(r => this.peers.set(r, req.sender)) - - // 2PC-1: Vote. - // The message need to skip sender check since the leader has no peer map yet. - const yes = new Msg('yes', this.id, [req.sender], {roles: this.roles}, true) - this.send(yes) - - // 2PC-2: Commit. - const { payload } = await this.receive(util.pattern('commit', req.sender)) - this.peers = new Map(payload) - this.buffer.length = 0 - this.trans.flush() - - const committed = new Msg('committed', this.id, [req.sender], null) - this.send(committed) - - // Wait for 'go' - await this.receive(util.pattern('go', req.sender)) - } - - - send(msg) { - this.trans.send(msg) - } - - /** - * Session-level receive. - * @param {[type]} labels [description] - * @param {[type]} senders [description] - * @return {[type]} [description] - */ - // async receive(patterns=[]) { - // if (!Array.isArray(patterns)) - // patterns = [patterns] - // if (patterns.length == 0) - // patterns.push(util.pattern(null, null, null)) - - // const encode_one = ({label, sender, pred}) => { - // let uuid = this.peers.get(sender) - // if (!uuid) - // uuid = null - - // if (pred == null) - // pred = msg => true - - // return util.pattern(label, uuid, msg => Msg.isMsg(this.decode(msg)) && pred(this.decode(msg))) - // } - - // // Push the `link` pattern as the last one. - // patterns.push(util.pattern('link')) - - // while (true) { - // const msg = this.decode(await this._receive(patterns.map(p => encode_one(p)))) - // // Regular message, just return it. - // if (msg.label != 'link') - // return msg - - // // Link message. - // this.send(new Msg('yes', this.roles, msg.sender, null)) - // await this._asleaf() - // // console.log("LINK FINISHED") - - // recorder.log(this) - // recorder.current() - // } - // } - - /** - * Endpoint-layer receive. - * - * @param {[type]} labels [description] - * @param {[type]} senders [description] - * @return {[type]} [description] - */ - async receive(patterns=null) { - const pred = util.preds(patterns) - - // Receive and check. - let index = this.buffer.findIndex(msg => pred(msg)) - while (index < 0) { - const msg = await this.trans.receive() - - // In-session messages. - if (msg.receivers.includes(this.id) && this.peers.hasvalue(msg.sender)) { - // Reply to in-session 'ping' at anytime. - if (msg.label == 'ping') { - this.send(new Msg('pong', this.id, [msg.sender], this.toJSON())) - } else { - this.buffer.push(msg) - } - } - - // In-session before the acceptor has the peer map. - else if (msg.receivers.includes(this.id) && Msg.skipSenderCheck(msg)) { this.buffer.push(msg) } - - // Init state, receive only the vote messages. - else if (this.state == 'init' && msg.label == 'vote' && msg.payload.name == this.name) { this.buffer.push(msg) } - - // Otherwise, the msg is discarded. - else { continue } - - index = this.buffer.findIndex(msg => pred(msg)) - } - - const [msg] = this.buffer.splice(index, 1) - // console.debug(`Received: ${msg.label}`) - - return msg - } - - peak(patterns=null) { - const pred = util.preds(patterns) - - const search = msg => { - if (msg.receivers.includes(this.id) && this.peers.hasvalue(msg.sender)) - return pred(msg) - else if (msg.receivers.includes(this.id) && Msg.skipSenderCheck(msg)) - return pred(msg) - else if (this.state == 'init' && msg.label == 'vote' && msg.payload.name == this.name) - return pred(msg) - else - return false - } - - return this.buffer.some(search) || this.trans.buffer.some(search) - } - - isempty() { - let count = 0 - this.trans.buffer.forEach(msg => { - if (msg.receivers.includes(this.id) && this.peers.hasvalue(msg.sender)) - count += 1 - }) - - return this.buffer.length + count == 0 - } - - cancel() { - this.trans.cancel() - } - - resume() { - this.trans.resume() - } - - close() { - this.trans.close() - } - - /** - * Session-level forwarding. - * - * @param {[type]} ep1 [description] - * @param {[type]} ep2 [description] - * @return {[type]} [description] - */ - static forward(ep1, ep2) { - let forward = true - - const forward12 = new Promise(async (resolve, reject) => { - while (forward) { - setTimeout(() => ep1.cancel(), 100) - try { ep2.send(await ep1.receive()) } catch(e) { ep1.resume() } - } - - resolve() - }) - - const forward21 = new Promise(async (resolve, reject) => { - while (forward) { - setTimeout(() => ep2.cancel(), 100) - try { ep1.send(await ep2.receive()) } catch(e) { ep2.resume() } - } - - resolve() - }) - - let stop = async () => { - forward = false - await Promise.all([forward12, forward21]) - } - - return stop - } - - static async link(ep1, ep2) { - - const blocked = async (ep) => { - let pongs - do { - recorder.current() - const ping = new Msg('ping', ep.id, ep.peers.uniqueValues(), null) - pongs = await ep.sync('pong', ep.peers.uniqueValues(), {msg: ping}) - } while (!pongs.every(({payload}) => ['linking', 'receiving'].includes(payload.state))) - } - - await blocked(ep1) - await blocked(ep2) - - const [keep, kill] = !(ep1.isempty()) ? [ep1, ep2] : [ep2, ep1] - assert(kill.isempty()) - - // By LMRL, there will be exactly one `keep` whose mailbox is non-empty. - // TODO: Prove this in the thesis. - if (!keep.isempty()) { - const forward = [] - while (!keep.isempty()) { - forward.push(keep.decodeMsg(await keep.receive())) - } - // console.log('AS ROOT') - await Endpoint._asroot(keep, kill, forward) - } else { - // console.log('AS NODE') - await Endpoint._asnode(keep, kill) - } - - kill.close() - return [keep, kill] - } - - - /** - * Nested 2PC, as Root. - * - * @param {[type]} keep [description] - * @param {[type]} kill [description] - * @return {[type]} [description] - */ - static async _asroot(keep, kill, forward) { - - const oldkeepstate = keep.state - const oldkillstate = kill.state - - keep.state = `${oldkeepstate}/keep/root` - kill.state = `${oldkillstate}/kill/root` - - const keepfull = keep.peers.uniqueValues() - const killfull = kill.peers.uniqueValues() - - const newroles = Set.intersect(keep.roles, kill.roles) - const newpeers = new Map() - newroles.forEach(role => newpeers.set(role, keep.id)) - - recorder.log(keep) - recorder.log(kill) - recorder.current() - - // Nested 2PC-1: Voting. - let y1 = await keep.sync('yes', keepfull, {msg: new Msg('link', keep.id, keepfull, {id: keep.id, roles: keep.roles})}) - let y2 = await kill.sync('yes', killfull, {msg: new Msg('link', kill.id, killfull, {id: keep.id, roles: kill.roles})}) - const yes = [...y1, ...y2] - - // Compute the new peer map. - yes.forEach(({payload}) => newpeers.extend(new Map(payload))) - - // Nested 2PC-2: Commit. - keep.state = `${oldkeepstate}/keep/root/committed` - kill.state = `${oldkillstate}/kill/root/committed` - - recorder.log(keep) - recorder.log(kill) - recorder.current() - - await kill.sync('committed', killfull, {msg: new Msg('commit', kill.id, killfull, newpeers)}) - await keep.sync('committed', keepfull, {msg: new Msg('commit', keep.id, keepfull, newpeers)}) - - // Commit. - keep.peers = newpeers - keep.roles = newroles - - keep.state = `${oldkeepstate}/keep/root/forwarding` - kill.state = `${oldkillstate}/kill/root/forwarding` - - recorder.log(keep) - recorder.log(kill) - recorder.current() - - // Forward. - forward.forEach(msg => { - const packet = keep.encodeMsg(msg) - packet.sender = keep.peers.get(msg.sender[0]) - keep.send(packet) - - if (keep.roles.some(r => msg.receivers.includes(r))) - keep.buffer.push(packet) - }) - - if (newroles.size == 0) - keep.send(new Msg('go', keep.id, newpeers.uniqueValues(), null, true)) - else - keep.send(new Msg('go', keep.id, newpeers.uniqueValues(), null, false)) - - recorder.log(keep) - recorder.log(kill) - recorder.current() - } - - - /** - * Nested 2PC, as Non-root Non-leaf Node. - * - * @param {[type]} keep [description] - * @param {[type]} kill [description] - * @return {[type]} [description] - */ - static async _asnode(keep, kill) { - - const oldkeepstate = keep.state - const oldkillstate = kill.state - - keep.state = `${oldkeepstate}/keep/node` - kill.state = `${oldkillstate}/kill/node` - - const newroles = Set.intersect(keep.roles, kill.roles) - const newpeers = new Map() - newroles.forEach(role => newpeers.set(role, keep.id)) - - recorder.log(keep) - recorder.log(kill) - recorder.current() - - // Determin the parent and child, w.r.t. nested 2PC - while (!keep.peak(util.pattern('link')) && kill.peak(util.pattern('link'))) - await util.sleep(1) - - const [parent, child] = keep.peak(util.pattern('link')) ? [keep, kill] : [kill, keep] - - const link = await parent.receive(util.pattern('link')) - assert(link.payload.roles.every(e => child.roles.has(e))) - assert(link.payload.roles.every(e => !parent.roles.has(e))) - - const childfull = child.peers.uniqueValues() - - keep.state = `${oldkeepstate}/keep/node/yes` - kill.state = `${oldkillstate}/kill/node/yes` - - recorder.log(keep) - recorder.log(kill) - recorder.current() - - // Nested 2PC-1: Request votes from children. - const childlink = new Msg('link', child.id, childfull, {id: link.payload.id, roles: child.roles}) - const yes = await child.sync('yes', childfull, {msg: childlink}) - - // Compute the new peer map. - yes.forEach(({payload}) => newpeers.extend(new Map(payload))) - - // Nested 2PC-1: Vote to the parent. - parent.send(new Msg('yes', parent.id, [link.sender], newpeers)) - - keep.state = `${oldkeepstate}/keep/node/commit` - kill.state = `${oldkillstate}/kill/node/commit` - recorder.log(keep) - recorder.log(kill) - recorder.current() - - // Nested 2PC-2: Commit the children. - const commit = await parent.receive(util.pattern('commit', link.sender)) - const childcommit = new Msg('commit', child.id, childfull, commit.payload) - await child.sync('committed', childfull, {msg: childcommit}) - - // Nested 2PC-2: Commit myself. - const committed = new Msg('committed', parent.id, [link.sender], null) - keep.roles = newroles - keep.peers = new Map(commit.payload) - - // Nested 2PC-2: Committed. - parent.send(committed) - - keep.state = `${oldkeepstate}/keep/node/go` - kill.state = `${oldkillstate}/kill/node/go` - recorder.log(keep) - recorder.log(kill) - recorder.current() - - // Go - console.log(keep.toJSON()) - await keep.receive(util.pattern('go', link.payload.id)) - - recorder.log(keep) - recorder.log(kill) - recorder.current() - } - - - - async _asleaf(link) { - - const oldstate = this.state - - this.state = `${oldstate}/linking/leaf` - recorder.log(this) - recorder.current() - - // Nested 2PC-1: Vote. - const peers = new Map() - this.roles.forEach(role => peers.set(role, this.id)) - this.send(new Msg('yes', this.id, [link.sender], peers)) - - // 2PC-2: Commit. - this.state = `${oldstate}/linking/commit` - recorder.log(this) - recorder.current() - - const { payload } = await this.receive(util.pattern('commit', link.sender)) - const committed = new Msg('committed', this.id, [link.sender], null) - - this.peers = new Map(payload) - this.send(committed) - - this.state = `${oldstate}/linking/go` - recorder.log(this) - recorder.current() - - // Go. - console.log(this.toJSON()) - await this.receive(util.pattern('go', link.payload.id)) - - recorder.log(this) - recorder.current() - - } - - - /** - * This implements one round trip of a 2-phase commit. - * @param {string} label Expected label of response messages. - * @param {Set} full Expected full set of uuids or roles. - * @param {Object} opts Options. - * @return {Array} The array of all responses. - */ - async sync(label, full, opts) { - const {msg, repeat, type} = Object.assign({msg: null, repeat: false, type: 'uuid'}, opts) - const all = full.clone() - - // Send the message first. - let interval = null - if (msg) - if (repeat) - interval = setInterval(() => this.send(msg), 100) - else - this.send(msg) - - const responses = [] - const respondents = type == 'role' ? this.roles.clone() : new Set([this.id]) - - switch (type) { - case 'role': - // Block until all roles have responded. - while (!all.every(role => respondents.has(role))) { - let resp = await this.receive(util.pattern(label, null, null)) - if (respondents.some(r => resp.payload.roles.includes(r))) - continue - - responses.push(resp) - respondents.union(resp.payload.roles) - } - break - case 'uuid': - // Block until all uuids have responded. - while (!all.every(uuid => respondents.has(uuid))) { - let resp = await this.receive(util.pattern(label, null, null)) - if (respondents.has(resp.sender)) - continue - - responses.push(resp) - respondents.add(resp.sender) - } - break - default: - throw new Error(`Unexpected type: ${type}.`) - } - - if (repeat) - clearInterval(interval) - - return responses - } - - - /** - * Encode an array of patterns for session-layer messages - * to those for endpoint-layer messages. - * - * @param {Array} patterns - * @return {Array} - */ - encodePatterns(patterns) { - assert(Array.isArray(patterns)) - - const encode = ({label, sender, pred}) => { - let uuid = this.peers.get(sender) - assert(!!uuid) - - if (pred == null) - return util.pattern(label, uuid, null) - else - return util.pattern(label, uuid, msg => pred(this.decode(msg))) - } - - return patterns.map(p => encode(p)) - } - - - /** - * Encode a session-layer message into an endpoint-layer message. - * - * @param {[type]} msg [description] - * @return {[type]} [description] - */ - encodeMsg(msg) { - assert(Msg.isMsg(msg)) - const {label, sender, receivers, payload} = msg - - // Filter out `undefined` and duplicated ones. - let uuids = [...receivers.map(r => this.peers.get(r)).filter(uuid => !!uuid)].dedup() - - const packet = new Msg(label, this.id, uuids, msg) - if (Msg.skipSenderCheck(msg)) - packet.skipsendercheck = true - return packet - } - - /** - * Decode an endpoint-layer message into a session-layer message. - * - * @param {[type]} msg [description] - * @return {[type]} [description] - */ - decodeMsg(msg) { - if (!Msg.isMsg(msg.payload)) - console.error(msg) - - assert(Msg.isMsg(msg)) - msg = msg.payload - assert(Msg.isMsg(msg)) - - return msg - } -} - -module.exports = Endpoint \ No newline at end of file diff --git a/BACKUP/node2/log b/BACKUP/node2/log deleted file mode 100644 index 52b297e..0000000 --- a/BACKUP/node2/log +++ /dev/null @@ -1,1261 +0,0 @@ -┌─────────┬────────────────────┬────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -└─────────┴────────────────────┴────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [ 'vote/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [ 'vote/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [ 'vote/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'vote/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [ 'vote/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [ 'vote/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'vote/session1' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [ 'vote/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'init' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [ 'vote/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [ 'vote/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [ 'vote/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [ 'vote/session2' ] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [ 'vote/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [ 'vote/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [ 'vote/session2' ] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session2' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session3' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'init' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session3' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session3' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session3' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [ 'vote/session3' ] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session3' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬─────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼─────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'vote/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [ 'vote/session3' ] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'vote/session3' ] │ -└─────────┴────────────────────┴────────────┴────────┴─────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session2' ] │ -│ 4 │ 'session3/[3]' │ 'init' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'yes/session1' ] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [ 'yes/session2' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'yes/session1' ] │ -│ 5 │ 'session1/[1]' │ 'acp/vote' │ [] │ [ 'yes/session1' ] │ -└─────────┴────────────────────┴────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴──────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴──────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴──────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session3' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴──────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/vote' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session3' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴──────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [ 'yes/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'yes/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [ 'yes/session3' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴──────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session3' ] │ -└─────────┴────────────────────┴──────────────┴────────┴────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session3' ] │ -└─────────┴────────────────────┴──────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/vote' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session3' ] │ -└─────────┴────────────────────┴──────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'commit/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session3' ] │ -└─────────┴────────────────────┴──────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'commit/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session3' ] │ -└─────────┴────────────────────┴──────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [ 'commit/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'commit/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'commit/session1' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'yes/session3' ] │ -└─────────┴────────────────────┴──────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬──────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼──────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/yes' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -└─────────┴────────────────────┴──────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'commit/session2' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [ 'commit/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [ 'commit/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'commit/session2' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/yes' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'commit/session3' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'commit/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [ 'commit/session3' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'commit/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/yes' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'committed/session1' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [ 'committed/session2' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'committed/session1' ] │ -│ 5 │ 'session1/[1]' │ 'acp/commit' │ [] │ [ 'committed/session1' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session3' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'acp/commit' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session3' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'committed/session2' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'committed/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [ 'committed/session3' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'committed/session2' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'acp/commit' │ [] │ [] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'go/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'acp/committed' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3', 'go/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3', 'go/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3', 'go/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3', 'go/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'go/session2' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3', 'go/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [ 'go/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'go/session2' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', 'committed/session3', 'go/session2' ] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', - 'committed/session3', - 'go/session2', ... 1 more item ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2', 'go/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'acp/committed' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', - 'committed/session3', - 'go/session2', ... 1 more item ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2', 'go/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'go/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', - 'committed/session3', - 'go/session2', ... 1 more item ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬──────────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'go/session2', 'go/session3' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'go/session3' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [ 'go/session3' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'committed/session2', - 'committed/session3', - 'go/session2', ... 1 more item ] │ -└─────────┴────────────────────┴─────────────────┴────────┴──────────────────────────────────────────────────────────────────────────────────────┘ -Ready -┌─────────┬────────────────────┬─────────────────┬────────┬────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3' ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────────────┴────────┴────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────────────┬────────┬───────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────────────┼────────┼───────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', ... 1 more item ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1' ] │ -│ 4 │ 'session3/[3]' │ 'acp/committed' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────────────┴────────┴───────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────┬───────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────┼───────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', ... 1 more item ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1' ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────┴───────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────┬───────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────┼───────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', ... 1 more item ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1' ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────┴───────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────┬───────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────┼───────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', ... 1 more item ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1' ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────┴───────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────┬───────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────┼───────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', ... 1 more item ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 1 more item ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────┴───────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 2 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 1 more item ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', ... 2 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 1 more item ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 2 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 1 more item ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'msg/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', ... 2 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 1 more item ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴─────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'msg/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 2 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 1 more item ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [ 'link/session1' ] │ -└─────────┴────────────────────┴─────────┴─────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 2 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 2 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴─────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 3 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 2 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴─────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 3 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 2 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴─────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 3 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'link/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 2 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴─────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬─────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 3 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'link/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 2 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session1' ] │ -│ 5 │ 'session1/[1]' │ 'ready' │ [] │ [] │ -└─────────┴────────────────────┴─────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 3 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'link/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 2 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session1' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'link/session2' ] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 3 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 3 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 4 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 3 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 4 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 3 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 4 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 3 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'msg/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] ;ljhkjhgjhtdtwe │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 4 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 3 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 4 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 4 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 5 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 4 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 5 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 4 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 5 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'yes/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 4 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'yes/session1' ] │ -│ 1 │ 'session2/[1,2]' │ 'ready' │ [] │ [ 'committed/session3', 'go/session1', 'go/session3', - ... 5 more items ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'yes/session1' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 4 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'msg/session1' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 5 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [ 'yes/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 5 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [ 'yes/session1' ] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 5 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session1' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 6 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 6 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 6 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'link/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 6 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'link/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 6 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'link/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'link/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 7 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 7 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'ready' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 7 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 7 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2', 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 7 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2', 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'link/blocked' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 8 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2', 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'link/blocked' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 8 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2', 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'link/blocked' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 8 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2', 'yes/session2', 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [] │ -│ 2 │ 'session2/[3,4]' │ 'link/blocked' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 8 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ -┌─────────┬────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┐ -│ (index) │ name │ state │ buffer │ trans │ -├─────────┼────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────┤ -│ 0 │ 'session1/[2,3,4]' │ 'ready' │ [ 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757', - 'msg/session1/736bb893-cc4b-4f2b-a143-d9802cb24757' ] │ [ 'link/session2', 'yes/session2', 'yes/session2' ] │ -│ 1 │ 'session2/[1,2]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -│ 2 │ 'session2/[3,4]' │ 'link/blocked' │ [] │ [] │ -│ 3 │ 'session3/[1,2,4]' │ 'ready' │ [] │ [ 'go/session1', 'go/session2', 'msg/session1', ... 8 more items ] │ -│ 4 │ 'session3/[3]' │ 'ready' │ [] │ [ 'yes/session2' ] │ -│ 5 │ 'session1/[1]' │ 'link/blocked' │ [] │ [ 'yes/session2' ] │ -└─────────┴────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────┘ diff --git a/BACKUP/node2/msg.js b/BACKUP/node2/msg.js deleted file mode 100644 index aec18f2..0000000 --- a/BACKUP/node2/msg.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict" - -class Msg { - constructor(label, sender, receivers, payload, skipsendercheck=false) { - - this.label = label - - /** - * Sender roles/uuid. - * @type {Array|uuid} - */ - this.sender = sender - - /** - * Receivers roles/uuids. - * - * @type {Array} - */ - this.receivers = receivers - - /** - * Payload - */ - this.payload = payload - - /** - * Whether this message is out-of-session. - * This property will only exist if it is indeed out-of-session. - * @type {Boolean} - */ - if (skipsendercheck) - this.skipsendercheck = skipsendercheck - - } - - static isMsg(msg) { - - try { - if (!('label' in msg)) - return false - if (!('sender' in msg)) - return false - if (!('receivers' in msg)) - return false - if (!('payload' in msg)) - return false - - return true - } catch(e) { - return false - } - } - - static skipSenderCheck(msg) { - return Msg.isMsg(msg) && msg.skipsendercheck - } -} - -module.exports = Msg \ No newline at end of file diff --git a/BACKUP/node2/package-lock.json b/BACKUP/node2/package-lock.json deleted file mode 100644 index 100e096..0000000 --- a/BACKUP/node2/package-lock.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "ats-sessions", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "bindings": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", - "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=" - }, - "nan": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", - "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=" - }, - "nanomsg": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/nanomsg/-/nanomsg-4.0.2.tgz", - "integrity": "sha512-m4FO8uqvkIglzKG7vt0hK1d+cQR1SSssxaCnYUa3SELOO//yal1q8voCgZN/QYQa8WckqzfghyLfDwzNJPg4Tg==", - "requires": { - "bindings": "1.2.1", - "nan": "2.8" - } - }, - "readline-sync": { - "version": "1.4.9", - "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.9.tgz", - "integrity": "sha1-PtqOZfI80qF+YTAbHwADOWr17No=" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - } - } -} diff --git a/BACKUP/node2/package.json b/BACKUP/node2/package.json deleted file mode 100644 index 35a64c8..0000000 --- a/BACKUP/node2/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "ats-sessions", - "version": "1.0.0", - "description": "", - "main": "index.js", - "dependencies": { - "nanomsg": "^4.0.2", - "readline-sync": "^1.4.9", - "uuid": "^3.3.2" - }, - "devDependencies": {}, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "MIT" -} diff --git a/BACKUP/node2/recorder.js b/BACKUP/node2/recorder.js deleted file mode 100644 index d78feca..0000000 --- a/BACKUP/node2/recorder.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict' - -const _ = require('./collection.js') -const readline = require('readline-sync') - -class Recorder { - constructor() { - this.buffer = [] - } - - log(ep) { - const obj = {id : ep.id, - name : ep.name, - roles : ep.roles, - peers : ep.peers, - state : ep.state, - buffer : ep.buffer.map(m => `${m.label}/${m.sender}`), - trans : ep.trans.buffer.map(m => `${m.label}/${m.sender.split('/')[0]}`)} - - this.buffer.push(obj) - } - - dump() { - console.log('Dumping recorded session ...') - console.log(JSON.stringify(this.buffer, null, 2)) - } - - replay() { - const eps = new Map() - for (var i = 0; i < this.buffer.length; i++) { - let obj = this.buffer[i] - eps.set(obj.id, {name: `${obj.name}/${JSON.stringify(obj.roles)}`, state: obj.state, buffer: [], trans: []}) - } - - for (var i = 0; i < this.buffer.length; i++) { - let obj = this.buffer[i] - eps.set(obj.id, {name: `${obj.name}/${JSON.stringify(obj.roles)}`, state: obj.state, buffer: obj.buffer, trans: obj.trans}) - console.log(`=============\nReplay: ${i}:`) - console.table([...eps.values()]) - readline.question('') - } - } - - current() { - // return - - const eps = new Map() - for (var i = 0; i < this.buffer.length; i++) { - let obj = this.buffer[i] - eps.set(obj.id, {name: `${obj.name}/${JSON.stringify(obj.roles)}`, state: obj.state, buffer: obj.buffer, trans: obj.trans}) - } - console.table([...eps.values()]) - } -} - - -const key = Symbol.for('Session.Recorder') - -if (Object.getOwnPropertySymbols(global).indexOf(key) < 0) - global[key] = new Recorder() - -module.exports = global[key] diff --git a/BACKUP/node2/renderer.js b/BACKUP/node2/renderer.js deleted file mode 100644 index cce4d8d..0000000 --- a/BACKUP/node2/renderer.js +++ /dev/null @@ -1,137 +0,0 @@ -'use strict' - -import * as d3 from "d3" - -class DataStore { - constructor(recorder) { - this.recorder = recorder - this.reset() - } - - reset() { - this.links = new Map() - this.nodes = new Map() - } - - pos(p) { - this.reset() - - const buffer = this.recorder.buffer - assert(p >= 0 && p < buffer.length) - - for (var i = 0; i < buffer.length; i++) { - let obj = buffer[i] - this.nodes.set(obj.id, {name: `${obj.name}/${JSON.stringify(obj.roles)}`, buffer: obj.buffer, trans: obj.trans}) - - obj.peers.forEach((uuid, role) => { - if (!obj.roles.has(role))) { - let link = [obj.id, uuid] - link.sort() - linkid = JSON.stringify(link) - - this.links.set(linkid, {type: 'peer', src: link[0], dst: link[1]}) - } - }) - } - - for (let key of this.links.keys()) { - const {src, dst} = this.links.get(key) - if ([src, dst].some(id => !this.nodes.haskey(id))) - this.links.delete(key) - } - } -} - - - -class Renderer { - constructor(data, svg, log) { - this.data = data - - this.svg = svg - this.log = log - } - - reset() { - this.svg.selectAll('*').remove() - this.log.html(null) - - this.peerlinks = this.svg.append('g').addClass('peerlinks').property('__data__', {zindex: 1}) - this.endpoints = this.svg.append('g').addClass('endpoints').property('__data__', {zindex: 5}) - // this.mboxlinks = this.svg.append('g').attr('class', 'mboxlinks').property('__data__', {zindex: 2}) - // this.msglinks = this.svg.append('g').attr('class', 'msglinks').property('__data__', {zindex: 3}) - // this.mailboxes = this.svg.append('g').attr('class', 'mailboxes').property('__data__', {zindex: 4}) - } - - zindex() { - this.svg.selectAll('g').sort((a, b) => a.zindex - b.zindex) - this.svg.selectAll('text').raise() - } - - circle(svg, data) { - const nodes = svg.selectAll('circle').data(data, d => d.id) - nodes.enter().append('circle').attr('r', 10) - nodes.exit().remove() - - const labels = svg.selectAll('text').data(data, d => d.id) - labels.enter().append('text') - labels.exit().remove() - - nodes.attr('cx', d => d.x).attr('cy', d => d.y) - labels.attr('x', d => d.x + 10).attr('y', d => d.y - 10) - - return [nodes, labels] - } - - line(svg, data) { - const links = svg.selectAll('line').data(data) - links.enter().append('line') - links.exit().remove() - links.attr('x1', d => d.source.x).attr('y1', d => d.source.y).attr('x2', d => d.target.x).attr('y2', d => d.target.y) - - return links - } - - renderEndpoints(data) { - const [nodes, labels] = this.circle(this.endpoints, data) - - nodes.classed('endpoint', true).classed('active', d => d.active) - labels.text(d => `[${d.roles}]@${d.state}`) - } - - renderMailboxes(data) { - const [nodes, labels] = this.circle(this.mailboxes, data) - - nodes.classed('mailbox', true).classed('active', d => d.active) - labels.text(d => JSON.stringify(d.mails.map(m => m.label))) - } - - renderMboxlinks(data) { - const links = this.line(this.mboxlinks, data) - links.classed('mboxlink', true).classed('active', d => d.active) - } - - renderMsglinks(data) { - const links = this.line(this.msglinks, data) - links.classed('msglink', true).classed('active', d => d.active) - - const labels = this.msglinks.selectAll('text').data(data, d => d.id) - labels.enter().append('text').merge(labels) - .text(d => d.msg.label) - .attr('x', d => (d.source.x + d.target.x)/2 + 10) - .attr('y', d => (d.source.y + d.target.y)/2 - 10) - - labels.exit().remove() - - } - - renderPeerlinks(data) { - const links = this.line(this.peerlinks, data) - links.classed('peerlink', true).classed('active', d => d.active) - } - - renderLogs(data) { - const text = this.log.selectAll('code').data(data) - text.enter().append('code').merge(text).classed('json', true).text(d => JSON.stringify(d, null, 2)) - } -} \ No newline at end of file diff --git a/BACKUP/node2/session.js b/BACKUP/node2/session.js deleted file mode 100644 index a4463ca..0000000 --- a/BACKUP/node2/session.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict" - -const assert = require('assert') - -const Endpoint = require('./endpoint.js') -const _ = require('./collection.js') -const Msg = require('./msg.js') -const util = require('./util.js') - -class Session { - constructor(name, protocol, roles) { - this.name = name - this.protocol = protocol - this.roles = new Set(roles) - this.full = null - this.ep = new Endpoint(name, this.roles) - } - - async request(address) { - this.ep.state = 'init' - await this.ep.request(address) - this.full = new Set(this.ep.peers.keys()) - this.ep.state = 'ready' - } - - async accept(address, full) { - this.ep.state = 'init' - this.full = new Set(full) - await this.ep.accept(address, full) - this.ep.state = 'ready' - } - - send(sender, receivers, payload) { - this.ep.state = 'sending' - assert(typeof(sender) === 'number') - assert(this.roles.has(sender)) - assert(Array.isArray(receivers)) - assert(receivers.every(r => this.full.has(r))) - - const msg = new Msg('msg', [sender], (new Set(receivers)).toJSON(), payload) - this.ep.send(this.ep.encodeMsg(msg)) - this.ep.state = 'ready' - } - - async receive(sender) { - assert(typeof(sender) === 'number') - - const oldstate = this.ep.state - this.ep.state = 'receiving' - - while (true) { - // Match session-level 'msg' before endpoint-level 'link'. - const patterns = [...this.ep.encodePatterns([util.pattern('msg', sender, null)]), - util.pattern('link', null, null)] - - const msg = await this.ep.receive(patterns) - - if (msg.label == 'msg') - return this.ep.decodeMsg(msg).payload - - assert(msg.label == 'link') - await this.ep._asleaf(msg) - } - } - - close() { - this.ep.close() - } - - // async sync(label, msg) { - // const sync = await this.ep.sync(label, this.full, {msg: this.ep.encodeMsg(msg)}) - // return sync.map(msg => this.ep.decodeMsg(msg)) - // } - - static async link(s1, s2) { - assert(s1.protocol == s2.protocol) - assert(s1.full.equal(s2.full)) - assert(Set.union(s1.roles, s2.roles).isSupersetOf(s1.full)) - - s1.ep.state = 'linking' - s2.ep.state = 'linking' - - const [keepep, killep] = await Endpoint.link(s1.ep, s2.ep) - const [keep, kill] = keepep.id == s1.ep.id ? [s1, s2] : [s2, s1] - - keep.ep.state = 'ready' - keep.roles = keep.ep.roles - - kill.close() - return [keep, kill] - } -} - -module.exports = Session \ No newline at end of file diff --git a/BACKUP/node2/test.js b/BACKUP/node2/test.js deleted file mode 100644 index f41c2c6..0000000 --- a/BACKUP/node2/test.js +++ /dev/null @@ -1,430 +0,0 @@ -"use strict" - -const transport = require('./transport.js') -const Endpoint = require('./endpoint.js') -const Session = require('./session.js') - -const util = require('./util.js') -const Msg = require('./msg.js') -const recorder = require('./recorder.js') -const nanomsg = require('nanomsg') - -const addr = 'inproc://bus' -const name1 = 'session1' -const name2 = 'session2' -const name3 = 'session3' - -const handler = msg => console.log(msg) -const onerror = e => { - console.error(e, e.stack.split('\n')) -} - -async function test_broadcast() { - const addr = 'inproc://bus1' - - const device = transport.NanomsgBroker(addr) - await util.sleep(100) - - const s1 = nanomsg.socket('bus') - const s2 = nanomsg.socket('bus') - - s1.setEncoding('utf8') - s1.connect(addr) - s1.on('data', handler) - - s2.setEncoding('utf8') - s2.connect(addr) - s2.on('data', handler) - - s1.send('hello from s1') - s2.send('hello from s2') - - await util.sleep(100) - s1.close() - s2.close() - - device.close() -} - -async function test2() { - const a1 = 'inproc://bus1' - const a2 = 'inproc://bus2' - - const device1 = transport.NanomsgBroker(a1) - const device2 = transport.NanomsgBroker(a2) - await util.sleep(100) - - const s1 = nanomsg.socket('bus') - const s2 = nanomsg.socket('bus') - const ss = nanomsg.socket('bus') - - s1.setEncoding('utf8') - s1.connect(a1) - s1.on('data', handler) - - s2.setEncoding('utf8') - s2.connect(a2) - s2.on('data', handler) - - ss.setEncoding('utf8') - ss.connect(a1) - ss.connect(a2) - ss.on('data', handler) - - s1.send('hello from bus1') - s2.send('hello from bus2') - - await util.sleep(100) - s1.close() - s2.close() - ss.close() - - device1.close() - device2.close() -} - -async function test_accept_request() { - - const device = transport.NanomsgBroker(addr) - await util.sleep(100) - - const ep1 = new Endpoint(name1, [0,2]) - const ep2 = new Endpoint(name1, [1]) - const ep3 = new Endpoint(name1, [3,4,5]) - - const p1 = ep1.accept(addr, [0,1,2,3,4,5]) - const p2 = ep2.request(addr) - const p3 = ep3.request(addr) - - await Promise.all([p1, p2, p3]) - - ep1.close() - ep2.close() - ep3.close() - device.close() - - console.log('Done') -} - - -async function test_forward() { - - const device = transport.NanomsgBroker(addr) - await util.sleep(100) - - const ep1 = new Endpoint(name1, [0,2]) - const ep2 = new Endpoint(name1, [1]) - const ep3 = new Endpoint(name1, [3,4,5]) - - const p1 = ep1.accept(addr, [0,1,2,3,4,5]) - const p2 = ep2.request(addr) - const p3 = ep3.request(addr) - - const epa = new Endpoint(name2, [0,1,2]) - const epb = new Endpoint(name2, [3,4]) - const epc = new Endpoint(name2, [5]) - - const pa = epa.accept(addr, [0,1,2,3,4,5]) - const pb = epb.request(addr) - const pc = epc.request(addr) - - await Promise.all([p1, p2, p3, pa, pb, pc]) - - console.log('Done') - - const thread1 = new Promise((ok, no) => { - ep1.send(new Msg('msg', [0], [5], 'hello')) - ok() - }) - - const thread2 = new Promise(async (ok, no) => { - const msg = await epc.receive() - console.log(msg) - ok() - }) - - const stop = Endpoint.forward(ep3, epa) - - await Promise.all([thread1, thread2]) - await stop() - - ep1.close() - ep2.close() - ep3.close() - epa.close() - epb.close() - epc.close() - - device.close() -} - -async function test_2party2cut() { - - const device = transport.NanomsgBroker(addr) - await util.sleep(100) - - const ep1 = new Endpoint(name1, [1]) - const ep2 = new Endpoint(name1, [2]) - - const p1 = ep1.accept(addr, [1,2]) - const p2 = ep2.request(addr) - - const epa = new Endpoint(name2, [1]) - const epb = new Endpoint(name2, [2]) - - const pa = epa.accept(addr, [1,2]) - const pb = epb.request(addr) - - await Promise.all([p1, p2, pa, pb]) - - console.log('Ready') - - const thread1 = new Promise(async (ok, no) => { - ep1.send(new Msg('msg', [1], [2], 'hello')) - console.log((await ep1.receive(util.pattern('msg', 2))).payload) - ok(ep1) - }) - - const thread2 = new Promise(async (ok, no) => { - console.log((await epb.receive(util.pattern('msg', 1))).payload) - epb.send(new Msg('msg', [2], [1], 'world')) - ok(epb) - }) - - const thread3 = new Promise(async (ok, no) => { - const [keep, kill] = await Endpoint.link(ep2, epa, [1,2]) - // if (keep.roles.size == 0) - // keep.close() - ok(keep) - }) - - const [x, y, z] = await Promise.all([thread1, thread2, thread3]) - - x.close() - y.close() - z.close() - - device.close() -} - -async function test_3party2cutspill() { - - const device = transport.NanomsgBroker(addr) - await util.sleep(100) - - const ep1 = new Endpoint(name1, [1]) - const ep2 = new Endpoint(name1, [2,3]) - - const p1 = ep1.accept(addr, [1,2,3]) - const p2 = ep2.request(addr) - - const epa = new Endpoint(name2, [1,2]) - const epb = new Endpoint(name2, [3]) - - const pa = epa.accept(addr, [1,2,3]) - const pb = epb.request(addr) - - await Promise.all([p1, p2, pa, pb]) - - console.log('Ready') - - const thread1 = new Promise(async (ok, no) => { - ep1.send(new Msg('msg', [1], [2], 'hello 1->2')) - ep1.send(new Msg('msg', [1], [3], 'hello 1->3')) - ep1.send(new Msg('msg', [1], [2,3], 'hello 1->2,3')) - console.log((await ep1.receive(util.pattern('msg', 3))).payload) - console.log((await ep1.receive(util.pattern('msg', 2))).payload) - ok(ep1) - }) - - const thread2 = new Promise(async (ok, no) => { - console.log((await epb.receive(util.pattern('msg', 1))).payload) - console.log((await epb.receive(util.pattern('msg', 1))).payload) - epb.send(new Msg('msg', [3], [1], 'world 3->1')) - ok(epb) - }) - - const thread3 = new Promise(async (ok, no) => { - const [keep, kill] = await Endpoint.link(ep2, epa, [1,2,3]) - console.log(keep.toJSON()) - console.log((await keep.receive(util.pattern('msg', 1))).payload) - console.log((await keep.receive(util.pattern('msg', 1))).payload) - keep.send(new Msg('msg', [2], [1], 'world 2->1')) - ok(keep) - }) - - const [x, y, z] = await Promise.all([thread1, thread2, thread3]) - - x.close() - y.close() - z.close() - - device.close() -} - -async function test_mult3party2cutspill() { - - const device = transport.NanomsgBroker(addr) - await util.sleep(100) - - const full = [1,2,3,4] - - const ep1 = new Endpoint(name1, [1]) - const ep2 = new Endpoint(name1, [2,3,4]) - - const p1 = ep1.accept(addr, full) - const p2 = ep2.request(addr) - - const epa = new Endpoint(name2, [1,2]) - const epb = new Endpoint(name2, [3,4]) - - const pa = epa.accept(addr, full) - const pb = epb.request(addr) - - const epx = new Endpoint(name3, [1,2,4]) - const epy = new Endpoint(name3, [3]) - - const px = epx.accept(addr, full) - const py = epy.request(addr) - - await Promise.all([p1, p2, pa, pb, px, py]) - - console.log('Ready') - - const thread1 = new Promise(async (ok, no) => { - ep1.send(new Msg('msg', [1], [2], 'hello 1->2')) - ep1.send(new Msg('msg', [1], [3], 'hello 1->3')) - ep1.send(new Msg('msg', [1], [4], 'hello 1->4')) - console.log((await ep1.receive(util.pattern('msg', 4))).payload) - console.log((await ep1.receive(util.pattern('msg', 3))).payload) - console.log((await ep1.receive(util.pattern('msg', 2))).payload) - ok(ep1) - }) - - const thread2 = new Promise(async (ok, no) => { - console.log((await epy.receive(util.pattern('msg', 1))).payload) - epy.send(new Msg('msg', [3], [1], 'world 3->1')) - ok(epy) - }) - - const thread3 = new Promise(async (ok, no) => { - const [keep, kill] = await Endpoint.link(ep2, epa, full) - console.log((await keep.receive(util.pattern('msg', 1))).payload) - keep.send(new Msg('msg', [2], [1], 'world 2->1')) - ok(keep) - }) - - const thread4 = new Promise(async (ok, no) => { - const [keep, kill] = await Endpoint.link(epb, epx, full) - console.log((await keep.receive(util.pattern('msg', 1))).payload) - keep.send(new Msg('msg', [4], [1], 'world 4->1')) - ok(keep) - }) - - const [a,b,c,d] = await Promise.all([thread1, thread2, thread3, thread4]) - - a.close() - b.close() - c.close() - d.close() - - device.close() -} - -async function testss() { - const device = transport.NanomsgBroker(addr) - await util.sleep(100) - - const full = [1,2,3,4] - - const ep1 = new Session(name1, null, [1]) - const ep2 = new Session(name1, null, [2,3,4]) - - const p1 = ep1.accept(addr, full) - const p2 = ep2.request(addr) - - const epa = new Session(name2, null, [1,2]) - const epb = new Session(name2, null, [3,4]) - - const pa = epa.accept(addr, full) - const pb = epb.request(addr) - - const epx = new Session(name3, null, [1,2,4]) - const epy = new Session(name3, null, [3]) - - const px = epx.accept(addr, full) - const py = epy.request(addr) - - await Promise.all([p1, p2, pa, pb, px, py]) - - console.log('Ready') - - const thread1 = new Promise(async (ok, no) => { - ep1.send(1, [2], 'hello 1->2') - ep1.send(1, [3], 'hello 1->3') - ep1.send(1, [4], 'hello 1->4') - console.log(await ep1.receive(4)) - console.log(await ep1.receive(3)) - console.log(await ep1.receive(2)) - ok(ep1) - }) - - const thread2 = new Promise(async (ok, no) => { - console.log(await epy.receive(1)) - epy.send(3, [1], 'world 3->1') - ok(epy) - }) - - const thread3 = new Promise(async (ok, no) => { - const [keep, kill] = await Session.link(ep2, epa) - console.log(await keep.receive(1)) - keep.send(2, [1], 'world 2->1') - ok(keep) - }) - - const thread4 = new Promise(async (ok, no) => { - const [keep, kill] = await Session.link(epb, epx) - console.log(await keep.receive(1)) - keep.send(4, [1], 'world 4->1') - ok(keep) - }) - - const [a,b,c,d] = await Promise.all([thread1, thread2, thread3, thread4]) - - a.close() - b.close() - c.close() - d.close() - - device.close() -} - - -async function bug() { - var outside - try { - outside = await Promise.race([42]) - var inside = await Promise.race([42]) - } catch (e) { - - } -} - -try { - // setTimeout(() => recorder.replay(), 1000) - // test_broadcast() - // test_3party2cutspill() - // .then((_) => recorder.dump()) - // .catch((_) => recorder.dump()) - // .finally(() => recorder.dump()) - testss() - // test_forward() - // bug() -} catch (e) { - - console.error(e, e.stack.split('\n')) -} finally { - -} - - diff --git a/BACKUP/node2/transport.js b/BACKUP/node2/transport.js deleted file mode 100644 index 46f354d..0000000 --- a/BACKUP/node2/transport.js +++ /dev/null @@ -1,149 +0,0 @@ -"use strict" - -const nanomsg = require("nanomsg") -const assert = require("assert") -const _ = require("./collection.js") -const util = require('./util.js') -const recorder = require('./recorder.js') - -class Transport { - - constructor() { - - } - - connect(address) { - - } - - disconnect(address) { - - } - - listen(address) { - - } - - close() { - - } - - send(msg) { - - } - - receive() { - - } - - toJSON() { - - } -} - - -class NanomsgTransport extends Transport { - - constructor(ep) { - super() - - this.ep = ep - - this.sock = nanomsg.socket('bus') - this.sock.setEncoding('utf8') - - // JS is single threaded. Safe to use just an array. - this.buffer = [] - - this.sock.on('data', msg => { - msg = JSON.parse(msg) - this.buffer.push(msg) - - // console.log(this.toJSON()) - recorder.log(this.ep) - }) - - this.quit = false - } - - toJSON() { - return {trans: this.buffer.map(m => m.label), ep: [this.ep.name, JSON.stringify(this.ep.roles)]} - } - - connect(address) { - this.sock.connect(address) - assert(this.sock.connected[address] >= 0) - } - - disconnect(address) { - if (address in this.sock.connected) { - this.sock.shutdown(this.sock.connected[address]) - } - } - - listen(address) { - this.sock.bind(address) - assert(this.sock.bound[address] >= 0) - } - - close() { - this.sock.close() - } - - send(msg) { - const packet = JSON.stringify(msg) - const sent = this.sock.send(packet) - assert (sent == packet.length) - - console.debug(`Sent: ${JSON.stringify(msg)}`) - } - - cancel() { - this.quit = true - } - - resume() { - this.quit = false - } - - flush() { - this.buffer.length = 0 - } - - async receive() { - while (this.buffer.length == 0 && !this.quit) - await util.sleep(1) - - if (this.buffer.length == 0) - throw new Error('Cancelled') - else { - const msg = this.buffer.shift() - // console.log(this.toJSON()) - recorder.log(this.ep) - // recorder.current() - return msg - } - } -} - -class NanomsgBroker { - constructor(address) { - this.sock = nanomsg.socket('bus', {raw: true}) - this.sock.bind(address) - this.device = nanomsg.device(this.sock) - - // omit the error - this.device.on('error', e => {}) - } - - close() { - this.sock.close() - this.sock = null - this.device = null - } -} - -module.exports = { - Nanomsg : ep => new NanomsgTransport(ep), - NanomsgBroker : addr => new NanomsgBroker(addr) -} \ No newline at end of file diff --git a/BACKUP/node2/util.js b/BACKUP/node2/util.js deleted file mode 100644 index 0802ab0..0000000 --- a/BACKUP/node2/util.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict" - -const _ = require('./collection.js') - -// nodejs util library -let util = require("util") - -util.sleep = ms => - new Promise((resolve, reject) => setTimeout(resolve, ms)) - -util.waituntil = async (cond) => { - while (!cond()) { - await util.sleep(1) - } -} - -util.wait = (promise, ms) => new Promise(async (resolve, reject) => { - setTimeout(reject(promise), ms) - resolve(await promise) -}) - -/* For pattern matching in message receiving */ - -util.pattern = (label=null, sender=null, pred=null) => { - return {label: label, sender: sender, pred: pred} -} - -util.preds = function (patterns) { - - function build ({label, sender, pred}) { - let cond - - if (label == null && sender == null) - cond = msg => true - else if (label && sender == null) - cond = msg => label == msg.label - else if (label == null && sender) - cond = msg => sender == msg.sender - else - cond = msg => label == msg.label && sender == msg.sender - - if (pred == null) - return msg => cond(msg) - else - return msg => cond(msg) && pred(msg) - } - - if (!patterns) - return msg => true - - if (!Array.isArray(patterns)) - return build(patterns) - - if (patterns.length == 0) - return msg => true - - // Use foldr and short-circuit of || to do left-to-right check. - // The patterns are matched from patterns[0] to patterns[length-1]. - return patterns.foldr(msg => false, (p, preds) => msg => build(p)(msg) || preds(msg)) -} - -module.exports = util \ No newline at end of file diff --git a/BACKUP/output b/BACKUP/output deleted file mode 100644 index e69de29..0000000 diff --git a/BACKUP/package-lock.json b/BACKUP/package-lock.json deleted file mode 100644 index f232074..0000000 --- a/BACKUP/package-lock.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "immutable": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", - "integrity": "sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=" - } - } -} diff --git a/BACKUP/payload.sats b/BACKUP/payload.sats deleted file mode 100644 index caacc71..0000000 --- a/BACKUP/payload.sats +++ /dev/null @@ -1,8 +0,0 @@ - - -(* runtime payload *) -absvtype payload (vt@ype) - -fun {a:vt@ype} payload_encode (a): payload a -fun {a:vt@ype} payload_decode (payload a): a - diff --git a/BACKUP/python/broker.py b/BACKUP/python/broker.py deleted file mode 100644 index 25ce2e5..0000000 --- a/BACKUP/python/broker.py +++ /dev/null @@ -1,11 +0,0 @@ - - - -class Broker(Object): - - def __init__(self, name): - self.name = name - self.members = dict() - - - def \ No newline at end of file diff --git a/BACKUP/python/endpoint.py b/BACKUP/python/endpoint.py deleted file mode 100644 index 5d1641e..0000000 --- a/BACKUP/python/endpoint.py +++ /dev/null @@ -1,32 +0,0 @@ -import uuid - - - - -class Endpoint(Object): - - def __init__(self, name, roles): - self.id = uuid.uuid4() - self.roles = roles - self.name = name - self.peers = dict() - self.state = 'init' - - def init(self): - pass - - def broadcast(self, payload): - pass - - def receive(self): - pass - - def close(self): - pass - - def wait(self): - pass - - @staticmethod - def link(ep1, ep2): - pass diff --git a/BACKUP/python/msg.py b/BACKUP/python/msg.py deleted file mode 100644 index 139597f..0000000 --- a/BACKUP/python/msg.py +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/BACKUP/python/redis_transport.py b/BACKUP/python/redis_transport.py deleted file mode 100644 index b28b04f..0000000 --- a/BACKUP/python/redis_transport.py +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/BACKUP/python/test.c b/BACKUP/python/test.c deleted file mode 100644 index 40f8ad8..0000000 --- a/BACKUP/python/test.c +++ /dev/null @@ -1,5016 +0,0 @@ -/* Generated by Cython 0.28.4 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. -#else -#define CYTHON_ABI "0_28_4" -#define CYTHON_FUTURE_DIVISION 0 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; - #endif - #endif -#else - #include -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__ ) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; // PyThread_create_key reports success always -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif // TSS (Thread Specific Storage) API -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -#else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact - #define PyObject_Unicode PyObject_Str -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__test -#define __PYX_HAVE_API__test -/* Early includes */ -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "test.py", -}; - -/*--- Type declarations ---*/ - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* FetchCommonType.proto */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -/* CythonFunction.proto */ -#define __Pyx_CyFunction_USED 1 -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; - void *defaults; - int defaults_pyobjects; - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; -} __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(void); - -/* PyObjectLookupSpecial.proto */ -#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { - PyObject *res; - PyTypeObject *tp = Py_TYPE(obj); -#if PY_MAJOR_VERSION < 3 - if (unlikely(PyInstance_Check(obj))) - return __Pyx_PyObject_GetAttrStr(obj, attr_name); -#endif - res = _PyType_Lookup(tp, attr_name); - if (likely(res)) { - descrgetfunc f = Py_TYPE(res)->tp_descr_get; - if (!f) { - Py_INCREF(res); - } else { - res = f(res, obj, (PyObject *)tp); - } - } else { - PyErr_SetObject(PyExc_AttributeError, attr_name); - } - return res; -} -#else -#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* Print.proto */ -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - -/* PrintOne.proto */ -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'test' */ -#define __Pyx_MODULE_NAME "test" -extern int __pyx_module_is_main_test; -int __pyx_module_is_main_test = 0; - -/* Implementation of 'test' */ -static const char __pyx_k_e[] = "e"; -static const char __pyx_k_s1[] = "s1"; -static const char __pyx_k_s2[] = "s2"; -static const char __pyx_k_BUS[] = "BUS"; -static const char __pyx_k_bus[] = "bus"; -static const char __pyx_k_end[] = "end"; -static const char __pyx_k_PAIR[] = "PAIR"; -static const char __pyx_k_addr[] = "addr"; -static const char __pyx_k_bind[] = "bind"; -static const char __pyx_k_exit[] = "__exit__"; -static const char __pyx_k_file[] = "file"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_pool[] = "pool"; -static const char __pyx_k_recv[] = "recv"; -static const char __pyx_k_send[] = "send"; -static const char __pyx_k_test[] = "test"; -static const char __pyx_k_time[] = "time"; -static const char __pyx_k_enter[] = "__enter__"; -static const char __pyx_k_print[] = "print"; -static const char __pyx_k_sleep[] = "sleep"; -static const char __pyx_k_start[] = "start"; -static const char __pyx_k_Device[] = "Device"; -static const char __pyx_k_Socket[] = "Socket"; -static const char __pyx_k_device[] = "device"; -static const char __pyx_k_domain[] = "domain"; -static const char __pyx_k_future[] = "future"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_result[] = "result"; -static const char __pyx_k_submit[] = "submit"; -static const char __pyx_k_test_2[] = "__test__"; -static const char __pyx_k_connect[] = "connect"; -static const char __pyx_k_futures[] = "futures"; -static const char __pyx_k_nanomsg[] = "nanomsg"; -static const char __pyx_k_s1_loop[] = "s1_loop"; -static const char __pyx_k_s2_loop[] = "s2_loop"; -static const char __pyx_k_test_py[] = "test.py"; -static const char __pyx_k_AF_SP_RAW[] = "AF_SP_RAW"; -static const char __pyx_k_s1_future[] = "s1_future"; -static const char __pyx_k_s2_future[] = "s2_future"; -static const char __pyx_k_concurrent[] = "concurrent"; -static const char __pyx_k_s1_sending[] = "s1 sending ..."; -static const char __pyx_k_device_loop[] = "device_loop"; -static const char __pyx_k_max_workers[] = "max_workers"; -static const char __pyx_k_as_completed[] = "as_completed"; -static const char __pyx_k_s2_receiving[] = "s2 receiving ..."; -static const char __pyx_k_ipc_tmp_bus_ipc[] = "ipc:///tmp/bus.ipc"; -static const char __pyx_k_s1_sent_a_message[] = "s1 sent a message"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_concurrent_futures[] = "concurrent.futures"; -static const char __pyx_k_ProcessPoolExecutor[] = "ProcessPoolExecutor"; -static PyObject *__pyx_n_s_AF_SP_RAW; -static PyObject *__pyx_n_s_BUS; -static PyObject *__pyx_n_s_Device; -static PyObject *__pyx_n_s_PAIR; -static PyObject *__pyx_n_s_ProcessPoolExecutor; -static PyObject *__pyx_n_s_Socket; -static PyObject *__pyx_n_s_addr; -static PyObject *__pyx_n_s_as_completed; -static PyObject *__pyx_n_s_bind; -static PyObject *__pyx_n_s_bus; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_concurrent; -static PyObject *__pyx_n_s_concurrent_futures; -static PyObject *__pyx_n_s_connect; -static PyObject *__pyx_n_s_device; -static PyObject *__pyx_n_s_device_loop; -static PyObject *__pyx_n_s_domain; -static PyObject *__pyx_n_s_e; -static PyObject *__pyx_n_s_end; -static PyObject *__pyx_n_s_enter; -static PyObject *__pyx_n_s_exit; -static PyObject *__pyx_n_s_file; -static PyObject *__pyx_n_s_future; -static PyObject *__pyx_n_s_futures; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_kp_s_ipc_tmp_bus_ipc; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_max_workers; -static PyObject *__pyx_n_s_nanomsg; -static PyObject *__pyx_n_s_pool; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_recv; -static PyObject *__pyx_n_s_result; -static PyObject *__pyx_n_s_s1; -static PyObject *__pyx_n_s_s1_future; -static PyObject *__pyx_n_s_s1_loop; -static PyObject *__pyx_kp_s_s1_sending; -static PyObject *__pyx_kp_b_s1_sent_a_message; -static PyObject *__pyx_n_s_s2; -static PyObject *__pyx_n_s_s2_future; -static PyObject *__pyx_n_s_s2_loop; -static PyObject *__pyx_kp_s_s2_receiving; -static PyObject *__pyx_n_s_send; -static PyObject *__pyx_n_s_sleep; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_submit; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_test_2; -static PyObject *__pyx_kp_s_test_py; -static PyObject *__pyx_n_s_time; -static PyObject *__pyx_pf_4test_device_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bus); /* proto */ -static PyObject *__pyx_pf_4test_2s1_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1); /* proto */ -static PyObject *__pyx_pf_4test_4s2_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s2); /* proto */ -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_10; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_codeobj__4; -static PyObject *__pyx_codeobj__6; -static PyObject *__pyx_codeobj__8; -/* Late includes */ - -/* "test.py":10 - * # print(bus.bind(addr)) - * - * def device_loop(bus): # <<<<<<<<<<<<<< - * device = nanomsg.Device(bus) - * print(device.start()) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4test_1device_loop(PyObject *__pyx_self, PyObject *__pyx_v_bus); /*proto*/ -static PyMethodDef __pyx_mdef_4test_1device_loop = {"device_loop", (PyCFunction)__pyx_pw_4test_1device_loop, METH_O, 0}; -static PyObject *__pyx_pw_4test_1device_loop(PyObject *__pyx_self, PyObject *__pyx_v_bus) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("device_loop (wrapper)", 0); - __pyx_r = __pyx_pf_4test_device_loop(__pyx_self, ((PyObject *)__pyx_v_bus)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4test_device_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bus) { - PyObject *__pyx_v_device = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("device_loop", 0); - - /* "test.py":11 - * - * def device_loop(bus): - * device = nanomsg.Device(bus) # <<<<<<<<<<<<<< - * print(device.start()) - * return - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_bus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_bus}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_bus}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_bus); - __Pyx_GIVEREF(__pyx_v_bus); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_bus); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_device = __pyx_t_1; - __pyx_t_1 = 0; - - /* "test.py":12 - * def device_loop(bus): - * device = nanomsg.Device(bus) - * print(device.start()) # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_device, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":13 - * device = nanomsg.Device(bus) - * print(device.start()) - * return # <<<<<<<<<<<<<< - * - * s1 = nanomsg.Socket(nanomsg.PAIR) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "test.py":10 - * # print(bus.bind(addr)) - * - * def device_loop(bus): # <<<<<<<<<<<<<< - * device = nanomsg.Device(bus) - * print(device.start()) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("test.device_loop", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_device); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "test.py":18 - * print(s1.bind(addr)) - * - * def s1_loop(s1): # <<<<<<<<<<<<<< - * while True: - * print('s1 sending ...') - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4test_3s1_loop(PyObject *__pyx_self, PyObject *__pyx_v_s1); /*proto*/ -static PyMethodDef __pyx_mdef_4test_3s1_loop = {"s1_loop", (PyCFunction)__pyx_pw_4test_3s1_loop, METH_O, 0}; -static PyObject *__pyx_pw_4test_3s1_loop(PyObject *__pyx_self, PyObject *__pyx_v_s1) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("s1_loop (wrapper)", 0); - __pyx_r = __pyx_pf_4test_2s1_loop(__pyx_self, ((PyObject *)__pyx_v_s1)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4test_2s1_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("s1_loop", 0); - - /* "test.py":19 - * - * def s1_loop(s1): - * while True: # <<<<<<<<<<<<<< - * print('s1 sending ...') - * print(s1.send(b's1 sent a message')) - */ - while (1) { - - /* "test.py":20 - * def s1_loop(s1): - * while True: - * print('s1 sending ...') # <<<<<<<<<<<<<< - * print(s1.send(b's1 sent a message')) - * time.sleep(1) - */ - if (__Pyx_PrintOne(0, __pyx_kp_s_s1_sending) < 0) __PYX_ERR(0, 20, __pyx_L1_error) - - /* "test.py":21 - * while True: - * print('s1 sending ...') - * print(s1.send(b's1 sent a message')) # <<<<<<<<<<<<<< - * time.sleep(1) - * # print(s1.recv()) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s1, __pyx_n_s_send); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "test.py":22 - * print('s1 sending ...') - * print(s1.send(b's1 sent a message')) - * time.sleep(1) # <<<<<<<<<<<<<< - * # print(s1.recv()) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sleep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "test.py":18 - * print(s1.bind(addr)) - * - * def s1_loop(s1): # <<<<<<<<<<<<<< - * while True: - * print('s1 sending ...') - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("test.s1_loop", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "test.py":28 - * print(s2.connect(addr)) - * - * def s2_loop(s2): # <<<<<<<<<<<<<< - * while True: - * print('s2 receiving ...') - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4test_5s2_loop(PyObject *__pyx_self, PyObject *__pyx_v_s2); /*proto*/ -static PyMethodDef __pyx_mdef_4test_5s2_loop = {"s2_loop", (PyCFunction)__pyx_pw_4test_5s2_loop, METH_O, 0}; -static PyObject *__pyx_pw_4test_5s2_loop(PyObject *__pyx_self, PyObject *__pyx_v_s2) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("s2_loop (wrapper)", 0); - __pyx_r = __pyx_pf_4test_4s2_loop(__pyx_self, ((PyObject *)__pyx_v_s2)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4test_4s2_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s2) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("s2_loop", 0); - - /* "test.py":29 - * - * def s2_loop(s2): - * while True: # <<<<<<<<<<<<<< - * print('s2 receiving ...') - * # s2.send(b's2 sent a message') - */ - while (1) { - - /* "test.py":30 - * def s2_loop(s2): - * while True: - * print('s2 receiving ...') # <<<<<<<<<<<<<< - * # s2.send(b's2 sent a message') - * print(s2.recv()) - */ - if (__Pyx_PrintOne(0, __pyx_kp_s_s2_receiving) < 0) __PYX_ERR(0, 30, __pyx_L1_error) - - /* "test.py":32 - * print('s2 receiving ...') - * # s2.send(b's2 sent a message') - * print(s2.recv()) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_s2, __pyx_n_s_recv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "test.py":28 - * print(s2.connect(addr)) - * - * def s2_loop(s2): # <<<<<<<<<<<<<< - * while True: - * print('s2 receiving ...') - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("test.s2_loop", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_test(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_test}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "test", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_AF_SP_RAW, __pyx_k_AF_SP_RAW, sizeof(__pyx_k_AF_SP_RAW), 0, 0, 1, 1}, - {&__pyx_n_s_BUS, __pyx_k_BUS, sizeof(__pyx_k_BUS), 0, 0, 1, 1}, - {&__pyx_n_s_Device, __pyx_k_Device, sizeof(__pyx_k_Device), 0, 0, 1, 1}, - {&__pyx_n_s_PAIR, __pyx_k_PAIR, sizeof(__pyx_k_PAIR), 0, 0, 1, 1}, - {&__pyx_n_s_ProcessPoolExecutor, __pyx_k_ProcessPoolExecutor, sizeof(__pyx_k_ProcessPoolExecutor), 0, 0, 1, 1}, - {&__pyx_n_s_Socket, __pyx_k_Socket, sizeof(__pyx_k_Socket), 0, 0, 1, 1}, - {&__pyx_n_s_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 0, 1, 1}, - {&__pyx_n_s_as_completed, __pyx_k_as_completed, sizeof(__pyx_k_as_completed), 0, 0, 1, 1}, - {&__pyx_n_s_bind, __pyx_k_bind, sizeof(__pyx_k_bind), 0, 0, 1, 1}, - {&__pyx_n_s_bus, __pyx_k_bus, sizeof(__pyx_k_bus), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_concurrent, __pyx_k_concurrent, sizeof(__pyx_k_concurrent), 0, 0, 1, 1}, - {&__pyx_n_s_concurrent_futures, __pyx_k_concurrent_futures, sizeof(__pyx_k_concurrent_futures), 0, 0, 1, 1}, - {&__pyx_n_s_connect, __pyx_k_connect, sizeof(__pyx_k_connect), 0, 0, 1, 1}, - {&__pyx_n_s_device, __pyx_k_device, sizeof(__pyx_k_device), 0, 0, 1, 1}, - {&__pyx_n_s_device_loop, __pyx_k_device_loop, sizeof(__pyx_k_device_loop), 0, 0, 1, 1}, - {&__pyx_n_s_domain, __pyx_k_domain, sizeof(__pyx_k_domain), 0, 0, 1, 1}, - {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, - {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, - {&__pyx_n_s_future, __pyx_k_future, sizeof(__pyx_k_future), 0, 0, 1, 1}, - {&__pyx_n_s_futures, __pyx_k_futures, sizeof(__pyx_k_futures), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_kp_s_ipc_tmp_bus_ipc, __pyx_k_ipc_tmp_bus_ipc, sizeof(__pyx_k_ipc_tmp_bus_ipc), 0, 0, 1, 0}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_max_workers, __pyx_k_max_workers, sizeof(__pyx_k_max_workers), 0, 0, 1, 1}, - {&__pyx_n_s_nanomsg, __pyx_k_nanomsg, sizeof(__pyx_k_nanomsg), 0, 0, 1, 1}, - {&__pyx_n_s_pool, __pyx_k_pool, sizeof(__pyx_k_pool), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_recv, __pyx_k_recv, sizeof(__pyx_k_recv), 0, 0, 1, 1}, - {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, - {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1}, - {&__pyx_n_s_s1_future, __pyx_k_s1_future, sizeof(__pyx_k_s1_future), 0, 0, 1, 1}, - {&__pyx_n_s_s1_loop, __pyx_k_s1_loop, sizeof(__pyx_k_s1_loop), 0, 0, 1, 1}, - {&__pyx_kp_s_s1_sending, __pyx_k_s1_sending, sizeof(__pyx_k_s1_sending), 0, 0, 1, 0}, - {&__pyx_kp_b_s1_sent_a_message, __pyx_k_s1_sent_a_message, sizeof(__pyx_k_s1_sent_a_message), 0, 0, 0, 0}, - {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1}, - {&__pyx_n_s_s2_future, __pyx_k_s2_future, sizeof(__pyx_k_s2_future), 0, 0, 1, 1}, - {&__pyx_n_s_s2_loop, __pyx_k_s2_loop, sizeof(__pyx_k_s2_loop), 0, 0, 1, 1}, - {&__pyx_kp_s_s2_receiving, __pyx_k_s2_receiving, sizeof(__pyx_k_s2_receiving), 0, 0, 1, 0}, - {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, - {&__pyx_n_s_sleep, __pyx_k_sleep, sizeof(__pyx_k_sleep), 0, 0, 1, 1}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_submit, __pyx_k_submit, sizeof(__pyx_k_submit), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1}, - {&__pyx_kp_s_test_py, __pyx_k_test_py, sizeof(__pyx_k_test_py), 0, 0, 1, 0}, - {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - return 0; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "test.py":21 - * while True: - * print('s1 sending ...') - * print(s1.send(b's1 sent a message')) # <<<<<<<<<<<<<< - * time.sleep(1) - * # print(s1.recv()) - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_b_s1_sent_a_message); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "test.py":22 - * print('s1 sending ...') - * print(s1.send(b's1 sent a message')) - * time.sleep(1) # <<<<<<<<<<<<<< - * # print(s1.recv()) - * - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "test.py":10 - * # print(bus.bind(addr)) - * - * def device_loop(bus): # <<<<<<<<<<<<<< - * device = nanomsg.Device(bus) - * print(device.start()) - */ - __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_s_bus, __pyx_n_s_device); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_py, __pyx_n_s_device_loop, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 10, __pyx_L1_error) - - /* "test.py":18 - * print(s1.bind(addr)) - * - * def s1_loop(s1): # <<<<<<<<<<<<<< - * while True: - * print('s1 sending ...') - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_s1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_py, __pyx_n_s_s1_loop, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 18, __pyx_L1_error) - - /* "test.py":28 - * print(s2.connect(addr)) - * - * def s2_loop(s2): # <<<<<<<<<<<<<< - * while True: - * print('s2 receiving ...') - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_s2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_py, __pyx_n_s_s2_loop, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 28, __pyx_L1_error) - - /* "test.py":35 - * - * - * with concurrent.futures.ProcessPoolExecutor(max_workers=10) as pool: # <<<<<<<<<<<<<< - * # bus_future = pool.submit(device_loop, bus) - * s1_future = pool.submit(s1_loop, s1) - */ - __pyx_tuple__9 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_modinit_global_init_code(void); /*proto*/ -static int __Pyx_modinit_variable_export_code(void); /*proto*/ -static int __Pyx_modinit_function_export_code(void); /*proto*/ -static int __Pyx_modinit_type_init_code(void); /*proto*/ -static int __Pyx_modinit_type_import_code(void); /*proto*/ -static int __Pyx_modinit_variable_import_code(void); /*proto*/ -static int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) - #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC inittest(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC inittest(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_test(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_test(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - result = PyDict_SetItemString(moddict, to_name, value); - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static int __pyx_pymod_exec_test(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_test(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("test", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_test) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "test")) { - if (unlikely(PyDict_SetItemString(modules, "test", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "test.py":1 - * import nanomsg # <<<<<<<<<<<<<< - * import concurrent.futures - * import time - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_nanomsg, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_nanomsg, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":2 - * import nanomsg - * import concurrent.futures # <<<<<<<<<<<<<< - * import time - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_concurrent_futures, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_concurrent, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":3 - * import nanomsg - * import concurrent.futures - * import time # <<<<<<<<<<<<<< - * - * addr = 'ipc:///tmp/bus.ipc' - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":5 - * import time - * - * addr = 'ipc:///tmp/bus.ipc' # <<<<<<<<<<<<<< - * - * bus = nanomsg.Socket(nanomsg.BUS, domain=nanomsg.AF_SP_RAW) - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_addr, __pyx_kp_s_ipc_tmp_bus_ipc) < 0) __PYX_ERR(0, 5, __pyx_L1_error) - - /* "test.py":7 - * addr = 'ipc:///tmp/bus.ipc' - * - * bus = nanomsg.Socket(nanomsg.BUS, domain=nanomsg.AF_SP_RAW) # <<<<<<<<<<<<<< - * # print(bus.bind(addr)) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Socket); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BUS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_AF_SP_RAW); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_domain, __pyx_t_5) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_bus, __pyx_t_5) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "test.py":10 - * # print(bus.bind(addr)) - * - * def device_loop(bus): # <<<<<<<<<<<<<< - * device = nanomsg.Device(bus) - * print(device.start()) - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4test_1device_loop, 0, __pyx_n_s_device_loop, NULL, __pyx_n_s_test, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_device_loop, __pyx_t_5) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "test.py":15 - * return - * - * s1 = nanomsg.Socket(nanomsg.PAIR) # <<<<<<<<<<<<<< - * print(s1.bind(addr)) - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Socket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_PAIR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s1, __pyx_t_5) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "test.py":16 - * - * s1 = nanomsg.Socket(nanomsg.PAIR) - * print(s1.bind(addr)) # <<<<<<<<<<<<<< - * - * def s1_loop(s1): - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_s1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_bind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_addr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PrintOne(0, __pyx_t_3) < 0) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test.py":18 - * print(s1.bind(addr)) - * - * def s1_loop(s1): # <<<<<<<<<<<<<< - * while True: - * print('s1 sending ...') - */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4test_3s1_loop, 0, __pyx_n_s_s1_loop, NULL, __pyx_n_s_test, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s1_loop, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test.py":25 - * # print(s1.recv()) - * - * s2 = nanomsg.Socket(nanomsg.PAIR) # <<<<<<<<<<<<<< - * print(s2.connect(addr)) - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Socket); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_nanomsg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_PAIR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s2, __pyx_t_3) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test.py":26 - * - * s2 = nanomsg.Socket(nanomsg.PAIR) - * print(s2.connect(addr)) # <<<<<<<<<<<<<< - * - * def s2_loop(s2): - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_s2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_connect); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_addr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PrintOne(0, __pyx_t_5) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "test.py":28 - * print(s2.connect(addr)) - * - * def s2_loop(s2): # <<<<<<<<<<<<<< - * while True: - * print('s2 receiving ...') - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4test_5s2_loop, 0, __pyx_n_s_s2_loop, NULL, __pyx_n_s_test, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s2_loop, __pyx_t_5) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "test.py":35 - * - * - * with concurrent.futures.ProcessPoolExecutor(max_workers=10) as pool: # <<<<<<<<<<<<<< - * # bus_future = pool.submit(device_loop, bus) - * s1_future = pool.submit(s1_loop, s1) - */ - /*with:*/ { - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_concurrent); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_futures); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ProcessPoolExecutor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_max_workers, __pyx_int_10) < 0) __PYX_ERR(0, 35, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - /*try:*/ { - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pool, __pyx_t_3) < 0) __PYX_ERR(0, 35, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test.py":37 - * with concurrent.futures.ProcessPoolExecutor(max_workers=10) as pool: - * # bus_future = pool.submit(device_loop, bus) - * s1_future = pool.submit(s1_loop, s1) # <<<<<<<<<<<<<< - * s2_future = pool.submit(s2_loop, s2) - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pool); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_submit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_s1_loop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_s1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s1_future, __pyx_t_5) < 0) __PYX_ERR(0, 37, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "test.py":38 - * # bus_future = pool.submit(device_loop, bus) - * s1_future = pool.submit(s1_loop, s1) - * s2_future = pool.submit(s2_loop, s2) # <<<<<<<<<<<<<< - * - * for future in concurrent.futures.as_completed([s1_future, s2_future]): - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pool); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_submit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_s2_loop); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s2_future, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":40 - * s2_future = pool.submit(s2_loop, s2) - * - * for future in concurrent.futures.as_completed([s1_future, s2_future]): # <<<<<<<<<<<<<< - * try: - * print(future.result()) - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_concurrent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_futures); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_as_completed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_s1_future); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_s2_future); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 40, __pyx_L6_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 40, __pyx_L6_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 40, __pyx_L6_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_11(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 40, __pyx_L6_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_future, __pyx_t_1) < 0) __PYX_ERR(0, 40, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":41 - * - * for future in concurrent.futures.as_completed([s1_future, s2_future]): - * try: # <<<<<<<<<<<<<< - * print(future.result()) - * except Exception as e: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - /*try:*/ { - - /* "test.py":42 - * for future in concurrent.futures.as_completed([s1_future, s2_future]): - * try: - * print(future.result()) # <<<<<<<<<<<<<< - * except Exception as e: - * print(e) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_future); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L14_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L14_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L14_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L14_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L14_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":41 - * - * for future in concurrent.futures.as_completed([s1_future, s2_future]): - * try: # <<<<<<<<<<<<<< - * print(future.result()) - * except Exception as e: - */ - } - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L21_try_end; - __pyx_L14_error:; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "test.py":43 - * try: - * print(future.result()) - * except Exception as e: # <<<<<<<<<<<<<< - * print(e) - * - */ - __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_15) { - __Pyx_AddTraceback("test", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L16_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_e, __pyx_t_4) < 0) __PYX_ERR(0, 43, __pyx_L16_except_error) - - /* "test.py":44 - * print(future.result()) - * except Exception as e: - * print(e) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_e); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L16_except_error) - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_PrintOne(0, __pyx_t_5) < 0) __PYX_ERR(0, 44, __pyx_L16_except_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L15_exception_handled; - } - goto __pyx_L16_except_error; - __pyx_L16_except_error:; - - /* "test.py":41 - * - * for future in concurrent.futures.as_completed([s1_future, s2_future]): - * try: # <<<<<<<<<<<<<< - * print(future.result()) - * except Exception as e: - */ - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - goto __pyx_L6_error; - __pyx_L15_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - __pyx_L21_try_end:; - } - - /* "test.py":40 - * s2_future = pool.submit(s2_loop, s2) - * - * for future in concurrent.futures.as_completed([s1_future, s2_future]): # <<<<<<<<<<<<<< - * try: - * print(future.result()) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "test.py":35 - * - * - * with concurrent.futures.ProcessPoolExecutor(max_workers=10) as pool: # <<<<<<<<<<<<<< - * # bus_future = pool.submit(device_loop, bus) - * s1_future = pool.submit(s1_loop, s1) - */ - } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_try_end; - __pyx_L6_error:; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /*except:*/ { - __Pyx_AddTraceback("test", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) __PYX_ERR(0, 35, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_14); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_16 < 0) __PYX_ERR(0, 35, __pyx_L8_except_error) - __pyx_t_17 = ((!(__pyx_t_16 != 0)) != 0); - if (__pyx_t_17) { - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_2, __pyx_t_4); - __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 35, __pyx_L8_except_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L7_exception_handled; - } - __pyx_L8_except_error:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - goto __pyx_L1_error; - __pyx_L7_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_L11_try_end:; - } - } - /*finally:*/ { - /*normal exit:*/{ - if (__pyx_t_6) { - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - goto __pyx_L5; - } - __pyx_L5:; - } - goto __pyx_L27; - __pyx_L2_error:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L1_error; - __pyx_L27:; - } - - /* "test.py":1 - * import nanomsg # <<<<<<<<<<<<<< - * import concurrent.futures - * import time - */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init test", 0, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init test"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* GetModuleGlobalName */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - if (likely(result)) { - Py_INCREF(result); - } else if (unlikely(PyErr_Occurred())) { - result = NULL; - } else { -#else - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); - } -} -#endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); - if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); - goto bad; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; - } -done: - Py_DECREF(fake_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} - -/* CythonFunction */ - #include -static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp = op->func_doc; - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - PyObject_GC_Track(op); - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - __Pyx__CyFunction_dealloc(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return __Pyx_PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - arg0 = PyTuple_GET_ITEM(arg, 0); - #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; - #endif - result = (*meth)(self, arg0); - #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(arg0); - #endif - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -}; -static int __pyx_CyFunction_init(void) { - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if PY_VERSION_HEX >= 0x030700A3 - *type = tstate->exc_state.exc_type; - *value = tstate->exc_state.exc_value; - *tb = tstate->exc_state.exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A3 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = type; - tstate->exc_state.exc_value = value; - tstate->exc_state.exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { -#endif - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if PY_VERSION_HEX >= 0x030700A3 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = local_type; - tstate->exc_state.exc_value = local_value; - tstate->exc_state.exc_traceback = local_tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (PyObject_Not(use_cline) != 0) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* Print */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} -#endif - -/* PrintOne */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} -#else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; -} -#endif - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; ip) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { - Py_DECREF(result); - return NULL; - } - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/BACKUP/python/test.py b/BACKUP/python/test.py deleted file mode 100644 index d573508..0000000 --- a/BACKUP/python/test.py +++ /dev/null @@ -1,46 +0,0 @@ -import nanomsg -import concurrent.futures -import time - -addr = 'ipc:///tmp/bus.ipc' - -bus = nanomsg.Socket(nanomsg.BUS, domain=nanomsg.AF_SP_RAW) -# print(bus.bind(addr)) - -def device_loop(bus): - device = nanomsg.Device(bus) - print(device.start()) - return - -s1 = nanomsg.Socket(nanomsg.PAIR) -print(s1.bind(addr)) - -def s1_loop(s1): - while True: - print('s1 sending ...') - print(s1.send(b's1 sent a message')) - time.sleep(1) - # print(s1.recv()) - -s2 = nanomsg.Socket(nanomsg.PAIR) -print(s2.connect(addr)) - -def s2_loop(s2): - while True: - print('s2 receiving ...') - # s2.send(b's2 sent a message') - print(s2.recv()) - - -with concurrent.futures.ProcessPoolExecutor(max_workers=10) as pool: - # bus_future = pool.submit(device_loop, bus) - s1_future = pool.submit(s1_loop, s1) - s2_future = pool.submit(s2_loop, s2) - - for future in concurrent.futures.as_completed([s1_future, s2_future]): - try: - print(future.result()) - except Exception as e: - print(e) - - diff --git a/BACKUP/python/transport.py b/BACKUP/python/transport.py deleted file mode 100644 index 8b35577..0000000 --- a/BACKUP/python/transport.py +++ /dev/null @@ -1,74 +0,0 @@ - - - -class Transport(Object): - - def __init___(self, sid): - self.state = 'init' - pass - - def connect(self, addr): - pass - - def disconnect(self, addr): - pass - - def send(self, json): - pass - - def receive(self, seq): - pass - -import nanomsg - -class NanomsgTransport(Transport): - - def __init__(self, sid): - pass - - def connect(self, addr): - if self.state != 'init': - return - - - - def broker(self, addr): - if self.broker is not None: - return self.broker - - self.broker = nanomsg.Socket(nanomsg.PAIR) - - - -# class NanomsgTransportBroker(Transport): - - - -# import redis - -# class RedisTransport(Transport): - -# def __init__(self): -# super().__init__(self) -# self.redis = None -# self.lounge = 'lounge' # keyspace for sessions waiting to start -# self.sid = None # keyspace for the current session - -# def connect(self, addr): -# host, port, sid = addr - -# self.sid = sid -# self.redis = redis.StrictRedis(host=host, port=port) - -# return self - - -# def send(self, json) -# return self.redis.rpush(self.sid, json) - -# def receive(self, seq) -# resp = self.redis.lindex(self.sid, seq) -# if resp is None: -# self.redis.brpop(self.sid) - -# def control(self, json) diff --git a/BACKUP/rt.sats b/BACKUP/rt.sats deleted file mode 100644 index 1baab2d..0000000 --- a/BACKUP/rt.sats +++ /dev/null @@ -1,46 +0,0 @@ -//staload "util" - -absvtype rtchan -abstype rtstype -abstype transport - -datatype rttype = -| INT -| BOOL -| STRING -| STYPE -| CHAN of (set int, set int, rtstype) - -//datavtype rtdata = -//| INT of int -//| BOOL of bool -//| STRING of string -//| STYPE of rtstype -//| CHAN of rtchan - -datatype rtstype_t = -| Init of (int) -| Msg of (int, int, rttype) -| BMsg of (int, rttype) -| Seq of (rtstype, rtstype) -| End of (int) -| {a:t@ype} Quan of (int, a -> rtstype) - -datavtype rtchan_t = Chan of (set int, set int, rtstype, transport) - -assume rtchan = rtchan_t -assume rtstype = rtstype_t - - -fun session_accept (name: string, addr: string, full: set int, self: set int): rtchan -fun session_request (name: string, addr: string, full: set int, self: set int): rtchan - -fun {a:vt@ype} session_send (!rtchan, a): void -fun {a:vt@ype} session_recv (!rtchan): a -fun session_skip (!rtchan): void - -fun {a:t@ype} session_bsend (!rtchan, a): void -fun {a:t@ype} session_brecv (!rtchan): a - -fun {a:t@ype} session_unify (!rtchan, a): void -fun {a:t@ype} session_exify (!rtchan): a \ No newline at end of file diff --git a/BACKUP/rtsession.dats b/BACKUP/rtsession.dats deleted file mode 100644 index ea2c279..0000000 --- a/BACKUP/rtsession.dats +++ /dev/null @@ -1,39 +0,0 @@ -staload "./rtsession.sats" -staload "./endpoint.sats" - -vtypedef msg (a:vt@ype) = $rec{from=role, to=roleset, label=string, payload=a} - -datavtype _rtsession = RTSession of (roleset, rtstype, endpoint) -assume rtsession = _rtsession - -implement {a} rtsession_send (s, proof, payload) = let - val @RTSession (roles, stype, ep) = s -in - case+ stype of - | Seq (Msg (from, to, rtti), s) when mem(roles, from) andalso not(mem(roles, to)) andalso proof = rtti => - let - val msg = $rec{from=from, to=to, label="msg", payload=payload} : msg - val _ = endpt_send (ep, msg) - val _ = stype := s - in - fold@ s - end - - | _ =>> assertloc ("Type Error!") -end - -implement {a} rtsession_recv (s, proof) = let - val @RTSession (roles, stype, ep) = s -in - case+ stype of - | Seq (Msg (from, to, rtti), s) when not(mem(roles, from)) andalso mem(roles, to) andalso proof = rtti => - let - val msg = : msg - val $rec{from=from, to=to, label="msg", payload=payload} = endpt_recv (ep) : msg - val _ = stype := s - in - fold@ s - end - - | _ =>> assertloc ("Type Error!") -end \ No newline at end of file diff --git a/BACKUP/rtsession.sats b/BACKUP/rtsession.sats deleted file mode 100644 index 6360cc2..0000000 --- a/BACKUP/rtsession.sats +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - -(* runtime types *) -datatype rtti (a:vt@ype) = -| INT (int) -| STRING (string) -| BOOL (bool) -| RTSTYPE (rtstype) -| RTTI (rtti a) of (rtti a) - -(* runtime stypes *) -and rtstype (stype) = -| {r:role} Init (pinit r) of (int r) -| {r:role} End (pend r) of (int r) -| {r1,r2:role} {a:vt@ype} Msg (pmsg(r1,r2,a)) of (int r1, int r2, rtti a) -| {r:role} {a:t@ype} BCast (pbcast(r,a)) of (int r, rtti a) -| {s1,s2:stype} Seq (pseq(s1,s2)) of (rtstype s1, rtstype s2) - -(* rtsession *) -absvtype rtsession = ptr - - -fun {} rtsession_make (roleset, rtstype): rtsession -fun {} rtsession_free (rtsession): void - -fun {} rtsession_roles (!rtsession): roleset -fun {} rtsession_stype (!rtsession): rtstype - -fun {} rtsession_accept (!rtsession): bool -fun {} rtsession_request (!rtsession): bool - -fun {a:vt@ype} rtsession_send (!rtsession, rtti a, a): void -fun {a:vt@ype} rtsession_recv (!rtsession, rtti a): a - -fun {} rtsession_close (rtsession): void -fun {} rtsession_wait (rtsession): void \ No newline at end of file diff --git a/BACKUP/runtime/c/Makefile b/BACKUP/runtime/c/Makefile deleted file mode 100644 index ac6f81d..0000000 --- a/BACKUP/runtime/c/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - - -CFLAGS=-std=c99 -g -O0 -DLOG_USE_COLOR -DDEBUG -LDFLAGS=-lpthread -lnng - -runtime: runtime.o log.o - - diff --git a/BACKUP/runtime/c/runtime b/BACKUP/runtime/c/runtime deleted file mode 100755 index 82f24a2..0000000 Binary files a/BACKUP/runtime/c/runtime and /dev/null differ diff --git a/BACKUP/session.dats b/BACKUP/session.dats deleted file mode 100644 index 9609e0d..0000000 --- a/BACKUP/session.dats +++ /dev/null @@ -1,93 +0,0 @@ -staload "./libsession.sats" -staload "./session.sats" -staload "./set.sats" - -staload UNSAFE = "prelude/SATS/unsafe.sats" - -(* session type implementation *) -datavtype session_t (self:roles, s:stype) = -| Session (self, s) of (set self, rtstype s, endpt (self, s)) - -assume session (self:roles, s:stype) = session_t (self, s) - -implement {} session_send {self} {from,to} {a} (session, v) = let - val+ ~Session (self, rtti, ep) = session - val+ Msg (from, to) = rtti - val _ = assertloc (mem(self,from) andalso ~mem(self,to)) - - val _ = endpt_send (ep, from, to, v) -in - -end - -implement {} session_recv {self} {from,to} {a} (session) = let - val+ ~Session (self, rtti, ep) = session - val+ Msg (from, to) = rtti - val v = endpt_recv (ep, from, to) -in - v -end - -implement {} session_seq {self} {s1,s2} {a} (session, f) = let - val+ @Session (self, rtti, ep) = session - val+ Seq (rt1, rt2) = rtti - - val s1 = Session (self, rt1, $UNSAFE.castvwtp1{endpt(self,s1)}(ep)) - val ret = f s1 - val _ = cloptr_free ($UNSAFE.castvwtp0{cloptr(void)} f) - - val _ = rtti := rt2 - val _ = ep := $UNSAFE.castvwtp0{endpt(self,s2)}(ep) - prval _ = fold@ session -in - ret -end - - - -//implement {} rtchan_send_message {self} {from,to} {a} {s} (rtchan, payload) = let -// val+ @RTChan (rtstype, chan) = rtchan -// val+ Message (rtcont, from, to) = rtstype - -// val _ = chan_send_message (chan, from, to, payload) -// val _ = rtstype := rtcont -//in -// fold@ rtchan -//end - -//implement {} chan_create {s} {a,b} (a, b, f) = let -// val mboxA = mbox_create () -// val mboxB = mbox_create () -// val sockA = sock_create () -// val sockB = sock_create () - - -//in -//end - - -//implement {} rtchan_create {s} {a,b} (a, b, s, f) = let -// val chan = chan_create (a, b, llam chan => -// let -// val _ = f (RTChan (s, chan)) -// in -// cloptr_free ($UNSAFE.castvwtp0{cloptr(void)} f) -// end) -//in -// RTChan (s, chan) -//end - -//implement {} session_create {s} {self} (self, s, f) = let -// prval _ = lemma_set_com_disj {self} () -// prval _ = lemma_set_disj_comm {self,~self} () - -// val rtchan = rtchan_create (~self, self, s, llam rtchan => -// let -// val _ = f (Session (~self, rtchan)) -// in -// cloptr_free ($UNSAFE.castvwtp0{cloptr(void)} f) -// end) - -//in -// Session (self, rtchan) -//end \ No newline at end of file diff --git a/BACKUP/session.sats b/BACKUP/session.sats deleted file mode 100644 index d7903f3..0000000 --- a/BACKUP/session.sats +++ /dev/null @@ -1,77 +0,0 @@ -staload "./libsession.sats" -staload "./set.sats" - -(* typed endpoints *) -absvtype endpt (roles, stype) = ptr - -(* API for endpoints *) -fun {} endpt_send - {self:roles} {from,to:role|mem(self,from)*not(mem(self,to))} {a:vt@ype} - (endpt(self,pmsg(from,to,a)), int from, int to, a): void - -fun {} endpt_recv - {self:roles} {from,to:role|not(mem(self,from))*mem(self,to)} {a:vt@ype} - (endpt(self,pmsg(from,to,a)), int from, int to): a - -//fun {} endpt_accept -// {self:roles} {r:role|mem(self,r)} {s:stype} -// (socket, set self, rtstype(pinit(r)::s)): endpt(self,s) - -//fun {} endpt_request -// {self:roles} {r:role|not(mem(self,r))} {s:stype} -// (socket, set self, rtstype(pinit(r)::s)): endpt(self,s) - - - -//fun {} chan_create -// {s:stype} {a,b:roles|disj(a,b)} -// (set a, set b, chan (a, s) - void): chan (b, s) - -//fun {} chan_lock_acquire -// {self:roles} {r:role|mem(self,r)} {s:stype} -// (!chan(self,plock(r)::s)) - -//fun {} chan_lock_accept -// {self:roles} {r:role|not(mem(self,r))} {s:stype} -// (!chan(self,plock(r,s)) >> chan(self,s)): - -//fun {} chan_unlock_accept -// {self:roles} {r:role|not(mem(self,r))} {s:stype} -// (LOCK s | !chan(self,unlock(r)) >> chan(self,s)): void - -//fun {} chan_lock_request -// {self:roles} {r:role|mem(self,r)} {s:stype} -// (!chan(self,plock(r)::s) >> chan(self,s)): (LOCK s | void) - -//fun {} chan_unlock_request -// {self:roles} {r:role|mem(self,r)} {s:stype} -// (LOCK s | !chan(self,unlock(r)) >> chan(self,s)): void - - -//FORK = rpt(plock(0)::punlock(0)) - -//fun {} chan_service_provide -// {self:roles} {r:role|mem(self,r)} {s:stype} -// (!chan(self,prpt(r)::s)): void - -//fun {} chan_service_stop -// {self:roles} {r:role|mem(self,r)} {s:stype} -// (chan(self,prpt(r)::s)): void - -//fun {} chan_service_request -// {self:roles} {r:role|not(mem(self,r))} {s:stype} -// (!chan(self,prpt(r)::s)): chan(self,s) - - -(* API for rtchan *) -//fun {} rtchan_send -// {self:roles} {from,to:role|mem(self,from)*not(mem(self,to))} {a:vt@ype} {s:stype} -// (!rtchan(self,pmsg(from,to,a)::s) >> rtchan(self,s), payload a): void - -//fun {} rtchan_create -// {s:stype} {a,b:roles|disj(a,b)} -// (set a, set b, rtstype s, rtchan (a, s) - void): rtchan (b, s) - - - - diff --git a/BACKUP/set.sats b/BACKUP/set.sats deleted file mode 100644 index 771d283..0000000 --- a/BACKUP/set.sats +++ /dev/null @@ -1,97 +0,0 @@ -datasort Set = (* hook into smt2 *) -sortdef set = Set - -stacst set_emp: set = "ext#smt_set_emp" -// -stacst set_add: (set, int) -> set = "ext#smt_set_add" -stacst set_del: (set, int) -> set = "ext#smt_set_del" -// -stacst set_cap: (set, set) -> set = "ext#smt_set_cap" -stacst set_cup: (set, set) -> set = "ext#smt_set_cup" -stacst set_dif: (set, set) -> set = "ext#smt_set_dif" -stacst set_com: (set) -> set = "ext#smt_set_com" -// -stacst set_mem: (set, int) -> bool = "ext#smt_set_mem" -stacst set_sub: (set, set) -> bool = "ext#smt_set_sub" -stacst set_sup: (set, set) -> bool = "ext#smt_set_sup" -stacst set_eq: (set, set) -> bool = "ext#smt_set_eq" - -stadef emp = set_emp -stadef + (e:int, s:set) = set_add (s, e) -stadef + = set_add -stadef - = set_del -stadef + = set_cup -stadef * = set_cap -stadef - = set_dif -stadef ~ = set_com -stadef mem = set_mem -stadef sub = set_sub -stadef > = set_sub -stadef sup = set_sup -stadef < = set_sup -stadef == = set_eq -stadef disj (a:set, b:set) = a * b == emp - - -abstype set (set) - -fun set_emp (): set emp - -fun set_add {s:set} {n:int} (set s, int n): set (s + n) -fun set_del {s:set} {n:int} (set s, int n): set (s - n) - -fun set_cap {s1,s2:set} (set s1, set s2): set (s1 * s2) -fun set_cup {s1,s2:set} (set s1, set s2): set (s1 + s2) -fun set_dif {s1,s2:set} (set s1, set s2): set (s1 - s2) - -// TODO: need to have a concrete representation of co-finite set -// consider set(co:bool, set:s) -fun set_com {s:set} (set s): set (~s) - -fun set_mem {s:set} {n:int} (set s, int n): bool (mem (s, n)) -fun set_sub {s1,s2:set} (set s1, set s2): bool (sub (s1, s2)) -fun set_sup {s1,s2:set} (set s1, set s2): bool (sup (s1, s2)) -fun set_eq {s1,s2:set} (set s1, set s2): bool (s1 == s2) - -fun set_disj {s1,s2:set} (set s1, set s2): bool (disj (s1, s2)) - -overload + with set_add -overload - with set_del -overload + with set_cup -overload * with set_cap -overload - with set_dif -overload ~ with set_com -overload = with set_eq - -overload emp with set_emp -overload mem with set_mem -overload sub with set_sub -overload sup with set_sup -overload disj with set_disj - -praxi lemma_set_com_disj {s:set} (): [disj(s,~s)] unit_p -praxi lemma_set_disj_comm {s1,s2:set|disj(s1,s2)} (): [disj(s2,s1)] unit_p -//// -praxi lemma_set_sub_emp {g:set} (): [sub(g,emp)] unit_p -praxi lemma_set_sub_cap {g,g1,g2:set|sub(g,g1)&&sub(g,g2)} (): [sub(g,g1*g2)] unit_p - - -praxi lemma_set_sub_self {g:set} (): [sub(g,g)] unit_p -praxi lemma_set_sub_sub {g1,g2,g3:set|sub(g1,g2)&&sub(g2,g3)} (): [sub(g1,g3)] unit_p -praxi lemma_set_sub_cup {g,g1,g2:set|sub(g,g1)&&sub(g,g2)} (): [sub(g,g1+g2)] unit_p -praxi lemma_set_sub_cup2 {g1,g2:set} (): [sub(g1+g2,g1)&&sub(g1+g2,g2)] unit_p -praxi lemma_set_sub_cap2 {g1,g2:set} (): [sub(g1,g1*g2)&&sub(g2,g1*g2)] unit_p - -praxi lemma_set_size_nat {g:set} (): [size(g) >= 0] unit_p -praxi lemma_set_size_empty (): [size(snil)==0] unit_p -praxi lemma_set_size_add {g:set} {e:int} (): [(mem(g,e)&&size(g+e)==size(g))+(not(mem(g,e))&&size(g+e)==size(g)+1)] unit_p - -praxi lemma_set_com_law {u,g:set|sub(u,g)} (): [(g+(u-g)==u)&&(g*(u-g)==snil)] unit_p -praxi lemma_set_com_sub {u,g1,g2:set|sub(u,g1)&&sub(u,g2)&&(sub(g1,g2))} (): [sub(u-g2,u-g1)] unit_p -praxi lemma_set_com_emp {u:set} (): [u-snil==u] unit_p -praxi lemma_set_com_uni {u:set} (): [u-u==snil] unit_p -praxi lemma_set_com_inv {u,g:set|sub(u,g)} (): [u-(u-g)==g] unit_p - -praxi lemma_set_com_demorgan {u,g1,g2:set|sub(u,g1)&&sub(u,g2)} (): [(u-(g1+g2)==(u-g1)*(u-g2))&&(u-(g1*g2)==(u-g1)+(u-g2))] unit_p - - diff --git a/BACKUP/set.smt2 b/BACKUP/set.smt2 deleted file mode 100644 index 17295e4..0000000 --- a/BACKUP/set.smt2 +++ /dev/null @@ -1,23 +0,0 @@ -; uninterpreted sort -(define-sort Elt () Int) -(define-sort Set () (Array Elt Bool)) - -(define-const smt_set_emp (Set) ((as const (Set)) false)) -(define-fun smt_set_add ((s Set) (x Elt)) (Set) (store s x true)) -(define-fun smt_set_del ((s Set) (x Elt)) (Set) (store s x false)) -(define-fun smt_set_cap ((s1 Set) (s2 Set)) (Set) ((_ map and) s1 s2)) -(define-fun smt_set_cup ((s1 Set) (s2 Set)) (Set) ((_ map or) s1 s2)) -(define-fun smt_set_com ((s Set)) (Set) ((_ map not) s)) -; s1 - s2 -(define-fun smt_set_dif ((s1 Set) (s2 Set)) (Set) (smt_set_cap s1 (smt_set_com s2))) -(define-fun smt_set_mem ((s Set) (x Elt)) Bool (select s x)) -; s1 <: s2 -(define-fun smt_set_sub ((s1 (Set)) (s2 (Set))) Bool (= smt_set_emp (smt_set_dif s1 s2))) -; s1 :> s2 -(define-fun smt_set_sup ((s1 (Set)) (s2 (Set))) Bool (= smt_set_emp (smt_set_dif s2 s1))) -(define-fun smt_set_eq ((s1 (Set)) (s2 (Set))) Bool (and (smt_set_sub s1 s2) (smt_set_sup s1 s2))) - - -; uninterpreted sort -(declare-sort stype 0) -;(define-fun S2Eextkind ((s s2rt_tkind)) s2rt_int) diff --git a/BACKUP/socket.sats b/BACKUP/socket.sats deleted file mode 100644 index bc511c7..0000000 --- a/BACKUP/socket.sats +++ /dev/null @@ -1,19 +0,0 @@ - - -abstype sockopt -absvtype socket - -fun sock_create (sockopt): sock - -fun sock_bind (!sock, address): void -fun sock_connect (!sock, address): void - -fun sock_close (sock): void -fun sock_link (!sock, !sock): void - -datatype POLL_EVENT = CAN_SEND | CAN_RECEIVE -fun sock_poll (!sock, POLL_EVENT): bool - - -fun {a:vt@ype} sock_send (!sock, a): void -fun {a:vt@ype} sock_receive (!sock): a \ No newline at end of file diff --git a/BACKUP/test_bitcoinpayment.dats b/BACKUP/test_bitcoinpayment.dats deleted file mode 100644 index 276171e..0000000 --- a/BACKUP/test_bitcoinpayment.dats +++ /dev/null @@ -1,73 +0,0 @@ -//https://d28rh4a8wq0iu5.cloudfront.net/bitcointech/readings/princeton_bitcoin_book.pdf -//Figure 4.8: Payment process involving a user, merchant, and payment service. -staload "./libsession.sats" -staload "./set.sats" - -#define C 0 -#define M 1 -#define P 2 - -typedef tid (n:int) = int n - - - -stadef proto = pquan(M, lam (n:int) => pmsg(M,C,@(tid(n),int)):: - pmsg(C,P,@(tid(n),int)):: -// pquan2(P, lam (pi:stype) => pmsg(P,C,rtstype(pi)) :: pi) - pbcast(P,@(tid(n),string)):: - pmsg(P,M,@(tid(n),string)):: - pend(M)) - -extern fun client (session(C+emp,proto)): void -extern fun server (session(M+P+emp,proto)): void -extern fun merchant (session(M+emp,proto)): void -extern fun payment (session(P+emp,proto)): void - - -implement client (ch) = let - val [tid:int] ch = session_exify ch - val @(tid, amount) = session_recv_cont ch - val () = session_send_cont (ch, @(tid, amount)) - val @(tid, status) = session_brecv_cont ch - val () = session_skip_cont ch -in - session_wait ch -end - -//implement server (chMP) = let -// val rtti = Quan(M, lam {n:int} (n: int(n)) => -// Seq(Msg(M,C), -// Seq(Msg(C,P), -// Seq(BCast(P), -// Seq(Msg(P,M), -// End(M)))))): rtstype(proto) - -// val chfull = session_full (emp()+M+P+C, rtti) -//in -// session_split {emp+P,emp+M} (chfull, -// llam chP => payment chP, -// llam chMC => merchant (session_cut (chMC, chMP))) -//end - -implement merchant (ch) = let - val tid = 100 : tid(100) - - val ch = session_unify ch - val () = session_send_cont (ch, @(tid, 199)) - val () = session_skip_cont ch - val @(_, status) = session_brecv_cont ch - val @(_, status) = session_recv_cont ch -in - session_close ch -end - -implement payment (ch) = let - val [tid:int] ch = session_exify ch - val () = session_skip_cont ch - val @(tid, amount) = session_recv_cont ch - val () = session_bcast_cont (ch, @(tid, "ok")) - val () = session_send_cont (ch, @(tid, "confirmed")) -in - session_wait ch -end - diff --git a/BACKUP/test_typechecking.dats b/BACKUP/test_typechecking.dats deleted file mode 100644 index bbde8e7..0000000 --- a/BACKUP/test_typechecking.dats +++ /dev/null @@ -1,125 +0,0 @@ - -staload "./libsession.sats" -staload "./set.sats" - -//#include "share/atspre_staload.hats" - - -(* 0: client *) -(* 1: auth *) -(* 2: server *) - -absvtype token = ptr - -stadef protoauth = pmsg(0,1,string)::pmsg(0,1,string)::pmsg(1,0,token) -stadef protosrv_ok = pmsg(0,2,int)::pmsg(0,2,int)::pmsg(2,0,bool)::pend(0) -stadef protosrv_fail = pmsg(2,0,string)::pend(2) -stadef protosrv = pmsg(0,2,token)::paddi(2,protosrv_ok,protosrv_fail) - -stadef proto = protoauth :: protosrv - -extern fun authenticate (string, string): token -extern fun validate (token): bool - -extern fun auth (session(1+emp,protoauth)): void -extern fun srv (session(2+emp,protosrv)): void -extern fun cli (session(0+emp,proto)): void - -implement auth (ch) = let - val usn = session_recv_cont ch - val pwd = session_recv_cont ch - val token = authenticate (usn, pwd) -in - session_send (ch, token) -end - -implement srv (ch) = let - val token = session_recv_cont ch - - fun fail (ch: session(2+emp,protosrv_fail)): void = let - val _ = session_send_cont (ch, "Validation failed.") - in - session_close ch - end - - fun ok (ch: session(2+emp,protosrv_ok)): void = let - val a = session_recv_cont ch - val b = session_recv_cont ch - val _ = session_send_cont (ch, a = b) - in - session_wait ch - end -in - if validate token - then - let val _ = session_aconj (ch, Left ()) - in ok ch end - else - let val _ = session_aconj (ch, Right ()) - in fail ch end -end - -implement cli (ch) = let - fun do_auth (ch: session(0+emp, protoauth)): token = let - val _ = session_send_cont (ch, "admin") - val _ = session_send_cont (ch, "password") - in - session_recv ch - end - - val token = session_seq (ch, llam ch => do_auth ch) - val _ = session_send_cont (ch, token) - val choice = session_adisj ch - - fun fail (ch: session(0+emp, protosrv_fail)): void = let - val msg = session_recv_cont ch - in - session_wait ch - end - - fun ok (ch: session(0+emp, protosrv_ok)): void = let - val a = 1 - val b = 1 - val _ = session_send_cont (ch, a) -// val _ = session_send_cont (ch, b) - val r = session_recv_cont ch - in - session_close ch - end -in - case+ choice of - | ~Left () => ok ch - | ~Right () => fail ch -end - -extern fun test (): void - - -implement test () = let - val full = emp() + 0 + 1 + 2 - - val rttiauth: rtstype(protoauth) = Seq(Msg(0,1),Seq(Msg(0,1),Msg(1,0))) - val rttisrvok: rtstype(protosrv_ok) = Seq(Msg(0,2),Seq(Msg(0,2), Seq(Msg(2,0), End(0)))) - val rttisrvfail: rtstype(protosrv_fail) = Seq(Msg(2,0),End(2)) - val rttisrv: rtstype(protosrv) = Seq(Msg(0,2),Addi(2,rttisrvok,rttisrvfail)) - val rtti:rtstype(proto) = Seq(rttiauth,rttisrv) - - fun hook (ch:session(emp+1+2,proto)): void = let - - val () = session_seq (ch, llam ch => - session_split {emp+1,emp+2} (ch, - llam ch => auth ch, - llam ch => session_skip ch)) - - val _ = session_split {emp+1,emp+2} (ch, - llam ch => session_skip ch, - llam ch => srv ch) - in - end - - val session = session_full (full, rtti) - val _ = session_split {emp+0, emp+1+2} (session, - llam ch => cli ch, - llam ch => hook ch) -in -end diff --git a/BACKUP/thread.sats b/BACKUP/thread.sats deleted file mode 100644 index 5240c03..0000000 --- a/BACKUP/thread.sats +++ /dev/null @@ -1,8 +0,0 @@ - -absvtype thread -abstype thread_id -typedef thread_fn = (thread_id) - void - -fun {} thread_create (thread_fn): thread_id -fun {} thread_self (): thread_id -fun {} thread_exit (): void diff --git a/BACKUP/timer.sats b/BACKUP/timer.sats deleted file mode 100644 index c44ebcf..0000000 --- a/BACKUP/timer.sats +++ /dev/null @@ -1,3 +0,0 @@ - - -abstype timer \ No newline at end of file diff --git a/BACKUP/uuid.sats b/BACKUP/uuid.sats deleted file mode 100644 index 8d28fc5..0000000 --- a/BACKUP/uuid.sats +++ /dev/null @@ -1,11 +0,0 @@ - -abstype uuid - - -fun uuid (): uuid - -fun print_uuid (uuid): void -fun eq_uuid_uuid (uuid, uuid): bool - -overload print with print_uuid -overload = with eq_uuid_uuid \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f2b3803..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Hanwen (Steinway) Wu - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Makefile b/Makefile deleted file mode 100644 index d7bd0b0..0000000 --- a/Makefile +++ /dev/null @@ -1,25 +0,0 @@ - -CFLAGS=-std=c11 -g -O0 -DLOG_USE_COLOR -DDEBUG -CFLAGS+=-D_GNU_SOURCE -I$(PATSHOME) -I$(PATSHOME)/ccomp/runtime -I$(PATSHOME)/contrib/atscntrb -DATS_MEMALLOC_LIBC -LDFLAGS=-lpthread -PATSOPT=patsopt --constraint-ignore - -all: test.tc test_dats - mv test_dats a.out - -clean: - rm -rf *.const *.tc *_dats.c *_sats.c *.o examples/*.const examples/*.tc *.dSYM - -%.const: %.dats - patsopt -tc --constraint-export -d $< | patsolve_smt2 -i preamble --printfile ./set.smt2 -i - > $@ - -%.tc: %.const - z3 -t:2000 -smt2 $< 2>&1 | tee $@ | em -fgreen "^unsat" | em "^sat|^timeout|^unknown" - -%_dats.c: %.dats - $(PATSOPT) -o $@ -d $< - -%_sats.c: %.sats - $(PATSOPT) -o $@ -s $< - -test_dats: endpoint_dats.o libsession_dats.o log.o runtime.o thread_dats.o test_dats.o diff --git a/ats-sessions.sublime-project b/ats-sessions.sublime-project deleted file mode 100644 index 8e9f1fc..0000000 --- a/ats-sessions.sublime-project +++ /dev/null @@ -1,26 +0,0 @@ -{ - "folders": - [ - { - "path": "." - }, - { - "path": "/Users/hwwu/Git/ats-utils" - }, - { - "path": "/Users/hwwu/Git/ats-session-playground" - }, - { - "path": "/Users/hwwu/Programs/atsgit/contrib/ATS-extsolve" - }, - { - "path": "/Users/hwwu/Programs/atsgit/contrib/ATS-extsolve-smt2" - }, - { - "path": "/Users/hwwu/Programs/atsgit/contrib/ATS-extsolve-z3" - }, - { - "path": "/Users/hwwu/Git/c0/cc0-concur" - } - ] -} diff --git a/ats-sessions.sublime-workspace b/ats-sessions.sublime-workspace deleted file mode 100644 index de62a58..0000000 --- a/ats-sessions.sublime-workspace +++ /dev/null @@ -1,4932 +0,0 @@ -{ - "auto_complete": - { - "selected_items": - [ - [ - "uni", - "uniqueValues" - ], - [ - "skip", - "skipSenderCheck" - ], - [ - "com", - "committed" - ], - [ - "requ", - "requests〔variable〕" - ], - [ - "respon", - "responses" - ], - [ - "acc", - "accptorside" - ], - [ - "re", - "requesterside" - ], - [ - "proto", - "prototype" - ], - [ - "in", - "intersect" - ], - [ - "pattern", - "patterns" - ], - [ - "pat", - "patterns〔argument〕" - ], - [ - "rece", - "receivers〔variable〕" - ], - [ - "res", - "respondents" - ], - [ - "Na", - "NanomsgBroker" - ], - [ - "cast", - "castvwtp1" - ], - [ - "nng", - "nng_socket" - ], - [ - "pthr", - "pthread_t" - ], - [ - "pt", - "pthread_t" - ], - [ - "t", - "transport" - ], - [ - "expli", - "explicitly" - ], - [ - "equiv", - "equivalences" - ], - [ - "sych", - "synchronously" - ], - [ - "syn", - "synchronously" - ], - [ - "exp", - "explicitly" - ], - [ - "sig", - "signature" - ], - [ - "pres", - "preserves" - ], - [ - "clas", - "classes" - ], - [ - "__", - "__name__ == '__main__':〔variable〕" - ], - [ - "mem", - "memory" - ], - [ - "evalu", - "evaluation" - ], - [ - "appli", - "applying" - ], - [ - "the", - "theorems" - ], - [ - "lem", - "lemmas" - ], - [ - "contra", - "contractum" - ], - [ - "constn", - "constants" - ], - [ - "all", - "allocated" - ], - [ - "resou", - "resources" - ], - [ - "faci", - "facilitate" - ], - [ - "invol", - "involves" - ], - [ - "Subs", - "Substitution" - ], - [ - "implem", - "implementations" - ], - [ - "sy", - "symmetric" - ], - [ - "corres", - "correspond" - ], - [ - "gene", - "generalization" - ], - [ - "genera", - "generalize" - ], - [ - "gen", - "generalized" - ], - [ - "functi", - "functional" - ], - [ - "jud", - "judgement" - ], - [ - "thero", - "theory" - ], - [ - "bal", - "balanced" - ], - [ - "st", - "straightforward" - ], - [ - "pre-de", - "pre-defined" - ], - [ - "des", - "described" - ], - [ - "colon", - "coloncolon" - ], - [ - "rel", - "relations" - ], - [ - "comm", - "communication" - ], - [ - "corrspon", - "correspondences" - ], - [ - "equi", - "equivalences" - ], - [ - "constru", - "constructors" - ], - [ - "stu", - "structured" - ], - [ - "bro", - "broadcast" - ], - [ - "clos", - "closeendpoint" - ], - [ - "conn", - "connected" - ], - [ - "marg", - "margin-bottom" - ], - [ - "margin", - "margin-right" - ], - [ - "margi", - "margin-left" - ], - [ - "mar", - "margin-top" - ], - [ - "ba", - "background-color" - ], - [ - "back", - "background-color" - ], - [ - "even", - "events〔variable〕" - ], - [ - "mail", - "mailboxes" - ], - [ - "updateMail", - "updateSvgMailboxLinks" - ], - [ - "selec", - "selectAll" - ], - [ - "endpoin", - "endpoints" - ], - [ - "select", - "selection〔variable〕" - ], - [ - "Sess", - "SessionRecorder" - ], - [ - "Se", - "SessionEvent" - ], - [ - "Ses", - "SessionRecorderWorker" - ], - [ - "cons", - "constructor" - ], - [ - "close", - "close_as_leader" - ], - [ - "Les", - "LessThan" - ], - [ - "Gre", - "GreaterThanEquals" - ], - [ - "n", - "n_items" - ], - [ - "G", - "GreaterThanEquals" - ], - [ - "setup", - "setup_x11" - ], - [ - "broker", - "brokeraddr〔variable〕" - ], - [ - "brok", - "brokeraddr" - ], - [ - "print", - "print_delim" - ], - [ - "Path", - "PathParam" - ], - [ - "jo", - "jobPoolSize" - ], - [ - "transf", - "transfer_state" - ], - [ - "regis", - "registerMapper" - ], - [ - "APOLLO_", - "APOLLO_URL" - ], - [ - "APOLLO", - "APOLLO_VER" - ], - [ - "PRO", - "PROTOBUF_CPP" - ], - [ - "clearT", - "clearInterval〔function〕" - ], - [ - "clear", - "clearTimeout〔function〕" - ], - [ - "reset", - "reset_timer" - ], - [ - "send", - "send_within_session" - ], - [ - "vo", - "votedfor" - ], - [ - "multi", - "multiplier〔variable〕" - ], - [ - "Nested", - "NestedProd" - ], - [ - "ann", - "announce" - ], - [ - "on_", - "on_match" - ], - [ - "worker", - "worker.onmessage" - ], - [ - "gener", - "generalization" - ], - [ - "endo", - "endomorphism" - ], - [ - "ult", - "ultrafilter" - ], - [ - "ultra", - "ultrafilters" - ], - [ - "cut", - "cut-elimination" - ], - [ - "con", - "containsHelper" - ], - [ - "pretty_s0", - "pretty_s0tring" - ], - [ - "pretty_i", - "pretty_d0eclist" - ], - [ - "pretty_d0", - "pretty_d0eclist" - ], - [ - "pretty_e", - "pretty_d0eclist" - ], - [ - "displays", - "displayStr" - ], - [ - "besideSof", - "besideSoftbreak" - ], - [ - "rbra", - "rbracket" - ], - [ - "lbra", - "lbrace" - ], - [ - "fix", - "fix-point" - ], - [ - "deadlock", - "deadlock-freeness" - ], - [ - "dead", - "deadlock-freeness" - ], - [ - "intui", - "intuitionistic" - ], - [ - "form", - "formalization" - ], - [ - "deque", - "dequeuing" - ], - [ - "strai", - "straitforwardly" - ], - [ - "read", - "read〔function〕" - ], - [ - "readlin", - "readlines〔function〕" - ] - ] - }, - "buffers": - [ - { - "file": "node2/util.js", - "settings": - { - "buffer_size": 1413, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "node2/collection.js", - "settings": - { - "buffer_size": 4049, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "node2/msg.js", - "settings": - { - "buffer_size": 1259, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "node2/session.js", - "settings": - { - "buffer_size": 2306, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "rtsession.sats", - "settings": - { - "buffer_size": 1070, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "rt.sats", - "settings": - { - "buffer_size": 1138, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "libsession.sats", - "settings": - { - "buffer_size": 4098, - "line_ending": "Unix" - } - }, - { - "file": "node2/transport.js", - "settings": - { - "buffer_size": 2284, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "node2/test.js", - "settings": - { - "buffer_size": 9717, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "node2/endpoint.js", - "settings": - { - "buffer_size": 16914, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "node2/recorder.js", - "settings": - { - "buffer_size": 1651, - "encoding": "UTF-8", - "line_ending": "Unix" - } - }, - { - "file": "node2/renderer.js", - "settings": - { - "buffer_size": 4016, - "encoding": "UTF-8", - "line_ending": "Unix" - } - } - ], - "build_system": "Packages/User/ats.sublime-build", - "build_system_choices": - [ - [ - [ - [ - "Packages/Haskell/Haskell.sublime-build", - "" - ], - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ] - ], - [ - "Packages/Haskell/Haskell.sublime-build", - "" - ] - ], - [ - [ - [ - "Packages/Makefile/Make.sublime-build", - "" - ], - [ - "Packages/Makefile/Make.sublime-build", - "Clean" - ], - [ - "Packages/JSLint/JSLint.sublime-build", - "" - ], - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ] - ], - [ - "Packages/JSLint/JSLint.sublime-build", - "" - ] - ], - [ - [ - [ - "Packages/Makefile/Make.sublime-build", - "" - ], - [ - "Packages/Makefile/Make.sublime-build", - "Clean" - ], - [ - "Packages/JSLint/JSLint.sublime-build", - "" - ], - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ], - [ - "Packages/User/ats.sublime-build", - "Compile to C" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ] - ], - [ - [ - [ - "Packages/Makefile/Make.sublime-build", - "" - ], - [ - "Packages/Makefile/Make.sublime-build", - "Clean" - ], - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ], - [ - "Packages/User/ats.sublime-build", - "Compile to C" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ] - ], - [ - [ - [ - "Packages/Python/Python.sublime-build", - "" - ], - [ - "Packages/Python/Python.sublime-build", - "Syntax Check" - ], - [ - "Packages/Python 3/Python3.sublime-build", - "" - ], - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ] - ], - [ - "Packages/Python 3/Python3.sublime-build", - "" - ] - ], - [ - [ - [ - "Packages/Python/Python.sublime-build", - "" - ], - [ - "Packages/Python/Python.sublime-build", - "Syntax Check" - ], - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ] - ], - [ - "Packages/Python/Python.sublime-build", - "" - ] - ], - [ - [ - [ - "Packages/Python/Python.sublime-build", - "" - ], - [ - "Packages/Python/Python.sublime-build", - "Syntax Check" - ], - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ], - [ - "Packages/User/Python 3.sublime-build", - "" - ] - ], - [ - "Packages/User/Python 3.sublime-build", - "" - ] - ], - [ - [ - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "" - ] - ], - [ - "Packages/User/ats.sublime-build", - "" - ] - ], - [ - [ - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ] - ], - [ - [ - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ], - [ - "Packages/User/ats.sublime-build", - "Compile to C" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ] - ], - [ - [ - [ - "Packages/SublimeREPL/sublimerepl_build_system_hack.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Checking" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Type Checking" - ] - ], - [ - [ - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Type Check" - ] - ], - [ - [ - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Checking" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ] - ], - [ - [ - [ - "Packages/User/ats.sublime-build", - "" - ], - [ - "Packages/User/ats.sublime-build", - "Type Checking" - ], - [ - "Packages/User/ats.sublime-build", - "Compile with GC" - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ] - ], - [ - "Packages/User/ats.sublime-build", - "Make" - ] - ] - ], - "build_varint": "Type Check", - "command_palette": - { - "height": 345.0, - "last_filter": "", - "selected_items": - [ - [ - "jslint", - "JSLint" - ], - [ - "lint", - "JSLint" - ], - [ - "setting", - "Preferences: Settings" - ], - [ - "insta", - "Package Control: Install Package" - ], - [ - "ali", - "AlignTab: Live Preview Mode" - ], - [ - "ats", - "Set Syntax: ATS" - ], - [ - "extende", - "Set Syntax: Markdown Extended" - ], - [ - "high vio", - "BracketHighlighter: Toggle High Visibility Mode" - ], - [ - "removep", - "Package Control: Remove Package" - ], - [ - "package", - "Package Control: Remove Package" - ], - [ - "markdownexten", - "Set Syntax: Markdown Extended" - ], - [ - "syntaxmarkdown", - "Set Syntax: Markdown Extended" - ], - [ - "spac", - "Indentation: Convert to Spaces" - ], - [ - "late", - "Set Syntax: LaTeX" - ], - [ - "space", - "Indentation: Convert to Spaces" - ], - [ - "tex", - "Set Syntax: LaTeX" - ], - [ - "latex", - "Set Syntax: LaTeX" - ], - [ - "colorsche", - "UI: Select Color Scheme" - ], - [ - "install", - "Package Control: Install Package" - ], - [ - "matlab", - "Set Syntax: MATLAB" - ], - [ - "python", - "Set Syntax: Python3" - ], - [ - "alig", - "AlignTab: Live Preview Mode" - ], - [ - "", - "AlignTab: Live Preview Mode" - ], - [ - "wrap", - "Word Wrap: Toggle" - ], - [ - "align", - "AlignTab: Live Preview Mode" - ], - [ - "formatasj", - "CodeFormatter: Format as Javascript Syntax" - ], - [ - "fo", - "CodeFormatter: Format as Javascript Syntax" - ], - [ - "format as", - "CodeFormatter: Format as Javascript Syntax" - ], - [ - "format", - "CodeFormatter: Format Code" - ], - [ - "upgra", - "Package Control: Upgrade Package" - ], - [ - "upper", - "Convert Case: Upper Case" - ], - [ - "fmt", - "JSFMT: Format the current file" - ], - [ - "json", - "Set Syntax: JSON" - ], - [ - "javascrip", - "Set Syntax: JavaScript Next" - ], - [ - "sort", - "Sort Lines" - ], - [ - "c++", - "Set Syntax: C++" - ], - [ - "typech", - "Build With: ats - Type Check" - ], - [ - "repl", - "SublimeREPL: Python" - ], - [ - "pytho", - "Set Syntax: Python3" - ], - [ - "jsfm", - "JSFMT: Format the current file" - ], - [ - "javascipt", - "CodeFormatter: Format as Javascript Syntax" - ], - [ - "aligi", - "AlignTab: Live Preview Mode" - ], - [ - "typ", - "Build With: ats - Type Check" - ], - [ - "type", - "Build With: ats - Type Check" - ], - [ - "list", - "Package Control: List Packages" - ], - [ - "jsonto", - "Convert: JSON to CSON" - ], - [ - "cson", - "Convert: CSON to JSON" - ], - [ - "togcson", - "Convert: Toggle Object Notation (CSON⟷JSON)" - ], - [ - "upgrade", - "Package Control: Upgrade Package" - ], - [ - "instal", - "Package Control: Install Package" - ], - [ - "yamle", - "PackageDev: Convert to YAML and Rearrange Syntax Definition" - ], - [ - "yaml", - "Set Syntax: YAML" - ], - [ - "atomizer", - "Atomizr: Convert Atom to Sublime Text" - ], - [ - "in", - "Package Control: Install Package" - ], - [ - "te", - "Set Syntax: LaTeX" - ], - [ - "hask", - "Set Syntax: Haskell" - ], - [ - "java", - "Set Syntax: Java" - ], - [ - "tab", - "Indentation: Convert to Tabs" - ], - [ - "surround", - "Surround: delete surround" - ], - [ - "random", - "Random:Text" - ], - [ - "form", - "CodeFormatter: Format Code" - ], - [ - "com", - "CSV: Compact columns" - ], - [ - "justify", - "CSV: Justify columns" - ], - [ - "python3", - "Set Syntax: Python3" - ], - [ - "just", - "CSV: Justify columns" - ], - [ - "ju", - "CSV: Justify columns" - ], - [ - "compa", - "CSV: Compact columns" - ], - [ - "csv", - "CSV: Justify columns" - ], - [ - "delete", - "CSV: Delete column" - ], - [ - "install pa", - "Package Control: Install Package" - ], - [ - "bash", - "Set Syntax: Shell Script (Bash)" - ], - [ - "shell", - "SublimeREPL: Shell" - ], - [ - "markdown", - "Set Syntax: AcademicMarkdown" - ], - [ - "scala", - "Set Syntax: Scala" - ], - [ - "make", - "Set Syntax: Makefile" - ], - [ - "merge", - "Sublimerge: Show Changes Between Current and Remote..." - ], - [ - "haske", - "Set Syntax: Haskell" - ], - [ - "update", - "Package Control: Upgrade/Overwrite All Packages" - ], - [ - "jsfmt", - "JSFMT: Format the current file" - ], - [ - "al", - "AlignTab: Live Preview Mode" - ], - [ - "replcur", - "SublimeREPL: Python - RUN current file" - ], - [ - "replpy", - "SublimeREPL: Python" - ], - [ - "markdo", - "Set Syntax: Markdown Extended" - ], - [ - "pandoc", - "Pandoc" - ], - [ - "ma", - "Set Syntax: Markdown GFM" - ], - [ - "docker", - "Set Syntax: Dockerfile" - ], - [ - "reinde", - "Indentation: Reindent Lines" - ], - [ - "ruby", - "Set Syntax: Ruby" - ], - [ - "compi", - "Coffee: Compile File" - ], - [ - "cofeescript", - "Set Syntax: CoffeeScript" - ], - [ - "coffeescr", - "Set Syntax: CoffeeScript (Literate)" - ], - [ - "coffee", - "Set Syntax: CoffeeScript" - ], - [ - "randomte", - "Random:Text" - ], - [ - "lisp", - "Set Syntax: Lisp" - ], - [ - "ins", - "Package Control: Install Package" - ], - [ - "user", - "Preferences: Settings - User" - ], - [ - "instl", - "Package Control: Install Package" - ], - [ - "awk", - "Set Syntax: AWK" - ], - [ - "sor", - "Sort Lines" - ], - [ - "close", - "Project: Close" - ], - [ - "add", - "Project: Add Folder" - ], - [ - "comple", - "PackageDev: New Completions File" - ], - [ - "syntaxc", - "Set Syntax: C" - ], - [ - "syntax c", - "Set Syntax: C" - ], - [ - "up", - "Package Control: Upgrade Package" - ], - [ - "convert", - "PackageDev: Convert (YAML, JSON, PList) to…" - ], - [ - "aaa", - "Package Control: Add Repository" - ], - [ - "upgr", - "Package Control: Upgrade Package" - ], - [ - "pack", - "Package Control: Upgrade Package" - ], - [ - "acd", - "Set Syntax: AcademicMarkdown" - ], - [ - "markdow", - "Set Syntax: AcademicMarkdown" - ], - [ - "fortmat", - "CodeFormatter: Format as CSS Syntax" - ], - [ - "pando", - "Pandoc" - ], - [ - "pand", - "Pandoc" - ], - [ - "aca", - "Set Syntax: AcademicMarkdown" - ], - [ - "forma", - "CodeFormatter: Format Code" - ], - [ - "fotm", - "JSFMT: Format the current file" - ], - [ - "emma", - "Emmet: Wrap With Abbreviation" - ], - [ - "emmet", - "Emmet: Rename Tag" - ], - [ - "for", - "CodeFormatter: Format as CSS Syntax" - ], - [ - "liqu", - "Set Syntax: HTML Liquid" - ], - [ - "html", - "HTML: Encode Special Characters" - ], - [ - "acdemi", - "Set Syntax: AcademicMarkdown" - ], - [ - "scss", - "Set Syntax: SCSS" - ], - [ - "erlan", - "Set Syntax: Erlang" - ], - [ - "erlang", - "Set Syntax: Erlang" - ], - [ - "alitn", - "AlignTab: Live Preview Mode" - ], - [ - "low", - "Convert Case: Lower Case" - ] - ], - "width": 528.0 - }, - "console": - { - "height": 282.0, - "history": - [ - "pwd", - "asd", - "clean", - "clear", - "import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)" - ] - }, - "distraction_free": - { - "menu_visible": true, - "show_minimap": false, - "show_open_files": false, - "show_tabs": false, - "side_bar_visible": false, - "status_bar_visible": false - }, - "expanded_folders": - [ - "/Users/hwwu/Git/ats-sessions", - "/Users/hwwu/Git/ats-sessions/node2" - ], - "file_history": - [ - "/Users/hwwu/Library/Application Support/Sublime Text 3/Packages/JSLint/JSLint.sublime-settings", - "/Users/hwwu/Git/ats-sessions/node2/transport.js", - "/Users/hwwu/Git/ats-sessions/node2/log", - "/Users/hwwu/Git/ats-sessions/node2/test.js", - "/Users/hwwu/Git/ats-sessions/node2/collection.js", - "/Users/hwwu/Git/ats-sessions/node2/msg.js", - "/Users/hwwu/Downloads/nonwindows-2/client2.conf", - "/Users/hwwu/Downloads/openvpn-2/51 Glen.ovpn", - "/Users/hwwu/Downloads/openvpn-3/VPNConfig.ovpn", - "/Users/hwwu/Downloads/openvpn-2/VPNConfig.ovpn", - "/Users/hwwu/Downloads/openvpn/51 Glen.ovpn", - "/Users/hwwu/Git/ats-sessions/node/renderer.js", - "/Users/hwwu/Git/ats-sessions/node/endpoint.js", - "/Users/hwwu/Git/ats-sessions/node2/util.js", - "/Users/hwwu/Git/ats-sessions/node2/session.js", - "/Users/hwwu/Git/ats-sessions/node/util.js", - "/Users/hwwu/Git/ats-sessions/node2/node_modules/nanomsg/lib/index.js", - "/Users/hwwu/Git/ats-sessions/node/socket.js", - "/Users/hwwu/Git/ats-sessions/ats/Makefile", - "/Users/hwwu/Git/ats-sessions/ats/uuid.dats", - "/Users/hwwu/Git/ats-sessions/ats/transport.dats", - "/Users/hwwu/Git/ats-sessions/ats/thread.dats", - "/Users/hwwu/Git/ats-sessions/ats/main.dats", - "/Users/hwwu/Git/ats-sessions/ats/endpoint.dats", - "/Users/hwwu/Git/ats-sessions/ats/transport.sats", - "/Users/hwwu/Git/ats-sessions/ats/thread.sats", - "/Users/hwwu/Git/ats-sessions/ats/test.c", - "/Users/hwwu/Git/ats-sessions/ats/json.sats", - "/Users/hwwu/Git/ats-sessions/ats/endpoint.sats", - "/Users/hwwu/Git/ats-sessions/thread.sats", - "/Users/hwwu/Git/ats-sessions/ats/uuid.sats", - "/Users/hwwu/Git/ats-sessions/ats/uuid_dats.c", - "/Users/hwwu/Git/ats-sessions/ats/thread_dats.c", - "/usr/include/uuid/uuid.h", - "/Users/hwwu/Git/ats-sessions/ats/transport_dats.c", - "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/valgrind.rb", - "/usr/include/sys/_types.h", - "/usr/include/sys/_types/_uuid_t.h", - "/usr/local/include/zuuid.h", - "/Users/hwwu/Git/ats-sessions/ats/main_dats.c", - "/Users/hwwu/Git/ats-sessions/ats/json.dats", - "/Users/hwwu/Git/ats-sessions/node/node_modules/nanomsg/deps/nanomsg/src/devices/device.h", - "/Users/hwwu/Git/ats-sessions/python/transport.py", - "/Users/hwwu/Git/ats-sessions/node/node_modules/nanomsg/deps/nanomsg/src/devices/device.c", - "/Users/hwwu/Git/ats-sessions/constraints", - "/Users/hwwu/Git/ats-sessions/c/transport.h", - "/Users/hwwu/Git/ats-sessions/rtsession.sats", - "/Users/hwwu/Git/ats-sessions/python/redis_transport.py", - "/Users/hwwu/Git/ats-sessions/Makefile", - "/Users/hwwu/Git/ats-sessions/libsession.sats", - "/Users/hwwu/Git/ats-sessions/test_bitcoinpayment.dats", - "/Users/hwwu/Git/ats-sessions/c/msg.h", - "/Users/hwwu/Git/ats-sessions/python/msg.py", - "/Users/hwwu/Git/ats-sessions/python/endpoint.py", - "/Users/hwwu/Git/ats-sessions/python/broker.py", - "/Users/hwwu/Git/ats-sessions/python/test.py", - "/usr/local/lib/python3.6/site-packages/nanomsg/__init__.py", - "/Users/hwwu/Git/ats-sessions/rtsession.dats", - "/Users/hwwu/Git/ats-sessions/c/utils.h", - "/Users/hwwu/Git/ats-sessions/endpoint.sats", - "/Users/hwwu/Git/ats-sessions/ats/roles.sats", - "/Users/hwwu/Git/ats-sessions/c/roles.h", - "/Users/hwwu/Git/ats-sessions/c/endpoint.h", - "/Users/hwwu/Git/ats-sessions/endpoint.dats", - "/Users/hwwu/Git/ats-sessions/endpoint_redis.dats", - "/Users/hwwu/Library/Application Support/Sublime Text 3/Packages/BracketHighlighter/bh_core.sublime-settings", - "/Users/hwwu/Library/Application Support/Sublime Text 3/Packages/User/bh_core.sublime-settings", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/30-simplesession.md", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/build/ex-simple-eq.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/div2thm.py", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/test.md", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/Makefile", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/build/preserve_comments.py", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/40-mtlcdep.md", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/before.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0typing.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0_prf_subst.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0_prf_subjectreduction.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0_prf_subjectreduction_terms.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0_prf_progress.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0red.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/20-mtlc0.md", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0_prf_progress_terms.tex", - "/Users/hwwu/Git/ats-postiats-release/my-travis-ci/install_contrib.sh", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlcsimplered.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0syntax.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0rho.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mrl.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/lmrl.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/lk.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/header.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlcsimplerho.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlcdepsyntax.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/abbrv.md", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/typography.md", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlcsimplesyntax.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/10-intro.md", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0_prf_uniquedecomposition.tex", - "/Users/hwwu/Git/paper-jekyll-theme/_config.yml", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/include/mtlc0_prf_subjectreduction.tex.md", - "/Users/hwwu/Git/research-notes/2017-01-CONCUR2017/include/mtlc0syntax.tex", - "/Users/hwwu/Git/ats-session-playground/dependent/tests/teststub.dats", - "/Users/hwwu/Git/ats-session-playground/dependent/tests/simple.dats", - "/Users/hwwu/Git/ats-session-playground/dependent/tests/poly.dats", - "/Users/hwwu/Git/ats-session-playground/dependent/tests/dep_testeq.dats", - "/Users/hwwu/Git/ats-sessions/set.smt2", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/01-intro.md", - "/Users/hwwu/Git/ats-sessions/test_typechecking.dats", - "/Users/hwwu/Library/Group Containers/2E337YPCZY.airmail/Library/Application Support/it.bloop.airmail2/Airmail/steinwaywhw@gmail.com_1/AttachmentsNg/CAAfXiEnfhmwMk6XWU2R+UrtTeonO=7pVeCSF+NH9gt6_uSFkAg@mail.gmail.com/contours2ucm.m", - "/Users/hwwu/Git/ats-postiats-release/my-travis-ci/build_docker.sh", - "/Users/hwwu/Git/ats-postiats-release/my-travis-ci/Dockerfile", - "/Users/hwwu/Git/docker-ats-base/install.sh", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/main.md", - "/Users/hwwu/Git/pandoc-templates/bu_ece_thesis/bu_ece_thesis.pandoc-template", - "/Users/hwwu/Git/research-notes/2017-08-LC2017-Talk/cut.tex", - "/Users/hwwu/Git/research-notes/2017-08-LC2017-Talk/Makefile", - "/Users/hwwu/Git/research-notes/2017-08-LC2017-Talk/intuitions.tex", - "/Users/hwwu/Git/pandoc-templates/bu_ece_thesis/build/before.tex", - "/Users/hwwu/Git/research-notes/2018-03-Thesis/build/submission.tex", - "/Users/hwwu/Git/ats-sessions/set.sats", - "/Users/hwwu/Git/ats-sessions/session.dats", - "/Users/hwwu/Git/ats-session-playground/multiparty/session.dats", - "/Users/hwwu/Git/ats-session-playground/multiparty/test.beam", - "/Users/hwwu/Git/ats-session-playground/multiparty/session.erl", - "/Users/hwwu/Git/ats-learn-some-logics/multirole/set.smt", - "/Users/hwwu/Git/ats-session-playground/multiparty/Makefile", - "/Users/hwwu/Git/ats-session-playground/multiparty/session_dats.c", - "/Users/hwwu/Git/ats-session-playground/multiparty/app/lib/session.erl" - ], - "find": - { - "height": 54.0 - }, - "find_in_files": - { - "height": 139.0, - "where_history": - [ - ] - }, - "find_state": - { - "case_sensitive": false, - "find_history": - [ - "rtdata", - "rttype", - "table", - "commit", - "yes", - "link.payload.roles", - "committed", - "vote", - "receive", - "cancel", - "console.log", - "here", - "decodeMsg", - "s.ep.", - "s", - "link", - "ping", - "\t\trecorder.log(this)", - "recorder.log", - "current", - "record", - "new Msg", - "role", - "this", - "s.sync", - "new Msg('msg', [", - "Endpoint", - "committed", - "yes", - "link", - "child.peers.uniqueValues()", - "vote", - "Vote", - "vote", - "sender", - "vote", - "Session", - "trans", - "roles", - "layer", - "full", - "root", - "vote", - "encodeMsg", - "vote", - "Endpoint", - "ep2", - "ep1", - "layer", - "uniqueValues", - "full", - "layer", - "node", - "keep", - "uniquevalues", - "responses", - "build_condition", - " 'msg/session1/", - " ... 1 more item ] │", - " 'go/session1'", - "as root", - "as node", - "ep2", - "epb", - "[1,2,3]", - "epb", - "console.log", - "map", - "link finished", - "encode", - "isempty", - "this.buffer", - "push(msg)", - "msg", - "newroles", - "full", - "keep", - "this", - "commit", - "vote", - "toJSON()", - "_receive", - "encode", - "reply", - "vote?", - "req", - "vote?", - "recorder", - "json.stringify", - "addClass", - "\"", - "ep", - "link", - "empty", - "vote.sender", - "req", - "uniquevalues", - "peers", - "responses", - "linkaccept", - "linkrequest", - "vote", - "isSubsetOf", - "linkaccept", - "accmsg", - "var", - "reqside", - "accside", - "respondents.has", - "_send", - "isoutofsession", - "map", - "accept", - "request", - "accept", - "const", - "_receive", - "accept", - "req", - "linkrequests", - "keep.", - "empty", - "requesterside", - "accptorside", - "forward", - ".get(0)", - "[0]", - "Set.minus(full, keep.roles)" - ], - "highlight": false, - "in_selection": false, - "preserve_case": false, - "regex": false, - "replace_history": - [ - ], - "reverse": false, - "show_context": true, - "use_buffer2": true, - "whole_word": false, - "wrap": true - }, - "groups": - [ - { - "selected": 5, - "sheets": - [ - { - "buffer": 0, - "file": "node2/util.js", - "semi_transient": false, - "settings": - { - "buffer_size": 1413, - "regions": - { - }, - "selection": - [ - [ - 591, - 591 - ] - ], - "settings": - { - "WordCount": - { - "changes": 0, - "count": 118, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 1389, - 1390 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 590, - 591 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content" - ], - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 1389, - 1390 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 590, - 591 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "stack_index": 10, - "type": "text" - }, - { - "buffer": 1, - "file": "node2/collection.js", - "semi_transient": false, - "settings": - { - "buffer_size": 4049, - "regions": - { - }, - "selection": - [ - [ - 1095, - 1095 - ] - ], - "settings": - { - "WordCount": - { - "changes": 0, - "count": 271, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 1187, - 1188 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 1159, - 1160 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content" - ], - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 1096, - 1097 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 1024, - 1025 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 188.0, - "zoom_level": 1.0 - }, - "stack_index": 8, - "type": "text" - }, - { - "buffer": 2, - "file": "node2/msg.js", - "semi_transient": false, - "settings": - { - "buffer_size": 1259, - "regions": - { - }, - "selection": - [ - [ - 748, - 748 - ] - ], - "settings": - { - "WordCount": - { - "changes": 0, - "count": 69, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 1236, - 1237 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 24, - 25 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content" - ], - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 1236, - 1237 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 24, - 25 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "tab_size": 4, - "translate_tabs_to_spaces": true - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "stack_index": 5, - "type": "text" - }, - { - "buffer": 3, - "file": "node2/session.js", - "semi_transient": false, - "settings": - { - "buffer_size": 2306, - "regions": - { - }, - "selection": - [ - [ - 1520, - 1520 - ] - ], - "settings": - { - "WordCount": - { - "changes": 0, - "count": 102, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": 112, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 1626, - 1627 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 1251, - 1252 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "bracket_highlighter.locations": - { - "close": - { - }, - "icon": - { - }, - "open": - { - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 536.0, - "zoom_level": 1.0 - }, - "stack_index": 3, - "type": "text" - }, - { - "buffer": 4, - "file": "rtsession.sats", - "semi_transient": false, - "settings": - { - "buffer_size": 1070, - "regions": - { - }, - "selection": - [ - [ - 7, - 7 - ] - ], - "settings": - { - "WordCount": - { - "changes": 27, - "count": 99, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - }, - "icon": - { - }, - "open": - { - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "bracket_highlighter.locations": - { - "close": - { - }, - "icon": - { - }, - "open": - { - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/ATS Syntax Highlight/ats.tmLanguage" - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "stack_index": 2, - "type": "text" - }, - { - "buffer": 5, - "file": "rt.sats", - "semi_transient": false, - "settings": - { - "buffer_size": 1138, - "regions": - { - }, - "selection": - [ - [ - 290, - 290 - ] - ], - "settings": - { - "WordCount": - { - "changes": 1793, - "count": 128, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_name": "", - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - }, - "icon": - { - }, - "open": - { - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "bracket_highlighter.locations": - { - "close": - { - }, - "icon": - { - }, - "open": - { - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "syntax": "Packages/ATS Syntax Highlight/ats.tmLanguage" - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "stack_index": 0, - "type": "text" - }, - { - "buffer": 6, - "file": "libsession.sats", - "semi_transient": true, - "settings": - { - "buffer_size": 4098, - "regions": - { - }, - "selection": - [ - [ - 0, - 0 - ] - ], - "settings": - { - "WordCount": - { - "changes": 0, - "count": 192, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": 130, - "bracket_highlighter.clone_locations": - { - "close": - { - }, - "icon": - { - }, - "open": - { - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "bracket_highlighter.locations": - { - "close": - { - }, - "icon": - { - }, - "open": - { - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/ATS Syntax Highlight/ats.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 448.0, - "zoom_level": 1.0 - }, - "stack_index": 1, - "type": "text" - }, - { - "buffer": 7, - "file": "node2/transport.js", - "semi_transient": false, - "settings": - { - "buffer_size": 2284, - "regions": - { - }, - "selection": - [ - [ - 1710, - 1710 - ] - ], - "settings": - { - "WordCount": - { - "changes": 0, - "count": 88, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 1709, - 1710 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/round_bracket.png", - "region.yellowish" - ] - }, - "open": - { - "1": - [ - 1697, - 1698 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 1709, - 1710 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/round_bracket.png", - "region.yellowish" - ] - }, - "open": - { - "1": - [ - 1697, - 1698 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 1416.0, - "zoom_level": 1.0 - }, - "stack_index": 6, - "type": "text" - } - ] - }, - { - "selected": 0, - "sheets": - [ - { - "buffer": 8, - "file": "node2/test.js", - "semi_transient": false, - "settings": - { - "buffer_size": 9717, - "regions": - { - }, - "selection": - [ - [ - 8567, - 8567 - ] - ], - "settings": - { - "WordCount": - { - "changes": 0, - "count": 560, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 8520, - 8521 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/round_bracket.png", - "region.yellowish" - ] - }, - "open": - { - "1": - [ - 8499, - 8500 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content" - ], - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 8566, - 8567 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/round_bracket.png", - "region.yellowish" - ] - }, - "open": - { - "1": - [ - 8562, - 8563 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 5448.0, - "zoom_level": 1.0 - }, - "stack_index": 4, - "type": "text" - }, - { - "buffer": 9, - "file": "node2/endpoint.js", - "semi_transient": false, - "settings": - { - "buffer_size": 16914, - "regions": - { - }, - "selection": - [ - [ - 12735, - 12735 - ] - ], - "settings": - { - "WordCount": - { - "changes": 1404, - "count": 923, - "modified": false, - "selection": false, - "status": -1, - "syntax": "plain text" - }, - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 12878, - 12879 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 10720, - 10721 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 12735, - 12736 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/round_bracket.png", - "region.yellowish" - ] - }, - "open": - { - "1": - [ - 12720, - 12721 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 6681.0, - "zoom_level": 1.0 - }, - "stack_index": 7, - "type": "text" - }, - { - "buffer": 10, - "file": "node2/recorder.js", - "semi_transient": false, - "settings": - { - "buffer_size": 1651, - "regions": - { - }, - "selection": - [ - [ - 1210, - 1210 - ] - ], - "settings": - { - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.clone_locations": - { - "close": - { - "1": - [ - 1479, - 1480 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 1196, - 1197 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.clone_regions": - [ - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content" - ], - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 1482, - 1483 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/curly_bracket.png", - "region.purplish" - ] - }, - "open": - { - "1": - [ - 1196, - 1197 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "stack_index": 9, - "type": "text" - }, - { - "buffer": 11, - "file": "node2/renderer.js", - "semi_transient": false, - "settings": - { - "buffer_size": 4016, - "regions": - { - }, - "selection": - [ - [ - 218, - 218 - ] - ], - "settings": - { - "auto_complete": false, - "bracket_highlighter.busy": false, - "bracket_highlighter.clone": -1, - "bracket_highlighter.locations": - { - "close": - { - "1": - [ - 217, - 218 - ] - }, - "icon": - { - "1": - [ - "Packages/BracketHighlighter/icons/round_bracket.png", - "region.yellowish" - ] - }, - "open": - { - "1": - [ - 216, - 217 - ] - }, - "unmatched": - { - } - }, - "bracket_highlighter.regions": - [ - "bh_curly", - "bh_curly_center", - "bh_curly_open", - "bh_curly_close", - "bh_curly_content", - "bh_single_quote", - "bh_single_quote_center", - "bh_single_quote_open", - "bh_single_quote_close", - "bh_single_quote_content", - "bh_unmatched", - "bh_unmatched_center", - "bh_unmatched_open", - "bh_unmatched_close", - "bh_unmatched_content", - "bh_c_define", - "bh_c_define_center", - "bh_c_define_open", - "bh_c_define_close", - "bh_c_define_content", - "bh_tag", - "bh_tag_center", - "bh_tag_open", - "bh_tag_close", - "bh_tag_content", - "bh_double_quote", - "bh_double_quote_center", - "bh_double_quote_open", - "bh_double_quote_close", - "bh_double_quote_content", - "bh_regex", - "bh_regex_center", - "bh_regex_open", - "bh_regex_close", - "bh_regex_content", - "bh_round", - "bh_round_center", - "bh_round_open", - "bh_round_close", - "bh_round_content", - "bh_angle", - "bh_angle_center", - "bh_angle_open", - "bh_angle_close", - "bh_angle_content", - "bh_default", - "bh_default_center", - "bh_default_open", - "bh_default_close", - "bh_default_content", - "bh_square", - "bh_square_center", - "bh_square_open", - "bh_square_close", - "bh_square_content" - ], - "git_gutter_is_enabled": true, - "incomplete_sync": null, - "remote_loading": false, - "synced": false, - "syntax": "Packages/JavaScriptNext - ES6 Syntax/JavaScriptNext.tmLanguage", - "tab_size": 4, - "translate_tabs_to_spaces": true - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "stack_index": 11, - "type": "text" - } - ] - } - ], - "incremental_find": - { - "height": 27.0 - }, - "input": - { - "height": 71.0 - }, - "layout": - { - "cells": - [ - [ - 0, - 0, - 1, - 1 - ], - [ - 1, - 0, - 2, - 1 - ] - ], - "cols": - [ - 0.0, - 0.498893821023, - 1.0 - ], - "rows": - [ - 0.0, - 1.0 - ] - }, - "menu_visible": true, - "output.astyle_error_message": - { - "height": 0.0 - }, - "output.exec": - { - "height": 295.0 - }, - "output.find_results": - { - "height": 0.0 - }, - "output.mdpopups": - { - "height": 0.0 - }, - "output.package_dev": - { - "height": 122.0 - }, - "output.sftp": - { - "height": 110.0 - }, - "pinned_build_system": "", - "project": "ats-sessions.sublime-project", - "replace": - { - "height": 50.0 - }, - "save_all_on_build": true, - "select_file": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - [ - "transportjs", - "ats-sessions/node2/transport.js" - ], - [ - "test.js", - "ats-sessions/node2/test.js" - ], - [ - "msg.js", - "ats-sessions/node2/msg.js" - ], - [ - "collection", - "ats-sessions/node2/collection.js" - ], - [ - "session.js", - "ats-sessions/node2/session.js" - ], - [ - "log", - "ats-sessions/node2/log" - ], - [ - "renderer", - "ats-sessions/node/renderer.js" - ], - [ - "util.js", - "ats-sessions/node2/util.js" - ], - [ - "mailbox.js", - "ats-sessions/node/mailbox.js" - ], - [ - "node2util", - "ats-sessions/node2/util.js" - ], - [ - "transport.js", - "ats-sessions/node2/transport.js" - ], - [ - "collection.js", - "ats-sessions/node2/collection.js" - ], - [ - "endpoint.js", - "ats-sessions/node/endpoint.js" - ], - [ - "node2 utils", - "ats-sessions/node2/util.js" - ], - [ - "socket.js", - "ats-sessions/node/socket.js" - ], - [ - "thread.sats", - "ats-sessions/ats/thread.sats" - ], - [ - "thread", - "ats-sessions/thread.sats" - ], - [ - "json.sats", - "ats-sessions/ats/json.sats" - ], - [ - "uuid.dats", - "ats-sessions/ats/uuid.dats" - ], - [ - "device.h", - "ats-sessions/node/node_modules/nanomsg/deps/nanomsg/src/devices/device.h" - ], - [ - "device.c", - "ats-sessions/node/node_modules/nanomsg/deps/nanomsg/src/devices/device.c" - ], - [ - "transportpy", - "ats-sessions/python/transport.py" - ], - [ - "test.py", - "ats-sessions/python/test.py" - ], - [ - "redis", - "ats-sessions/python/redis_transport.py" - ], - [ - "20", - "20-mtlc0.md" - ], - [ - "30", - "30-simplesession.md" - ], - [ - "header", - "include/header.tex" - ], - [ - "50", - "50-mtlcmult.md" - ], - [ - "submisstex", - "build/submission.tex" - ], - [ - "eg", - "include/eg-simple-1.tex" - ], - [ - "simplered", - "include/mtlcsimplered.tex" - ], - [ - "be", - "include/before.tex" - ], - [ - "", - "include/eg-simple-1.tex" - ], - [ - "bef", - "include/before.tex" - ], - [ - "head", - "include/header.tex" - ], - [ - "before", - "include/before.tex" - ], - [ - "hea", - "include/header.tex" - ], - [ - "e", - "include/eg-simple-eq.tex" - ], - [ - "ex", - "include/eg-simple-eq.tex" - ], - [ - "div", - "include/div2thm.py" - ], - [ - "test", - "include/test.md" - ], - [ - "testmd", - "build/test.md" - ], - [ - "pres", - "build/preserve_comments.py" - ], - [ - "mtlc", - "20-mtlc0.md" - ], - [ - "mtlcsimplered", - "include/mtlcsimplered.tex" - ], - [ - "mtlcsim", - "include/mtlcsimplesyntax.tex" - ], - [ - "mtlc0", - "include/mtlc0typing.tex" - ], - [ - "mtlcred", - "include/mtlc0red.tex" - ], - [ - "red", - "include/mtlc0red.tex" - ], - [ - "mtlc0sy", - "include/mtlc0syntax.tex" - ], - [ - "mtlc0synt", - "build/mtlc0syntax.tex" - ], - [ - "ab", - "abbrv.md" - ], - [ - "40", - "40-mtlcdep.md" - ], - [ - "10", - "10-intro.md" - ], - [ - "mtlc0syntax", - "include/mtlc0syntax.tex" - ], - [ - "pired", - "include/mtlcdeppired.tex" - ], - [ - "mtsimplet", - "include/mtlcsimplesyntax.tex" - ], - [ - "mtlcsimplesyn", - "include/mtlcsimplesyntax.tex" - ], - [ - "dep", - "include/mtlcdeppisyntax.tex" - ], - [ - "deppi", - "include/mtlcdeppisyntax.tex" - ], - [ - "deppisy", - "include/mtlcdeppisyntax.tex" - ], - [ - "deppisyn", - "include/mtlcdeppisyntax.tex" - ], - [ - "syntax", - "include/mtlcdeppisyntax.tex" - ], - [ - "mtlcsimplesyntax", - "include/mtlcsimplesyntax.tex" - ], - [ - "mtlc0red", - "include/mtlc0red.tex" - ], - [ - "rho", - "build/mtlc0rho.tex" - ], - [ - "before.t", - "include/before.tex" - ], - [ - "prfprogress", - "include/mtlc0_prf_progress.tex" - ], - [ - "mtlc0_prf_progress_terms", - "include/mtlc0_prf_progress_terms.tex" - ], - [ - "mtlc0prfsubjectreduction", - "include/mtlc0_prf_subjectreduction.tex" - ], - [ - "mtlc0_prf_subjectreduction_terms", - "include/mtlc0_prf_subjectreduction_terms.tex" - ], - [ - "mtlc0typing.tex", - "include/mtlc0typing.tex" - ], - [ - "20mt", - "research-notes/2018-03-Thesis/20-mtlc0.md" - ], - [ - "mtlc0typingtex", - "research-notes/2018-03-Thesis/include/mtlc0typing.tex" - ], - [ - "thesisbefore", - "research-notes/2018-03-Thesis/include/before.tex" - ], - [ - "thesisincludehead", - "research-notes/2018-03-Thesis/include/header.tex" - ], - [ - "thesisincludeheader", - "research-notes/2018-03-Thesis/include/header.tex" - ], - [ - "thesisinclumtlc0typingtex", - "research-notes/2018-03-Thesis/include/mtlc0typing.tex" - ], - [ - "subjectr", - "research-notes/2018-03-Thesis/include/mtlc0_prf_subjectreduction.tex" - ], - [ - "thesismtlc0rho", - "research-notes/2018-03-Thesis/include/mtlc0rho.tex" - ], - [ - "thesismtlc0syntax", - "research-notes/2018-03-Thesis/include/mtlc0syntax.tex" - ], - [ - "atssessionsconst", - "ats-sessions/constraints" - ], - [ - "releasemy-travis-ci/bui", - "ats-postiats-release/my-travis-ci/build_docker.sh" - ], - [ - "thesisinclumtlcdepsyntax", - "research-notes/2018-03-Thesis/include/mtlcdepsyntax.tex" - ], - [ - "thesisbefore.tex", - "research-notes/2018-03-Thesis/include/before.tex" - ], - [ - "libsession.sats", - "ats-sessions/libsession.sats" - ], - [ - "constraint", - "ats-sessions/constraints" - ], - [ - "set.sats", - "ats-sessions/set.sats" - ], - [ - "dependentsession", - "ats-session-playground/dependent/session.sats" - ], - [ - "set.smt2", - "ats-sessions/set.smt2" - ], - [ - "constraints", - "ats-sessions/constraints" - ], - [ - "simple.dats", - "ats-session-playground/dependent/tests/simple.dats" - ], - [ - "teststub", - "ats-session-playground/dependent/tests/teststub.dats" - ], - [ - "lmrl", - "research-notes/2017-05-01-Proposal/include/lmrl.tex" - ], - [ - "lmrl.tex", - "research-notes/2017-05-01-Proposal/include/lmrl.tex" - ], - [ - "proposalbefore", - "research-notes/2017-05-01-Proposal/include/before.tex" - ], - [ - "proposeheader", - "research-notes/2017-05-01-Proposal/include/header.tex" - ], - [ - "mtlcsimplesy", - "research-notes/2017-05-01-Proposal/include/mtlcsimplesyntax.tex" - ], - [ - "include/mtlcsimplesyntax", - "research-notes/2017-05-01-Proposal/include/mtlcsimplesyntax.tex" - ], - [ - "abbrv", - "research-notes/2017-05-01-Proposal/abbrv.md" - ], - [ - "mbox.js", - "ats-sessions/node/mailbox.js" - ], - [ - "sock.j", - "ats-sessions/node/socket.js" - ], - [ - "recorder.js", - "ats-sessions/node/recorder.js" - ], - [ - "renderer.js", - "ats-sessions/node/renderer.js" - ], - [ - "nanomsgindex.js", - "ats-sessions/node/node_modules/nanomsg/lib/index.js" - ], - [ - "nanomsg/lib/index.js", - "ats-sessions/node/node_modules/nanomsg/lib/index.js" - ], - [ - "mailboxjs", - "ats-sessions/node/mailbox.js" - ], - [ - "sock", - "ats-sessions/node/socket.js" - ], - [ - "visul", - "ats-sessions/node/visualizer.html" - ], - [ - "render", - "ats-sessions/node/renderer.js" - ], - [ - "index.js", - "ats-sessions/node/index.js" - ], - [ - "collections.js", - "ats-sessions/node/collections.js" - ], - [ - "recor", - "ats-sessions/node/recorder.js" - ], - [ - "mbox", - "ats-sessions/js/mbox.js" - ], - [ - "deparr", - "ats-session-playground/dependent/output/dep_array.dats" - ], - [ - "util.sh", - "Git/iseedocker/scripts/util.sh" - ], - [ - "python3", - "Git/ATS-Python3/LICENSE" - ], - [ - "test2datsc", - "Git/test2_dats.c" - ], - [ - "socket.sats", - "Git/ats-sessions/socket.sats" - ], - [ - "endpoint.dats", - "Git/ats-sessions/endpoint.dats" - ], - [ - "uuid.sats", - "Git/ats-sessions/uuid.sats" - ], - [ - "payload.", - "Git/ats-sessions/payload.sats" - ], - [ - "session.sats", - "Git/ats-sessions/session.sats" - ], - [ - "session.dats", - "Git/ats-sessions/session.dats" - ], - [ - "resume.tex", - "Git/resume/Resume.tex" - ], - [ - "asl.cls", - "Git/pandoc-templates/asl/asl.cls" - ], - [ - "aslpandocte", - "Git/pandoc-templates/asl/asl.pandoc-template" - ], - [ - "jslsubmission.tex", - "Git/research-notes/2017-09-JSL-Multirole/build/submission.tex" - ] - ], - "width": 0.0 - }, - "select_project": - { - "height": 500.0, - "last_filter": "thesis", - "selected_items": - [ - [ - "thesis", - "~/Git/research-notes/2018-03-Thesis/thesis.sublime-project" - ], - [ - "research", - "~/Git/research-notes/research.sublime-project" - ], - [ - "redis", - "~/Git/ats-redis/ats-redis.sublime-project" - ], - [ - "atssesspl", - "~/Git/ats-session-playground/ats-session-playground.sublime-project" - ], - [ - "sessionpl", - "~/Git/ats-session-playground/ats-session-playground.sublime-project" - ], - [ - "", - "~/Git/pandoc-templates/sigplanconf/sigplanconf.sublime-workspace" - ] - ], - "width": 380.0 - }, - "select_symbol": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "selected_group": 0, - "settings": - { - }, - "show_minimap": false, - "show_open_files": true, - "show_tabs": true, - "side_bar_visible": true, - "side_bar_width": 270.0, - "status_bar_visible": true, - "template_settings": - { - } -} diff --git a/blackboard.sats b/blackboard.sats deleted file mode 100644 index 3abee00..0000000 --- a/blackboard.sats +++ /dev/null @@ -1,17 +0,0 @@ -%{# -#include "./runtime.h" -%} - -absvtype board = ptr - -fun board_make (string): board = "mac#" -fun board_ref (!board): board = "mac#" -fun board_free (board): void = "mac#" - -//fun {} board_write (!board, msg): void -//fun {} board_read {a,b:set} (reader: set a, writer: set a, label: msglabel): msg -//fun {} board_connect (string): board -//fun {} do_board_write (!board, msg): void -//fun {} do_board_read {a,b:set} (reader: set a, writer: set a, label: msglabel): msg - - diff --git a/board.c b/board.c deleted file mode 100644 index daf315f..0000000 --- a/board.c +++ /dev/null @@ -1,373 +0,0 @@ -/** - * Blackboard. Please #include this file in runtime.c - */ - -struct board_t* board_make(const char* id) { - struct board_t* b = (struct board_t*)malloc(sizeof(struct board_t)); - pthread_mutex_init(&b->mutex, NULL); - pthread_cond_init(&b->cond, NULL); - b->queue = queue_make(); - strcpy(b->id, id); - b->refcount = 1; - - // Debug - g_boards[++g_bindex] = b; - return b; -} - -struct board_t* board_ref(struct board_t* b) { - b->refcount++; - return b; -} - -int board_free(struct board_t* b) { - b->refcount--; - assert(b->refcount >= 0); - - if (b->refcount > 0) return -1; - assert(b->refcount == 0); - - board_show(b); - pthread_mutex_destroy(&b->mutex); - pthread_cond_destroy(&b->cond); - - int i = 0; - while (b->queue->head != NULL) { - struct msg_t* e = (struct msg_t*)queue_deq(b->queue); - assert(e != NULL); - msg_free(e); - i++; - } - - int count = queue_free(b->queue); - assert(count == 0); - - log_info("Board %s @ %p freed with %d message(s).", b->id, (void*)b, i); - - for (int i = 0; i <= g_bindex; i++) { - if (g_boards[i] == b) g_boards[i] = NULL; - } - - free(b); - return i; -} - -void board_lock (struct board_t* board) { - pthread_mutex_lock(&board->mutex); - // log_warn("Board @ %p locked.", (void*)board); -} - -void board_unlock (struct board_t* board) { - pthread_mutex_unlock(&board->mutex); - // log_warn("Board @ %p unlocked.", (void*)board); -} - -PRIVATE struct search_env_t { - int index; // index of -1 - struct msg_t* from; // default to NULL - struct msg_t* pattern; - struct msg_t* found; -}; - -PRIVATE void search(int i, struct msg_t* cur , struct search_env_t* env) { - #define SETENV(_index, _found) {env->index=_index; env->found=_found;} - - // Already found, skip. - if (env->index >= 0) return; - - if (env->from != NULL) { - // Not yet the starting point. - if (cur != env->from) { - return; - } - - // Start from the next. - env->from = NULL; - return; - } - - if (cur->label == MSG_FWD_KEEP) { - // FWD_KEEP, set as found. - if (MSG_RECVER_MATCH(cur, env->pattern)) SETENV(i, cur); - - // Skip - return; - } - - // FWD_KILL, set as found. - if (cur->label == MSG_FWD_KILL) { - SETENV(i, cur); - return; - } - - if (MSG_MATCH(cur, env->pattern)) { - SETENV(i, cur); - - #ifndef NDEBUG - char buffer[50]; - int j = sprintf(buffer, "Searching for %s ", msg_show_label(env->pattern)); - j += msg_show_senders(env->pattern, buffer+j); - j += sprintf(buffer+j, " => "); - j += msg_show_receivers(env->pattern, buffer+j); - log_trace("%s Found! From = %p, index = %d, cur = %d", buffer, env->from, env->index, i); - #endif - } - - #ifndef NDEBUG - char buffer[50]; - int j = sprintf(buffer, "Searching for %s ", msg_show_label(env->pattern)); - j += msg_show_senders(env->pattern, buffer+j); - j += sprintf(buffer+j, " => "); - j += msg_show_receivers(env->pattern, buffer+j); - log_trace("%s FAILED! From = %p, index = %d, cur = %d", buffer, env->from, env->index, i); - #endif - - return; - - #undef SETENV -} - -/** - * Write to the blackboard. Write always succeeds, and no matter where the message - * actually goes, we always signal. - * - * @param b The board to write to. - * @param m The message. - * @return The board where the endpoint should be writing to/reading from. - */ -struct board_t* board_write(struct board_t* b, struct msg_t* m) { - - board_lock(b); - - if (b->queue->head == NULL || ((struct msg_t*)(b->queue->tail->payload))->label != MSG_FWD_KILL) { - queue_enq(b->queue, m); - msg_log(b, m, 1); - pthread_cond_broadcast(&b->cond); - board_unlock(b); - - // Write succeeds. Should continue to use the board. - return b; - } - - // Check the tail. - struct msg_t* last = (struct msg_t*)b->queue->tail->payload; - assert(last->label == MSG_FWD_KILL); - - board_unlock(b); - - struct board_t* child = (struct board_t*)last->payload; - log_trace("Saw KILL in %s. Writing again to %s", b->id, child->id); - struct board_t* grandchild = board_write(child, m); - - board_lock(b); - assert(b->queue->head != NULL); - - // If KILL is the only message left. - if (b->queue->head == b->queue->tail) { - assert(last->label == MSG_FWD_KILL); - log_trace("KILL is the last message in %s.", b->id); - - // The `b` board should be freed, and the endpoint needs to use the new board. - pthread_cond_broadcast(&b->cond); - board_unlock(b); - return grandchild; - } - - // Otherwise, continue to use `b`. - pthread_cond_broadcast(&b->cond); - board_unlock(b); - return b; -} - - - - -/** - * Read from the board. - * - * @param b The board to read from. - * @param pattern Message pattern. - * @param out The found message. - * @return The actual board read from. - */ -struct board_t* board_read(struct board_t* b, struct msg_t* pattern, struct msg_t* out) { - - /* Keep looping, until we find the match. - - If we find KEEP, jump and recursively find. - - If succeed, then return. - - If failed, then - - If KILL is the only message in child, remove the KEEP message. - - In any case, restart the search from the next index. - - If we find KILL, jump and recursively find. - - If KILL is the only message of this board, return the new board. - - Otherwise, keep using this board. - */ - - struct msg_t* contfrom = NULL; - - while (1) { - board_lock(b); - - // Search from `contfrom` and wait until a match. - struct search_env_t env = {.index = -1, .from = contfrom, .pattern = pattern, .found = NULL}; - queue_iforeach(b->queue, (queue_fn)search, (void*)&env); - - while (env.index < 0) { - env.index = -1; - env.from = contfrom; - env.found = NULL; - if (queue_find(b->queue, contfrom) < 0) { - contfrom = NULL; - } - env.from = contfrom; - - struct timeval now; - gettimeofday(&now, NULL); - - struct timespec timeout; - timeout.tv_sec = now.tv_sec; - timeout.tv_nsec = now.tv_usec * 1000; - timeout.tv_nsec += 1000 * 1000 * 500; // 500 ms - - pthread_cond_timedwait(&b->cond, &b->mutex, &timeout); - - #ifndef NDEBUG - char buffer[50]; - int i = 0; - i = sprintf(buffer, "Searching for %s ", msg_show_label(pattern)); - i += msg_show_senders(pattern, buffer+i); - i += sprintf(buffer+i, " => "); - i += msg_show_receivers(pattern, buffer+i); - log_trace("[Lock obtained]: %s in %s with %d, %p, %p", buffer, b->id, env.index, env.from, env.found); - board_show_nolock(b); - #endif - - queue_iforeach(b->queue, (queue_fn)search, (void*)&env); - } - - - - - struct msg_t *found = env.found; - struct board_t *child = (struct board_t*)found->payload; - struct board_t *grandchild; - - switch (found->label) { - case MSG_FWD_KEEP: - - /** - * First, try to read from the child. - */ - board_unlock(b); - - log_trace("Saw KEEP in %s. Reading again from %s", b->id, child->id); - grandchild = board_read(child, pattern, out); - - // If succeed, return. - if (out->label == pattern->label) return b; - - /** - * If it failed, then the child contains no match, and a KILL. - * We need to either skip the KEEP and re-search, or delete the KEEP and re-search. - * But note, the KEEP may be changed/deleted since the thread was unlocked. - */ - board_lock(b); - - // If someone else has freed the KEEP, just return. - int index = queue_find(b->queue, found); - if (index < 0) { - log_trace("Someone else deleted KEEP."); - board_unlock(b); - - // Restart read from the beginning. - contfrom = NULL; - continue; - } - - // If the child board has only a KILL message, - // then delete the KEEP message, and release the board. - if (child->queue->head == child->queue->tail) { - found = queue_ideq(b->queue, index); - log_trace("KILL is the last message in %s.", child->id); - - log_trace("KEEP %s deleted from %s", ((struct board_t*)found->payload)->id, b->id); - msg_free(found); - - // log_info("Read failed from KEEP in %s, restarting from 0", b->id); - board_unlock(b); - - // Restart the search from the beginning. - contfrom = NULL; - continue; - } - - log_trace("Read failed from KEEP in %s, restarting from %d", b->id, index+1); - board_unlock(b); - - // Restart the search from right after the KEEP message. - contfrom = found; - continue; - - // Our board is being killed. - case MSG_FWD_KILL: - - if (b->queue->head == b->queue->tail) { - log_trace("KILL is the last message in %s.", b->id); - } - - // Failed to find any message. Abort. - // This case is only for readings initiated via a JUMP from KEEP messages. - if (MSG_SET_SUB(pattern->receivers, found->senders)) { - log_trace("Saw KILL in %s. Read failed.", b->id); - board_unlock(b); - return NULL; - } - - // Otherwise. - int jump = b->queue->head == b->queue->tail ? 1 : 0; - - board_unlock(b); - - child = (struct board_t*)found->payload; - log_trace("Saw KILL in %s. Read again from %s", b->id, child->id); - grandchild = board_read(child, pattern, out); - - return jump == 1 ? grandchild : b; - - default: - // Mark and copy. - found->receivers = MSG_SET_MINUS(found->receivers, pattern->receivers); - memcpy(out, found, sizeof(struct msg_t)); - - // If all received, delete the message. - if (found->receivers == 0) msg_free(queue_ideq(b->queue, env.index)); - - board_unlock(b); - // log_info("Read success in %s %p", b->id, (void*)b); - msg_log(b, out, 0); - - return b; - } - - return NULL; - } -} - -PRIVATE void board_dbgfn(int i, struct msg_t* m, void* env) { - char prefix[10]; - sprintf(prefix, " %s => ", env); - msg_show_prefix(m, prefix); -} - -void board_show(struct board_t* b) { - board_lock(b); - board_show_nolock(b); - board_unlock(b); -} - -void board_show_nolock(struct board_t* b) { - log_debug("Board %s %p ref %d", b->id, (void*)b, b->refcount); - queue_iforeach(b->queue, (queue_fn)board_dbgfn, b->id); -} \ No newline at end of file diff --git a/endpoint.dats b/endpoint.dats deleted file mode 100644 index 5887a17..0000000 --- a/endpoint.dats +++ /dev/null @@ -1,43 +0,0 @@ -#define ATS_DYNLOADFLAG 0 - -staload "./endpoint.sats" -staload "./set.sats" -staload "./msg.sats" - -staload UN = "prelude/SATS/unsafe.sats" - -local (**) - -typedef set = [s:set] set s -extern fun _send (!endpoint, msglabel, set, set, ptr): void = "mac#ep_send" -extern fun _recv (!endpoint, msglabel, set, set): ptr = "mac#ep_recv" -extern fun _sync (!endpoint, msglabel, set): void = "mac#ep_sync" - -in (**) - -implement {a} ep_send (ep, label, sender, receiver, a) = - _send (ep, label, emp()+g1ofg0(sender), emp()+g1ofg0(receiver), $UN.castvwtp0{ptr} a) - -implement ep_bsend (ep, label, sender, a) = - _send (ep, label, emp()+g1ofg0(sender), ep_get_full(ep)-ep_get_self(ep), $UN.cast{ptr} a) - -// Unsafe. Can only send constant string. -implement ep_bsend (ep, label, sender, a) = - _send (ep, label, emp()+g1ofg0(sender), ep_get_full(ep)-ep_get_self(ep), $UN.cast{ptr} a) - -implement {a} ep_recv (ep, label, sender, receiver) = - $UN.castvwtp0{a} (_recv (ep, label, emp()+g1ofg0(sender), emp()+g1ofg0(receiver))) - -implement ep_brecv (ep, label, sender) = - $UN.cast{int} (_recv (ep, label, emp()+g1ofg0(sender), ep_get_self ep)) - -implement ep_brecv (ep, label, sender) = - $UN.cast{string} (_recv (ep, label, emp()+g1ofg0(sender), ep_get_self ep)) - -implement ep_sync_recv (ep, label, syncer) = - _sync (ep, label, emp()+g1ofg0(syncer)) - -implement {a} ep_sync_send (ep, label, syncer, a) = - _send (ep, label, ep_get_self ep, emp()+g1ofg0(syncer), $UN.cast{ptr} a) - -end (**) \ No newline at end of file diff --git a/endpoint.sats b/endpoint.sats deleted file mode 100644 index a1d974b..0000000 --- a/endpoint.sats +++ /dev/null @@ -1,25 +0,0 @@ -%{# -#include "./runtime.h" -%} - -staload "./set.sats" -staload "./blackboard.sats" -staload "./msg.sats" - -absvtype endpoint = ptr - -fun ep_make {full,self:set|full>self} (set full, set self, !board): endpoint = "mac#" -fun ep_free (endpoint): void = "mac#" - -fun ep_get_self (!endpoint): [s:set] set s = "mac#" -fun ep_get_full (!endpoint): [s:set] set s = "mac#" - -fun ep_link (endpoint, endpoint): endpoint = "mac#" - - -fun {a:t@ype} ep_bsend (!endpoint, msglabel, int, a): void -fun {a:t@ype} ep_brecv (!endpoint, msglabel, int): a -fun {a:vt@ype} ep_send (!endpoint, msglabel, int, int, a): void -fun {a:vt@ype} ep_recv (!endpoint, msglabel, int, int): a -fun {a:t@ype} ep_sync_send (!endpoint, msglabel, int, a): void -fun ep_sync_recv (!endpoint, msglabel, int): void \ No newline at end of file diff --git a/ep.c b/ep.c deleted file mode 100644 index 8cff1c3..0000000 --- a/ep.c +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Endpoints. Please #include this file in runtime.c - */ - -struct ep_t* ep_make(int32_t full, int32_t self, struct board_t* board) { - struct ep_t* ep = (struct ep_t*)malloc(sizeof(struct ep_t)); - ep->self = self; - ep->full = full; - ep->board = board_ref(board); - - g_endpoints[++g_eindex] = ep; - return ep; -} - -void ep_free(struct ep_t* ep) { - board_free(ep->board); - free(ep); - - for (int i = 0; i <= g_eindex; i++) { - if (g_endpoints[i] == ep) - g_endpoints[i] = NULL; - } - return; -} - -void ep_send(struct ep_t* ep, int label, int32_t from, int32_t to, void* payload) { - struct msg_t* m = msg_make(label, from, to, payload); - struct board_t* child = board_write(ep->board, m); - - if (child != ep->board) { - struct board_t* old = ep->board; - ep->board = board_ref(child); - board_free(old); - } - - return; -} - -void* ep_recv(struct ep_t* ep, int label, int32_t from, int32_t to) { - struct msg_t* p = msg_make(label, from, to, NULL); - struct msg_t* found = msg_make(-1, INT32_MIN, INT32_MIN, NULL); - - struct board_t* child = board_read(ep->board, p, found); - assert(found->label == p->label); - - if (child != ep->board) { - struct board_t* old = ep->board; - ep->board = board_ref(child); - board_free(old); - } - - // The pointer is copied. The actual content is not owned by the message. - // This is only possible in shared memory. - void* payload = found->payload; - msg_free(p); - msg_free(found); - - if (label == MSG_SYNC_CLOSE) { - log_trace("SYNC_CLOSE Received!"); - } - - // switch (label) { - // case MSG_MSG: - // log_info("MSG %s read from %s", payload, ep->board->id); - // break; - // } - - return payload; -} - -void ep_sync(struct ep_t* ep, int label, int syncer) { - int32_t senders = MSG_SET_MINUS(ep->full, ep->self); - - char buffer[20]; - int i = 0; - while (senders > 0) { - for(unsigned int mask = 0x80; mask; mask >>= 1) { - i += sprintf(buffer+i, "%d", !!(mask & senders)); - } - log_trace("Syncing with %s", buffer); - int32_t sender = (int32_t)(ep_recv(ep, label, INT32_MIN, syncer)); - senders = MSG_SET_MINUS(senders, sender); - i = 0; - } - return; -} - - -/** - * Link two endpoints. The operation puts the reference of each one into the other. - * - * When reading: - * - If KILL, jump to the other board and read again. - * - If KILL is the only message, return the new board. - * - Otherwise, keep using the old board. - * - If KEEP, - * - If the KEEP is sent by oneself (self < KEEP.senders, or !(self < KEEP.receivers)), skip. - * - Otherwise, jump to the other board and read again. - * - If succeed, return. - * - If failed, restart search from the next one. - * - If the other board only contains the KILL, remove KEEP. - * - * When writing: - * - If KILL, jump to the other board and write again. - * - If KILL is the only message, return the new board. - * - Otherwise, keep using the old board. - * - If KEEP, skip. - * - * @param ep1 The keep endpoint. - * @param ep2 The kill endpoint. - * @return The keep endpoint. - */ -struct ep_t* ep_link(struct ep_t* ep1, struct ep_t* ep2) { - // Kill ep2->board. - // FWD_KILL: - // senders: ep2.self - // receivers: ep2.full - struct msg_t* p = msg_make(MSG_FWD_KILL, ep2->self, ep2->full, board_ref(ep1->board)); - - // Keep ep1->board. - // FWD_KEEP: - // senders: full - ep2.self - // receivers: ep2.self - struct msg_t* q = msg_make(MSG_FWD_KEEP, ep2->full & ~ep2->self, ep2->self, board_ref(ep2->board)); - - // Kill ep2. - ep1->self &= ep2->self; - - board_write(ep2->board, p); - board_write(ep1->board, q); - - - ep_free(ep2); - - return ep1; -} - -void ep_show(struct ep_t* ep) { - char buffer[64]; - int i = sprintf(buffer, "Endpoint ["); - for(unsigned int mask = 0x80; mask; mask >>= 1) { - i += sprintf(buffer+i, "%d", !!(mask & ep->full)); - } - i += sprintf(buffer+i, "] ["); - for(unsigned int mask = 0x80; mask; mask >>= 1) { - i += sprintf(buffer+i, "%d", !!(mask & ep->self)); - } - sprintf(buffer+i, "] [%s] @ %p", ep->board->id, (void*)ep); - log_debug(buffer); -} \ No newline at end of file diff --git a/examples/MakefileBackup b/examples/MakefileBackup deleted file mode 100644 index 8709681..0000000 --- a/examples/MakefileBackup +++ /dev/null @@ -1,18 +0,0 @@ - - - - -FRONTEND=../frontend - - -all: ex-queue.const ex-queue.tc - -clean: *.const *.tc - rm -rf $? - -%.const: %.dats - patsopt -tc --constraint-export -d $< | patsolve_smt2 -i preamble --printfile $(FRONTEND)/set.smt2 -i - > $@ - -%.tc: %.const - z3 -t:2000 -smt2 $< 2>&1 | tee $@ | em -fgreen "^unsat" | em "^sat|^timeout|^unknown" - diff --git a/examples/ex-cut-residual.dats b/examples/ex-cut-residual.dats deleted file mode 100644 index 0a43008..0000000 --- a/examples/ex-cut-residual.dats +++ /dev/null @@ -1,221 +0,0 @@ - - -/** - * - * This is a complicated multiparty session where all boards are busy. - * In a binary case, there must be one board that is completely blocked and no new - * message can write into the board. That's not the case here for MPST. - * - * 0, 1, 23456 <-> 012, 3, 456 <-> 01234, 5, 6 - * => - * 0, 1, 2, 3, 4, 5, 6 - * - * Hanwen - * Aug 2018 - */ - - -stadef ss = pmsg(0,1,string):: - pmsg(0,2,string):: - pmsg(0,4,string):: - pmsg(0,5,string):: - pmsg(6,1,string):: - pmsg(6,2,string):: - pmsg(6,4,string):: - pmsg(6,5,string):: - pmsg(3,0,string):: - pmsg(3,1,string):: - pmsg(3,2,string):: - pmsg(3,4,string):: - pmsg(3,5,string):: - pmsg(3,6,string):: - pend(3) - -stadef full = emp+0+1+2+3+4+5+6 - -vtypedef chan (rs:set) = chan(emp+0+1+2+3+4+5+6, rs, ss) - -extern fun p0 (chan(emp+0)): void -extern fun p1 (chan(emp+1)): void -extern fun p2 (chan(emp+2)): void -extern fun p3 (chan(emp+3)): void -extern fun p4 (chan(emp+4)): void -extern fun p5 (chan(emp+5)): void -extern fun p6 (chan(emp+6)): void - -extern fun test (string): void - -implement test (msg) = let - val _ = println! msg - - val board = board_make "A" - val ch0 = session_make {pinit(2)::ss} (emp()+0+1+2+3+4+5+6, emp()+0, board) - val ch1 = session_make {pinit(2)::ss} (emp()+0+1+2+3+4+5+6, emp()+1, board) - val ch23456 = session_make {pinit(2)::ss} (emp()+0+1+2+3+4+5+6, emp()+2+3+4+5+6, board) - val _ = board_free board - - val board = board_make "B" - val ch012 = session_make {pinit(4)::ss} (emp()+0+1+2+3+4+5+6, emp()+0+1+2, board) - val ch3 = session_make {pinit(4)::ss} (emp()+0+1+2+3+4+5+6, emp()+3, board) - val ch456 = session_make {pinit(4)::ss} (emp()+0+1+2+3+4+5+6, emp()+4+5+6, board) - val _ = board_free board - - val board = board_make "C" - val ch01234 = session_make {pinit(4)::ss} (emp()+0+1+2+3+4+5+6, emp()+0+1+2+3+4, board) - val ch5 = session_make {pinit(4)::ss} (emp()+0+1+2+3+4+5+6, emp()+5, board) - val ch6 = session_make {pinit(4)::ss} (emp()+0+1+2+3+4+5+6, emp()+6, board) - val _ = board_free board - - val _ = session_request (ch0, 2, llam ch => p0 ch) - val _ = session_request (ch1, 2, llam ch => p1 ch) - val _ = session_accept (ch23456, 2) - - val _ = session_request (ch012, 4, llam ch => p2 (session_link (ch, ch23456))) - val _ = session_request (ch3, 4, llam ch => p3 ch) - - val _ = session_request (ch5, 4, llam ch => p5 ch) - val _ = session_request (ch6, 4, llam ch => p6 ch) - - val _ = session_accept (ch01234, 4) - val _ = session_accept (ch456, 4) -in - p4 (session_link (ch456, ch01234)) -end - - - - - - -implement p0 (ch) = let - val _ = session_send (ch, 0, 1, "0->1") - val _ = session_send (ch, 0, 2, "0->2") - val _ = session_send (ch, 0, 4, "0->4") - val _ = session_send (ch, 0, 5, "0->5") - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 3, 0)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch -in - session_wait (ch, 3) -end - -implement p1 (ch) = let - val _ = println! (session_recv (ch, 0, 1)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 6, 1)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 3, 1)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch -in - session_wait (ch, 3) -end - -implement p2 (ch) = let - prval _ = session_skip ch - val _ = println! (session_recv (ch, 0, 2)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 6, 2)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 3, 2)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch -in - session_wait (ch, 3) -end - -implement p3 (ch) = let - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = session_send (ch, 3, 0, "3->0") - val _ = session_send (ch, 3, 1, "3->1") - val _ = session_send (ch, 3, 2, "3->2") - val _ = session_send (ch, 3, 4, "3->4") - val _ = session_send (ch, 3, 5, "3->5") - val _ = session_send (ch, 3, 6, "3->6") -in - session_close (ch, 3) -end - -implement p4 (ch) = let - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 0, 4)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 6, 4)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 3, 4)) - prval _ = session_skip ch - prval _ = session_skip ch -in - session_wait (ch, 3) -end - -implement p5 (ch) = let - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 0, 5)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 6, 5)) - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 3, 5)) - prval _ = session_skip ch -in - session_wait (ch, 3) -end - -implement p6 (ch) = let - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = session_send (ch, 6, 1, "6->1") - val _ = session_send (ch, 6, 2, "6->2") - val _ = session_send (ch, 6, 4, "6->4") - val _ = session_send (ch, 6, 5, "6->5") - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - prval _ = session_skip ch - val _ = println! (session_recv (ch, 3, 6)) -in - session_wait (ch, 3) -end \ No newline at end of file diff --git a/examples/ex-queue.dats b/examples/ex-queue.dats deleted file mode 100644 index 5e7cdab..0000000 --- a/examples/ex-queue.dats +++ /dev/null @@ -1,92 +0,0 @@ -//staload "../libsession.sats" -//staload "../set.sats" - -#define C 1 -#define S 0 - -#define Crs emp+C -#define Srs emp+S -#define Frs emp+C+S - -stadef queue (a:t@ype) = pfix (lam p => pbranch(C,pbmsg(C,a)::p,popt(S,pbmsg(S,a)::p))) - -extern fun {a:t@ype} empty (): chan(Frs,Crs,queue(a)) -extern fun {a:t@ype} elem (chan(Frs,Crs,queue(a)), a): chan(Frs,Crs,queue(a)) - -extern fun {a:t@ype} enq (!chan(Frs,Crs,queue(a)), a): void -extern fun {a:t@ype} free (chan(Frs,Crs,queue(a))): void - -implement {a} empty () = let - fun server (left: chan(Frs,Srs,queue(a))): void = let - prval _ = session_unroll left - val c = session_offer (left, C) - in - case+ c of - | ~Right() => (session_choose (left, Right()); session_close left) - | ~Left() => - let - val x = session_brecv (left, C) - val right = elem (empty (), x) - in - session_emp (session_link (right, left)) - end - end -in - session_fork (emp()+S, emp()+C, llam left => server left) -end - -implement {a} elem (right, x) = let - fun server (left: chan(Frs,Srs,queue(a)), right: chan(Frs,Crs,queue(a))): void = let - prval _ = session_unroll left - val c = session_offer (left, C) - in - case+ c of - | ~Left() => - let - val y = session_brecv (left, C) - prval _ = session_unroll right - val _ = session_choose (right, Left()) - val _ = session_bsend (right, y) - in - server (left, right) - end - | ~Right() => - let - val _ = session_choose (left, Left()) - val _ = session_bsend (left, x) - in - session_emp (session_link (left, right)) - end - end -in - session_fork (emp()+S, emp()+C, llam left => server (left, right)) -end - -implement {a} enq (ch, x) = let - prval _ = session_unroll ch - val _ = session_choose (ch, Left()) - val _ = session_bsend (ch, x) -in -end - -implement free (ch) = let - prval _ = session_unroll ch - val _ = session_choose (ch, Right()) - val c = session_offer (ch, S) -in - case+ c of - | ~Right() => (println! ("nil"); session_wait (ch, S)) - | ~Left() => (println! (session_brecv (ch, S)); free ch) -end - -extern fun test (string): void -implement test (msg) = let - val _ = println! msg - - val queue = empty () - val _ = (enq(queue,1); enq(queue,2); enq(queue,3)) - val _ = (enq(queue,4); enq(queue,5); enq(queue,6)) - val _ = (enq(queue,7); enq(queue,8); enq(queue,9)) -in - free queue -end \ No newline at end of file diff --git a/examples/ex-sieve.dats b/examples/ex-sieve.dats deleted file mode 100644 index 2ff902b..0000000 --- a/examples/ex-sieve.dats +++ /dev/null @@ -1,113 +0,0 @@ -//#include "share/atspre_staload.hats" -staload "../frontend/libsession.sats" -staload "../frontend/set.sats" - -#define C 1 -#define S 0 - -#define Crs (emp+C) -#define Srs (emp+S) -#define Frs (emp+C+S) - -stadef ints = pfix(lam p => pbranch(C,pbmsg(S,int)::p, pend(C))) - -extern fun from (int): chan(Frs,Crs,ints) -extern fun filter (chan(Frs,Crs,ints), int - bool): chan(Frs,Crs,ints) -extern fun sieve (chan(Frs,Crs,ints)): chan(Frs,Crs,ints) - -implement from (n) = let - fun server (ch:chan(Frs,Srs,ints), n:int): void = let - prval _ = session_unroll ch - val choice = session_offer ch - in - case+ choice of - | ~Left() => (session_bsend (ch, n); server (ch, n+1)) - | ~Right() => session_wait ch - end -in - session_fork (emp()+S, emp()+C, llam ch => server (ch, n)) -end - -implement filter (inp, p) = let - fun get (inp: !chan(Frs,Crs,ints)): int = let - prval _ = session_unroll inp - val _ = session_choose (inp, Left ()) - val n = session_brecv inp - in - if p n - then n - else get inp - end - - fun server (out: chan(Frs,Srs,ints), inp: chan(Frs,Crs,ints)): void = let - prval _ = session_unroll out - val c = session_offer out - in - case+ c of - | ~Left() => (session_bsend (out, get inp); server (out, inp)) - | ~Right() => - let - val _ = session_wait out - prval _ = session_unroll inp - val _ = session_choose (inp, Right()) - in - session_close inp - end - end -in - session_fork (emp()+S, emp()+C, llam out => server (out, inp)) -end - -implement sieve (inp) = let - fun server (out: chan(Frs,Srs,ints), inp: chan(Frs,Crs,ints)): void = let - prval _ = session_unroll out - val c = session_offer out - in - case+ c of - | ~Right() => - let - prval _ = session_unroll inp - val _ = session_choose (inp, Right()) - val _ = session_close inp - in - session_wait out - end - | ~Left() => - let - prval _ = session_unroll inp - val _ = session_choose (inp, Left()) - val n = session_brecv inp - val _ = session_bsend (out, n) - in - server (out, filter (inp, lam p => p mod n > 0)) - end - end -in - session_fork (emp()+S, emp()+C, llam out => server (out, inp)) -end - -extern fun test (string): void -implement test (msg) = let - val _ = println! msg - val ch = sieve (from 2) - - fun loop (ch: chan(Frs,Crs,ints), n:int): void = - if n <= 0 - then - let - prval _ = session_unroll ch - val _ = session_choose (ch, Right()) - in - session_close ch - end - else - let - prval _ = session_unroll ch - val _ = session_choose (ch, Left()) - val _ = println! (session_brecv ch) - in - loop (ch, n-1) - end -in - loop (ch, 20) -end diff --git a/libsession.dats b/libsession.dats deleted file mode 100644 index 1734fb9..0000000 --- a/libsession.dats +++ /dev/null @@ -1,166 +0,0 @@ -#define ATS_DYNLOADFLAG 0 -#include "share/atspre_staload.hats" - -staload "./libsession.sats" -staload "./set.sats" -staload "./blackboard.sats" -staload "./endpoint.sats" -staload "./msg.sats" - -staload "libats/SATS/athread.sats" -staload _ = "libats/DATS/athread.dats" -staload _ = "libats/DATS/athread_posix.dats" - - -staload _ = "./endpoint.dats" - -implement session_fork {rs1,rs2} {s} (rs1, rs2, f) = let - val board = board_make ("random") - val ep1 = $UNSAFE.castvwtp0{chan(rs1+rs2,rs1,s)} (ep_make (rs1+rs2, rs1, board)) - val ep2 = $UNSAFE.castvwtp0{chan(rs1+rs2,rs2,s)} (ep_make (rs1+rs2, rs2, board)) - val _ = board_free board - val _ = athread_create_cloptr_exn (llam () => let val _ = f ep1 in $UNSAFE.castvwtp0{void} f end) -in - ep2 -end - -implement session_close {full,self} {r} (ch, syncer) = let - val ep = $UNSAFE.castvwtp0{endpoint} ch - val _ = ep_sync_recv (ep, SYNC_CLOSE, syncer) - val _ = ep_bsend (ep, CLOSE, syncer, 0) - val _ = ep_free ep -in -end - -implement session_wait {full,self} {r} (ch, syncer) = let - val ep = $UNSAFE.castvwtp0{endpoint} ch - val _ = ep_sync_send (ep, SYNC_CLOSE, syncer, $UNSAFE.cast{int}(ep_get_self ep)) - val _ = ep_brecv (ep, CLOSE, syncer) - val _ = ep_free ep -in -end - -implement {a} session_send {full,self} {from,to} {s} (ch, from, to, a) = let - val ep = $UNSAFE.castvwtp1{endpoint} ch - val _ = ep_send (ep, MSG, from, to, a) - extern praxi cast {x:stype} (!chan(full,self,x)>>chan(full,self,s)): unit_p - val _ = $UNSAFE.castvwtp0{void} ep - prval _ = cast ch -in -end - -implement {a} session_recv {full,self} {from,to} {s} (ch, from, to) = let - val ep = $UNSAFE.castvwtp1{endpoint} ch - val a = ep_recv (ep, MSG, from, to) - extern praxi cast {x:stype} (!chan(full,self,x)>>chan(full,self,s)): unit_p - val _ = $UNSAFE.castvwtp0{void} ep - prval _ = cast ch -in - a -end - -implement {a} session_bsend {full,self} {from} {s} (ch, from, a) = let - val ep = $UNSAFE.castvwtp1{endpoint} ch - val _ = ep_bsend (ep, MSG, from, a) - extern praxi cast {x:stype} (!chan(full,self,x)>>chan(full,self,s)): unit_p - val _ = $UNSAFE.castvwtp0{void} ep - prval _ = cast ch -in -end - -implement {a} session_brecv {full,self} {from} {s} (ch, from) = let - val ep = $UNSAFE.castvwtp1{endpoint} ch - val a = ep_brecv (ep, MSG, from) - extern praxi cast {x:stype} (!chan(full,self,x)>>chan(full,self,s)): unit_p - val _ = $UNSAFE.castvwtp0{void} ep - prval _ = cast ch -in - a -end - -implement session_link {full,rs1,rs2} {s} (ch1, ch2) = let - val ep1 = $UNSAFE.castvwtp0{endpoint} ch1 - val ep2 = $UNSAFE.castvwtp0{endpoint} ch2 - val ep = ep_link(ep1, ep2) -in - $UNSAFE.castvwtp0{chan(full,rs1*rs2,s)} ep -end - -implement session_emp {full} {s} (ch) = let - val ep = $UNSAFE.castvwtp0{endpoint} ch -in - ep_free ep -end - -implement session_choose {full,self} {r} {s,s1,s2} (ch, chooser, choice) = let - fun snd (ep: endpoint, i: int): void = let - val _ = ep_bsend (ep, BRANCH, chooser, i) - val _ = $UNSAFE.castvwtp0{void} ep - in - end - extern praxi cast1 {x:stype} (!chan(full,self,x)>>chan(full,self,s1)): unit_p - extern praxi cast2 {x:stype} (!chan(full,self,x)>>chan(full,self,s2)): unit_p -in - case+ choice of - | ~Left () => - let - val _ = snd($UNSAFE.castvwtp1{endpoint} ch, 0) - prval _ = cast1 ch - in end - | ~Right () => - let - val _ = snd($UNSAFE.castvwtp1{endpoint} ch, 1) - prval _ = cast2 ch - in end -end - -implement session_offer {full,self} {r} {s1,s2} (ch, chooser) = let - val ep = $UNSAFE.castvwtp1{endpoint} ch - val c = ep_brecv (ep, BRANCH, chooser) - val _ = $UNSAFE.castvwtp0{void} ep - extern praxi cast1 {x:stype} (!chan(full,self,x)>>chan(full,self,s1)): unit_p - extern praxi cast2 {x:stype} (!chan(full,self,x)>>chan(full,self,s2)): unit_p -in - if c = 0 - then - let prval _ = cast1 ch - in Left () end - else - let prval _ = cast2 ch - in Right () end -end - -implement session_make {s} {full,self} (full, self, board) = let - val ep = $UNSAFE.castvwtp0{chan(full,self,s)} (ep_make (full, self, board)) -in - ep -end - -implement session_accept {full,self} {r} {s} (ch, accepter) = let - val ep = $UNSAFE.castvwtp1{endpoint} ch - val _ = ep_sync_recv (ep, SYNC_INIT, accepter) - val _ = ep_bsend (ep, INIT, accepter, 0) - val _ = $UNSAFE.castvwtp0{void} ep - extern praxi cast {x:stype} (!chan(full,self,x)>>chan(full,self,s)): unit_p - prval _ = cast ch -in -end - -implement session_request {full,self} {r} {s} (ch, accepter, f) = let - - fun threadfn (ch: chan(full,self,pinit(r)::s), f: chan(full,self,s) - void): void = let - val ep = $UNSAFE.castvwtp1{endpoint} ch - val _ = ep_sync_send (ep, SYNC_INIT, accepter, $UNSAFE.cast{int}(ep_get_self ep)) - val _ = ep_brecv (ep, INIT, accepter) - val _ = $UNSAFE.castvwtp0{void} ep - extern praxi cast {x:stype} (!chan(full,self,x)>>chan(full,self,s)): unit_p - prval _ = cast ch - val _ = f ch - val _ = $UNSAFE.castvwtp0{void} f - in - end - -in - ignoret athread_create_cloptr_exn (llam () => threadfn (ch, f)) -end - diff --git a/libsession.sats b/libsession.sats deleted file mode 100644 index afbe6be..0000000 --- a/libsession.sats +++ /dev/null @@ -1,143 +0,0 @@ -//#include "share/atspre_staload.hats" -staload "./set.sats" -staload "./maybe.sats" - -sortdef role = int -sortdef roles = set - -(* session types *) -datasort stype = (* external *) -| pinit of (role) -| pend of (role) -| pmsg of (role, role, vt@ype) -| pbmsg of (role, t@ype) -| pseq of (stype, stype) -| ppara of (role, stype, stype) -| pbranch of (role, stype, stype) -| pfix of (stype -> stype) -| pquan of (role, int -> stype) -| pquan2 of (role, stype -> stype) -| pserve of (role, stype) - -//stacst pinit : (role) -> stype = "ext#" -//stacst pend : (role) -> stype = "ext#" -//stacst pmsg : (role, role, vt@ype) -> stype = "ext#" -//stacst pbmsg : (role, t@ype) -> stype = "ext#" -//stacst pseq : (stype, stype) -> stype = "ext#" -//stacst ppara : (role, stype, stype) -> stype = "ext#" -//stacst pbranch : (role, stype, stype) -> stype = "ext#" -//stacst pfix : (stype -> stype) -> stype = "ext#" -//stacst pquan : (role, int -> stype) -> stype = "ext#" -//stacst pquan2 : (role, stype -> stype) -> stype = "ext#" -//stacst pserve : (role, stype) -> stype = "ext#" - -stadef :: = pseq -stadef popt (r:role, s:stype) = pbranch(r,s,pend(r)) -stadef prpt (r:role, a:t@ype) = pfix(lam (p:stype):stype => popt(r, pbmsg(r,a)::p)) -stadef prpt (r1:role, r2:role, a:vt@ype) = pfix(lam (p:stype):stype => popt(r1, pmsg(r1,r2,a)::p)) - -datavtype choice (stype, p:stype, q:stype) = -| Left (p, p, q) of () -| Right (q, p, q) of () - -(* endpoint type *) -absvtype chan (roles, roles, stype) = ptr - -(* session api *) -fun {a:vt@ype} session_send - {full,self:roles|full>self} {from,to:role|mem(self,from)*mem(full-self,to)} {s:stype} - (!chan(full,self,pmsg(from,to,a)::s)>>chan(full,self,s), int from, int to, a): void - -fun {a:vt@ype} session_recv - {full,self:roles|full>self} {from,to:role|mem(full-self,from)*mem(self,to)} {s:stype} - (!chan(full,self,pmsg(from,to,a)::s)>>chan(full,self,s), int from, int to): a - -prfun session_skip - {full,self:roles|full>self} {from,to:role|(mem(self,from)*mem(self,to))+(mem(full-self,from)*mem(full-self,to))} {a:vt@ype} {s:stype} - (!chan(full,self,pmsg(from,to,a)::s)>>chan(full,self,s)): unit_p - -fun {a:t@ype} session_bsend - {full,self:roles|full>self} {from:role|mem(self,from)} {s:stype} - (!chan(full,self,pbmsg(from,a)::s)>>chan(full,self,s), int from, a): void - -fun {a:t@ype} session_brecv - {full,self:roles|full>self} {from:role|mem(full-self,from)} {s:stype} - (!chan(full,self,pbmsg(from,a)::s)>>chan(full,self,s), int from): a - -fun session_close - {full,self:roles|full>self} {r:role|mem(self,r)} - (chan(full,self,pend(r)), int r): void - -fun session_wait - {full,self:roles|full>self} {r:role|mem(full-self,r)} - (chan(full,self,pend(r)), int r): void - -fun session_fork - {rs1,rs2:roles} {s:stype} - (set rs1, set rs2, chan(rs1+rs2,rs1,s) - void): chan(rs1+rs2,rs2,s) - -fun {a:vt@ype} session_make - {s:stype} {full,self:roles|full>self} - (set full, set self, connection: !a): chan(full,self,s) - -fun session_accept - {full,self:roles|full>self} {r:role|mem(self,r)} {s:stype} - (!chan(full,self,pinit(r)::s)>>chan(full,self,s), int r): void - -fun session_request - {full,self:roles|full>self} {r:role|mem(full-self,r)} {s:stype} - (chan(full,self,pinit(r)::s), int r, chan(full,self,s) - void): void - -castfn session_exify - {full,self:roles|full>self} {r:role|mem(full-self,r)} {fp:int->stype} - (chan(full,self,pquan(r,fp))): [n:int] chan(full,self,fp(n)) - -castfn session_unify - {full,self:roles|full>self} {r:role|mem(self,r)} {fp:int->stype} - (chan(full,self,pquan(r,fp))): {n:int} chan(full,self,fp(n)) - -prfun session_unroll - {full,self:roles|full>self} {f:stype->stype} - (!chan(full,self,pfix(f))>>chan(full,self,f(pfix(f)))): void - -(* session combinators *) -fun session_paraconn - {full,self:roles|full>self} {r:role|mem(self,r)} {s1,s2:stype} - (chan(full,self,ppara(r,s1,s2))): @(chan(full,self,s1),chan(full,self,s2)) - -fun session_paradisj - {full,self:roles|full>self} {r:role|mem(full-self,r)} {s1,s2:stype} - (chan(full,self,ppara(r,s1,s2)), chan(full,self,s1) - void, chan(full,self,s2) - void): void - -fun session_choose - {full,self:roles|full>self} {r:role|mem(self,r)} {s,s1,s2:stype} - (!chan(full,self,pbranch(r,s1,s2))>>chan(full,self,s), int r, choice(s,s1,s2)): void - -fun session_offer - {full,self:roles|full>self} {r:role|mem(full-self,r)} {s1,s2:stype} - (!chan(full,self,pbranch(r,s1,s2))>>chan(full,self,s), int r): #[s:stype] choice (s,s1,s2) - -fun session_link - {full,rs1,rs2:roles|(full>rs1)*(full>rs2)*disj(full-rs1,full-rs2)} {s:stype} - (chan(full,rs1,s), chan(full,rs2,s)): chan(full,rs1*rs2,s) - -fun session_client - {full,self:roles|full>self} {r:role|mem(self,r)} {cont,s:stype} - (!chan(full,self,pserve(r,s))>>chan(full,self,cont), choice(cont,pserve(r,s),pend(r))): maybe(chan(full,self,s)) - -fun session_server - {full,self:roles|full>self} {r:role|mem(full-self,r)} {s:stype} - (!chan(full,self,pserve(r,s))>>chan(full,self,cont), chan(full,self,s) - void): #[cont:stype] choice(cont,pserve(r,s),pend(r)) - -fun session_emp - {full:roles} {s:stype} - (chan(full,emp,s)): void - -fun session_full - {full:roles} {s:stype} - (set full): chan(full,full,s) - -fun session_split - {full,rs1,rs2:roles|(full>rs1)*(full>rs2)*disj(rs1,rs2)} {s:stype} - (!chan(full,rs1+rs2,s)>>chan(full,rs2,s), chan(full,rs1,s) - void): void - diff --git a/log.c b/log.c deleted file mode 100644 index 7a22b88..0000000 --- a/log.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2017 rxi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include - -#include "log.h" - -static struct { - void *udata; - log_LockFn lock; - FILE *fp; - int level; - int quiet; -} L; - - -static const char *level_names[] = { - "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL" -}; - -#ifdef LOG_USE_COLOR -static const char *level_colors[] = { - "\x1b[94m", "\x1b[36m", "\x1b[32m", "\x1b[33m", "\x1b[31m", "\x1b[35m" -}; -#endif - - -static void lock(void) { - if (L.lock) { - L.lock(L.udata, 1); - } -} - - -static void unlock(void) { - if (L.lock) { - L.lock(L.udata, 0); - } -} - - -void log_set_udata(void *udata) { - L.udata = udata; -} - - -void log_set_lock(log_LockFn fn) { - L.lock = fn; -} - -void pthread_lock(void* udata, int lock) { - if (lock == 1) - pthread_mutex_lock((pthread_mutex_t*)udata); - else - pthread_mutex_unlock((pthread_mutex_t*)udata); -} - -pthread_mutex_t glock = PTHREAD_MUTEX_INITIALIZER; -void log_set_pthread() { - log_set_udata(&glock); - log_set_lock(pthread_lock); -} - - -void log_set_fp(FILE *fp) { - L.fp = fp; -} - - -void log_set_level(int level) { - L.level = level; -} - - -void log_set_quiet(int enable) { - L.quiet = enable ? 1 : 0; -} - - -void log_log(int level, const char *file, int line, const char *fmt, ...) { - if (level < L.level) { - return; - } - - /* Acquire lock */ - lock(); - - /* Get current time */ - time_t t = time(NULL); - struct tm *lt = localtime(&t); - - /* Log to stderr */ - if (!L.quiet) { - va_list args; - char buf[16]; - buf[strftime(buf, sizeof(buf), "%H:%M:%S", lt)] = '\0'; -#ifdef LOG_USE_COLOR - fprintf( - stderr, "%s %s%-5s\x1b[0m \x1b[97m%s:%d:\x1b[0m ", - buf, level_colors[level], level_names[level], file, line); -#else - fprintf(stderr, "%s %-5s %s:%d: ", buf, level_names[level], file, line); -#endif - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); - fflush(stderr); - } - - /* Log to file */ - if (L.fp) { - va_list args; - char buf[32]; - buf[strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", lt)] = '\0'; - fprintf(L.fp, "%s %-5s %s:%d: ", buf, level_names[level], file, line); - va_start(args, fmt); - vfprintf(L.fp, fmt, args); - va_end(args); - fprintf(L.fp, "\n"); - fflush(L.fp); - } - - /* Release lock */ - unlock(); -} \ No newline at end of file diff --git a/log.h b/log.h deleted file mode 100644 index f1aff1a..0000000 --- a/log.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2017 rxi - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the MIT license. See `log.c` for details. - */ - -#ifndef LOG_H -#define LOG_H - -#include -#include - -#define LOG_VERSION "0.1.0" - -typedef void (*log_LockFn)(void *udata, int lock); - -enum { LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_FATAL }; - -#define log_trace(...) log_log(LOG_TRACE, __FILE__, __LINE__, __VA_ARGS__) -#define log_debug(...) log_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__) -#define log_info(...) log_log(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__) -#define log_warn(...) log_log(LOG_WARN, __FILE__, __LINE__, __VA_ARGS__) -#define log_error(...) log_log(LOG_ERROR, __FILE__, __LINE__, __VA_ARGS__) -#define log_fatal(...) log_log(LOG_FATAL, __FILE__, __LINE__, __VA_ARGS__) - -void log_set_udata(void *udata); -void log_set_lock(log_LockFn fn); -void log_set_fp(FILE *fp); -void log_set_level(int level); -void log_set_quiet(int enable); - -void log_set_pthread(); - -void log_log(int level, const char *file, int line, const char *fmt, ...); - -#endif \ No newline at end of file diff --git a/maybe.sats b/maybe.sats deleted file mode 100644 index ac3dd90..0000000 --- a/maybe.sats +++ /dev/null @@ -1,5 +0,0 @@ - - -datavtype maybe (a:vt@ype) = -| Just (a) of (a) -| None (a) of () \ No newline at end of file diff --git a/msg.c b/msg.c deleted file mode 100644 index 833744b..0000000 --- a/msg.c +++ /dev/null @@ -1,106 +0,0 @@ - - - -/** - * Messages. Please #include this file in runtime.c - */ - -const char* msg_show_label(struct msg_t* m) { - switch (m->label) { - case MSG_MSG : return "MSG"; - case MSG_BRANCH : return "BRANCH"; - case MSG_INIT : return "INIT"; - case MSG_CLOSE : return "CLOSE"; - case MSG_SYNC_INIT : return "SYNC_INIT"; - case MSG_SYNC_CLOSE : return "SYNC_CLOSE"; - case MSG_FWD_KEEP : return "KEEP"; - case MSG_FWD_KILL : return "KILL"; - default : panic("Unknown label."); - } - return NULL; -} - -int msg_show_senders(struct msg_t* m, char* buffer) { - int i = 0; - for(unsigned int mask = 0x80; mask; mask >>= 1) { - i += sprintf(buffer+i, "%d", !!(mask & m->senders)); - } - return i; -} - -int msg_show_receivers(struct msg_t* m, char* buffer) { - int i = 0; - for(unsigned int mask = 0x80; mask; mask >>= 1) { - i += sprintf(buffer+i, "%d", !!(mask & m->receivers)); - } - return i; -} - -void msg_show(struct msg_t* m) { - msg_show_prefix(m, "\t"); -} - -void msg_show_prefix(struct msg_t* m, const char* prefix) { - char* label; - char buffer[100]; - - int i = sprintf(buffer, "%s", prefix); - i += sprintf(buffer+i, "[%s] [", msg_show_label(m)); - i += msg_show_senders(m, buffer+i); - i += sprintf(buffer+i, "] ["); - i += msg_show_receivers(m, buffer+i); - i += sprintf(buffer+i, "]"); - - switch (m->label) { - case MSG_FWD_KEEP: - case MSG_FWD_KILL: - i += sprintf(buffer+i, "[%s]", ((struct board_t*)m->payload)->id); - break; - case MSG_SYNC_INIT: - case MSG_SYNC_CLOSE: - i += sprintf(buffer+i, " ["); - for(unsigned int mask = 0x80; mask; mask >>= 1) { - i += sprintf(buffer+i, "%d", !!(mask & (int32_t)m->payload)); - } - sprintf(buffer+i, "]"); - break; - } - log_debug("%s", buffer); -} - -PRIVATE void msg_log(void* b, void* m, int rw) { - struct board_t* board = (struct board_t*)b; - struct msg_t* msg = (struct msg_t*)m; - char* action = rw == 0 ? "read from" : "written to"; - - switch (msg->label) { - case MSG_MSG : log_debug("Message %s %s %s", msg->payload, action, board->id); break; - case MSG_BRANCH : log_debug("Branch %s %s %s", (int)msg->payload == 0 ? "left" : "right", action, board->id); break; - case MSG_CLOSE : log_debug("Close %s %s", action, board->id); break; - case MSG_FWD_KEEP : log_debug("Keep %s %s %s", ((struct board_t*)msg->payload)->id, action, board->id); break; - case MSG_FWD_KILL : log_debug("Kill %s %s %s", ((struct board_t*)msg->payload)->id, action, board->id); break; - } -} - -struct msg_t* msg_make(int label, int32_t senders, int32_t receivers, void* payload) { - struct msg_t* m = (struct msg_t*)malloc(sizeof(struct msg_t)); - m->label = label; - m->senders = senders; - m->receivers = receivers; - m->payload = payload; - return m; -} - -/** - * Free the message. If the payload is a blackboard, free the board as well. - */ -void msg_free(struct msg_t* msg) { - struct board_t* child; - switch (msg->label) { - case MSG_FWD_KILL: - case MSG_FWD_KEEP: - child = (struct board_t*)msg->payload; - board_free(child); - } - free(msg); -} \ No newline at end of file diff --git a/msg.sats b/msg.sats deleted file mode 100644 index f4f58be..0000000 --- a/msg.sats +++ /dev/null @@ -1,18 +0,0 @@ - -datatype msglabel = MSG | BRANCH | CLOSE | INIT | SYNC_CLOSE | SYNC_INIT | KEEP | KILL - -//// -absvtype msg = ptr - -fun msg_make {a,b:set} (label: msglabel, sender: set a, receiver: set b, payload: ptr): msg - -fun msg_add_sender (!msg, int): void -fun msg_del_sender (!msg, int): void -fun msg_add_receiver (!msg, int): void -fun msg_del_receiver (!msg, int): void -fun msg_set_label (!msg, msglabel): void -fun msg_get_label (!msg): msglabel -fun msg_set_payload (!msg, ptr): void -fun msg_get_payload (!msg): ptr - -fun msg_free (msg): void \ No newline at end of file diff --git a/queue.c b/queue.c deleted file mode 100644 index 45afd68..0000000 --- a/queue.c +++ /dev/null @@ -1,105 +0,0 @@ - -/** - * Simple queue. Please #include this file in runtime.c - */ - -struct queue_t* queue_make() { - struct queue_t* q = (struct queue_t*)malloc(sizeof(struct queue_t)); - q->head = NULL; - q->tail = NULL; - return q; -} - -int queue_free(struct queue_t* q) { - int i = 0; - while (q->head != NULL) { - i++; - void* e = queue_deq(q); - if (e != NULL) free(e); - } - log_debug("Queue @ %p freed.", (void*)q); - free(q); - return i; -} - -void queue_enq(struct queue_t* q, void* payload) { - struct queue_node_t* node = (struct queue_node_t*)malloc(sizeof(struct queue_node_t)); - node->payload = payload; - node->next = NULL; - - /* empty queue */ - if (q->head == NULL) { - q->head = node; - q->tail = node; - return; - } - - q->tail->next = node; - q->tail = node; -} - -void* queue_deq(struct queue_t* q) { - /* empty queue */ - if (q->head == NULL) panic("Empty queue."); - - /* one element */ - if (q->head == q->tail) { - void* ret = q->head->payload; - free(q->head); - q->head = NULL; - q->tail = NULL; - - return ret; - } - - /* more elements */ - void* ret = q->head->payload; - struct queue_node_t* newhead = q->head->next; - free(q->head); - q->head = newhead; - - return ret; -} - -void* queue_ideq(struct queue_t* q, int i) { - if (i == 0) return queue_deq(q); - - // Navigate to the one before i. - struct queue_node_t* cur = q->head; - while (cur != NULL && i > 1) { - cur = cur->next; - i--; - } - if (cur == NULL || cur->next == NULL) panic("Index out of range."); - assert(i == 1); - - struct queue_node_t* tofree = cur->next; - void* payload = tofree->payload; - cur->next = tofree->next; - if (cur->next == NULL) q->tail = cur; - - free(tofree); - return payload; -} - - -void queue_iforeach(struct queue_t* q, queue_fn f, void* env) { - struct queue_node_t* cur = q->head; - int i = 0; - while (cur != NULL) { - f(i, cur->payload, env); - i++; - cur = cur->next; - } -} - -int queue_find (struct queue_t* q, void* addr) { - struct queue_node_t* cur = q->head; - int i = 0; - while (cur != NULL && cur->payload != addr) { - cur = cur->next; - i++; - } - - return cur != NULL ? i : -1; -} \ No newline at end of file diff --git a/runtime.c b/runtime.c deleted file mode 100644 index 786debe..0000000 --- a/runtime.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "./runtime.h" -#include "./log.h" - -#include -#include -#include -#include -#include -#include /* INT32_MIN */ -#include -#include -#include -#include - -/** - * Utilities. - */ - -void step() { - #ifndef NDEBUG - puts("...\n"); - getchar(); - #endif -} - -struct ep_t* g_endpoints[10]; -atomic_int g_eindex = -1; -struct board_t* g_boards[10]; -atomic_int g_bindex = -1; - -void panic(const char* msg) { - #define BT_BUF_SIZE 100 - fprintf(stderr, "\n[panic] %s\n", msg); - - void *buffer[BT_BUF_SIZE]; - - int nptrs = backtrace(buffer, BT_BUF_SIZE); - fprintf(stderr, "backtrace() returned %d addresses\n", nptrs); - backtrace_symbols_fd(buffer, nptrs, STDERR_FILENO); - - puts("\n"); - for (int i = 0; i <= g_eindex; i++) { - if (g_endpoints[i] != NULL) - ep_show(g_endpoints[i]); - } - puts("\n"); - for (int i = 0; i <= g_bindex; i++) { - if (g_boards[i] != NULL) - board_show(g_boards[i]); - } - - exit(EXIT_FAILURE); - #undef BT_BUF_SIZE -} - -int32_t arr2bits(int n, int* arr) { - int32_t ret = 0; - while (n > 0) { - ret |= (1 << *arr); - n--; arr++; - } - return ret; -} - -PRIVATE void _handle_sig(int s) { - switch (s) { - case SIGINT: panic("SIGINT"); break; - case SIGSEGV: panic("SIGSEGV"); break; - } -} - -void install_handler() { - struct sigaction h; - h.sa_handler = _handle_sig; - sigemptyset(&h.sa_mask); - h.sa_flags = 0; - sigaction(SIGINT, &h, NULL); - sigaction(SIGSEGV, &h, NULL); -} - - -#include "./queue.c" -#include "./msg.c" -#include "./board.c" -#include "./ep.c" - - - - diff --git a/runtime.h b/runtime.h deleted file mode 100644 index b3fe651..0000000 --- a/runtime.h +++ /dev/null @@ -1,151 +0,0 @@ -#pragma once - -/* macro comments */ -#define PRIVATE - -#include -#include - -/** - * Utils. - */ - -void panic (const char* msg); -int32_t arr2bits (int n, int* arr); -void step (); // Dummy getchar() when DEBUG. -void install_handler(); - -/** - * Use `PACK(a, b, c)` to generate `arr2bits(3, (int[3]){a, b, c})` - */ -// #define ARGC(...) ARGC_(__VA_ARGS__, 10,9,8,7,6,5,4,3,2,1,0) -// #define ARGC_(...) ARGC__(__VA_ARGS__) -// #define ARGC__(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -// #define PACK(...) arr2bits(ARGC(__VA_ARGS__), (int[ARGC(__VA_ARGS__)]){__VA_ARGS__}) - -/** - * Simple queue. - * - * Note, the queue owns the payload, until it gets dequeued. - */ - -struct queue_node_t { - void* payload; - struct queue_node_t* next; -}; - -struct queue_t { - struct queue_node_t* head; - struct queue_node_t* tail; -}; - - -struct queue_t* queue_make (); -int queue_free (struct queue_t* q); // Return number of nodes. -void queue_enq (struct queue_t* q, void* payload); -void* queue_deq (struct queue_t* q); -void* queue_ideq (struct queue_t* q, int i); -int queue_find (struct queue_t* q, void* addr); - -typedef void (*queue_fn)(int, void*, void*); -void queue_iforeach(struct queue_t* q, queue_fn, void*); - -/** - * Messages. - * - * Note that, the message does not own the payload. - */ - -enum { - MSG_MSG, - MSG_BRANCH, - MSG_CLOSE, - MSG_INIT, - MSG_SYNC_CLOSE, - MSG_SYNC_INIT, - MSG_FWD_KEEP, - MSG_FWD_KILL -}; - -#define MSG_SET_ADD(a, x) ((a) | (1 << (b))) -#define MSG_SET_MINUS(a, b) ((a) & (~(b))) -#define MSG_SET_SUB(a, b) (((a) | (b)) == (b)) -#define MSG_SET_SUP(a, b) (((a) | (b)) == (a)) -#define MSG_SET_CAP(a, b) ((a) & (b)) -#define MSG_SET_CUP(a, b) ((a) | (b)) - -#define MSG_LABEL_MATCH(m, p) ((p)->label < 0 || (m)->label == (p)->label) -#define MSG_RECVER_MATCH(m, p) ((p)->receivers < 0 || MSG_SET_SUP((m)->receivers, (p)->receivers)) -#define MSG_SENDER_MATCH(m, p) ((p)->senders < 0 || MSG_SET_SUP((m)->senders, (p)->senders)) -#define MSG_MATCH(m, p) (MSG_LABEL_MATCH(m,p) && MSG_SENDER_MATCH(m,p) && MSG_RECVER_MATCH(m,p)) - -struct msg_t { - int label; - int32_t senders; // The union of all roles of the sending endpoints. - int32_t receivers; // The union of all roles of the receiving endpoints. - void* payload; -}; - -struct msg_t* msg_make (int label, int32_t senders, int32_t receivers, void* payload); -void msg_free (struct msg_t* msg); - -void msg_show (struct msg_t* msg); -void msg_show_prefix (struct msg_t* msg, const char* prefix); -const char* msg_show_label (struct msg_t* msg); -int msg_show_senders (struct msg_t* msg, char* buffer); -int msg_show_receivers (struct msg_t* msg, char* buffer); -/** - * Blackboard. - */ - -struct board_t { - pthread_mutex_t mutex; - pthread_cond_t cond; - - atomic_int refcount; - struct queue_t* queue; - char id[64]; -}; - - -struct board_t* board_make (const char* id); -struct board_t* board_ref (struct board_t* board); -int board_free (struct board_t* board); // Return number of messages. - -struct board_t* board_write (struct board_t* board, struct msg_t* msg); -struct board_t* board_read (struct board_t* board, struct msg_t* pattern, struct msg_t* out); - -void board_lock (struct board_t* board); -void board_unlock (struct board_t* board); - -void board_show (struct board_t* board); -void board_show_nolock (struct board_t* board); - -/** - * Endpoint. - * - * Endpoint does not own the board, but it owns the payload. - */ - -struct ep_t { - struct board_t* board; - int32_t self; - int32_t full; -}; - -#define ep_get_self(x) (((struct ep_t*)(x))->self) -#define ep_get_full(x) (((struct ep_t*)(x))->full) - -struct ep_t* ep_make (int32_t full, int32_t self, struct board_t* board); -void ep_free (struct ep_t* ep); - -void ep_send (struct ep_t* ep, int label, int32_t from, int32_t to, void* payload); -void* ep_recv (struct ep_t* ep, int label, int32_t from, int32_t to); -void ep_sync (struct ep_t* ep, int label, int32_t syncer); - -struct ep_t* ep_link (struct ep_t* ep1, struct ep_t* ep2); - -void ep_show(struct ep_t* ep); - - - diff --git a/set.sats b/set.sats deleted file mode 100644 index 7f7c791..0000000 --- a/set.sats +++ /dev/null @@ -1,88 +0,0 @@ -datasort Set = (* hook into smt2 *) -sortdef set = Set - -stacst set_emp: set = "ext#smt_set_emp" -stacst set_add: (set, int) -> set = "ext#smt_set_add" -stacst set_del: (set, int) -> set = "ext#smt_set_del" -stacst set_cap: (set, set) -> set = "ext#smt_set_cap" -stacst set_cup: (set, set) -> set = "ext#smt_set_cup" -stacst set_dif: (set, set) -> set = "ext#smt_set_dif" -stacst set_com: (set) -> set = "ext#smt_set_com" -stacst set_mem: (set, int) -> bool = "ext#smt_set_mem" -stacst set_sub: (set, set) -> bool = "ext#smt_set_sub" -stacst set_sup: (set, set) -> bool = "ext#smt_set_sup" -stacst set_eq: (set, set) -> bool = "ext#smt_set_eq" - -stadef emp = set_emp -stadef + (e:int, s:set) = set_add (s, e) -stadef + = set_add -stadef - = set_del -stadef + = set_cup -stadef * = set_cap -stadef - = set_dif -stadef ~ = set_com -stadef mem = set_mem -stadef sub = set_sub -stadef < = set_sub -stadef sup = set_sup -stadef > = set_sup -stadef == = set_eq -stadef disj (a:set, b:set) = a * b == emp - -(* An naive natural number bit set. *) -%{# -#ifndef LIBSS_SET -#define LIBSS_SET - -#include -#include -#include - -#define libss_set_emp() (0) -#define libss_set_add(s, n) ((s) | (1 << (n))) -#define libss_set_del(s, n) ((s) & ~(1 << n)) -#define libss_set_cap(a, b) ((a) & (b)) -#define libss_set_cup(a, b) ((a) | (b)) -#define libss_set_dif(a, b) ((a) & ~(b)) -#define libss_set_mem(s, n) (((a) & (1 << (n))) > 0) -#define libss_set_sub(a, b) ((a) | (b) == (b)) -#define libss_set_sup(a, b) ((a) | (b) == (a)) -#define libss_set_eq(a, b) ((a) == (b)) -#define libss_set_disj(a, b) ((a) & (b) == 0) -#define libss_set_show(s) for(unsigned int mask=0x8000;mask;mask>>=1){printf("%d",!!(mask & s));} - -#endif -%} - -abst@ype set (set) = $extype "int32_t" - -#define ATS_EXTERN_PREFIX "libss_" - -fun set_emp (): set emp = "mac#%" -fun set_add {s:set} {n:int} (set s, int n): set (s + n) = "mac#%" -fun set_del {s:set} {n:int} (set s, int n): set (s - n) = "mac#%" -fun set_cap {s1,s2:set} (set s1, set s2): set (s1 * s2) = "mac#%" -fun set_cup {s1,s2:set} (set s1, set s2): set (s1 + s2) = "mac#%" -fun set_dif {s1,s2:set} (set s1, set s2): set (s1 - s2) = "mac#%" -fun set_mem {s:set} {n:int} (set s, int n): bool (mem (s, n)) = "mac#%" -fun set_sub {s1,s2:set} (set s1, set s2): bool (s1 < s2) = "mac#%" -fun set_sup {s1,s2:set} (set s1, set s2): bool (s1 > s2) = "mac#%" -fun set_eq {s1,s2:set} (set s1, set s2): bool (s1 == s2) = "mac#%" -fun set_disj {s1,s2:set} (set s1, set s2): bool (disj (s1, s2)) = "mac#%" -fun set_show {s:set} (set s): void = "mac#%" - -overload + with set_add -overload - with set_del -overload + with set_cup -overload * with set_cap -overload - with set_dif -overload = with set_eq -overload emp with set_emp -overload mem with set_mem -overload sub with set_sub -overload < with set_sub -overload sup with set_sup -overload > with set_sup -overload disj with set_disj - - diff --git a/set.smt2 b/set.smt2 deleted file mode 100644 index 5c4f15b..0000000 --- a/set.smt2 +++ /dev/null @@ -1,38 +0,0 @@ -; uninterpreted sort -(define-sort Elt () Int) -(define-sort Set () (Array Elt Bool)) - -(define-const smt_set_emp (Set) ((as const Set) false)) -(define-fun smt_set_add ((s Set) (x Elt)) Set (store s x true)) -(define-fun smt_set_del ((s Set) (x Elt)) Set (store s x false)) -(define-fun smt_set_cap ((s1 Set) (s2 Set)) Set ((_ map and) s1 s2)) -(define-fun smt_set_cup ((s1 Set) (s2 Set)) Set ((_ map or) s1 s2)) -(define-fun smt_set_com ((s Set)) Set ((_ map not) s)) -(define-fun smt_set_mem ((s Set) (x Elt)) Bool (select s x)) - -; s1 - s2 -(define-fun smt_set_dif ((s1 Set) (s2 Set)) Set (smt_set_cap s1 (smt_set_com s2))) -; s1 <: s2 -(define-fun smt_set_sub ((s1 Set) (s2 Set)) Bool (= smt_set_emp (smt_set_dif s1 s2))) -; s1 :> s2 -(define-fun smt_set_sup ((s1 Set) (s2 Set)) Bool (= smt_set_emp (smt_set_dif s2 s1))) -; s1 = s2 -(define-fun smt_set_eq ((s1 Set) (s2 Set)) Bool (and (smt_set_sub s1 s2) (smt_set_sup s1 s2))) - - -; uninterpreted sort -(declare-sort stype 0) -;(define-fun S2Eextkind ((s s2rt_tkind)) s2rt_int) - -; uninterpreted fun -(declare-fun pinit (s2rt_int) stype) -(declare-fun pend (s2rt_int) stype) -(declare-fun pmsg (s2rt_int s2rt_int s2rt_vt0ype) stype) -(declare-fun pbmsg (s2rt_int s2rt_t0ype) stype) -(declare-fun pseq (stype stype) stype) -(declare-fun ppara (s2rt_int stype stype) stype) -(declare-fun pbranch (s2rt_int stype stype) stype) -(declare-fun pfix ((Array stype stype)) stype) -(declare-fun pquan (s2rt_int (Array s2rt_int stype)) stype) -(declare-fun pquan2 (s2rt_int (Array stype stype)) stype) -(declare-fun pserve (s2rt_int stype) stype) diff --git a/test.dats b/test.dats deleted file mode 100644 index ba7fea7..0000000 --- a/test.dats +++ /dev/null @@ -1,100 +0,0 @@ -#include "share/atspre_staload.hats" - -staload "./libsession.sats" -staload "./set.sats" -staload "./blackboard.sats" -staload "./endpoint.sats" -staload "./msg.sats" -staload "./thread.sats" - -staload _ = "./thread.dats" -staload _ = "./endpoint.dats" -staload _ = "./libsession.dats" - -%{^ -#include "./runtime.h" -#include "./log.h" -%} - -extern fun setup (): void -implement setup () = let - val LOG_INFO = $extval(int, "LOG_INFO") - val _ = $extfcall(void, "install_handler") - val _ = $extfcall(void, "log_set_pthread") - val _ = $extfcall(void, "log_set_level", LOG_INFO) -in -end - -extern fun helloworld (): void -implement helloworld () = let - stadef rs1 = emp+1 - stadef rs2 = emp+2 - stadef helloworld = pbmsg(1,string)::pbmsg(2,string)::pend(1) - - fun client (ch: chan(rs1+rs2,rs1,helloworld)): void = let - val _ = session_bsend (ch, 1, "hello") - val _ = println! (session_brecv (ch, 2)) - in - session_close (ch, 1) - end - - fun server (ch: chan(rs1+rs2,rs2,helloworld)): void = let - val _ = println! (session_brecv (ch, 1)) - val _ = session_bsend (ch, 2, "world!") - in - session_wait (ch, 1) - end - - val ch = session_fork (emp()+1, emp()+2, llam ch => client ch) - val _ = server ch -in -end - -extern fun simplelink (): void -implement simplelink () = let - stadef rs1 = emp+1 - stadef rs2 = emp+2 - stadef helloworld = pbmsg(1,string)::pbmsg(2,string)::pbmsg(1,string)::pbmsg(2,string)::pend(1) - - fun client (ch: chan(rs1+rs2,rs1,helloworld)): void = let - val _ = session_bsend (ch, 1, "hello1") - val _ = println! (session_brecv (ch, 2)) - val _ = $extfcall(void, "sleep", 1) - val _ = session_bsend (ch, 1, "hello2") - val _ = println! (session_brecv (ch, 2)) - in - session_close (ch, 1) - end - - fun server (ch: chan(rs1+rs2,rs2,helloworld)): void = let - val _ = println! (session_brecv (ch, 1)) - val _ = session_bsend (ch, 2, "world1!") - val _ = $extfcall(void, "sleep", 1) - val _ = println! (session_brecv (ch, 1)) - val _ = session_bsend (ch, 2, "world2!") - in - session_wait (ch, 1) - end - - val ch1 = session_fork (emp()+1, emp()+2, llam ch => client ch) - val ch2 = session_fork (emp()+2, emp()+1, llam ch => server ch) - val ch = session_link (ch1, ch2) - val _ = session_emp ch -in -end - -//local (**) - -//#include "./examples/ex-queue.dats" -#include "./examples/ex-cut-residual.dats" - -//in (**) - -implement main0 () = let - val _ = setup () - val _ = test("Test Cut") -in - $extfcall(void, "sleep", 2) -end - -//end (**) \ No newline at end of file diff --git a/thread.dats b/thread.dats deleted file mode 100644 index 21411e6..0000000 --- a/thread.dats +++ /dev/null @@ -1,55 +0,0 @@ -#define ATS_DYNLOADFLAG 0 - -%{^ -#include -%} - -staload "./thread.sats" - -local - -#include "share/atspre_staload.hats" - -abst@ype pthread_t = $extype "pthread_t" -assume tid = pthread_t - -in - -implement thread_self () = - $extfcall (tid, "pthread_self") - -implement thread_spawn (f) = let - staload UN = "prelude/SATS/unsafe.sats" - - fun apply (f: () - void): ptr = let - val _ = f () - val _ = cloptr_free ($UN.castvwtp0{cloptr0} f) - in - the_null_ptr - end - - extern fun pthread_create (&pthread_t? >> _, - int, - (()- void) -> ptr, - () - void): int = "mac#pthread_create" - var tid: tid - val g = $UN.castvwtp1{cloptr0} f - val ret = pthread_create (tid, 0, apply, f) -in - if ret != 0 - then let - val _ = cloptr_free ($UN.castvwtp0{cloptr0} g) - val _ = assert_errmsg (ret = 0, "thread_spawn_env: failed") - in tid end - else let - val _ = $UN.castvwtp0{void} g - in tid end -end - -implement thread_join (tid) = let - val ret = $extfcall (int, "pthread_join", tid, 0) -in - assert_errmsg (ret = 0, "thread_join failed.") -end - -end \ No newline at end of file diff --git a/thread.sats b/thread.sats deleted file mode 100644 index 88f078d..0000000 --- a/thread.sats +++ /dev/null @@ -1,15 +0,0 @@ - - -abst@ype tid - -fun thread_self (): tid -fun thread_join (tid): void -fun thread_spawn (() - void): tid - -//abstype condvar - -//fun condvar_make (): condvar -//fun condvar_signal (condvar): void -//fun condvar_broadcast (condvar): void -//fun condvar_wait (condvar): void -