Update more things
This commit is contained in:
parent
69c4976303
commit
9a61198f93
@ -104,9 +104,9 @@ that STR is of the correct length for a word with LEN mora"
|
|||||||
(accent-name :col-type :binary)
|
(accent-name :col-type :binary)
|
||||||
(accent-html :col-type :binary)))
|
(accent-html :col-type :binary)))
|
||||||
|
|
||||||
(defun initialize-connection ()
|
(defun initialize-connection (&optional (db-path #P"myoji.sqlite"))
|
||||||
"Initialize the connection to the myoji database."
|
"Initialize the connection to the myoji database."
|
||||||
(mito:connect-toplevel :sqlite3 :database-name #P"myoji.sqlite")
|
(mito:connect-toplevel :sqlite3 :database-name db-path)
|
||||||
(mito:ensure-table-exists 'myoji))
|
(mito:ensure-table-exists 'myoji))
|
||||||
|
|
||||||
(defun make-myoji (reading kanji &key accent-string accent-point)
|
(defun make-myoji (reading kanji &key accent-string accent-point)
|
||||||
|
15
start.lisp
15
start.lisp
@ -1,10 +1,11 @@
|
|||||||
(ql:quickload '(:myoji-accent))
|
(ql:quickload '(:myoji-accent))
|
||||||
|
|
||||||
(myoji-accent/accent:initialize-connection)
|
|
||||||
|
|
||||||
(defparameter *interface* "localhost")
|
(defparameter *interface* "localhost")
|
||||||
(defparameter *port* 8080)
|
(defparameter *port* 8080)
|
||||||
(defparameter *debug* nil)
|
(defparameter *debug* nil)
|
||||||
|
(defparameter *db-path* (merge-pathnames
|
||||||
|
(uiop:pathname-directory-pathname *load-truename*)
|
||||||
|
"myoji.sqlite"))
|
||||||
(defparameter *help* nil)
|
(defparameter *help* nil)
|
||||||
|
|
||||||
(defun parse-arguments (&optional (args (uiop:command-line-arguments)))
|
(defun parse-arguments (&optional (args (uiop:command-line-arguments)))
|
||||||
@ -20,6 +21,9 @@
|
|||||||
(when (member (car arg) '("-p" "--port") :test 'equal)
|
(when (member (car arg) '("-p" "--port") :test 'equal)
|
||||||
(require-arg arg)
|
(require-arg arg)
|
||||||
(setq *port* (parse-integer (second arg))))
|
(setq *port* (parse-integer (second arg))))
|
||||||
|
(when (member (car arg) '("-b" "--db") :test 'equal)
|
||||||
|
(require-arg arg)
|
||||||
|
(setq *db-path* (parse-integer (second arg))))
|
||||||
(when (member (car arg) '("-d" "--debug") :test 'equal)
|
(when (member (car arg) '("-d" "--debug") :test 'equal)
|
||||||
(setq *debug* t))))
|
(setq *debug* t))))
|
||||||
args))
|
args))
|
||||||
@ -28,6 +32,7 @@
|
|||||||
(format t "usage: sbcl --load ~a~%" *load-pathname*)
|
(format t "usage: sbcl --load ~a~%" *load-pathname*)
|
||||||
(format t " -h|--help print this message, then exit~%")
|
(format t " -h|--help print this message, then exit~%")
|
||||||
(format t " -d|--debug enable debug output~%")
|
(format t " -d|--debug enable debug output~%")
|
||||||
|
(format t " -b|--db path to the database (takes an argument)~%")
|
||||||
(format t " -p|--port the port to use (takes an argument)~%")
|
(format t " -p|--port the port to use (takes an argument)~%")
|
||||||
(format t " -i|--interface the address to bind to (takes an argument)~%")
|
(format t " -i|--interface the address to bind to (takes an argument)~%")
|
||||||
(uiop:quit))
|
(uiop:quit))
|
||||||
@ -35,4 +40,8 @@
|
|||||||
(parse-arguments)
|
(parse-arguments)
|
||||||
(if *help*
|
(if *help*
|
||||||
(print-help)
|
(print-help)
|
||||||
(reblocks/server:start :interface *interface* :port *port* :debug *debug*))
|
(progn
|
||||||
|
(format t "Loading database from ~s~%" *db-path*)
|
||||||
|
(myoji-accent/accent:initialize-connection *db-path*)
|
||||||
|
(format t "Starting server on ~s:~s~%" *interface* *port*)
|
||||||
|
(reblocks/server:start :interface *interface* :port *port* :debug *debug*)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user