This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Usage | |
| new target("all", |task| | |
| task compile("file.ooc", compile options => ["run", set("dist", "distDir")]) | |
| . print("Compiled, now cleaning") | |
| . execute(get target("clean")) | |
| ) | |
| new target("clean", |task| | |
| task select("rock_tmp", ".libs") delete() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| include time, stdlib | |
| import os/Process | |
| import net/TCPSocket | |
| import threading/Thread | |
| import structs/[ArrayList, HashMap, HashBag, Bag] | |
| import text/json | |
| import io/[File, FileWriter, Reader] | |
| time: extern func(Pointer) -> UInt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| makeVideo: func(music, image, dest: File, name: String) { | |
| // just launch ffmpeg :D | |
| "Making video..." println() | |
| process := Process new(["ffmpeg", "-loop_input", "-shortest", "-y", "-i", image getAbsolutePath(), "-i", music getAbsolutePath(), "-acodec", "copy", "-vcodec", "mjpeg", dest getChild(name) getAbsolutePath()]) | |
| process setStdout(Pipe new()) . setStderr(Pipe new()) | |
| "ffmpeg exited with status %d" format(process execute()) println() | |
| "Made video!" println() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Foo: class {} | |
| Bar: class extends Foo {} | |
| operator + <T> (left: Foo, right: T) { | |
| "OHAI" println() | |
| } | |
| bar: Bar | |
| bar + 42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void array_range____OP_IDX_T__star_Range__T__star(uint8_t* __genericReturn1, lang_types__Class* T, uint8_t* data, lang_Numbers__Range range) { | |
| lang_Numbers__Int size = range.max - range.min; | |
| uint8_t* ret = ((uint8_t*) (lang_Memory__gc_malloc(size * T->size))); | |
| { | |
| lang_Numbers__Int i; | |
| for (i = 0; i < size; i++) { | |
| lang_Memory__memcpy(&(ret[i * T->size]), &(data[(range.min + i) * T->size]), T->size); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <inttypes.h> | |
| typedef struct { | |
| int min; | |
| int max; | |
| } Range; | |
| void slice(uint8_t* genReturn, uint8_t* data, Range range) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* test source file, generated with rock, the ooc compiler written in ooc */ | |
| #include <./test.h> | |
| #include <sdk/lang/String.h> | |
| #include <sdk/lang/BufferIterator.h> | |
| #include <sdk/lang/Abstractions.h> | |
| #include <sdk/lang/System.h> | |
| #include <sdk/lang/Format.h> | |
| #include <sdk/lang/IO.h> | |
| #include <sdk/lang/types.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; This is a comment. Only when the line starts with it though | |
| ; Set the variable "name" to "SampleTest" | |
| ; Variable names are case insensitive | |
| Name: SampleTest | |
| Source: foo.ooc | |
| ; This is special syntax to set a variable to a block of text | |
| ; This way you can have multi-line values | |
| Compilation-stdout-output !>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MaybeState: enum { | |
| None, | |
| Some | |
| } | |
| Maybe: class <T> { | |
| _value: T | |
| value: T { | |
| get { | |
| if(state == MaybeState None) raise("No value!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import structs/ArrayList | |
| Symbol: class { | |
| value: String | |
| table: static ArrayList<This> | |
| new: static func(.value) -> const This { | |
| if(!table) table = ArrayList<This> new() |