diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-04-14 12:46:44 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-04-14 12:46:44 +0300 |
commit | 302a74e565999792d3cac79df23ee93b01e49f52 (patch) | |
tree | 0d6b456092fb092ff71a46d2e23557b3955a9fb6 | |
parent | 391b9afdd48db47f95567dbf1c3c9d2cc1029415 (diff) | |
download | gamma-302a74e565999792d3cac79df23ee93b01e49f52.tar.gz gamma-302a74e565999792d3cac79df23ee93b01e49f52.tar.bz2 |
Upgrade gint version.
* gint: Upgrade.
* src/Makefile.am: Initialize BUILT_SOURCES.
* src/gamma-expat.c: Use lower-case names for
parameters to SCM interfaces. Improve docstrings.
* src/gsql_conn.c: Likewise.
* src/syslog-port.c: Likewise.
* src/syslog.c: Likewise.
m--------- | gint | 0 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/gamma-expat.c | 85 | ||||
-rw-r--r-- | src/gsql_conn.c | 76 | ||||
-rw-r--r-- | src/syslog-port.c | 6 | ||||
-rw-r--r-- | src/syslog.c | 45 |
6 files changed, 128 insertions, 85 deletions
diff --git a/gint b/gint -Subproject c6a7620deb7e3e139329e2daad31d4071f01b43 +Subproject 4254b0590e609b82dac3d688ecb401c9eefb7e2 diff --git a/src/Makefile.am b/src/Makefile.am index 7ae8351..6fc983a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,5 +40,6 @@ AM_CPPFLAGS=-DDATADIR=\"$(guiledir)\" SUFFIXES= CLEANFILES= +BUILT_SOURCES= include ../gint/gint.mk diff --git a/src/gamma-expat.c b/src/gamma-expat.c index 2dcfbfa..b70fe32 100644 --- a/src/gamma-expat.c +++ b/src/gamma-expat.c @@ -110,16 +110,17 @@ make_user_data () SCM_GLOBAL_SYMBOL(gamma_xml_error, "gamma-xml-error"); -SCM_DEFINE_PUBLIC(scm_xml_expat_version_string, "xml-expat-version-string", 0, 0, 0, - (), - "Return the version of the expat library as a string.") +SCM_DEFINE_PUBLIC(scm_xml_expat_version_string, "xml-expat-version-string", + 0, 0, 0, + (), + "Return the version of the expat library as a string.") { return scm_from_locale_string(XML_ExpatVersion()); } SCM_DEFINE_PUBLIC(scm_xml_expat_version, "xml-expat-version", 0, 0, 0, - (), - "Return expat library version information.") + (), + "Return expat library version information.") { XML_Expat_Version vinfo = XML_ExpatVersionInfo(); return scm_list_3(scm_from_int(vinfo.major), @@ -127,14 +128,15 @@ SCM_DEFINE_PUBLIC(scm_xml_expat_version, "xml-expat-version", 0, 0, 0, scm_from_int(vinfo.micro)); } -SCM_DEFINE_PUBLIC(scm_xml_primitive_make_parser, "xml-primitive-make-parser", 0, 2, 0, - (SCM enc, SCM sep), - "Return a new parser. If @var{enc} is given, it must be one of:" - " \"US-ASCII\", \"UTF-8\", \"UTF-16\", \"ISO-8859-1\". If @var{sep}" - "is given, the returned parser has namespace processing in effect. " - "In that case, @var{sep} is a character which is used as a " - "separator between the namespace @acronym{URI} and the local part " - "of the name in returned namespace element and attribute names.") +SCM_DEFINE_PUBLIC(scm_xml_primitive_make_parser, "xml-primitive-make-parser", + 0, 2, 0, + (SCM enc, SCM sep), +"Return a new parser. If @var{enc} is given, it must be one of: " +"@samp{US-ASCII}, @samp{UTF-8}, @samp{UTF-16}, @samp{ISO-8859-1}. If @var{sep} " +"is given, the returned parser has namespace processing in effect. " +"In that case, @var{sep} is a character which is used as a " +"separator between the namespace @acronym{URI} and the local part " +"of the name in returned namespace element and attribute names.") #define FUNC_NAME s_scm_xml_primitive_make_parser { XML_Char *encoding = NULL; @@ -160,8 +162,8 @@ SCM_DEFINE_PUBLIC(scm_xml_primitive_make_parser, "xml-primitive-make-parser", 0, #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_xml_set_encoding, "xml-set-encoding", 2, 0, 0, - (SCM parser, SCM enc), - "Set the encoding to be used by the @var{parser}.") + (SCM parser, SCM enc), + "Set the encoding to be used by the @var{parser}.") #define FUNC_NAME s_scm_xml_set_encoding { struct gamma_xml_parser *gp; @@ -188,8 +190,8 @@ SCM_DEFINE_PUBLIC(scm_xml_set_encoding, "xml-set-encoding", 2, 0, 0, #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_xml_primitive_parse, "xml-primitive-parse", 3, 0, 0, - (SCM parser, SCM input, SCM isfinal), - "Parse next piece of input") + (SCM parser, SCM input, SCM isfinal), + "Parse next piece of input") #define FUNC_NAME s_scm_xml_primitive_parse { struct gamma_xml_parser *gp; @@ -234,8 +236,8 @@ SCM_DEFINE_PUBLIC(scm_xml_primitive_parse, "xml-primitive-parse", 3, 0, 0, #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_xml_default_current, "xml-default-current", 1, 0, 0, - (SCM parser), - "Pass current markup to the default handler.") + (SCM parser), +"Pass current markup to the default handler.") #define FUNC_NAME s_scm_xml_default_current { struct gamma_xml_parser *gp; @@ -249,8 +251,8 @@ SCM_DEFINE_PUBLIC(scm_xml_default_current, "xml-default-current", 1, 0, 0, #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_xml_error_string, "xml-error-string", 1, 0, 0, - (SCM code), - "Return a textual description corresponding to the error @code{code}.") + (SCM code), +"Return a textual description of the error @code{code}.") #define FUNC_NAME s_scm_xml_error_string { const char *p; @@ -260,10 +262,11 @@ SCM_DEFINE_PUBLIC(scm_xml_error_string, "xml-error-string", 1, 0, 0, } #undef FUNC_NAME -SCM_DEFINE_PUBLIC(scm_xml_current_line_number, "xml-current-line-number", 1, 0, 0, - (SCM parser), - "Return the current line number in the input stream. " - "The first line is reported as 1.") +SCM_DEFINE_PUBLIC(scm_xml_current_line_number, "xml-current-line-number", + 1, 0, 0, + (SCM parser), +"Return current line number in the input stream. " +"The first line is reported as 1.") #define FUNC_NAME s_scm_xml_current_line_number { struct gamma_xml_parser *gp; @@ -275,10 +278,11 @@ SCM_DEFINE_PUBLIC(scm_xml_current_line_number, "xml-current-line-number", 1, 0, } #undef FUNC_NAME -SCM_DEFINE_PUBLIC(scm_xml_current_column_number, "xml-current-column-number", 1, 0, 0, - (SCM parser), - "Return the current column number in the input stream. " - "The first column is reported as 0.") +SCM_DEFINE_PUBLIC(scm_xml_current_column_number, "xml-current-column-number", + 1, 0, 0, + (SCM parser), +"Return current column number in the input stream. " +"The first column is reported as 0.") #define FUNC_NAME s_scm_xml_current_column_number { struct gamma_xml_parser *gp; @@ -290,13 +294,14 @@ SCM_DEFINE_PUBLIC(scm_xml_current_column_number, "xml-current-column-number", 1, } #undef FUNC_NAME -SCM_DEFINE_PUBLIC(scm_xml_current_byte_count, "xml-current-byte-count", 1, 0, 0, - (SCM parser), - "Return the number of bytes in the current event. " - "Returns 0 if the event is inside a reference to an internal " - "entity and for the end-tag event for empty element tags " - "(the later can be used to distinguish empty-element tags " - "from empty elements using separate start and end tags).") +SCM_DEFINE_PUBLIC(scm_xml_current_byte_count, "xml-current-byte-count", + 1, 0, 0, + (SCM parser), +"Return the number of bytes in the current event. " +"Returns 0 if the event is inside a reference to an internal " +"entity and for the end-tag event for empty element tags " +"(the later can be used to distinguish empty-element tags " +"from empty elements using separate start and end tags).") #define FUNC_NAME s_scm_xml_current_byte_count { struct gamma_xml_parser *gp; @@ -884,9 +889,11 @@ find_generic_handler_setter(SCM key) return -1; } -SCM_DEFINE_PUBLIC(scm_xml_primitive_set_handler, "xml-primitive-set-handler", 3, 0, 0, - (SCM parser, SCM key, SCM handler), - "Set XML handler for event @code{key}.") +SCM_DEFINE_PUBLIC(scm_xml_primitive_set_handler, "xml-primitive-set-handler", + 3, 0, 0, + (SCM parser, SCM key, SCM handler), +"Set XML callback handler for event @code{key} in parser @var{parser} " +"to @var{handler}.") #define FUNC_NAME s_scm_xml_primitive_set_handler { struct gamma_xml_parser *gp; diff --git a/src/gsql_conn.c b/src/gsql_conn.c index 86bf926..4d53a03 100644 --- a/src/gsql_conn.c +++ b/src/gsql_conn.c @@ -135,8 +135,35 @@ gamma_cvt_iface(SCM inval, void *outval, const char *func_name) SCM_DEFINE_PUBLIC (sql_open_connection, "sql-open-connection", 1, 0, 0, - (SCM PARAM), - "Connect to a database.") + (SCM param), +"Connect to a database. Take connection parameters from @var{param}, " +"which must be a list of conses. In each cons, the @samp{car} contains " +"a @dfn{key} identifying the parameter, and the @samp{cdr} supplies the " +"value for that parameter.\n" +"\n" +"Valid keys are:\n" +"@table @asis\n" +"@item #:iface\n" +"Defines the type of the @acronym{SQL} interface (either @samp{mysql} or " +"@samp{postgres}.\n" +"@item #:host\n" +"Server host name.\n" +"@item #:port\n" +"Port number on @samp{#:host}.\n" +"@item #:socket\n" +"Socket path, if the server is listening on a UNIX socket. Either\n" +"@samp{#:port} or @samp{#:socket} may be given, but not both.\n" +"@item #:user\n" +"Sets the @acronym{SQL} user name.\n" +"@item #:pass\n" +"Sets the password for @samp{#:user}\n" +"@item #:ssl-cert\n" +"Full pathname of the @acronym{SSL} certificate to use (MySQL only).\n" +"@item #:config-file\n" +"Read missing parameters from the specified file (MySQL only).\n" +"@item #:config-group\n" +"Read the specified group in the config file (MySQL only).\n" +"@end table\n") #define FUNC_NAME s_sql_open_connection { int iface; @@ -148,44 +175,51 @@ SCM_DEFINE_PUBLIC (sql_open_connection, "sql-open-connection", 1, 0, 0, SCM smob; - SCM_ASSERT(scm_is_pair(PARAM), PARAM, SCM_ARG1, FUNC_NAME); - gamma_parmlist_parse (PARAM, dcltab, + SCM_ASSERT(scm_is_pair(param), param, SCM_ARG1, FUNC_NAME); + gamma_parmlist_parse (param, dcltab, GAMMA_PARMLIST_IGNORE_UNKNOWN, FUNC_NAME); - smob = sql_iftab[iface].connect(PARAM, FUNC_NAME); + smob = sql_iftab[iface].connect(param, FUNC_NAME); return smob; } #undef FUNC_NAME SCM_DEFINE_PUBLIC (sql_close_connection, "sql-close-connection", 1, 0, 0, - (SCM CONN), - "Close connection to a database.") + (SCM conn), + "Close connection to a database.") #define FUNC_NAME s_sql_close_connection { - struct sql_connect *conn; - SCM_ASSERT(scm_is_sql_connect(CONN), CONN, SCM_ARG1, FUNC_NAME); - conn = (struct sql_connect *)SCM_CDR(CONN); - sql_iftab[conn->iface].close(conn); + struct sql_connect *cp; + SCM_ASSERT(scm_is_sql_connect(conn), conn, SCM_ARG1, FUNC_NAME); + cp = (struct sql_connect *)SCM_CDR(conn); + sql_iftab[cp->iface].close(cp); return SCM_UNSPECIFIED; } #undef FUNC_NAME SCM_DEFINE_PUBLIC (sql_query, "sql-query", 2, 0, 0, - (SCM CONN, SCM QUERY), - "Run an SQL query") + (SCM conn, SCM query), +"Send the SQL query @var{query} to the server using connection @var{conn} \ +and return the result.\n\ +If @var{query} is a @samp{SELECT}, or similar query, returning tuples, the \ +return value is a list of rows. Each row is a list of values, one for each \ +column. All values are returned as strings. NULL values are returned as \ +@samp{#f}.\n\n\ +If @var{query} is an @samp{UPDATE} (or a similar query), @code{sql-query} \ +returns number of rows affected by the query.\n") #define FUNC_NAME s_sql_query { - struct sql_connect *conn; - char *query; + struct sql_connect *conn_ptr; + char *query_ptr; SCM ret; - SCM_ASSERT(scm_is_sql_connect(CONN), CONN, SCM_ARG1, FUNC_NAME); - SCM_ASSERT(scm_is_string(QUERY), QUERY, SCM_ARG2, FUNC_NAME); - conn = (struct sql_connect *)SCM_CDR(CONN); - query = scm_to_locale_string(QUERY); - ret = sql_iftab[conn->iface].query(conn, query); - free(query); + SCM_ASSERT(scm_is_sql_connect(conn), conn, SCM_ARG1, FUNC_NAME); + SCM_ASSERT(scm_is_string(query), query, SCM_ARG2, FUNC_NAME); + conn_ptr = (struct sql_connect *)SCM_CDR(conn); + query_ptr = scm_to_locale_string(query); + ret = sql_iftab[conn_ptr->iface].query(conn_ptr, query_ptr); + free(query_ptr); return ret; } #undef FUNC_NAME diff --git a/src/syslog-port.c b/src/syslog-port.c index 3088f48..4b27ef9 100644 --- a/src/syslog-port.c +++ b/src/syslog-port.c @@ -167,9 +167,9 @@ _syslog_port_print(SCM exp, SCM port, scm_print_state *pstate) } SCM_DEFINE_PUBLIC(scm_open_syslog_port, "open-syslog-port", 1, 0, 0, - (SCM prio), - "Create and open an output port connected to syslog priority " - "@code{prio}.") + (SCM prio), +"Create and open an output port connected to syslog priority " +"@code{prio}.") #define FUNC_NAME s_scm_open_syslog_port { SCM_ASSERT(scm_is_integer(prio), prio, SCM_ARG1, FUNC_NAME); diff --git a/src/syslog.c b/src/syslog.c index 088b7b2..82bc688 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -24,25 +24,26 @@ static char *log_tag; SCM_DEFINE_PUBLIC(scm_openlog, "openlog", 3, 0, 0, - (SCM IDENT, SCM OPTION, SCM FACILITY), -"Opens a connection to the system logger for Guile program.\n" -"IDENT, OPTION and FACILITY have the same meaning as in openlog(3)") + (SCM ident, SCM option, SCM facility), +"Opens a connection to the system logger for Guile program.\n\ +The arguments @var{ident}, @var{option} and @var{facility} have the same \ +meaning as in openlog(3)\n") #define FUNC_NAME s_scm_openlog { - SCM_ASSERT(scm_is_string(IDENT), IDENT, SCM_ARG1, FUNC_NAME); + SCM_ASSERT(scm_is_string(ident), ident, SCM_ARG1, FUNC_NAME); if (log_tag) free(log_tag); - log_tag = scm_to_locale_string(IDENT); - SCM_ASSERT(scm_is_integer(OPTION), OPTION, SCM_ARG2, FUNC_NAME); - SCM_ASSERT(scm_is_integer(FACILITY), FACILITY, SCM_ARG3, FUNC_NAME); - openlog(log_tag, scm_to_int(OPTION), scm_to_int(FACILITY)); + log_tag = scm_to_locale_string(ident); + SCM_ASSERT(scm_is_integer(option), option, SCM_ARG2, FUNC_NAME); + SCM_ASSERT(scm_is_integer(facility), facility, SCM_ARG3, FUNC_NAME); + openlog(log_tag, scm_to_int(option), scm_to_int(facility)); return SCM_UNSPECIFIED; } #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_openlog_p, "openlog?", 0, 0, 0, - (), - "Returns #t if @code{openlog} was called.") + (), +"Returns @samp{#t} if @code{openlog} has already been called.\n") #define FUNC_NAME s_scm_openlog_p { return log_tag ? SCM_BOOL_T : SCM_BOOL_F; @@ -50,8 +51,8 @@ SCM_DEFINE_PUBLIC(scm_openlog_p, "openlog?", 0, 0, 0, #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_syslog_tag, "syslog-tag", 0, 0, 0, - (), - "Returns the tag given to the recent @code{openlog}.") + (), +"Returns the tag given to the recent @code{openlog} invocation.\n") #define FUNC_NAME s_scm_syslog_tag { if (!log_tag) @@ -63,27 +64,27 @@ SCM_DEFINE_PUBLIC(scm_syslog_tag, "syslog-tag", 0, 0, 0, #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_syslog, "syslog", 2, 0, 0, - (SCM PRIO, SCM TEXT), - "Distributes TEXT via syslogd priority PRIO.") + (SCM prio, SCM text), +"Distributes @var{text} via syslogd priority @var{prio}.\n") #define FUNC_NAME s_scm_syslog { - int prio; + int nprio; char *str; - SCM_ASSERT(scm_is_integer(PRIO), PRIO, SCM_ARG1, FUNC_NAME); - prio = scm_to_int(PRIO); + SCM_ASSERT(scm_is_integer(prio), prio, SCM_ARG1, FUNC_NAME); + nprio = scm_to_int(prio); - SCM_ASSERT(scm_is_string(TEXT), TEXT, SCM_ARG2, FUNC_NAME); - str = scm_to_locale_string(TEXT); - syslog(prio, "%s", str); + SCM_ASSERT(scm_is_string(text), text, SCM_ARG2, FUNC_NAME); + str = scm_to_locale_string(text); + syslog(nprio, "%s", str); free(str); return SCM_UNSPECIFIED; } #undef FUNC_NAME SCM_DEFINE_PUBLIC(scm_closelog, "closelog", 0, 0, 0, - (), - "Closes the channel to the system logger opened by @code{openlog}.") + (), +"Closes the channel to the system logger opened by @code{openlog}.\n") #define FUNC_NAME s_scm_closelog { closelog(); |