common-lisp-study/clog/clog.lisp

84 lines
2.9 KiB
Common Lisp

;; here's most up-to-date thing?
;; https://github.com/rabbibotton/clog
;;
;; welp currently can't load clog, libraries are not found
;; tried to add openssl to buildinputs, but not yet working
(defun pkg-config-add-lib (libname)
(let ((process (sb-ext:run-program "/usr/bin/env"
(list "pkg-config" libname "--libs-only-L")
:input t :output :stream :wait t)))
(let ((stream (sb-ext:process-output process)))
(loop for line = (read-line stream nil nil)
while line do
(format t "~&another lib ~S" line)
;; Drop "-L" part, and add '/' to the end '/' IS necessary!
;; (pushnew (pathname (concatenate 'string (subseq line 2) "/"))
;; cffi:*foreign-library-directories*))
(sb-ext:process-close process)))))
(pkg-config-add-lib "libcrypto")
;; nope, I don't understand it, and it doesn't work
(ql:quickload :clog)
(set-on-new-window (lambda (body) (create-div body :content "hello world.")))
(dotimes (n 10) (create-div *body* :content (format nil "Line ~A - Hello World" n)) (sleep .3))
(clog:is-running-p)
(clog:debug-mode)
(in-package clog-user)
(clog-install-dir)
;; #P"/home/efim/quicklisp/local-projects/clog/"
(ql:quickload :clog/tools) ; clog-terminal not found =C
(ql:quickload :clog-terminal/tools) ; well, my guess is that I'm not using latest? since I've what, downloaded to local projects
; instead of adding a repository?
;; yup, some repos weren't cloned
(clog-tools:clog-builder)
(clog:open-manual)
(ql:quickload :clog/terminal) ; yup after cloning more repos
(clog-tools:clog-db-admin)
;; (initialize)
;; well, now it's time to try to go through tutorials, i guess
(clog:run-tutorial 1)
;; #P"/home/efim/quicklisp/local-projects/clog/"
;; ~/quicklisp/local-projects/clog/tutorial/README.md
(defun my-setup (body)
(let ((header (create-child body "<h1>lalalla</h1>"))
(colors '(:black :blue :green)))
(setf (color header) :efim)
(set-on-click header
(lambda (obj)
(declare (ignore obj))
;; if set value in debugger, this is how to delete it
;; since it's just created in image
;; (boundp 'colors)
;; (makunbound 'colors)
(nth (random (length colors)) colors)
(setf (color header) (nth (random (length colors)) colors)))))
(create-child body "<p>lalalla</p>")) ; now, that doesn't work.
(initialize #'my-setup)
(open-browser)
;; and for each element, we can call #'set-on-click
;; next things I'd like to do is random colors, I guess
;; but how do I look which colors can be used?
;; it would seem that it just takes value of the keyword and puts it into html property
;; but
;; well, it's not that.