Commit 9a600f9d authored by Arturo Espinosa's avatar Arturo Espinosa
Browse files

More documentation integration:



More documentation integration:

1. Finished documenting the Gnumeric functions.
2. Fix bugs in the DocBook sgml
3. Add script to create Docbook function reference
4. Use Gnumeric's --dump-func-defs and generate
   function reference.

Miguel.
parent a4f0f363
1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-misc.c: Added documentation for the functions in this file.
1999-01-26 Bruno Unna <bruno@iac.com.mx>
* src/dialog-cell-format.c (create_coloring_page): Now, the
......
1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-misc.c: Added documentation for the functions in this file.
1999-01-26 Bruno Unna <bruno@iac.com.mx>
* src/dialog-cell-format.c (create_coloring_page): Now, the
......
SUBDIRS = intl po macros plugins src
SUBDIRS = intl po macros plugins src doc
EXTRA_DIST = \
gnumeric.desktop README HACKING \
......
1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-misc.c: Added documentation for the functions in this file.
1999-01-26 Bruno Unna <bruno@iac.com.mx>
* src/dialog-cell-format.c (create_coloring_page): Now, the
......
1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-misc.c: Added documentation for the functions in this file.
1999-01-26 Bruno Unna <bruno@iac.com.mx>
* src/dialog-cell-format.c (create_coloring_page): Now, the
......
......@@ -12,9 +12,10 @@ SGML_FILES = \
files.sgml \
formats.sgml \
formulas.sgml \
func-header.sgml \
func-footer.sgml \
functions.sgml \
gnumeric.sgml \
intro.sgml \
number-format.sgml \
selections.sgml \
text-entry.sgml \
......@@ -38,6 +39,18 @@ gnumeric.html: gnumeric/gnumeric.html
gnumeric/gnumeric.html: $(SGML_FILES)
-db2html gnumeric.sgml
functions.sgml: func-list.sgml func-index.sgml func-header.sgml func-footer.sgml
cat $(srcdir)/func-header.sgml func-index.sgml func-list.sgml $(srcdir)/func-footer.sgml > functions.sgml
func-list.sgml: func.defs $(srcdir)/make-docbook.pl
perl $(srcdir)/make-docbook.pl func.defs > func-list.sgml
func-index.sgml: func.defs $(srcdir)/make-index.pl
perl $(srcdir)/make-index.pl func.defs > func-index.sgml
func.defs: $(top_builddir)/src/gnumeric
$(top_builddir)/src/gnumeric --dump-func-defs=func.defs
dist-hook:
mkdir $(distdir)/gnumeric
-cp gnumeric/*.html gnumeric/*.css $(distdir)/gnumeric
......
......@@ -240,7 +240,7 @@
<keycap>Backspace</keycap></keycombo></para>
</sect2>
</sect1>
<sect1>
......
</sect1>
\ No newline at end of file
<sect1>
<title>Reference</title>
This diff is collapsed.
......@@ -7,6 +7,7 @@
<!entity autofill SYSTEM "autofill.sgml">
<!entity worksheet SYSTEM "worksheet.sgml">
<!entity files SYSTEM "files.sgml">
<!entity functions SYSTEM "functions.sgml">
]>
<book id="gnumeric">
<bookinfo>
......@@ -91,6 +92,10 @@
<para>boxes, labels, etc eventually.</para>
</chapter>
<chapter id="function-reference">
<title>Gnumeric Function Reference</title>
&functions;
</chapter>
</book>
......
$state = 0;
while (<>){
if (/^\@FUNCTION=(.*)/){
$func=$1;
$state = 0;
print "\n\n";
print " <refentry>\n";
print " <refmeta>\n";
print " <refentrytitle><anchor id=\"gnumeric-$1\">$1</refentrytitle><refmiscinfo></refmiscinfo>\n";
print " </refmeta>\n";
print " <refnamediv>\n";
print " <refname>$1</refname>\n";
print " <refpurpose></refpurpose>\n";
print " </refnamediv>\n";
next;
}
if (/^\@SYNTAX=(.*)/){
print " <refsynopsisdiv>\n";
print " <synopsis>$1</synopsis>\n";
print " </refsynopsisdiv>\n";
next;
}
if (/^\@DESCRIPTION=(.*)/){
print " <refsect1>\n";
print " <title>Description</title>\n";
print " <para>$1</para>\n";
$state = 1;
next;
}
if (/^\@SEEALSO=(.*)/){
@links = split (/,/, $1);
print "\n </refsect1>";
print "\n <refsect1><title>See also</title>\n";
@a = ();
print " <para>";
foreach $link (@links){
$link =~ s/ //g;
push @a, " <link linkend=\"gnumeric-$link\">$link</link>\n";
}
print join (", ", @a);
print " </para>\n";
print " </refsect1>\n";
print " </refentry>\n\n";
$state = 0;
next;
}
if ($state){
chop;
print " <para>$_</para>";
}
}
gnumeric.html Gnumeric manual
\ No newline at end of file
gnumeric.html Gnumeric manual
function-reference.html Gnumeric Functions reference
......@@ -173,7 +173,7 @@ static char *help_hour = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=MINUTE, NOW, TIME, SECOND")
};
......@@ -188,7 +188,7 @@ static char *help_minute = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=HOUR, NOW, TIME, SECOND")
};
......@@ -203,7 +203,7 @@ static char *help_second = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=HOUR, MINUTE, NOW, TIME")
};
......@@ -240,7 +240,7 @@ static char *help_year = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=DAY, MONTH, TIME, NOW")
};
......@@ -254,7 +254,7 @@ static char *help_month = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=DAY, TIME, NOW, YEAR")
};
......@@ -268,7 +268,7 @@ static char *help_day = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=MONTH, TIME, NOW, YEAR")
};
......
......@@ -13,6 +13,17 @@
#include "utils.h"
#include "func.h"
static char *help_char = {
N_("@FUNCTION=CHAR\n"
"@SYNTAX=CHAR(x)\n"
"@DESCRIPTION="
"Returns the ascii character reprensented by the number x."
"\n"
"@SEEALSO=CODE")
};
static Value *
gnumeric_char (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
......@@ -24,6 +35,17 @@ gnumeric_char (struct FunctionDefinition *i, Value *argv [], char **error_string
return value_str (result);
}
static char *help_code = {
N_("@FUNCTION=CODE\n"
"@SYNTAX=CODE(char)\n"
"@DESCRIPTION="
"Returns the ASCII number for the character char."
"\n"
"@SEEALSO=CHAR")
};
static Value *
gnumeric_code (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
......@@ -35,6 +57,17 @@ gnumeric_code (struct FunctionDefinition *i, Value *argv [], char **error_string
return value_int (argv [0]->v.str->str [0]);
}
static char *help_exact = {
N_("@FUNCTION=EXACT\n"
"@SYNTAX=EXACT(string1, string2)\n"
"@DESCRIPTION="
"Returns true if string1 is exactly equal to string2 (this routine is case sensitive."
"\n"
"@SEEALSO=")
};
static Value *
gnumeric_exact (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
......@@ -46,6 +79,17 @@ gnumeric_exact (struct FunctionDefinition *i, Value *argv [], char **error_strin
return value_int (strcmp (argv [0]->v.str->str, argv [1]->v.str->str) == 0);
}
static char *help_len = {
N_("@FUNCTION=LEN\n"
"@SYNTAX=LEN(string)\n"
"@DESCRIPTION="
"Returns the length in characters of the string @string."
"\n"
"@SEEALSO=CHAR, CODE")
};
static Value *
gnumeric_len (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
......@@ -128,6 +172,16 @@ gnumeric_left (void *sheet, GList *expr_node_list, int eval_col, int eval_row, c
return v;
}
static char *help_lower = {
N_("@FUNCTION=LOWER\n"
"@SYNTAX=LOWER(text)\n"
"@DESCRIPTION="
"Returns a lower-case version of the string in @text"
"\n"
"@SEEALSO=UPPER")
};
static Value *
gnumeric_lower (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
......@@ -149,6 +203,54 @@ gnumeric_lower (struct FunctionDefinition *i, Value *argv [], char **error_strin
return v;
}
static char *help_mid = {
N_("@FUNCTION=MID\n"
"@SYNTAX=MID(string, position, length)\n"
"@DESCRIPTION="
"Returns a substring from @string starting at @position for @lenght characters."
"\n"
"@SEEALSO=LEFT, RIGHT")
};
static Value *
gnumeric_mid (struct FunctionDefinition *i, Value *argv [], char **error)
{
Value *v;
int pos, len;
char *s, *source;
if (argv [0]->type != VALUE_STRING ||
argv [1]->type != VALUE_INTEGER ||
argv [2]->type != VALUE_INTEGER){
*error = "Type mismatch";
return NULL;
}
len = value_get_as_int (argv [2]);
pos = value_get_as_int (argv [1]);
if (len < 0 || pos < 0){
*error = "Invalid arguments";
return NULL;
}
source = argv [0]->v.str->str;
if (pos > strlen (source))
return value_str ("");
s = g_malloc0 (len);
strncpy (s, source + pos, len);
v = value_str (s);
g_free (s);
return v;
}
static char *help_right = {
N_("@FUNCTION=RIGHT\n"
"@SYNTAX=RIGHT(text[,num_chars])\n"
......@@ -189,6 +291,16 @@ gnumeric_right (void *sheet, GList *expr_node_list, int eval_col, int eval_row,
return v;
}
static char *help_upper = {
N_("@FUNCTION=UPPER\n"
"@SYNTAX=UPPER(text)\n"
"@DESCRIPTION="
"Returns a upper-case version of the string in @text"
"\n"
"@SEEALSO=LOWER")
};
static Value *
gnumeric_upper (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
......@@ -211,22 +323,21 @@ gnumeric_upper (struct FunctionDefinition *i, Value *argv [], char **error_strin
}
FunctionDefinition string_functions [] = {
{ "char", "f", "number", NULL, NULL, gnumeric_char },
{ "code", "s", "text", NULL, NULL, gnumeric_code },
{ "exact", "ss", "text1,text2", NULL, NULL, gnumeric_exact },
{ "left", 0, "text,num_chars", &help_left, gnumeric_left, NULL },
{ "len", "s", "text", NULL, NULL, gnumeric_len },
{ "lower", "s", "text", NULL, NULL, gnumeric_lower },
{ "char", "f", "number", &help_char, NULL, gnumeric_char },
{ "code", "s", "text", &help_code, NULL, gnumeric_code },
{ "exact", "ss", "text1,text2", &help_exact, NULL, gnumeric_exact },
{ "left", 0, "text,num_chars", &help_left, gnumeric_left, NULL },
{ "len", "s", "text", &help_len, NULL, gnumeric_len },
{ "lower", "s", "text", &help_lower, NULL, gnumeric_lower },
{ "mid", "sff","text,pos,num", &help_mid, NULL, gnumeric_mid },
{ "right", 0, "text,num_chars", &help_right, gnumeric_right, NULL },
{ "upper", "s", "text", NULL, NULL, gnumeric_upper },
{ "upper", "s", "text", &help_upper, NULL, gnumeric_upper },
{ NULL, NULL },
};
/*
* Missing:
*
* CLEAN(text) removes non-printable character from text
*
* DOLLAR(number [,decimals] formats number as currency.
*
* FIXED (number, decimals, no_comma)
......@@ -234,8 +345,6 @@ FunctionDefinition string_functions [] = {
*
* FIND (find_text, within_text [,start_at_num])
*
* MID (text, start_num, num_chars)
*
* PROPER(text) capitalizes the first letter in each word of a text value
*
* REPLACE(old_text, start_num, num_chars, new_text)
......
......@@ -27,6 +27,9 @@ dialog_about (Workbook *wb)
"Federico Mena, Canvas support.",
"Adrian Likins, Documentation, debugging",
"Jakub Jelinek, Gnumeric hacker",
"Michael Meeks, Excel and OLE2 importing",
"Bruno Unna, Excel code",
"Mark Probst, Guile support",
NULL
};
......
......@@ -27,6 +27,9 @@ dialog_about (Workbook *wb)
"Federico Mena, Canvas support.",
"Adrian Likins, Documentation, debugging",
"Jakub Jelinek, Gnumeric hacker",
"Michael Meeks, Excel and OLE2 importing",
"Bruno Unna, Excel code",
"Mark Probst, Guile support",
NULL
};
......
......@@ -173,7 +173,7 @@ static char *help_hour = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=MINUTE, NOW, TIME, SECOND")
};
......@@ -188,7 +188,7 @@ static char *help_minute = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=HOUR, NOW, TIME, SECOND")
};
......@@ -203,7 +203,7 @@ static char *help_second = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=HOUR, MINUTE, NOW, TIME")
};
......@@ -240,7 +240,7 @@ static char *help_year = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=DAY, MONTH, TIME, NOW")
};
......@@ -254,7 +254,7 @@ static char *help_month = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=DAY, TIME, NOW, YEAR")
};
......@@ -268,7 +268,7 @@ static char *help_day = {
"\n"
"Note that Gnumeric will perform regular string to serial "
"number conversion for you, so you can enter a date as a "
"string"
"string\n"
""
"@SEEALSO=MONTH, TIME, NOW, YEAR")
};
......
......@@ -14,22 +14,16 @@
#include "utils.h"
#include "func.h"
static Value *
gnumeric_char (FunctionDefinition *fn, Value *argv [], char **error_string)
{
Value *v = g_new (Value, 1);
int i;
char buffer [2];
v->type = VALUE_STRING;
i = value_get_as_double (argv [0]);
buffer [0] = i;
buffer [1] = 0;
v->v.str = string_get (buffer);
return v;
}
static char *help_clean = {
N_("@FUNCTION=CLEAN\n"
"@SYNTAX=CLEAN(string)\n"
"@DESCRIPTION="
"Cleans the string from any non-printable characters."
"\n"
"@SEEALSO=")
};
static Value *
gnumeric_clean (FunctionDefinition *fn, Value *argv [], char **error_string)
{
......@@ -58,25 +52,7 @@ gnumeric_clean (FunctionDefinition *fn, Value *argv [], char **error_string)
return res;
}
static Value *
gnumeric_exact (FunctionDefinition *fn, Value *argv [], char **error_string)
{
Value *res;
if (argv [0]->type != VALUE_STRING || argv [1]->type != VALUE_STRING){
*error_string = _("Type mismatch");
return NULL;
}
res = g_new (Value, 1);
res->type = VALUE_INTEGER;
res->v.v_int = !strcmp (argv [0]->v.str->str, argv [1]->v.str->str);
return res;
}
FunctionDefinition misc_functions [] = {
{ "char", "f", "number", NULL, NULL, gnumeric_char },
{ "clean", "s", "text", NULL, NULL, gnumeric_clean },
{ "exact", "ss", "text1,text2", NULL, NULL, gnumeric_exact },
{ "clean", "s", "text", &help_clean, NULL, gnumeric_clean },
{ NULL, NULL }
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment