Skip to content

Instantly share code, notes, and snippets.

@ytomino
ytomino / adaexn.ll
Created May 12, 2011 12:26
LLVM exception test with libgnat
; llvm-as adaexn.ll && llvm-ld -native adaexn.bc -L`gcc -print-libgcc-file-name | xargs dirname`/adalib -lgnat && ./a.out
; LLVM primitives
declare i8* @llvm.eh.exception() nounwind readonly
declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
declare i32 @llvm.eh.typeid.for(i8*) nounwind
; libgcc
declare void @_Unwind_Resume(i8*)
type token = T_w | T_W | T_v | EOF;;
let rec scan s i = (
let length = String.length s in
if i >= length then length, EOF else
match s.[i] with
| 'W' -> i + 1, T_W
| 'w' -> i + 1, T_w
| 'v' -> i + 1, T_v
| '\xef' -> (* W : EF BC B7, v : EF BD 96, w : EF BD 97 *)
@ytomino
ytomino / .gitignore
Created April 9, 2012 06:46
Boost.Context in Ada
# This gist contains Ada version of Boost.Context and test.
/asm
/build
/b~*
/*.o
/import
/test_context
@ytomino
ytomino / principal_warn.ml
Created August 26, 2012 09:54
謎の警告
type 'a with_name = [`named of 'a];;
type function_type = [`function_type of all_type]
and all_type = [
| `void
| `function_type of all_type]
and named_var = [
| `extern of all_type
| `function_forward of function_type
| `defined_expression of expression]
@ytomino
ytomino / romantable_jisx6004.txt
Last active April 21, 2024 01:47
JIS-X-6004 for Google日本語入力
- -
-- ―
―- ― ―
~ ~
・< ・・
・・< …
・- ←
さ- ↓
^- ↑
-> →
@ytomino
ytomino / alloc.adb
Created December 8, 2012 10:40
built-in-place bug of gcc-4.7
function alloc return access lifetime.T is
begin
return new lifetime.T'(lifetime.Create);
-- lifetime.Finalize may be called here
end alloc;
@ytomino
ytomino / git-mystash.diff
Last active December 17, 2015 18:29
git stashを改造してみた。 (1). HEADとindexとworking treeが全部異なるファイルがあるときにgit stash -k && git stash popってやると、何もしてないのにconflictしやがる問題のfix。 (2). メッセージを指定しなかった時のデフォルトメッセージに現在の日付を追加。 (3). git stash listに-v(--verbose)オプションを追加。ハッシュ値を見ることができる。
--- Homebrew/Cellar/git/1.8.2/libexec/git-core/git-stash.orig 2013-03-23 06:07:23.000000000 +0900
+++ bin/git-mystash 2013-05-27 14:40:09.000000000 +0900
@@ -34,9 +34,17 @@
fi
no_changes () {
- git diff-index --quiet --cached HEAD --ignore-submodules -- &&
- git diff-files --quiet --ignore-submodules &&
- (test -z "$untracked" || test -z "$(untracked_files)")
+ keep_index="$1" # 引数追加
function _escape_path {
sed 's/ /\\ /g' | sed 's/(/\\(/g' | sed 's/)/\\)/g' | sed 's/\$/\\$/g'
}
function complete_pushd {
local cur
cur=${COMP_WORDS[COMP_CWORD]}
if [ `expr "x${cur}" : 'x+'` != 0 ]; then
IFS=$'\n' COMPREPLY=( $(compgen -W "$(dirs -v | head -n 10 | sed 's/^ */+/' )" -- $cur ) )
elif [ `expr "x${cur}" : 'x-'` != 0 ]; then
@ytomino
ytomino / gist:8476213
Last active January 3, 2016 14:29
BBAutoCompleteに補完候補を追加する方法
-- BBAutoComplete.scptを編集する
...
on makeAlsoTexts()
tell application "TextWrangler"
set theResult to {}
-- this will include the first document from window 1, but that's OK
repeat with w in windows
...
@ytomino
ytomino / cppexc.adb
Created May 20, 2014 01:46
throwing and catching a C++ exception
with Ada.Text_IO;
with Interfaces.C.Strings;
with GNAT.CPP_Exceptions;
procedure cppexc is
pragma Linker_Options ("-lstdc++");
use type Interfaces.C.char_array;
char_const_ptr : exception;
pragma Import (Cpp, char_const_ptr, "_ZTIPKc"); -- typeid(char const *)
begin
Ada.Text_IO.Put_Line ("throw...");