parse_ctrees.h
static inline int * match_column_name(const char (*wanted_columns)[PARSE_CTREES_MAX_COLNAME_LEN], const int nwanted, const char (*names)[PARSE_CTREES_MAX_COLNAME_LEN], const int totncols)
{
    int *columns = calloc(nwanted, sizeof(*columns));
    PARSE_CTREES_XASSERT(columns != NULL,
                         NULL,
                         "Error: Could not allocate memory for reading in the columns for each of the %d fields\n",
                         nwanted);
    for(int i=0;i<nwanted;i++) {
        columns[i] = -1;
    }
    int nfound=0;
    for(int i=0;i<nwanted;i++) {
        const char *wanted_colname = wanted_columns[i];
        int found=0;
        for(int j=0;j<totncols;j++) {
            const char *file_colname = names[j];
            if (strcasecmp(wanted_colname, file_colname) == 0) {
                fprintf(stderr, "Found `%s` in column # %d as with name `%s`\n", wanted_colname, j, file_colname);
                columns[i] = j;
                nfound++;
                found = 1;
                break;
            }
        }
        if(found == 0) {
            fprintf(stderr,"Did not find requested column `%s'\n", wanted_colname);
        }
    }
    fprintf(stderr,"Found %d columns out of the requested %d\n", nfound, nwanted);
    return columns;
}
/* This function takes the array of wanted CTREES columns (``wanted_columns``) and matches those against
 the column names that were found in the CTREEs output (``names``)
 ``nwanted`` is the number of elements in ``wanted_columns``
 ``totncols`` is the number of elements in ``names``

 Returns a integer array of ``nwanted`` elements, where each element of this array contains the column number
 in CTREES output if a match was found, otherwise contains a -1.

 The performed string matching of column-names between ``wanted_columns`` and ``names`` is case-insensitive.
*/


Returns a integer array of ``nwanted`` elements, where each element of this array contains the column number
in CTREES output if a match was found, otherwise contains a -1.


Returns a integer array of ` ` nwanted ` ` elements where each element of this array contains the column number in CTREES output if a match was found otherwise contains a - 1 .
static inline int * match_column_name(const char (*wanted_columns)[PARSE_CTREES_MAX_COLNAME_LEN], const int nwanted, const char (*names)[PARSE_CTREES_MAX_COLNAME_LEN], const int totncols)
{
    int *columns = calloc(nwanted, sizeof(*columns));
    PARSE_CTREES_XASSERT(columns != NULL,
                         NULL,
                         "Error: Could not allocate memory for reading in the columns for each of the %d fields\n",
                         nwanted);
    for(int i=0;i<nwanted;i++) {
        columns[i] = -1;
    }
    int nfound=0;
    for(int i=0;i<nwanted;i++) {
        const char *wanted_colname = wanted_columns[i];
        int found=0;
        for(int j=0;j<totncols;j++) {
            const char *file_colname = names[j];
            if (strcasecmp(wanted_colname, file_colname) == 0) {
                fprintf(stderr, "Found `%s` in column # %d as with name `%s`\n", wanted_colname, j, file_colname);
                columns[i] = j;
                nfound++;
                found = 1;
                break;
            }
        }
        if(found == 0) {
            fprintf(stderr,"Did not find requested column `%s'\n", wanted_colname);
        }
    }
    fprintf(stderr,"Found %d columns out of the requested %d\n", nfound, nwanted);
    return columns;
}
static inline int * match_column_name ( const char ( * wanted_columns ) [ PARSE_CTREES_MAX_COLNAME_LEN ] , const int nwanted , const char ( * names ) [ PARSE_CTREES_MAX_COLNAME_LEN ] , const int totncols ) { int * columns = calloc ( nwanted , sizeof ( * columns ) ) ; PARSE_CTREES_XASSERT ( columns != NULL , NULL , " \n " , nwanted ) ; for ( int i = 0 ; i < nwanted ; i ++ ) { columns [ i ] = -1 ; } int nfound = 0 ; for ( int i = 0 ; i < nwanted ; i ++ ) { const char * wanted_colname = wanted_columns [ i ] ; int found = 0 ; for ( int j = 0 ; j < totncols ; j ++ ) { const char * file_colname = names [ j ] ; if ( strcasecmp ( wanted_colname , file_colname ) == 0 ) { fprintf ( stderr , " \n " , wanted_colname , j , file_colname ) ; columns [ i ] = j ; nfound ++ ; found = 1 ; break ; } } if ( found == 0 ) { fprintf ( stderr , " \n " , wanted_colname ) ; } } fprintf ( stderr , " \n " , nfound , nwanted ) ; return columns ; }
This function takes the array of wanted CTREES columns (``wanted_columns``) and matches those against
the column names that were found in the CTREEs output (``names``)
``nwanted`` is the number of elements in ``wanted_columns``
``totncols`` is the number of elements in ``names``
This function takes the array of wanted CTREES columns ( ` ` wanted_columns ` ` ) and matches those against the column names that were found in the CTREEs output ( ` ` names ` ` ) ` ` nwanted ` ` is the number of elements in ` ` wanted_columns ` ` ` ` totncols ` ` is the number of elements in ` ` names ` `