From cae545f93002400c0656daff94361cfb8ed27b45 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 24 Jul 2005 23:08:32 +0000 Subject: [PATCH] factorbot fix, starting 0.77 --- CHANGES.html | 3 +++ Makefile | 15 +++++++++--- examples/factorbot.factor | 13 ++++++---- library/bootstrap/boot-stage3.factor | 36 +++++++++++++++------------- version.factor | 2 +- 5 files changed, 43 insertions(+), 26 deletions(-) diff --git a/CHANGES.html b/CHANGES.html index ff7f199285..c4a21fd11d 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -119,3 +119,6 @@ write1 ( char -- ) + + + diff --git a/Makefile b/Makefile index 148077d847..0fa0af9fb9 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,16 @@ else STRIP = strip endif -DEFAULT_LIBS = -lm +ifdef STATIC + DEFAULT_LIBS = -lm -Wl,-static -Wl,-whole-archive \ + -Wl,-export-dynamic \ + -lSDL -lSDL_gfx -lSDL_ttf \ + -Wl,-no-whole-archive \ + -lfreetype -lz -L/usr/X11R6/lib -lX11 -lXext \ + -Wl,-Bdynamic +else + DEFAULT_LIBS = -lm +endif UNIX_OBJS = native/unix/file.o \ native/unix/signal.o \ @@ -76,13 +85,13 @@ macosx: linux: $(MAKE) f \ CFLAGS="$(DEFAULT_CFLAGS) -export-dynamic" \ - LIBS="$(DEFAULT_LIBS) -ldl" + LIBS="-ldl $(DEFAULT_LIBS)" $(STRIP) f linux-ppc: $(MAKE) f \ CFLAGS="$(DEFAULT_CFLAGS) -export-dynamic -mregnames" \ - LIBS="$(DEFAULT_LIBS) -ldl" + LIBS="-ldl $(DEFAULT_LIBS)" $(STRIP) f windows: diff --git a/examples/factorbot.factor b/examples/factorbot.factor index b699c036f3..d3f0ad297f 100644 --- a/examples/factorbot.factor +++ b/examples/factorbot.factor @@ -30,15 +30,15 @@ SYMBOL: receiver "JOIN " irc-write irc-print ; GENERIC: handle-irc -PREDICATE: string privmsg "PRIVMSG" swap subseq? ; +PREDICATE: string privmsg " " split1 nip "PRIVMSG" head? ; +PREDICATE: string ping "PING" head? ; M: string handle-irc ( line -- ) drop ; : parse-privmsg ( line -- text ) - ":" ?head drop - "!" split1 swap speaker set - "PRIVMSG " split1 nip + " " split1 nip + "PRIVMSG " ?head drop " " split1 swap receiver set ":" ?head drop ; @@ -48,6 +48,9 @@ M: privmsg handle-irc ( line -- ) [ "factorbot-commands" ] search dup [ execute ] [ 2drop ] ifte ; +: parse-irc ( line -- ) + ":" ?head [ "!" split1 swap speaker set ] when handle-irc ; + : say ( line nick -- ) "PRIVMSG " irc-write irc-write " :" irc-write irc-print ; @@ -72,7 +75,7 @@ M: privmsg handle-irc ( line -- ) : irc-loop ( -- ) irc-stream get stream-readln - [ dup print flush handle-irc irc-loop ] when* ; + [ dup print flush parse-irc irc-loop ] when* ; : factorbot "irc.freenode.net" connect diff --git a/library/bootstrap/boot-stage3.factor b/library/bootstrap/boot-stage3.factor index ddf07d26c4..2a9e7dcb0c 100644 --- a/library/bootstrap/boot-stage3.factor +++ b/library/bootstrap/boot-stage3.factor @@ -6,23 +6,25 @@ parser sequences io unparser words ; "Compiling base..." print -unix? [ - "sdl" "libSDL.so" "cdecl" add-library - "sdl-gfx" "libSDL_gfx.so" "cdecl" add-library - "sdl-ttf" "libSDL_ttf.so" "cdecl" add-library -] when - -win32? [ - "kernel32" "kernel32.dll" "stdcall" add-library - "user32" "user32.dll" "stdcall" add-library - "gdi32" "gdi32.dll" "stdcall" add-library - "winsock" "ws2_32.dll" "stdcall" add-library - "mswsock" "mswsock.dll" "stdcall" add-library - "libc" "msvcrt.dll" "cdecl" add-library - "sdl" "SDL.dll" "cdecl" add-library - "sdl-gfx" "SDL_gfx.dll" "cdecl" add-library - "sdl-ttf" "SDL_ttf.dll" "cdecl" add-library -] when +"statically-linked" get [ + unix? [ + "sdl" "libSDL.so" "cdecl" add-library + "sdl-gfx" "libSDL_gfx.so" "cdecl" add-library + "sdl-ttf" "libSDL_ttf.so" "cdecl" add-library + ] when + + win32? [ + "kernel32" "kernel32.dll" "stdcall" add-library + "user32" "user32.dll" "stdcall" add-library + "gdi32" "gdi32.dll" "stdcall" add-library + "winsock" "ws2_32.dll" "stdcall" add-library + "mswsock" "mswsock.dll" "stdcall" add-library + "libc" "msvcrt.dll" "cdecl" add-library + "sdl" "SDL.dll" "cdecl" add-library + "sdl-gfx" "SDL_gfx.dll" "cdecl" add-library + "sdl-ttf" "SDL_ttf.dll" "cdecl" add-library + ] when +] unless default-cli-args parse-command-line diff --git a/version.factor b/version.factor index e0a6ea9f9b..d66bf72f8a 100644 --- a/version.factor +++ b/version.factor @@ -1,2 +1,2 @@ IN: kernel -: version "0.76" ; +: version "0.77" ;