Skip to content

Commit

Permalink
Initial commit. (imported the whole legacy codebase)
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Sep 28, 2009
0 parents commit 520a3db
Show file tree
Hide file tree
Showing 691 changed files with 524,610 additions and 0 deletions.
32 changes: 32 additions & 0 deletions BUILD
@@ -0,0 +1,32 @@
===========================
Build instructions for ooc
===========================

The source distribution is spread mainly for study, but if you want to
build it yourself, here's what it take:

- GNU Make
- Apache Ant
- a POSIX-ish shell (bash is fine, and so is MSYS for MinGW/Windows)
- GCC 4.x with java support (gcj front-end) (last builds work very
well on MinGW/Windows)

If you have everything set up correctly, including paths, etc., just type
$ make

In the main ooc directory, and it should compile fine =) The output is
an executable in the bin/ooc directory, statically linked to gcj.

The provided Makefile is very easy to understand, and works perfectly
under Gentoo and Windows XP+MinGW+MSYS.

If you want to build from .java source (not from .class), you have
to check out 'ubi' as well (ooc depends on it), you can find on GitHub
at http://github.com/amoswenger/ubi

The garbage collector (libgc.a) is the Boehm GC. It's very portable.
It can be downloaded from http://www.hpl.hp.com/personal/Hans_Boehm/gc/

You're welcome if you want to build binaries for 64-bit platforms,
Solaris*, BSD*, etc. I'm reachable at amoswenger@gmail.com for discussion
about this.
162 changes: 162 additions & 0 deletions INSTALL
@@ -0,0 +1,162 @@
=====================
Linux
=====================

$ cd /opt/
$ tar xjf ooc-0.2-ninja.tar.bz2
$ ln -s /opt/ooc/bin/ooc /usr/bin/
$ ooc -V

If it prints the version number and the build date, you're all set ;)

Your next stop should be the examples folders, to familiarize yourself
with the language.

