Skip to content

Commit 3d581b3

Browse files
committed
Merge remote-tracking branch 'siskin/master'
2 parents 5c7f724 + 2947e8b commit 3d581b3

26 files changed

+179
-286
lines changed

make/rebol3.nest

+11-11
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ mezz-lib-files: [
258258
; %mezz/codec-html-entities.reb
259259
; %mezz/codec-wav.reb
260260
; %mezz/codec-swf.reb
261-
; %mezz/codec-image.reb ; included using: include-image-os-codec (windows only so far)
261+
; %mezz/codec-image.reb ; included using: include-image-os-codec (windows and macos only so far)
262262
; %mezz/codec-image-ext.reb ; image codec extensions (codecs/png/size?)
263263
]
264264
mezz-prot-files: [
@@ -329,20 +329,18 @@ include-native-gif-codec: [config: INCLUDE_GIF_CODEC core-files: %core/u-gif.c]
329329

330330
;@@ on Windows it's better to use system image codec (ability to use more types)
331331
include-image-os-codec: [
332+
config: INCLUDE_IMAGE_OS_CODEC
333+
mezz-lib-files: %mezz/codec-image.reb
332334
#if Windows? [
333-
config: INCLUDE_IMAGE_OS_CODEC
334335
host-files: %os/win32/host-image.c
335-
mezz-lib-files: %mezz/codec-image-win.reb
336336
]
337337
#if MacOS? [
338-
config: INCLUDE_IMAGE_OS_CODEC
339338
host-files: [
340339
%os/osx/host-image.c
341340
%os/osx/sys-codecs.m
342341
%os/osx/sys-utils.m
343342
]
344343
frameworks: [CoreGraphics CoreImage ImageIO Foundation]
345-
mezz-lib-files: %mezz/codec-image-osx.reb
346344
]
347345
]
348346

