aboutsummaryrefslogtreecommitdiff
path: root/system/include
diff options
context:
space:
mode:
Diffstat (limited to 'system/include')
-rw-r--r--system/include/emscripten/emscripten.h28
-rw-r--r--system/include/err.h95
-rw-r--r--system/include/stdbool.h3
3 files changed, 123 insertions, 3 deletions
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h
index 93551f39..61634b0e 100644
--- a/system/include/emscripten/emscripten.h
+++ b/system/include/emscripten/emscripten.h
@@ -60,7 +60,7 @@ extern void emscripten_async_run_script(const char *script, int millis);
* that execution continues normally. Note that in both cases
* we do not run global destructors, atexit, etc., since we
* know the main loop will still be running, but if we do
- * not simulate an infinite loop then the stack will be unwinded.
+ * not simulate an infinite loop then the stack will be unwound.
* That means that if simulate_infinite_loop is false, and
* you created an object on the stack, it will be cleaned up
* before the main loop will be called the first time.
@@ -215,7 +215,7 @@ void emscripten_async_wget_data(const char* url, void *arg, void (*onload)(void*
* More feature-complete version of emscripten_async_wget. Note:
* this version is experimental.
*
- * The requestype is 'GET' or 'POST',
+ * The requesttype is 'GET' or 'POST',
* If is post request, param is the post parameter
* like key=value&key2=value2.
* The param 'arg' is a pointer will be pass to the callback
@@ -345,6 +345,30 @@ extern void EMSCRIPTEN_PROFILE_INIT(int max);
extern void EMSCRIPTEN_PROFILE_BEGIN(int id);
extern void EMSCRIPTEN_PROFILE_END(int id);
+/*
+ * jcache-friendly printf. printf in general will receive a string
+ * literal, which becomes a global constant, which invalidates all
+ * jcache entries. emscripten_jcache_printf is parsed before
+ * clang into something without any string literals, so you can
+ * add such printouts to your code and only the (chunk containing
+ * the) function you modify will be invalided and recompiled.
+ *
+ * Note in particular that you need to already have a call to this
+ * function in your code *before* you add one and do an incremental
+ * build, so that adding an external reference does not invalidate
+ * everything.
+ *
+ * This function assumes the first argument is a string literal
+ * (otherwise you don't need it), and the other arguments, if any,
+ * are neither strings nor complex expressions (but just simple
+ * variables). (You can create a variable to store a complex
+ * expression on the previous line, if necessary.)
+ */
+#ifdef __cplusplus
+void emscripten_jcache_printf(const char *format, ...);
+void emscripten_jcache_printf_(...); /* internal use */
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/system/include/err.h b/system/include/err.h
new file mode 100644
index 00000000..a9b92ee6
--- /dev/null
+++ b/system/include/err.h
@@ -0,0 +1,95 @@
+/* $OpenBSD: err.h,v 1.10 2006/01/06 18:53:04 millert Exp $ */
+/* $NetBSD: err.h,v 1.11 1994/10/26 00:55:52 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)err.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ERR_H_
+#define _ERR_H_
+
+/*
+ * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two
+ * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
+ * of them here we may collide with the utility's includes. It's unreasonable
+ * for utilities to have to include one of them to include err.h, so we get
+ * va_list from <machine/_types.h> and use it.
+ */
+#include <sys/cdefs.h>
+//#include <machine/_types.h>
+#include <stdarg.h>
+
+#define __dead __attribute__((__noreturn__))
+
+__BEGIN_DECLS
+
+__dead void err(int, const char *, ...)
+ __attribute__((__format__ (printf, 2, 3)));
+__dead void verr(int, const char *, va_list)
+ __attribute__((__format__ (printf, 2, 0)));
+__dead void errx(int, const char *, ...)
+ __attribute__((__format__ (printf, 2, 3)));
+__dead void verrx(int, const char *, va_list)
+ __attribute__((__format__ (printf, 2, 0)));
+void warn(const char *, ...)
+ __attribute__((__format__ (printf, 1, 2)));
+void vwarn(const char *, va_list)
+ __attribute__((__format__ (printf, 1, 0)));
+void warnx(const char *, ...)
+ __attribute__((__format__ (printf, 1, 2)));
+void vwarnx(const char *, va_list)
+ __attribute__((__format__ (printf, 1, 0)));
+
+/*
+ * The _* versions are for use in library functions so user-defined
+ * versions of err*,warn* do not get used.
+ */
+__dead void _err(int, const char *, ...)
+ __attribute__((__format__ (printf, 2, 3)));
+__dead void _verr(int, const char *, va_list)
+ __attribute__((__format__ (printf, 2, 0)));
+__dead void _errx(int, const char *, ...)
+ __attribute__((__format__ (printf, 2, 3)));
+__dead void _verrx(int, const char *, va_list)
+ __attribute__((__format__ (printf, 2, 0)));
+void _warn(const char *, ...)
+ __attribute__((__format__ (printf, 1, 2)));
+void _vwarn(const char *, va_list)
+ __attribute__((__format__ (printf, 1, 0)));
+void _warnx(const char *, ...)
+ __attribute__((__format__ (printf, 1, 2)));
+void _vwarnx(const char *, va_list)
+ __attribute__((__format__ (printf, 1, 0)));
+
+#undef __dead
+
+__END_DECLS
+
+#endif /* !_ERR_H_ */
diff --git a/system/include/stdbool.h b/system/include/stdbool.h
index f970ade8..561eed3f 100644
--- a/system/include/stdbool.h
+++ b/system/include/stdbool.h
@@ -2,12 +2,13 @@
#ifndef __stdbool_h__
#define __stdbool_h__
+#define __bool_true_false_are_defined 1
+
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
-#define __bool_true_false_are_defined 1
#endif