Skip to content

Instantly share code, notes, and snippets.

@susisu
Last active November 6, 2015 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save susisu/831e06af2ddee14938c8 to your computer and use it in GitHub Desktop.
Save susisu/831e06af2ddee14938c8 to your computer and use it in GitHub Desktop.
lazy.cpp patch

http://esoteric.sange.fi/essie2/download/lazy-k.zip の lazy.cpp を GCC でコンパイルするときのためのパッチです.

元は http://blog.livedoor.jp/dankogai/archives/51524324.html にあったものですが, なんか手元の環境で上手く当てられなかったので作りなおしました (やり方がまずかったのかもしれない).

patch lazy.cpp < lazy.cpp.patch

とかでパッチを当ててから, http://blog.cormoran-web.com/blog/lazyk/ に書いてあるように -fpermissive をつけて,

g++ lazy.cpp -fpermissive -o lazy

でコンパイルできます (たぶん).

--- lazy.cpp.orig 2015-11-06 19:36:27.000000000 +0900
+++ lazy.cpp 2015-11-06 20:05:16.000000000 +0900
@@ -32,7 +32,6 @@
#include <stdio.h>
-#include <io.h>
#include <fcntl.h>
#include <stdlib.h>
#include <ctype.h>
@@ -56,7 +55,7 @@
public:
enum Type { A, K, K1, S, S1, S2, I1, LazyRead, Inc, Num, Free } type;
- static void* operator new(unsigned) {
+ static void* operator new(size_t) {
Expr* result = free_list;
if (result) {
free_list = result->arg1;
@@ -563,8 +562,10 @@
e = append_program(e, &File(stdin, "(standard input)"));
break;
case 'b':
+#ifdef O_BINARY
setmode(fileno(stdin), O_BINARY);
setmode(fileno(stdout), O_BINARY);
+#endif
break;
case 'e':
++i;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment