Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 27, 2024, 07:18:38 19:18


Login with username, password and session length


Pages: [1]
Print
Author Topic: C Structure (Keil Compiler)  (Read 4132 times)
0 Members and 1 Guest are viewing this topic.
Help
Junior Member
**
Offline Offline

Posts: 37

Thank You
-Given: 33
-Receive: 0


« on: January 05, 2008, 03:13:03 03:13 »

Code:
/* ---------------------------------------------------------------------- 
 * DECLARE your own open(), close(), addr(), and byte() routines here.
 *
 */

static int open1(), close1(), addr1(), byte1();
static int open2(), close2(), addr2(), byte2();
static int open3(), close3(), addr3(), byte3();
static int open4(), close4(), addr4(), byte4();

/* ----------------------------------------------------------------------
 * ADD an entry to this table to register your
 * output format routines. Give your object format
 * a name to be specified with the -F option.
 *
 */

static int format;
static struct {
   char *name;
   int (*e_open)();
   int (*e_close)();
   int (*e_addr)();
   int (*e_byte)();
} formtab[] = {
   { "tdr",   open1, close1, addr1, byte1 },
   { "byte",  open2, close2, addr2, byte2 },
   { "od",    open3, close3, addr3, byte3 },
   { "srec2", open4, close4, addr4, byte4 },
   { "srec3", open4, close4, addr4, byte4 },
   { "srec4", open4, close4, addr4, byte4 }
};

#define FORMTABSIZE   (sizeof(formtab)/sizeof(formtab[0]))

Hi,

Above the structure declared the function in structure. This sample code is picked from other sample project code. This sample project i took from net is not completed source and some of the .h and .c file is not included.

The call functions:
Code:
(*formtab[format].e_open)(file,ftype,arg); 
(*formtab[format].e_close)();
(*formtab[format].e_addr)(a);
(*formtab[format].e_byte)(b);

The compiler show:-> error C267: 'function': requires ANSI-style prototype

How to declare the function? I already included initial define function prototype. I think my function prototype is wrong.

The attached file is the code. Please help me...

Thank you.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC