Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 9 commits
  • 7 files changed
  • 0 commit comments
  • 5 contributors
Commits on Sep 29, 2012
@gvx gvx Converts code blocks into lists in README c4c6603
@taviso Merge pull request #1 from documenteers/master
Lists that were codeblocks in README
c19ad7b
Commits on Jan 03, 2013
@LarsH LarsH Added .gitignore 10b2bdf
@LarsH LarsH Changed Makefile linking order 2970fe9
@taviso Merge pull request #3 from LarsH/master
Suggested Makefile/.gitignore changes
be79c44
Commits on May 08, 2013
@flarn2006 flarn2006 Added an implementation of strchrnul for platforms (such as Mac OS X)…
… that don't support it
750e9a4
@taviso Merge pull request #4 from flarn2006/master
Added implementation of strchrnul
7ca56e9
Commits on Aug 30, 2014
@safinaskar safinaskar Changed == to =
== is not POSIX.
Default shell on Debian is dash. So, on my Debian box all this "test"s are interpreted by dash. And dash's built-in "test" doesn't understand ==
04dc158
@taviso Merge pull request #6 from safinaskar/patch-1
changed == to = in Makefile to support non-bash shells.
b3113f8
View
8 .gitignore
@@ -0,0 +1,8 @@
+*.o
+raras
+rarld
+sample.rar
+bitbuffer_test
+test/*.ri
+test/*.ro
+test/*.rar
View
6 Makefile
@@ -1,5 +1,7 @@
+# Add -DNEEDS_STRCHRNUL to end of CFLAGS if necessary
CFLAGS = -ggdb3 -O0 -march=native -std=gnu99 -Wall
-LDFLAGS = $(CFLAGS) -lz
+LDFLAGS = $(CFLAGS)
+LDLIBS = -lz
RARAS = ./raras
RARLD = ./rarld
@@ -14,7 +16,7 @@ RARLD = ./rarld
all: raras rarld sample.rar test
rarld: rarld.o bitbuffer.o
-raras: parser.o raras.o bitbuffer.o
+raras: strchrnul.o parser.o raras.o bitbuffer.o
bitbuffer_test: bitbuffer_test.o bitbuffer.o
test: bitbuffer_test
View
40 README.md
@@ -67,17 +67,17 @@ Operands.
The operand types supported for RarVM are as follows
- * Registers (`r0, r1, ..., r7`)
- * Memory references (`[#0x12345]`)
- * Register indirect references (`[r0]`)
- * Base + Index indirect references (`[r4+#0x1234]`)
- * Immediates (`#0x12312`)
+ * Registers (`r0, r1, ..., r7`)
+ * Memory references (`[#0x12345]`)
+ * Register indirect references (`[r0]`)
+ * Base + Index indirect references (`[r4+#0x1234]`)
+ * Immediates (`#0x12312`)
And as a convenience to programmers, the assembler also supports symbolic
references that are resolved to immediates at compile time, simply prefix them
with $.
- * Symbolic references (`jmp $next_loop`)
+ * Symbolic references (`jmp $next_loop`)
So a trivial demonstration program might help.
@@ -115,14 +115,14 @@ Rar programs can either supply their own initial register values, or use the
default set which includes some system information. If you do not specify your
own registers, these will be set:
- * r0: zero
- * r1: zero
- * r2: zero
- * r3: Address of Global Memory Buffer
- * r4: Filter Block Length
- * r5: Filter Exec Count
- * r6: zero
- * r7: End of available memory (and thus the stack grows down on RarVM).
+ * r0: zero
+ * r1: zero
+ * r2: zero
+ * r3: Address of Global Memory Buffer
+ * r4: Filter Block Length
+ * r5: Filter Exec Count
+ * r6: zero
+ * r7: End of available memory (and thus the stack grows down on RarVM).
Flags are always initialised to zero.
@@ -166,10 +166,10 @@ Calling conventions.
I use the following conventions, feel free to ignore them if you prefer
something hideous like pascal.
- * No registers are saved by callee, except r6 and r7.
- * The return code is placed in r0.
- * Parameters are passed cdecl style (reverse order) on the stack.
- * r6 is used as a frame pointer, and you're required to preserve it.
+ * No registers are saved by callee, except r6 and r7.
+ * The return code is placed in r0.
+ * Parameters are passed cdecl style (reverse order) on the stack.
+ * r6 is used as a frame pointer, and you're required to preserve it.
See the standard library for examples.
@@ -185,8 +185,8 @@ Status
This is a list of what currently is believed to work:
- * Basic programs appear to run on the Linux unrar program.
- * I havn't tested Windows yet, because I'm still porting the CRC tools to RarVM.
+ * Basic programs appear to run on the Linux unrar program.
+ * I havn't tested Windows yet, because I'm still porting the CRC tools to RarVM.
Needless to say, don't pipe untrusted input into this early alpha build ;-)
View
2  raras.c
@@ -22,6 +22,8 @@
#include "bitbuffer.h"
#include "rar.h"
+#include "strchrnul.h"
+
int main(int argc, char **argv)
{
FILE *input = NULL;
View
11 strchrnul.c
@@ -0,0 +1,11 @@
+#include <string.h>
+#include "strchrnul.h"
+
+char *strchrnul(const char *s, int c)
+{
+ char *ptr = strchr(s, c);
+ if (!ptr) {
+ ptr = strchr(s, '\0');
+ }
+ return ptr;
+}
View
8 strchrnul.h
@@ -0,0 +1,8 @@
+#ifndef __STRCHRNUL_H
+#define __STRCHRNUL_H
+
+#ifdef NEEDS_STRCHRNUL
+ char *strchrnul(const char *s, int c);
+#endif
+
+#endif
View
20 test/Makefile
@@ -13,15 +13,15 @@ RARLD = ../rarld
all: helloworld.rar crc32.rar bswap.rar mod.rar bitorder.rar vectormatch.rar \
vectorrow.rar compensate.rar operands.rar fib.rar
- test "$$(unrar p -inul helloworld.rar)" == "Hello, World!"
- test "$$(unrar p -inul crc32.rar)" == "OK"
- test "$$(unrar p -inul bswap.rar)" == "OK"
- test "$$(unrar p -inul mod.rar)" == "OK"
- test "$$(unrar p -inul bitorder.rar)" == "OK"
- test "$$(unrar p -inul vectormatch.rar)" == "OK"
- test "$$(unrar p -inul compensate.rar)" == "OK"
- test "$$(unrar p -inul vectorrow.rar)" == "OK"
- test "$$(unrar p -inul operands.rar)" == "OK"
- test "$$(unrar p -inul fib.rar)" == "OK"
+ test "$$(unrar p -inul helloworld.rar)" = "Hello, World!"
+ test "$$(unrar p -inul crc32.rar)" = "OK"
+ test "$$(unrar p -inul bswap.rar)" = "OK"
+ test "$$(unrar p -inul mod.rar)" = "OK"
+ test "$$(unrar p -inul bitorder.rar)" = "OK"
+ test "$$(unrar p -inul vectormatch.rar)" = "OK"
+ test "$$(unrar p -inul compensate.rar)" = "OK"
+ test "$$(unrar p -inul vectorrow.rar)" = "OK"
+ test "$$(unrar p -inul operands.rar)" = "OK"
+ test "$$(unrar p -inul fib.rar)" = "OK"
clean:
rm -f *.ri *.ro *.rar

No commit comments for this range

Something went wrong with that request. Please try again.