From 8879bb85def76adea1aaf9331ea7938234f188cf Mon Sep 17 00:00:00 2001 From: SongWei Date: Fri, 14 Feb 2020 16:01:13 +1100 Subject: [PATCH] 32bit --- c/CMakeLists.txt | 15 ++++++++++++++- server.lisp | 34 ++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 74ac873..230dba6 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -5,4 +5,17 @@ add_library(leoext SHARED lib.c) include_directories(${CURL_INCLUDE_DIR}) target_link_libraries(leoext ${CURL_LIBRARIES}) -set_target_properties(leoext PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") + +set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_FLAGS "-m32 -L/usr/lib32") + +set(CMAKE_SYSTEM_NAME Linux) + +set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_FLAGS -m32) + +set(CMAKE_FIND_ROOT_PATH /usr/lib32) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/server.lisp b/server.lisp index ad8ba35..1ba25e7 100644 --- a/server.lisp +++ b/server.lisp @@ -11,7 +11,7 @@ (defun route-hello-world (env) (declare (ignore env)) '(200 (:content-type "text/plain") - ("hello"))) + ("hello world"))) (defun route-not-found (&optional env) (declare (ignore env)) @@ -60,21 +60,23 @@ (nil ,#'route-not-found))) (if (not (find-package 'swank)) -(woo:run - (lambda (env) - ;;(print env) - ;;(print (type-of env)) - (if (eq :post (getf env :request-method)) - (let* ((post-stream (getf env :raw-body)) - (char-stream (flexi-streams:make-flexi-stream - post-stream - :external-format :utf-8))))) + (sb-thread:make-thread + (lambda () + (woo:run + (lambda (env) + ;;(print env) + ;;(print (type-of env)) + (if (eq :post (getf env :request-method)) + (let* ((post-stream (getf env :raw-body)) + (char-stream (flexi-streams:make-flexi-stream + post-stream + :external-format :utf-8))))) ;(format t (read-line char-stream)))) ;(format t "dispatching...") - (let ((route-function (dispatch (getf env :request-uri) +dispatch-table+))) - (format t "method:~A uri:~A route: ~A~%" - (getf env :request-method) - (getf env :request-uri) - route-function) - (funcall route-function env))))) + (let ((route-function (dispatch (getf env :request-uri) +dispatch-table+))) + (format t "method:~A uri:~A route: ~A~%" + (getf env :request-method) + (getf env :request-uri) + route-function) + (funcall route-function env)))))))