@@ -495,7 +493,7 @@ include-codec-bbcode: [mezz-lib-files: %mezz/codec-bbcode.reb ]
495493
include-codec-html-entities: [mezz-lib-files: %mezz/codec-html-entities.reb]
496494
include-codec-ico: [
497495
; at this moment ico can be encoded only from pngs!
498-
:include-native-png-codec
496+
;:include-native-png-codec
499497
mezz-lib-files: %mezz/codec-ico.reb
500498
mezz-lib-files: %mezz/codec-image-ext.reb ; png/size? function
501499
]
@@ -538,10 +536,11 @@ include-rebol-core: [
538536
:include-iconv
539537
:include-https
540538

539+
:include-codec-unixtime
541540
:include-codec-gzip
542541
:include-codec-zip
543542
:include-codec-tar
544-
:include-codec-unixtime
543+
545544
config: INCLUDE_SHA224
546545
config: INCLUDE_SHA384
547546

@@ -551,23 +550,24 @@ include-rebol-core: [
551550
include-rebol-bulk: [
552551
:include-rebol-core
553552
:include-optional-checksums
554-
:include-image-codecs
555553
:include-image-natives
556554
:include-lzma-compression
557555
:include-base85-encoding
558556
:include-view
559557
:include-midi
560558

559+
:include-codec-swf
561560
:include-codec-gzip
562561
:include-codec-zip
563562
:include-codec-tar
564563
:include-codec-bbcode
565-
:include-codec-html-entities
566-
:include-codec-ico
564+
:include-codec-html-entities
567565
:include-codec-json
568566
:include-codec-xml
569-
:include-codec-swf
570567
:include-codec-wav
568+
:include-codec-ico
569+
570+
:include-image-codecs
571571

572572
:include-mezz-date
573573
:include-mezz-colors

src/boot/sysobj.reb

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ standard: object [
176176

177177
codec: construct [
178178
name: ;word!
179+
type: ;word!
179180
title: ;string!
180181
suffixes: ;block!
181182
decode: ;[any-function! none!]

src/core/m-pools.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,7 @@ const REBPOOLSPEC Mem_Pool_Spec[MAX_POOLS] =
411411
#endif
412412
} else {
413413
if (powerof2) {
414-
// !!! WHO added this and why??? Just use a left shift and mask!
415-
REBCNT len=2048;
416-
while(len<length)
417-
len*=2;
418-
length=len;
414+
U32_ROUND_UP_POWER_OF_2(length);
419415
} else
420416
length = ALIGN(length, 2048);
421417
#ifdef DEBUGGING

src/include/reb-c.h

+10
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,16 @@ typedef void(*CFUNC)(void *);
306306

307307
#define ROUND_TO_INT(d) (REBINT)(floor((d) + 0.5))
308308

309+
// https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
310+
// Note: 32bit, v must be > 0
311+
#define U32_ROUND_UP_POWER_OF_2(v) \
312+
v--; \
313+
v |= v >> 1; \
314+
v |= v >> 2; \
315+
v |= v >> 4; \
316+
v |= v >> 8; \
317+
v |= v >> 16; \
318+
v++; \
309319

310320
/***********************************************************************
311321
**

src/mezz/base-defs.reb

+11-7
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,20 @@ decode-url: none ; set in sys init
5151

5252
foreach [codec handler] system/codecs [
5353
if handle? handler [
54-
; Change boot handle into object:
55-
codec: set codec make object! [
56-
entry: handler
57-
title: form reduce ["Internal codec for" codec "media type"]
54+
; Change boot handle (for internal native codecs) into object:
55+
codec: set codec make object! [
5856
name: codec
59-
type: 'image!
57+
type: switch codec [
58+
text markup ['text ]
59+
gif bmp jpeg png ['image]
60+
wav ['sound]
61+
]
62+
title: form reduce ["Internal codec for" codec "media type"]
6063
suffixes: select [
61-
text [%.txt]
62-
markup [%.html %.htm %.xsl %.wml %.sgml %.asp %.php %.cgi]
64+
text [%.txt %.cgi]
65+
markup [%.html %.htm %.xsl %.wml %.sgml %.asp %.php]
6366
] codec
67+
entry: handler
6468
]
6569
; Media-types block format: [.abc .def type ...]
6670
if codec/suffixes [ ;append to file-types only if there is any suffix

src/mezz/codec-bbcode.reb

+1
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ bbcode: func [
427427

428428
register-codec [
429429
name: 'bbcode
430+
type: 'text
430431
title: "Bulletin Board Code"
431432
suffixes: [%.bbcode]
432433

src/mezz/codec-crt.reb

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ REBOL [
77

88
register-codec [
99
name: 'crt
10+
type: 'cryptography
1011
title: "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"
1112
suffixes: [%.crt]
1213
decode: wrap [

src/mezz/codec-der.reb

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ REBOL [
1818

1919
register-codec [
2020
name: 'der
21+
type: 'cryptography
2122
title: "Distinguished Encoding Rules"
2223
suffixes: [%.p12 %.pfx %.cer %.der %.jks]
2324
decode: function[data [binary!]][
@@ -332,6 +333,7 @@ register-codec [
332333

333334
register-codec [
334335
name: 'mobileprovision
336+
type: 'cryptography
335337
title: "Apple's mobileprovision file"
336338
suffixes: [%.mobileprovision]
337339
decode: function[data [binary!]][

src/mezz/codec-gzip.reb

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ REBOL [
88

99
register-codec [
1010
name: 'gzip
11+
type: 'compression
1112
title: "Lossless compressed data format compatible with GZIP utility."
1213
suffixes: [%.gz]
1314
decode: function[data [binary!]] [

src/mezz/codec-html-entities.reb

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ digits: charset [#"0" - #"9"]
278278

279279
register-codec [
280280
name: 'html-entities
281+
type: 'text
281282
title: "Reserved characters in HTML"
282283

283284
decode: func [

src/mezz/codec-ico.reb

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ REBOL [
99
system/options/log/ico: 2
1010
register-codec [
1111
name: 'ico
12+
type: 'image
1213
title: "Windows icon or cursor file"
1314
suffixes: [%.ico %.cur]
1415

src/mezz/codec-image-osx.reb

-107
This file was deleted.

0 commit comments

Comments
 (0)