<commit_before>#!/usr/bin/env gosh
;; -*- coding: euc-jp -*-

(use text.html-lite)
(use text.tree)

(define *version* "0.1.0")
(define *last-update* "Fri Aug 10 2007")

(define-syntax def
  (syntax-rules (en ja procedure method)
	((_ lang)
	 '())
	((_ en ((type name ...) (p ...) (q ...)) rest ...)
	 (def en ((type name ...) (p ...)) rest ...))
	((_ ja ((type name ...) (p ...) (q ...)) rest ...)
	 (def ja ((type name ...) (q ...)) rest ...))
	((_ lang ((procedure (name arg ...) ...) (p ...)) rest ...)
	 (list*
	  (html:h3 (html:span :class "type" "procedure") ": "
			   (html:span :class "procedure" (html-escape-string (symbol->string 'name))) " "
			   (cons (html:span :class "argument" 'arg) " ") ...)
	  ...
	  (html:p (html-escape-string p))
	  ...
	  (html:hr)
	  (def lang rest ...)))
	((_ lang ((method (name arg ...) ...) (p ...)) rest ...)
	 (list*
	  (html:h3 (html:span :class "type" "method") ": "
			   (html:span :class "method" (html-escape-string (symbol->string 'name))) " "
			   (cons (html:span :class "argument" (html-escape-string (x->string 'arg))) " ") ...)
	  ...
	  (html:p (html-escape-string p))
	  ...
	  (html:hr)
	  (def lang rest ...)))
	((_ lang ((type name ...) (p ...)) rest ...)
	 (list*
	  (html:h3 (html:span :class "type" 'type) ": "
			   (html:span :class 'type (html-escape-string (symbol->string 'name))))
	  ...
	  (html:p (html-escape-string p))
	  ...
	  (html:hr)
	  (def lang rest ...)))))

(define-macro (api lang)
  `(def ,lang
		((class <memcache-connection>)
		 ("The class abstracts connections to memcached."
          "You will get its instance by calling procedure \"memcache-connect\".")
		 ("Υ饹 memcached ؤ³ݲƤޤ"
          "memcache-connect Ƥ֤Ȥǥ󥹥󥹤ޤ"))

        ((class <memcache-error>
                <memcache-client-error>
                <memcache-server-error>)
         ("These errors represent ERROR, CLIENT_ERROR and SERVER_ERROR from memcached respectively."
          "An instance of either <memcache-client-error> or <memcache-server-error> has slot 'message'.")
         ("Υ顼Ϥ줾 memcached  ERRORCLIENT_ERROR  SERVER_ERROR ɽޤ"
          "<memcache-client-error>  <memcache-server-error> Υ󥹥󥹤ϥå 'message' ޤ"))

		((procedure (memcache-connect host port))
		 ("Return a connection to memcached. An error occurs if failed.")
		 ("memcached ؤ³֤ޤ³˼Ԥϥ顼𤵤ޤ"))

		((method (memcache-close (conn <memcache-connection>)))
		 ("Close the connection. See also method \"quit\".")
		 ("³Ĥޤ᥽å \"quit\" ⻲ȤƤ"))

        ((parameter *memcache-read-line-max*
                    *memcache-read-retry-max*
                    *memcache-read-nanosecond*)
         ("The parameter *memcache-read-line-max* keeps the max of length of the response line, which default value is 256"
          "For *memcache-read-retry-max* and *memcache-read-nanosecond*, read the source.")
         ("ѥ᡼ *memcache-read-line-max*  memcached Υ쥹ݥ󥹹ԤκĹݻͤ256Ǥ"
          "*memcache-read-retry-max*  *memcache-read-nanosecond* ˤĤƤϥɤǤ"))

        ((method (set (conn <memcache-connection>) key value &optional opt)
                 (add (conn <memcache-connection>) key value &optional opt)
                 (replace (conn <memcache-connection>) key value &optional opt))
         ("Set the value with key by command 'set'/'add'/'replace', resp."
          "Return #t in case of success, or #f otherwise.")
         (" key  value ĥȥϿޤ"
          "ξˤ #t 򡢤Ǥʤ #f ֤ޤ"))

        ((method (get (conn <memcache-connection>) &optional keys))
         ("Return entries with keys as alist.")
         (" keys ĥȥϢǼޤ"))

        ((method (delete (conn <memcache-connection>) key &optional opt))
         ("Delete the entry with key."
          "Return #t if done, or #f otherwise.")
         (" key ĥȥޤ"
          "ˤ #t 򡢤Ǥʤ #f ֤ޤ"))

        ((method (incr (conn <memcache-connection>) key value)
                 (decr (conn <memcache-connection>) key value))
         ("Increment/decrement the entry with key by value."
          "Return the resulting value if done, or #f if there is no such entry.")
         (" key ĥȥͤ value ʬ䤷ޤ/餷ޤ"
          "/ˤϷ̤֤ͤȥ꤬Ĥʤ #f ֤ޤ"))

        ((method (stats (conn <memcache-connection>) &optional opt))
         ("Return the stats of memcached as string.")
         ("memcached ׾ʸ֤ޤ"))

        ((method (flush-all (conn <memcache-connection>) &optional opt))
         ("Drop all of the entries with possible delay."
          "Return #t in case of success.")
         ("ƤΥȥޤopt ٱ䤵뤳ȤǤޤ"
          "ʤ #t ֤ޤ"))

        ((method (version (conn <memcache-connection>)))
         ("Return the version of memcached as string.")
         ("memcached ΥСʸ֤ޤ"))

        ((method (quit (conn <memcache-connection>)))
         ("Publish command 'quit'. See also method \"memcache-close\".")
         ("ޥ 'quit' ȯԤޤ᥽å \"memcache-close\" ⻲ȤƤ"))
		))

(define (document-tree lang)
  (let ((title (if (eq? 'ja lang) "Gauche-memcache ե󥹥ޥ˥奢" "Gauche-memcache Reference Manual")))
	(html:html
	 (html:head
	  (if (eq? 'ja lang) (html:meta :http-equiv "Content-Type" :content "text/html; charset=EUC-JP") '())
	  (html:title title))
	 (html:body
	  (html:h1 title)
	  (html:style
	   :type "text/css"
	   "<!-- \n"
	   "h2 { background-color:#dddddd; }\n"
	   "address { text-align: right; }\n"
	   ".type { font-size: medium; text-decoration: underline; }\n"
	   ".procedure { font-size: medium; font-weight: normal; }\n"
	   ".method { font-size: medium; font-weight: normal; }\n"
	   ".argument { font-size: small; font-style: oblique; font-weight: normal; }\n"
	   ".constant { font-size: medium; font-weight: normal; }\n"
	   ".variable { font-size: medium; font-weight: normal; }\n"
	   "#last_update { text-align: right; font-size: small; }\n"
	   "#project { text-align: right; }\n"
	   " -->")
	  (html:p "For version " *version*)
	  (html:p :id "last_update" "last update: " *last-update*)
	  (html:p :id "project" (html:a :href "http://fixedpoint.jp/gauche-memcache/" "http://fixedpoint.jp/gauche-memcache/"))
	  (if (eq? 'en lang)
		  (html:p (html:span :style "color:red;" "Warning:") " still unstable.")
		  (html:p (html:span :style "color:red;" "ٹ:") " ѹβǽޤ"))
      (html:h2 "Information")
      (if (eq? 'en lang)
          "At first see the protocol docs: "
          "ޤץȥΥɥȤ򻲾ȤƤ: ")
      (html:a :href "http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt"
              "http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt")
      (html:h2 "API")
	  (if (eq? 'en lang)
          (api en)
          (api ja))
      (html:h2 "CGI Session with memcache")
      (if (eq? 'en lang)
          "For documentation on CGI session with memcache, see: "
          "Memcache ˤ CGI åˤĤƤϼ򻲾ȤƤ: ")
      (html:a :href "http://fixedpoint.jp/gauche-cgi-ext/" "http://fixedpoint.jp/gauche-cgi-ext/")
	  (html:address "&copy; 2007 Takeshi Abe")
	  ))))

(define (main args)
  (define (usage)
	(format (current-error-port) "usage: gosh reference.scm (en|ja)\n")
	(exit 1))
  (when (< (length args) 2)
	(usage))
  (write-tree (document-tree (string->symbol (cadr args))))
  0)<commit_msg>mentioned the parameters on session. EUC-JP -> UTF-8<commit_after>#!/usr/bin/env gosh
;; -*- coding: euc-jp -*-

(use text.html-lite)
(use text.tree)

(define *version* "0.1.0")
(define *last-update* "Fri Aug 10 2007")

(define-syntax def
  (syntax-rules (en ja procedure method)
	((_ lang)
	 '())
	((_ en ((type name ...) (p ...) (q ...)) rest ...)
	 (def en ((type name ...) (p ...)) rest ...))
	((_ ja ((type name ...) (p ...) (q ...)) rest ...)
	 (def ja ((type name ...) (q ...)) rest ...))
	((_ lang ((procedure (name arg ...) ...) (p ...)) rest ...)
	 (list*
	  (html:h3 (html:span :class "type" "procedure") ": "
			   (html:span :class "procedure" (html-escape-string (symbol->string 'name))) " "
			   (cons (html:span :class "argument" 'arg) " ") ...)
	  ...
	  (html:p (html-escape-string p))
	  ...
	  (html:hr)
	  (def lang rest ...)))
	((_ lang ((method (name arg ...) ...) (p ...)) rest ...)
	 (list*
	  (html:h3 (html:span :class "type" "method") ": "
			   (html:span :class "method" (html-escape-string (symbol->string 'name))) " "
			   (cons (html:span :class "argument" (html-escape-string (x->string 'arg))) " ") ...)
	  ...
	  (html:p (html-escape-string p))
	  ...
	  (html:hr)
	  (def lang rest ...)))
	((_ lang ((type name ...) (p ...)) rest ...)
	 (list*
	  (html:h3 (html:span :class "type" 'type) ": "
			   (html:span :class 'type (html-escape-string (symbol->string 'name))))
	  ...
	  (html:p (html-escape-string p))
	  ...
	  (html:hr)
	  (def lang rest ...)))))

(define-macro (api lang)
  `(def ,lang
		((class <memcache-connection>)
		 ("The class abstracts connections to memcached."
          "You will get its instance by calling procedure \"memcache-connect\".")
		 ("Υ饹 memcached ؤ³ݲƤޤ"
          "memcache-connect Ƥ֤Ȥǥ󥹥󥹤ޤ"))

        ((class <memcache-error>
                <memcache-client-error>
                <memcache-server-error>)
         ("These errors represent ERROR, CLIENT_ERROR and SERVER_ERROR from memcached respectively."
          "An instance of either <memcache-client-error> or <memcache-server-error> has slot 'message'.")
         ("Υ顼Ϥ줾 memcached  ERRORCLIENT_ERROR  SERVER_ERROR ɽޤ"
          "<memcache-client-error>  <memcache-server-error> Υ󥹥󥹤ϥå 'message' ޤ"))

		((procedure (memcache-connect host port))
		 ("Return a connection to memcached. An error occurs if failed.")
		 ("memcached ؤ³֤ޤ³˼Ԥϥ顼𤵤ޤ"))

		((method (memcache-close (conn <memcache-connection>)))
		 ("Close the connection. See also method \"quit\".")
		 ("³Ĥޤ᥽å \"quit\" ⻲ȤƤ"))

        ((parameter *memcache-read-line-max*
                    *memcache-read-retry-max*
                    *memcache-read-nanosecond*)
         ("The parameter *memcache-read-line-max* keeps the max of length of the response line, which default value is 256"
          "For *memcache-read-retry-max* and *memcache-read-nanosecond*, read the source.")
         ("ѥ᡼ *memcache-read-line-max*  memcached Υ쥹ݥ󥹹ԤκĹݻͤ256Ǥ"
          "*memcache-read-retry-max*  *memcache-read-nanosecond* ˤĤƤϥɤǤ"))

        ((method (set (conn <memcache-connection>) key value &optional opt)
                 (add (conn <memcache-connection>) key value &optional opt)
                 (replace (conn <memcache-connection>) key value &optional opt))
         ("Set the value with key by command 'set'/'add'/'replace', resp."
          "Return #t in case of success, or #f otherwise.")
         (" key  value ĥȥϿޤ"
          "ξˤ #t 򡢤Ǥʤ #f ֤ޤ"))

        ((method (get (conn <memcache-connection>) &optional keys))
         ("Return entries with keys as alist.")
         (" keys ĥȥϢǼޤ"))

        ((method (delete (conn <memcache-connection>) key &optional opt))
         ("Delete the entry with key."
          "Return #t if done, or #f otherwise.")
         (" key ĥȥޤ"
          "ˤ #t 򡢤Ǥʤ #f ֤ޤ"))

        ((method (incr (conn <memcache-connection>) key value)
                 (decr (conn <memcache-connection>) key value))
         ("Increment/decrement the entry with key by value."
          "Return the resulting value if done, or #f if there is no such entry.")
         (" key ĥȥͤ value ʬ䤷ޤ/餷ޤ"
          "/ˤϷ̤֤ͤȥ꤬Ĥʤ #f ֤ޤ"))

        ((method (stats (conn <memcache-connection>) &optional opt))
         ("Return the stats of memcached as string.")
         ("memcached ׾ʸ֤ޤ"))

        ((method (flush-all (conn <memcache-connection>) &optional opt))
         ("Drop all of the entries with possible delay."
          "Return #t in case of success.")
         ("ƤΥȥޤopt ٱ䤵뤳ȤǤޤ"
          "ʤ #t ֤ޤ"))

        ((method (version (conn <memcache-connection>)))
         ("Return the version of memcached as string.")
         ("memcached ΥСʸ֤ޤ"))

        ((method (quit (conn <memcache-connection>)))
         ("Publish command 'quit'. See also method \"memcache-close\".")
         ("ޥ 'quit' ȯԤޤ᥽å \"memcache-close\" ⻲ȤƤ"))
		))

(define-macro (api-session lang)
  `(def ,lang
		((parameter *session-memcache-host*
                    *session-memcache-port*)
		 ("You can specify the hostname and port number of memcached by them, respectively."
          "As default they have value \"localhost\" and 11211.")
		 ("Υѥ᡼ˤä memcached Υۥ̾ȥݡֹǤޤ"
          "ͤϤ줾 \"localhost\"  11211 Ǥ"))))

(define (document-tree lang)
  (let ((title (if (eq? 'ja lang) "Gauche-memcache ե󥹥ޥ˥奢" "Gauche-memcache Reference Manual")))
	(html:html
	 (html:head
	  (if (eq? 'ja lang) (html:meta :http-equiv "Content-Type" :content "text/html; charset=UTF-8") '())
	  (html:title title))
	 (html:body
	  (html:h1 title)
	  (html:style
	   :type "text/css"
	   "<!-- \n"
	   "h2 { background-color:#dddddd; }\n"
	   "address { text-align: right; }\n"
	   ".type { font-size: medium; text-decoration: underline; }\n"
	   ".procedure { font-size: medium; font-weight: normal; }\n"
	   ".method { font-size: medium; font-weight: normal; }\n"
	   ".argument { font-size: small; font-style: oblique; font-weight: normal; }\n"
	   ".constant { font-size: medium; font-weight: normal; }\n"
	   ".variable { font-size: medium; font-weight: normal; }\n"
	   "#last_update { text-align: right; font-size: small; }\n"
	   "#project { text-align: right; }\n"
	   " -->")
	  (html:p "For version " *version*)
	  (html:p :id "last_update" "last update: " *last-update*)
	  (html:p :id "project" (html:a :href "http://fixedpoint.jp/gauche-memcache/" "http://fixedpoint.jp/gauche-memcache/"))
	  (if (eq? 'en lang)
		  (html:p (html:span :style "color:red;" "Warning:") " still unstable.")
		  (html:p (html:span :style "color:red;" "ٹ:") " ѹβǽޤ"))
      (html:h2 "Information")
      (if (eq? 'en lang)
          "At first see the protocol docs: "
          "ޤץȥΥɥȤ򻲾ȤƤ: ")
      (html:a :href "http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt"
              "http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt")
      (html:h2 "API")
	  (if (eq? 'en lang)
          (api en)
          (api ja))
      (html:h2 "CGI Session with memcache")
      (if (eq? 'en lang)
          "For documentation on CGI session with Gauche-cgi-ext we assume, see: "
          "ꤹ Gauche-cgi-ext ˤ CGI åˤĤƤϼ򻲾ȤƤ: ")
      (html:a :href "http://fixedpoint.jp/gauche-cgi-ext/" "http://fixedpoint.jp/gauche-cgi-ext/")
      (if (eq? 'en lang)
          (api-session en)
          (api-session ja))
	  (html:address "&copy; 2007 <NAME>")
	  ))))

(define (main args)
  (define (usage)
	(format (current-error-port) "usage: gosh reference.scm (en|ja)\n")
	(exit 1))
  (when (< (length args) 2)
	(usage))
  (write-tree (document-tree (string->symbol (cadr args))))
  0)
{'fraction_non_alphanumeric': 0.18523085354158103, 'fraction_numerical': 0.004932182490752158, 'mean_word_length': 2.5195274831243974, 'pattern_counts': {'":': 6, '<': 48, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2709676', 'n_tokens_mistral': 5653, 'n_tokens_neox': 5293, 'n_words': 1375}