# HG changeset patch # User Ziv Scully # Date 1442092293 14400 # Node ID c05851bf7861e2eab2d411f8298e61f5c4b0c6dc # Parent e09c3dc102eff239b1ce9a027e69e0c94ea5de0f# Parent 010ce27228f1894d2adc7672d11b39131ab91f47 Merge. diff -r e09c3dc102ef -r c05851bf7861 CHANGELOG --- a/CHANGELOG Sat Aug 15 23:08:37 2015 -0700 +++ b/CHANGELOG Sat Sep 12 17:11:33 2015 -0400 @@ -1,3 +1,14 @@ +======== +20150819 +======== + +- Allow mouse and key events for +- Add HTML 'align' attribute +- Add onChange handler to radioOption +- New literal [_LOC_] that is replaced with textual information on location in source file +- Add a simple 'make test' target +- Bug fixes and documentation improvements + ======== 20150520 ======== diff -r e09c3dc102ef -r c05851bf7861 Makefile.am --- a/Makefile.am Sat Aug 15 23:08:37 2015 -0700 +++ b/Makefile.am Sat Sep 12 17:11:33 2015 -0400 @@ -119,7 +119,7 @@ TESTPID = /tmp/urweb.pid test: - urweb -dbms sqlite -db $(TESTDB) -demo /Demo demo + bin/urweb -boot -noEmacs -dbms sqlite -db $(TESTDB) -demo /Demo demo rm -f $(TESTDB) sqlite3 $(TESTDB) < demo/demo.sql demo/demo.exe & echo $$! > $(TESTPID) diff -r e09c3dc102ef -r c05851bf7861 configure.ac --- a/configure.ac Sat Aug 15 23:08:37 2015 -0700 +++ b/configure.ac Sat Sep 12 17:11:33 2015 -0400 @@ -1,4 +1,4 @@ -AC_INIT([urweb], [20150520]) +AC_INIT([urweb], [20150819]) WORKING_VERSION=1 AC_USE_SYSTEM_EXTENSIONS diff -r e09c3dc102ef -r c05851bf7861 doc/intro.ur --- a/doc/intro.ur Sat Aug 15 23:08:37 2015 -0700 +++ b/doc/intro.ur Sat Sep 12 17:11:33 2015 -0400 @@ -58,12 +58,15 @@ fact 5 (* end *) -fun isEven n = n = 0 || isOdd (n - 1) -and isOdd n = n = 1 || isEven (n - 1) +fun isEven n = n = 0 || (n > 1 && isOdd (n - 1)) +and isOdd n = n = 1 || (n > 1 && isEven (n - 1)) (* begin eval *) isEven 32 (* end *) +(* begin eval *) +isEven 31 +(* end *) (* Of course we have anonymous functions, too. *) diff -r e09c3dc102ef -r c05851bf7861 doc/manual.tex --- a/doc/manual.tex Sat Aug 15 23:08:37 2015 -0700 +++ b/doc/manual.tex Sat Sep 12 17:11:33 2015 -0400 @@ -2314,7 +2314,7 @@ &&& (E) & \textrm{explicit precedence} \\ \textrm{Nullary operators} & n &::=& \mt{CURRENT\_TIMESTAMP} \\ \textrm{Unary operators} & u &::=& \mt{NOT} \\ - \textrm{Binary operators} & b &::=& \mt{AND} \mid \mt{OR} \mid = \mid \neq \mid < \mid \leq \mid > \mid \geq \\ + \textrm{Binary operators} & b &::=& \mt{AND} \mid \mt{OR} \mid = \mid \neq \mid < \mid \leq \mid > \mid \geq \mid \mt{LIKE} \\ \textrm{Aggregate functions} & a &::=& \mt{COUNT} \mid \mt{AVG} \mid \mt{SUM} \mid \mt{MIN} \mid \mt{MAX} \\ \textrm{Directions} & o &::=& \mt{ASC} \mid \mt{DESC} \mid \{e\} \\ \textrm{SQL integer} & N &::=& n \mid \{e\} \\ diff -r e09c3dc102ef -r c05851bf7861 src/c/http.c --- a/src/c/http.c Sat Aug 15 23:08:37 2015 -0700 +++ b/src/c/http.c Sat Sep 12 17:11:33 2015 -0400 @@ -314,7 +314,7 @@ } static void help(char *cmd) { - printf("Usage: %s [-p ] [-a ] [-t ] [-k] [-q] [-T SEC]\nThe '-k' option turns on HTTP keepalive.\nThe '-q' option turns off some chatter on stdout.\nThe -T option sets socket recv timeout (0 disables timeout, default is 5 sec)", cmd); + printf("Usage: %s [-p ] [-a ] [-t ] [-k] [-q] [-T SEC]\nThe '-k' option turns on HTTP keepalive.\nThe '-q' option turns off some chatter on stdout.\nThe '-T' option sets socket recv timeout (0 disables timeout, default is 5 sec).\n", cmd); } static void sigint(int signum) { diff -r e09c3dc102ef -r c05851bf7861 src/c/openssl.c --- a/src/c/openssl.c Sat Aug 15 23:08:37 2015 -0700 +++ b/src/c/openssl.c Sat Sep 12 17:11:33 2015 -0400 @@ -1,5 +1,6 @@ #include "config.h" +#include #include #include #include @@ -7,12 +8,17 @@ #include #include #include +#include +#include #include #include #define PASSSIZE 4 +// OpenSSL locks array. See threads(3SSL). +static pthread_mutex_t *openssl_locks; + int uw_hash_blocksize = 32; static int password[PASSSIZE]; @@ -27,7 +33,41 @@ } } +// OpenSSL callbacks +static void thread_id(CRYPTO_THREADID *const result) { + CRYPTO_THREADID_set_numeric(result, pthread_self()); +} +static void lock_or_unlock(const int mode, const int type, const char *file, + const int line) { + pthread_mutex_t *const lock = &openssl_locks[type]; + if (mode & CRYPTO_LOCK) { + if (pthread_mutex_lock(lock)) { + fprintf(stderr, "Can't take lock at %s:%d\n", file, line); + exit(1); + } + } else { + if (pthread_mutex_unlock(lock)) { + fprintf(stderr, "Can't release lock at %s:%d\n", file, line); + exit(1); + } + } +} + void uw_init_crypto() { + int i; + // Set up OpenSSL. + assert(openssl_locks == NULL); + openssl_locks = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); + if (!openssl_locks) { + perror("malloc"); + exit(1); + } + for (i = 0; i < CRYPTO_num_locks(); ++i) { + pthread_mutex_init(&(openssl_locks[i]), NULL); + } + CRYPTO_THREADID_set_callback(thread_id); + CRYPTO_set_locking_callback(lock_or_unlock); + // Prepare signatures. if (uw_sig_file) { int fd; diff -r e09c3dc102ef -r c05851bf7861 src/c/urweb.c --- a/src/c/urweb.c Sat Aug 15 23:08:37 2015 -0700 +++ b/src/c/urweb.c Sat Sep 12 17:11:33 2015 -0400 @@ -169,13 +169,8 @@ void uw_free_client_data(void *); void uw_copy_client_data(void *dst, void *src); -static pthread_mutex_t rand_mutex = PTHREAD_MUTEX_INITIALIZER; - static uw_Basis_int my_rand() { - pthread_mutex_lock(&rand_mutex); int ret, r = RAND_bytes((unsigned char *)&ret, sizeof ret); - pthread_mutex_unlock(&rand_mutex); - if (r) return abs(ret); else diff -r e09c3dc102ef -r c05851bf7861 src/elaborate.sml --- a/src/elaborate.sml Sat Aug 15 23:08:37 2015 -0700 +++ b/src/elaborate.sml Sat Sep 12 17:11:33 2015 -0400 @@ -4123,6 +4123,18 @@ val dNew = (L'.DFfiStr (x, n, sgn'), loc) in + case #1 sgn' of + L'.SgnConst sgis => + (case List.find (fn (L'.SgiConAbs _, _) => false + | (L'.SgiCon _, _) => false + | (L'.SgiDatatype _, _) => false + | (L'.SgiVal _, _) => false + | _ => true) sgis of + NONE => () + | SOME sgi => (ErrorMsg.errorAt loc "Disallowed signature item for FFI module"; + epreface ("item", p_sgn_item env sgi))) + | _ => raise Fail "FFI signature isn't SgnConst"; + Option.map (fn tm => ModDb.insert (dNew, tm)) tmo; ([dNew], (env', denv, enD gs' @ gs)) end) diff -r e09c3dc102ef -r c05851bf7861 src/settings.sml --- a/src/settings.sml Sat Aug 15 23:08:37 2015 -0700 +++ b/src/settings.sml Sat Sep 12 17:11:33 2015 -0400 @@ -887,7 +887,7 @@ if path' = path then () else - ErrorMsg.error ("Two different files requested for URI " ^ Uri) + ErrorMsg.error ("Two different files requested for URI " ^ Uri ^ " ( " ^ path' ^ " vs. " ^ path ^ ")") | NONE => let val inf = BinIO.openIn path diff -r e09c3dc102ef -r c05851bf7861 tests/ffisub.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/ffisub.urp Sat Sep 12 17:11:33 2015 -0400 @@ -0,0 +1,3 @@ +ffi ffisub + +empty diff -r e09c3dc102ef -r c05851bf7861 tests/ffisub.urs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/ffisub.urs Sat Sep 12 17:11:33 2015 -0400 @@ -0,0 +1,5 @@ +structure S : sig + type t +end + +val x : S.t