Skip to content

Commit ffb1bf3

Browse files
committed
Merge mainline into community
Conflicts: src/boot/platforms.r
2 parents 9535519 + 25033f8 commit ffb1bf3

13 files changed

+69
-14
lines changed

src/boot/natives.r

-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ remove-each: native [
272272
return: native [
273273
{Returns a value from a function.}
274274
value [any-type!]
275-
/redo {Upon return, re-evaluate the returned result. (Used for DO)}
276275
]
277276

278277
switch: native [

src/boot/platforms.r

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ REBOL [
1717
Amiga [1 m68k20+ 2 m68k 3 ppc]
1818
Macintosh [1 mac-ppc 2 mac-m68k 3 mac-misc 4 osx-ppc 5 osx-x86]
1919
Windows [1 win32-x86 2 dec-alpha 3 win32-x64]
20-
Linux [1 libc5-x86 2 libc6-2-3-x86 3 libc6-2-5-x86 4 libc6-2-11-x86 10 libc6-ppc 20 libc6-arm 30 libc6-mips 40 libc-x64]
20+
Linux [1 libc5-x86 2 libc6-2-3-x86 3 libc6-2-5-x86 4 libc6-2-11-x86 10 libc6-ppc 20 libc6-arm 21 bionic-arm 30 libc6-mips 40 libc-x64]
2121
Haiku [75 x86-32]
2222
BSDi [1 x86]
2323
FreeBSD [1 x86 2 elf-x86]

src/core/m-gc.c

+28-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@
8181
#include "sys-core.h"
8282
#include "reb-evtypes.h"
8383

84+
#ifdef REB_API
85+
extern REBOL_HOST_LIB *Host_Lib;
86+
#endif
87+
8488
//-- For Serious Debugging:
8589
#ifdef WATCH_GC_VALUE
8690
REBSER *Watcher = 0;
@@ -173,12 +177,32 @@ static void Mark_Series(REBSER *series, REBCNT depth);
173177
while(req) {
174178
// The ->port field of the REBREQ is void*, so we must cast
175179
// Comment says it is "link back to REBOL port object"
176-
CHECK_MARK((REBSER*)req->port, depth);
180+
if (req->port) CHECK_MARK((REBSER*)req->port, depth);
177181
req = req->next;
178182
}
179183
}
180184
}
181185

186+
/***********************************************************************
187+
**
188+
*/ static void Mark_Devices(REBCNT depth)
189+
/*
190+
** Mark all devices. Search for pending requests.
191+
**
192+
***********************************************************************/
193+
{
194+
int d;
195+
REBDEV *dev;
196+
REBREQ *req;
197+
REBDEV **devices = Host_Lib->devices;
198+
199+
for (d = 0; d < RDI_MAX; d++) {
200+
dev = devices[d];
201+
if (dev)
202+
for (req = dev->pending; req; req = req->next)
203+
if (req->port) CHECK_MARK((REBSER*)req->port, depth);
204+
}
205+
}
182206

183207
/***********************************************************************
184208
**
@@ -556,6 +580,9 @@ static void Mark_Series(REBSER *series, REBCNT depth);
556580
Mark_Series(VAL_SERIES(ROOT_ROOT), 0);
557581
Mark_Series(Task_Series, 0);
558582

583+
// Mark all devices:
584+
Mark_Devices(0);
585+
559586
count = Sweep_Series();
560587
count += Sweep_Gobs();
561588

src/core/n-control.c

-1
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,6 @@ enum {
687687
{
688688
REBVAL *arg = D_ARG(1);
689689

690-
if (D_REF(2)) VAL_SET_OPT(arg, OPTS_REVAL);
691690
SET_THROW(ds, RE_RETURN, arg);
692691
return R_RET;
693692
}

src/core/n-system.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -443,19 +443,21 @@ REBYTE *evoke_help = "Evoke values:\n"
443443
case CODI_CHECK:
444444
return R_TRUE;
445445

446-
case CODI_BINARY:
447-
case CODI_TEXT:
446+
case CODI_BINARY: //used on encode
447+
case CODI_TEXT: //used on decode
448448
ser = Make_Binary(codi.len);
449449
ser->tail = codi.len;
450450
memcpy(BIN_HEAD(ser), codi.data, codi.len);
451451
Set_Binary(D_RET, ser);
452452
if (result != CODI_BINARY) VAL_SET(D_RET, REB_STRING);
453-
454-
// See notice in reb-codec.h on reb_codec_image
455-
Free_Mem(codi.data, codi.len);
453+
454+
//don't free the text binary input buffer during decode (it's the 3rd arg value in fact)
455+
if (result == CODI_BINARY)
456+
// See notice in reb-codec.h on reb_codec_image
457+
Free_Mem(codi.data, codi.len);
456458
break;
457459

458-
case CODI_IMAGE:
460+
case CODI_IMAGE: //used on decode
459461
ser = Make_Image(codi.w, codi.h, TRUE); // Puts it into RETURN stack position
460462
memcpy(IMG_DATA(ser), codi.bits, codi.w * codi.h * 4);
461463
SET_IMAGE(D_RET, ser);

src/core/u-parse.c

+5
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,11 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
527527
i = Find_Str_Char(series, 0, index, series->tail, 1, VAL_CHAR(item), HAS_CASE(parse));
528528
if (i != NOT_FOUND && is_thru) i++;
529529
}
530+
// bitset
531+
else if (IS_BITSET(item)) {
532+
i = Find_Str_Bitset(series, 0, index, series->tail, 1, VAL_BITSET(item), HAS_CASE(parse));
533+
if (i != NOT_FOUND && is_thru) i++;
534+
}
530535
}
531536
}
532537

src/core/u-zlib.c

+2
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
287287
}
288288
if (strm->zfree == Z_NULL) strm->zfree = zcfree;
289289

290+
if (!strm->checksum) strm->checksum = adler32;
291+
290292
if (level == Z_DEFAULT_COMPRESSION) level = 6;
291293
/* #ifdef FASTEST */
292294
/* level = 1; */

src/include/reb-codec.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@
3535
// of size (->w * ->h * 4). This will be freed by the
3636
// REBNATIVE(do_codec) in n-system.c
3737
//
38-
// If your codec routine returns CODI_BINARY or CODI_TEXT, it is
38+
// If your codec routine returns CODI_BINARY, it is
3939
// expected that the ->data field contains a block of memory
4040
// allocated with Make_Mem of size ->len. This will be freed by
4141
// the REBNATIVE(do_codec) in n-system.c
4242
//
43+
// If your codec routine returns CODI_TEXT, it is
44+
// expected that the ->data field is 3rd input binary! argument in
45+
// the REBNATIVE(do_codec) in n-system.c
46+
// so the deallocation is left to GC
47+
//
4348
typedef struct reb_codec_image {
4449
int action;
4550
int w;

src/mezz/base-funcs.r

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function: funct: func [
4141
body: copy/deep body
4242
; Collect all set-words in the body as words to be used as locals, and add
4343
; them to the spec. Don't include the words already in the spec or object.
44-
append spec collect-words/deep/set/ignore body either with [
44+
insert find/tail spec /local collect-words/deep/set/ignore body either with [
4545
; Make our own local object if a premade one is not provided
4646
unless object? object [object: make object! object]
4747
bind body object ; Bind any object words found in the body

src/mezz/mezz-func.r

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ closure: func [
3535
body: copy/deep body
3636
; Collect all set-words in the body as words to be used as locals, and add
3737
; them to the spec. Don't include the words already in the spec or object.
38-
append spec collect-words/deep/set/ignore body either with [
38+
insert find/tail spec /local collect-words/deep/set/ignore body either with [
3939
; Make our own local object if a premade one is not provided
4040
unless object? object [object: make object! object]
4141
bind body object ; Bind any object words found in the body

src/os/posix/dev-file.c

+8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@
5353
#define O_BINARY 0
5454
#endif
5555

56+
// The BSD legacy names S_IREAD/S_IWRITE are not defined on e.g. Android.
57+
#ifndef S_IREAD
58+
#define S_IREAD S_IRUSR
59+
#endif
60+
#ifndef S_IWRITE
61+
#define S_IWRITE S_IWUSR
62+
#endif
63+
5664
// NOTE: the code below assumes a file id will never by zero. This should
5765
// be safe. In posix, zero is stdin, which is handled by dev-stdio.c.
5866

src/tools/make-os-ext.r

+4-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ process: func [file] [
130130
remit {
131131
typedef struct REBOL_Host_Lib ^{
132132
int size;
133-
unsigned int ver_sum;}
133+
unsigned int ver_sum;
134+
REBDEV **devices;}
134135

135136
memit {
136137
extern REBOL_HOST_LIB *Host_Lib;
@@ -152,6 +153,7 @@ out: reduce [
152153
#define HOST_LIB_SUM } checksum/tcp to-binary xsum {
153154
#define HOST_LIB_SIZE } cnt {
154155
156+
extern REBDEV *Devices[];
155157
}
156158
rlib
157159
{
@@ -169,6 +171,7 @@ REBOL_HOST_LIB *Host_Lib;
169171
REBOL_HOST_LIB Host_Lib_Init = ^{ // Host library function vector table.
170172
HOST_LIB_SIZE,
171173
(HOST_LIB_VER << 16) + HOST_LIB_SUM,
174+
(REBDEV**)&Devices,
172175
}
173176
dlib
174177
{^};

src/tools/systems.r

+5
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,27 @@ systems: [
3030
[0.4.04 "linux" posix [+O2 HID LDL ST1 M32 -LM]] ; libc 2.11
3131
[0.4.10 "linux_ppc" posix [+O1 HID LDL ST1 -LM]]
3232
[0.4.20 "linux_arm" posix [+O2 HID LDL ST1 -LM]]
33+
[0.4.21 "linux_arm" posix [+O2 HID LDL ST1 -LM PIE]] ; bionic (Android)
3334
[0.4.30 "linux_mips" posix [+O2 HID LDL ST1 -LM]] ; glibc does not need C++
3435
[0.4.40 "linux_x64" posix [+O2 HID LDL ST1 -LM]]
3536
[0.5.75 "haiku" posix [+O2 ST1 NWK]]
3637
[0.7.02 "freebsd" posix [+O1 C++ ST1 -LM]]
3738
[0.9.04 "openbsd" posix [+O1 C++ ST1 -LM]]
39+
[0.13.01 "android_arm" android [HID F64 LDL LLOG -LM CST]]
3840
]
3941

4042
compile-flags: [
4143
+OS: "-Os" ; size optimize
4244
+O1: "-O1" ; full optimize
4345
+O2: "-O2" ; full optimize
4446
UNI: "-DUNICODE" ; win32 wants it
47+
CST: "-DCUSTOM_STARTUP" ; include custom startup script at host boot
4548
HID: "-fvisibility=hidden" ; all syms are hidden
4649
F64: "-D_FILE_OFFSET_BITS=64" ; allow larger files
4750
NPS: "-Wno-pointer-sign" ; OSX fix
4851
NSP: "-fno-stack-protector" ; avoid insert of functions names
4952
PIC: "-fPIC" ; position independent (used for libs)
53+
PIE: "-fPIE" ; position independent (executables)
5054
DYN: "-dynamic" ; optimize for dll??
5155
NCM: "-fno-common" ; lib cannot have common vars
5256
PAK: "-fpack-struct" ; pack structures
@@ -59,6 +63,7 @@ linker-flags: [
5963
STA: "--strip-all"
6064
C++: "-lstdc++" ; link with stdc++
6165
LDL: "-ldl" ; link with dynamic lib lib
66+
LLOG: "-llog" ; on Android, link with liblog.so
6267
ARC: "-arch i386" ; x86 32 bit architecture (OSX)
6368
M32: "-m32" ; use 32-bit memory model (Linux x64)
6469
W32: "-lwsock32 -lcomdlg32"

0 commit comments

Comments
 (0)