(/opt/ooc is just an example install location, but it's a good one.)

The ooc compiler has been run successfully under Gentoo, Ubuntu,
and Red Hat, but it should work just as well in other distributions.
You can report bugs to http://bugs.launchpad.net/ooc-language.

WARNING: DON'T COPY THE EXECUTABLE. It will prevent the compiler from
locating its libraries (in sdk/, libs/, etc.). Make a symbolic link,
as shown above.

===============================
Windows + MinGW/MSYS
===============================

- Install the latest MinGW and MSYS packages from http://www.mingw.org/
- Extract ooc-0.2-ninja.tar.bz2, e.g. to C:\ooc\ (if you need an
(un)archiver program, check out http://www.7-zip.org/)
- Add C:\ooc\bin\ to your PATH, e.g.:
* Open "Control Panel -> System"
* Go in the "Advanced" tab
* Click on the "Environment variables" button
* Select "PATH" from the bottom list, and click on the "Edit" button
just below
* Add ";C:\ooc\bin" to the end of your PATH. The folder names are
separated with semi-colons (";")
- Open MSYS, type "ooc" and press Enter

If it prints the version number and the build date, you're all set ;)

Your next stop should be the examples folders, to familiarize yourself
with the language.

(C:\ooc\ is just an example install location, but it's a good one.
As a general rule, avoid spaces in path names, it could cause problem
with some tools.)

=============================
Windows CMD.exe
=============================

ooc also works under the regular windows shell. It guess its
location by reading the "Path" environment variable. If you
still have environment variable problems, you can temporarily
set it with "set OOC_DIST=C:\ooc" (for example)

You can report bugs concerning windows compatibility
on http://bugs.launchpad.net/ooc-language

=====================================
OpenSolaris, Solaris
FreeBSD, NetBSD, OpenBSD
and other Java-supporting platforms
=====================================

Since there are not yet binary builds for these operating systems,
you have to use the "jar distribution", (the one with bin/ooc.jar in it),
and you need a JRE (Java Runtime Environment) that supports Java 1.5 or more
to run ooc.

You can download Sun's JRE from http://java.sun.com/

The jar is 'executable', which means you can run it with:
$ java -jar /opt/ooc/bin/ooc.jar arg1 arg2 arg3

It's recommended for everyday work to use a bash script in /usr/bin/
to launch ooc. There's an example of such a script in utils/launch-script.sh
$ cp utils/launch-script.sh /usr/bin/ooc
$ vim /usr/bin/ooc
(edit the path of the script)

=============================
Haiku, Zeta, BeOS, etc.
=============================

There doesn't seem to be a stable Java distribution for the BeOS family.
However, with the work going on with OpenJDK 7 and Haiku, the situation
may change.

In the meantime, you can still use ooc! Just use another computer under
Linux/Windows, to translate to C99 source, export it (for example using
the make backend), and compile it with gcc on your Haiku machine. This
method has been tested with a gcc4 version of Haiku, and it worked very
well.

For your convenience, there is a statically linkable version of libgc.a
built for Haiku/gcc4 in the libs/haiku/ directory.

================
64bit support
================

That is the great unknown. No tests have been made so far.
If you run a 64-bit os/kernel, please, please report any bugs on
http://bugs.launchpad.net/ooc-language

==============
Requirements
==============

- A C compiler (preferably GCC, or MinGW/GCC on Windows)

ooc is implemented in Java, but binaries compiled with GCJ are distributed.
These are statically linked, so libgcj.so.9 isn't needed.



=================
Troubleshooting
=================

Q: I've got the message "ERROR: You need to set the OOC_DIST environment
variable to where you have installed ooc. (example: export OOC_DIST=/opt/ooc)"

A: Usually, ooc is smart enough to guess where it's installed and configures
all path itself. Unfortunately, sometimes it's too hard to guess, so you
have to help ooc a little bit by exporting your OOC_DIST variable. If you're
on Windows, you can adjust that in Control Panel -> System -> Advanced ->
Environment Variables -> New -> Name: OOC_DIST, Value: C:/ooc (for example)

Q: ooc says it can't find gcc in the path

A: Then your gcc hides well. You can help ooc by exporting the CC
environment variable, e.g. export CC=/usr/bin/i686-pc-linux-gnu-gcc
If you're on MinGW, you should probably add C:\MinGW\bin to your PATH.
You can do that in the Control panel, see the answer above as for
how to manipulate environment variables in Windows XP and above.

Q: ooc says it can't find the class OocLib.ooc

A: Then it has guessed OOC_DIST wrong. See the first answer up there.

Q: I wrote a file.ooc and compiled it with ooc but nothing happens!

A: Did you forget to add a main function ? (e.g. func main { /* ... */ })
ooc won't output any file if there are no main functions in the .ooc files
you ask it to compile.

Q: Why can't I see any .c/.h files? What happens to them during compilation?

A: By default, ooc creates an "ooc_tmp" directory, writes every .c/.h
file in it, asks gcc to compile it, copy the executables outside the
ooc_tmp directory, and removes the ooc_tmp directory. If you want
to see the ooc_tmp directory, call ooc with the -noclean option.

Q: The binary linux/windows version crashes/does funny stuff

A: Sorry for the inconvenience, you may want to try the .jar distribution.
See the Solaris/BSD etc. section above for instructions
10 changes: 10 additions & 0 deletions LICENSE
@@ -0,0 +1,10 @@
Copyright (c) 2009, Amos Wenger & the ooc team
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the project ooc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 changes: 24 additions & 0 deletions Makefile
@@ -0,0 +1,24 @@
.PHONY: all clean

all: prepare dynamic

static:
ant
cd utils/ && gcj -static-libgcj -g -O3 -Dooc.version="`cat version.txt`, built on `date +%F\ %R:%S`" `find build/ -name "*.class"` --main=org.ooc.compiler.CommandLineInterface -o ../bin/ooc

dynamic:
ant
cd utils/ && gcj -g -O3 -Dooc.version="`cat version.txt`, built on `date +%F\ %R:%S`" `find build/ -name "*.class"` --main=org.ooc.compiler.CommandLineInterface -o ../bin/ooc

strip:
test "${WINDIR}" == "" && strip bin/ooc || strip bin/ooc.exe

prepare:
test -d bin || mkdir -p bin

clean:
ant clean
rm -rf bin

nogcj: prepare
ant -f build-nogcj.xml
55 changes: 55 additions & 0 deletions README
@@ -0,0 +1,55 @@
=============================================
ooc, aka: another hack at 'object oriented C'
=============================================

ooc is an object-oriented programming language which is implemented with
a source-to-source translator to pure C99. It supports classes, abstract
functions, foreach, ranges, etc. It intends to be modern, modular,
extensible, yet simple and fast.

ooc is trying to reconcile high-level concepts from Java and the speed
and small footprint of C. It somehow falls into the same category as
Vala, except that Vala is based on GLib, while ooc is based only on the
standard C library, making it very lightweight.

ooc is for people thriving for object orientation and other high level
features (e.g. a garbage collector, foreaches, imports vs includes),
without willing to bear the weight of C++ or the Java/C# runtime
environments.

ooc's syntax is inspired by Java and C, without the hassle. Source files
are organized in packages, and most dependencies are resolved
automagically (e.g. a simple 'use gl;' instructs the compiler to include
OpenGL headers, and to link to -lGL or -lopengl32, depending on the target
platform).

ooc's primary implementation is written in Java, for portability.
A project to write an ooc compiler in ooc itself, called 'rock', has
been launched on GitHub recently.
Stay tuned at: http://github.com/amoswenger/rock

The standard library aims to be small, fast, portable, and modular.
For now it contains file reading/writing classes, time classes, process
launching classes, fairly complete GTK bindings, OpenGL/GLU/GLUT bindings,
basic SDL bindings, string manipulation routines, and more to come.

The ooc compiler isn't perfect, but it's very usable for the time being.
A few projects are already using it, and there will be an Artifical
Intelligence programming contest during the summer!

While ooc is certainly not ready for the enterprise, it is a very
good candidate for the next language you want to learn and fiddle with.

I'm really to discussion about language design/implementation, etc.
and I'd really appreciate feedback about ooc, so don't hesitate to
contact me at amoswenger@gmail.com.

Resources:
==========

- http://ooc-lang.org/ Official website
- http://ooc-lang.org/doc/langref/book1.htm Language Reference guide
- http://github.com/amoswenger/ooc Git repository

Enjoy!

27 changes: 27 additions & 0 deletions build-nogcj.xml
@@ -0,0 +1,27 @@
<project name="ooc" default="compile" basedir=".">
<description>
ooc build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src:../ubi/src"/>
<property name="build" location="utils/build"/>

<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>

<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
</target>
</project>
31 changes: 31 additions & 0 deletions build.xml
@@ -0,0 +1,31 @@
<project name="ooc" default="compile" basedir=".">
<description>
ooc build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src:../ubi/src"/>
<property name="build" location="utils/build"/>

<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" compiler="gcj">
<compilerarg value="-c"/>
<compilerarg value="-O3"/>
<compilerarg value="-g"/>
</javac>
</target>

<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
</target>
</project>
21 changes: 21 additions & 0 deletions legacy-doc/Makefile
@@ -0,0 +1,21 @@
.PHONY: clean langref compman

DOCRES=/usr/share/sgml/stylesheets/dsssl/docbook/html

all: langref compman
@echo "All done!"

langref: langref.xml
cd langref && jade -t xml -d ${DOCRES}/docbook.dsl ../res/xml.dcl ../langref.xml
rm -f langref.zip
zip langref.zip -r langref/

compman: compman.xml
cd compman && jade -t xml -d ${DOCRES}/docbook.dsl ../res/xml.dcl ../compman.xml
#cd compman && jade -t tex -d ${DOCRES}/docbook.dsl ../res/xml.dcl ../compman.xml
rm -rf compman.zip
zip compman.zip -r compman/

clean:
rm -f langref/*
rm -f compman/*
Binary file added legacy-doc/art/llama.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added legacy-doc/art/llama.xcf
Binary file not shown.
Binary file added legacy-doc/art/ooc-smiley.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added legacy-doc/art/ooc-smiley.xcf
Binary file not shown.

0 comments on commit 520a3db

Please sign in to comment.