rebol / rebol Goto Github PK
View Code? Open in Web Editor NEWSource code for the Rebol interpreter
Home Page: http://www.rebol.com/
License: Apache License 2.0
Source code for the Rebol interpreter
Home Page: http://www.rebol.com/
License: Apache License 2.0
Rebol [R3] Source Code Distribution Date: 12-Dec-2012 Version: 2.101.0 From: Carl Sassenrath Web: www.rebol.com Build Target: This first release is intended for non-Windows systems like Linux, Mac, BSD, Android, etc. However, it will build for Windows, but I've not included the typical MSVC project files. I'll try to get that added, but it's not that tough to create one yourself. You will need to set struct align to 4 bytes. About the Makefile: You might notice that the makefile is a bit old-fashioned. That's because I still support Rebol on some very old systems that don't offer newer makefile features. So, please keep that in mind and stick with this simple format. Also, the makefile is built by Rebol. Typing "make make" will rebuild it, and you can also select a different platform target by providing the Rebol platform identifier typing e.g. "make make OS_ID=0.4.4" (Linux Libc6 2.11 platform version). Build Instructions: Parts of Rebol are built by Rebol. So, to build it, you'll need to download a running binary into the local make directory. Call it r3-make. The build happens in the make directory. It will create an obj sub-dir for storing the object files. I prefer this over mixing the source and object files into the same directory. You may need to do "make clean" for clean make session. The biggest step is to do the "make prep" which will use Rebol to configure and build a number of important C header files. If you are building for a new platform that has no existing Rebol, you can use "make prep" to build all the files you need on an existing platform and copy them to the new platform. After the prep, just run "make" or "make r3" and the rest of the system will build. Toolchain Note: Rebol builds on many different compilers over a range of systems. Although the C source doesn't strictly follow any one standard, it's quite portable and I've yet to find a toolchain that won't build it. You can even cross compile it for embedded systems quite easily. If you run into a problem, it's probably something fairly simple. Don't over complicate it. Note to Contributors: I welcome your help with porting Rebol to many more devices and making various improvements. I just ask that you: 1. Keep code clear and simple. 2. Document unusual code, reasoning, or gotchas. 3. Use same style for code, vars, indent(4), comments, etc. 4. Keep in mind Linux, OS X, BSD, big/little endian CPUs. 5. Test everything, then test it again. Enjoy your new Rebol freedom, -Carl Bug reporting note: Report bugs, wishes, etc. at the http://curecode.org/rebol3/view-tickets.rsp site.
Carl, at www.rebol.net you wrote:
"REBOL DocBase (old Wiki)"
Users are having problem with the "(old Wiki)" characterization. Could you, please, remove it?
Individual pixels in images should be addressable by a pair expression; this works with a get-path, pick and poke, but not with a set-path
Example code
>> img: make image! 4x4
>> img/3x2
== 0.0.0.0
>> img/3x2: 1.2.3.4
** Syntax error: invalid "time" -- "3x2:"
Reference: http://curecode.org/rebol3/ticket.rsp?id=803
When the interpreter's error reporting when running a script seems to be more tailored toward exploratory programming than toward running scripts:
$ cat test.r
#!/usr/bin/r3
print (1 / 0)
$ ./test.r
** Math error: attempt to divide by zero
** Where: / do either either either -apply-
** Near: / 0
>>
There are two problems here:
Interpreters that run scripts should behave nicely. Python, for example:
$ cat test.py
#!/usr/bin/python
print(1 / 0)
$ ./test.py
Traceback (most recent call last):
File "./test.py", line 3, in <module>
print(1 / 0)
ZeroDivisionError: division by zero
$ echo $?
1
$
Hi, Carl, what do you think would be an appropriate platform number for Android? Cyphre seems to prefer 0.6.01 for android_arm.
it is possible (without error message) to specify one or more types for a refinement in the function spec; this information shows up in the result of the reflector types-of
, but is not used otherwise (e.g. for type-checking) except under apply
Example code:
>> f: func [/a [integer!]][type? a]
>> types-of :f
== [make typeset! [integer!]]
>> f
== none!
>> f/a
== logic!
>> apply :f []
== none!
>> apply :f [true]
** Script error: applier does not allow logic! for its /a argument
Reference: http://curecode.org/rebol3/ticket.rsp?id=974
Where is the Wiki of GitHub? It disappered!
A bug which appears on Rebol2 and r3-a111-3-1 at least on Windows and Linux:
Some simple arithmetic leads to incorrect results with decimal type.
Here is a simple example:
>> -8.45 + 8.0 + 0.45
== 7.21644966006352e-16
Should instead be 0.
>> 1.333333333333333 > 1.333333333333332
== true
>> 1.333333333333333 = 1.333333333333332
== true
This line in c-do.c is an example of something for which the order of operations is not defined:
// Get first block value:
pvs.path = VAL_BLK_DATA(pvs.orig = *path_val);
(Note that VAL_BLK_DATA is a preprocessor macro, and not a function.)
One might think that means that the compiler could choose to do the pvs.orig = *path_val
, then call VAL_BLK_DATA
on that, then put the result in pvs.path
or put the VAL_BLK_DATA (pvs.orig)
into pvs.path
, and then do pvs.orig = *path_val
. But as pointed out here, it's not an either-or situation in principle. It's undefined behavior.
http://stackoverflow.com/a/13714644/211160
Happened across this just by trying to build the sole file c-do.c with warning levels turned up, adding things like -Werror=sequence-point
, which would be a good idea in general to do.
ask/hide
calls input/hide
In REBOL 2, select/skip
with size n>1
yielded a block result of length n-1
. In other words, it yielded the rest of the record. Not so in REBOL 3. Is this intentional?
Example code
>> s: [a 1 b 2 c 3]
>> select/skip s 'c 2
== 3 ; was [3] in REBOL 2
The dtoa.c used in R3 repo is out of date and has some bugs.
In R3
>> 212839188833879E-21
== 2.1283918883387901e-7
In Python
>>> 212839188833879E-21
2.12839188833879e-07
In d-crash.c, APPEND_BYTES is strncat and used as: APPEND_BYTES(buf, s, sizeof(buf)).
This will over-write the buf if s is longer than buf and buf is not empty. The last argument of strncat is max number of characters to append to buf, so if buf is not empty, passing sizeof(buf) allows for overwrite.
A quick hack would be to define APPEND_BYTES(dst, src, len) as strncat(dst, src, len - strlen(dst) - 1 > 0 ? len - strlen(dst) - 1 : 0 )
It would be helpful if Rebol respected the http_proxy
and https_proxy
environment variables for routing http(s) requests through a proxy. These environment variables are widely respected by convention for determining proxy settings.
Since the introduction of /hour /minute /second
selectors for date!
values which do NOT correspond to numerical selectors, it is an error for numerical selectors to be outside the range 1 .. 9
.
With time!
values, out of bound numerical selector values give simply none
.
In an earlier issue Carl said that "none
is the correct return value for an out-of-range ordinal selector".
BTW, why could not /hour /minute
and /second
correspond to, say, /10 /11
and /12
?
To be noted also that /julian == /yearday (== /8)
on date values but it does not exist on the now
function.
Sorry folks, Dec-Feb is the "crazy crazy busy" time for new product development. Yes, I know, I'm bad. But, I'm quite addicted to making new products... especially cute little electronic ones that sell in all the major stores in the US. Each one presents special new challenges that I just can't resist.
Starting in March I'll break away for a few hours a week to take care of things here.
Also... I really want to try using R3 with graphics running on DirectFB. It would be quite cool.
One other thing... has anyone got R3 running graphics on Raspberry Pi yet? If not, let's talk about how we can make that happen. What do we need?
Normally, when a word is set to a function, then setting it to a value of another type supersedes the function value. Not so when the function it was set to, had one or more refinements, and the new setting is done with at least one of these specified. See code.
>> f: func [/a][] ; simplest example
>> probe :f ; check f is a function
make function! [[/a][]]
>> f: 1 ; set f to an integer
>> probe :f
1 ; it is indeed
>> f: func [/a][] ; again
>> probe :f
make function! [[/a][]]
>> f/a: 1 ; now set f/a
>> probe :f ; this hasn't done anything, but isn't forbidden either
make function! [[/a][]]
INCLUDE license (see the source at http://www.rebol.org/view-script.r?script=ladislav-include.r ) has been adjusted to Apache 2.0
Embedded scripts need to decode the binary source from a start position only to a particular end position, and shouldn't go any further. This kind of thing happens with the length-specified embedded scripts that sys/load-header
enables, but it could also happen with something like RSP template dialects. When we needed to support such limits in sys/load-header
for checksums and decompression, we added a /part
option to checksum
and decompress
. We need a similar /part
option for transcode
.
For this example data:
>> s: to-binary {rebol [] print "Hello!" stuff after the script}
== #{
7265626F6C205B5D207072696E74202248656C6C6F2122207374756666206166
7465722074686520736372697074
}
Code required now if you use to block!
:
>> d: to block! copy/part s 23 ; note the copy overhead here
== [rebol [] print "Hello!"]
>> e: skip s 23
== #{2073747566662061667465722074686520736372697074}
Code required now if you use transcode
:
>> d: head clear back tail transcode copy/part s 23 ; still copy overhead
== [rebol [] print "Hello!"]
>> e: skip s 23
== #{2073747566662061667465722074686520736372697074}
Yes, the head clear back tail
stuff is dumb, but that will be discussed in another issue.
Code required now if you use transcode/part
:
>> d: transcode/part s 23 ; no copy overhead here
== [rebol [] print "Hello!" #{2073747566662061667465722074686520736372697074}]
>> e: last d
== #{2073747566662061667465722074686520736372697074}
>> head clear back tail d
== [rebol [] print "Hello!"]
Still has the stupid API clear back tail
problem (another issue), but at least it doesn't have the copy overhead anymore.
According to the DRAW Dialect Reference, text
can take a render-mode like anti-aliased
, but REBOL errors:
view layout [text anti-aliased "Hello World"]
** Script Error: anti-aliased has no value
** Where: do-facets
** Near: anti-aliased "Hello World"
The default text rendering is aliased:
view layout [text "Hello World"]
In f-extension.c:
*/ REBNATIVE(do_callback)
/*
** object word arg1 arg2
**
***********************************************************************/
{
RXICBI *cbi;
REBVAL *event = D_ARG(1);
REBCNT n;
if (VAL_EVENT_TYPE(event) == EVT_CALLBACK) {
if (cbi = VAL_EVENT_SER(event)) {
n = Do_Callback(cbi->obj, cbi->word, cbi->args, &(cbi->result));
}
}
SET_FLAG(cbi->flags, RXC_DONE);
If event is not EVT_CALLBACK, cbi will not be initialized and the code will likely crash trying to access it.
I guess it's possible to write a test script to exercise this codepath, but I'm not there yet.
We should pull over any important R3 host changes into this main distribution.
R3GUI still refers to
http://www.rebol.com/r3/rsl.html
However, that page does not exist. I suppose that the Apache 2 license shall now be used?
What would be required for supporting 64-bit ARM? I want to run Rebol on my laptop (Acer R13 -- MediaTek MT8173(c) 64-bit ARMv8) but currently I get this error:
./rebol-view/rebol: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory
Meanwhile I do have X11 installed and other X11 applications seem to work.
Here's the version of rebol I'm using:
$ file Downloads/rebol-view/rebol
Downloads/rebol-view/rebol: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=13961069bc477d1233c6edd300fee274f8f798e7, stripped
And this is my system:
$ uname -a
Linux localhost 3.18.0-14875-g438cb8ab27c6 #1 SMP PREEMPT Sat Sep 16 09:49:59 PDT 2017 aarch64 aarch64 aarch64 GNU/Linux
Supposing that R3GUI shalll have the Apache 2 license, I guess that it should be decided where to put its source code...
I created a new account on Codecure. There was no confirmation email. It just didn't work. If anyone here can access the logs, the email I used was [email protected]
.
It would be nice to discover the type and size of vector components by some kind of reflector. A mezzanine to do the same is easily written, but a native is better - it could be an overloading of spec-of
.
In this case, the path expressions are NOT checked to be valid refinements, they are not even evaluated as shown by the example that should throw an error if evaluated.
>> f: func [][print "hello"]
>> probe :f
make function! [[][print "hello"]]
>> probe :f/(1 / 0)
make function! [[][print "hello"]]
Currently, the following lexical and syntactical forms are allowed as path elements:
literal value except string, lit-word, word (which is not evaluated), get-word (evaluated, result may be of any type), and parenthesized expression (evaluated, result may again be of any type)
BrianH says: The " character is a delimiter, and apparently of higher precedence than paths (or is it lower?). This is the same as R2, but it would be useful to change because using strings as keys in blocks and maps is extremely common.
This could be easy to implement without impact since the current behavior results in an error.
Reference: http://curecode.org/rebol3/ticket.rsp?id=746
Currently, you can disable stripping the symbols of the build results with
make ... STRIP=echo
It would be nice if there was a simple+consistent way to disable stripping during development.
According to http://issue.cc/r3/1886 we have a SPLIT function separate from the PARSE now, but BrianH pointed out that the /INTO refinement is not very good.
Please debate.
It would be nice if r3 supported 64bit platforms natively.
Currently, you have to install a 32bit compatibility layer to build and run REBOL on 64 bit platforms.
Meant to post issue on rebol-issues. Closed. Cannot delete it here.
I would eliminate the demo entry in splash intro and help, since it's not available.
Just thought I would mention: I always check pull requests before issues, so it is not necessary to add an issue along with the pull... unless you think there really is an issue.
I was following this tutorial and it suggested introducing a bug to see the error message. I tried it and it froze every Rebol window on my system. I tried it a number of times, and everything works perfectly until you hit Ctrl-E in the editor with any error in the source. It just freezes [little spinning umbrella thingy forever.]
OS X 10.10.2
Model Name: MacBook Air
Processor Name: Intel Core i5
Processor Speed: 1.3 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 3 MB
Memory: 4 GB
Boot ROM Version: MBA61.0099.B18
SMC Version (system): 2.13f15
From: http://rebol.informe.com/forum/rebol-2-f8/strange-behaviour-in-windows-8-t132.html
It seems rebol has a bug that appears in windows 8 (or maybe it is windows 8 which has a bug)
when you create a file in root partion of disk C it becomes unvisible in windows explorer, windows command line and whatever windows program accesing c:\ folder, that file is in another universe for windows point of view.
>> save %/c/a.txt "hello universe!"
c:\> dir
(no clue about a.txt)
But if you do a dir list in rebol view console, it is there! and you can read it, load it and even delete it
>> ls %/c/
$Recycle.Bin/ a.txt Users/ Windows/
The effect of this weird bug is you cannot open any file created from rebol view 2.7 with any windows program, files created inside rebol are only visible to rebol. But this only happen with files created in root folder, if you create files in any other folder all seems to be ok.
>> save %/c/aeat/b.txt "hello universe"
>> ls %/c/aeat
b.txt
any idea of this weird windowness?
When you try to FIND a tuple value in an image the image is returned at the head position if the tuple is not in the image.
A reminder of the issue still under discussion, see http://curecode.org/rebol3/ticket.rsp?id=818&
Currently it seems that the only way to sub-launch another os executable is with call, which is very limited.
Real programs need at least the following additional functionality:
I'm not proposing the exact syntax, as I don't have a good feel for rebol but it could be done by extending call or implementing a new command, like exec.
Even more advanced functionality would be to be able to communicate with launched process by reading it's stdout/stderr and writing to its stdin in response.
Results in a 404 not found error. For example:
image: read http://www.elle.nl/var/ellenl/storage/images/mode/nieuws/like!-nieuwe-cruyff-collectie/1918159-1-eng-GB/LIKE!-Nieuwe-Cruyff-Collectie_home_news.jpg
** Access error: protocol error: "Server error: HTTP/1.1 404 Not Found"
Another example:
content: to-string read http://www.metacritic.com/game/xbox-one/guacamelee!-super-turbo-championship-edition
Content then contains the HTML for metacritic's 404 Not Found page.
Both examples work fine in Rebol 2.
When running "make all", it fails at the end with
make[1]: Entering directory `/home/adigulla/packages/r3/make'
gcc -o host objs/host-main.o objs/host-args.o objs/host-device.o objs/host-stdio.o objs/dev-net.o objs/dev-dns.o objs/host-lib.o objs/host-readline.o objs/dev-stdio.o objs/dev-event.o objs/dev-file.o libr3.so -lc -lm -ldl -m32
strip libr3.lib
strip: 'libr3.lib': No such file
This is probably just because it uses the wrong file name.
I'm on Linux x86/64 with 32bit compiler + 32bit dependencies installed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.