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 - download
Index: ┃ T p

⟦c341ef95a⟧ TextFile

    Length: 1018 (0x3fa)
    Types: TextFile
    Names: »project.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/graph/project.c« 

TextFile

/*
 * Copyright (C) 1986   Alan Kent
 *
 * Permission is granted to freely distribute part or
 * all of this code as long as it is not for profit
 * and this message is retained in the code.
 *
 * No resposibility is taken for any damage or incorect
 * results this program generates.
 * 
 */


#include <stdio.h>
#include "graph.h"


extern table_st *new_table ();
extern double eval ();


table_st *
project ( table , attr_expr_list )
table_st *table;
expr_list_st *attr_expr_list;
{
    table_st *newtab , *p;
    expr_list_st *list;
    int count;
    int i;

    if ( table == NULL )
	abort ( "cannot project on an empty table" );
    count = 0;
    for ( list = attr_expr_list; list != NULL; list = list->next )
	count++;
    newtab = new_table ( count , table->size );
    for ( list = attr_expr_list , p = newtab; list != NULL; list = list->next , p = p->next ) {
	for ( i = 0; i < table->size; i++ )
	    p->data[i] = eval ( table , i , list->expr );
    }
    free_table ( table );
    return ( newtab );
}