Merge branch 'master' into eyre-new

Conflicts:
	urb/urbit.pill
	urb/zod/docs/pub/doc/arvo/util.md
This commit is contained in:
Anton Dyudin 2015-03-24 17:01:13 -07:00
commit 2669bcf0f5
10 changed files with 60 additions and 100 deletions

View File

@ -33,7 +33,7 @@ ENDIAN=little
# #
BIN=bin BIN=bin
LIB=$(PWD)/urb LIB=$(shell pwd)/urb
RM=rm -f RM=rm -f
CC=gcc CC=gcc
@ -86,8 +86,11 @@ CWFLAGS=-Wall \
-Wno-sign-compare \ -Wno-sign-compare \
-Wno-unused-parameter \ -Wno-unused-parameter \
-Wno-missing-field-initializers \ -Wno-missing-field-initializers \
-Wno-error=unused-result \ -Wno-strict-aliasing \
-Werror -Werror
ifneq ($(OS),bsd)
CWFLAGS+=-Wno-error=unused-result
endif
ifdef NO_SILENT_RULES ifdef NO_SILENT_RULES
%.o: %.c $(CORE) %.o: %.c $(CORE)
@ -377,7 +380,7 @@ $(LIBCOMMONMARK):
$(MAKE) -C outside/commonmark $(MAKE) -C outside/commonmark
$(CRE2_OFILES): outside/cre2/src/src/cre2.cpp outside/cre2/src/src/cre2.h $(LIBRE2) $(CRE2_OFILES): outside/cre2/src/src/cre2.cpp outside/cre2/src/src/cre2.h $(LIBRE2)
$(CXX) $(CXXFLAGS) -c $< $(LIBRE2) -o $@ $(CXX) $(CXXFLAGS) -c $< -o $@
$(V_OFILES): i/v/vere.h $(V_OFILES): i/v/vere.h

View File

@ -178,3 +178,12 @@
# else # else
# error "port: timeconvert" # error "port: timeconvert"
# endif # endif
/* Entropy
*/
# if defined(U3_OS_bsd) && defined(__OpenBSD__)
# define c3_rand(rd) (getentropy((void*)rd, 32) == 0 ? \
(void)0 : c3_assert(!"ent"))
# else
# define c3_rand u3_sist_rand
# endif

View File

@ -24,7 +24,7 @@
** %oops :: assertion failure ** %oops :: assertion failure
*/ */
c3_i c3_i
u3m_bail(c3_m how_m); u3m_bail(c3_m how_m) __attribute__((noreturn));
/* u3m_file(): load file, as atom, or bail. /* u3m_file(): load file, as atom, or bail.
*/ */

View File

@ -201,12 +201,15 @@
/* u3_ames: ames networking. /* u3_ames: ames networking.
*/ */
typedef struct _u3_ames { // packet network state typedef struct _u3_ames { // packet network state
uv_udp_t wax_u; // socket state union {
uv_timer_t tim_u; // network timer uv_udp_t wax_u;
c3_o alm; // alarm on uv_handle_t had_u;
c3_w law_w; // last wakeup, unix time };
c3_s por_s; // public IPv4 port uv_timer_t tim_u; // network timer
c3_w imp_w[256]; // imperial IPs c3_o alm; // alarm on
c3_w law_w; // last wakeup, unix time
c3_s por_s; // public IPv4 port
c3_w imp_w[256]; // imperial IPs
} u3_ames; } u3_ames;
/* u3_save: checkpoint control. /* u3_save: checkpoint control.
@ -1091,6 +1094,11 @@
void void
u3_sist_get(const c3_c* key_c, c3_y* val_y); u3_sist_get(const c3_c* key_c, c3_y* val_y);
/* u3_sist_rand(): fill 8 words (32 bytes) with high-quality entropy.
*/
void
u3_sist_rand(c3_w* rad_w);
/** New timer system. /** New timer system.
**/ **/
/* u3_temp_io_init(): initialize time timer. /* u3_temp_io_init(): initialize time timer.

5
n/m.c
View File

@ -571,7 +571,7 @@ c3_w Exit;
** [%2 trace] ** [%2 trace]
** [%3 code trace] ** [%3 code trace]
** == ** ==
*/ */
c3_i c3_i
u3m_bail(u3_noun how) u3m_bail(u3_noun how)
{ {
@ -636,11 +636,10 @@ u3m_bail(u3_noun how)
} }
} }
} }
/* Longjmp, with an underscore. /* Longjmp, with an underscore.
*/ */
_longjmp(u3R->esc.buf, how); _longjmp(u3R->esc.buf, how);
return 0;
} }
int c3_cooked() { return u3m_bail(c3__oops); } int c3_cooked() { return u3m_bail(c3__oops); }

View File

