DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T c

⟦3b90e2013⟧ TextFile

    Length: 4809 (0x12c9)
    Types: TextFile
    Names: »correlate.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/dsap/common/correlate.c« 

TextFile

/* correlate.c - correlate search results */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/dsap/common/RCS/correlate.c,v 6.0 89/03/18 23:27:27 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/dsap/common/RCS/correlate.c,v 6.0 89/03/18 23:27:27 mrose Rel $
 *
 *
 * $Log:	correlate.c,v $
 * Revision 6.0  89/03/18  23:27:27  mrose
 * Release 5.0
 * 
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


/* LINTLIBRARY */

#include "quipu/util.h"
#include "quipu/list.h"      /* to get LSR # defs */
#include "quipu/ds_search.h"

extern LLog * log_dsap;
int	entryinfo_print();
int	dn_print();

correlate_search_results(sr_res)
struct ds_search_result	* sr_res;
{
    struct ds_search_result	* sr_tmp;
    struct ds_search_result	* sr_last;

    LLOG(log_dsap, LLOG_DEBUG, ("correlate_search_results() "));

    if(sr_res->srr_correlated)
    {
	LLOG(log_dsap, LLOG_DEBUG, ("Already correlated! "));
	return;
    }

    LLOG(log_dsap, LLOG_DEBUG, ("Not yet correlated! "));

    for(sr_tmp = sr_res->srr_un.srr_parts; sr_tmp != NULLSRR; sr_tmp = sr_tmp->srr_next)
    {
	LLOG(log_dsap, LLOG_DEBUG, ("correlate_search_results(A Result Part)"));
	correlate_search_results(sr_tmp);
    }

    sr_tmp = sr_res->srr_un.srr_parts;
    sr_res->srr_correlated = TRUE;
    sr_res->srr_un.srr_unit = (struct ds_search_unit *) malloc(sizeof(struct ds_search_unit));
    sr_res->CSR_object = NULLDN;
    sr_res->CSR_entries = NULLENTRYINFO;
    sr_res->CSR_limitproblem = LSR_NOLIMITPROBLEM;
    sr_res->CSR_cr = NULLCONTINUATIONREF;
    sr_res->CSR_common.cr_requestor = NULLDN;
    sr_res->CSR_common.cr_aliasdereferenced = FALSE;

    while(sr_tmp != NULLSRR)
    {
	merge_search_results(sr_res, sr_tmp);
	sr_last = sr_tmp;
	sr_tmp = sr_tmp->srr_next;
	sr_last->srr_next = NULLSRR;
	LLOG(log_dsap, LLOG_DEBUG, ("Before search_results_free"));
	search_result_free(sr_last);
	LLOG(log_dsap, LLOG_DEBUG, ("After search_results_free"));
    }
}

merge_search_results(sr_res, sr_tmp)
struct ds_search_result	* sr_res;
struct ds_search_result	* sr_tmp;
{
    ContinuationRef		cr_tmp;

    LLOG(log_dsap, LLOG_DEBUG, ("merge_search_results"));

    if(sr_tmp == NULLSRR)
	return;

    if (sr_res->CSR_entries == NULLENTRYINFO)
    {
	LLOG(log_dsap, LLOG_DEBUG, ("Before inserting entries"));
	sr_res->CSR_entries = sr_tmp->CSR_entries;
    }
    else
    {
	pslog(log_dsap, LLOG_DEBUG, "Before merging entries", entryinfo_print, (caddr_t) sr_res->CSR_entries);
	entryinfo_append (sr_res->CSR_entries,sr_tmp->CSR_entries);
    }

    LLOG(log_dsap, LLOG_DEBUG, ("Before merging limitproblems"));

    if(sr_res->CSR_limitproblem == LSR_NOLIMITPROBLEM)
        sr_res->CSR_limitproblem = sr_tmp->CSR_limitproblem;

    LLOG(log_dsap, LLOG_DEBUG, ("Before merging ContinuationRefs"));

    if(sr_tmp->CSR_cr != NULLCONTINUATIONREF)
    {
	for(cr_tmp = sr_tmp->CSR_cr; cr_tmp->cr_next != NULLCONTINUATIONREF; cr_tmp = cr_tmp->cr_next)
	{
	    pslog(log_dsap, LLOG_DEBUG, "Another new ref:", dn_print, (caddr_t) cr_tmp->cr_name);
	}
	pslog(log_dsap, LLOG_DEBUG, "Another new ref:", dn_print, (caddr_t) cr_tmp->cr_name);
	cr_tmp->cr_next = sr_res->CSR_cr;
	sr_res->CSR_cr = sr_tmp->CSR_cr;
	sr_tmp->CSR_cr = NULLCONTINUATIONREF;
    }
    else
    {
	LLOG(log_dsap, LLOG_DEBUG, ("No new references to merge"));
    }

#ifdef DEBUG
    if(sr_res->CSR_cr != NULLCONTINUATIONREF)
    {
	for(cr_tmp = sr_res->CSR_cr; cr_tmp != NULLCONTINUATIONREF; cr_tmp = cr_tmp->cr_next)
	{
	    pslog(log_dsap, LLOG_DEBUG, "ref entry:", dn_print, (caddr_t) cr_tmp->cr_name);
	}
    }
    else
    {
	LLOG(log_dsap, LLOG_DEBUG, ("No references"));
    }
#endif
    DLOG(log_dsap, LLOG_DEBUG, ("After merging results:"));

}

search_result_free(arg)
struct ds_search_result	* arg;
{
    LLOG(log_dsap, LLOG_DEBUG, ("search_result_free"));

    if(arg == NULLSRR)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("Lost part of search structure somewhere!"));
	return;
    }

    if(arg->srr_correlated)
    {
	LLOG(log_dsap, LLOG_DEBUG, ("search_result_free - correlated"));
/*
	dn_free (arg->CSR_common.cr_requestor);
*/
	dn_free (arg->CSR_object);
	entryinfo_free (arg->CSR_entries,1);
	crefs_free (arg->CSR_cr);
	free(arg->srr_un.srr_unit);
    }
    else
    {
	LLOG(log_dsap, LLOG_DEBUG, ("search_result_free - uncorrelated"));
	search_result_free(arg->srr_un.srr_parts);
	free(arg->srr_un.srr_parts);
    }

    LLOG(log_dsap, LLOG_DEBUG, ("After freeing parts"));

    if(arg->srr_next != NULLSRR)
    {
	search_result_free(arg->srr_next);
	free(arg->srr_next);
    }

    LLOG(log_dsap, LLOG_DEBUG, ("After freeing next"));

    return;
}