This file contains 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
/* | |
* issetugid implementation for Linux | |
* Public domain | |
*/ | |
#include <errno.h> | |
#include <gnu/libc-version.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <unistd.h> |
This file contains 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
.DEFAULT_GOAL := all | |
.PHONY: ${MAKECMDGOALS} | |
$(filter-out all,${MAKECMDGOALS}) all: .forward-all ; | |
.forward-all: | |
${MAKE} -C build ${MAKECMDGOALS} | |
${MAKEFILE_LIST}: ; | |
.SUFFIXES: |
This file contains 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 io/[Writer, Reader] | |
/** | |
Multi-Purpose Buffer class. | |
This is a String, with guaranteed mutability. | |
All operations will be done on the Buffer itself, instead of a clone. | |
Other difference from String: the constructor will set capacity, not size. | |
*/ | |
Buffer: class extends String{ |
This file contains 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
XString: class { | |
data : Char* | |
size : SizeT | |
init: func (src: Char*, =size) { | |
data = gc_malloc(size) | |
memcpy (data, src, size) | |
} | |
This file contains 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
using Posix; | |
[Compact] | |
public class Test { | |
public void test() { | |
stdout.puts ("foo\n"); | |
} | |
} | |
static int main(){ |
This file contains 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
opening file nagtest.ooc for read... | |
full name nagtest | |
myst name . | |
/home/rofl/dev/rock/sdk/lang/Exception.ooc | |
/home/rofl/dev/rock/sdk/lang/System.ooc | |
/home/rofl/dev/rock/sdk/lang/Memory.ooc | |
/home/rofl/dev/rock/sdk/lang/types.ooc~ | |
/home/rofl/dev/rock/sdk/lang/types.ooc | |
/home/rofl/dev/rock/sdk/lang/Numbers.ooc | |
/home/rofl/dev/rock/sdk/lang/Buffer.ooc |
This file contains 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
OOC: Changes to String | |
String is now a class, which wraps a Buffer in a immutable way. | |
this means every method that can change the string, like trim, is executed on a clone of the internal buffer, then a new String including that buffer is returned. | |
the other difference between string and buffer is, that methods for the buffer are mostly of void return type, while String always returns a new instance. so you can do something like | |
// s infers to String here | |
s := " /tmp/aaa/bbb " trim() replaceAll("/", "\\") reverse() | |
here a new string is created, then each time a clone created and the method applied on the clones buffer | |
so this makes for at least 4 memory allocations and complete memcpy, which isnt very efficient. |
This file contains 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
main: func (argc: Int, argv: Char**) { | |
for (i in 1..argc) printf (argv[i]) | |
} | |
$ rm -rf .libs/ rock_tmp/ && rock plain.ooc -gc=dynamic +-Os -dce | |
$ ls -lat plain | |
-rwxr-xr-x 1 rofl users 133283 31. Aug 18:50 plain | |
$ objdump -t plain |
OlderNewer