* cbc -> bin/cbc

* cbci -> bin/cbci.rb
* bin/cbci.sh: new file.
* lib/libcbc.cb: new file.
* build.properties: create jar file in lib/.
* install.sh: new file.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4018 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2008-09-14 16:19:44 +00:00
parent 7524fb4468
commit 97ff5aafe0
8 changed files with 94 additions and 1 deletions

View File

@ -1,3 +1,17 @@
Mon Sep 15 01:19:36 2008 Minero Aoki <aamine@loveruby.net>
* cbc -> bin/cbc
* cbci -> bin/cbci.rb
* bin/cbci.sh: new file.
* lib/libcbc.cb: new file.
* build.properties: create jar file in lib/.
* install.sh: new file.
Mon Sep 15 00:43:29 2008 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/Compiler.java: handle multiple

1
ToDo
View File

@ -2,6 +2,7 @@
== Current
* write install.sh
* va_list
* -O (peephole optimization)
* movl $0, %eax => xorl %eax, %eax

View File

View File

39
bin/cbci.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
TMPDIR=/tmp
TMPNAME="cflatexpr$$"
main() {
local basedir="$(expand_path "$(dirname "$0")")"
cd "$TMPDIR"
trap "rm -f $TMPNAME*" EXIT
cat <<EndSource > "$TMPNAME.cb"
import stdio;
int
main(int argc, char** argv)
{
printf("%d\n", $1);
return 0;
}
EndSource
"$basedir/cbc" "$TMPNAME.cb" || exit 1
"./$TMPNAME"
st=$?
echo "status: $st" 1>&2
exit 0
}
expand_path() {
local path="$1"
if [ $(expr "$path" : "/") -eq 1 ]
then
echo "$path"
else
echo "$(pwd)/$path"
fi
}
main "$@"

View File

@ -3,7 +3,7 @@ javacc.dir=/usr/share/java
src.dir=.
build.dir=build
build.classes.dir=build/classes
build.jar=cbc.jar
build.jar=lib/cbc.jar
src.jj.file=./net/loveruby/cflat/parser/Parser.jj
build.parser.dir=./net/loveruby/cflat/parser

21
install.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
version=1.0.0
prefix="${1:-/usr/local/cbc/$version}"
invoke() {
echo "$@"
if ! "$@"
then
echo "install failed." 1>&2
exit 1
fi
}
echo "version=$version"
echo "prefix=$prefix"
invoke mkdir -p "$prefix/bin"
invoke cp bin/cbc bin/cbci "$prefix/bin
invoke mkdir -p "$prefix/lib"
invoke cp cbc.jar lib/libcbc.o "$prefix/lib"
echo "cbc successfully installed as $prefix/bin/cbc"

18
lib/libcbc.cb Normal file
View File

@ -0,0 +1,18 @@
//import stdarg; // FIXME
typedef unsigned long va_arg_t;
typedef va_arg_t* va_list;
va_list
va_init(void *arg)
{
return (va_list)arg + 1;
}
va_arg_t
va_next(va_list* ap)
{
va_arg_t arg = **ap;
(*ap)++;
return arg;
}