This list is closed, nobody may subscribe to it.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
(5) |
Sep
(3) |
Oct
(41) |
Nov
(41) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(75) |
Feb
(10) |
Mar
(170) |
Apr
(174) |
May
(66) |
Jun
(11) |
Jul
(10) |
Aug
(44) |
Sep
(73) |
Oct
(28) |
Nov
(139) |
Dec
(52) |
2003 |
Jan
(35) |
Feb
(93) |
Mar
(62) |
Apr
(10) |
May
(55) |
Jun
(70) |
Jul
(37) |
Aug
(16) |
Sep
(56) |
Oct
(31) |
Nov
(57) |
Dec
(83) |
2004 |
Jan
(85) |
Feb
(67) |
Mar
(27) |
Apr
(37) |
May
(75) |
Jun
(85) |
Jul
(160) |
Aug
(68) |
Sep
(104) |
Oct
(25) |
Nov
(39) |
Dec
(23) |
2005 |
Jan
(10) |
Feb
(45) |
Mar
(43) |
Apr
(19) |
May
(108) |
Jun
(31) |
Jul
(41) |
Aug
(23) |
Sep
(65) |
Oct
(58) |
Nov
(44) |
Dec
(54) |
2006 |
Jan
(96) |
Feb
(27) |
Mar
(69) |
Apr
(59) |
May
(67) |
Jun
(35) |
Jul
(13) |
Aug
(461) |
Sep
(160) |
Oct
(399) |
Nov
(32) |
Dec
(72) |
2007 |
Jan
(316) |
Feb
(305) |
Mar
(318) |
Apr
(54) |
May
(194) |
Jun
(173) |
Jul
(282) |
Aug
(91) |
Sep
(227) |
Oct
(365) |
Nov
(168) |
Dec
(18) |
2008 |
Jan
(71) |
Feb
(111) |
Mar
(155) |
Apr
(173) |
May
(70) |
Jun
(67) |
Jul
(55) |
Aug
(83) |
Sep
(32) |
Oct
(68) |
Nov
(80) |
Dec
(29) |
2009 |
Jan
(46) |
Feb
(18) |
Mar
(95) |
Apr
(76) |
May
(140) |
Jun
(98) |
Jul
(84) |
Aug
(123) |
Sep
(94) |
Oct
(131) |
Nov
(142) |
Dec
(125) |
2010 |
Jan
(128) |
Feb
(158) |
Mar
(172) |
Apr
(134) |
May
(94) |
Jun
(84) |
Jul
(32) |
Aug
(127) |
Sep
(167) |
Oct
(109) |
Nov
(69) |
Dec
(78) |
2011 |
Jan
(39) |
Feb
(58) |
Mar
(52) |
Apr
(47) |
May
(56) |
Jun
(76) |
Jul
(55) |
Aug
(54) |
Sep
(165) |
Oct
(255) |
Nov
(328) |
Dec
(263) |
2012 |
Jan
(82) |
Feb
(147) |
Mar
(400) |
Apr
(216) |
May
(209) |
Jun
(160) |
Jul
(86) |
Aug
(141) |
Sep
(156) |
Oct
(6) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(2) |
2016 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
(8) |
Jul
(2) |
Aug
(5) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
From: <car...@us...> - 2012-03-13 03:05:42
|
Revision: 9847 http://octave.svn.sourceforge.net/octave/?rev=9847&view=rev Author: carandraug Date: 2012-03-13 03:05:35 +0000 (Tue, 13 Mar 2012) Log Message: ----------- xmlread: updating NEWS file of miscellaneous and IO to mention move of the function Modified Paths: -------------- trunk/octave-forge/main/io/NEWS trunk/octave-forge/main/miscellaneous/NEWS Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-03-13 03:01:20 UTC (rev 9846) +++ trunk/octave-forge/main/io/NEWS 2012-03-13 03:05:35 UTC (rev 9847) @@ -14,7 +14,7 @@ ** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. ** The following functions have been imported from the miscellaneous package: - cell2csv csvconcat + cell2csv csvconcat xmlread csv2cell csvexplode xmlwrite =============================================================================== Modified: trunk/octave-forge/main/miscellaneous/NEWS =================================================================== --- trunk/octave-forge/main/miscellaneous/NEWS 2012-03-13 03:01:20 UTC (rev 9846) +++ trunk/octave-forge/main/miscellaneous/NEWS 2012-03-13 03:05:35 UTC (rev 9847) @@ -19,7 +19,7 @@ ** The following functions have been moved to the IO package: - cell2csv csvconcat + cell2csv csvconcat xmlread csv2cell csvexplode xmlwrite ** The function `clip' was imported from the audio package. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-13 03:01:26
|
Revision: 9846 http://octave.svn.sourceforge.net/octave/?rev=9846&view=rev Author: carandraug Date: 2012-03-13 03:01:20 +0000 (Tue, 13 Mar 2012) Log Message: ----------- io: using macros for Makefile Modified Paths: -------------- trunk/octave-forge/main/io/src/Makefile Modified: trunk/octave-forge/main/io/src/Makefile =================================================================== --- trunk/octave-forge/main/io/src/Makefile 2012-03-13 02:51:42 UTC (rev 9845) +++ trunk/octave-forge/main/io/src/Makefile 2012-03-13 03:01:20 UTC (rev 9846) @@ -1,5 +1,7 @@ all: csvexplode.oct csv2cell.oct csvconcat.oct cell2csv.oct xmlread.oct +MKOCTFILE = mkoctfile -Wall + ifdef FLEXML # flexml is a dead project. It requires flex 2.5.4a-6 (flex-old on Debian). # Further, we have modified the resulting xmltree_read.c by hand, changing @@ -13,19 +15,19 @@ endif xmltree.o: xmltree.c xmltree.h - mkoctfile -Wall -c $< + $(MKOCTFILE) -c $< xmltree_read.o: xmltree_read.c xmltree_read.h - mkoctfile -Wall -c $< + $(MKOCTFILE) -c $< xmlread.o: xmlread.cc xmltree_read.h xmltree.h - mkoctfile -Wall -c $< + $(MKOCTFILE) -c $< xmlread.oct: xmlread.o xmltree_read.o xmltree.o - mkoctfile -Wall $^ + $(MKOCTFILE) $^ %.oct: %.cc - mkoctfile -Wall $< + $(MKOCTFILE) $< clean: rm -f *.o octave-core core *.oct *~ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-13 02:51:52
|
Revision: 9845 http://octave.svn.sourceforge.net/octave/?rev=9845&view=rev Author: carandraug Date: 2012-03-13 02:51:42 +0000 (Tue, 13 Mar 2012) Log Message: ----------- xmlread: moving from miscellaneous to IO package. Updating Makefiles Modified Paths: -------------- trunk/octave-forge/main/io/src/Makefile trunk/octave-forge/main/miscellaneous/src/Makefile Added Paths: ----------- trunk/octave-forge/main/io/src/octave.dtd trunk/octave-forge/main/io/src/xmlread.cc trunk/octave-forge/main/io/src/xmltree.c trunk/octave-forge/main/io/src/xmltree.h trunk/octave-forge/main/io/src/xmltree_read.act trunk/octave-forge/main/io/src/xmltree_read.c trunk/octave-forge/main/io/src/xmltree_read.h trunk/octave-forge/main/io/src/xmltree_read.l Removed Paths: ------------- trunk/octave-forge/main/miscellaneous/src/octave.dtd trunk/octave-forge/main/miscellaneous/src/xmlread.cc trunk/octave-forge/main/miscellaneous/src/xmltree.c trunk/octave-forge/main/miscellaneous/src/xmltree.h trunk/octave-forge/main/miscellaneous/src/xmltree_read.act trunk/octave-forge/main/miscellaneous/src/xmltree_read.c trunk/octave-forge/main/miscellaneous/src/xmltree_read.h trunk/octave-forge/main/miscellaneous/src/xmltree_read.l Modified: trunk/octave-forge/main/io/src/Makefile =================================================================== --- trunk/octave-forge/main/io/src/Makefile 2012-03-13 02:41:21 UTC (rev 9844) +++ trunk/octave-forge/main/io/src/Makefile 2012-03-13 02:51:42 UTC (rev 9845) @@ -1,5 +1,29 @@ -all: csvexplode.oct csv2cell.oct csvconcat.oct cell2csv.oct +all: csvexplode.oct csv2cell.oct csvconcat.oct cell2csv.oct xmlread.oct +ifdef FLEXML +# flexml is a dead project. It requires flex 2.5.4a-6 (flex-old on Debian). +# Further, we have modified the resulting xmltree_read.c by hand, changing +# all occurrences of yy to xml_ and YY to XML_. Some other changes have be +# mode so the ouput of flexml won't be as correct as the actual committed C +# file +xmltree_read.l: xmltree_read.act octave.dtd + $(FLEXML) -A -a $^ +xmltree_read.c: xmltree_read.l + $(FLEX) -B -Pxml_ -o$@ $< +endif + +xmltree.o: xmltree.c xmltree.h + mkoctfile -Wall -c $< + +xmltree_read.o: xmltree_read.c xmltree_read.h + mkoctfile -Wall -c $< + +xmlread.o: xmlread.cc xmltree_read.h xmltree.h + mkoctfile -Wall -c $< + +xmlread.oct: xmlread.o xmltree_read.o xmltree.o + mkoctfile -Wall $^ + %.oct: %.cc mkoctfile -Wall $< Copied: trunk/octave-forge/main/io/src/octave.dtd (from rev 9841, trunk/octave-forge/main/miscellaneous/src/octave.dtd) =================================================================== --- trunk/octave-forge/main/io/src/octave.dtd (rev 0) +++ trunk/octave-forge/main/io/src/octave.dtd 2012-03-13 02:51:42 UTC (rev 9845) @@ -0,0 +1,39 @@ +<!ELEMENT octave (scalar | complex | string | array | structure | list | cell)> + +<!ELEMENT scalar (#PCDATA)> +<!ATTLIST scalar + value (undefined | true | false | inf | neginf | na | nan) "undefined" + name CDATA #IMPLIED> + +<!ELEMENT complex (scalar, scalar)> +<!ATTLIST complex name CDATA #IMPLIED> + +<!ELEMENT string (#PCDATA)> +<!ATTLIST string + length CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT array (string, string+)> +<!ATTLIST array + rows CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT matrix (scalar | complex)*> +<!ATTLIST matrix + rows CDATA #REQUIRED + columns CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT structure ANY> +<!ATTLIST structure name CDATA #IMPLIED> + +<!ELEMENT list ANY> +<!ATTLIST list + length CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT cell ANY> +<!ATTLIST cell + rows CDATA #REQUIRED + columns CDATA #REQUIRED + name CDATA #IMPLIED> Copied: trunk/octave-forge/main/io/src/xmlread.cc (from rev 9841, trunk/octave-forge/main/miscellaneous/src/xmlread.cc) =================================================================== --- trunk/octave-forge/main/io/src/xmlread.cc (rev 0) +++ trunk/octave-forge/main/io/src/xmlread.cc 2012-03-13 02:51:42 UTC (rev 9845) @@ -0,0 +1,152 @@ +// Copyright (C) 2004 Laurent Mazet <ma...@cr...> +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> +#include <octave/lo-ieee.h> +#include <octave/oct-map.h> +#include <octave/Cell.h> + +extern "C" { +#include "xmltree.h" +#include "xmltree_read.h" +} + +octave_value get_element (element *root) { + int length, rows, columns; + + string_vector tmp_array; + ComplexMatrix tmp_matrix; + Octave_map tmp_structure; + Cell tmp_cell; + octave_value_list tmp_list; + + octave_value retval; + + if (!root) + return retval; + + switch (root->def_value) { + case value_scalar: + switch (root->const_value) { + case const_true: retval = octave_value(true); break; + case const_false: retval = octave_value(false); break; + case const_inf: retval = octave_value(octave_Inf); break; + case const_neginf: retval = octave_value(-octave_Inf); break; + case const_nan: retval = octave_value(octave_NaN); break; + case const_na: retval = octave_value(octave_NA); break; + case const_undef: retval = octave_value(root->scalar_value); break; + } + break; + + case value_complex: + retval = + octave_value(Complex(get_element(root->child).double_value(), + get_element(root->child->next).double_value())); + break; + + case value_string: + retval = octave_value(root->string_value); + break; + + case value_array: + rows = root->rows; + root = root->child; + tmp_array = string_vector(rows); + for (int k=0; (k<rows) && (root); k++, root = root->next) + tmp_array(k) = get_element(root).string_value(); + retval = octave_value(tmp_array); + break; + + case value_matrix: + rows = root->rows; + columns = root->columns; + root = root->child; + tmp_matrix = ComplexMatrix(rows, columns); + for (int k=0; (k<rows) && (root); k++) + for (int l=0; (l<columns) && (root); l++, root = root->next) + tmp_matrix(k, l) = get_element(root).complex_value(); + if (tmp_matrix.all_elements_are_real()) + retval = octave_value(real(tmp_matrix)); + else + retval = octave_value(tmp_matrix); + break; + + case value_structure: + root = root->child; + for (int k=0; root; root = root->next) + if (root->name) + tmp_structure.assign(root->name, get_element(root)); + else { + char *name = new char[7]; + sprintf (name, "__%04d", k++); + warning ("no field name in structure."); + tmp_structure.assign(name, get_element(root)); + delete[] name; + } + retval = octave_value(tmp_structure); + break; + + case value_list: + length = root->length; + root = root->child; + //tmp_list = octave_value_list(length); + for (int k=0; (k<length) && (root); k++, root = root->next) + tmp_list(k) = get_element(root); + retval = octave_value(tmp_list); + break; + + case value_cell: + rows = root->rows; + columns = root->columns; + root = root->child; + tmp_cell = Cell(rows, columns); + for (int k=0; (k<rows) && (root); k++) + for (int l=0; (l<columns) && (root); l++, root = root->next) + tmp_cell(k, l) = get_element(root); + retval = octave_value(tmp_cell); + break; + + default: + warning ("unknown type.\n"); + } + + return retval; +} + +DEFUN_DLD (xmlread, args, nargout, + "-*- texinfo -*-\n" + "@deftypefn {Function File} {@var{value}} xmlread(@var{filename})\n" + "\n" + "Read a @var{value} from @var{filename} as an XML file\n" + "@end deftypefn") { + + /* Check argument */ + if (args.length() != 1) { + print_usage (); + return octave_value_list(); + } + + /* Read file */ + std::string filename = args(0).string_value(); + element *root = read_xmltree(filename.c_str()); + if (!root) + return octave_value_list(); + + /* step down into the element tree */ + octave_value retval = get_element (root->child); + free_element (root); + + return retval; +} Copied: trunk/octave-forge/main/io/src/xmltree.c (from rev 9841, trunk/octave-forge/main/miscellaneous/src/xmltree.c) =================================================================== --- trunk/octave-forge/main/io/src/xmltree.c (rev 0) +++ trunk/octave-forge/main/io/src/xmltree.c 2012-03-13 02:51:42 UTC (rev 9845) @@ -0,0 +1,173 @@ +// Copyright (C) 2004 Laurent Mazet <ma...@cr...> +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, see <http://www.gnu.org/licenses/>. + +#include <stdio.h> +#include <stdlib.h> + +#include "xmltree.h" + +element *new_element () { + + element *new; + new = (element *) malloc (sizeof(element)); + if (!new) + perror("xml: no enough memory for new_element()\n"); + + new->next = new->child = NULL; + + new->def_value = value_undef; + new->const_value = const_undef; + new->scalar_value = 0; + new->string_value = NULL; + + new->name = NULL; + new->length = new->rows = new->columns = new->nb_elements = 0; + + return new; +} + +element *new_next (element *pred) { + + element *new = new_element(); + + if (pred) + pred->next = new; + + return new; +} + +element *new_child (element *father) { + + element *new = new_element(); + + if (father) + father->child = new; + + return new; +} + +void free_element (element *root) { + + if (!root) + return; + + if (root->next) + free_element (root->next); + if (root->child) + free_element (root->child); + + if (root->string_value) + free (root->string_value); + if (root->name) + free (root->name); + + free (root); +} + +void print_level(int l) { + int i; + for (i=0; i<l; i++) + printf (" "); +} + +void print_element (element *root, int l) { + + if (!root) + return; + + if (root->name) { + print_level(l); + printf ("name: %s\n", root->name); + } + + print_level(l); + switch (root->def_value) { + case value_scalar: + printf ("scalar: "); + switch (root->const_value) { + case const_true: printf ("true\n"); break; + case const_false: printf ("false\n"); break; + case const_inf: printf ("inf\n"); break; + case const_neginf: printf ("neginf\n"); break; + case const_nan: printf ("nan\n"); break; + case const_na: printf ("na\n"); break; + case const_undef: printf ("%f\n", root->scalar_value); break; + } + break; + case value_data: + printf ("data:\n"); + break; + case value_complex: + printf ("complex:\n"); + break; + case value_string: + printf ("string (%d): %s\n", root->length, root->string_value); + break; + case value_array: + printf ("array (%d):\n", root->rows); + break; + case value_matrix: + printf ("matrix (%d, %d):\n", root->rows, root->columns); + break; + case value_structure: + printf ("structure:\n"); + break; + case value_list: + printf ("list (%d):\n", root->length); + break; + case value_cell: + printf ("cell (%d, %d):\n", root->rows, root->columns); + break; + default: + printf ("???:\n"); + } + + if (root->child) { + print_level(l); + printf ("child:\n"); + print_element (root->child, l+1); + } + + if (root->next) { + print_level(l); + printf ("next:\n"); + print_element (root->next, l); + } +} + +list *new_list(list *father) { + + list *new; + new = (list *) malloc (sizeof(list)); + if (!new) + perror("xml: no enough memory for new_list()\n"); + + new->prev = father; + + new->root = NULL; + + return new; +} + +list *pop_list(list *child) { + list *father; + + father = child->prev; + free (child); + + return father; +} + + Copied: trunk/octave-forge/main/io/src/xmltree.h (from rev 9841, trunk/octave-forge/main/miscellaneous/src/xmltree.h) =================================================================== --- trunk/octave-forge/main/io/src/xmltree.h (rev 0) +++ trunk/octave-forge/main/io/src/xmltree.h 2012-03-13 02:51:42 UTC (rev 9845) @@ -0,0 +1,80 @@ +// Copyright (C) 2004 Laurent Mazet <ma...@cr...> +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, see <http://www.gnu.org/licenses/>. + +/* + xmltree structure + */ + +#if !defined(__XMLTREE_H__) +#define __XMLTREE_H__ + +typedef enum { + value_undef = 0, + value_scalar, + value_complex, + value_string, + value_array, + value_matrix, + value_structure, + value_list, + value_cell, + value_data } t_value; + +typedef enum { + const_undef = 0, + const_true, + const_false, + const_inf, + const_neginf, + const_na, + const_nan } t_const; + +typedef struct _element { + struct _element *next; + struct _element *child; + + /* values */ + t_value def_value; + t_const const_value; + double scalar_value; + char *string_value; + + /* parameters */ + char *name; + int length; + int rows; + int columns; + + /* check */ + int nb_elements; + +} element; + +typedef struct _list { + struct _list *prev; + + element **root; +} list; + +element *new_element (); +element *new_next (element *pred); +element *new_child (element *father); +void free_element (element *root); +void print_element (element *root, int l); + +list *new_list(list *father); +list *pop_list(list *child); + +#endif /* __XMLTREE_H__ */ Copied: trunk/octave-forge/main/io/src/xmltree_read.act (from rev 9841, trunk/octave-forge/main/miscellaneous/src/xmltree_read.act) =================================================================== --- trunk/octave-forge/main/io/src/xmltree_read.act (rev 0) +++ trunk/octave-forge/main/io/src/xmltree_read.act 2012-03-13 02:51:42 UTC (rev 9845) @@ -0,0 +1,345 @@ +<!-- -*- XML -*- --> +<!-- + Copyright (C) 2004 Laurent Mazet <ma...@cr...> + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free Software + Foundation; either version 3 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along with + this program; if not, see <http://www.gnu.org/licenses/>. + --> + +<!DOCTYPE actions SYSTEM "flexml-act.dtd"> + +<actions> + +<!-- Top --> + +<top><![CDATA[ +#ifndef _MSC_VER +#include <stdlib.h> +#endif +#include "xmltree.h" + +#define warning perror + +element **current; +element *root; +list *lastlist; +]]></top> + +<!-- Data --> + +<start tag='octave'><![CDATA[ +root = new_element(); +root->def_value = value_data; +current = &(root->child); + +lastlist = new_list(lastlist); +lastlist->root = current; +]]></start> + +<end tag='octave'><![CDATA[ +current = lastlist->root; +lastlist = pop_list(lastlist); +current = &((*current)->next); +]]></end> + +<!-- Scalar --> + +<start tag='scalar'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +(*current)->def_value = value_scalar; +switch ({value}) { + case {value=true}: (*current)->const_value = const_true; break; + case {value=false}: (*current)->const_value = const_false; break; + case {value=inf}: (*current)->const_value = const_inf; break; + case {value=neginf}: (*current)->const_value = const_neginf; break; + case {value=nan}: (*current)->const_value = const_nan; break; + case {value=na}: (*current)->const_value = const_na; break; + default: (*current)->const_value = const_undef; +} +]]></start> + +<end tag='scalar'><![CDATA[ +if (((*current)->const_value == const_undef) && ({#PCDATA})) + (*current)->scalar_value = strtod ({#PCDATA}, NULL); + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- String --> + +<start tag='string'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +if ({length}) + (*current)->length = strtol ({length}, NULL, 10); + +(*current)->def_value = value_string; +]]></start> + +<end tag='string'><![CDATA[ +if ({#PCDATA}) { + + int len = strlen({#PCDATA}); + /* check length parameter */ + if ((*current)->length != len) { + warning("incorrect length parameter for string\n"); + (*current)->length = len; + } + + (*current)->string_value = (char *) malloc ((len+1) * sizeof(char)); + strcpy((*current)->string_value, {#PCDATA}); +} + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- Complex --> + +<start tag='complex'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +(*current)->def_value = value_complex; + +lastlist = new_list(lastlist); +lastlist->root = current; +current = &((*current)->child); +]]></start> + +<end tag='complex'><![CDATA[ +current = lastlist->root; +lastlist = pop_list(lastlist); + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- Array --> + +<start tag='array'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +if ({rows}) + (*current)->rows = strtol ({rows}, NULL, 10); + +(*current)->def_value = value_array; + +lastlist = new_list(lastlist); +lastlist->root = current; +current = &((*current)->child); +]]></start> + +<end tag='array'><![CDATA[ +/* check rows parameter */ +if ((*(lastlist->root))->rows != (*(lastlist->root))->nb_elements) { + warning("incorrect length parameter for array\n"); + (*(lastlist->root))->rows = (*(lastlist->root))->nb_elements; +} + +current = lastlist->root; +lastlist = pop_list(lastlist); + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- Matrix --> + +<start tag='matrix'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +if ({rows}) + (*current)->rows = strtol ({rows}, NULL, 10); + +if ({columns}) + (*current)->columns = strtol ({columns}, NULL, 10); + +(*current)->def_value = value_matrix; + +lastlist = new_list(lastlist); +lastlist->root = current; +current = &((*current)->child); +]]></start> + +<end tag='matrix'><![CDATA[ +/* check (rows, columns) parameters */ +if ((*(lastlist->root))->rows * (*(lastlist->root))->columns != + (*(lastlist->root))->nb_elements) { + warning("incorrect (rows, columns) parameters for matrix: reshaping matrix into vector\n"); + (*(lastlist->root))->rows = 1; + (*(lastlist->root))->columns = (*(lastlist->root))->nb_elements; +} + +current = lastlist->root; +lastlist = pop_list(lastlist); + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- Structure --> + +<start tag='structure'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +(*current)->def_value = value_structure; + +lastlist = new_list(lastlist); +lastlist->root = current; +current = &((*current)->child); +]]></start> + +<end tag='structure'><![CDATA[ +/* no check possible (sic) */ + +current = lastlist->root; +lastlist = pop_list(lastlist); + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- List --> + +<start tag='list'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +if ({length}) + (*current)->length = strtol ({length}, NULL, 10); + +(*current)->def_value = value_list; + +lastlist = new_list(lastlist); +lastlist->root = current; +current = &((*current)->child); +]]></start> + +<end tag='list'><![CDATA[ +/* check length parameter */ +if ((*(lastlist->root))->length != (*(lastlist->root))->nb_elements) { + warning("incorrect length parameter for list\n"); + (*(lastlist->root))->length = (*(lastlist->root))->nb_elements; +} + +current = lastlist->root; +lastlist = pop_list(lastlist); + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- Cell --> + +<start tag='cell'><![CDATA[ +*current = new_element(); + +if ({name}) { + (*current)->name = (char *) malloc(strlen({name})+1); + strcpy ((*current)->name, {name}); +} + +if ({rows}) + (*current)->rows = strtol ({rows}, NULL, 10); + +if ({columns}) + (*current)->columns = strtol ({columns}, NULL, 10); + +(*current)->def_value = value_cell; + +lastlist = new_list(lastlist); +lastlist->root = current; +current = &((*current)->child); +]]></start> + +<end tag='cell'><![CDATA[ +/* check (rows, columns) parameters */ +if ((*(lastlist->root))->rows * (*(lastlist->root))->columns != + (*(lastlist->root))->nb_elements) { + warning("incorrect (rows, columns) parameters for cell: reshaping cell into list\n"); + (*(lastlist->root))->def_value = value_list; + (*(lastlist->root))->length = (*(lastlist->root))->nb_elements; +} + +current = lastlist->root; +lastlist = pop_list(lastlist); + +(*(lastlist->root))->nb_elements++; + +current = &((*current)->next); +]]></end> + +<!-- Main --> + +<main> +element *read_xmltree (const char *file) { + + current = NULL; + root = NULL; + lastlist = NULL; + + xml_in = fopen(file, "r"); + if (!xml_in) + perror("can't open file\n"); + + xml_lex(); + fclose(xml_in); + + return root; +} +</main> + +</actions> Copied: trunk/octave-forge/main/io/src/xmltree_read.c (from rev 9841, trunk/octave-forge/main/miscellaneous/src/xmltree_read.c) =================================================================== --- trunk/octave-forge/main/io/src/xmltree_read.c (rev 0) +++ trunk/octave-forge/main/io/src/xmltree_read.c 2012-03-13 02:51:42 UTC (rev 9845) @@ -0,0 +1,4438 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header$ + */ + +#define FLEX_SCANNER +#define XML__FLEX_MAJOR_VERSION 2 +#define XML__FLEX_MINOR_VERSION 5 + +#include <stdio.h> +#include <errno.h> + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include <stdlib.h> +#ifndef _WIN32 +#include <unistd.h> +#endif + +/* Use prototypes in function declarations. */ +#define XML__USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define XML__USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define XML__USE_PROTOS +#define XML__USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include <io.h> +#include <stdlib.h> +#define XML__USE_CONST +#define XML__USE_PROTOS +#endif + +#ifdef XML__USE_CONST +#define xml_const const +#else +#define xml_const +#endif + + +#ifdef XML__USE_PROTOS +#define XML__PROTO(proto) proto +#else +#define XML__PROTO(proto) () +#endif + + +/* Returned upon end-of-file. */ +#define XML__NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define XML__SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN xml__start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The XML_STATE alias is for lex + * compatibility. + */ +#define XML__START ((xml__start - 1) / 2) +#define XML_STATE XML__START + +/* Action number for EOF rule of a given start state. */ +#define XML__STATE_EOF(state) (XML__END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define XML__NEW_FILE xml_restart( xml_in ) + +#define XML__END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define XML__BUF_SIZE 16384 + +typedef struct xml__buffer_state *XML__BUFFER_STATE; + +extern int xml_leng; +extern FILE *xml_in, *xml_out; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * xml_less( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the xml_less() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define xml_less(n) \ + do \ + { \ + /* Undo effects of setting up xml_text. */ \ + *xml__cp = xml__hold_char; \ + XML__RESTORE_XML__MORE_OFFSET \ + xml__c_buf_p = xml__cp = xml__bp + n - XML__MORE_ADJ; \ + XML__DO_BEFORE_ACTION; /* set up xml_text again */ \ + } \ + while ( 0 ) + +#define unput(c) xml_unput( c, xml_text_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int xml__size_t; + + +struct xml__buffer_state + { + FILE *xml__input_file; + + char *xml__ch_buf; /* input buffer */ + char *xml__buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + xml__size_t xml__buf_size; + + /* Number of characters read into xml__ch_buf, not including EOB + * characters. + */ + int xml__n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int xml__is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int xml__is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int xml__at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int xml__fill_buffer; + + int xml__buffer_status; +#define XML__BUFFER_NEW 0 +#define XML__BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as XML__EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via xml_restart()), so that the user can continue scanning by + * just pointing xml_in at a new input file. + */ +#define XML__BUFFER_EOF_PENDING 2 + }; + +static XML__BUFFER_STATE xml__current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define XML__CURRENT_BUFFER xml__current_buffer + + +/* xml__hold_char holds the character lost when xml_text is formed. */ +static char xml__hold_char; + +static int xml__n_chars; /* number of characters read into xml__ch_buf */ + + +int xml_leng; + +/* Points to current character in buffer. */ +static char *xml__c_buf_p = (char *) 0; +static int xml__init = 1; /* whether we need to initialize */ +static int xml__start = 0; /* start state number */ + +/* Flag which is used to allow xml_wrap()'s to do buffer switches + * instead of setting up a fresh xml_in. A bit of a hack ... + */ +static int xml__did_buffer_switch_on_eof; + +void xml_restart XML__PROTO(( FILE *input_file )); + +void xml__switch_to_buffer XML__PROTO(( XML__BUFFER_STATE new_buffer )); +void xml__load_buffer_state XML__PROTO(( void )); +XML__BUFFER_STATE xml__create_buffer XML__PROTO(( FILE *file, int size )); +void xml__delete_buffer XML__PROTO(( XML__BUFFER_STATE b )); +void xml__init_buffer XML__PROTO(( XML__BUFFER_STATE b, FILE *file )); +void xml__flush_buffer XML__PROTO(( XML__BUFFER_STATE b )); +#define XML__FLUSH_BUFFER xml__flush_buffer( xml__current_buffer ) + +XML__BUFFER_STATE xml__scan_buffer XML__PROTO(( char *base, xml__size_t size )); +XML__BUFFER_STATE xml__scan_string XML__PROTO(( xml_const char *xml__str )); +XML__BUFFER_STATE xml__scan_bytes XML__PROTO(( xml_const char *bytes, int len )); + +static void *xml__flex_alloc XML__PROTO(( xml__size_t )); +static void *xml__flex_realloc XML__PROTO(( void *, xml__size_t )); +static void xml__flex_free XML__PROTO(( void * )); + +#define xml__new_buffer xml__create_buffer + +#define xml__set_interactive(is_interactive) \ + { \ + if ( ! xml__current_buffer ) \ + xml__current_buffer = xml__create_buffer( xml_in, XML__BUF_SIZE ); \ + xml__current_buffer->xml__is_interactive = is_interactive; \ + } + +#define xml__set_bol(at_bol) \ + { \ + if ( ! xml__current_buffer ) \ + xml__current_buffer = xml__create_buffer( xml_in, XML__BUF_SIZE ); \ + xml__current_buffer->xml__at_bol = at_bol; \ + } + +#define XML__AT_BOL() (xml__current_buffer->xml__at_bol) + + +#define xml_wrap() 1 +#define XML__SKIP_XML_WRAP +typedef unsigned char XML__CHAR; +FILE *xml_in = (FILE *) 0, *xml_out = (FILE *) 0; +typedef int xml__state_type; +extern char *xml_text; +#define xml_text_ptr xml_text + +static xml__state_type xml__get_previous_state XML__PROTO(( void )); +static xml__state_type xml__try_NUL_trans XML__PROTO(( xml__state_type current_state )); +static int xml__get_next_buffer XML__PROTO(( void )); +static void xml__fatal_error XML__PROTO(( xml_const char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up xml_text. + */ +#define XML__DO_BEFORE_ACTION \ + xml_text_ptr = xml__bp; \ + xml_leng = (int) (xml__cp - xml__bp); \ + xml__hold_char = *xml__cp; \ + *xml__cp = '\0'; \ + xml__c_buf_p = xml__cp; + +#define XML__NUM_RULES 157 +#define XML__END_OF_BUFFER 158 +static xml_const short int xml__accept[1064] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 158, 156, 23, 10, 10, 23, + + 23, 135, 10, 135, 5, 6, 5, 8, 9, 8, + 151, 143, 144, 152, 149, 152, 150, 155, 143, 144, + 155, 157, 157, 27, 10, 27, 27, 27, 25, 157, + 31, 10, 31, 157, 51, 10, 51, 51, 51, 49, + 51, 51, 152, 151, 157, 60, 10, 60, 60, 60, + 58, 60, 64, 10, 64, 157, 72, 10, 72, 72, + 72, 70, 72, 72, 152, 157, 83, 10, 83, 83, + 83, 81, 83, 83, 87, 10, 87, 87, 157, 97, + 10, 97, 97, 97, 95, 97, 97, 97, 101, 10, + 101, 157, 101, 157, 107, 10, 107, 107, 107, 105, + + 107, 152, 157, 118, 10, 118, 118, 118, 116, 118, + 118, 152, 157, 131, 10, 131, 131, 131, 129, 131, + 131, 131, 152, 10, 0, 2, 2, 0, 4, 7, + 146, 145, 0, 0, 0, 0, 0, 154, 0, 26, + 28, 0, 0, 0, 0, 0, 0, 50, 52, 52, + 52, 0, 0, 0, 0, 59, 61, 61, 0, 0, + 71, 73, 73, 73, 0, 82, 84, 84, 84, 0, + 0, 96, 98, 98, 98, 98, 0, 0, 106, 108, + 108, 0, 117, 119, 119, 119, 0, 0, 130, 132, + 132, 132, 132, 0, 0, 0, 0, 0, 3, 0, + + 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 52, 52, 0, 0, + 0, 148, 61, 0, 0, 0, 73, 73, 0, 0, + 84, 84, 0, 0, 0, 98, 98, 98, 0, 0, + 0, 108, 0, 0, 119, 119, 0, 0, 132, 132, + 132, 0, 0, 0, 22, 1, 0, 0, 141, 0, + 0, 0, 138, 137, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 30, 0, 52, 52, 0, 0, + 0, 54, 0, 61, 0, 0, 63, 0, 0, 73, + 73, 0, 0, 75, 0, 84, 84, 0, 0, 86, + + 0, 0, 98, 98, 98, 0, 0, 100, 0, 0, + 108, 0, 0, 110, 0, 119, 119, 0, 0, 121, + 0, 132, 132, 132, 0, 0, 134, 0, 0, 0, + 142, 136, 0, 0, 0, 0, 122, 0, 111, 0, + 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, + 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 98, 0, 0, 0, 0, 0, 0, 0, 0, + 119, 0, 0, 0, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 12, 0, 139, 140, 0, 76, 122, + 0, 111, 0, 0, 0, 0, 0, 48, 47, 0, + + 0, 0, 0, 0, 57, 56, 0, 73, 0, 69, + 68, 0, 0, 80, 79, 0, 78, 77, 0, 0, + 98, 0, 94, 93, 0, 90, 89, 0, 0, 104, + 103, 0, 119, 0, 115, 114, 0, 132, 0, 128, + 127, 0, 124, 123, 0, 0, 0, 11, 24, 76, + 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 88, 98, 0, 0, 0, + 0, 0, 120, 132, 0, 133, 0, 0, 24, 55, + 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67, 66, + + 0, 0, 85, 88, 0, 0, 0, 0, 0, 113, + 112, 0, 0, 0, 0, 55, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 147, 0, 53, 0, 0, 74, 0, 92, 91, + 0, 99, 0, 0, 126, 125, 0, 0, 102, 0, + 0, 44, 0, 0, 0, 0, 0, 0, 43, 0, + 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, + 0, 0, 0, 102, 0, 40, 46, 0, 0, 0, + 0, 39, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, + + 0, 0, 35, 0, 0, 109, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 38, 0, 0, 37, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 42, 0, 41, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 34, 33, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, + 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 17, 0, 14, 0, + 13, 0, 16, 0, 0, 0, 15, 0, 0, 0, + 0, 19, 0 + } ; + +static xml_const int xml__ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 7, 1, 1, 8, 9, 1, + 1, 1, 1, 1, 10, 11, 12, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 14, 15, 16, + 17, 18, 19, 1, 20, 21, 22, 23, 24, 21, + 14, 14, 14, 14, 14, 14, 25, 14, 26, 27, + 14, 14, 28, 29, 14, 14, 14, 14, 30, 14, + 31, 1, 32, 1, 14, 1, 33, 21, 34, 35, + + 36, 37, 38, 39, 40, 14, 14, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 14, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static xml_const int xml__meta[55] = + { 0, + 1, 2, 2, 2, 1, 1, 1, 1, 1, 3, + 3, 1, 4, 5, 1, 1, 1, 6, 1, 7, + 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, + 1, 1, 7, 7, 7, 7, 7, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5 + } ; + +static xml_const short int xml__base[1112] = + { 0, + 0, 0, 0, 3, 6, 9, 24, 27, 11, 14, + 15, 17, 29, 38, 45, 52, 59, 61, 67, 70, + 93, 125, 73, 76, 143, 146, 149, 164, 180, 0, + 232, 234, 241, 249, 266, 309, 284, 287, 290, 327, + 330, 333, 351, 354, 370, 0, 422, 424, 431, 439, + 456, 0, 509, 512, 515, 518, 533, 536, 539, 542, + 557, 560, 563, 566, 582, 0, 635, 638, 641, 644, + 659, 662, 665, 668, 683, 686, 702, 745, 727, 762, + 720, 723, 794, 0, 846, 848, 765, 769, 880, 0, + 932, 934, 0, 0, 3088, 3089, 3089, 111, 114, 47, + + 62, 3089, 117, 150, 3089, 3089, 3077, 3089, 3089, 3068, + 3089, 3081, 3081, 932, 3089, 3089, 3089, 3089, 3079, 3079, + 3049, 3089, 236, 3089, 168, 3062, 0, 155, 3089, 938, + 3089, 173, 242, 936, 3089, 256, 3061, 0, 159, 3089, + 3045, 3044, 244, 3044, 940, 3089, 357, 3057, 0, 343, + 3089, 3041, 3089, 361, 432, 939, 3089, 446, 3055, 0, + 426, 3089, 3036, 3038, 434, 942, 3089, 689, 3052, 0, + 528, 3089, 3036, 3024, 3089, 692, 941, 770, 949, 3089, + 738, 3049, 0, 552, 3089, 3022, 3032, 3020, 3089, 788, + 964, 958, 774, 962, 3089, 855, 3045, 0, 654, 3089, + + 3029, 1008, 975, 3089, 863, 3043, 0, 678, 3089, 3024, + 3026, 3046, 977, 3089, 866, 3039, 0, 855, 3089, 3012, + 3022, 3010, 3041, 869, 34, 2999, 3089, 3041, 3032, 3089, + 3089, 3089, 37, 40, 3000, 2999, 2997, 3028, 3011, 3089, + 0, 2997, 260, 3003, 73, 2998, 3007, 3089, 0, 2998, + 2998, 148, 2990, 3019, 2992, 3089, 0, 2993, 3000, 2984, + 3089, 0, 2989, 2989, 2982, 3089, 0, 2987, 2976, 2994, + 2993, 3089, 0, 2984, 2982, 2971, 2980, 2972, 3089, 0, + 2978, 2971, 3089, 0, 2975, 2975, 2975, 2979, 3089, 0, + 2973, 2971, 2960, 2977, 2992, 2999, 281, 2966, 3089, 148, + + 0, 2962, 2962, 2990, 2989, 2959, 3089, 2953, 2954, 2959, + 2957, 2950, 2964, 2949, 997, 1000, 2959, 2944, 2971, 1005, + 1026, 3089, 2956, 1022, 1029, 2944, 2952, 2953, 1033, 1051, + 2952, 2939, 1059, 1062, 2937, 2935, 2948, 2935, 1068, 1072, + 2935, 2945, 1079, 1085, 2942, 2943, 1089, 1092, 2928, 2941, + 2928, 1109, 1112, 2957, 3089, 3089, 17, 2933, 3089, 2958, + 2957, 2923, 3089, 3089, 2921, 2936, 2935, 2926, 2921, 2840, + 2847, 255, 1115, 1118, 3089, 1121, 1138, 2842, 2852, 1141, + 1147, 3089, 1150, 1154, 1158, 1170, 3089, 1175, 2832, 2820, + 1178, 1182, 1187, 3089, 1194, 1199, 1204, 1207, 1211, 3089, + + 1216, 2819, 2821, 1220, 1228, 1224, 1236, 3089, 1244, 2810, + 1247, 1253, 1256, 3089, 1263, 2808, 1266, 1273, 1276, 3089, + 1282, 2812, 1285, 1294, 1301, 1304, 3089, 1310, 321, 1313, + 3089, 3089, 2836, 2829, 2788, 2780, 873, 2788, 1055, 2791, + 2776, 2780, 1321, 1331, 1334, 1342, 2789, 1353, 1358, 1361, + 1370, 2765, 1374, 1377, 1393, 1396, 1399, 1414, 1417, 1425, + 2654, 2650, 1432, 1435, 1443, 1448, 1459, 1462, 1465, 1478, + 2653, 1481, 1484, 1497, 2648, 1500, 1505, 1516, 1520, 1532, + 698, 2672, 1535, 3089, 2670, 3089, 3089, 2651, 1528, 1538, + 2650, 1541, 2638, 2646, 2634, 1545, 1552, 3089, 3089, 1562, + + 1565, 2653, 1573, 1578, 3089, 3089, 1586, 1590, 1596, 3089, + 3089, 1606, 1609, 3089, 3089, 1617, 3089, 3089, 1626, 2624, + 2628, 1629, 3089, 3089, 1637, 3089, 3089, 1648, 1651, 3089, + 3089, 1659, 1665, 1669, 3089, 3089, 1681, 2623, 1688, 3089, + 3089, 1698, 3089, 3089, 1706, 320, 333, 3089, 1709, 1712, + 2617, 1715, 1718, 2617, 1723, 1726, 1694, 1696, 2645, 1745, + 1748, 1751, 1758, 1767, 1754, 1771, 1774, 1777, 1784, 1794, + 1797, 1805, 3089, 1810, 1813, 3089, 284, 41, 1816, 1822, + 1832, 1835, 2596, 1838, 2606, 2594, 51, 2573, 2569, 2539, + 2518, 309, 2482, 2213, 2201, 1841, 1844, 1848, 3089, 3089, + + 1861, 1864, 3089, 1867, 1870, 1874, 1882, 1886, 1889, 3089, + 3089, 1899, 1903, 1911, 505, 1915, 2137, 1919, 3089, 2096, + 2062, 694, 2026, 2010, 1985, 1920, 1874, 130, 1872, 1858, + 1825, 3089, 1922, 3089, 1928, 1931, 3089, 1939, 3089, 3089, + 1948, 3089, 1951, 1954, 3089, 3089, 1997, 283, 1968, 1756, + 1787, 3089, 1736, 1700, 1670, 1659, 1622, 1650, 3089, 1588, + 1519, 1436, 1417, 1971, 3089, 1974, 509, 536, 326, 711, + 228, 1050, 506, 1977, 1373, 3089, 3089, 1344, 1346, 1312, + 1284, 3089, 3089, 1256, 1286, 1157, 1984, 530, 411, 533, + 631, 105, 683, 972, 635, 634, 1141, 1089, 3089, 953, + + 943, 914, 3089, 813, 1991, 3089, 1113, 944, 977, 970, + 996, 1308, 1060, 1088, 2001, 3089, 778, 740, 3089, 689, + 612, 720, 2004, 1061, 2009, 640, 1086, 1309, 1003, 845, + 2030, 2040, 3089, 542, 3089, 400, 2022, 2033, 638, 2050, + 1111, 1049, 1145, 979, 1117, 2053, 2078, 2110, 333, 204, + 2070, 1157, 1151, 1243, 2073, 2102, 2128, 2131, 1149, 2149, + 2181, 17, 6, 1291, 1020, 2141, 1080, 2173, 2200, 2203, + 2206, 1225, 511, 3089, 3089, 1264, 1215, 2212, 1272, 1374, + 1392, 1394, 1412, 1217, 1300, 508, 1495, 837, 1340, 1477, + 1534, 1542, 2223, 1021, 556, 1567, 762, 1364, 1396, 1430, + + 1460, 2233, 931, 2240, 1492, 2244, 1329, 1366, 1452, 1473, + 1604, 2250, 2261, 1533, 2269, 1640, 1656, 1661, 1671, 1619, + 2279, 632, 1388, 1680, 1598, 1811, 2287, 2290, 2296, 2299, + 1498, 1814, 1831, 1218, 1332, 2307, 1351, 1422, 2317, 2325, + 2335, 2343, 1554, 1583, 1630, 1565, 1607, 2353, 1627, 1772, + 1876, 1920, 1921, 1941, 1972, 1973, 1979, 2045, 1764, 1804, + 1878, 1705, 1929, 2048, 2103, 1949, 1950, 1669, 1776, 1910, + 2089, 2090, 2144, 2145, 2177, 2361, 1996, 2032, 1585, 1810, + 2199, 2204, 2049, 2051, 2052, 2120, 2121, 2122, 2174, 2201, + 2211, 2227, 2364, 2085, 2256, 1371, 1437, 2231, 2237, 1476, + + 1747, 2251, 2297, 2300, 2318, 2336, 2342, 2354, 2356, 2130, + 2176, 1863, 2221, 2010, 2248, 2358, 2359, 2295, 2367, 2330, + 2332, 2362, 2366, 2368, 2370, 2372, 2375, 2278, 2298, 2383, + 2384, 1457, 2379, 2378, 2380, 2381, 2385, 2259, 2286, 2306, + 2322, 2382, 2386, 2388, 2389, 2387, 2390, 2392, 2393, 2391, + 2394, 2397, 2412, 2414, 2416, 2424, 2426, 2427, 2435, 2436, + 2438, 2439, 2440, 2434, 2437, 2423, 2441, 2442, 2443, 2451, + 2453, 2448, 2450, 2456, 2457, 2458, 2461, 2462, 2463, 2464, + 2466, 2455, 2468, 2469, 2470, 1978, 2485, 2477, 2482, 2154, + 2493, 2471, 2489, 2490, 2491, 2492, 2495, 2496, 2497, 2498, + + 2500, 2515, 2513, 2524, 2505, 2506, 2545, 2517, 2525, 2532, + 2533, 2535, 2538, 2539, 2540, 2514, 2519, 2562, 2574, 3089, + 2544, 2551, 2579, 3089, 2553, 2575, 2581, 2576, 2582, 2580, + 2584, 2586, 2573, 2578, 2603, 3089, 2597, 2592, 2614, 2620, + 2623, 2626, 2591, 2593, 2631, 2643, 3089, 2648, 3089, 2651, + 3089, 2654, 3089, 2596, 2601, 2660, 3089, 2642, 2650, 2671, + 2677, 3089, 3089, 2695, 2702, 2709, 2716, 2723, 2730, 2737, + 2744, 2751, 2758, 2765, 2772, 2779, 2786, 2793, 2798, 2803, + 2808, 2813, 2818, 2823, 2828, 2833, 2838, 2845, 2848, 2851, + 2854, 2857, 2860, 2863, 2866, 2869, 2872, 2879, 2883, 2889, + + 2895, 2901, 2907, 2913, 2919, 2925, 2931, 2937, 2944, 2951, + 2958 + } ; + +static xml_const short int xml__def[1112] = + { 0, + 1064, 1064, 1065, 1065, 1065, 1065, 1066, 1066, 1067, 1067, + 1068, 1068, 1069, 1069, 1069, 1069, 1070, 1070, 1071, 1071, + 1072, 1072, 1071, 1071, 1073, 1073, 1071, 1071, 1063, 29, + 1069, 1069, 1071, 1071, 1074, 1074, 1071, 1071, 1071, 1071, + 1075, 1075, 1071, 1071, 1063, 45, 1069, 1069, 1071, 1071, + 1063, 51, 1071, 1071, 1071, 1071, 1071, 1071, 1076, 1076, + 1076, 1076, 1071, 1071, 1063, 65, 1077, 1077, 1071, 1071, + 1077, 1077, 1077, 1077, 1071, 1071, 1078, 1078, 1069, 1069, + 1071, 1071, 1063, 83, 1069, 1069, 1071, 1071, 1063, 89, + 1069, 1069, 1064, 1064, 1063, 1063, 1063, 1063, 1063, 1063, + + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1079, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1080, 1063, 1063, + 1080, 1080, 1063, 1063, 1063, 1063, 1063, 1063, 1081, 1063, + 1063, 1081, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1082, + 1063, 1063, 1082, 1082, 1063, 1063, 1063, 1063, 1063, 1083, + 1063, 1063, 1083, 1083, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1084, 1063, 1063, 1084, 1084, 1084, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1085, 1063, 1063, + + 1085, 1063, 1063, 1063, 1063, 1063, 1086, 1063, 1063, 1086, + 1086, 202, 1063, 1063, 1063, 1063, 1087, 1063, 1063, 1087, + 1087, 1087, 202, 1063, 1088, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1079, 1063, 1063, 1063, 1063, 1089, 1063, 1063, 1080, 1080, + 1080, 1063, 1090, 1063, 1063, 1063, 1081, 1081, 1091, 1063, + 1063, 1082, 1082, 1082, 1092, 1063, 1083, 1083, 1083, 1093, + 1063, 1063, 1084, 1084, 1084, 1084, 1094, 1063, 1063, 1085, + 1085, 1095, 1063, 1086, 1086, 1086, 1096, 1063, 1063, 1087, + 1087, 1087, 1087, 1097, 1098, 1063, 1098, 1063, 1063, 1063, + + 1099, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1100, 1100, 1080, 1080, 1063, 1101, + 1101, 1063, 1081, 1102, 1102, 1063, 1082, 1082, 1103, 1103, + 1083, 1083, 1104, 1104, 1063, 1084, 1084, 1084, 1105, 1105, + 1063, 1085, 1106, 1106, 1086, 1086, 1107, 1107, 1087, 1087, + 1087, 1108, 1108, 1098, 1063, 1063, 1098, 1063, 1063, 1099, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1100, 1063, 1100, 1080, 1080, 1063, 1063, + 1101, 1063, 1101, 1081, 1063, 1102, 1063, 1102, 1063, 1082, + 1082, 1063, 1103, 1063, 1103, 1083, 1083, 1063, 1104, 1063, + + 1104, 1063, 1084, 1084, 1084, 1063, 1105, 1063, 1105, 1063, + 1085, 1063, 1106, 1063, 1106, 1086, 1086, 1063, 1107, 1063, + 1107, 1087, 1087, 1087, 1063, 1108, 1063, 1108, 1098, 1109, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1100, 1063, 1063, 1080, 1063, 1101, 1063, 1063, + 1102, 1082, 1063, 1063, 1103, 1063, 1063, 1063, 1063, 1104, + 1063, 1084, 1063, 1063, 1063, 1063, 1105, 1063, 1063, 1106, + 1086, 1063, 1063, 1107, 1087, 1063, 1063, 1063, 1063, 1108, + 1098, 1109, 1109, 1063, 1109, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1100, 1063, 1063, 1063, 1063, + + 1063, 1063, 1101, 1063, 1063, 1063, 1102, 1082, 1063, 1063, + 1063, 1103, 1063, 1063, 1063, 1063, 1063, 1063, 1104, 1063, + 1084, 1063, 1063, 1063, 1063, 1063, 1063, 1105, 1063, 1063, + 1063, 1106, 1086, 1063, 1063, 1063, 1107, 1087, 1063, 1063, + 1063, 1063, 1063, 1063, 1108, 1098, 1109, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1100, 1063, 1063, 1063, 1063, 1101, + 1102, 1063, 1063, 1103, 1104, 1063, 1084, 1105, 1106, 1063, + 1063, 1063, 1063, 1087, 1063, 1063, 1098, 1109, 1063, 1063, + 1063, 1063, 1063, 1100, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1101, 1102, 1063, 1063, 1063, + + 1103, 1063, 1063, 1063, 1063, 1063, 1105, 1106, 1063, 1063, + 1063, 1063, 1063, 1098, 1109, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1102, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1106, 1063, 1063, 1063, 1098, 1109, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1106, 1098, 1098, 1098, 1098, + 1098, 1098, 1109, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1106, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1109, 1063, 1063, 1063, 1063, + + 1063, 1063, 1063, 1063, 1063, 1063, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1109, 1063, 1063, 1063, 1063, 1063, + 1063, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1109, 1109, 1063, 1063, 1063, 1063, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1109, 1110, 1111, 1063, 1063, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1110, + 1111, 1063, 1063, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1109, 1063, 1063, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1063, + 1098, 1098, 1098, 1063, 1098, 1098, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1063, 1098, 1098, 1098, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1063, 1098, 1063, 1098, + 1063, 1098, 1063, 1098, 1098, 1098, 1063, 1098, 1098, 1098, + 1098, 1063, 0, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + + 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, + 1063 + } ; + +static xml_const short int xml__nxt[3144] = + { 0, + 1063, 98, 99, 98, 98, 99, 98, 98, 99, 98, + 98, 99, 98, 106, 775, 100, 106, 109, 100, 109, + 107, 101, 774, 107, 101, 103, 99, 103, 103, 99, + 103, 112, 113, 110, 355, 110, 114, 115, 429, 104, + 112, 113, 104, 296, 116, 114, 115, 112, 113, 300, + 117, 225, 114, 116, 112, 113, 297, 117, 484, 114, + 116, 119, 120, 119, 120, 226, 225, 116, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 227, 302, 123, 622, 303, 123, 623, 615, 130, 301, + 121, 130, 121, 124, 125, 99, 125, 124, 124, 124, + + 124, 124, 124, 124, 126, 124, 313, 124, 128, 124, + 129, 124, 224, 224, 224, 224, 224, 224, 224, 224, + 224, 314, 355, 124, 124, 124, 125, 99, 125, 124, + 124, 124, 124, 124, 124, 124, 126, 124, 659, 124, + 128, 124, 129, 124, 132, 99, 132, 132, 99, 132, + 99, 99, 99, 711, 228, 124, 124, 296, 133, 228, + 300, 133, 359, 228, 134, 99, 99, 99, 227, 224, + 224, 224, 660, 227, 224, 224, 224, 227, 319, 134, + 135, 136, 99, 136, 135, 135, 135, 135, 135, 135, + 135, 137, 135, 138, 135, 139, 135, 140, 135, 138, + + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 135, 135, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 141, 138, 138, 138, 138, 138, 138, 138, + 142, 138, 138, 138, 112, 113, 112, 113, 763, 114, + 228, 114, 99, 99, 99, 355, 228, 143, 252, 143, + 99, 99, 99, 246, 227, 253, 145, 224, 224, 224, + 227, 693, 227, 144, 145, 144, 146, 147, 99, 147, + 146, 146, 146, 146, 146, 146, 146, 148, 146, 239, + 146, 150, 146, 151, 146, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 441, 310, 146, 146, 355, 134, + + 484, 355, 134, 311, 442, 134, 357, 614, 152, 146, + 147, 99, 147, 146, 146, 146, 146, 146, 146, 146, + 148, 146, 673, 146, 150, 146, 151, 146, 99, 99, + 99, 154, 99, 154, 154, 99, 154, 355, 355, 146, + 146, 628, 134, 355, 629, 155, 577, 228, 155, 481, + 484, 152, 99, 99, 99, 99, 99, 99, 224, 224, + 224, 227, 224, 224, 224, 691, 156, 762, 578, 156, + 157, 158, 99, 158, 157, 157, 157, 157, 157, 157, + 157, 159, 157, 160, 157, 161, 157, 162, 157, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + + 157, 157, 160, 160, 160, 160, 160, 160, 160, 160, + 163, 160, 164, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 112, 113, 112, 113, 355, 114, + 228, 114, 99, 99, 99, 750, 228, 165, 252, 165, + 99, 99, 99, 259, 227, 265, 166, 224, 224, 224, + 227, 708, 227, 144, 166, 144, 167, 168, 99, 168, + 167, 167, 167, 167, 167, 167, 167, 169, 167, 170, + 167, 171, 167, 172, 167, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 167, 167, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 173, 170, + + 170, 170, 174, 170, 170, 170, 170, 170, 170, 170, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 484, 484, 156, 355, 355, 156, 484, 485, + 156, 795, 228, 156, 99, 99, 99, 99, 99, 99, + 176, 99, 176, 176, 99, 176, 227, 355, 156, 696, + 355, 156, 648, 355, 177, 688, 228, 177, 176, 99, + 176, 176, 99, 176, 99, 99, 99, 99, 99, 99, + 227, 689, 178, 355, 709, 178, 707, 749, 179, 690, + 804, 179, 180, 181, 99, 181, 180, 180, 180, 180, + 180, 180, 180, 182, 180, 183, 180, 184, 180, 185, + + 180, 183, 183, 183, 183, 183, 183, 183, 183, 183, + 183, 183, 180, 180, 183, 186, 183, 183, 183, 183, + 183, 183, 183, 183, 187, 183, 183, 183, 188, 183, + 183, 183, 183, 183, 183,... [truncated message content] |
From: <car...@us...> - 2012-03-13 02:41:28
|
Revision: 9844 http://octave.svn.sourceforge.net/octave/?rev=9844&view=rev Author: carandraug Date: 2012-03-13 02:41:21 +0000 (Tue, 13 Mar 2012) Log Message: ----------- xmlwrite: moving from miscellaneous to IO package Modified Paths: -------------- trunk/octave-forge/main/io/NEWS trunk/octave-forge/main/miscellaneous/NEWS Added Paths: ----------- trunk/octave-forge/main/io/inst/xmlwrite.m Removed Paths: ------------- trunk/octave-forge/main/miscellaneous/inst/xmlwrite.m Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-03-13 02:08:43 UTC (rev 9843) +++ trunk/octave-forge/main/io/NEWS 2012-03-13 02:41:21 UTC (rev 9844) @@ -15,7 +15,7 @@ ** The following functions have been imported from the miscellaneous package: cell2csv csvconcat - csv2cell csvexplode + csv2cell csvexplode xmlwrite =============================================================================== io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis Copied: trunk/octave-forge/main/io/inst/xmlwrite.m (from rev 9841, trunk/octave-forge/main/miscellaneous/inst/xmlwrite.m) =================================================================== --- trunk/octave-forge/main/io/inst/xmlwrite.m (rev 0) +++ trunk/octave-forge/main/io/inst/xmlwrite.m 2012-03-13 02:41:21 UTC (rev 9844) @@ -0,0 +1,201 @@ +## Copyright (C) 2004 Laurent Mazet <ma...@cr...> +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 3 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{nb} =} xmlwrite (@var{filename}, @var{value}) +## @deftypefnx {Function File} {@var{nb} =} xmlwrite (@var{fd}, @var{value}, [@var{name}]) +## +## Write a @var{value} into @var{filename} (@var{fd}) as a XML file. +## +##The number of elements (@var{nb}) or 0 is returned. +## @end deftypefn + +function nb = xmlwrite (filename, value, name) + persistent indent = ""; + persistent separator = "\n"; + + ## Check argument number + nb = 0; + if (nargin < 2) || (nargin > 3) + print_usage; + endif + + ## Get the file identificator + isopen = false; + if ischar(filename) + + ## Check file name + sn = char (strsplit (filename, ".")); + if !strcmp(tolower(deblank(sn(end,:))), "xml") + filename = [filename, ".xml"]; + endif + + ## Open file + fd = fopen (filename, "w"); + if fd <= 0 + error("error opening file \"%s\"\n", filename); + endif + + ## XML header + fprintf (fd, "<?xml version=\"1.0\"?>\n"); + fprintf (fd, "<!DOCTYPE octave SYSTEM \"octave.dtd\">\n"); + fprintf (fd, "<octave>\n"); + indent = " "; + else + isopen = true; + fd = filename; + endif + + ## Store name in optional argument + opt = ""; + if nargin == 3 + opt = sprintf(" name=\"%s\"", name); + endif + + ## Process by type + + if ischar(value) && (rows(value) <= 1) + ## String type + + fprintf (fd, "%s<string%s length=\"%d\">%s</string>%s", + indent, opt, length(value), value, separator); + + elseif ischar(value) + ## String array type + + fprintf (fd, "%s<array%s rows=\"%d\">\n", indent, opt, rows(value)); + _indent = indent; indent = [indent, " "]; + for k=1:rows(value), + nb += xmlwrite (fd, deblank(value(k, :))); + endfor + indent = _indent; + fprintf (fd, "%s</array>\n", indent); + + elseif isscalar(value) + ## Scalar type + + if iscomplex(value) + ## Complex type + + fprintf (fd, "%s<complex%s>", indent, opt); + _indent = indent; indent = ""; _separator = separator; separator = ""; + nb += xmlwrite (fd, real(value)); + nb += xmlwrite (fd, imag(value)); + indent = _indent; separator = _separator; + fprintf (fd, "</complex>%s", separator); + + elseif isbool(value) + ## Boolean type + + if value + fprintf (fd, "%s<scalar%s value=\"true\"/>%s", indent, opt, separator); + else + fprintf (fd, "%s<scalar%s value=\"false\"/>%s", indent, opt, separator); + endif + + elseif isinf(value) + ## Infinite type + + if value > 0 + fprintf (fd, "%s<scalar%s value=\"inf\"/>%s", + indent, opt, separator); + else + fprintf (fd, "%s<scalar%s value=\"neginf\"/>%s", + indent, opt, separator); + endif + + elseif isnan(value) + ## Not-A-Number type + + fprintf (fd, "%s<scalar%s value=\"nan\"/>%s", indent, opt, separator); + + elseif isna(value) + ## Not-Avaliable + + fprintf (fd, "%s<scalar%s value=\"na\"/>%s", indent, opt, separator); + + else + sc = sprintf(sprintf("%%.%dg", save_precision), value); + fprintf (fd, "%s<scalar%s>%s</scalar>%s", indent, opt, sc, ... + separator); + endif + + elseif ismatrix(value) && isnumeric(value) && (length(size(value)) <= 2) + ## Matrix type + + fprintf (fd, "%s<matrix%s rows=\"%d\" columns=\"%d\">\n", + indent, opt, rows(value), columns(value)); + _indent = indent; indent = ""; separator = ""; + for k=1:rows(value), + fprintf (fd, "%s ", _indent); + for l=1:columns(value)-1, + nb += xmlwrite (fd, value(k, l)); + fprintf (fd, " "); + endfor + nb += xmlwrite (fd, value(k, end)); + fprintf (fd, "\n"); + endfor + indent = _indent; separator = "\n"; + fprintf (fd, "%s</matrix>\n", indent); + + elseif isstruct(value) + ## Structure type + + st = fieldnames(value); + fprintf (fd, "%s<structure%s>\n", indent, opt); + _indent = indent; indent = [indent, " "]; + for k=1:length(st), + eval(sprintf("nb += xmlwrite (fd, value.%s, \"%s\");", st{k}, st{k})); + endfor + indent = _indent; + fprintf (fd, "%s</structure>\n", indent); + + elseif iscell(value) + ## Cell type + + fprintf (fd, "%s<cell%s rows=\"%d\" columns=\"%d\">\n", + indent, opt, rows(value), columns(value)); + _indent = indent; indent = [indent, " "]; + for k=1:rows(value), + for l=1:columns(value), + nb += xmlwrite (fd, value{k, l}); + endfor + endfor + indent = _indent; + fprintf (fd, "%s</cell>\n", indent); + + elseif islist(value) + ## List type + + fprintf (fd, "%s<list%s length=\"%d\">\n", indent, opt, length(value)); + _indent = indent; indent = [indent, " "]; + for k=1:length(value), + nb += xmlwrite (fd, value{k}); + endfor + indent = _indent; + fprintf (fd, "%s</list>\n", indent); + + else + ## Unknown type + error("unknown type\n"); + endif + nb++; + + if !isopen + fprintf (fd, "</octave>\n"); + fclose(fd); + endif + +endfunction Modified: trunk/octave-forge/main/miscellaneous/NEWS =================================================================== --- trunk/octave-forge/main/miscellaneous/NEWS 2012-03-13 02:08:43 UTC (rev 9843) +++ trunk/octave-forge/main/miscellaneous/NEWS 2012-03-13 02:41:21 UTC (rev 9844) @@ -20,7 +20,7 @@ ** The following functions have been moved to the IO package: cell2csv csvconcat - csv2cell csvexplode + csv2cell csvexplode xmlwrite ** The function `clip' was imported from the audio package. Deleted: trunk/octave-forge/main/miscellaneous/inst/xmlwrite.m =================================================================== --- trunk/octave-forge/main/miscellaneous/inst/xmlwrite.m 2012-03-13 02:08:43 UTC (rev 9843) +++ trunk/octave-forge/main/miscellaneous/inst/xmlwrite.m 2012-03-13 02:41:21 UTC (rev 9844) @@ -1,201 +0,0 @@ -## Copyright (C) 2004 Laurent Mazet <ma...@cr...> -## -## This program is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free Software -## Foundation; either version 3 of the License, or (at your option) any later -## version. -## -## This program is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -## details. -## -## You should have received a copy of the GNU General Public License along with -## this program; if not, see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {@var{nb} =} xmlwrite (@var{filename}, @var{value}) -## @deftypefnx {Function File} {@var{nb} =} xmlwrite (@var{fd}, @var{value}, [@var{name}]) -## -## Write a @var{value} into @var{filename} (@var{fd}) as a XML file. -## -##The number of elements (@var{nb}) or 0 is returned. -## @end deftypefn - -function nb = xmlwrite (filename, value, name) - persistent indent = ""; - persistent separator = "\n"; - - ## Check argument number - nb = 0; - if (nargin < 2) || (nargin > 3) - print_usage; - endif - - ## Get the file identificator - isopen = false; - if ischar(filename) - - ## Check file name - sn = char (strsplit (filename, ".")); - if !strcmp(tolower(deblank(sn(end,:))), "xml") - filename = [filename, ".xml"]; - endif - - ## Open file - fd = fopen (filename, "w"); - if fd <= 0 - error("error opening file \"%s\"\n", filename); - endif - - ## XML header - fprintf (fd, "<?xml version=\"1.0\"?>\n"); - fprintf (fd, "<!DOCTYPE octave SYSTEM \"octave.dtd\">\n"); - fprintf (fd, "<octave>\n"); - indent = " "; - else - isopen = true; - fd = filename; - endif - - ## Store name in optional argument - opt = ""; - if nargin == 3 - opt = sprintf(" name=\"%s\"", name); - endif - - ## Process by type - - if ischar(value) && (rows(value) <= 1) - ## String type - - fprintf (fd, "%s<string%s length=\"%d\">%s</string>%s", - indent, opt, length(value), value, separator); - - elseif ischar(value) - ## String array type - - fprintf (fd, "%s<array%s rows=\"%d\">\n", indent, opt, rows(value)); - _indent = indent; indent = [indent, " "]; - for k=1:rows(value), - nb += xmlwrite (fd, deblank(value(k, :))); - endfor - indent = _indent; - fprintf (fd, "%s</array>\n", indent); - - elseif isscalar(value) - ## Scalar type - - if iscomplex(value) - ## Complex type - - fprintf (fd, "%s<complex%s>", indent, opt); - _indent = indent; indent = ""; _separator = separator; separator = ""; - nb += xmlwrite (fd, real(value)); - nb += xmlwrite (fd, imag(value)); - indent = _indent; separator = _separator; - fprintf (fd, "</complex>%s", separator); - - elseif isbool(value) - ## Boolean type - - if value - fprintf (fd, "%s<scalar%s value=\"true\"/>%s", indent, opt, separator); - else - fprintf (fd, "%s<scalar%s value=\"false\"/>%s", indent, opt, separator); - endif - - elseif isinf(value) - ## Infinite type - - if value > 0 - fprintf (fd, "%s<scalar%s value=\"inf\"/>%s", - indent, opt, separator); - else - fprintf (fd, "%s<scalar%s value=\"neginf\"/>%s", - indent, opt, separator); - endif - - elseif isnan(value) - ## Not-A-Number type - - fprintf (fd, "%s<scalar%s value=\"nan\"/>%s", indent, opt, separator); - - elseif isna(value) - ## Not-Avaliable - - fprintf (fd, "%s<scalar%s value=\"na\"/>%s", indent, opt, separator); - - else - sc = sprintf(sprintf("%%.%dg", save_precision), value); - fprintf (fd, "%s<scalar%s>%s</scalar>%s", indent, opt, sc, ... - separator); - endif - - elseif ismatrix(value) && isnumeric(value) && (length(size(value)) <= 2) - ## Matrix type - - fprintf (fd, "%s<matrix%s rows=\"%d\" columns=\"%d\">\n", - indent, opt, rows(value), columns(value)); - _indent = indent; indent = ""; separator = ""; - for k=1:rows(value), - fprintf (fd, "%s ", _indent); - for l=1:columns(value)-1, - nb += xmlwrite (fd, value(k, l)); - fprintf (fd, " "); - endfor - nb += xmlwrite (fd, value(k, end)); - fprintf (fd, "\n"); - endfor - indent = _indent; separator = "\n"; - fprintf (fd, "%s</matrix>\n", indent); - - elseif isstruct(value) - ## Structure type - - st = fieldnames(value); - fprintf (fd, "%s<structure%s>\n", indent, opt); - _indent = indent; indent = [indent, " "]; - for k=1:length(st), - eval(sprintf("nb += xmlwrite (fd, value.%s, \"%s\");", st{k}, st{k})); - endfor - indent = _indent; - fprintf (fd, "%s</structure>\n", indent); - - elseif iscell(value) - ## Cell type - - fprintf (fd, "%s<cell%s rows=\"%d\" columns=\"%d\">\n", - indent, opt, rows(value), columns(value)); - _indent = indent; indent = [indent, " "]; - for k=1:rows(value), - for l=1:columns(value), - nb += xmlwrite (fd, value{k, l}); - endfor - endfor - indent = _indent; - fprintf (fd, "%s</cell>\n", indent); - - elseif islist(value) - ## List type - - fprintf (fd, "%s<list%s length=\"%d\">\n", indent, opt, length(value)); - _indent = indent; indent = [indent, " "]; - for k=1:length(value), - nb += xmlwrite (fd, value{k}); - endfor - indent = _indent; - fprintf (fd, "%s</list>\n", indent); - - else - ## Unknown type - error("unknown type\n"); - endif - nb++; - - if !isopen - fprintf (fd, "</octave>\n"); - fclose(fd); - endif - -endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-13 02:08:50
|
Revision: 9843 http://octave.svn.sourceforge.net/octave/?rev=9843&view=rev Author: carandraug Date: 2012-03-13 02:08:43 +0000 (Tue, 13 Mar 2012) Log Message: ----------- csvexplode, csv2cell, cell2csv, csvconcat: making note on the NEWS file of IO and miscellaneous packages Modified Paths: -------------- trunk/octave-forge/main/io/NEWS trunk/octave-forge/main/miscellaneous/NEWS Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-03-13 01:53:05 UTC (rev 9842) +++ trunk/octave-forge/main/io/NEWS 2012-03-13 02:08:43 UTC (rev 9843) @@ -7,11 +7,16 @@ ** Bug fixes: --- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. --- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. +--- csv2cell: checks if file is empty annd return an empty cell if so. ** Adapted to internal LibreOffice-3.5-final changes. ** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. +** The following functions have been imported from the miscellaneous package: + cell2csv csvconcat + csv2cell csvexplode + =============================================================================== io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis =============================================================================== Modified: trunk/octave-forge/main/miscellaneous/NEWS =================================================================== --- trunk/octave-forge/main/miscellaneous/NEWS 2012-03-13 01:53:05 UTC (rev 9842) +++ trunk/octave-forge/main/miscellaneous/NEWS 2012-03-13 02:08:43 UTC (rev 9843) @@ -17,8 +17,13 @@ clip normr text_waitbar normc sample - ** The function clip was imported from the audio package. + ** The following functions have been moved to the IO package: + cell2csv csvconcat + csv2cell csvexplode + + ** The function `clip' was imported from the audio package. + ** The functions `apply' and `map' have been deprecated. `cellfun' and `arrayfun' from octave core should be used instead. @@ -30,8 +35,6 @@ ** Multiple bug fixes and increased input check on many functions. - ** The function `csv2cell' now returns an empty cell in the case of empty file - ** Package is no longer automatically loaded. ** improvements to help text. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-13 01:53:13
|
Revision: 9842 http://octave.svn.sourceforge.net/octave/?rev=9842&view=rev Author: carandraug Date: 2012-03-13 01:53:05 +0000 (Tue, 13 Mar 2012) Log Message: ----------- ga: move NEWS to package root Modified Paths: -------------- trunk/octave-forge/admin/list_inactive_users.pl Added Paths: ----------- trunk/octave-forge/main/ga/NEWS Removed Paths: ------------- trunk/octave-forge/main/ga/doc/NEWS Modified: trunk/octave-forge/admin/list_inactive_users.pl =================================================================== --- trunk/octave-forge/admin/list_inactive_users.pl 2012-03-13 00:59:55 UTC (rev 9841) +++ trunk/octave-forge/admin/list_inactive_users.pl 2012-03-13 01:53:05 UTC (rev 9842) @@ -37,8 +37,8 @@ ################################################################################ ## Configuration variables ################################################################################ -my $repo_path = '~/development/octave-forge/main/'; # path for the repository -my $date_limit = '2011-01-01'; # give date in format YYYY-MM-DD +my $repo_path = '~/development/octave-forge/'; # path for the repository +my $date_limit = '2010-08-07'; # give date in format YYYY-MM-DD my $sf_dev_list = 'http://sourceforge.net/project/memberlist.php?group_id=2888'; # URL for sourceforge project member list ################################################################################ Copied: trunk/octave-forge/main/ga/NEWS (from rev 9841, trunk/octave-forge/main/ga/doc/NEWS) =================================================================== --- trunk/octave-forge/main/ga/NEWS (rev 0) +++ trunk/octave-forge/main/ga/NEWS 2012-03-13 01:53:05 UTC (rev 9842) @@ -0,0 +1,10 @@ +Summary of important user-visible changes for releases of the ga package + +=============================================================================== +ga-0.9.9 Release Date: 2012-xx-yy Release Manager: Luca Favatella +=============================================================================== + +** Remove dependency on the "communications" package and require + Octave version 3.4.0 (or better). The "communications" package was + used only for its "randint" function; now the "randi" function, + introduced on Octave 3.4.0, is used instead. Deleted: trunk/octave-forge/main/ga/doc/NEWS =================================================================== --- trunk/octave-forge/main/ga/doc/NEWS 2012-03-13 00:59:55 UTC (rev 9841) +++ trunk/octave-forge/main/ga/doc/NEWS 2012-03-13 01:53:05 UTC (rev 9842) @@ -1,10 +0,0 @@ -Summary of important user-visible changes for releases of the ga package - -=============================================================================== -ga-0.9.9 Release Date: 2012-xx-yy Release Manager: Luca Favatella -=============================================================================== - -** Remove dependency on the "communications" package and require - Octave version 3.4.0 (or better). The "communications" package was - used only for its "randint" function; now the "randi" function, - introduced on Octave 3.4.0, is used instead. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sla...@us...> - 2012-03-13 01:00:01
|
Revision: 9841 http://octave.svn.sourceforge.net/octave/?rev=9841&view=rev Author: slackydeb Date: 2012-03-13 00:59:55 +0000 (Tue, 13 Mar 2012) Log Message: ----------- ga: update news and description files Modified Paths: -------------- trunk/octave-forge/main/ga/DESCRIPTION trunk/octave-forge/main/ga/doc/NEWS Modified: trunk/octave-forge/main/ga/DESCRIPTION =================================================================== --- trunk/octave-forge/main/ga/DESCRIPTION 2012-03-13 00:40:30 UTC (rev 9840) +++ trunk/octave-forge/main/ga/DESCRIPTION 2012-03-13 00:59:55 UTC (rev 9841) @@ -1,6 +1,6 @@ Name: ga Version: 0.9.9 -Date: 2011-07-29 +Date: 2012-03-13 Author: Luca Favatella <sla...@gm...> Maintainer: Luca Favatella <sla...@gm...> Title: Genetic Algorithm and Direct Search Modified: trunk/octave-forge/main/ga/doc/NEWS =================================================================== --- trunk/octave-forge/main/ga/doc/NEWS 2012-03-13 00:40:30 UTC (rev 9840) +++ trunk/octave-forge/main/ga/doc/NEWS 2012-03-13 00:59:55 UTC (rev 9841) @@ -0,0 +1,10 @@ +Summary of important user-visible changes for releases of the ga package + +=============================================================================== +ga-0.9.9 Release Date: 2012-xx-yy Release Manager: Luca Favatella +=============================================================================== + +** Remove dependency on the "communications" package and require + Octave version 3.4.0 (or better). The "communications" package was + used only for its "randint" function; now the "randi" function, + introduced on Octave 3.4.0, is used instead. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sla...@us...> - 2012-03-13 00:40:37
|
Revision: 9840 http://octave.svn.sourceforge.net/octave/?rev=9840&view=rev Author: slackydeb Date: 2012-03-13 00:40:30 +0000 (Tue, 13 Mar 2012) Log Message: ----------- Add empty NEWS file Added Paths: ----------- trunk/octave-forge/main/ga/doc/NEWS Added: trunk/octave-forge/main/ga/doc/NEWS =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 22:46:28
|
Revision: 9839 http://octave.svn.sourceforge.net/octave/?rev=9839&view=rev Author: carandraug Date: 2012-03-12 22:46:21 +0000 (Mon, 12 Mar 2012) Log Message: ----------- csvexplode, csv2cell, cell2csv, csvconcat: moving from miscellaneous to IO package. Fixing Makefiles Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/src/Makefile Added Paths: ----------- trunk/octave-forge/main/io/src/ trunk/octave-forge/main/io/src/Makefile trunk/octave-forge/main/io/src/cell2csv.cc trunk/octave-forge/main/io/src/csv2cell.cc trunk/octave-forge/main/io/src/csvconcat.cc trunk/octave-forge/main/io/src/csvexplode.cc Removed Paths: ------------- trunk/octave-forge/main/miscellaneous/src/cell2csv.cc trunk/octave-forge/main/miscellaneous/src/csv2cell.cc trunk/octave-forge/main/miscellaneous/src/csvconcat.cc trunk/octave-forge/main/miscellaneous/src/csvexplode.cc Added: trunk/octave-forge/main/io/src/Makefile =================================================================== --- trunk/octave-forge/main/io/src/Makefile (rev 0) +++ trunk/octave-forge/main/io/src/Makefile 2012-03-12 22:46:21 UTC (rev 9839) @@ -0,0 +1,7 @@ +all: csvexplode.oct csv2cell.oct csvconcat.oct cell2csv.oct + +%.oct: %.cc + mkoctfile -Wall $< + +clean: + rm -f *.o octave-core core *.oct *~ Copied: trunk/octave-forge/main/io/src/cell2csv.cc (from rev 9837, trunk/octave-forge/main/miscellaneous/src/cell2csv.cc) =================================================================== --- trunk/octave-forge/main/io/src/cell2csv.cc (rev 0) +++ trunk/octave-forge/main/io/src/cell2csv.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -0,0 +1,116 @@ +// Copyright (C) 2004 Laurent Mazet <ma...@cr...> +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, see <http://www.gnu.org/licenses/>. + +#include <fstream> + +#include <octave/oct.h> +#include <octave/Cell.h> + +DEFUN_DLD (cell2csv, args, nargout, + "-*- texinfo -*-\n" + "@deftypefn {Function File} {} cell2csv (@var{file}, @var{c})\n" + "@deftypefnx {Function File} {} cell2csv (@var{file}, @var{c}, @var{sep})\n" + "@deftypefnx {Function File} {} cell2csv (@var{file}, @var{c}, @var{sep}, @var{prot})\n" + "\n" + "Create a CSV file from a cell. " + "@var{sep} changes the character used to separate two fields. By " + "default, two fields are expected to be separated by a coma " + "(@code{,}). @var{prot} changes the character used to protect a string. " + "By default it's a double quote (@code{\"}).\n" + "@end deftypefn") { + + /* Check argument */ + if ((args.length() < 2) || (args.length() > 4)) { + print_usage (); + return octave_value(); + } + + /* Get arguments */ + std::string file = args(0).string_value(); + + Cell c = args(1).cell_value(); + + std::string sep = (args.length() > 2) ? args(2).string_value() : ","; + if (sep.length() != 1) { + error("Only on charactere need as separator\n"); + return octave_value(); + } + + std::string prot = (args.length() > 3) ? args(3).string_value() : "\""; + if (prot.length() != 1) { + error("Only on charactere need as protector\n"); + return octave_value(); + } + + /* Open file */ + std::ofstream fd(file.c_str()); + if (!fd.is_open()) { + error("cannot write %s\n", file.c_str()); + return octave_value(); + } + + /* Concat a cell into a string */ + std::string word; + + /* For each element */ + for (int i=0, il=c.rows(); i<il; i++) { + + for (int j=0, jl=c.columns(); j<jl; j++) { + word = ""; + + /* Add separator */ + if (j != 0) + word += sep; + + if (c(i, j).is_real_scalar()) { + + /* Output real value */ + char tmp[20]; + sprintf(tmp, "%g", c(i, j).double_value()); + word += tmp; + } + + else if (c(i, j).is_string()) { + /* Output string value */ + std::string str = c(i, j).string_value(); + if (str.find(sep) != str.npos) { + size_t pos = 0; + while ((pos=str.find(prot, pos)) != str.npos) { + str.replace(pos, 1, prot+prot); + pos += 2; + } + str = prot + str + prot; + } + word += str; + } + + else if (!c(i, j).is_empty()) { + /* Output NaN value */ + warning ("not a real or a string\n"); + word += "NaN"; + } + + fd << word; + } + + /* Add end of line */ + fd << std::endl; + } + + /* Close file */ + fd.close(); + + return octave_value(); +} Copied: trunk/octave-forge/main/io/src/csv2cell.cc (from rev 9837, trunk/octave-forge/main/miscellaneous/src/csv2cell.cc) =================================================================== --- trunk/octave-forge/main/io/src/csv2cell.cc (rev 0) +++ trunk/octave-forge/main/io/src/csv2cell.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -0,0 +1,193 @@ +// Copyright (C) 2004 Laurent Mazet <ma...@cr...> +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, see <http://www.gnu.org/licenses/>. + +#include <fstream> + +#include <octave/oct.h> +#include <octave/Cell.h> + +#define MAXSTRINGLENGTH 4096 + +DEFUN_DLD (csv2cell, args, nargout, + "-*- texinfo -*-\n" + "@deftypefn {Function File} {@var{c} = } csv2cell (@var{file})\n" + "@deftypefnx {Function File} {@var{c} = } csv2cell (@var{file}, @var{sep})\n" + "@deftypefnx {Function File} {@var{c} = } csv2cell (@var{file}, @var{sep}, @var{prot})\n" + "\n" + "Read a CSV (Comma Separated Values) file and convert it into a " + "cell. " + "@var{sep} changes the character used to separate two fields. By " + "default, two fields are expected to be separated by a coma " + "(@code{,}). @var{prot} changes the character used to protect a string. " + "By default it's a double quote (@code{\"}).\n" + "@end deftypefn") { + + /* Get arguments */ + const int nargin = args.length (); + octave_value_list retval; + if (nargin == 0) + { + error ("csv2cell: not enough input arguments"); + return retval; + } + + const std::string file = args (0).string_value (); + + const std::string _sep = (nargin > 1) ? args (1).string_value () : ","; + if (_sep.length() != 1) + { + error ("csv2cell: only on charactere need as separator"); + return retval; + } + char sep = _sep[0]; + + const std::string _prot = (nargin > 2) ? args (2).string_value () : "\""; + if (_prot.length() != 1) + { + error ("csv2cell: only on charactere need as protector"); + return retval; + } + char prot = _prot[0]; + + /* Open file */ + std::ifstream fd (file.c_str ()); + if (!fd.is_open ()) + { + error ("csv2cell: cannot read %s", file.c_str()); + return retval; + } + fd.seekg (0, std::ios::end); + long fdend = fd.tellg (); + fd.seekg (0, std::ios::beg); + + if (fd.tellg () >= fdend) + return octave_value (Cell (0, 0)); + + /* Buffers */ + char line [MAXSTRINGLENGTH]; + std::string str, word; + bool inside = false; + + /* Read a line */ + str = ""; + fd.getline (line, MAXSTRINGLENGTH); + while (fd.fail ()) + { + fd.clear (); + str += line; + fd.getline (line, MAXSTRINGLENGTH); + } + str += line; + + /* Parse first to get number of columns */ + int nbcolumns = 0; + for (int i = 0, len = str.length (); i <= len; i++) + if (((i==len) || (str [i] == sep)) && (!inside)) + nbcolumns++; + else if ((inside) && (str [i] == prot) && ((i < len) && (str [i+1] == prot))) + ++i; + else if (str [i] == prot) + inside = !inside; + + /* Read all the file to get number of rows */ + int nbrows = 1; + while (fd.tellg () < fdend) + { + fd.getline (line, MAXSTRINGLENGTH); + while (fd.fail ()) + { + fd.clear (); + fd.getline (line, MAXSTRINGLENGTH); + } + nbrows++; + } + + /* Rewind */ + fd.seekg (0, std::ios::beg); + if (!fd.good ()) + { + error ("csv2cell: cannot reread %s", file.c_str ()); + return retval; + } + + /* Read all the file until the end */ + Cell c (nbrows, nbcolumns); + for (int i = 0; i < nbrows; i++) + { + /* Read a line */ + str = ""; + fd.getline (line, MAXSTRINGLENGTH); + while (fd.fail ()) + { + fd.clear (); + str += line; + fd.getline (line, MAXSTRINGLENGTH); + } + str += line; + + /* Explode a line into a sub cell */ + word = ""; + inside = false; + int j = 0; + for (int k = 0, len = str.length (); k <= len; k++) + { + if (((k == len) || (str [k] == sep)) && (!inside)) + { + /* Check number of columns */ + if (j == nbcolumns) + { + fd.close (); + error ("csv2cell: incorrect CSV file, line %d too long", i+1); + return retval; + } + + /* Check if scalar */ + const char *word_str = word.c_str (); + char *err; + double val = strtod (word_str, &err); + + /* Store into the cell */ + c (i, j++) = ((word == "") || (err != word_str+word.length())) ? + octave_value (word) : octave_value (val); + word = ""; + } + else if ((inside) && (str[k]==prot) && ((k<len) && (str[k+1]==prot))) + { + /* Insisde a string */ + word += prot; + ++k; + } + else if (str[k] == prot) + /* Changing */ + inside = !inside; + else + word += str[k]; + } + + /* Check number of columns */ + if (j != nbcolumns) + { + fd.close (); + error ("csv2cell: incorrect CSV file, line %d too short", i+1); + return retval; + } + } + + /* Close file */ + fd.close (); + + retval (0) = c; + return retval; +} Copied: trunk/octave-forge/main/io/src/csvconcat.cc (from rev 9837, trunk/octave-forge/main/miscellaneous/src/csvconcat.cc) =================================================================== --- trunk/octave-forge/main/io/src/csvconcat.cc (rev 0) +++ trunk/octave-forge/main/io/src/csvconcat.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -0,0 +1,98 @@ +// Copyright (C) 2004 Laurent Mazet <ma...@cr...> +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> +#include <octave/Cell.h> + +DEFUN_DLD (csvconcat, args, nargout, + "-*- texinfo -*-\n" + "@deftypefn {Function File} {@var{str} = } csvconcat (@var{c})\n" + "@deftypefnx {Function File} {@var{str} = } csvconcat (@var{c}, @var{sep})\n" + "@deftypefnx {Function File} {@var{str} = } csvconcat (@var{c}, @var{sep}, @var{prot})\n" + "\n" + "Concatenate a cell into a CSV string or array of strings. " + "@var{sep} changes the character used to separate two fields. By " + "default, two fields are expected to be separated by a coma " + "(@code{,}). @var{prot} changes the character used to protect a string. " + "By default it's a double quote (@code{\"}).\n" + "@end deftypefn") { + + /* Check argument */ + if ((args.length() < 1) || (args.length() > 3)) { + print_usage (); + return octave_value(); + } + + /* Get arguments */ + Cell c = args(0).cell_value(); + + std::string sep = (args.length() > 1) ? args(1).string_value() : ","; + if (sep.length() != 1) { + error("Only on charactere need as separator\n"); + return octave_value(); + } + + std::string prot = (args.length() > 2) ? args(2).string_value() : "\""; + if (prot.length() != 1) { + error("Only on charactere need as protector\n"); + return octave_value(); + } + + /* Concat a cell into a string */ + string_vector vec(c.rows()); + std::string word; + + /* For each element */ + for (int i=0, il=c.rows(); i<il; i++) { + word = ""; + for (int j=0, jl=c.columns(); j<jl; j++) { + + /* Add separator */ + if (j != 0) + word += sep; + + if (c(i, j).is_real_scalar()) { + + /* Output real value */ + char tmp[20]; + sprintf(tmp, "%g", c(i, j).double_value()); + word += tmp; + } + + else if (c(i, j).is_string()) { + /* Output string value */ + std::string str = c(i, j).string_value(); + if (str.find(sep) != str.npos) { + unsigned int pos = 0; + while ((pos=str.find(prot, pos)) != str.npos) { + str.replace(pos, 1, prot+prot); + pos += 2; + } + str = prot + str + prot; + } + word += str; + } + + else { + /* Output NaN value */ + warning ("not a real or a string\n"); + word += "NaN"; + } + } + vec(i) = word; + } + + return octave_value(vec); +} Copied: trunk/octave-forge/main/io/src/csvexplode.cc (from rev 9837, trunk/octave-forge/main/miscellaneous/src/csvexplode.cc) =================================================================== --- trunk/octave-forge/main/io/src/csvexplode.cc (rev 0) +++ trunk/octave-forge/main/io/src/csvexplode.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -0,0 +1,97 @@ +// Copyright (C) 2004 Laurent Mazet <ma...@cr...> +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> +#include <octave/Cell.h> + +DEFUN_DLD (csvexplode, args, nargout, + "-*- texinfo -*-\n" + "@deftypefn {Function File} {@var{c} = } csvexplode (@var{str})\n" + "@deftypefnx {Function File} {@var{c} = } csvexplode (@var{str}, @var{sep})\n" + "@deftypefnx {Function File} {@var{c} = } csvexplode (@var{str}, @var{sep}, @var{prot})\n" + "\n" + "Explode a CSV string into a cell. " + "@var{sep} changes the character used to separate two fields. By " + "default, two fields are expected to be separated by a coma " + "(@code{,}). @var{prot} changes the character used to protect a string. " + "By default it's a double quote (@code{\"}).\n" + "@end deftypefn") { + + /* Check argument */ + if ((args.length() < 1) || (args.length() > 3)) { + print_usage (); + return octave_value(); + } + + /* Get arguments */ + if (!args(0).is_string()) { + if (args(0).is_cell()) + return octave_value(args(0)); + else + return octave_value(Cell(args(0))); + } + std::string str = args(0).string_value(); + + std::string _sep = (args.length() > 1) ? args(1).string_value() : ","; + if (_sep.length() != 1) { + error("Only on charactere need as separator\n"); + return octave_value(); + } + char sep = _sep[0]; + + std::string _prot = (args.length() > 2) ? args(2).string_value() : "\""; + if (_prot.length() != 1) { + error("Only on charactere need as protector\n"); + return octave_value(); + } + char prot = _prot[0]; + + /* Explode a line into a cell */ + Cell retval; + std::string word; + bool inside = false; + for (int i=0, len=str.length(); i<=len; i++) { + if (((i==len) || (str[i] == sep)) && (!inside)) { + + /* Extand cell */ + retval.resize(dim_vector(1, retval.columns()+1)); + + /* Check if scalar */ + const char *word_str=word.c_str(); + char *err; + double val = strtod (word_str, &err); + + /* Store into the cell */ + retval(0, retval.columns()-1) = + ((word == "") || (err != word_str+word.length())) ? + octave_value(word) : octave_value(val); + + word = ""; + } + else if ((inside) && (str[i]==prot) && ((i<len) && (str[i+1]==prot))) { + + /* Insisde a string */ + word += prot; + ++i; + } + else if (str[i] == prot) + /* Changing */ + inside = !inside; + else + word += str[i]; + } + + return octave_value(retval); +} Modified: trunk/octave-forge/main/miscellaneous/src/Makefile =================================================================== --- trunk/octave-forge/main/miscellaneous/src/Makefile 2012-03-12 22:37:25 UTC (rev 9838) +++ trunk/octave-forge/main/miscellaneous/src/Makefile 2012-03-12 22:46:21 UTC (rev 9839) @@ -49,18 +49,6 @@ xmlread.oct: xmlread.o xmltree_read.o xmltree.o $(MKOCTFILE) $^ -csvexplode.oct: csvexplode.cc - $(MKOCTFILE) $(MISCDEFS) $< - -csv2cell.oct: csv2cell.cc - $(MKOCTFILE) $(MISCDEFS) $< - -csvconcat.oct: csvconcat.cc - $(MKOCTFILE) $(MISCDEFS) $< - -cell2csv.oct: cell2csv.cc - $(MKOCTFILE) $(MISCDEFS) $< - cell2cell.oct: cell2cell.cc $(MKOCTFILE) $(MISCDEFS) $< Deleted: trunk/octave-forge/main/miscellaneous/src/cell2csv.cc =================================================================== --- trunk/octave-forge/main/miscellaneous/src/cell2csv.cc 2012-03-12 22:37:25 UTC (rev 9838) +++ trunk/octave-forge/main/miscellaneous/src/cell2csv.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -1,116 +0,0 @@ -// Copyright (C) 2004 Laurent Mazet <ma...@cr...> -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 3 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License along with -// this program; if not, see <http://www.gnu.org/licenses/>. - -#include <fstream> - -#include <octave/oct.h> -#include <octave/Cell.h> - -DEFUN_DLD (cell2csv, args, nargout, - "-*- texinfo -*-\n" - "@deftypefn {Function File} {} cell2csv (@var{file}, @var{c})\n" - "@deftypefnx {Function File} {} cell2csv (@var{file}, @var{c}, @var{sep})\n" - "@deftypefnx {Function File} {} cell2csv (@var{file}, @var{c}, @var{sep}, @var{prot})\n" - "\n" - "Create a CSV file from a cell. " - "@var{sep} changes the character used to separate two fields. By " - "default, two fields are expected to be separated by a coma " - "(@code{,}). @var{prot} changes the character used to protect a string. " - "By default it's a double quote (@code{\"}).\n" - "@end deftypefn") { - - /* Check argument */ - if ((args.length() < 2) || (args.length() > 4)) { - print_usage (); - return octave_value(); - } - - /* Get arguments */ - std::string file = args(0).string_value(); - - Cell c = args(1).cell_value(); - - std::string sep = (args.length() > 2) ? args(2).string_value() : ","; - if (sep.length() != 1) { - error("Only on charactere need as separator\n"); - return octave_value(); - } - - std::string prot = (args.length() > 3) ? args(3).string_value() : "\""; - if (prot.length() != 1) { - error("Only on charactere need as protector\n"); - return octave_value(); - } - - /* Open file */ - std::ofstream fd(file.c_str()); - if (!fd.is_open()) { - error("cannot write %s\n", file.c_str()); - return octave_value(); - } - - /* Concat a cell into a string */ - std::string word; - - /* For each element */ - for (int i=0, il=c.rows(); i<il; i++) { - - for (int j=0, jl=c.columns(); j<jl; j++) { - word = ""; - - /* Add separator */ - if (j != 0) - word += sep; - - if (c(i, j).is_real_scalar()) { - - /* Output real value */ - char tmp[20]; - sprintf(tmp, "%g", c(i, j).double_value()); - word += tmp; - } - - else if (c(i, j).is_string()) { - /* Output string value */ - std::string str = c(i, j).string_value(); - if (str.find(sep) != str.npos) { - size_t pos = 0; - while ((pos=str.find(prot, pos)) != str.npos) { - str.replace(pos, 1, prot+prot); - pos += 2; - } - str = prot + str + prot; - } - word += str; - } - - else if (!c(i, j).is_empty()) { - /* Output NaN value */ - warning ("not a real or a string\n"); - word += "NaN"; - } - - fd << word; - } - - /* Add end of line */ - fd << std::endl; - } - - /* Close file */ - fd.close(); - - return octave_value(); -} Deleted: trunk/octave-forge/main/miscellaneous/src/csv2cell.cc =================================================================== --- trunk/octave-forge/main/miscellaneous/src/csv2cell.cc 2012-03-12 22:37:25 UTC (rev 9838) +++ trunk/octave-forge/main/miscellaneous/src/csv2cell.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -1,193 +0,0 @@ -// Copyright (C) 2004 Laurent Mazet <ma...@cr...> -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 3 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License along with -// this program; if not, see <http://www.gnu.org/licenses/>. - -#include <fstream> - -#include <octave/oct.h> -#include <octave/Cell.h> - -#define MAXSTRINGLENGTH 4096 - -DEFUN_DLD (csv2cell, args, nargout, - "-*- texinfo -*-\n" - "@deftypefn {Function File} {@var{c} = } csv2cell (@var{file})\n" - "@deftypefnx {Function File} {@var{c} = } csv2cell (@var{file}, @var{sep})\n" - "@deftypefnx {Function File} {@var{c} = } csv2cell (@var{file}, @var{sep}, @var{prot})\n" - "\n" - "Read a CSV (Comma Separated Values) file and convert it into a " - "cell. " - "@var{sep} changes the character used to separate two fields. By " - "default, two fields are expected to be separated by a coma " - "(@code{,}). @var{prot} changes the character used to protect a string. " - "By default it's a double quote (@code{\"}).\n" - "@end deftypefn") { - - /* Get arguments */ - const int nargin = args.length (); - octave_value_list retval; - if (nargin == 0) - { - error ("csv2cell: not enough input arguments"); - return retval; - } - - const std::string file = args (0).string_value (); - - const std::string _sep = (nargin > 1) ? args (1).string_value () : ","; - if (_sep.length() != 1) - { - error ("csv2cell: only on charactere need as separator"); - return retval; - } - char sep = _sep[0]; - - const std::string _prot = (nargin > 2) ? args (2).string_value () : "\""; - if (_prot.length() != 1) - { - error ("csv2cell: only on charactere need as protector"); - return retval; - } - char prot = _prot[0]; - - /* Open file */ - std::ifstream fd (file.c_str ()); - if (!fd.is_open ()) - { - error ("csv2cell: cannot read %s", file.c_str()); - return retval; - } - fd.seekg (0, std::ios::end); - long fdend = fd.tellg (); - fd.seekg (0, std::ios::beg); - - if (fd.tellg () >= fdend) - return octave_value (Cell (0, 0)); - - /* Buffers */ - char line [MAXSTRINGLENGTH]; - std::string str, word; - bool inside = false; - - /* Read a line */ - str = ""; - fd.getline (line, MAXSTRINGLENGTH); - while (fd.fail ()) - { - fd.clear (); - str += line; - fd.getline (line, MAXSTRINGLENGTH); - } - str += line; - - /* Parse first to get number of columns */ - int nbcolumns = 0; - for (int i = 0, len = str.length (); i <= len; i++) - if (((i==len) || (str [i] == sep)) && (!inside)) - nbcolumns++; - else if ((inside) && (str [i] == prot) && ((i < len) && (str [i+1] == prot))) - ++i; - else if (str [i] == prot) - inside = !inside; - - /* Read all the file to get number of rows */ - int nbrows = 1; - while (fd.tellg () < fdend) - { - fd.getline (line, MAXSTRINGLENGTH); - while (fd.fail ()) - { - fd.clear (); - fd.getline (line, MAXSTRINGLENGTH); - } - nbrows++; - } - - /* Rewind */ - fd.seekg (0, std::ios::beg); - if (!fd.good ()) - { - error ("csv2cell: cannot reread %s", file.c_str ()); - return retval; - } - - /* Read all the file until the end */ - Cell c (nbrows, nbcolumns); - for (int i = 0; i < nbrows; i++) - { - /* Read a line */ - str = ""; - fd.getline (line, MAXSTRINGLENGTH); - while (fd.fail ()) - { - fd.clear (); - str += line; - fd.getline (line, MAXSTRINGLENGTH); - } - str += line; - - /* Explode a line into a sub cell */ - word = ""; - inside = false; - int j = 0; - for (int k = 0, len = str.length (); k <= len; k++) - { - if (((k == len) || (str [k] == sep)) && (!inside)) - { - /* Check number of columns */ - if (j == nbcolumns) - { - fd.close (); - error ("csv2cell: incorrect CSV file, line %d too long", i+1); - return retval; - } - - /* Check if scalar */ - const char *word_str = word.c_str (); - char *err; - double val = strtod (word_str, &err); - - /* Store into the cell */ - c (i, j++) = ((word == "") || (err != word_str+word.length())) ? - octave_value (word) : octave_value (val); - word = ""; - } - else if ((inside) && (str[k]==prot) && ((k<len) && (str[k+1]==prot))) - { - /* Insisde a string */ - word += prot; - ++k; - } - else if (str[k] == prot) - /* Changing */ - inside = !inside; - else - word += str[k]; - } - - /* Check number of columns */ - if (j != nbcolumns) - { - fd.close (); - error ("csv2cell: incorrect CSV file, line %d too short", i+1); - return retval; - } - } - - /* Close file */ - fd.close (); - - retval (0) = c; - return retval; -} Deleted: trunk/octave-forge/main/miscellaneous/src/csvconcat.cc =================================================================== --- trunk/octave-forge/main/miscellaneous/src/csvconcat.cc 2012-03-12 22:37:25 UTC (rev 9838) +++ trunk/octave-forge/main/miscellaneous/src/csvconcat.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -1,98 +0,0 @@ -// Copyright (C) 2004 Laurent Mazet <ma...@cr...> -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 3 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License along with -// this program; if not, see <http://www.gnu.org/licenses/>. - -#include <octave/oct.h> -#include <octave/Cell.h> - -DEFUN_DLD (csvconcat, args, nargout, - "-*- texinfo -*-\n" - "@deftypefn {Function File} {@var{str} = } csvconcat (@var{c})\n" - "@deftypefnx {Function File} {@var{str} = } csvconcat (@var{c}, @var{sep})\n" - "@deftypefnx {Function File} {@var{str} = } csvconcat (@var{c}, @var{sep}, @var{prot})\n" - "\n" - "Concatenate a cell into a CSV string or array of strings. " - "@var{sep} changes the character used to separate two fields. By " - "default, two fields are expected to be separated by a coma " - "(@code{,}). @var{prot} changes the character used to protect a string. " - "By default it's a double quote (@code{\"}).\n" - "@end deftypefn") { - - /* Check argument */ - if ((args.length() < 1) || (args.length() > 3)) { - print_usage (); - return octave_value(); - } - - /* Get arguments */ - Cell c = args(0).cell_value(); - - std::string sep = (args.length() > 1) ? args(1).string_value() : ","; - if (sep.length() != 1) { - error("Only on charactere need as separator\n"); - return octave_value(); - } - - std::string prot = (args.length() > 2) ? args(2).string_value() : "\""; - if (prot.length() != 1) { - error("Only on charactere need as protector\n"); - return octave_value(); - } - - /* Concat a cell into a string */ - string_vector vec(c.rows()); - std::string word; - - /* For each element */ - for (int i=0, il=c.rows(); i<il; i++) { - word = ""; - for (int j=0, jl=c.columns(); j<jl; j++) { - - /* Add separator */ - if (j != 0) - word += sep; - - if (c(i, j).is_real_scalar()) { - - /* Output real value */ - char tmp[20]; - sprintf(tmp, "%g", c(i, j).double_value()); - word += tmp; - } - - else if (c(i, j).is_string()) { - /* Output string value */ - std::string str = c(i, j).string_value(); - if (str.find(sep) != str.npos) { - unsigned int pos = 0; - while ((pos=str.find(prot, pos)) != str.npos) { - str.replace(pos, 1, prot+prot); - pos += 2; - } - str = prot + str + prot; - } - word += str; - } - - else { - /* Output NaN value */ - warning ("not a real or a string\n"); - word += "NaN"; - } - } - vec(i) = word; - } - - return octave_value(vec); -} Deleted: trunk/octave-forge/main/miscellaneous/src/csvexplode.cc =================================================================== --- trunk/octave-forge/main/miscellaneous/src/csvexplode.cc 2012-03-12 22:37:25 UTC (rev 9838) +++ trunk/octave-forge/main/miscellaneous/src/csvexplode.cc 2012-03-12 22:46:21 UTC (rev 9839) @@ -1,97 +0,0 @@ -// Copyright (C) 2004 Laurent Mazet <ma...@cr...> -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 3 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License along with -// this program; if not, see <http://www.gnu.org/licenses/>. - -#include <octave/oct.h> -#include <octave/Cell.h> - -DEFUN_DLD (csvexplode, args, nargout, - "-*- texinfo -*-\n" - "@deftypefn {Function File} {@var{c} = } csvexplode (@var{str})\n" - "@deftypefnx {Function File} {@var{c} = } csvexplode (@var{str}, @var{sep})\n" - "@deftypefnx {Function File} {@var{c} = } csvexplode (@var{str}, @var{sep}, @var{prot})\n" - "\n" - "Explode a CSV string into a cell. " - "@var{sep} changes the character used to separate two fields. By " - "default, two fields are expected to be separated by a coma " - "(@code{,}). @var{prot} changes the character used to protect a string. " - "By default it's a double quote (@code{\"}).\n" - "@end deftypefn") { - - /* Check argument */ - if ((args.length() < 1) || (args.length() > 3)) { - print_usage (); - return octave_value(); - } - - /* Get arguments */ - if (!args(0).is_string()) { - if (args(0).is_cell()) - return octave_value(args(0)); - else - return octave_value(Cell(args(0))); - } - std::string str = args(0).string_value(); - - std::string _sep = (args.length() > 1) ? args(1).string_value() : ","; - if (_sep.length() != 1) { - error("Only on charactere need as separator\n"); - return octave_value(); - } - char sep = _sep[0]; - - std::string _prot = (args.length() > 2) ? args(2).string_value() : "\""; - if (_prot.length() != 1) { - error("Only on charactere need as protector\n"); - return octave_value(); - } - char prot = _prot[0]; - - /* Explode a line into a cell */ - Cell retval; - std::string word; - bool inside = false; - for (int i=0, len=str.length(); i<=len; i++) { - if (((i==len) || (str[i] == sep)) && (!inside)) { - - /* Extand cell */ - retval.resize(dim_vector(1, retval.columns()+1)); - - /* Check if scalar */ - const char *word_str=word.c_str(); - char *err; - double val = strtod (word_str, &err); - - /* Store into the cell */ - retval(0, retval.columns()-1) = - ((word == "") || (err != word_str+word.length())) ? - octave_value(word) : octave_value(val); - - word = ""; - } - else if ((inside) && (str[i]==prot) && ((i<len) && (str[i+1]==prot))) { - - /* Insisde a string */ - word += prot; - ++i; - } - else if (str[i] == prot) - /* Changing */ - inside = !inside; - else - word += str[i]; - } - - return octave_value(retval); -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2012-03-12 22:37:31
|
Revision: 9838 http://octave.svn.sourceforge.net/octave/?rev=9838&view=rev Author: thomas-weber Date: 2012-03-12 22:37:25 +0000 (Mon, 12 Mar 2012) Log Message: ----------- Remove executable bit from @galois/fft.m Property Changed: ---------------- trunk/octave-forge/main/comm/inst/@galois/fft.m Property changes on: trunk/octave-forge/main/comm/inst/@galois/fft.m ___________________________________________________________________ Deleted: svn:executable - * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 22:23:26
|
Revision: 9837 http://octave.svn.sourceforge.net/octave/?rev=9837&view=rev Author: carandraug Date: 2012-03-12 22:23:20 +0000 (Mon, 12 Mar 2012) Log Message: ----------- csv2latex: bug fix by <Philip Nienhuis pr....@hc...> making function more silent and using correct parentheses for indexing Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/inst/csv2latex.m Modified: trunk/octave-forge/main/miscellaneous/inst/csv2latex.m =================================================================== --- trunk/octave-forge/main/miscellaneous/inst/csv2latex.m 2012-03-12 21:35:17 UTC (rev 9836) +++ trunk/octave-forge/main/miscellaneous/inst/csv2latex.m 2012-03-12 22:23:20 UTC (rev 9837) @@ -47,7 +47,7 @@ ## csv2latex('example.csv', '\t', 'example.tex', {'|l|', 'l|'}, true, ## {'Column 1', 'Column 2', 'Column 3'}, {'Row 1', 'Row 2'}); -function csv2latex(csv_file, csv_sep, latex_file, tabular_alignments, has_hline, column_titles, row_titles) +function csv2latex (csv_file, csv_sep, latex_file, tabular_alignments, has_hline, column_titles, row_titles) ## set up the default values if nargin < 7 @@ -64,7 +64,7 @@ end ## load the csv file and create the csv cell - [fid, msg] = fopen (csv_file, 'r') # open the csv file to read + [fid, msg] = fopen (csv_file, 'r'); # open the csv file to read csv = cell(); if fid != -1 [val, count] = fread(fid); # read all data from the file @@ -77,7 +77,7 @@ csv(line_index, value_index) = csv_value; value_index++; csv_value = ''; - else if val(index) == '\n'; + elseif (val(index) == '\n' || (val(index) == '\r' && val(index+1) == '\r')) csv(line_index, value_index) = csv_value; value_index++; csv_value = ''; @@ -123,7 +123,7 @@ end ## print latex file - [fid, msg] = fopen (latex_file, 'w') # open the latex file for writing + [fid, msg] = fopen (latex_file, 'w'); # open the latex file for writing if fid != -1 fprintf (fid, '\\begin{tabular}{%s}\n', alignment_preamble); # print the begin of the tabular if column_title_size != 0 @@ -145,9 +145,9 @@ fprintf (fid, ' & '); # print an empty row title end end - fprintf (fid, ' %s ', csv(row_index, col_index)); + fprintf (fid, ' %s ', csv{row_index, col_index}); else - fprintf (fid, '& %s ', csv(row_index, col_index)); + fprintf (fid, '& %s ', csv{row_index, col_index}); end end fprintf (fid, '\\\\\n'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-03-12 21:35:23
|
Revision: 9836 http://octave.svn.sourceforge.net/octave/?rev=9836&view=rev Author: mmarzolla Date: 2012-03-12 21:35:17 +0000 (Mon, 12 Mar 2012) Log Message: ----------- added new test cases Modified Paths: -------------- trunk/octave-forge/main/queueing/inst/ctmc_check_Q.m trunk/octave-forge/main/queueing/inst/dtmc_check_P.m Modified: trunk/octave-forge/main/queueing/inst/ctmc_check_Q.m =================================================================== --- trunk/octave-forge/main/queueing/inst/ctmc_check_Q.m 2012-03-12 19:37:46 UTC (rev 9835) +++ trunk/octave-forge/main/queueing/inst/ctmc_check_Q.m 2012-03-12 21:35:17 UTC (rev 9836) @@ -46,7 +46,8 @@ return; endif - if ( norm( sum(Q,2), "inf" ) > epsilon ) + if (any(Q(~logical(eye(size(Q))))<0) || \ # there is any negavite non-diagonal element + norm( sum(Q,2), "inf" ) > epsilon ) err = "Q is not an infinitesimal generator matrix"; return; endif @@ -54,3 +55,37 @@ result = rows(Q); err = ""; endfunction +%!test +%! Q = [0]; +%! [result err] = ctmc_check_Q(Q); +%! assert( result, 1 ); +%! assert( err, "" ); + +%!test +%! N = 10; +%! Q = ctmc_bd(rand(1,N-1),rand(1,N-1)); +%! [result err] = ctmc_check_Q(Q); +%! assert( result, N ); +%! assert( err, "" ); + +%!test +%! Q = [1 2 3; 4 5 6]; +%! [result err] = ctmc_check_Q(Q); +%! assert( result, 0 ); +%! assert( index(err, "square") > 0 ); + +%!test +%! N = 10; +%! Q = ctmc_bd(rand(1,N-1),rand(1,N-1)); +%! Q(2,1) = -1; +%! [result err] = ctmc_check_Q(Q); +%! assert( result, 0 ); +%! assert( index(err, "infinitesimal") > 0 ); + +%!test +%! N = 10; +%! Q = ctmc_bd(rand(1,N-1),rand(1,N-1)); +%! Q(1,1) += 7; +%! [result err] = ctmc_check_Q(Q); +%! assert( result, 0 ); +%! assert( index(err, "infinitesimal") > 0 ); Modified: trunk/octave-forge/main/queueing/inst/dtmc_check_P.m =================================================================== --- trunk/octave-forge/main/queueing/inst/dtmc_check_P.m 2012-03-12 19:37:46 UTC (rev 9835) +++ trunk/octave-forge/main/queueing/inst/dtmc_check_P.m 2012-03-12 21:35:17 UTC (rev 9836) @@ -66,4 +66,8 @@ %!test %! P = [0 1; 1 0]; -%! assert( dtmc_check_P(P), 2 ); \ No newline at end of file +%! assert( dtmc_check_P(P), 2 ); + +%!test +%! P = dtmc_bd( linspace(0.1,0.4,10), linspace(0.4,0.1,10) ); +%! assert( dtmc_check_P(P), rows(P) ); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-03-12 19:37:52
|
Revision: 9835 http://octave.svn.sourceforge.net/octave/?rev=9835&view=rev Author: mmarzolla Date: 2012-03-12 19:37:46 +0000 (Mon, 12 Mar 2012) Log Message: ----------- Code simplified Modified Paths: -------------- trunk/octave-forge/main/queueing/inst/ctmc_taexps.m Modified: trunk/octave-forge/main/queueing/inst/ctmc_taexps.m =================================================================== --- trunk/octave-forge/main/queueing/inst/ctmc_taexps.m 2012-03-12 18:35:30 UTC (rev 9834) +++ trunk/octave-forge/main/queueing/inst/ctmc_taexps.m 2012-03-12 19:37:46 UTC (rev 9835) @@ -103,9 +103,8 @@ M = lsode( {ff, fj}, zeros(size(p)), t ); endif else - t = ctmc_mtta(Q,p); L = ctmc_exps(Q,p); - M = L ./ t; + M = L ./ sum(L); endif endfunction %!test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 18:35:40
|
Revision: 9834 http://octave.svn.sourceforge.net/octave/?rev=9834&view=rev Author: carandraug Date: 2012-03-12 18:35:30 +0000 (Mon, 12 Mar 2012) Log Message: ----------- miscellaneous: updating INDEX list of functions Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/INDEX Modified: trunk/octave-forge/main/miscellaneous/INDEX =================================================================== --- trunk/octave-forge/main/miscellaneous/INDEX 2012-03-12 18:31:51 UTC (rev 9833) +++ trunk/octave-forge/main/miscellaneous/INDEX 2012-03-12 18:35:30 UTC (rev 9834) @@ -3,22 +3,39 @@ apply asci cell2cell - sample + cell2csv + csv2cell + csvconcat + csvexplode + chebyshevpoly + clip + colorboard csv2latex - chebyshevpoly + gameoflife hermitepoly + hilbert_curve infoskeleton laguerrepoly legendrepoly + map match + normc + normr nze + partarray + peano_curve + publish + read_options reduce + rolldices + sample slurp_file + solvesudoku + temp_name + text_waitbar units + xmlread + xmlwrite zagzig + z_curve zigzag - csvconcat - csvexplode - server - publish - clip This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 18:32:01
|
Revision: 9833 http://octave.svn.sourceforge.net/octave/?rev=9833&view=rev Author: carandraug Date: 2012-03-12 18:31:51 +0000 (Mon, 12 Mar 2012) Log Message: ----------- temp_name: deprecating function in favour of tmpnam Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/NEWS trunk/octave-forge/main/miscellaneous/inst/temp_name.m Modified: trunk/octave-forge/main/miscellaneous/NEWS =================================================================== --- trunk/octave-forge/main/miscellaneous/NEWS 2012-03-12 18:16:27 UTC (rev 9832) +++ trunk/octave-forge/main/miscellaneous/NEWS 2012-03-12 18:31:51 UTC (rev 9833) @@ -25,6 +25,9 @@ ** The function `partarray' has been deprecated. `mat2cell' from octave core should be used instead. + ** The function `temp_name' has been deprecated. `tmpnam' from octave core + should be used instead. + ** Multiple bug fixes and increased input check on many functions. ** The function `csv2cell' now returns an empty cell in the case of empty file Modified: trunk/octave-forge/main/miscellaneous/inst/temp_name.m =================================================================== --- trunk/octave-forge/main/miscellaneous/inst/temp_name.m 2012-03-12 18:16:27 UTC (rev 9832) +++ trunk/octave-forge/main/miscellaneous/inst/temp_name.m 2012-03-12 18:31:51 UTC (rev 9833) @@ -33,6 +33,13 @@ function n = temp_name (rootname, quick) + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "temp_name has been deprecated, and will be removed in the future. Use `tmpnam' instead."); + endif + ### Keep track of previously asked names persistent cnt = struct ("dummy",0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 18:16:38
|
Revision: 9832 http://octave.svn.sourceforge.net/octave/?rev=9832&view=rev Author: carandraug Date: 2012-03-12 18:16:27 +0000 (Mon, 12 Mar 2012) Log Message: ----------- miscellaneous: remove deprecated function map from seealso Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/inst/match.m trunk/octave-forge/main/miscellaneous/inst/reduce.m Modified: trunk/octave-forge/main/miscellaneous/inst/match.m =================================================================== --- trunk/octave-forge/main/miscellaneous/inst/match.m 2012-03-12 18:01:06 UTC (rev 9831) +++ trunk/octave-forge/main/miscellaneous/inst/match.m 2012-03-12 18:16:27 UTC (rev 9832) @@ -35,7 +35,7 @@ ## match(@@(x) ( x >= 1 ), [-1 0 1 2]) ## @result{} 1 2 ## @end example -## @seealso{reduce, map, cellfun, arrayfun, cellfun, structfun, spfun} +## @seealso{reduce, cellfun, arrayfun, cellfun, structfun, spfun} ## @end deftypefn function rval = match (fun_handle, data) Modified: trunk/octave-forge/main/miscellaneous/inst/reduce.m =================================================================== --- trunk/octave-forge/main/miscellaneous/inst/reduce.m 2012-03-12 18:01:06 UTC (rev 9831) +++ trunk/octave-forge/main/miscellaneous/inst/reduce.m 2012-03-12 18:16:27 UTC (rev 9832) @@ -32,7 +32,6 @@ ## reduce(@@(x,y)(x*y),[1:7]) ## @result{} 5040 (actually, 7!) ## @end example -## @seealso{map} ## @end deftypefn ## Parts of documentation copied from the "Python Library Reference, v2.5" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 18:01:17
|
Revision: 9831 http://octave.svn.sourceforge.net/octave/?rev=9831&view=rev Author: carandraug Date: 2012-03-12 18:01:06 +0000 (Mon, 12 Mar 2012) Log Message: ----------- miscellaneous: fix NEWS file to appropriate status of partarray function Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/NEWS Modified: trunk/octave-forge/main/miscellaneous/NEWS =================================================================== --- trunk/octave-forge/main/miscellaneous/NEWS 2012-03-12 18:00:10 UTC (rev 9830) +++ trunk/octave-forge/main/miscellaneous/NEWS 2012-03-12 18:01:06 UTC (rev 9831) @@ -22,7 +22,7 @@ ** The functions `apply' and `map' have been deprecated. `cellfun' and `arrayfun' from octave core should be used instead. - ** The function `partarray' has been removed. `mat2cell' from octave core + ** The function `partarray' has been deprecated. `mat2cell' from octave core should be used instead. ** Multiple bug fixes and increased input check on many functions. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 18:00:16
|
Revision: 9830 http://octave.svn.sourceforge.net/octave/?rev=9830&view=rev Author: carandraug Date: 2012-03-12 18:00:10 +0000 (Mon, 12 Mar 2012) Log Message: ----------- partarray: put function back in Makefile Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/src/Makefile Modified: trunk/octave-forge/main/miscellaneous/src/Makefile =================================================================== --- trunk/octave-forge/main/miscellaneous/src/Makefile 2012-03-12 17:59:42 UTC (rev 9829) +++ trunk/octave-forge/main/miscellaneous/src/Makefile 2012-03-12 18:00:10 UTC (rev 9830) @@ -6,7 +6,7 @@ TARGETS=text_waitbar.oct $(LISTEN) xmlread.oct \ csvexplode.oct csv2cell.oct csvconcat.oct cell2csv.oct \ - cell2cell.oct sample.oct + cell2cell.oct sample.oct partarray.oct all: $(TARGETS) @@ -64,6 +64,9 @@ cell2cell.oct: cell2cell.cc $(MKOCTFILE) $(MISCDEFS) $< +partarray.oct: partarray.cc + $(MKOCTFILE) $(MISCDEFS) $< + sample.oct: sample.cc $(MKOCTFILE) $(MISCDEFS) $< This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 17:59:48
|
Revision: 9829 http://octave.svn.sourceforge.net/octave/?rev=9829&view=rev Author: carandraug Date: 2012-03-12 17:59:42 +0000 (Mon, 12 Mar 2012) Log Message: ----------- partarray: deprecating function warning message Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/src/partarray.cc Modified: trunk/octave-forge/main/miscellaneous/src/partarray.cc =================================================================== --- trunk/octave-forge/main/miscellaneous/src/partarray.cc 2012-03-12 16:26:07 UTC (rev 9828) +++ trunk/octave-forge/main/miscellaneous/src/partarray.cc 2012-03-12 17:59:42 UTC (rev 9829) @@ -159,6 +159,12 @@ Does not work with structure arrays at the moment.\n\ @end deftypefn") { + static bool warned = false; + if (!warned){ + warning_with_id ("Octave:deprecated-function", + "partarray has been deprecated, and will be removed in the future. Use `mat2cell' instead."); + warned = true; + } std::string fname ("partarray"); if (args.length () == 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-03-12 16:26:13
|
Revision: 9828 http://octave.svn.sourceforge.net/octave/?rev=9828&view=rev Author: mmarzolla Date: 2012-03-12 16:26:07 +0000 (Mon, 12 Mar 2012) Log Message: ----------- ctmc_taexps() now works also for absorbing chains Modified Paths: -------------- trunk/octave-forge/main/queueing/inst/ctmc_taexps.m Modified: trunk/octave-forge/main/queueing/inst/ctmc_taexps.m =================================================================== --- trunk/octave-forge/main/queueing/inst/ctmc_taexps.m 2012-03-12 16:21:17 UTC (rev 9827) +++ trunk/octave-forge/main/queueing/inst/ctmc_taexps.m 2012-03-12 16:26:07 UTC (rev 9828) @@ -18,14 +18,15 @@ ## -*- texinfo -*- ## ## @deftypefn {Function File} {@var{M} =} ctmc_taexps (@var{Q}, @var{t}, @var{p}) +## @deftypefnx {Function File} {@var{M} =} ctmc_taexps (@var{Q}, @var{p}) ## ## @cindex Markov chain, continuous time ## @cindex Time-alveraged sojourn time ## ## Compute the @emph{time-averaged sojourn time} @code{@var{M}(i)}, -## defined as the fraction of the time interval @math{[0,t]} spent in -## state @math{i}, assuming that the state occupancy probabilities at -## time 0 are @var{p}. +## defined as the fraction of the time interval @math{[0,t]} (or until +## absorption) spent in state @math{i}, assuming that the state +## occupancy probabilities at time 0 are @var{p}. ## ## @strong{INPUTS} ## @@ -38,7 +39,7 @@ ## matrix @var{Q} must also satisfy the condition @math{\sum_{j=1}^N Q_{ij} = 0} ## ## @item t -## Time +## Time. If omitted, the results are computed until absorption. ## ## @item p ## @code{@var{p}(i)} is the probability that, at time 0, the system was in @@ -51,9 +52,12 @@ ## @table @var ## ## @item M -## @code{@var{M}(i)} is the expected fraction of time spent in state -## @math{i} during the interval @math{[0,t]} assuming that the state -## occupancy probability at time zero is @var{p}. +## If this function is called with three parameters, @code{@var{M}(i)} +## is the expected fraction of the interval @math{0,t]} spent in state +## @math{i} assuming that the state occupancy probability at time zero +## is @var{p}. If this function is called with two parameters, +## @code{@var{M}(i)} is the expected fraction of time until absorption +## spent in state @math{i}. ## ## @end table ## @@ -62,11 +66,11 @@ ## Author: Moreno Marzolla <marzolla(at)cs.unibo.it> ## Web: http://www.moreno.marzolla.name/ -function M = ctmc_taexps( Q, t, p ) +function M = ctmc_taexps( Q, varargin ) persistent epsilon = 10*eps; - if ( nargin != 3 ) + if ( nargin < 2 || nargin > 3 ) print_usage(); endif @@ -75,22 +79,43 @@ (N>0) || \ usage(err); + if ( nargin == 2 ) + p = varargin{1}; + else + t = varargin{1}; + p = varargin{2}; + endif + ( isvector(p) && length(p) == N && all(p>=0) && abs(sum(p)-1.0)<epsilon ) || \ usage( "p must be a probability vector" ); - if ( isscalar(t) ) - (t >= 0) || \ - usage( "t must be >= 0" ); - F = @(x) (p*expm(Q*x)); - M = quadv(F,0,t) / t; - else - ## FIXME: deprecate this? - t = t(:)'; # make t a row vector - p = p(:)'; # make p a row vector - ff = @(x,t) (((x')*(Q-eye(N)/t).+p/t)'); - fj = @(x,t) (Q-eye(N)/t); - M = lsode( {ff, fj}, zeros(size(p)), t ); + if ( nargin == 3 ) + if ( isscalar(t) ) + (t >= 0) || \ + usage( "t must be >= 0" ); + F = @(x) (p*expm(Q*x)); + M = quadv(F,0,t) / t; + else + ## FIXME: deprecate this? + t = t(:)'; # make t a row vector + p = p(:)'; # make p a row vector + ff = @(x,t) (((x')*(Q-eye(N)/t).+p/t)'); + fj = @(x,t) (Q-eye(N)/t); + M = lsode( {ff, fj}, zeros(size(p)), t ); + endif + else + t = ctmc_mtta(Q,p); + L = ctmc_exps(Q,p); + M = L ./ t; endif endfunction +%!test +%! Q = [ 0 0.1 0 0; \ +%! 0.9 0 0.1 0; \ +%! 0 0.9 0 0.1; \ +%! 0 0 0 0 ]; +%! Q -= diag( sum(Q,2) ); +%! M = ctmc_taexps(Q, [1 0 0 0]); +%! assert( sum(M), 1, 10*eps ); %!demo %! lambda = 0.5; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 16:21:28
|
Revision: 9827 http://octave.svn.sourceforge.net/octave/?rev=9827&view=rev Author: carandraug Date: 2012-03-12 16:21:17 +0000 (Mon, 12 Mar 2012) Log Message: ----------- text-waitbar: texinfo fix on help text Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/src/text_waitbar.cc Modified: trunk/octave-forge/main/miscellaneous/src/text_waitbar.cc =================================================================== --- trunk/octave-forge/main/miscellaneous/src/text_waitbar.cc 2012-03-12 16:04:09 UTC (rev 9826) +++ trunk/octave-forge/main/miscellaneous/src/text_waitbar.cc 2012-03-12 16:21:17 UTC (rev 9827) @@ -50,7 +50,7 @@ displayed in the waitbar (and truncated if it is too long). Otherwise,\n\ @var{msg} is not displayed and the width is initialized to a default of 50\n\ characters, or it can be set to @var{n} characters with\n\ -@code{text_waitbar (0, @var{n}). If no terminal is detected (such as when\n\ +@code{text_waitbar (0, @var{n})}. If no terminal is detected (such as when\n\ Octave is run in batch mode and output is redirected), no output is\n\ generated.\n\ \n\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 16:04:20
|
Revision: 9826 http://octave.svn.sourceforge.net/octave/?rev=9826&view=rev Author: carandraug Date: 2012-03-12 16:04:09 +0000 (Mon, 12 Mar 2012) Log Message: ----------- partarray: recover function from revision 8274 before being removed. We want to deprecate it first Revision Links: -------------- http://octave.svn.sourceforge.net/octave/?rev=8274&view=rev Added Paths: ----------- trunk/octave-forge/main/miscellaneous/src/partarray.cc Added: trunk/octave-forge/main/miscellaneous/src/partarray.cc =================================================================== --- trunk/octave-forge/main/miscellaneous/src/partarray.cc (rev 0) +++ trunk/octave-forge/main/miscellaneous/src/partarray.cc 2012-03-12 16:04:09 UTC (rev 9826) @@ -0,0 +1,229 @@ +/* + +Copyright (C) 2010, 2011 Olaf Till + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include <octave/oct.h> +#include <octave/ov-struct.h> + +template<class NDA> +static Cell +do_partarray (const NDA& a, const std::string& fname, + const octave_value_list& args) +{ + // FIXME: some type-independent code should probably go into an + // extra function (no template) to avoid its repetitive instanciation + + int nidc = args.length () - 1; + + dim_vector dv = a.dims (); + + int ndims = dv.length (); + + int maxdims = ndims > nidc ? ndims : nidc; + + Array<octave_idx_type> alldims (dim_vector (maxdims, 1)); + for (int i = 0; i < maxdims; alldims(i) = i < ndims ? dv(i) : 1, i++); + + int nc = 1; + Array<int> nidx (dim_vector (maxdims, 1)); + // Octave-3.2.4 reports "missing symbol" with Array<Array< > >, + // though 3.3.54+ does not + Array<octave_idx_type> bidc [maxdims], eidc [maxdims]; + // + Array<octave_idx_type> step (dim_vector (maxdims, 1)); + step(0) = 1; + for (int i = 0; i < maxdims; i++) + { + int cnidx; + octave_value arg; + if (i >= nidc || (arg = args(i + 1)).is_empty ()) + { + Array<octave_idx_type> bidx (dim_vector (1, 1), 1); + Array<octave_idx_type> eidx (dim_vector (1, 1), alldims(i)); + bidc[i] = bidx; + eidc[i] = eidx; + cnidx = 1; + } + else + { + dim_vector argdims = arg.dims (); + if (argdims.length () > 2 || argdims(1) != 2) + { + error ("%s: argument %i: wrong dimensions", + fname.c_str (), i + 2); + return Cell (); + } + cnidx = + (bidc[i] = octave_value (arg.matrix_value ().column (0)). + octave_idx_type_vector_value ()).length (); + eidc[i] = octave_value (arg.matrix_value ().column (1)). + octave_idx_type_vector_value (); + for (int j = 0; j < cnidx; j++) + { + if (bidc[i](j) < 1 || eidc[i](j) > alldims(i)) + error ("%s: index given by row %i of argument %i exceeds array dimensions", + fname.c_str (), j, i + 2); + if (bidc[i](j) > eidc[i](j)) + // so later length calculations yield 0 + eidc[i](j) = bidc[i](j) - 1; + } + } + nc *= (nidx(i) = cnidx); + if (i < maxdims - 1) + step(i + 1) = step(i) * alldims(i); + } + if (error_state) + return Cell (); + + dim_vector rdv (nc, 1); + + Cell retval (rdv); + + // preparations are done, start now; take care, indices are + // one-based, since given by user + + // go through all combinations of indices into user indices + Array<int> cidx (dim_vector (maxdims, 1), 0); // current combination + for (int i = 0; i < nc; i++) + { + // set cursor to start of subarray and calculate some lengths + octave_idx_type n = 1, cursor = 0; + Array<octave_idx_type> lengths (dim_vector (maxdims, 1)); + for (int j = 0; j < maxdims; j++) + { + octave_idx_type begin = bidc[j](cidx(j)); + octave_idx_type end = eidc[j](cidx(j)); + octave_idx_type length = end + 1 - begin; + lengths(j) = length; + n *= length; + cursor += (begin - 1) * step(j); + } + Array<octave_idx_type> starts (dim_vector (maxdims - 1, 1), cursor); + Array<octave_idx_type> idx_cursors (dim_vector (maxdims, 1), 0); + // copy the subarray + dim_vector subdv; + subdv.resize (maxdims); + for (octave_idx_type k = 0; k < maxdims; k++) + subdv(k) = lengths(k); + NDA asub (subdv); + for (octave_idx_type k = 0; k < n; k++) + { + asub(k) = a(cursor++); + idx_cursors(0)++; + for (int l = 0; l < maxdims - 1; l++) + { + if (idx_cursors(l) == lengths(l)) + { + idx_cursors(l) = 0; + idx_cursors(l + 1)++; + cursor = starts(l) + step(l + 1); + for (int m = 0; m <= l; starts(m) = cursor, m++); + } + } + } + // insert subarray into cell + retval(i, 0) = octave_value (asub); + // prepare next combination + cidx(0)++; + for (int j = 0; j < maxdims - 1; j++) + if (cidx(j) >= nidx(j)) + { + cidx(j) = 0; + cidx(j + 1)++; + } + } + + return retval; +} + +DEFUN_DLD (partarray, args, , + "-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {} partarray (@var{a}, @var{idx}, ...)\n\ +Return a column cell array with subarrays of the @var{a}. Start and end indices of subarrays are given in the rows of @var{idx}. @var{idx} can be given for each dimension, empty @var{idx} means no partitioning in the respective dimension. Order of returned subarrays: rows of @var{idx} of some dimension are completely used before using the next row of @var{idx} of the higher dimension.\n\ +\n\ +Does not work with structure arrays at the moment.\n\ +@end deftypefn") +{ + std::string fname ("partarray"); + + if (args.length () == 0) + { + print_usage (); + return octave_value_list (); + } + + octave_value array = args(0); + octave_value retval; + + // The idea to use a function template was taken from Octaves + // num2cell in src/DLD-FUNCTIONS/cellfun.cc. The following code, + // which distinguishes the applicable types for the template, was + // cut and pasted from there and adapted. + if (array.is_bool_type ()) + retval = do_partarray (array.bool_array_value (), fname, args); + else if (array.is_char_matrix ()) + retval = do_partarray (array.char_array_value (), fname, args); + else if (array.is_numeric_type ()) + { + if (array.is_integer_type ()) + { + if (array.is_int8_type ()) + retval = do_partarray (array.int8_array_value (), fname, args); + else if (array.is_int16_type ()) + retval = do_partarray (array.int16_array_value (), fname, args); + else if (array.is_int32_type ()) + retval = do_partarray (array.int32_array_value (), fname, args); + else if (array.is_int64_type ()) + retval = do_partarray (array.int64_array_value (), fname, args); + else if (array.is_uint8_type ()) + retval = do_partarray (array.uint8_array_value (), fname, args); + else if (array.is_uint16_type ()) + retval = do_partarray (array.uint16_array_value (), fname, args); + else if (array.is_uint32_type ()) + retval = do_partarray (array.uint32_array_value (), fname, args); + else if (array.is_uint64_type ()) + retval = do_partarray (array.uint64_array_value (), fname, args); + } + else if (array.is_complex_type ()) + { + if (array.is_single_type ()) + retval = do_partarray (array.float_complex_array_value (), + fname, args); + else + retval = do_partarray (array.complex_array_value (), fname, args); + } + else + { + if (array.is_single_type ()) + retval = do_partarray (array.float_array_value (), fname, args); + else + retval = do_partarray (array.array_value (), fname, args); + } + } + // FIXME: This seems to work in cellfun.cc, but not here ... + /* + else if (array.is_map ()) + retval = do_partarray (array.map_value (), fname, args); + */ + else if (array.is_cell ()) + retval = do_partarray (array.cell_value (), fname, args); + else + gripe_wrong_type_arg (fname, array); + + return octave_value (retval); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 15:48:04
|
Revision: 9825 http://octave.svn.sourceforge.net/octave/?rev=9825&view=rev Author: carandraug Date: 2012-03-12 15:47:53 +0000 (Mon, 12 Mar 2012) Log Message: ----------- publish: clean todo list Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/inst/publish.m Modified: trunk/octave-forge/main/miscellaneous/inst/publish.m =================================================================== --- trunk/octave-forge/main/miscellaneous/inst/publish.m 2012-03-12 15:34:37 UTC (rev 9824) +++ trunk/octave-forge/main/miscellaneous/inst/publish.m 2012-03-12 15:47:53 UTC (rev 9825) @@ -326,11 +326,10 @@ endif endfunction -% TO DO -% 1) MOVE PRINT TO FUNCTION (DONE) -% 2) REMOVE PATH RELATED THINGS SINCE IT IS NOT AS TRIVIAL TO DO (DONE) -% 3) ADD VARARGIN FOR ADDITIONAL FILES SOURCES TO BE INLCUDED AS -% APPENDICES (THIS SOLVES THE PROBLEM OF FUNCTIONS SINCE YOU CAN -% PUT THE FUNCTION CALL IN SCRIPT CALL PUBLISH(SCRIPT) AND ADD -% THE FUNCTIONS CODE AS APPENDIX) -% 4) KNOWN PROBLEM: THE COMMENTING LINES IN HTML +# TODO +# * ADD VARARGIN FOR ADDITIONAL FILES SOURCES TO BE INLCUDED AS +# APPENDICES (THIS SOLVES THE PROBLEM OF FUNCTIONS SINCE YOU CAN +# PUT THE FUNCTION CALL IN SCRIPT CALL PUBLISH(SCRIPT) AND ADD +# THE FUNCTIONS CODE AS APPENDIX) +# +# * KNOWN PROBLEM: THE COMMENTING LINES IN HTML This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-12 15:34:48
|
Revision: 9824 http://octave.svn.sourceforge.net/octave/?rev=9824&view=rev Author: carandraug Date: 2012-03-12 15:34:37 +0000 (Mon, 12 Mar 2012) Log Message: ----------- publish: fix another bug due to incorrectly named variables Modified Paths: -------------- trunk/octave-forge/main/miscellaneous/inst/publish.m Modified: trunk/octave-forge/main/miscellaneous/inst/publish.m =================================================================== --- trunk/octave-forge/main/miscellaneous/inst/publish.m 2012-03-12 15:20:13 UTC (rev 9823) +++ trunk/octave-forge/main/miscellaneous/inst/publish.m 2012-03-12 15:34:37 UTC (rev 9824) @@ -299,7 +299,7 @@ eval (ifile(1:end-2)) diary off fid = fopen ("publish_tmp_script.txt", 'r'); - scriptResult = fread (fid, '*char')'; + script_result = fread (fid, '*char')'; fclose(fid); delete ("publish_tmp_script.txt"); endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-03-12 15:20:19
|
Revision: 9823 http://octave.svn.sourceforge.net/octave/?rev=9823&view=rev Author: mmarzolla Date: 2012-03-12 15:20:13 +0000 (Mon, 12 Mar 2012) Log Message: ----------- fixed snakes and ladders demo Modified Paths: -------------- trunk/octave-forge/main/queueing/inst/dtmc_mtta.m Modified: trunk/octave-forge/main/queueing/inst/dtmc_mtta.m =================================================================== --- trunk/octave-forge/main/queueing/inst/dtmc_mtta.m 2012-03-12 15:16:22 UTC (rev 9822) +++ trunk/octave-forge/main/queueing/inst/dtmc_mtta.m 2012-03-12 15:20:13 UTC (rev 9823) @@ -142,17 +142,15 @@ %! P = zeros(101,101); %! ## setup transitions through the spinner %! for j=0:(100-n) -%! for i=1:n -%! P(1+j,1+j+i) = 1/n; -%! endfor +%! i=1:n +%! P(1+j,1+j+i) = 1/n; %! endfor %! for j=(101-n):100 %! P(1+j,1+j) = (n-100+j)/n; %! endfor %! for j=(101-n):100 -%! for i=1:(100-j) -%! P(1+j,1+j+i) = 1/n; -%! endfor +%! i=1:(100-j) +%! P(1+j,1+j+i) = 1/n; %! endfor %! Pstar = P; %! ## setup snakes and ladders @@ -175,28 +173,28 @@ %! 93 73; \ %! 95 75; \ %! 98 78 ]; -%! for ii=SL; -%! i = ii(1); -%! j = ii(2); +%! for ii=1:rows(SL); +%! i = SL(ii,1); +%! j = SL(ii,2); %! Pstar(1+i,:) = 0; %! for k=0:100 -%! if ( k != j ) +%! if ( k != i ) %! Pstar(1+k,1+j) = P(1+k,1+j) + P(1+k,1+i); %! endif %! endfor %! Pstar(:,1+i) = 0; %! endfor %! Pstar += diag( 1-sum(Pstar,2) ); -%! -%! nsteps = 50; # number of steps +%! ## spy(Pstar); +%! nsteps = 250; # number of steps %! Pfinish = zeros(1,nsteps); # Pfinish(i) = probability of finishing after step i %! start = zeros(1,101); start(1) = 1; %! for i=1:nsteps %! pn = dtmc(Pstar,i,start); %! Pfinish(i) = pn(101); # state 101 is the ending (absorbing) state %! endfor -%! f = dtmc_mtta(Pstar); -%! ## f(1) is the mean time to absorption starting from state 1 -%! printf("Average number of steps to complete the game: %f\n", f(1) ); -%! plot(Pfinish, ";Probability of finishing the game;"); -%! xlabel("Step number"); +%! f = dtmc_mtta(Pstar, start); +%! printf("Average number of steps to complete the game: %f\n", f ); +%! plot(Pfinish); +%! xlabel("Step number (n)"); +%! title("Probability of finishing the game before step n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |