World: r4wp
[#Red] Red language group
older newer | first last |
Kaj 25-Jun-2013 [8683] | Yes, and a cURL binding for network files |
Bo 25-Jun-2013 [8684] | I'm trying to load binary data to perform some bit-level operations on it. |
Kaj 25-Jun-2013 [8685x2] | There's a binary example in my 6502 emulator, where it loads a ROM file |
http://red.esperconsultancy.nl/Red-6502/dir?ci=tip | |
Bo 25-Jun-2013 [8687] | It sure would be nice if we had a centralized repository for Red and Red/System examples, like we have for Rebol at Rebol.org. |
Kaj 25-Jun-2013 [8688x2] | That wouldn't scale, unless it were a repository of links |
The file operation is in machine.reds under the ROM heading | |
Luis 25-Jun-2013 [8690] | Is possible an bridge from red to App Inventor components ? https://sites.google.com/site/mobileprogrammingusf/java-bridge |
Bo 25-Jun-2013 [8691] | In Rebol, I can put a 'halt at the end of my script to be able to read output from my script. Can I do a similar thing in Red/System? |
Kaj 25-Jun-2013 [8692x5] | There is HALT, but I think it's the same as QUIT |
If you have a console window in Windows that is closing, you could do | |
until [no] | |
Or if you're using my C library binding, to not use CPU: | |
input | |
Bo 25-Jun-2013 [8697x3] | OK. Thanks! |
I tried the until [no], but the console window just flashes up and disappears really quickly. I'm assuming that's because it is erroring out. Is there any document on how to debug this type of thing? | |
I'm trying to convert your file reading code to a general purpose function. | |
Kaj 25-Jun-2013 [8700x2] | There are general purpose functions for text files here in ANSI.reds: |
http://red.esperconsultancy.nl/Red-C-library/dir?ci=tip | |
Bo 25-Jun-2013 [8702] | Can those be easily modified for binary files? |
Kaj 25-Jun-2013 [8703x2] | I was still going to make binary versions with the 6502 code. Shouldn't be hard. Binary is easier than text |
I could do it now if you want? | |
Bo 25-Jun-2013 [8705] | I would really appreciate that! |
Kaj 25-Jun-2013 [8706x2] | OK, I have a suitable hole before my bedtime |
ANSI.reds now has read-file-binary | |
Bo 25-Jun-2013 [8708] | Do I just synchronize that with Fossil? |
Kaj 25-Jun-2013 [8709x5] | Yes, if you have that installed, just do |
fossil update | |
Added write-file-binary for good measure | |
Oops, I'm not returning the binary file length. Have to fix that oversight | |
Added a parameter to make read-file-binary return the file size | |
Bo 25-Jun-2013 [8714] | OK. |
Kaj 25-Jun-2013 [8715x2] | I updated the 6502 emulator to use it, so you can see an example there |
Luis, the Red Java bridge will be able to call generic Java code, so it should be possible to use the App Inventor library | |
PeterWood 26-Jun-2013 [8717] | Looking at the current bridge.red, It seems that the return value of a called a method of a Java object is treated as an integer by the bridge. Am I correct in thinking that is fine for integers and references to Java Objects? I presume logic! will be okay too (if caste back ) . I guess that the bridge doesn't support string or float values yet. |
DocKimbel 26-Jun-2013 [8718x2] | It does in the new bridge version I'm about to push online. |
I just need to make some addition to the Red/System compiler before. | |
PeterWood 26-Jun-2013 [8720] | That's great news. |
Bo 26-Jun-2013 [8721x5] | Are there any tutorials on how to write programs using Red? (Not Red/System - I know where the documentation is for that.) |
What I mean is something like Rebol in 10 steps, but maybe Red in 10 steps (assuming you already know Rebol). | |
For instance, I try to compile and run the following simple script: Red [] img1: load %img1.jpg print img1 | |
When I run it, I get the following error: *** Error: word has no value! unset | |
I know that Doc says Red isn't ready for general use yet, but I was wondering if maybe there were some resources so I could get started getting up to speed on it. When I started learning Rebol, it was probably even less complete. | |
Kaj 26-Jun-2013 [8726] | Yeah, Larry Wall bashed it for that |
Ladislav 26-Jun-2013 [8727] | Larry Wall used quite unrelated (and mostly invalid) arguments |
Kaj 26-Jun-2013 [8728x5] | No tutorials, though, but there's a fair amount of example code. It currently relies on being able to use a lot of REBOL knowledge |
The best thing is to program as basic as possible, and always be on the watch for missing stuff. For example, LOAD only works on strings, and there's no type checking, so it probably used the string value of %img1.jpg | |
With my I/O bindings you can READ a file and then LOAD it, but only UTF-8 text | |
Now that Red/System can read binary files, I could make a facility in Red, but it would have to do without a binary! type. I could return a handle to low level memory as an integer! | |
However, there would currently be no facilities to access the content at the Red level, so you would have to pass it to Red/System functions to do anything with it | |
older newer | first last |