gthumb r2402 - in trunk: . libgthumb src
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2402 - in trunk: . libgthumb src
- Date: Wed, 20 Aug 2008 19:43:59 +0000 (UTC)
Author: mjc
Date: Wed Aug 20 19:43:59 2008
New Revision: 2402
URL: http://svn.gnome.org/viewvc/gthumb?rev=2402&view=rev
Log:
2008-08-20 Michael J. Chudobiak <mjc svn gnome org>
* libgthumb/bookmarks.c: (bookmarks_write_to_disk):
* libgthumb/catalog.c: (catalog_write_to_disk):
* libgthumb/file-utils.c: (dir_remove), (file_unlink),
(get_file_mime_type), (image_is_jpeg), (image_is_gif):
* libgthumb/gfile-utils.c: (gfile_warning),
(gfile_get_filename_extension), (gfile_get_file_mime_type),
(_gfile_image_is_type), (_gfile_image_is_type__gconf_file_type),
(gfile_image_is_jpeg), (gfile_image_is_gif), (gfile_is_filetype),
(gfile_get_file_size), (_gfile_make_directory_tree),
(gfile_ensure_dir_exists), (_gfile_ith_temp_folder_to_try),
(gfile_get_temp_dir_name), (_gfile_delete_directory_recursive),
(gfile_dir_remove_recursive), (gfile_output_stream_write),
(gfile_output_stream_write_line):
* libgthumb/gfile-utils.h:
* src/albumtheme.c: (yyparse):
* src/albumtheme.l:
* src/albumtheme.y:
* src/catalog-web-exporter.c: (_write_line), (_write_locale_line),
(write_line), (write_markup_escape_line),
(write_markup_escape_locale_line), (gth_parsed_doc_print),
(gfile_parsed_doc_print), (save_html_image_cb),
(save_html_index_cb), (export__copy_image), (get_parsed_file),
(parse_theme_files):
* src/lex.albumtheme.c:
Greater use of g_output_stream_write. Use gfile-based mime-type
detection. Patch by Christophe BisiÃre. Bug #525482.
Modified:
trunk/ChangeLog
trunk/libgthumb/bookmarks.c
trunk/libgthumb/catalog.c
trunk/libgthumb/file-utils.c
trunk/libgthumb/gfile-utils.c
trunk/libgthumb/gfile-utils.h
trunk/src/albumtheme.c
trunk/src/albumtheme.l
trunk/src/albumtheme.y
trunk/src/catalog-web-exporter.c
trunk/src/lex.albumtheme.c
Modified: trunk/libgthumb/bookmarks.c
==============================================================================
--- trunk/libgthumb/bookmarks.c (original)
+++ trunk/libgthumb/bookmarks.c Wed Aug 20 19:43:59 2008
@@ -393,7 +393,7 @@
scan = bookmarks->list;
while (((bookmarks->max_lines < 0) || (lines < bookmarks->max_lines))
&& (scan != NULL)) {
- gfile_output_stream_write_line (ostream, error, "\"%s\"", scan->data);
+ gfile_output_stream_write_line (ostream, &error, "\"%s\"", scan->data);
if (error) {
gfile_warning ("Cannot write line to bookmark file",
Modified: trunk/libgthumb/catalog.c
==============================================================================
--- trunk/libgthumb/catalog.c (original)
+++ trunk/libgthumb/catalog.c Wed Aug 20 19:43:59 2008
@@ -373,39 +373,39 @@
/* write search data. */
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
SEARCH_HEADER);
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"\"%s\"",
search_data->start_from);
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"\"%s\"",
(search_data->recursive ? "TRUE" : "FALSE"));
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"\"%s\"",
search_data->file_pattern);
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"\"%s\"",
search_data->comment_pattern);
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"\"%s\"",
search_data->place_pattern);
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"%d\"%s\"",
catalog->search_data->all_keywords,
search_data->keywords_pattern);
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"%ld",
search_data->date);
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"%d",
search_data->date_scope);
}
@@ -413,7 +413,7 @@
/* sort method */
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"%s%s",
SORT_FIELD,
sort_names[catalog->sort_method]);
@@ -422,7 +422,7 @@
for (scan = catalog->list; scan; scan = scan->next)
if (!error) gfile_output_stream_write_line (ostream,
- error,
+ &error,
"\"%s\"",
(char*) scan->data);
Modified: trunk/libgthumb/file-utils.c
==============================================================================
--- trunk/libgthumb/file-utils.c (original)
+++ trunk/libgthumb/file-utils.c Wed Aug 20 19:43:59 2008
@@ -407,7 +407,16 @@
gboolean
dir_remove (const gchar *path)
{
- return (gnome_vfs_remove_directory (path) == GNOME_VFS_OK);
+ GFile *file;
+ gboolean result;
+
+ file = gfile_new (path);
+
+ result = g_file_delete (file, NULL, NULL);
+
+ g_object_unref (file);
+
+ return result;
}
@@ -781,7 +790,18 @@
gboolean
file_unlink (const char *path)
{
- return (gnome_vfs_unlink (path) == GNOME_VFS_OK);
+ GFile *file;
+ gboolean result;
+
+ g_assert (path != NULL);
+
+ file = gfile_new (path);
+
+ result = g_file_delete (file, NULL, NULL);
+
+ g_object_unref (file);
+
+ return result;
}
@@ -807,99 +827,27 @@
}
-static char*
-get_sample_name (const char *filename)
-{
- const char *ext;
-
- ext = get_extension (filename);
- if (ext == NULL)
- return NULL;
-
- return g_strconcat ("a", get_extension (filename), NULL);
-}
-
-
const char*
-get_file_mime_type (const char *filename,
+get_file_mime_type (const char *path,
gboolean fast_file_type)
{
- const char *result = NULL;
- const char *extension;
-
- if (filename == NULL)
+ GFile *file;
+ const char *result;
+
+ if (path == NULL)
return NULL;
- if (fast_file_type) {
- char *sample_name;
- char *n1;
-
- sample_name = get_sample_name (filename);
- if (sample_name != NULL) {
- n1 = g_filename_to_utf8 (sample_name, -1, 0, 0, 0);
- if (n1 != NULL) {
- char *n2 = g_utf8_strdown (n1, -1);
- char *n3 = g_filename_from_utf8 (n2, -1, 0, 0, 0);
- if (n3 != NULL)
- result = gnome_vfs_mime_type_from_name_or_default (file_name_from_path (n3), NULL);
- g_free (n3);
- g_free (n2);
- g_free (n1);
- }
+ file = gfile_new (path);
- g_free (sample_name);
- }
- }
- else {
- if (uri_scheme_is_file (filename))
- filename = get_file_path_from_uri (filename);
- result = gnome_vfs_get_file_mime_type (filename, NULL, FALSE);
- }
-
- result = get_static_string (result);
-
- /* Check files with special or problematic extensions */
- extension = get_filename_extension (filename);
- if (extension != NULL) {
-
- /* Raw NEF files are sometimes mis-recognized as tiff files. Fix that. */
- if (!strcmp_null_tolerant (result, "image/tiff") &&
- !strcasecmp (extension, "nef"))
- return "image/x-nikon-nef";
-
- /* Raw CR2 files are sometimes mis-recognized as tiff files. Fix that. */
- if (!strcmp_null_tolerant (result, "image/tiff") &&
- !strcasecmp (extension, "cr2"))
- return "image/x-canon-cr2";
-
- /* Check unrecognized binary types for special types that are not
- handled correctly in the normal mime databases. */
-
- if ((result == NULL) ||
- (strcmp_null_tolerant (result, "application/octet-stream") == 0)) {
-
- /* If the file extension is not recognized, or the content is
- determined to be binary data (octet-stream), check for HDR file
- types, which are not well represented in the freedesktop mime
- database currently. This section can be purged when they are.
- This is an unpleasant hack. Some file extensions
- may be missing here; please file a bug if they are. */
- if ( !strcasecmp (extension, "exr") /* OpenEXR format */
- || !strcasecmp (extension, "hdr") /* Radiance rgbe */
- || !strcasecmp (extension, "pic")) /* Radiance rgbe */
- return "image/x-hdr";
-
- /* Bug 329072: gnome-vfs doesn't recognize pcx files.
- This is the work-around until bug 329072 is fixed. */
- if (strcasecmp (extension, "pcx") == 0)
- return "image/x-pcx";
- }
- }
+ result = gfile_get_file_mime_type (file, fast_file_type);
+
+ g_object_unref (file);
return result;
}
+
gboolean
mime_type_is (const char *mime_type,
const char *value)
@@ -909,27 +857,18 @@
gboolean
-image_is_type (const char *uri,
- const char *type,
- gboolean fast_file_type)
+image_is_jpeg (const char *path)
{
- const char *result = get_file_mime_type (uri, fast_file_type);
- return (strcmp_null_tolerant (result, type) == 0);
-}
-
-
-static gboolean
-image_is_type__gconf_file_type (const char *uri,
- const char *type)
-{
- return image_is_type (uri, type, ! is_local_file (uri) || eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE));
-}
-
+ GFile *file;
+ gboolean result;
+
+ file = gfile_new (path);
+
+ result = gfile_image_is_jpeg (file);
+
+ g_object_unref (file);
-gboolean
-image_is_jpeg (const char *name)
-{
- return image_is_type__gconf_file_type (name, "image/jpeg");
+ return result;
}
@@ -964,9 +903,18 @@
gboolean
-image_is_gif (const char *name)
+image_is_gif (const char *path)
{
- return image_is_type__gconf_file_type (name, "image/gif");
+ GFile *file;
+ gboolean result;
+
+ file = gfile_new (path);
+
+ result = gfile_image_is_gif (file);
+
+ g_object_unref (file);
+
+ return result;
}
Modified: trunk/libgthumb/gfile-utils.c
==============================================================================
--- trunk/libgthumb/gfile-utils.c (original)
+++ trunk/libgthumb/gfile-utils.c Wed Aug 20 19:43:59 2008
@@ -21,10 +21,14 @@
*/
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
+#include "preferences.h"
+#include "glib-utils.h"
+#include "gconf-utils.h"
#include "gfile-utils.h"
@@ -94,11 +98,11 @@
uri = gfile_get_uri (file);
if (err == NULL)
- warning = g_strdup_printf ("%s: file %s\n", msg, uri);
+ warning = g_strdup_printf ("%s: file %s", msg, uri);
else
- warning = g_strdup_printf ("%s: file %s: %s\n", msg, uri, err->message);
+ warning = g_strdup_printf ("%s: file %s: %s", msg, uri, err->message);
- g_warning (warning);
+ g_warning ("%s\n", warning);
g_free (uri);
g_free (warning);
@@ -199,6 +203,132 @@
}
+/* Be careful: result must be g_free'd */
+char *
+gfile_get_filename_extension (GFile *file)
+{
+ char *basename;
+ char *last_dot;
+ char *extension;
+
+ basename = g_file_get_basename (file);
+
+ g_assert (basename != NULL);
+
+ last_dot = strrchr (basename, '.');
+ if (last_dot == NULL)
+ return NULL;
+
+ extension = g_strdup (last_dot + 1);
+
+ g_free (basename);
+
+ return extension;
+}
+
+
+const char*
+gfile_get_file_mime_type (GFile *file,
+ gboolean fast_file_type)
+{
+ const char *value;
+ const char *result = NULL;
+ GFileInfo *info;
+ GError *error = NULL;
+
+ g_assert (file != NULL);
+
+ info = g_file_query_info (file,
+ fast_file_type ?
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE :
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &error);
+ if (info != NULL) {
+ if (fast_file_type)
+ value = g_file_info_get_attribute_string (info,
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ else
+ value = g_file_info_get_content_type (info);
+
+ /*
+ * If the file content is determined to be binary data (octet-stream), check for
+ * HDR file types, which are not well represented in the freedesktop mime database
+ * currently. This section can be purged when they are. This is an unpleasant hack.
+ * Some file extensions may be missing here; please file a bug if they are.
+ */
+ if (strcmp (value, "application/octet-stream") == 0) {
+
+ char* extension;
+
+ extension = gfile_get_filename_extension (file);
+
+ if (extension != NULL) {
+ if ( !strcasecmp (extension, "exr") /* OpenEXR format */
+ || !strcasecmp (extension, "hdr") /* Radiance rgbe */
+ || !strcasecmp (extension, "pic")) /* Radiance rgbe */
+ value = "image/x-hdr";
+
+ g_free (extension);
+ }
+ }
+
+
+ result = get_static_string (value);
+ }
+ else {
+ gfile_warning ("Could not get content type", file, error);
+ g_clear_error (&error);
+ }
+
+ g_object_unref (info);
+
+ return result;
+}
+
+
+static gboolean
+_gfile_image_is_type (GFile *file,
+ const char *mime_type,
+ gboolean fast_file_type)
+{
+ const char *result;
+
+ result = gfile_get_file_mime_type (file, fast_file_type);
+
+ if (result == NULL)
+ return FALSE;
+
+ return (strcmp (result, mime_type) == 0);
+}
+
+
+static gboolean
+_gfile_image_is_type__gconf_file_type (GFile *file,
+ const char *mime_type)
+{
+ return _gfile_image_is_type (file,
+ mime_type,
+ ! gfile_is_local (file)
+ || eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE));
+}
+
+
+gboolean
+gfile_image_is_jpeg (GFile *file)
+{
+ return _gfile_image_is_type__gconf_file_type (file, "image/jpeg");
+}
+
+
+gboolean
+gfile_image_is_gif (GFile *file)
+{
+ return _gfile_image_is_type__gconf_file_type (file, "image/gif");
+}
+
+
static gboolean
gfile_is_filetype (GFile *file,
GFileType file_type)
@@ -212,7 +342,7 @@
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
- 0,
+ G_FILE_QUERY_INFO_NONE,
NULL,
&error);
if (error == NULL) {
@@ -250,11 +380,15 @@
goffset size = 0;
GError *err = NULL;
- //FIXME: shouldn't we get rid of this test and fix the callers instead
+ //FIXME: shouldn't we get rid of this test and fix the callers instead?
if (file == NULL)
return 0;
- info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL, &err);
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &err);
if (err == NULL) {
size = g_file_info_get_size (info);
}
@@ -272,7 +406,7 @@
/* Directory utils */
static gboolean
-make_directory_tree (GFile *dir,
+_gfile_make_directory_tree (GFile *dir,
mode_t mode,
GError **error)
{
@@ -281,7 +415,7 @@
parent = g_file_get_parent (dir);
if (parent != NULL) {
- success = make_directory_tree (parent, mode, error);
+ success = _gfile_make_directory_tree (parent, mode, error);
g_object_unref (parent);
if (! success)
return FALSE;
@@ -312,14 +446,14 @@
{
GError *priv_error = NULL;
- //FIXME: shouldn't we get rid of this test and fix the callers instead
+ //FIXME: shouldn't we get rid of this test and fix the callers instead?
if (dir == NULL)
return FALSE;
if (error == NULL)
error = &priv_error;
- if (! make_directory_tree (dir, mode, error)) {
+ if (! _gfile_make_directory_tree (dir, mode, error)) {
gfile_warning ("could not create directory", dir, *error);
if (priv_error != NULL)
@@ -384,7 +518,7 @@
#define MAX_TEMP_FOLDER_TO_TRY 2
static GFile *
-ith_temp_folder_to_try (int n)
+_gfile_ith_temp_folder_to_try (int n)
{
GFile *dir = NULL;
@@ -436,7 +570,7 @@
GFile *folder;
guint64 size;
- folder = ith_temp_folder_to_try (i);
+ folder = _gfile_ith_temp_folder_to_try (i);
size = gfile_get_destination_free_space (folder);
if (max_size < size) {
max_size = size;
@@ -464,8 +598,8 @@
static gboolean
-delete_directory_recursive (GFile *dir,
- GError **error)
+_gfile_delete_directory_recursive (GFile *dir,
+ GError **error)
{
GFileEnumerator *file_enum;
GFileInfo *info;
@@ -486,7 +620,7 @@
switch (g_file_info_get_file_type (info)) {
case G_FILE_TYPE_DIRECTORY:
- if (! delete_directory_recursive (child, error))
+ if (! _gfile_delete_directory_recursive (child, error))
error_occurred = TRUE;
break;
default:
@@ -514,7 +648,7 @@
gboolean result;
GError *error = NULL;
- result = delete_directory_recursive (dir, &error);
+ result = _gfile_delete_directory_recursive (dir, &error);
if (! result) {
gfile_warning ("Cannot delete directory", dir, error);
g_clear_error (&error);
@@ -526,14 +660,13 @@
/* Xfer */
-
-/* empty functions */
static void _empty_file_progress_cb (goffset current_num_bytes,
goffset total_num_bytes,
gpointer user_data)
{
}
+
gboolean
gfile_xfer (GFile *sfile,
GFile *dfile,
@@ -584,34 +717,59 @@
}
-void
-gfile_output_stream_write_line (GFileOutputStream *ostream,
- GError *error,
- const char *format,
+gssize
+gfile_output_stream_write (GFileOutputStream *ostream,
+ GError **error,
+ const char *str)
+{
+ GError *priv_error = NULL;
+ gssize result;
+
+
+ g_assert (str != NULL);
+
+ if (error == NULL)
+ error = &priv_error;
+
+ result = g_output_stream_write (G_OUTPUT_STREAM(ostream),
+ str,
+ strlen (str),
+ NULL,
+ error);
+
+ if (*error != NULL)
+ debug (DEBUG_INFO, "could not write string \"%s\": %s\n", str, (*error)->message);
+
+ if (priv_error != NULL)
+ g_clear_error (&priv_error);
+
+ return result;
+}
+
+
+gssize
+gfile_output_stream_write_line (GFileOutputStream *ostream,
+ GError **error,
+ const char *format,
...)
{
va_list args;
char *str;
+ gssize n1 = -1;
+ gssize n2 = -1;
g_assert (format != NULL);
-
+
va_start (args, format);
str = g_strdup_vprintf (format, args);
va_end (args);
- g_output_stream_write (G_OUTPUT_STREAM(ostream),
- str,
- strlen (str),
- NULL,
- &error);
+ n1 = gfile_output_stream_write (ostream, error, str);
+
+ if (n1 != -1)
+ n2 = gfile_output_stream_write (ostream, error, "\n");
+
g_free (str);
-
- if (error != NULL)
- return;
-
- g_output_stream_write (G_OUTPUT_STREAM(ostream),
- "\n",
- 1,
- NULL,
- &error);
+
+ return (n1 == -1 || n2 == -1 ? -1 : n1 + n2);
}
Modified: trunk/libgthumb/gfile-utils.h
==============================================================================
--- trunk/libgthumb/gfile-utils.h (original)
+++ trunk/libgthumb/gfile-utils.h Wed Aug 20 19:43:59 2008
@@ -66,6 +66,10 @@
...);
gboolean gfile_is_local (GFile *file);
+const char* gfile_get_file_mime_type (GFile *file,
+ gboolean fast_file_type);
+gboolean gfile_image_is_jpeg (GFile *file);
+gboolean gfile_image_is_gif (GFile *file);
gboolean gfile_path_is_file (GFile *file);
gboolean gfile_path_is_dir (GFile *file);
goffset gfile_get_file_size (GFile *file);
@@ -92,9 +96,12 @@
GFile *dfile);
/* line-based read/write */
-void gfile_output_stream_write_line (GFileOutputStream *ostream,
- GError *error,
+gssize gfile_output_stream_write_line (GFileOutputStream *ostream,
+ GError **error,
const char *format,
...);
+gssize gfile_output_stream_write (GFileOutputStream *ostream,
+ GError **error,
+ const char *str);
#endif /* GFILE_UTILS_H */
Modified: trunk/src/albumtheme.c
==============================================================================
--- trunk/src/albumtheme.c (original)
+++ trunk/src/albumtheme.c Wed Aug 20 19:43:59 2008
@@ -194,6 +194,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <gio/gio.h>
#include "albumtheme-private.h"
void yyerror (char *fmt, ...);
@@ -224,7 +225,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 35 "albumtheme.y"
+#line 36 "albumtheme.y"
{
char *text;
int ivalue;
@@ -236,7 +237,7 @@
GthCondition *cond;
}
/* Line 187 of yacc.c. */
-#line 239 "albumtheme.c"
+#line 240 "albumtheme.c"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -249,7 +250,7 @@
/* Line 216 of yacc.c. */
-#line 252 "albumtheme.c"
+#line 253 "albumtheme.c"
#ifdef short
# undef short
@@ -559,14 +560,14 @@
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] = {
- 0, 110, 110, 120, 125, 129, 142, 150, 154, 161,
- 164, 169, 174, 179, 182, 187, 199, 204, 207, 210,
- 214, 227, 240, 253, 266, 279, 292, 296, 301, 306,
- 313, 319, 322, 328, 342, 348, 354, 360, 368, 372,
- 377, 382, 383, 384, 385, 386, 387, 388, 389, 390,
- 391, 392, 393, 394, 395, 396, 397, 398, 399, 400,
- 401, 402, 403, 404, 405, 406, 407, 408, 409, 410,
- 411, 412, 413, 414, 417, 421, 426, 431, 436, 441
+ 0, 111, 111, 121, 126, 130, 143, 151, 155, 162,
+ 165, 170, 175, 180, 183, 188, 200, 205, 208, 211,
+ 215, 228, 241, 254, 267, 280, 293, 297, 302, 307,
+ 314, 320, 323, 329, 343, 349, 355, 361, 369, 373,
+ 378, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ 392, 393, 394, 395, 396, 397, 398, 399, 400, 401,
+ 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ 412, 413, 414, 415, 418, 422, 427, 432, 437, 442
};
#endif
@@ -1581,7 +1582,7 @@
switch (yyn)
{
case 2:
-#line 110 "albumtheme.y"
+#line 111 "albumtheme.y"
{
yy_parsed_doc = (yyvsp[(1) - (1)].list);
@@ -1594,7 +1595,7 @@
break;
case 3:
-#line 120 "albumtheme.y"
+#line 121 "albumtheme.y"
{
(yyval.list) =
g_list_prepend ((yyvsp[(2) - (2)].list),
@@ -1605,7 +1606,7 @@
break;
case 4:
-#line 125 "albumtheme.y"
+#line 126 "albumtheme.y"
{
(yyval.list) =
g_list_prepend ((yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].tag));
@@ -1614,7 +1615,7 @@
break;
case 5:
-#line 129 "albumtheme.y"
+#line 130 "albumtheme.y"
{
GList *cond_list;
GthTag *tag;
@@ -1633,7 +1634,7 @@
break;
case 6:
-#line 142 "albumtheme.y"
+#line 143 "albumtheme.y"
{
GthTag *tag = gth_tag_new_html ((yyvsp[(2) - (4)].text));
GList *child_doc = g_list_append (NULL, tag);
@@ -1646,7 +1647,7 @@
break;
case 7:
-#line 150 "albumtheme.y"
+#line 151 "albumtheme.y"
{
(yyval.list) = NULL;
;
@@ -1654,7 +1655,7 @@
break;
case 8:
-#line 154 "albumtheme.y"
+#line 155 "albumtheme.y"
{
if ((yyvsp[(2) - (2)].list) != NULL)
gth_parsed_doc_free ((yyvsp[(2) - (2)].list));
@@ -1664,7 +1665,7 @@
break;
case 9:
-#line 161 "albumtheme.y"
+#line 162 "albumtheme.y"
{
(yyval.cond) = gth_condition_new ((yyvsp[(2) - (3)].expr));
;
@@ -1672,7 +1673,7 @@
break;
case 10:
-#line 164 "albumtheme.y"
+#line 165 "albumtheme.y"
{
(yyval.cond) = gth_condition_new ((yyvsp[(3) - (5)].expr));
;
@@ -1680,7 +1681,7 @@
break;
case 11:
-#line 169 "albumtheme.y"
+#line 170 "albumtheme.y"
{
gth_condition_add_document ((yyvsp[(1) - (3)].cond),
(yyvsp[(2) - (3)].list));
@@ -1691,7 +1692,7 @@
break;
case 12:
-#line 174 "albumtheme.y"
+#line 175 "albumtheme.y"
{
(yyval.list) = NULL;
;
@@ -1699,7 +1700,7 @@
break;
case 13:
-#line 179 "albumtheme.y"
+#line 180 "albumtheme.y"
{
(yyval.cond) = gth_condition_new ((yyvsp[(2) - (3)].expr));
;
@@ -1707,7 +1708,7 @@
break;
case 14:
-#line 182 "albumtheme.y"
+#line 183 "albumtheme.y"
{
(yyval.cond) = gth_condition_new ((yyvsp[(3) - (5)].expr));
;
@@ -1715,7 +1716,7 @@
break;
case 15:
-#line 187 "albumtheme.y"
+#line 188 "albumtheme.y"
{
GthExpr *else_expr;
GthCondition *cond;
@@ -1731,7 +1732,7 @@
break;
case 16:
-#line 199 "albumtheme.y"
+#line 200 "albumtheme.y"
{
(yyval.cond) = NULL;
;
@@ -1739,7 +1740,7 @@
break;
case 19:
-#line 210 "albumtheme.y"
+#line 211 "albumtheme.y"
{
(yyval.expr) = (yyvsp[(2) - (3)].expr);
;
@@ -1747,7 +1748,7 @@
break;
case 20:
-#line 214 "albumtheme.y"
+#line 215 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
@@ -1764,7 +1765,7 @@
break;
case 21:
-#line 227 "albumtheme.y"
+#line 228 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
@@ -1781,7 +1782,7 @@
break;
case 22:
-#line 240 "albumtheme.y"
+#line 241 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
@@ -1798,7 +1799,7 @@
break;
case 23:
-#line 253 "albumtheme.y"
+#line 254 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
@@ -1815,7 +1816,7 @@
break;
case 24:
-#line 266 "albumtheme.y"
+#line 267 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
@@ -1832,7 +1833,7 @@
break;
case 25:
-#line 279 "albumtheme.y"
+#line 280 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
@@ -1849,7 +1850,7 @@
break;
case 26:
-#line 292 "albumtheme.y"
+#line 293 "albumtheme.y"
{
(yyval.expr) = (yyvsp[(2) - (2)].expr);
;
@@ -1857,7 +1858,7 @@
break;
case 27:
-#line 296 "albumtheme.y"
+#line 297 "albumtheme.y"
{
gth_expr_push_op ((yyvsp[(2) - (2)].expr), GTH_OP_NEG);
(yyval.expr) = (yyvsp[(2) - (2)].expr);
@@ -1866,7 +1867,7 @@
break;
case 28:
-#line 301 "albumtheme.y"
+#line 302 "albumtheme.y"
{
gth_expr_push_op ((yyvsp[(2) - (2)].expr), GTH_OP_NOT);
(yyval.expr) = (yyvsp[(2) - (2)].expr);
@@ -1875,7 +1876,7 @@
break;
case 29:
-#line 306 "albumtheme.y"
+#line 307 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
gth_expr_push_var (e, (yyvsp[(1) - (1)].text));
@@ -1886,7 +1887,7 @@
break;
case 30:
-#line 313 "albumtheme.y"
+#line 314 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
gth_expr_push_constant (e, (yyvsp[(1) - (1)].ivalue));
@@ -1896,7 +1897,7 @@
break;
case 31:
-#line 319 "albumtheme.y"
+#line 320 "albumtheme.y"
{
(yyval.expr) = (yyvsp[(1) - (1)].expr);
;
@@ -1904,7 +1905,7 @@
break;
case 32:
-#line 322 "albumtheme.y"
+#line 323 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
gth_expr_push_var (e, (yyvsp[(1) - (1)].text));
@@ -1915,7 +1916,7 @@
break;
case 33:
-#line 328 "albumtheme.y"
+#line 329 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
g_string_append ((yyvsp[(1) - (3)].string),
@@ -1935,7 +1936,7 @@
break;
case 34:
-#line 342 "albumtheme.y"
+#line 343 "albumtheme.y"
{
GString *s = g_string_new ((yyvsp[(1) - (1)].text));
g_free ((yyvsp[(1) - (1)].text));
@@ -1945,7 +1946,7 @@
break;
case 35:
-#line 348 "albumtheme.y"
+#line 349 "albumtheme.y"
{
GString *s = g_string_new ((yyvsp[(1) - (1)].text));
g_string_prepend_c (s, ' ');
@@ -1956,7 +1957,7 @@
break;
case 36:
-#line 354 "albumtheme.y"
+#line 355 "albumtheme.y"
{
GString *s = g_string_new ("");
g_string_sprintf (s, " %i", (yyvsp[(1) - (1)].ivalue));
@@ -1966,7 +1967,7 @@
break;
case 37:
-#line 360 "albumtheme.y"
+#line 361 "albumtheme.y"
{
if ((yyvsp[(2) - (2)].string) != NULL)
{
@@ -1980,7 +1981,7 @@
break;
case 38:
-#line 368 "albumtheme.y"
+#line 369 "albumtheme.y"
{
(yyval.string) = NULL;
;
@@ -1988,7 +1989,7 @@
break;
case 39:
-#line 372 "albumtheme.y"
+#line 373 "albumtheme.y"
{
(yyval.tag) =
gth_tag_new ((yyvsp[(1) - (3)].ivalue), (yyvsp[(2) - (3)].list));
@@ -1997,7 +1998,7 @@
break;
case 40:
-#line 377 "albumtheme.y"
+#line 378 "albumtheme.y"
{
(yyval.tag) =
gth_tag_new ((yyvsp[(1) - (3)].ivalue), (yyvsp[(2) - (3)].list));
@@ -2006,238 +2007,238 @@
break;
case 41:
-#line 382 "albumtheme.y"
+#line 383 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 42:
-#line 383 "albumtheme.y"
+#line 384 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 43:
-#line 384 "albumtheme.y"
+#line 385 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 44:
-#line 385 "albumtheme.y"
+#line 386 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 45:
-#line 386 "albumtheme.y"
+#line 387 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 46:
-#line 387 "albumtheme.y"
+#line 388 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 47:
-#line 388 "albumtheme.y"
+#line 389 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 48:
-#line 389 "albumtheme.y"
+#line 390 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 49:
-#line 390 "albumtheme.y"
+#line 391 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 50:
-#line 391 "albumtheme.y"
+#line 392 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 51:
-#line 392 "albumtheme.y"
+#line 393 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 52:
-#line 393 "albumtheme.y"
+#line 394 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 53:
-#line 394 "albumtheme.y"
+#line 395 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 54:
-#line 395 "albumtheme.y"
+#line 396 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 55:
-#line 396 "albumtheme.y"
+#line 397 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 56:
-#line 397 "albumtheme.y"
+#line 398 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 57:
-#line 398 "albumtheme.y"
+#line 399 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 58:
-#line 399 "albumtheme.y"
+#line 400 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 59:
-#line 400 "albumtheme.y"
+#line 401 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 60:
-#line 401 "albumtheme.y"
+#line 402 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 61:
-#line 402 "albumtheme.y"
+#line 403 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 62:
-#line 403 "albumtheme.y"
+#line 404 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 63:
-#line 404 "albumtheme.y"
+#line 405 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 64:
-#line 405 "albumtheme.y"
+#line 406 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 65:
-#line 406 "albumtheme.y"
+#line 407 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 66:
-#line 407 "albumtheme.y"
+#line 408 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 67:
-#line 408 "albumtheme.y"
+#line 409 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 68:
-#line 409 "albumtheme.y"
+#line 410 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 69:
-#line 410 "albumtheme.y"
+#line 411 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 70:
-#line 411 "albumtheme.y"
+#line 412 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 71:
-#line 412 "albumtheme.y"
+#line 413 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 72:
-#line 413 "albumtheme.y"
+#line 414 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 73:
-#line 414 "albumtheme.y"
+#line 415 "albumtheme.y"
{
(yyval.ivalue) = (yyvsp[(1) - (1)].ivalue);;
}
break;
case 74:
-#line 417 "albumtheme.y"
+#line 418 "albumtheme.y"
{
(yyval.list) =
g_list_prepend ((yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].var));
@@ -2246,7 +2247,7 @@
break;
case 75:
-#line 421 "albumtheme.y"
+#line 422 "albumtheme.y"
{
(yyval.list) = NULL;
;
@@ -2254,7 +2255,7 @@
break;
case 76:
-#line 426 "albumtheme.y"
+#line 427 "albumtheme.y"
{
(yyval.var) =
gth_var_new_expression ((yyvsp[(1) - (3)].text),
@@ -2265,7 +2266,7 @@
break;
case 77:
-#line 431 "albumtheme.y"
+#line 432 "albumtheme.y"
{
(yyval.var) =
gth_var_new_expression ((yyvsp[(1) - (5)].text),
@@ -2276,7 +2277,7 @@
break;
case 78:
-#line 436 "albumtheme.y"
+#line 437 "albumtheme.y"
{
(yyval.var) =
gth_var_new_expression ((yyvsp[(1) - (5)].text),
@@ -2287,7 +2288,7 @@
break;
case 79:
-#line 441 "albumtheme.y"
+#line 442 "albumtheme.y"
{
GthExpr *e = gth_expr_new ();
gth_expr_push_constant (e, 1);
@@ -2299,7 +2300,7 @@
/* Line 1267 of yacc.c. */
-#line 2190 "albumtheme.c"
+#line 2191 "albumtheme.c"
default:
break;
}
@@ -2510,7 +2511,7 @@
}
-#line 451 "albumtheme.y"
+#line 452 "albumtheme.y"
int
Modified: trunk/src/albumtheme.l
==============================================================================
--- trunk/src/albumtheme.l (original)
+++ trunk/src/albumtheme.l Wed Aug 20 19:43:59 2008
@@ -20,10 +20,20 @@
*/
#include <glib.h>
+#include <gio/gio.h>
+
+GFileInputStream *yy_istream;
+
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+{ \
+ gssize n = g_input_stream_read (G_INPUT_STREAM(yy_istream), buf, max_size, NULL, NULL); \
+ result = (n <= 0 ? YY_NULL : n); \
+}
%}
-%option nounput
+%option noinput nounput
number [0-9]+
name [a-zA-Z_][0-9a-zA-Z_:@]*
Modified: trunk/src/albumtheme.y
==============================================================================
--- trunk/src/albumtheme.y (original)
+++ trunk/src/albumtheme.y Wed Aug 20 19:43:59 2008
@@ -22,6 +22,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <gio/gio.h>
#include "albumtheme-private.h"
void yyerror (char *fmt, ...);
Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c (original)
+++ trunk/src/catalog-web-exporter.c Wed Aug 20 19:43:59 2008
@@ -79,10 +79,10 @@
};
extern int yyparse (void);
+extern GFileInputStream *yy_istream;
static GObjectClass *parent_class = NULL;
static guint catalog_web_exporter_signals[LAST_SIGNAL] = { 0 };
-extern FILE *yyin;
#define DEFAULT_THUMB_SIZE 100
#define DEFAULT_INDEX_FILE "index.html"
@@ -1069,36 +1069,49 @@
}
+/* write a line when no error is pending */
+
static void
-_write_line (const char *line, FILE *fout)
+_write_line (GFileOutputStream *ostream,
+ GError **error,
+ const char *line)
{
- fwrite (line, sizeof (char), strlen (line), fout);
+ if (error != NULL && *error != NULL)
+ return;
+
+ gfile_output_stream_write (ostream, error, line);
}
static void
-_write_locale_line (const char *line, FILE *fout)
+_write_locale_line (GFileOutputStream *ostream,
+ GError **error,
+ const char *line)
{
char *utf8_line;
utf8_line = g_locale_to_utf8 (line, -1, 0, 0, 0);
- _write_line (utf8_line, fout);
+ _write_line (ostream, error, utf8_line);
g_free (utf8_line);
}
static void
-write_line (const char *line, FILE *fout)
+write_line (GFileOutputStream *ostream,
+ GError **error,
+ const char *line)
{
if (line_is_void (line))
return;
- _write_line (line, fout);
+ _write_line (ostream, error, line);
}
static void
-write_markup_escape_line (const char *line, FILE *fout)
+write_markup_escape_line (GFileOutputStream *ostream,
+ GError **error,
+ const char *line)
{
char *e_line;
@@ -1106,13 +1119,15 @@
return;
e_line = _g_escape_text_for_html (line, -1);
- _write_line (e_line, fout);
+ _write_line (ostream, error, e_line);
g_free (e_line);
}
static void
-write_markup_escape_locale_line (const char *line, FILE *fout)
+write_markup_escape_locale_line (GFileOutputStream *ostream,
+ GError **error,
+ const char *line)
{
char *e_line;
@@ -1122,7 +1137,7 @@
return;
e_line = _g_escape_text_for_html (line, -1);
- _write_locale_line (e_line, fout);
+ _write_locale_line (ostream, error, e_line);
g_free (e_line);
}
@@ -1465,11 +1480,12 @@
static void
-gth_parsed_doc_print (GList *document,
- GFile *relative_to,
- CatalogWebExporter *ce,
- FILE *fout,
- gboolean allow_table)
+gth_parsed_doc_print (GList *document,
+ GFile *relative_to,
+ CatalogWebExporter *ce,
+ GFileOutputStream *ostream,
+ GError **error,
+ gboolean allow_table)
{
GList *scan;
@@ -1499,20 +1515,23 @@
GList *scan;
+ if (error != NULL && *error != NULL)
+ return;
+
switch (tag->type) {
case GTH_TAG_HEADER:
line = get_hf_text (ce->header);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_FOOTER:
line = get_hf_text (ce->footer);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_LANGUAGE:
line = get_current_language ();
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_THEME_LINK:
@@ -1525,7 +1544,7 @@
src);
line = gfile_get_relative_uri (file, relative_to);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
g_object_unref (file);
break;
@@ -1602,7 +1621,7 @@
image_height,
id_attr,
class_attr);
- write_line (line, fout);
+ write_line (ostream, error, line);
g_free (src_attr);
g_free (id_attr);
@@ -1619,14 +1638,14 @@
idata,
ce->target_dir);
line = gfile_get_relative_uri (file, relative_to);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
g_object_unref (file);
break;
case GTH_TAG_IMAGE_IDX:
line = g_strdup_printf ("%d", get_image_idx (tag, ce) + 1);
- write_line (line, fout);
+ write_line (ostream, error, line);
break;
case GTH_TAG_IMAGE_DIM:
@@ -1635,12 +1654,12 @@
line = g_strdup_printf ("%dx%d",
idata->image_width,
idata->image_height);
- write_line (line, fout);
+ write_line (ostream, error, line);
break;
case GTH_TAG_IMAGES:
line = g_strdup_printf ("%d", ce->n_images);
- write_line (line, fout);
+ write_line (ostream, error, line);
break;
case GTH_TAG_FILENAME:
@@ -1685,9 +1704,9 @@
}
if (gth_tag_get_var (ce, tag, "utf8") != 0)
- write_markup_escape_locale_line (line, fout);
+ write_markup_escape_locale_line (ostream, error, line);
else
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
g_object_unref (file);
break;
@@ -1728,9 +1747,9 @@
line = gfile_get_path (dir);
if (gth_tag_get_var (ce, tag, "utf8") != 0)
- write_markup_escape_locale_line (line, fout);
+ write_markup_escape_locale_line (ostream, error, line);
else
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
g_object_unref (dir);
g_object_unref (file);
@@ -1740,7 +1759,7 @@
idx = get_image_idx (tag, ce);
idata = g_list_nth (ce->file_list, idx)->data;
line = g_format_size_for_display (idata->src_file->size);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_COMMENT:
@@ -1765,7 +1784,7 @@
g_free (comment);
}
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_PLACE:
@@ -1789,7 +1808,7 @@
g_free (place);
}
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_DATE_TIME:
@@ -1812,7 +1831,7 @@
g_free (date_time);
}
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_PAGE_LINK:
@@ -1828,29 +1847,29 @@
idx,
ce->target_dir);
line = gfile_get_relative_uri (file, relative_to);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
g_object_unref (file);
break;
case GTH_TAG_PAGE_IDX:
line = g_strdup_printf ("%d", get_page_idx (tag, ce) + 1);
- write_line (line, fout);
+ write_line (ostream, error, line);
break;
case GTH_TAG_PAGE_ROWS:
line = g_strdup_printf ("%d", ce->page_rows);
- write_line (line, fout);
+ write_line (ostream, error, line);
break;
case GTH_TAG_PAGE_COLS:
line = g_strdup_printf ("%d", ce->page_cols);
- write_line (line, fout);
+ write_line (ostream, error, line);
break;
case GTH_TAG_PAGES:
line = g_strdup_printf ("%d", ce->n_pages);
- write_line (line, fout);
+ write_line (ostream, error, line);
break;
case GTH_TAG_TABLE:
@@ -1863,27 +1882,28 @@
/* this may not work correctly if single_index is set */
for (r = 0; r < ce->page_rows; r++) {
if (ce->image < ce->n_images)
- write_line (" <tr class=\"tr_index\">\n", fout);
+ write_line (ostream, error, " <tr class=\"tr_index\">\n");
else
- write_line (" <tr class=\"tr_empty_index\">\n", fout);
+ write_line (ostream, error, " <tr class=\"tr_empty_index\">\n");
for (c = 0; c < ce->page_cols; c++) {
if (ce->image < ce->n_images) {
- write_line (" <td class=\"td_index\">\n", fout);
+ write_line (ostream, error, " <td class=\"td_index\">\n");
gth_parsed_doc_print (ce->thumbnail_parsed,
relative_to,
ce,
- fout,
+ ostream,
+ error,
FALSE);
- write_line (" </td>\n", fout);
+ write_line (ostream, error, " </td>\n");
ce->image++;
}
else {
- write_line (" <td class=\"td_empty_index\">\n", fout);
- write_line (" \n", fout);
- write_line (" </td>\n", fout);
+ write_line (ostream, error, " <td class=\"td_empty_index\">\n");
+ write_line (ostream, error, " \n");
+ write_line (ostream, error, " </td>\n");
}
}
- write_line (" </tr>\n", fout);
+ write_line (ostream, error, " </tr>\n");
}
break;
@@ -1897,8 +1917,9 @@
break;
gth_parsed_doc_print (ce->thumbnail_parsed,
relative_to,
- ce,
- fout,
+ ce,
+ ostream,
+ error,
FALSE);
ce->image++;
}
@@ -1906,11 +1927,11 @@
case GTH_TAG_DATE:
line = get_current_date ();
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_HTML:
- write_line (tag->value.html, fout);
+ write_line (ostream, error, tag->value.html);
break;
case GTH_TAG_EXIF_EXPOSURE_TIME:
@@ -1918,7 +1939,7 @@
idata = g_list_nth (ce->file_list, idx)->data;
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[EXPTIME_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_EXIF_EXPOSURE_MODE:
@@ -1926,7 +1947,7 @@
idata = g_list_nth (ce->file_list, idx)->data;
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[EXPMODE_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_EXIF_FLASH:
@@ -1934,7 +1955,7 @@
idata = g_list_nth (ce->file_list, idx)->data;
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[FLASH_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_EXIF_SHUTTER_SPEED:
@@ -1942,7 +1963,7 @@
idata = g_list_nth (ce->file_list, idx)->data;
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[SHUTTERSPEED_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_EXIF_APERTURE_VALUE:
@@ -1950,7 +1971,7 @@
idata = g_list_nth (ce->file_list, idx)->data;
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[APERTURE_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_EXIF_FOCAL_LENGTH:
@@ -1958,7 +1979,7 @@
idata = g_list_nth (ce->file_list, idx)->data;
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[FOCAL_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_EXIF_DATE_TIME:
@@ -1974,10 +1995,10 @@
tp = localtime (&t);
strftime (s, 99, DATE_FORMAT, tp);
line = g_locale_to_utf8 (s, -1, 0, 0, 0);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
}
else
- write_line ("-", fout);
+ write_line (ostream, error, "-");
}
break;
@@ -1987,14 +2008,14 @@
idata = g_list_nth (ce->file_list, idx)->data;
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[MAKE_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
g_free (line);
- write_line (" ", fout);
+ write_line (ostream, error, " ");
line = get_metadata_tagset_string (idata->src_file,
TAG_NAME_SETS[MODEL_TAG_NAMES]);
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
break;
case GTH_TAG_SET_VAR:
@@ -2007,8 +2028,8 @@
value = gth_tag_get_var (ce, tag, "expr");
- line = g_strdup_printf ("%d",value);
- write_line (line, fout);
+ line = g_strdup_printf ("%d", value);
+ write_line (ostream, error, line);
break;
case GTH_TAG_IF:
@@ -2022,7 +2043,8 @@
gth_parsed_doc_print (cond->document,
relative_to,
ce,
- fout,
+ ostream,
+ error,
FALSE);
break;
}
@@ -2036,7 +2058,7 @@
if (child->type != GTH_TAG_HTML)
break;
line = g_strdup (_(child->value.html));
- write_markup_escape_line (line, fout);
+ write_markup_escape_line (ostream, error, line);
}
break;
@@ -2049,6 +2071,45 @@
}
+
+static gboolean
+gfile_parsed_doc_print (CatalogWebExporter *ce,
+ GList *document,
+ GFile *file,
+ GFile *relative_to)
+{
+ GFileOutputStream *ostream;
+ GError *error = NULL;
+ gboolean result;
+
+ gfile_debug (DEBUG_INFO, "save html file", file);
+
+ ostream = g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error);
+
+ if (error) {
+ gfile_warning ("Cannot open html file for writing",
+ file,
+ error);
+ }
+ else {
+ gth_parsed_doc_print (document,
+ relative_to,
+ ce,
+ ostream,
+ &error,
+ TRUE);
+ }
+
+ g_output_stream_close (G_OUTPUT_STREAM(ostream), NULL, &error);
+ g_object_unref (ostream);
+
+ result = (error == NULL);
+ g_clear_error (&error);
+
+ return result;
+}
+
+
static void
exporter_set_info (CatalogWebExporter *ce,
const char *info)
@@ -2324,14 +2385,14 @@
}
+
static gboolean
save_html_image_cb (gpointer data)
{
CatalogWebExporter *ce = data;
ImageData *idata;
GFile *file;
- char *local_file;
- FILE *fout;
+ GFile *relative_to;
if (ce->saving_timeout != 0) {
g_source_remove (ce->saving_timeout);
@@ -2353,28 +2414,16 @@
file = get_html_image_file (ce,
idata,
ce->target_tmp_dir);
- local_file = gfile_get_path (file);
-
- debug (DEBUG_INFO, "save html file: %s", local_file);
+
+
+ relative_to = get_html_image_dir (ce,
+ ce->target_dir);
+
- fout = fopen (local_file, "w");
- if (fout != NULL) {
- GFile *relative_to;
-
- relative_to = get_html_image_dir (ce,
- ce->target_dir);
-
- gth_parsed_doc_print (ce->image_parsed,
- relative_to,
- ce,
- fout,
- TRUE);
- g_object_unref (relative_to);
- fclose (fout);
- }
+ gfile_parsed_doc_print (ce, ce->image_parsed, file, relative_to);
g_object_unref (file);
- g_free (local_file);
+ g_object_unref (relative_to);
/**/
@@ -2407,8 +2456,6 @@
CatalogWebExporter *ce = data;
GFile *file;
GFile *relative_to;
- char *local_file;
- FILE *fout;
if (ce->saving_timeout != 0) {
g_source_remove (ce->saving_timeout);
@@ -2435,21 +2482,8 @@
ce->page,
ce->target_tmp_dir);
- local_file = gfile_get_path (file);
-
- debug (DEBUG_INFO, "save html index: %s", local_file);
+ gfile_parsed_doc_print (ce, ce->index_parsed, file, relative_to);
- fout = fopen (local_file, "w");
- if (fout != NULL) {
- gth_parsed_doc_print (ce->index_parsed,
- relative_to,
- ce,
- fout,
- TRUE);
- fclose (fout);
- }
-
- g_free (local_file);
g_object_unref (file);
g_object_unref (relative_to);
@@ -2664,10 +2698,10 @@
copy_done = gfile_copy (sfile, dfile);
if (copy_done) {
- char *uri;
- uri = gfile_get_uri (dfile);
+ if (gfile_image_is_jpeg (dfile)) {
+ char *uri;
+ uri = gfile_get_uri (dfile);
- if (image_is_jpeg (uri)) {
GthTransform transform;
FileData *fd;
@@ -2682,8 +2716,8 @@
}
file_data_unref (fd);
+ g_free (uri);
}
- g_free (uri);
}
g_object_unref (sfile);
@@ -2846,12 +2880,41 @@
}
+static GList *
+get_parsed_file (GFile *file)
+{
+ GList *result = NULL;
+ GError *error = NULL;
+
+ yy_parsed_doc = NULL;
+
+ gfile_debug (DEBUG_INFO, "load template", file);
+
+ yy_istream = g_file_read (file, NULL, &error);
+
+ if (error != NULL) {
+ gfile_warning ("Could not open template", file, error);
+ g_object_unref (&error);
+ }
+ else {
+ if (yyparse () == 0)
+ result = yy_parsed_doc;
+ else
+ debug (DEBUG_INFO, "<<syntax error>>");
+
+ g_input_stream_close (G_INPUT_STREAM(yy_istream), NULL, &error);
+ g_object_unref (yy_istream);
+ }
+
+ return result;
+}
+
+
static void
parse_theme_files (CatalogWebExporter *ce)
{
- GFile *template;
- char *local_file;
- GList *scan;
+ GFile *template;
+ GList *scan;
free_parsed_docs (ce);
@@ -2859,50 +2922,29 @@
/* read and parse index.gthtml */
- yy_parsed_doc = NULL;
template = gfile_append_path (ce->style_dir,
"index.gthtml",
NULL);
- gfile_debug (DEBUG_INFO, "load", template);
- local_file = gfile_get_path (template);
- yyin = fopen (local_file, "r");
-
- if ((yyin != NULL) && (yyparse () == 0))
- ce->index_parsed = yy_parsed_doc;
- else
- debug (DEBUG_INFO, "<<syntax error>>");
+ ce->index_parsed = get_parsed_file (template);
- if (yyin != NULL)
- fclose (yyin);
+ g_object_unref (template);
if (ce->index_parsed == NULL) {
GthTag *tag = gth_tag_new (GTH_TAG_TABLE, NULL);
ce->index_parsed = g_list_prepend (NULL, tag);
}
- g_object_unref (template);
- g_free (local_file);
-
/* read and parse thumbnail.gthtml */
- yy_parsed_doc = NULL;
template = gfile_append_path (ce->style_dir,
"thumbnail.gthtml",
NULL);
- gfile_debug (DEBUG_INFO, "load", template);
-
- local_file = gfile_get_path (template);
- yyin = fopen (local_file, "r");
- if ((yyin != NULL) && (yyparse () == 0))
- ce->thumbnail_parsed = yy_parsed_doc;
- else
- debug (DEBUG_INFO, "<<syntax error>>");
-
- if (yyin != NULL)
- fclose (yyin);
+ ce->thumbnail_parsed = get_parsed_file (template);
+ g_object_unref (template);
+
if (ce->thumbnail_parsed == NULL) {
GthExpr *expr;
GthVar *var;
@@ -2923,28 +2965,16 @@
ce->thumbnail_parsed = g_list_prepend (NULL, tag);
}
- g_object_unref (template);
- g_free (local_file);
-
/* Read and parse image.gthtml */
- yy_parsed_doc = NULL;
template = gfile_append_path (ce->style_dir,
"image.gthtml",
NULL);
- gfile_debug (DEBUG_INFO, "load", template);
-
- local_file = gfile_get_path (template);
- yyin = fopen (local_file, "r");
- if ((yyin != NULL) && (yyparse () == 0))
- ce->image_parsed = yy_parsed_doc;
- else
- debug (DEBUG_INFO, "<<syntax error>>");
-
- if (yyin != NULL)
- fclose (yyin);
+ ce->image_parsed = get_parsed_file (template);
+ g_object_unref (template);
+
if (ce->image_parsed == NULL) {
GthExpr *expr;
GthVar *var;
@@ -2965,9 +2995,6 @@
ce->image_parsed = g_list_prepend (NULL, tag);
}
- g_object_unref (template);
- g_free (local_file);
-
/* read index.html and set variables. */
for (scan = ce->index_parsed; scan; scan = scan->next) {
Modified: trunk/src/lex.albumtheme.c
==============================================================================
--- trunk/src/lex.albumtheme.c (original)
+++ trunk/src/lex.albumtheme.c Wed Aug 20 19:43:59 2008
@@ -757,9 +757,20 @@
*/
#include <glib.h>
+#include <gio/gio.h>
+GFileInputStream *yy_istream;
-#line 772 "lex.yy.c"
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+{ \
+ gssize n = g_input_stream_read (G_INPUT_STREAM(yy_istream), buf, max_size, NULL, NULL); \
+ result = (n <= 0 ? YY_NULL : n); \
+}
+
+#define YY_NO_INPUT 1
+
+#line 783 "lex.yy.c"
#define INITIAL 0
#define TAG 1
@@ -943,10 +954,10 @@
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 34 "albumtheme.l"
+#line 44 "albumtheme.l"
-#line 959 "lex.yy.c"
+#line 970 "lex.yy.c"
if (!(yy_init))
{
@@ -1032,7 +1043,7 @@
case 1:
YY_RULE_SETUP
-#line 36 "albumtheme.l"
+#line 46 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_HEADER;
@@ -1040,7 +1051,7 @@
}
YY_BREAK case 2:
YY_RULE_SETUP
-#line 41 "albumtheme.l"
+#line 51 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_FOOTER;
@@ -1048,7 +1059,7 @@
}
YY_BREAK case 3:
YY_RULE_SETUP
-#line 46 "albumtheme.l"
+#line 56 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_LANGUAGE;
@@ -1056,7 +1067,7 @@
}
YY_BREAK case 4:
YY_RULE_SETUP
-#line 51 "albumtheme.l"
+#line 61 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_THEME_LINK;
@@ -1064,7 +1075,7 @@
}
YY_BREAK case 5:
YY_RULE_SETUP
-#line 56 "albumtheme.l"
+#line 66 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_IMAGE;
@@ -1072,7 +1083,7 @@
}
YY_BREAK case 6:
YY_RULE_SETUP
-#line 61 "albumtheme.l"
+#line 71 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_IMAGE_LINK;
@@ -1080,7 +1091,7 @@
}
YY_BREAK case 7:
YY_RULE_SETUP
-#line 66 "albumtheme.l"
+#line 76 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_IMAGE_IDX;
@@ -1088,7 +1099,7 @@
}
YY_BREAK case 8:
YY_RULE_SETUP
-#line 71 "albumtheme.l"
+#line 81 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_IMAGE_DIM;
@@ -1096,7 +1107,7 @@
}
YY_BREAK case 9:
YY_RULE_SETUP
-#line 76 "albumtheme.l"
+#line 86 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_IMAGES;
@@ -1104,7 +1115,7 @@
}
YY_BREAK case 10:
YY_RULE_SETUP
-#line 81 "albumtheme.l"
+#line 91 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_FILENAME;
@@ -1112,7 +1123,7 @@
}
YY_BREAK case 11:
YY_RULE_SETUP
-#line 86 "albumtheme.l"
+#line 96 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_FILEPATH;
@@ -1120,7 +1131,7 @@
}
YY_BREAK case 12:
YY_RULE_SETUP
-#line 91 "albumtheme.l"
+#line 101 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_FILESIZE;
@@ -1128,7 +1139,7 @@
}
YY_BREAK case 13:
YY_RULE_SETUP
-#line 96 "albumtheme.l"
+#line 106 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_COMMENT;
@@ -1136,7 +1147,7 @@
}
YY_BREAK case 14:
YY_RULE_SETUP
-#line 101 "albumtheme.l"
+#line 111 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_PLACE;
@@ -1144,7 +1155,7 @@
}
YY_BREAK case 15:
YY_RULE_SETUP
-#line 106 "albumtheme.l"
+#line 116 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_DATE_TIME;
@@ -1152,7 +1163,7 @@
}
YY_BREAK case 16:
YY_RULE_SETUP
-#line 111 "albumtheme.l"
+#line 121 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_PAGE_LINK;
@@ -1160,7 +1171,7 @@
}
YY_BREAK case 17:
YY_RULE_SETUP
-#line 116 "albumtheme.l"
+#line 126 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_PAGE_IDX;
@@ -1168,7 +1179,7 @@
}
YY_BREAK case 18:
YY_RULE_SETUP
-#line 121 "albumtheme.l"
+#line 131 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_PAGE_ROWS;
@@ -1176,7 +1187,7 @@
}
YY_BREAK case 19:
YY_RULE_SETUP
-#line 126 "albumtheme.l"
+#line 136 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_PAGE_COLS;
@@ -1184,7 +1195,7 @@
}
YY_BREAK case 20:
YY_RULE_SETUP
-#line 131 "albumtheme.l"
+#line 141 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_PAGES;
@@ -1192,7 +1203,7 @@
}
YY_BREAK case 21:
YY_RULE_SETUP
-#line 136 "albumtheme.l"
+#line 146 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_TABLE;
@@ -1200,7 +1211,7 @@
}
YY_BREAK case 22:
YY_RULE_SETUP
-#line 141 "albumtheme.l"
+#line 151 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_THUMBS;
@@ -1208,7 +1219,7 @@
}
YY_BREAK case 23:
YY_RULE_SETUP
-#line 146 "albumtheme.l"
+#line 156 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_DATE;
@@ -1216,7 +1227,7 @@
}
YY_BREAK case 24:
YY_RULE_SETUP
-#line 151 "albumtheme.l"
+#line 161 "albumtheme.l"
{
BEGIN (STAG);
yylval.ivalue = GTH_TAG_TEXT;
@@ -1224,14 +1235,14 @@
}
YY_BREAK case 25:
YY_RULE_SETUP
-#line 156 "albumtheme.l"
+#line 166 "albumtheme.l"
{
BEGIN (INITIAL);
return TEXT_END;
}
YY_BREAK case 26:
YY_RULE_SETUP
-#line 160 "albumtheme.l"
+#line 170 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_EXPOSURE_TIME;
@@ -1239,7 +1250,7 @@
}
YY_BREAK case 27:
YY_RULE_SETUP
-#line 165 "albumtheme.l"
+#line 175 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_EXPOSURE_MODE;
@@ -1247,7 +1258,7 @@
}
YY_BREAK case 28:
YY_RULE_SETUP
-#line 170 "albumtheme.l"
+#line 180 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_FLASH;
@@ -1255,7 +1266,7 @@
}
YY_BREAK case 29:
YY_RULE_SETUP
-#line 175 "albumtheme.l"
+#line 185 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_SHUTTER_SPEED;
@@ -1263,7 +1274,7 @@
}
YY_BREAK case 30:
YY_RULE_SETUP
-#line 180 "albumtheme.l"
+#line 190 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_APERTURE_VALUE;
@@ -1271,7 +1282,7 @@
}
YY_BREAK case 31:
YY_RULE_SETUP
-#line 185 "albumtheme.l"
+#line 195 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_FOCAL_LENGTH;
@@ -1279,7 +1290,7 @@
}
YY_BREAK case 32:
YY_RULE_SETUP
-#line 190 "albumtheme.l"
+#line 200 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_DATE_TIME;
@@ -1287,7 +1298,7 @@
}
YY_BREAK case 33:
YY_RULE_SETUP
-#line 195 "albumtheme.l"
+#line 205 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EXIF_CAMERA_MODEL;
@@ -1295,7 +1306,7 @@
}
YY_BREAK case 34:
YY_RULE_SETUP
-#line 200 "albumtheme.l"
+#line 210 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_SET_VAR;
@@ -1303,7 +1314,7 @@
}
YY_BREAK case 35:
YY_RULE_SETUP
-#line 205 "albumtheme.l"
+#line 215 "albumtheme.l"
{
BEGIN (TAG);
yylval.ivalue = GTH_TAG_EVAL;
@@ -1311,194 +1322,194 @@
}
YY_BREAK case 36:
YY_RULE_SETUP
-#line 210 "albumtheme.l"
+#line 220 "albumtheme.l"
{
BEGIN (TAG);
return IF;
}
YY_BREAK case 37:
YY_RULE_SETUP
-#line 214 "albumtheme.l"
+#line 224 "albumtheme.l"
{
BEGIN (TAG);
return ELSE;
}
YY_BREAK case 38:
YY_RULE_SETUP
-#line 218 "albumtheme.l"
+#line 228 "albumtheme.l"
{
BEGIN (TAG);
return ELSE_IF;
}
YY_BREAK case 39:
YY_RULE_SETUP
-#line 222 "albumtheme.l"
+#line 232 "albumtheme.l"
{
BEGIN (TAG);
return END;
}
YY_BREAK case 40:
YY_RULE_SETUP
-#line 226 "albumtheme.l"
+#line 236 "albumtheme.l"
{
BEGIN (STR);
return '\'';
}
YY_BREAK case 41:
YY_RULE_SETUP
-#line 230 "albumtheme.l"
+#line 240 "albumtheme.l"
{
BEGIN (SSTR);
return '\'';
}
YY_BREAK case 42:
YY_RULE_SETUP
-#line 234 "albumtheme.l"
+#line 244 "albumtheme.l"
{
yylval.text = g_strdup (yytext);
return STRING;
}
YY_BREAK case 43:
YY_RULE_SETUP
-#line 238 "albumtheme.l"
+#line 248 "albumtheme.l"
{
BEGIN (TAG);
return '\'';
}
YY_BREAK case 44:
YY_RULE_SETUP
-#line 242 "albumtheme.l"
+#line 252 "albumtheme.l"
{
BEGIN (STAG);
return '\'';
}
YY_BREAK case 45:
YY_RULE_SETUP
-#line 246 "albumtheme.l"
+#line 256 "albumtheme.l"
{
yylval.ivalue = atoi (yytext);
return NUMBER;
}
YY_BREAK case 46:
YY_RULE_SETUP
-#line 250 "albumtheme.l"
+#line 260 "albumtheme.l"
{
yylval.text = g_strdup (yytext);
return NAME;
}
YY_BREAK case 47:
YY_RULE_SETUP
-#line 254 "albumtheme.l"
+#line 264 "albumtheme.l"
{
return '=';
}
YY_BREAK case 48:
YY_RULE_SETUP
-#line 257 "albumtheme.l"
+#line 267 "albumtheme.l"
{
yylval.ivalue = GTH_OP_CMP_LT;
return COMPARE;
}
YY_BREAK case 49:
YY_RULE_SETUP
-#line 261 "albumtheme.l"
+#line 271 "albumtheme.l"
{
yylval.ivalue = GTH_OP_CMP_GT;
return COMPARE;
}
YY_BREAK case 50:
YY_RULE_SETUP
-#line 265 "albumtheme.l"
+#line 275 "albumtheme.l"
{
BEGIN (INITIAL);
return END_TAG;
}
YY_BREAK case 51:
YY_RULE_SETUP
-#line 269 "albumtheme.l"
+#line 279 "albumtheme.l"
{
return '+';
}
YY_BREAK case 52:
YY_RULE_SETUP
-#line 272 "albumtheme.l"
+#line 282 "albumtheme.l"
{
return '-';
}
YY_BREAK case 53:
YY_RULE_SETUP
-#line 275 "albumtheme.l"
+#line 285 "albumtheme.l"
{
return '*';
}
YY_BREAK case 54:
YY_RULE_SETUP
-#line 278 "albumtheme.l"
+#line 288 "albumtheme.l"
{
return '/';
}
YY_BREAK case 55:
YY_RULE_SETUP
-#line 281 "albumtheme.l"
+#line 291 "albumtheme.l"
{
return '!';
}
YY_BREAK case 56:
YY_RULE_SETUP
-#line 284 "albumtheme.l"
+#line 294 "albumtheme.l"
{
return '(';
}
YY_BREAK case 57:
YY_RULE_SETUP
-#line 287 "albumtheme.l"
+#line 297 "albumtheme.l"
{
return ')';
}
YY_BREAK case 58:
YY_RULE_SETUP
-#line 290 "albumtheme.l"
+#line 300 "albumtheme.l"
{
return '"';
}
YY_BREAK case 59:
YY_RULE_SETUP
-#line 293 "albumtheme.l"
+#line 303 "albumtheme.l"
{
yylval.ivalue = GTH_OP_AND;
return BOOL_OP;
}
YY_BREAK case 60:
YY_RULE_SETUP
-#line 297 "albumtheme.l"
+#line 307 "albumtheme.l"
{
yylval.ivalue = GTH_OP_OR;
return BOOL_OP;
}
YY_BREAK case 61:
YY_RULE_SETUP
-#line 301 "albumtheme.l"
+#line 311 "albumtheme.l"
{
yylval.ivalue = GTH_OP_CMP_EQ;
return COMPARE;
}
YY_BREAK case 62:
YY_RULE_SETUP
-#line 305 "albumtheme.l"
+#line 315 "albumtheme.l"
{
yylval.ivalue = GTH_OP_CMP_NE;
return COMPARE;
}
YY_BREAK case 63:
YY_RULE_SETUP
-#line 309 "albumtheme.l"
+#line 319 "albumtheme.l"
{
yylval.ivalue = GTH_OP_CMP_LE;
return COMPARE;
}
YY_BREAK case 64:
YY_RULE_SETUP
-#line 313 "albumtheme.l"
+#line 323 "albumtheme.l"
{
yylval.ivalue = GTH_OP_CMP_GE;
return COMPARE;
@@ -1506,20 +1517,20 @@
YY_BREAK case 65:
/* rule 65 can match eol */
YY_RULE_SETUP
-#line 317 "albumtheme.l"
+#line 327 "albumtheme.l"
{
/* Eat spaces inside tag. */
}
YY_BREAK case 66:
YY_RULE_SETUP
-#line 320 "albumtheme.l"
+#line 330 "albumtheme.l"
{
BEGIN (INITIAL);
return END_TAG;
}
YY_BREAK case 67:
YY_RULE_SETUP
-#line 324 "albumtheme.l"
+#line 334 "albumtheme.l"
{
yylval.text = g_strdup (yytext);
return HTML;
@@ -1527,7 +1538,7 @@
YY_BREAK case 68:
/* rule 68 can match eol */
YY_RULE_SETUP
-#line 328 "albumtheme.l"
+#line 338 "albumtheme.l"
{
yylval.text = g_strdup (yytext);
return HTML;
@@ -1537,16 +1548,16 @@
case YY_STATE_EOF (STAG):
case YY_STATE_EOF (STR):
case YY_STATE_EOF (SSTR):
-#line 332 "albumtheme.l"
+#line 342 "albumtheme.l"
{
return 0;
}
YY_BREAK case 69:
YY_RULE_SETUP
-#line 336 "albumtheme.l"
+#line 346 "albumtheme.l"
ECHO;
YY_BREAK
-#line 1627 "lex.yy.c"
+#line 1638 "lex.yy.c"
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
@@ -2544,4 +2555,4 @@
#define YYTABLES_NAME "yytables"
-#line 336 "albumtheme.l"
+#line 346 "albumtheme.l"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]