This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
parse error at end of input :(
- From: "Jordi Vendrell" <jordivendrell06 at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 13 Sep 2006 19:08:28 +0200
- Subject: parse error at end of input :(
- References: <5b8d9a10609130947t686f413cn77f6605528604b76@mail.gmail.com>
hi,
I'm compiling a program I have here using gcc-2.95 but I get this
main.c:219: parse error at end of input
error message.
I've checked but haven't seen any parse error. Anyone sees where is
the problem?
I'm using Knoppix distro with kernel 2.4.27
kind regards
Jordi Vendrell
PS: the program is a function separated from a bigger program, but I
guess it should work anyway
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <comedilib.h>
#include <comedi.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <getopt.h>
#include <ctype.h>
#include <asm/io.h>
#include <unistd.h>
#include <pthread.h>
#include <linux/kernel.h>
#include "examples.h"
#define PORT 0x280 //digital I/O port PC embedded
//varaibles globals per controlar l'hora i el dia
struct tm *hora;
time_t time1;
int dia;
//struct on es gauardaran les dades un cop aquestes siguin definitives
FILE *df;
struct dades_t{
float vsolar; //tensio plaques solars
float vbp; //tensio bateria petita
float vbg; //tensio bateria gran
float vzener; //tensio zener
float isbp; //intensitat p.solar bat petita
float isbg; //intensitat p.solar bat gran
float icbp; //intensitat carrega bat petita
float idbg; //intensitat carrega dissipadora bat gran
float inbg; //intensita carrega nominal bat gran
float ieolos; //intensitat aerogenrador
float dirvent; //direccio del vent
float vent; //velocitat del vent
};
struct dades_t mesures;
//struct per tenir el balans de potencia
struct balans_t{
float Qinbp;
float Qoubp;
float incQp1p;
float Qinbg;
float Qoubg;
float incQp1g;
};
struct balans_t balcarr;
pthread_mutex_t mutex;
comedi_t *device; //descriptor de fitxer del comedi
int subdevice; //amb el qual selecionem quin tipus de senyal estem treballant analoques, digitals, counters,etc
int rang; //representa els augments i aspectes de les i/o analogiques de unipolar/bipolar
int aref=AREF_GROUND; //com es realitzara la mesura
float perdues=0;
int mosfet1=0, mosfet2=0, mosfet3=0, mosfet4=0, mosfet5=0;
int apagar=1;
int actiu=0;
#define M_PACK2(a,b) (((a)<<2) | (b))
#define M_PACK4(a,b,c,d) ((M_PACK2(a,b)<<4 | M_PACK2(c,d))
#define M_IGN 0
#define M_INC 1
#define M_DEC 2
struct counter_config_struct{
unsigned int id;
unsigned int inp0_src;
unsigned int inp0_arg;
unsigned int inp0_mach;
unsigned int inp1_src;
unsigned int inp1_arg;
unsigned int inp1_mach;
};
void main (void)
{
double mostres1[4];
lsampl_t dades;
comedi_range *cmrg;
int maxdata;
device=comedi_open("/dev/comedi0");
if(device == NULL)
{
comedi_perror(filename);
exit(0);
}
while(apagar==1)
{
// pthread_mutex_lock(&mutex);
subdevice=0;
maxdata=comedi_get_maxdata(device,subdevice,7);
cmrg=comedi_get_range(device,subdevice,7,rang);
if(actiu==0)
{
if(ioperm(PORT,1,1))
{
perror("ioperm");
exit(1);
}
outb(0x00,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[0]=comedi_to_phys(dades,cmrg,maxdata);
outb(0x01,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[1]=comedi_to_phys(dades,cmrg,maxdata);
outb(0x02,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[2]=comedi_to_phys(dades,cmrg,maxdata);
outb(0x03,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[3]=comedi_to_phys(dades,cmrg,maxdata);
}
if(actiu==1)
{
if(ioperm(PORT,1,1))
{
perror("ioperm");
exit(1);
}
outb(0x04,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[0]=comedi_to_phys(dades,cmrg,maxdata);
outb(0x05,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[1]=comedi_to_phys(dades,cmrg,maxdata);
outb(0x06,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[2]=comedi_to_phys(dades,cmrg,maxdata);
outb(0x07,PORT);
usleep(10000);
comedi_data_read(device,subdevice,7,rang,aref,&dades);
mostres1[3]=comedi_to_phys(dades,cmrg,maxdata);
}
if(ioperm(PORT,1,0)) //tanquem el canal per escriure sobre le PORT del PC embedded
{
perror("ioperm");
exit(1);
}
mesures.vzener=mostres1[2]; //guardem les dades a l'struct assignada
perdues=8.02-mesures.vzener;
//modificant el possible error que hi pugui haver
mesures.vbg=(mostres1[0]+perdues)/0.56;
printf("el valor es :%f\n", mesures.vbg);
mesures.vsolar=(mostres1[1]+perdues)/0.47;
printf("el valor es :%f\n", mesures.vsolar);
mesures.dirvent=(mostres1[3]+perdues)/0.68;
printf("el valor es :%f\n", mesures.dirvent);
// pthread_mutex_unlock(&mutex);
}