Computer Hope

Software => Computer programming => Topic started by: qito on October 28, 2019, 06:03:30 PM

Title: C LIB Help
Post by: qito on October 28, 2019, 06:03:30 PM
Hi,
My first attempt to add a function to the C LIB, fail's to compile:

Code: [Select]
/* test.c */
#include <stdio.h>
#include <stdarg.h>
#include “test.h” /* DSP header file */

#define maxent (sm) (sm->txt->hn.numelem)

#define MIN(a,b) ((a) < (b) ? (a) : (b))
void displist (menudesc *sm) ;

void displist (menudesc *sm)

/*
 Parameters:
 *sm * pointer to DSP structure
 */
{
    int i,m,n,x,y,col;
    strlist tl;
   
    /* calculate's MIN between DSP area and DSP items */
   
    n= MIN(maxent (sm) - sm->scrofs,sm->area) ;
   
    m = n+sm->scrofs; /* add minimum to _s offset */
    selectwindow (sm->w) ; /* select as mounted */
    clrwin (NULL, 0); /* clear */
   
    tl = getstrptr(sm->scrofs +1, sm->txt); /* point to first item */
    /* write */
    for (i = sm->scrofs, x=0, y=0, col=1; (i<m); i++) {
        prthz (x,y,tl->dn.elem.data, sm->w->wndatr,tl->dn.elem.len) ;
        tl = tl->dn.next; /* get 1st */
        if (++y >= sm->nrows) { /* goto 2nd */
            y = 0; col++;
            x = colx(col, sm) ; /* determine loc */
        }
    }
}



The line compiler appears to flag states:

Code: [Select]
  n= MIN(maxent (sm) - sm->scrofs,sm->area) ;

The C compiler reports:
Quote

C2064 : ERROR : term does not evaluate to a function


I'm stumpt and would appreciate any help with this C syntax, since I'm in transition from BASIC.
thx
qito