-
Notifications
You must be signed in to change notification settings - Fork 0
/
out.c
73 lines (53 loc) · 1.89 KB
/
out.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// $Id: out.c,v 2.11 2004/05/28 19:22:06 o Exp $
// philologic 2.8 -- TEI XML/SGML Full-text database engine
// Copyright (C) 2004 University of Chicago
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Affero General Public License as published by
// Affero, Inc.; either version 1 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
// Affero General Public License for more details.
//
// You should have received a copy of the Affero General Public License
// along with this program; if not, write to Affero, Inc.,
// 510 Third Street, Suite 225, San Francisco, CA 94107 USA.
#include <stdio.h>
#include "c.h"
#include "search.h"
#include "out.h"
Z32 dump_hits_out ( Search s, N32 level, Gmap m )
{
N32 n = m->gm_eod;
N32 i;
s_log ( s->debug, L_INFO, "dumping out results; (%d hits on map)", (Z8 *)n );
s_log ( s->debug, L_INFO, "map position set to %d;", (Z8 *)m->gm_c );
if ( s->hit_def->output == HIT_OUT_ASCII )
s_log ( s->debug, L_INFO, NULL, (Z8 *)"(output set to ASCII)" );
for ( i = 0; i < n; i++ )
{
if ( s->depth_r )
(void) hit_out ( gm_get_pos(m, i), s->hit_def, level, s->depth_r );
else
(void) hit_out ( gm_get_pos(m, i), s->hit_def, level, s->depth );
s->n_printed++;
if ( ! ( s->n_printed % 100 ) )
fflush( stdout );
else if ( s->n_printed == s->soft_limit )
{
s->batch_limit = DEFAULT_BATCH_LIMIT;
fflush( stdout );
}
if ( s->n_printed == s->print_limit )
{
fflush( stdout );
s->exitcode = 111;
return SEARCH_PRINT_LIMIT_REACHED;
}
}
fflush( stdout );
return 0;
}