mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 13:30:29 +00:00
Fix bugs and make improvements
- Get clone() working on FreeBSD - Increase some Python build quotas - Add more atomic builtins to chibicc - Fix ASAN poisoning of alloca() memory - Make MODE= mandatory link path tinier - Improve the examples folder a little bit - Start working on some more resource limits - Make the linenoise auto-complete UI as good as GNU readline - Update compile.com, avoiding AVX codegen on non-AVX systems - Make sure empty path to syscalls like opendir raises ENOENT - Correctly polyfill ENOENT vs. ENOTDIR on the New Technology - Port bestline's paredit features to //third_party/linenoise - Remove workarounds for RHEL 5.0 bugs that were fixed in 5.1
This commit is contained in:
parent
c3fb624647
commit
ae638c0850
181 changed files with 2994 additions and 1367 deletions
2
third_party/chibicc/chibicc.h
vendored
2
third_party/chibicc/chibicc.h
vendored
|
@ -348,6 +348,8 @@ typedef enum {
|
|||
ND_LOAD, // Atomic load
|
||||
ND_TESTANDSET, // Atomic lock test and set
|
||||
ND_RELEASE, // Atomic lock release
|
||||
ND_FETCHADD, // Atomic fetch and add
|
||||
ND_SUBFETCH, // Atomic sub and fetch
|
||||
ND_FPCLASSIFY, // floating point classify
|
||||
ND_MOVNTDQ, // Intel MOVNTDQ
|
||||
ND_PMOVMSKB, // Intel PMOVMSKB
|
||||
|
|
34
third_party/chibicc/codegen.c
vendored
34
third_party/chibicc/codegen.c
vendored
|
@ -262,6 +262,20 @@ static char *reg_ax(int sz) {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
static char *reg_di(int sz) {
|
||||
switch (sz) {
|
||||
case 1:
|
||||
return "%dil";
|
||||
case 2:
|
||||
return "%di";
|
||||
case 4:
|
||||
return "%edi";
|
||||
case 8:
|
||||
return "%rdi";
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
static const char *gotpcrel(void) {
|
||||
if (opt_pic) {
|
||||
return "@gotpcrel(%rip)";
|
||||
|
@ -1542,6 +1556,26 @@ void gen_expr(Node *node) {
|
|||
println("\tmov\t%s,(%%rdi)", reg_ax(node->ty->size));
|
||||
return;
|
||||
}
|
||||
case ND_FETCHADD: {
|
||||
gen_expr(node->lhs);
|
||||
push();
|
||||
gen_expr(node->rhs);
|
||||
pop("%rdi");
|
||||
println("\txadd\t%s,(%%rdi)", reg_ax(node->ty->size));
|
||||
return;
|
||||
}
|
||||
case ND_SUBFETCH: {
|
||||
gen_expr(node->lhs);
|
||||
push();
|
||||
gen_expr(node->rhs);
|
||||
pop("%rdi");
|
||||
push();
|
||||
println("\tneg\t%s", reg_ax(node->ty->size));
|
||||
println("\txadd\t%s,(%%rdi)", reg_ax(node->ty->size));
|
||||
pop("%rdi");
|
||||
println("\tsub\t%s,%s", reg_di(node->ty->size), reg_ax(node->ty->size));
|
||||
return;
|
||||
}
|
||||
case ND_RELEASE: {
|
||||
gen_expr(node->lhs);
|
||||
push();
|
||||
|
|
2
third_party/chibicc/kw.gperf
vendored
2
third_party/chibicc/kw.gperf
vendored
|
@ -119,6 +119,8 @@ __builtin_types_compatible_p, KW___BUILTIN_TYPES_COMPATIBLE_P
|
|||
"->", KW_ARROW
|
||||
".", KW_DOT
|
||||
__atomic_load, KW___ATOMIC_LOAD
|
||||
__atomic_fetch_add, KW___ATOMIC_FETCH_ADD
|
||||
__atomic_sub_fetch, KW___ATOMIC_SUB_FETCH
|
||||
__sync_lock_test_and_set, KW___SYNC_LOCK_TEST_AND_SET
|
||||
__sync_lock_release, KW___SYNC_LOCK_RELEASE
|
||||
__builtin_ia32_movntdq, KW___BUILTIN_IA32_MOVNTDQ
|
||||
|
|
2
third_party/chibicc/kw.h
vendored
2
third_party/chibicc/kw.h
vendored
|
@ -110,6 +110,8 @@
|
|||
#define KW___SYNC_LOCK_RELEASE 126
|
||||
#define KW___BUILTIN_IA32_PMOVMSKB128 127
|
||||
#define KW___BUILTIN_IA32_MOVNTDQ 128
|
||||
#define KW___ATOMIC_FETCH_ADD 129
|
||||
#define KW___ATOMIC_SUB_FETCH 130
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
|
19
third_party/chibicc/kw.inc
vendored
19
third_party/chibicc/kw.inc
vendored
|
@ -37,7 +37,7 @@
|
|||
#line 10 "kw.gperf"
|
||||
struct thatispacked KwSlot { char *name; unsigned char code; };
|
||||
|
||||
#define TOTAL_KEYWORDS 114
|
||||
#define TOTAL_KEYWORDS 116
|
||||
#define MIN_WORD_LENGTH 1
|
||||
#define MAX_WORD_LENGTH 28
|
||||
#define MIN_HASH_VALUE 1
|
||||
|
@ -230,7 +230,7 @@ LookupKw (register const char *str, register size_t len)
|
|||
{"||", KW_LOGOR},
|
||||
#line 67 "kw.gperf"
|
||||
{"_Alignof", KW__ALIGNOF},
|
||||
#line 122 "kw.gperf"
|
||||
#line 124 "kw.gperf"
|
||||
{"__sync_lock_test_and_set", KW___SYNC_LOCK_TEST_AND_SET},
|
||||
#line 49 "kw.gperf"
|
||||
{"error", KW_ERROR},
|
||||
|
@ -249,7 +249,7 @@ LookupKw (register const char *str, register size_t len)
|
|||
{""},
|
||||
#line 66 "kw.gperf"
|
||||
{"_Alignas", KW__ALIGNAS},
|
||||
#line 123 "kw.gperf"
|
||||
#line 125 "kw.gperf"
|
||||
{"__sync_lock_release", KW___SYNC_LOCK_RELEASE},
|
||||
{""},
|
||||
#line 39 "kw.gperf"
|
||||
|
@ -340,20 +340,22 @@ LookupKw (register const char *str, register size_t len)
|
|||
{""}, {""}, {""},
|
||||
#line 100 "kw.gperf"
|
||||
{"__builtin_strlen", KW___BUILTIN_STRLEN},
|
||||
#line 124 "kw.gperf"
|
||||
#line 126 "kw.gperf"
|
||||
{"__builtin_ia32_movntdq", KW___BUILTIN_IA32_MOVNTDQ},
|
||||
{""}, {""}, {""},
|
||||
#line 120 "kw.gperf"
|
||||
{".", KW_DOT},
|
||||
#line 36 "kw.gperf"
|
||||
{"include", KW_INCLUDE},
|
||||
{""}, {""}, {""},
|
||||
#line 122 "kw.gperf"
|
||||
{"__atomic_fetch_add", KW___ATOMIC_FETCH_ADD},
|
||||
{""}, {""},
|
||||
#line 14 "kw.gperf"
|
||||
{"return", KW_RETURN},
|
||||
{""}, {""}, {""},
|
||||
#line 26 "kw.gperf"
|
||||
{"union", KW_UNION},
|
||||
#line 125 "kw.gperf"
|
||||
#line 127 "kw.gperf"
|
||||
{"__builtin_ia32_pmovmskb128", KW___BUILTIN_IA32_PMOVMSKB128},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
#line 112 "kw.gperf"
|
||||
|
@ -373,7 +375,10 @@ LookupKw (register const char *str, register size_t len)
|
|||
{""}, {""}, {""}, {""},
|
||||
#line 53 "kw.gperf"
|
||||
{"inline", KW_INLINE},
|
||||
{""}, {""}, {""}, {""},
|
||||
{""},
|
||||
#line 123 "kw.gperf"
|
||||
{"__atomic_sub_fetch", KW___ATOMIC_SUB_FETCH},
|
||||
{""}, {""},
|
||||
#line 113 "kw.gperf"
|
||||
{"!", KW_EXCLAIM}
|
||||
};
|
||||
|
|
26
third_party/chibicc/parse.c
vendored
26
third_party/chibicc/parse.c
vendored
|
@ -3243,6 +3243,32 @@ static Node *primary(Token **rest, Token *tok) {
|
|||
*rest = skip(tok, ')');
|
||||
return node;
|
||||
}
|
||||
if (kw == KW___ATOMIC_FETCH_ADD) {
|
||||
Node *node = new_node(ND_FETCHADD, tok);
|
||||
tok = skip(tok->next, '(');
|
||||
node->lhs = assign(&tok, tok);
|
||||
add_type(node->lhs);
|
||||
node->ty = node->lhs->ty->base;
|
||||
tok = skip(tok, ',');
|
||||
node->rhs = assign(&tok, tok);
|
||||
tok = skip(tok, ',');
|
||||
const_expr(&tok, tok);
|
||||
*rest = skip(tok, ')');
|
||||
return node;
|
||||
}
|
||||
if (kw == KW___ATOMIC_SUB_FETCH) {
|
||||
Node *node = new_node(ND_SUBFETCH, tok);
|
||||
tok = skip(tok->next, '(');
|
||||
node->lhs = assign(&tok, tok);
|
||||
add_type(node->lhs);
|
||||
node->ty = node->lhs->ty->base;
|
||||
tok = skip(tok, ',');
|
||||
node->rhs = assign(&tok, tok);
|
||||
tok = skip(tok, ',');
|
||||
const_expr(&tok, tok);
|
||||
*rest = skip(tok, ')');
|
||||
return node;
|
||||
}
|
||||
if (kw == KW___SYNC_LOCK_TEST_AND_SET) {
|
||||
Node *node = new_node(ND_TESTANDSET, tok);
|
||||
tok = skip(tok->next, '(');
|
||||
|
|
313
third_party/linenoise/linenoise.c
vendored
313
third_party/linenoise/linenoise.c
vendored
|
@ -50,6 +50,10 @@
|
|||
│ ALT-B BACKWARD WORD │
|
||||
│ CTRL-ALT-F FORWARD EXPR │
|
||||
│ CTRL-ALT-B BACKWARD EXPR │
|
||||
│ ALT-RIGHT FORWARD EXPR │
|
||||
│ ALT-LEFT BACKWARD EXPR │
|
||||
│ ALT-SHIFT-B BARF EXPR │
|
||||
│ ALT-SHIFT-S SLURP EXPR │
|
||||
│ CTRL-K KILL LINE FORWARDS │
|
||||
│ CTRL-U KILL LINE BACKWARDS │
|
||||
│ ALT-H KILL WORD BACKWARDS │
|
||||
|
@ -58,12 +62,13 @@
|
|||
│ ALT-D KILL WORD FORWARDS │
|
||||
│ CTRL-Y YANK │
|
||||
│ ALT-Y ROTATE KILL RING AND YANK AGAIN │
|
||||
│ ALT-\ SQUEEZE ADJACENT WHITESPACE │
|
||||
│ CTRL-T TRANSPOSE │
|
||||
│ ALT-T TRANSPOSE WORD │
|
||||
│ ALT-U UPPERCASE WORD │
|
||||
│ ALT-L LOWERCASE WORD │
|
||||
│ ALT-C CAPITALIZE WORD │
|
||||
│ CTRL-C INTERRUPT PROCESS │
|
||||
│ CTRL-C CTRL-C INTERRUPT PROCESS │
|
||||
│ CTRL-Z SUSPEND PROCESS │
|
||||
│ CTRL-\ QUIT PROCESS │
|
||||
│ CTRL-S PAUSE OUTPUT │
|
||||
|
@ -71,6 +76,7 @@
|
|||
│ CTRL-Q ESCAPED INSERT │
|
||||
│ CTRL-SPACE SET MARK │
|
||||
│ CTRL-X CTRL-X GOTO MARK │
|
||||
│ PROTIP REMAP CAPS LOCK TO CTRL │
|
||||
│ │
|
||||
│ EXAMPLE │
|
||||
│ │
|
||||
|
@ -156,6 +162,7 @@
|
|||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/sysv/consts/termios.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
#include "net/http/escape.h"
|
||||
#include "third_party/linenoise/linenoise.h"
|
||||
#include "tool/build/lib/case.h"
|
||||
|
||||
|
@ -305,6 +312,14 @@ static int notwseparator(wint_t c) {
|
|||
return !iswseparator(c);
|
||||
}
|
||||
|
||||
static int iswname(wint_t c) {
|
||||
return !iswseparator(c) || c == '_' || c == '-' || c == '.';
|
||||
}
|
||||
|
||||
static int notwname(wint_t c) {
|
||||
return !iswname(c);
|
||||
}
|
||||
|
||||
static void linenoiseOnInt(int sig) {
|
||||
gotint = sig;
|
||||
}
|
||||
|
@ -817,34 +832,116 @@ static char linenoiseGrow(struct linenoiseState *ls, size_t n) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static size_t linenoiseMaxCompletionLength(linenoiseCompletions *lc) {
|
||||
static wint_t ScrubCompletionCharacter(wint_t c) {
|
||||
if ((0x00 <= c && c <= 0x1F) || c == 0x7F) {
|
||||
return kCp437[c];
|
||||
} else {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t linenoiseMaxCompletionWidth(linenoiseCompletions *lc) {
|
||||
size_t i, n, m;
|
||||
for (m = i = 0; i < lc->len; ++i) {
|
||||
n = strlen(lc->cvec[i]);
|
||||
n = GetMonospaceWidth(lc->cvec[i], strlen(lc->cvec[i]), 0);
|
||||
m = MAX(n, m);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
static size_t Forward(struct linenoiseState *l, size_t pos) {
|
||||
return pos + GetUtf8(l->buf + pos, l->len - pos).n;
|
||||
}
|
||||
|
||||
static size_t Backward(struct linenoiseState *l, size_t pos) {
|
||||
if (pos) {
|
||||
do --pos;
|
||||
while (pos && (l->buf[pos] & 0300) == 0200);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static size_t Backwards(struct linenoiseState *l, size_t pos,
|
||||
int pred(wint_t)) {
|
||||
size_t i;
|
||||
struct rune r;
|
||||
while (pos) {
|
||||
i = Backward(l, pos);
|
||||
r = GetUtf8(l->buf + i, l->len - i);
|
||||
if (pred(r.c)) {
|
||||
pos = i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static size_t Forwards(struct linenoiseState *l, size_t pos, int pred(wint_t)) {
|
||||
struct rune r;
|
||||
while (pos < l->len) {
|
||||
r = GetUtf8(l->buf + pos, l->len - pos);
|
||||
if (pred(r.c)) {
|
||||
pos += r.n;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static size_t GetCommonPrefixLength(struct linenoiseCompletions *lc) {
|
||||
struct rune r;
|
||||
int i, j, n, c;
|
||||
i = 0;
|
||||
for (n = -1, i = 0; i < lc->len; ++i) {
|
||||
if (n != -1) {
|
||||
n = strnlen(lc->cvec[i], n);
|
||||
} else {
|
||||
n = strlen(lc->cvec[i]);
|
||||
}
|
||||
}
|
||||
for (i = 0, r.n = 0; i < n; i += r.n) {
|
||||
for (c = -1, j = 0; j < lc->len; ++j) {
|
||||
r = GetUtf8(lc->cvec[j] + i, n - i);
|
||||
if (c != -1) {
|
||||
if (r.c != c) {
|
||||
goto Finished;
|
||||
}
|
||||
} else {
|
||||
c = r.c;
|
||||
}
|
||||
}
|
||||
}
|
||||
Finished:
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs tab completion similar in behavior to bash and readline.
|
||||
*/
|
||||
static ssize_t linenoiseCompleteLine(struct linenoiseState *ls, char *seq,
|
||||
int size) {
|
||||
char *s;
|
||||
ssize_t nread;
|
||||
struct abuf ab;
|
||||
linenoiseCompletions lc;
|
||||
struct linenoiseState saved;
|
||||
size_t i, j, k, n, perline, itemlen;
|
||||
size_t i, j, k, n, m, perline, itemlen;
|
||||
// we know that the user pressed tab once
|
||||
nread = 0;
|
||||
bzero(&lc, sizeof(lc));
|
||||
completionCallback(ls->buf, &lc);
|
||||
if (lc.len == 1) {
|
||||
// if there's a single completion, complete it, and return
|
||||
n = strlen(lc.cvec[0]);
|
||||
i = Backwards(ls, ls->pos, iswname);
|
||||
j = Forwards(ls, ls->pos, iswname);
|
||||
s = strndup(ls->buf + i, j - i);
|
||||
completionCallback(s, &lc);
|
||||
m = GetCommonPrefixLength(&lc);
|
||||
if (m > j - i) {
|
||||
// on common prefix (or single completion) we complete and return
|
||||
n = i + m + (ls->len - j);
|
||||
if (linenoiseGrow(ls, n + 1)) {
|
||||
memcpy(ls->buf, lc.cvec[0], n + 1);
|
||||
memmove(ls->buf + i + m, ls->buf + i + j, ls->len - j + 1);
|
||||
memcpy(ls->buf + i, lc.cvec[0], m);
|
||||
ls->len = ls->pos = n;
|
||||
}
|
||||
linenoiseRefreshLine(ls);
|
||||
|
@ -853,10 +950,15 @@ static ssize_t linenoiseCompleteLine(struct linenoiseState *ls, char *seq,
|
|||
// if there's a multiline completions, then do nothing and wait and
|
||||
// see if the user presses tab again. if the user does this we then
|
||||
// print ALL the completions, to above the editing line
|
||||
for (i = 0; i < lc.len; ++i) {
|
||||
s = lc.cvec[i];
|
||||
lc.cvec[i] = VisualizeControlCodes(s, -1, 0);
|
||||
free(s);
|
||||
}
|
||||
for (;;) {
|
||||
nread = linenoiseRead(ls->ifd, seq, size, ls);
|
||||
if (nread == 1 && seq[0] == '\t') {
|
||||
itemlen = linenoiseMaxCompletionLength(&lc) + 4;
|
||||
itemlen = linenoiseMaxCompletionWidth(&lc) + 4;
|
||||
perline = MAX(1, (ls->ws.ws_col - 1) / itemlen);
|
||||
abInit(&ab);
|
||||
abAppends(&ab, "\r\n\033[K");
|
||||
|
@ -1039,18 +1141,6 @@ static char *linenoiseRefreshHints(struct linenoiseState *l) {
|
|||
return ab.b;
|
||||
}
|
||||
|
||||
static size_t Forward(struct linenoiseState *l, size_t pos) {
|
||||
return pos + GetUtf8(l->buf + pos, l->len - pos).n;
|
||||
}
|
||||
|
||||
static size_t Backward(struct linenoiseState *l, size_t pos) {
|
||||
if (pos) {
|
||||
do --pos;
|
||||
while (pos && (l->buf[pos] & 0300) == 0200);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int linenoiseMirrorLeft(struct linenoiseState *l, unsigned res[2]) {
|
||||
unsigned c, pos, left, right, depth, index;
|
||||
if ((pos = Backward(l, l->pos))) {
|
||||
|
@ -1350,35 +1440,6 @@ static void linenoiseEditRefresh(struct linenoiseState *l) {
|
|||
linenoiseRefreshLine(l);
|
||||
}
|
||||
|
||||
static size_t Backwards(struct linenoiseState *l, size_t pos,
|
||||
int pred(wint_t)) {
|
||||
size_t i;
|
||||
struct rune r;
|
||||
while (pos) {
|
||||
i = Backward(l, pos);
|
||||
r = GetUtf8(l->buf + i, l->len - i);
|
||||
if (pred(r.c)) {
|
||||
pos = i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static size_t Forwards(struct linenoiseState *l, size_t pos, int pred(wint_t)) {
|
||||
struct rune r;
|
||||
while (pos < l->len) {
|
||||
r = GetUtf8(l->buf + pos, l->len - pos);
|
||||
if (pred(r.c)) {
|
||||
pos += r.n;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static size_t ForwardWord(struct linenoiseState *l, size_t pos) {
|
||||
pos = Forwards(l, pos, iswseparator);
|
||||
pos = Forwards(l, pos, notwseparator);
|
||||
|
@ -1711,6 +1772,145 @@ static void linenoiseEditCtrlq(struct linenoiseState *l) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves last item inside current s-expression to outside, e.g.
|
||||
*
|
||||
* (a| b c)
|
||||
* (a| b) c
|
||||
*
|
||||
* The cursor position changes only if a paren is moved before it:
|
||||
*
|
||||
* (a b c |)
|
||||
* (a b) c |
|
||||
*
|
||||
* To accommodate non-LISP languages we connect unspaced outer symbols:
|
||||
*
|
||||
* f(a,| b, g())
|
||||
* f(a,| b), g()
|
||||
*
|
||||
* Our standard keybinding is ALT-SHIFT-B.
|
||||
*/
|
||||
static void linenoiseEditBarf(struct linenoiseState *l) {
|
||||
struct rune r;
|
||||
unsigned long w;
|
||||
size_t i, pos, depth = 0;
|
||||
unsigned lhs, rhs, end, *stack = 0;
|
||||
/* go as far right within current s-expr as possible */
|
||||
for (pos = l->pos;; pos += r.n) {
|
||||
if (pos == l->len) goto Finish;
|
||||
r = GetUtf8(l->buf + pos, l->len - pos);
|
||||
if (depth) {
|
||||
if (r.c == stack[depth - 1]) {
|
||||
--depth;
|
||||
}
|
||||
} else {
|
||||
if ((rhs = GetMirrorRight(r.c))) {
|
||||
stack = (unsigned *)realloc(stack, ++depth * sizeof(*stack));
|
||||
stack[depth - 1] = rhs;
|
||||
} else if (GetMirrorLeft(r.c)) {
|
||||
end = pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* go back one item */
|
||||
pos = Backwards(l, pos, isxseparator);
|
||||
for (;; pos = i) {
|
||||
if (!pos) goto Finish;
|
||||
i = Backward(l, pos);
|
||||
r = GetUtf8(l->buf + i, l->len - i);
|
||||
if (depth) {
|
||||
if (r.c == stack[depth - 1]) {
|
||||
--depth;
|
||||
}
|
||||
} else {
|
||||
if ((lhs = GetMirrorLeft(r.c))) {
|
||||
stack = (unsigned *)realloc(stack, ++depth * sizeof(*stack));
|
||||
stack[depth - 1] = lhs;
|
||||
} else if (iswseparator(r.c)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos = Backwards(l, pos, isxseparator);
|
||||
/* now move the text */
|
||||
r = GetUtf8(l->buf + end, l->len - end);
|
||||
memmove(l->buf + pos + r.n, l->buf + pos, end - pos);
|
||||
w = tpenc(r.c);
|
||||
for (i = 0; i < r.n; ++i) {
|
||||
l->buf[pos + i] = w;
|
||||
w >>= 8;
|
||||
}
|
||||
if (l->pos > pos) {
|
||||
l->pos += r.n;
|
||||
}
|
||||
linenoiseRefreshLine(l);
|
||||
Finish:
|
||||
free(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves first item outside current s-expression to inside, e.g.
|
||||
*
|
||||
* (a| b) c d
|
||||
* (a| b c) d
|
||||
*
|
||||
* To accommodate non-LISP languages we connect unspaced outer symbols:
|
||||
*
|
||||
* f(a,| b), g()
|
||||
* f(a,| b, g())
|
||||
*
|
||||
* Our standard keybinding is ALT-SHIFT-S.
|
||||
*/
|
||||
static void linenoiseEditSlurp(struct linenoiseState *l) {
|
||||
char rp[6];
|
||||
struct rune r;
|
||||
size_t pos, depth = 0;
|
||||
unsigned rhs, point = 0, start = 0, *stack = 0;
|
||||
/* go to outside edge of current s-expr */
|
||||
for (pos = l->pos; pos < l->len; pos += r.n) {
|
||||
r = GetUtf8(l->buf + pos, l->len - pos);
|
||||
if (depth) {
|
||||
if (r.c == stack[depth - 1]) {
|
||||
--depth;
|
||||
}
|
||||
} else {
|
||||
if ((rhs = GetMirrorRight(r.c))) {
|
||||
stack = (unsigned *)realloc(stack, ++depth * sizeof(*stack));
|
||||
stack[depth - 1] = rhs;
|
||||
} else if (GetMirrorLeft(r.c)) {
|
||||
point = pos;
|
||||
pos += r.n;
|
||||
start = pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* go forward one item */
|
||||
pos = Forwards(l, pos, isxseparator);
|
||||
for (; pos < l->len; pos += r.n) {
|
||||
r = GetUtf8(l->buf + pos, l->len - pos);
|
||||
if (depth) {
|
||||
if (r.c == stack[depth - 1]) {
|
||||
--depth;
|
||||
}
|
||||
} else {
|
||||
if ((rhs = GetMirrorRight(r.c))) {
|
||||
stack = (unsigned *)realloc(stack, ++depth * sizeof(*stack));
|
||||
stack[depth - 1] = rhs;
|
||||
} else if (iswseparator(r.c)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* now move the text */
|
||||
memcpy(rp, l->buf + point, start - point);
|
||||
memmove(l->buf + point, l->buf + start, pos - start);
|
||||
memcpy(l->buf + pos - (start - point), rp, start - point);
|
||||
linenoiseRefreshLine(l);
|
||||
free(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs linenoise engine.
|
||||
*
|
||||
|
@ -1782,10 +1982,19 @@ static ssize_t linenoiseEdit(int stdin_fd, int stdout_fd, const char *prompt,
|
|||
CASE(CTRL('L'), linenoiseEditRefresh(&l));
|
||||
CASE(CTRL('Z'), linenoiseEditSuspend(&l));
|
||||
CASE(CTRL('U'), linenoiseEditKillLeft(&l));
|
||||
CASE(CTRL('C'), linenoiseEditInterrupt(&l));
|
||||
CASE(CTRL('T'), linenoiseEditTranspose(&l));
|
||||
CASE(CTRL('K'), linenoiseEditKillRight(&l));
|
||||
CASE(CTRL('W'), linenoiseEditRuboutWord(&l));
|
||||
case CTRL('C'):
|
||||
if (linenoiseRead(l.ifd, seq, sizeof(seq), &l) != 1) break;
|
||||
switch (seq[0]) {
|
||||
CASE(CTRL('C'), linenoiseEditInterrupt(&l));
|
||||
CASE(CTRL('B'), linenoiseEditBarf(&l));
|
||||
CASE(CTRL('S'), linenoiseEditSlurp(&l));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CTRL('X'):
|
||||
if (l.seq[1][0] == CTRL('X')) {
|
||||
linenoiseEditGoto(&l);
|
||||
|
|
3
third_party/linenoise/linenoise.mk
vendored
3
third_party/linenoise/linenoise.mk
vendored
|
@ -28,7 +28,8 @@ THIRD_PARTY_LINENOISE_A_DIRECTDEPS = \
|
|||
LIBC_SYSV_CALLS \
|
||||
LIBC_STR \
|
||||
LIBC_UNICODE \
|
||||
LIBC_STUBS
|
||||
LIBC_STUBS \
|
||||
NET_HTTP
|
||||
|
||||
THIRD_PARTY_LINENOISE_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_LINENOISE_A_DIRECTDEPS),$($(x))))
|
||||
|
|
54
third_party/python/Modules/_pickle.c
vendored
54
third_party/python/Modules/_pickle.c
vendored
|
@ -653,7 +653,7 @@ typedef struct PicklerObject {
|
|||
is an unbound method, NULL otherwise */
|
||||
PyObject *dispatch_table; /* private dispatch_table, can be NULL */
|
||||
|
||||
PyObject *write; /* write() method of the output stream. */
|
||||
PyObject *write_; /* write() method of the output stream. */
|
||||
PyObject *output_buffer; /* Write into a local bytearray buffer before
|
||||
flushing to the stream. */
|
||||
Py_ssize_t output_len; /* Length of output_buffer. */
|
||||
|
@ -699,7 +699,7 @@ typedef struct UnpicklerObject {
|
|||
Py_ssize_t next_read_idx;
|
||||
Py_ssize_t prefetched_idx; /* index of first prefetched byte */
|
||||
|
||||
PyObject *read; /* read() method of the input stream. */
|
||||
PyObject *read_; /* read() method of the input stream. */
|
||||
PyObject *readline; /* readline() method of the input stream. */
|
||||
PyObject *peek; /* peek() method of the input stream, or NULL */
|
||||
|
||||
|
@ -1045,14 +1045,14 @@ _Pickler_FlushToFile(PicklerObject *self)
|
|||
{
|
||||
PyObject *output, *result;
|
||||
|
||||
assert(self->write != NULL);
|
||||
assert(self->write_ != NULL);
|
||||
|
||||
/* This will commit the frame first */
|
||||
output = _Pickler_GetString(self);
|
||||
if (output == NULL)
|
||||
return -1;
|
||||
|
||||
result = _Pickle_FastCall(self->write, output);
|
||||
result = _Pickle_FastCall(self->write_, output);
|
||||
Py_XDECREF(result);
|
||||
return (result == NULL) ? -1 : 0;
|
||||
}
|
||||
|
@ -1118,7 +1118,7 @@ _Pickler_New(void)
|
|||
|
||||
self->pers_func = NULL;
|
||||
self->dispatch_table = NULL;
|
||||
self->write = NULL;
|
||||
self->write_ = NULL;
|
||||
self->proto = 0;
|
||||
self->bin = 0;
|
||||
self->framing = 0;
|
||||
|
@ -1175,8 +1175,8 @@ _Pickler_SetOutputStream(PicklerObject *self, PyObject *file)
|
|||
{
|
||||
_Py_IDENTIFIER(write);
|
||||
assert(file != NULL);
|
||||
self->write = _PyObject_GetAttrId(file, &PyId_write);
|
||||
if (self->write == NULL) {
|
||||
self->write_ = _PyObject_GetAttrId(file, &PyId_write);
|
||||
if (self->write_ == NULL) {
|
||||
if (PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"file must have a 'write' attribute");
|
||||
|
@ -1222,7 +1222,7 @@ _Unpickler_SkipConsumed(UnpicklerObject *self)
|
|||
|
||||
assert(self->peek); /* otherwise we did something wrong */
|
||||
/* This makes a useless copy... */
|
||||
r = PyObject_CallFunction(self->read, "n", consumed);
|
||||
r = PyObject_CallFunction(self->read_, "n", consumed);
|
||||
if (r == NULL)
|
||||
return -1;
|
||||
Py_DECREF(r);
|
||||
|
@ -1253,7 +1253,7 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
|
|||
PyObject *data;
|
||||
Py_ssize_t read_size;
|
||||
|
||||
assert(self->read != NULL);
|
||||
assert(self->read_ != NULL);
|
||||
|
||||
if (_Unpickler_SkipConsumed(self) < 0)
|
||||
return -1;
|
||||
|
@ -1287,7 +1287,7 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
|
|||
len = PyLong_FromSsize_t(n);
|
||||
if (len == NULL)
|
||||
return -1;
|
||||
data = _Pickle_FastCall(self->read, len);
|
||||
data = _Pickle_FastCall(self->read_, len);
|
||||
}
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
|
@ -1314,7 +1314,7 @@ _Unpickler_ReadImpl(UnpicklerObject *self, char **s, Py_ssize_t n)
|
|||
/* This case is handled by the _Unpickler_Read() macro for efficiency */
|
||||
assert(self->next_read_idx + n > self->input_len);
|
||||
|
||||
if (!self->read)
|
||||
if (!self->read_)
|
||||
return bad_readline();
|
||||
|
||||
num_read = _Unpickler_ReadFromFile(self, n);
|
||||
|
@ -1381,7 +1381,7 @@ _Unpickler_Readline(UnpicklerObject *self, char **result)
|
|||
return _Unpickler_CopyLine(self, line_start, num_read, result);
|
||||
}
|
||||
}
|
||||
if (!self->read)
|
||||
if (!self->read_)
|
||||
return bad_readline();
|
||||
|
||||
num_read = _Unpickler_ReadFromFile(self, READ_WHOLE_LINE);
|
||||
|
@ -1493,7 +1493,7 @@ _Unpickler_New(void)
|
|||
self->input_len = 0;
|
||||
self->next_read_idx = 0;
|
||||
self->prefetched_idx = 0;
|
||||
self->read = NULL;
|
||||
self->read_ = NULL;
|
||||
self->readline = NULL;
|
||||
self->peek = NULL;
|
||||
self->encoding = NULL;
|
||||
|
@ -1533,13 +1533,13 @@ _Unpickler_SetInputStream(UnpicklerObject *self, PyObject *file)
|
|||
else
|
||||
return -1;
|
||||
}
|
||||
self->read = _PyObject_GetAttrId(file, &PyId_read);
|
||||
self->read_ = _PyObject_GetAttrId(file, &PyId_read);
|
||||
self->readline = _PyObject_GetAttrId(file, &PyId_readline);
|
||||
if (self->readline == NULL || self->read == NULL) {
|
||||
if (self->readline == NULL || self->read_ == NULL) {
|
||||
if (PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"file must have 'read' and 'readline' attributes");
|
||||
Py_CLEAR(self->read);
|
||||
Py_CLEAR(self->read_);
|
||||
Py_CLEAR(self->readline);
|
||||
Py_CLEAR(self->peek);
|
||||
return -1;
|
||||
|
@ -4158,7 +4158,7 @@ _pickle_Pickler_dump(PicklerObject *self, PyObject *obj)
|
|||
/* Check whether the Pickler was initialized correctly (issue3664).
|
||||
Developers often forget to call __init__() in their subclasses, which
|
||||
would trigger a segfault without this check. */
|
||||
if (self->write == NULL) {
|
||||
if (self->write_ == NULL) {
|
||||
PickleState *st = _Pickle_GetGlobalState();
|
||||
PyErr_Format(st->PicklingError,
|
||||
"Pickler.__init__() was not called by %s.__init__()",
|
||||
|
@ -4218,7 +4218,7 @@ Pickler_dealloc(PicklerObject *self)
|
|||
PyObject_GC_UnTrack(self);
|
||||
|
||||
Py_XDECREF(self->output_buffer);
|
||||
Py_XDECREF(self->write);
|
||||
Py_XDECREF(self->write_);
|
||||
Py_XDECREF(self->pers_func);
|
||||
Py_XDECREF(self->dispatch_table);
|
||||
Py_XDECREF(self->fast_memo);
|
||||
|
@ -4231,7 +4231,7 @@ Pickler_dealloc(PicklerObject *self)
|
|||
static int
|
||||
Pickler_traverse(PicklerObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(self->write);
|
||||
Py_VISIT(self->write_);
|
||||
Py_VISIT(self->pers_func);
|
||||
Py_VISIT(self->dispatch_table);
|
||||
Py_VISIT(self->fast_memo);
|
||||
|
@ -4242,7 +4242,7 @@ static int
|
|||
Pickler_clear(PicklerObject *self)
|
||||
{
|
||||
Py_CLEAR(self->output_buffer);
|
||||
Py_CLEAR(self->write);
|
||||
Py_CLEAR(self->write_);
|
||||
Py_CLEAR(self->pers_func);
|
||||
Py_CLEAR(self->dispatch_table);
|
||||
Py_CLEAR(self->fast_memo);
|
||||
|
@ -4293,7 +4293,7 @@ _pickle_Pickler___init___impl(PicklerObject *self, PyObject *file,
|
|||
_Py_IDENTIFIER(dispatch_table);
|
||||
|
||||
/* In case of multiple __init__() calls, clear previous content. */
|
||||
if (self->write != NULL)
|
||||
if (self->write_ != NULL)
|
||||
(void)Pickler_clear(self);
|
||||
|
||||
if (_Pickler_SetProtocol(self, protocol, fix_imports) < 0)
|
||||
|
@ -6514,9 +6514,9 @@ _pickle_Unpickler_load_impl(UnpicklerObject *self)
|
|||
|
||||
/* Check whether the Unpickler was initialized correctly. This prevents
|
||||
segfaulting if a subclass overridden __init__ with a function that does
|
||||
not call Unpickler.__init__(). Here, we simply ensure that self->read
|
||||
not call Unpickler.__init__(). Here, we simply ensure that self->read_
|
||||
is not NULL. */
|
||||
if (unpickler->read == NULL) {
|
||||
if (unpickler->read_ == NULL) {
|
||||
PickleState *st = _Pickle_GetGlobalState();
|
||||
PyErr_Format(st->UnpicklingError,
|
||||
"Unpickler.__init__() was not called by %s.__init__()",
|
||||
|
@ -6676,7 +6676,7 @@ Unpickler_dealloc(UnpicklerObject *self)
|
|||
{
|
||||
PyObject_GC_UnTrack((PyObject *)self);
|
||||
Py_XDECREF(self->readline);
|
||||
Py_XDECREF(self->read);
|
||||
Py_XDECREF(self->read_);
|
||||
Py_XDECREF(self->peek);
|
||||
Py_XDECREF(self->stack);
|
||||
Py_XDECREF(self->pers_func);
|
||||
|
@ -6698,7 +6698,7 @@ static int
|
|||
Unpickler_traverse(UnpicklerObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(self->readline);
|
||||
Py_VISIT(self->read);
|
||||
Py_VISIT(self->read_);
|
||||
Py_VISIT(self->peek);
|
||||
Py_VISIT(self->stack);
|
||||
Py_VISIT(self->pers_func);
|
||||
|
@ -6709,7 +6709,7 @@ static int
|
|||
Unpickler_clear(UnpicklerObject *self)
|
||||
{
|
||||
Py_CLEAR(self->readline);
|
||||
Py_CLEAR(self->read);
|
||||
Py_CLEAR(self->read_);
|
||||
Py_CLEAR(self->peek);
|
||||
Py_CLEAR(self->stack);
|
||||
Py_CLEAR(self->pers_func);
|
||||
|
@ -6772,7 +6772,7 @@ _pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file,
|
|||
_Py_IDENTIFIER(persistent_load);
|
||||
|
||||
/* In case of multiple __init__() calls, clear previous content. */
|
||||
if (self->read != NULL)
|
||||
if (self->read_ != NULL)
|
||||
(void)Unpickler_clear(self);
|
||||
|
||||
if (_Unpickler_SetInputStream(self, file) < 0)
|
||||
|
|
48
third_party/python/Modules/expat/xmlparse.c
vendored
48
third_party/python/Modules/expat/xmlparse.c
vendored
|
@ -219,7 +219,7 @@ typedef struct {
|
|||
const XML_Char *base;
|
||||
const XML_Char *publicId;
|
||||
const XML_Char *notation;
|
||||
XML_Bool open;
|
||||
XML_Bool open_;
|
||||
XML_Bool is_param;
|
||||
XML_Bool is_internal; /* true if declared in internal subset outside PE */
|
||||
} ENTITY;
|
||||
|
@ -2276,7 +2276,7 @@ static enum XML_Error doContent(XML_Parser parser, int startTagLevel,
|
|||
reportDefault(parser, enc, s, next);
|
||||
break;
|
||||
}
|
||||
if (entity->open) return XML_ERROR_RECURSIVE_ENTITY_REF;
|
||||
if (entity->open_) return XML_ERROR_RECURSIVE_ENTITY_REF;
|
||||
if (entity->notation) return XML_ERROR_BINARY_ENTITY_REF;
|
||||
if (entity->textPtr) {
|
||||
enum XML_Error result;
|
||||
|
@ -2292,9 +2292,9 @@ static enum XML_Error doContent(XML_Parser parser, int startTagLevel,
|
|||
if (result != XML_ERROR_NONE) return result;
|
||||
} else if (parser->m_externalEntityRefHandler) {
|
||||
const XML_Char *context;
|
||||
entity->open = XML_TRUE;
|
||||
entity->open_ = XML_TRUE;
|
||||
context = getContext(parser);
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
if (!context) return XML_ERROR_NO_MEMORY;
|
||||
if (!parser->m_externalEntityRefHandler(
|
||||
parser->m_externalEntityRefHandlerArg, context, entity->base,
|
||||
|
@ -4417,7 +4417,7 @@ static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc,
|
|||
}
|
||||
break;
|
||||
}
|
||||
if (entity->open) return XML_ERROR_RECURSIVE_ENTITY_REF;
|
||||
if (entity->open_) return XML_ERROR_RECURSIVE_ENTITY_REF;
|
||||
if (entity->textPtr) {
|
||||
enum XML_Error result;
|
||||
XML_Bool betweenDecl =
|
||||
|
@ -4429,14 +4429,14 @@ static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc,
|
|||
}
|
||||
if (parser->m_externalEntityRefHandler) {
|
||||
dtd->paramEntityRead = XML_FALSE;
|
||||
entity->open = XML_TRUE;
|
||||
entity->open_ = XML_TRUE;
|
||||
if (!parser->m_externalEntityRefHandler(
|
||||
parser->m_externalEntityRefHandlerArg, 0, entity->base,
|
||||
entity->systemId, entity->publicId)) {
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
|
||||
}
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
handleDefault = XML_FALSE;
|
||||
if (!dtd->paramEntityRead) {
|
||||
dtd->keepProcessing = dtd->standalone;
|
||||
|
@ -4692,7 +4692,7 @@ static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity,
|
|||
(OPEN_INTERNAL_ENTITY *)MALLOC(parser, sizeof(OPEN_INTERNAL_ENTITY));
|
||||
if (!openEntity) return XML_ERROR_NO_MEMORY;
|
||||
}
|
||||
entity->open = XML_TRUE;
|
||||
entity->open_ = XML_TRUE;
|
||||
entity->processed = 0;
|
||||
openEntity->next = parser->m_openInternalEntities;
|
||||
parser->m_openInternalEntities = openEntity;
|
||||
|
@ -4722,7 +4722,7 @@ static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity,
|
|||
entity->processed = (int)(next - textStart);
|
||||
parser->m_processor = internalEntityProcessor;
|
||||
} else {
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
parser->m_openInternalEntities = openEntity->next;
|
||||
/* put openEntity back in list of free instances */
|
||||
openEntity->next = parser->m_freeInternalEntities;
|
||||
|
@ -4768,7 +4768,7 @@ static enum XML_Error internalEntityProcessor(XML_Parser parser,
|
|||
entity->processed = (int)(next - (char *)entity->textPtr);
|
||||
return result;
|
||||
} else {
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
parser->m_openInternalEntities = openEntity->next;
|
||||
/* put openEntity back in list of free instances */
|
||||
openEntity->next = parser->m_freeInternalEntities;
|
||||
|
@ -4915,11 +4915,11 @@ static enum XML_Error appendAttributeValue(XML_Parser parser,
|
|||
*/
|
||||
break;
|
||||
}
|
||||
if (entity->open) {
|
||||
if (entity->open_) {
|
||||
if (enc == parser->m_encoding) {
|
||||
/* It does not appear that this line can be executed.
|
||||
*
|
||||
* The "if (entity->open)" check catches recursive entity
|
||||
* The "if (entity->open_)" check catches recursive entity
|
||||
* definitions. In order to be called with an open
|
||||
* entity, it must have gone through this code before and
|
||||
* been through the recursive call to
|
||||
|
@ -4928,7 +4928,7 @@ static enum XML_Error appendAttributeValue(XML_Parser parser,
|
|||
* internal encoding (internal_utf8 or internal_utf16),
|
||||
* which can never be the same as the principle encoding.
|
||||
* It doesn't appear there is another code path that gets
|
||||
* here with entity->open being TRUE.
|
||||
* here with entity->open_ being TRUE.
|
||||
*
|
||||
* Since it is not certain that this logic is watertight,
|
||||
* we keep the line and merely exclude it from coverage
|
||||
|
@ -4948,11 +4948,11 @@ static enum XML_Error appendAttributeValue(XML_Parser parser,
|
|||
} else {
|
||||
enum XML_Error result;
|
||||
const XML_Char *textEnd = entity->textPtr + entity->textLen;
|
||||
entity->open = XML_TRUE;
|
||||
entity->open_ = XML_TRUE;
|
||||
result = appendAttributeValue(parser, parser->m_internalEncoding,
|
||||
isCdata, (char *)entity->textPtr,
|
||||
(char *)textEnd, pool);
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
if (result) return result;
|
||||
}
|
||||
} break;
|
||||
|
@ -5022,7 +5022,7 @@ static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc,
|
|||
dtd->keepProcessing = dtd->standalone;
|
||||
goto endEntityValue;
|
||||
}
|
||||
if (entity->open) {
|
||||
if (entity->open_) {
|
||||
if (enc == parser->m_encoding) parser->m_eventPtr = entityTextPtr;
|
||||
result = XML_ERROR_RECURSIVE_ENTITY_REF;
|
||||
goto endEntityValue;
|
||||
|
@ -5030,24 +5030,24 @@ static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc,
|
|||
if (entity->systemId) {
|
||||
if (parser->m_externalEntityRefHandler) {
|
||||
dtd->paramEntityRead = XML_FALSE;
|
||||
entity->open = XML_TRUE;
|
||||
entity->open_ = XML_TRUE;
|
||||
if (!parser->m_externalEntityRefHandler(
|
||||
parser->m_externalEntityRefHandlerArg, 0, entity->base,
|
||||
entity->systemId, entity->publicId)) {
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
result = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
|
||||
goto endEntityValue;
|
||||
}
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
if (!dtd->paramEntityRead) dtd->keepProcessing = dtd->standalone;
|
||||
} else
|
||||
dtd->keepProcessing = dtd->standalone;
|
||||
} else {
|
||||
entity->open = XML_TRUE;
|
||||
entity->open_ = XML_TRUE;
|
||||
result = storeEntityValue(
|
||||
parser, parser->m_internalEncoding, (char *)entity->textPtr,
|
||||
(char *)(entity->textPtr + entity->textLen));
|
||||
entity->open = XML_FALSE;
|
||||
entity->open_ = XML_FALSE;
|
||||
if (result) goto endEntityValue;
|
||||
}
|
||||
break;
|
||||
|
@ -5431,7 +5431,7 @@ static const XML_Char *getContext(XML_Parser parser) {
|
|||
const XML_Char *s;
|
||||
ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
|
||||
if (!e) break;
|
||||
if (!e->open) continue;
|
||||
if (!e->open_) continue;
|
||||
if (needSep && !poolAppendChar(&parser->m_tempPool, CONTEXT_SEP))
|
||||
return NULL;
|
||||
for (s = e->name; *s; s++)
|
||||
|
@ -5453,7 +5453,7 @@ static XML_Bool setContext(XML_Parser parser, const XML_Char *context) {
|
|||
if (!poolAppendChar(&parser->m_tempPool, XML_T('\0'))) return XML_FALSE;
|
||||
e = (ENTITY *)lookup(parser, &dtd->generalEntities,
|
||||
poolStart(&parser->m_tempPool), 0);
|
||||
if (e) e->open = XML_TRUE;
|
||||
if (e) e->open_ = XML_TRUE;
|
||||
if (*s != XML_T('\0')) s++;
|
||||
context = s;
|
||||
poolDiscard(&parser->m_tempPool);
|
||||
|
|
14
third_party/python/python.mk
vendored
14
third_party/python/python.mk
vendored
|
@ -4113,28 +4113,28 @@ $(THIRD_PARTY_PYTHON_STAGE2_A_DATA_OBJS): ZIPOBJ_FLAGS += -P.python -C3
|
|||
$(THIRD_PARTY_PYTHON_PYTEST_A_PYS_OBJS): PYFLAGS += -P.python -C3
|
||||
$(THIRD_PARTY_PYTHON_PYTEST_A_DATA_OBJS): ZIPOBJ_FLAGS += -P.python -C3
|
||||
|
||||
o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -C32 -M1024m
|
||||
o/$(MODE)/third_party/python/Objects/unicodeobject.o: QUOTA += -C32 -M1024m
|
||||
o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -C64 -M1024m
|
||||
o/$(MODE)/third_party/python/Objects/unicodeobject.o: QUOTA += -C64 -M1024m
|
||||
|
||||
o/$(MODE)/third_party/python/Parser/asdl_c.o: PYFLAGS += -m
|
||||
$(THIRD_PARTY_PYTHON_PYTEST_PYMAINS_OBJS): PYFLAGS += -t -P.python -C3
|
||||
$(THIRD_PARTY_PYTHON_PYTEST_TODOS:%.py=o/$(MODE)/%.o): PYFLAGS += -t -P.python -C3
|
||||
o/$(MODE)/third_party/python/Lib/test/pystone.o: PYFLAGS += -m -O2 -P.python -C4
|
||||
|
||||
o/$(MODE)/third_party/python/Lib/test/test_long.py.runs: QUOTA = -C32
|
||||
o/$(MODE)/third_party/python/Lib/test/test_hash.py.runs: QUOTA = -C32
|
||||
o/$(MODE)/third_party/python/Lib/test/test_exceptions.py.runs: QUOTA = -C32
|
||||
o/$(MODE)/third_party/python/Lib/test/test_long.py.runs: QUOTA = -C64
|
||||
o/$(MODE)/third_party/python/Lib/test/test_hash.py.runs: QUOTA = -C64
|
||||
o/$(MODE)/third_party/python/Lib/test/test_exceptions.py.runs: QUOTA = -C64
|
||||
o/$(MODE)/third_party/python/Lib/test/test_tuple.py.runs: QUOTA = -M512m
|
||||
o/$(MODE)/third_party/python/Lib/test/test_decimal.py.runs: QUOTA = -M512m -C64
|
||||
o/$(MODE)/third_party/python/Lib/test/test_longexp.py.runs: QUOTA = -M1024m
|
||||
o/$(MODE)/third_party/python/Lib/test/test_unicode.py.runs: QUOTA = -M1400m
|
||||
o/$(MODE)/third_party/python/Lib/test/test_unicodedata.py.runs: QUOTA = -C32
|
||||
o/$(MODE)/third_party/python/Lib/test/test_unicodedata.py.runs: QUOTA = -C64
|
||||
o/$(MODE)/third_party/python/Lib/test/test_logging.py.runs: QUOTA = -M512m
|
||||
o/$(MODE)/third_party/python/Lib/test/test_itertools.py.runs: QUOTA = -M1024m
|
||||
o/$(MODE)/third_party/python/Lib/test/test_tarfile.py.runs: QUOTA = -L120 -C64
|
||||
o/$(MODE)/third_party/python/Lib/test/test_sqlite.py.runs: QUOTA = -L120
|
||||
o/$(MODE)/third_party/python/Lib/test/test_gzip.py.runs: QUOTA = -L120
|
||||
o/$(MODE)/third_party/python/Lib/test/test_email/test_email.py.runs: QUOTA = -C16 -M1024m
|
||||
o/$(MODE)/third_party/python/Lib/test/test_email/test_email.py.runs: QUOTA = -C32 -M1024m
|
||||
|
||||
THIRD_PARTY_PYTHON_LIBS = \
|
||||
$(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue