Skip to content

Instantly share code, notes, and snippets.

@bowbow99
bowbow99 / framework.l
Created February 27, 2012 08:55
#xyzzy nanri-master から multiframe へ取り込んだ変更のテスト
;;; -*- mode: lisp; package: user -*-
#|
使い方(暫定):
1. どこかへ framework.l と nanri-master-change-tests.l をダウンロード
2. M-x load-file
load file: path/to/framework.l
3. M-x load-test-file
test file: path/to/nanri-master-change-tests.l
4. M-x change-tests
@nazoking
nazoking / trash.rb
Created January 6, 2012 03:40
cygwinからゴミ箱に捨てる
#!/bin/ruby
require 'Win32API'
module Cygwin
# cygwin環境であればtrue
def cygwin?
RUBY_PLATFORM =~ /-cygwin$/
end
# TODO コロン(:)などwindowsでファイル名に使えない文字が名前に入ってるファイルをうまく変換できません助けて!
# http://www.ruby-lang.org/ja/old-man/html/Win32API.html
PATH_TO_WIN32_FULL = Win32API.new('cygwin1.dll', 'cygwin_conv_to_full_win32_path', 'PP', 'I')
@miyamuko
miyamuko / gist:1003887
Created June 2, 2011 03:37
c-wrapper-modoki for #xyzzy
#|
Gauche の c-wrapper のように C のソースから直接 FFI の定義を生成するマクロ。
まだ、関数と構造体と列挙型だけ。
(c:define-c-type (winapi:BYTE *) LPBYTE)
(define-c-struct-wrapper "
typedef struct _PROCESS_INFORMATION {
HANDLE hProcess; // プロセスのハンドル
HANDLE hThread; // プライマリスレッドのハンドル
@youz
youz / compile.l.patch
Created May 31, 2011 13:44
compile.lにパッチを当てて https://github.com/miyamuko/xl-critic をバイトコンパイル
--- compile.l 2002-03-25 02:49:18 +0900
+++ compile_fix.l 2011-05-31 22:48:44 +0900
@@ -649,6 +649,10 @@
(defun compile-call (form)
(let ((f (assoc (car form) *macro-environment* :test #'eq)))
(cond ((null f)
+ (when (and (consp (car form))
+ (eq 'lambda (caar form)))
+ (format t "~&calling lambda form: ~S~%" form)
+ (push 'funcall form))
--- compile.l 2002-03-25 02:49:18 +0900
+++ compile_fix.l 2011-05-31 16:17:04 +0900
@@ -649,6 +649,9 @@
(defun compile-call (form)
(let ((f (assoc (car form) *macro-environment* :test #'eq)))
(cond ((null f)
+ (when (and (consp (car form))
+ (eq (caar form) 'lambda))
+ (push 'funcall form))
(dolist (f (cdr form))
@miyamuko
miyamuko / gist:998522
Created May 30, 2011 06:37
si:make-chunk の src-chunk が nil で offset を指定した場合、chunk をいじろうとした時点で #xyzzy がクラッシュする
;; 以下のコードで si:unpack-string の時点で xyzzy がクラッシュする。
;;
;; - offset を指定しない場合や nil の場合はクラッシュしない
;; - offset の値は何でもいい
;;
;; offset を指定された場合に chunk が nil の場合は、si:make-chunk の時点でエラーにするように
;; 引数をチェックするとかかな。
(let ((chunk nil)
(offset 100))
@miyamuko
miyamuko / gist:998414
Created May 30, 2011 03:36
#xyzzy の lambda マクロをコンパイルするとなんかおかしい
;; xl-critic でバイトコンパイルするとエラーになる原因は
;; destructuring-bind 内で使っている lambda マクロが原因?
;; clisp だと動くので xyzzy のどっかのバグ?
(defun test1 ()
(let ((a 1))
((lambda () a))))
;=> test1
(test1)
;=> 1
@zeptometer
zeptometer / infix.lisp
Created March 26, 2011 08:19
CLに中間記法を導入するリードマクロ。http://my.opera.com/zeptometer/blog/2011/03/27/cl
(defpackage :infix
(:use :cl)
(:export #:add-operator
#:add-infix-function
#:install-default-operators-and-infix-functions))
(in-package :infix)
(defconstant default-operators
'((1 ** expt :right)
@youz
youz / tco.lisp
Created January 20, 2011 03:48
tail-recursion to loop
;;; ref: https://gist.github.com/784338
;;; http://d.hatena.ne.jp/athos/20110119/p1
(defmacro w/uniq (names &body body)
(let ((binds (mapcar #'(lambda (s) `(,s (make-symbol ,(symbol-name s))))
(if (consp names) names (list names)))))
`(let ,binds ,@body)))
(defmacro defun-tc (name arglist . body)
(when (find-if (lambda (s) (find s '(&key &allow-other-keys &aux))) arglist)
anonymous
anonymous / xyzzy-autoexp.dat
Created October 16, 2010 15:04
lisp_object {
preview (
#if (&$e == Qnil) ("nil") #else (
#if (&$e == Qunbound) ("unbound") #else (
#if (((unsigned)&$e) & 0x01) ( #(
#if (((unsigned)&$e) & 0x10) ( #(
[((unsigned)&$e) >> 0x10, hx], " ",
#switch (((unsigned)&$e) & 0xffff)
#case 0x04 ( "Tchar" )
#case 0x08 ( "Tmessage" )