Skip to content

Instantly share code, notes, and snippets.

@antonijn
antonijn / gist:6938442
Last active December 25, 2015 07:19
Boh intermediate compiler generated code :3
#ifndef HEY_HI_CLASS_H
#define HEY_HI_CLASS_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
struct c_hey_p_hi_p_Class;
extern void c_hey_p_hi_p_Class_m_this(struct c_hey_p_hi_p_Class * self);
extern void c_hey_p_hi_p_Class_m_blah(struct c_hey_p_hi_p_Class * self, int32_t p_h);
extern void c_hey_p_hi_p_Class_m_main(void);
extern int32_t c_hey_p_hi_p_Class_sf_ajwidpajdp;
@antonijn
antonijn / Boh.java
Last active December 25, 2015 10:39
Boh...
try
{
int first = 0;
}
catch (Exception e)
{
float second = 1.0;
}
finally
{
@antonijn
antonijn / draft_1.cpp
Last active December 27, 2015 04:09
antonijn open-source license
// Copyright (c) <year> <name>
// The antonijn open-source license, draft 1, long form.
//
// The permission for the following is hereby granted, free of charge:
// 1. To use the software as you wish
// 1.1. To use the software for commercial purposes
// 1.2. To dynamically or statically link the software with any other
// software
// 1.3. To dynamically invoke/load software functionality at runtime in
// any other software
@antonijn
antonijn / dragon.cs
Created November 28, 2013 18:17
Dragon curve (memory inefficient)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace dragon
{
internal struct Vector2
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace linecounter
{
class Program
{
Base:
class boh.std.Object
this();
virtual boh.std.Type getType();
virtual long hash();
virtual boolean equals(Object other);
virtual boh.std.String toString();
static boolean valEquals(boh.std.Object l, boh.std.Object r);
@antonijn
antonijn / complex.cs
Last active January 1, 2016 23:59
How exception handling works.
private static void f()
{
ThreadExEnv env = Thread.current().getExEnv();
void() fin = void () ->
{
// finally block
// ...
};
if (!env.registerHandler(fin))
{
@antonijn
antonijn / utf8.aqua
Last active March 22, 2020 23:04
UTF-8 decoder
private static int getch(byte[] buf, ref int idx)
{
byte nxt = buf[idx++];
byte mask;
int remunits;
if ((nxt & 0x80) == 0) {
mask = 0;
remunits = 0;
} else {
byte lead = 0xC0;
@antonijn
antonijn / Program.aqua
Last active August 29, 2015 13:56
A bit of aqua, in various stages of its compilation.
import aqua.std;
public class Program
{
private static native int putchar(int ch);
private static void print(char ch)
{
putchar(ch);
}
@antonijn
antonijn / unicode.c
Last active June 4, 2024 21:30
UTF-8 to UTF-32 converter in C
#include "unicode.h"
#include <stdint.h>
#include <stddef.h>
int is_valid_char(uint32_t ch)
{
return ch < 0xd800 || ch > 0xdfff;
}
int is_combo_char(uint32_t ch)