summaryrefslogtreecommitdiff
path: root/backend/djvu/djvu-text-page.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/djvu/djvu-text-page.c')
-rw-r--r--backend/djvu/djvu-text-page.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/backend/djvu/djvu-text-page.c b/backend/djvu/djvu-text-page.c
index d74a3983..90bce25e 100644
--- a/backend/djvu/djvu-text-page.c
+++ b/backend/djvu/djvu-text-page.c
@@ -29,13 +29,13 @@
* @page: #DjvuTextPage instance
* @p: s-expression to append
* @delimit: character/word/... delimiter
- *
+ *
* Appends the string in @p to the page text.
- *
+ *
* Returns: whether the end was not reached in this s-expression
*/
static gboolean
-djvu_text_page_selection_process (DjvuTextPage *page,
+djvu_text_page_selection_process (DjvuTextPage *page,
miniexp_t p,
int delimit)
{
@@ -43,7 +43,7 @@ djvu_text_page_selection_process (DjvuTextPage *page,
char *token_text = (char *) miniexp_to_str (miniexp_nth (5, p));
if (page->text) {
char *new_text =
- g_strjoin (delimit & 2 ? "\n" :
+ g_strjoin (delimit & 2 ? "\n" :
delimit & 1 ? " " : NULL,
page->text, token_text,
NULL);
@@ -51,7 +51,7 @@ djvu_text_page_selection_process (DjvuTextPage *page,
page->text = new_text;
} else
page->text = g_strdup (token_text);
- if (p == page->end)
+ if (p == page->end)
return FALSE;
}
return TRUE;
@@ -62,24 +62,24 @@ djvu_text_page_selection_process (DjvuTextPage *page,
* @page: #DjvuTextPage instance
* @p: tree to append
* @delimit: character/word/... delimiter
- *
+ *
* Walks the tree in @p and appends the text with
- * djvu_text_page_selection_process() for all s-expressions
+ * djvu_text_page_selection_process() for all s-expressions
* between the start and end fields.
- *
+ *
* Returns: whether the end was not reached in this subtree
*/
static gboolean
-djvu_text_page_selection (DjvuTextPage *page,
+djvu_text_page_selection (DjvuTextPage *page,
miniexp_t p,
int delimit)
{
g_return_val_if_fail (miniexp_consp (p) && miniexp_symbolp
(miniexp_car (p)), FALSE);
- if (miniexp_car (p) != page->char_symbol)
+ if (miniexp_car (p) != page->char_symbol)
delimit |= miniexp_car (p) == page->word_symbol ? 1 : 2;
-
+
miniexp_t deeper = miniexp_cddr (miniexp_cdddr (p));
while (deeper != miniexp_nil) {
miniexp_t str = miniexp_car (deeper);
@@ -100,11 +100,11 @@ djvu_text_page_selection (DjvuTextPage *page,
static void
djvu_text_page_limits_process (DjvuTextPage *page,
- miniexp_t p,
+ miniexp_t p,
EvRectangle *rect)
{
EvRectangle current;
-
+
current.x1 = miniexp_to_int (miniexp_nth (1, p));
current.y1 = miniexp_to_int (miniexp_nth (2, p));
current.x2 = miniexp_to_int (miniexp_nth (3, p));
@@ -120,10 +120,10 @@ djvu_text_page_limits_process (DjvuTextPage *page,
static void
djvu_text_page_limits (DjvuTextPage *page,
- miniexp_t p,
+ miniexp_t p,
EvRectangle *rect)
{
- g_return_if_fail (miniexp_consp (p) &&
+ g_return_if_fail (miniexp_consp (p) &&
miniexp_symbolp (miniexp_car (p)));
miniexp_t deeper = miniexp_cddr (miniexp_cdddr (p));
@@ -139,20 +139,20 @@ djvu_text_page_limits (DjvuTextPage *page,
}
char *
-djvu_text_page_copy (DjvuTextPage *page,
+djvu_text_page_copy (DjvuTextPage *page,
EvRectangle *rectangle)
{
char* text;
-
+
page->start = miniexp_nil;
page->end = miniexp_nil;
djvu_text_page_limits (page, page->text_structure, rectangle);
djvu_text_page_selection (page, page->text_structure, 0);
-
- /* Do not free the string */
+
+ /* Do not free the string */
text = page->text;
page->text = NULL;
-
+
return text;
}
@@ -160,14 +160,14 @@ djvu_text_page_copy (DjvuTextPage *page,
* djvu_text_page_position:
* @page: #DjvuTextPage instance
* @position: index in the page text
- *
- * Returns the closest s-expression that contains the given position in
+ *
+ * Returns the closest s-expression that contains the given position in
* the page text.
- *
+ *
* Returns: closest s-expression
*/
static miniexp_t
-djvu_text_page_position (DjvuTextPage *page,
+djvu_text_page_position (DjvuTextPage *page,
int position)
{
GArray *links = page->links;
@@ -197,12 +197,12 @@ djvu_text_page_position (DjvuTextPage *page,
* djvu_text_page_union:
* @target: first rectangle and result
* @source: second rectangle
- *
- * Calculates the bounding box of two rectangles and stores the reuslt
+ *
+ * Calculates the bounding box of two rectangles and stores the reuslt
* in the first.
*/
static void
-djvu_text_page_union (EvRectangle *target,
+djvu_text_page_union (EvRectangle *target,
EvRectangle *source)
{
if (source->x1 < target->x1)
@@ -221,15 +221,15 @@ djvu_text_page_union (EvRectangle *target,
* @p: s-expression to append
* @start: first s-expression in the selection
* @end: last s-expression in the selection
- *
+ *
* Appends the rectangle defined by @p to the internal bounding box rectangle.
- *
+ *
* Returns: whether the end was not reached in this s-expression
*/
static gboolean
-djvu_text_page_sexpr_process (DjvuTextPage *page,
+djvu_text_page_sexpr_process (DjvuTextPage *page,
miniexp_t p,
- miniexp_t start,
+ miniexp_t start,
miniexp_t end)
{
if (page->bounding_box || p == start) {
@@ -256,16 +256,16 @@ djvu_text_page_sexpr_process (DjvuTextPage *page,
* @p: tree to append
* @start: first s-expression in the selection
* @end: last s-expression in the selection
- *
- * Walks the tree in @p and extends the rectangle with
+ *
+ * Walks the tree in @p and extends the rectangle with
* djvu_text_page_process() for all s-expressions between @start and @end.
- *
+ *
* Returns: whether the end was not reached in this subtree
*/
static gboolean
-djvu_text_page_sexpr (DjvuTextPage *page,
+djvu_text_page_sexpr (DjvuTextPage *page,
miniexp_t p,
- miniexp_t start,
+ miniexp_t start,
miniexp_t end)
{
g_return_val_if_fail (miniexp_consp (p) && miniexp_symbolp
@@ -293,12 +293,12 @@ djvu_text_page_sexpr (DjvuTextPage *page,
* @page: #DjvuTextPage instance
* @start: first s-expression in the selection
* @end: last s-expression in the selection
- *
+ *
* Builds a rectangle that contains all s-expressions in the given range.
*/
static EvRectangle *
djvu_text_page_box (DjvuTextPage *page,
- miniexp_t start,
+ miniexp_t start,
miniexp_t end)
{
page->bounding_box = NULL;
@@ -312,22 +312,22 @@ djvu_text_page_box (DjvuTextPage *page,
* @p: tree to append
* @case_sensitive: do not ignore case
* @delimit: insert spaces because of higher (sentence/paragraph/...) break
- *
- * Appends the tree in @p to the internal text string.
+ *
+ * Appends the tree in @p to the internal text string.
*/
static void
djvu_text_page_append_text (DjvuTextPage *page,
- miniexp_t p,
- gboolean case_sensitive,
+ miniexp_t p,
+ gboolean case_sensitive,
gboolean delimit)
{
char *token_text;
-
- g_return_if_fail (miniexp_consp (p) &&
+
+ g_return_if_fail (miniexp_consp (p) &&
miniexp_symbolp (miniexp_car (p)));
delimit |= page->char_symbol != miniexp_car (p);
-
+
miniexp_t deeper = miniexp_cddr (miniexp_cdddr (p));
while (deeper != miniexp_nil) {
miniexp_t data = miniexp_car (deeper);
@@ -354,7 +354,7 @@ djvu_text_page_append_text (DjvuTextPage *page,
if (!case_sensitive)
g_free (token_text);
} else
- djvu_text_page_append_text (page, data,
+ djvu_text_page_append_text (page, data,
case_sensitive, delimit);
delimit = FALSE;
deeper = miniexp_cdr (deeper);
@@ -366,12 +366,12 @@ djvu_text_page_append_text (DjvuTextPage *page,
* @page: #DjvuTextPage instance
* @text: text to search
* @case_sensitive: do not ignore case
- *
- * Searches the page for the given text. The results list has to be
+ *
+ * Searches the page for the given text. The results list has to be
* externally freed afterwards.
*/
-void
-djvu_text_page_search (DjvuTextPage *page,
+void
+djvu_text_page_search (DjvuTextPage *page,
const char *text,
gboolean case_sensitive)
{
@@ -409,23 +409,23 @@ djvu_text_page_search (DjvuTextPage *page,
* djvu_text_page_prepare_search:
* @page: #DjvuTextPage instance
* @case_sensitive: do not ignore case
- *
+ *
* Indexes the page text and prepares the page for subsequent searches.
*/
void
djvu_text_page_prepare_search (DjvuTextPage *page,
gboolean case_sensitive)
{
- djvu_text_page_append_text (page, page->text_structure,
- case_sensitive, FALSE);
+ djvu_text_page_append_text (page, page->text_structure,
+ case_sensitive, FALSE);
}
/**
* djvu_text_page_new:
* @text: S-expression of the page text
- *
- * Creates a new page to search.
- *
+ *
+ * Creates a new page to search.
+ *
* Returns: new #DjvuTextPage instance
*/
DjvuTextPage *
@@ -444,10 +444,10 @@ djvu_text_page_new (miniexp_t text)
/**
* djvu_text_page_free:
* @page: #DjvuTextPage instance
- *
+ *
* Frees the given #DjvuTextPage instance.
*/
-void
+void
djvu_text_page_free (DjvuTextPage *page)
{
g_free (page->text);