@ -22,7 +22,7 @@ JSMODULES=$(wildcard js/lib/*.js)
.PHONY: all spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs update-site upload-site check npm debug mingw archive tarball ziparchive testarchive testtarball testziparchive testlib bench apidoc .PHONY: all spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs update-site upload-site check npm debug mingw archive tarball ziparchive testarchive testtarball testziparchive testlib bench apidoc
all: $(BUILDDIR) all: $(BUILDDIR)
@make -C $(BUILDDIR) @$(MAKE) -C $(BUILDDIR)
@echo "Binaries can be found in $(BUILDDIR)/src" @echo "Binaries can be found in $(BUILDDIR)/src"
check: check:
@ -34,19 +34,19 @@ $(BUILDDIR): check $(SRCDIR)/html/html_unescape.h $(SRCDIR)/case_fold_switch.inc
cmake .. -G "$(GENERATOR)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) cmake .. -G "$(GENERATOR)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
install: $(BUILDDIR) install: $(BUILDDIR)
make -C $(BUILDDIR) install $(MAKE) -C $(BUILDDIR) install
debug: debug:
mkdir -p $(BUILDDIR); \ mkdir -p $(BUILDDIR); \
cd $(BUILDDIR); \ cd $(BUILDDIR); \
cmake .. -DCMAKE_BUILD_TYPE=Debug; \ cmake .. -DCMAKE_BUILD_TYPE=Debug; \
make $(MAKE)
mingw: mingw:
mkdir -p $(MINGW_BUILDDIR); \ mkdir -p $(MINGW_BUILDDIR); \
cd $(MINGW_BUILDDIR); \ cd $(MINGW_BUILDDIR); \
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$(MINGW_INSTALLDIR) ;\ cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$(MINGW_INSTALLDIR) ;\
make && make install $(MAKE) && $(MAKE) install
archive: spec.html $(BUILDDIR) archive: spec.html $(BUILDDIR)
@rm -rf $(PKGDIR); \ @rm -rf $(PKGDIR); \
@ -87,7 +87,7 @@ $(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt
perl mkcasefold.pl < $< > $@ perl mkcasefold.pl < $< > $@
test: $(SPEC) $(BUILDDIR) test: $(SPEC) $(BUILDDIR)
make -C $(BUILDDIR) test ARGS="-V" $(MAKE) -C $(BUILDDIR) test ARGS="-V"
$(TARBALL): archive $(TARBALL): archive
@ -100,13 +100,13 @@ testtarball: $(TARBALL)
rm -rf $(PKGDIR); \ rm -rf $(PKGDIR); \
tar xvzf $(TARBALL); \ tar xvzf $(TARBALL); \
cd $(PKGDIR); \ cd $(PKGDIR); \
mkdir build && cd build && cmake .. && make && ctest -V mkdir build && cd build && cmake .. && $(MAKE) && ctest -V
testziparchive: $(ZIPARCHIVE) testziparchive: $(ZIPARCHIVE)
rm -rf $(PKGDIR); \ rm -rf $(PKGDIR); \
unzip $(ZIPARCHIVE); \ unzip $(ZIPARCHIVE); \
cd $(PKGDIR); \ cd $(PKGDIR); \
mkdir build && cd build && cmake .. && make && ctest -V mkdir build && cd build && cmake .. && $(MAKE) && ctest -V
$(ALLTESTS): spec.txt $(ALLTESTS): spec.txt
python test/spec_tests.py --spec $< --dump-tests | python -c 'import json; import sys; tests = json.loads(sys.stdin.read()); print "\n".join([test["markdown"] for test in tests]).encode("utf-8")' > $@ python test/spec_tests.py --spec $< --dump-tests | python -c 'import json; import sys; tests = json.loads(sys.stdin.read()); print "\n".join([test["markdown"] for test in tests]).encode("utf-8")' > $@
@ -188,7 +188,7 @@ spec.pdf: spec.md template.tex specfilter.hs
### Website ### ### Website ###
update-site: spec.html js/commonmark.js update-site: spec.html js/commonmark.js
make -C $(SITE) update $(MAKE) -C $(SITE) update
upload-site: spec.html upload-site: spec.html
make -C $(SITE) upload $(MAKE) -C $(SITE) upload

View File

@ -1,70 +1,11 @@
/* /*
Portable header to provide the 32 and 64 bits type. Portable header to provide the 32 and 64 bits type.
Not a compatible replacement for <stdint.h>, do not blindly use it as such.
*/ */
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__WATCOMC__) && (defined(_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined(__UINT_FAST64_TYPE__)) )) && !defined(FIXEDINT_H_INCLUDED)
#include <stdint.h>
#define FIXEDINT_H_INCLUDED
#if defined(__WATCOMC__) && __WATCOMC__ >= 1250 && !defined(UINT64_C)
#include <limits.h>
#define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
#endif
#endif
#ifndef FIXEDINT_H_INCLUDED #ifndef FIXEDINT_H_INCLUDED
#define FIXEDINT_H_INCLUDED #define FIXEDINT_H_INCLUDED
/* (u)int32_t */ #include <stdint.h>
#ifndef uint32_t #include <limits.h>
#if (ULONG_MAX == 0xffffffffUL)
typedef unsigned long uint32_t;
#elif (UINT_MAX == 0xffffffffUL)
typedef unsigned int uint32_t;
#elif (USHRT_MAX == 0xffffffffUL)
typedef unsigned short uint32_t;
#endif
#endif
#ifndef int32_t
#if (LONG_MAX == 0x7fffffffL)
typedef signed long int32_t;
#elif (INT_MAX == 0x7fffffffL)
typedef signed int int32_t;
#elif (SHRT_MAX == 0x7fffffffL)
typedef signed short int32_t;
#endif
#endif
/* (u)int64_t */
#if (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC__ && __STDC_VERSION__ >= 199901L)
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define UINT64_C(v) v ##ULL
#define INT64_C(v) v ##LL
#elif defined(__GNUC__)
__extension__ typedef long long int64_t;
__extension__ typedef unsigned long long uint64_t;
#define UINT64_C(v) v ##ULL
#define INT64_C(v) v ##LL
#elif defined(__MWERKS__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__APPLE_CC__) || defined(_LONG_LONG) || defined(_CRAYC)
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define UINT64_C(v) v ##ULL
#define INT64_C(v) v ##LL
#elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined(__BORLANDC__) && __BORLANDC__ > 0x460) || defined(__alpha) || defined(__DECC)
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define UINT64_C(v) v ##UI64
#define INT64_C(v) v ##I64
#endif
#endif #endif

View File

@ -367,7 +367,7 @@ u3_ames_io_exit()
{ {
u3_ames* sam_u = &u3_Host.sam_u; u3_ames* sam_u = &u3_Host.sam_u;
uv_close((uv_handle_t*)&sam_u->wax_u, 0); uv_close(&sam_u->had_u, 0);
} }
/* u3_ames_io_poll(): update ames IO state. /* u3_ames_io_poll(): update ames IO state.

View File

@ -444,10 +444,10 @@ _sist_bask(c3_c* pop_c, u3_noun may)
} }
#endif #endif
/* _sist_rand(): fill a 256-bit (8-word) buffer. /* u3_sist_rand(): fill a 256-bit (8-word) buffer.
*/ */
static void void
_sist_rand(c3_w* rad_w) u3_sist_rand(c3_w* rad_w)
{ {
c3_i fid_i = open(DEVRANDOM, O_RDONLY); c3_i fid_i = open(DEVRANDOM, O_RDONLY);
@ -589,7 +589,7 @@ _sist_zest()
{ {
c3_w rad_w[8]; c3_w rad_w[8];
_sist_rand(rad_w); c3_rand(rad_w);
sal_l = (0x7fffffff & rad_w[0]); sal_l = (0x7fffffff & rad_w[0]);
} }
@ -599,7 +599,7 @@ _sist_zest()
c3_w rad_w[8]; c3_w rad_w[8];
u3_noun pas; u3_noun pas;
_sist_rand(rad_w); c3_rand(rad_w);
pas = u3i_words(2, rad_w); pas = u3i_words(2, rad_w);
u3A->key = _sist_fatt(sal_l, u3k(pas)); u3A->key = _sist_fatt(sal_l, u3k(pas));
@ -1201,7 +1201,7 @@ _sist_zen()
{ {
c3_w rad_w[8]; c3_w rad_w[8];
_sist_rand(rad_w); c3_rand(rad_w);
return u3i_words(8, rad_w); return u3i_words(8, rad_w);
} }

View File

@ -22,15 +22,15 @@
#include "all.h" #include "all.h"
#include "v/vere.h" #include "v/vere.h"
static void _term_read_tn_cb(uv_stream_t* tcp_u, static void _term_read_tn_cb(uv_stream_t* tcp_u,
ssize_t siz_i, ssize_t siz_i,
const uv_buf_t * buf_u); const uv_buf_t * buf_u);
static void _term_read_cb(uv_stream_t* tcp_u, static void _term_read_cb(uv_stream_t* tcp_u,
ssize_t siz_i, ssize_t siz_i,
const uv_buf_t * buf_u); const uv_buf_t * buf_u);
static void _term_suck(u3_utty*, const c3_y*, ssize_t); static inline void _term_suck(u3_utty*, const c3_y*, ssize_t);
static void _tel_event(telnet_nvt*, telnet_event*); static void _tel_event(telnet_nvt*, telnet_event*);
static void _tel_opt(telnet_nvt*, telnet_byte, telnet_telopt_event*); static void _tel_opt(telnet_nvt*, telnet_byte, telnet_telopt_event*);
#define _T_ECHO 1 // local echo #define _T_ECHO 1 // local echo
#define _T_CTIM 3 // suppress GA/char-at-a-time #define _T_CTIM 3 // suppress GA/char-at-a-time