Cleaning up code by adding prototypes or include files where required.

This commit is contained in:
skarg
2010-08-17 13:51:56 +00:00
parent 8a67273f9b
commit bc0de6b71f
20 changed files with 47 additions and 18 deletions
+2 -1
View File
@@ -42,6 +42,7 @@
#include "rp.h" #include "rp.h"
#include "wp.h" #include "wp.h"
#include "handlers.h" #include "handlers.h"
#include "bacfile.h"
typedef struct { typedef struct {
uint32_t instance; uint32_t instance;
@@ -164,7 +165,7 @@ static long fsize(
return (size); return (size);
} }
static unsigned bacfile_file_size( unsigned bacfile_file_size(
uint32_t object_instance) uint32_t object_instance)
{ {
char *pFilename = NULL; char *pFilename = NULL;
+2 -2
View File
@@ -182,7 +182,7 @@ bool Multistate_Input_Present_Value_Set(
return status; return status;
} }
char *Multistate_Input_Description( static char *Multistate_Input_Description(
uint32_t object_instance) uint32_t object_instance)
{ {
unsigned index = 0; /* offset from instance lookup */ unsigned index = 0; /* offset from instance lookup */
@@ -268,7 +268,7 @@ bool Multistate_Input_Name_Set(
return status; return status;
} }
char *Multistate_Input_State_Text( static char *Multistate_Input_State_Text(
uint32_t object_instance, uint32_t object_instance,
uint32_t state_index) uint32_t state_index)
{ {
+2 -2
View File
@@ -45,7 +45,7 @@ DEBUGGING = -g
endif endif
# put all the flags together # put all the flags together
CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES)
LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) LFLAGS = -Wl,$(LIBRARIES)
SRCS = main.c SRCS = main.c
@@ -70,6 +70,6 @@ depend:
${CC} -MM ${CFLAGS} *.c >> .depend ${CC} -MM ${CFLAGS} *.c >> .depend
clean: clean:
rm -f core ${TARGET_BIN} ${OBJS} ${BACNET_LIB_TARGET} $(TARGET).map rm -f core ${TARGET_BIN} ${OBJS} ${BACNET_LIB_TARGET}
include: .depend include: .depend
+2
View File
@@ -45,6 +45,8 @@ extern "C" {
void); void);
uint32_t Analog_Value_Index_To_Instance( uint32_t Analog_Value_Index_To_Instance(
unsigned index); unsigned index);
unsigned Analog_Value_Instance_To_Index(
uint32_t object_instance);
char *Analog_Value_Name( char *Analog_Value_Name(
uint32_t object_instance); uint32_t object_instance);
+8
View File
@@ -67,6 +67,10 @@ extern "C" {
int decode_tag_number( int decode_tag_number(
uint8_t * apdu, uint8_t * apdu,
uint8_t * tag_number); uint8_t * tag_number);
int decode_tag_number_safe(
uint8_t * apdu,
uint32_t apdu_len_remaining,
uint8_t * tag_number);
int decode_tag_number_and_value( int decode_tag_number_and_value(
uint8_t * apdu, uint8_t * apdu,
uint8_t * tag_number, uint8_t * tag_number,
@@ -88,6 +92,10 @@ extern "C" {
bool decode_is_context_tag( bool decode_is_context_tag(
uint8_t * apdu, uint8_t * apdu,
uint8_t tag_number); uint8_t tag_number);
bool decode_is_context_tag_with_length(
uint8_t * apdu,
uint8_t tag_number,
int *tag_length);
/* returns true if the tag is an opening tag */ /* returns true if the tag is an opening tag */
bool decode_is_opening_tag( bool decode_is_opening_tag(
uint8_t * apdu); uint8_t * apdu);
+2
View File
@@ -46,6 +46,8 @@ extern "C" {
void); void);
uint32_t Binary_Value_Index_To_Instance( uint32_t Binary_Value_Index_To_Instance(
unsigned index); unsigned index);
unsigned Binary_Value_Instance_To_Index(
uint32_t object_instance);
char *Binary_Value_Name( char *Binary_Value_Name(
uint32_t object_instance); uint32_t object_instance);
+4
View File
@@ -49,11 +49,15 @@ extern "C" {
void); void);
uint32_t Load_Control_Index_To_Instance( uint32_t Load_Control_Index_To_Instance(
unsigned index); unsigned index);
unsigned Load_Control_Instance_To_Index(
uint32_t object_instance);
char *Load_Control_Name( char *Load_Control_Name(
uint32_t object_instance); uint32_t object_instance);
void Load_Control_Init( void Load_Control_Init(
void); void);
void Load_Control_State_Machine(
int object_index);
int Load_Control_Read_Property( int Load_Control_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata); BACNET_READ_PROPERTY_DATA * rpdata);
+2
View File
@@ -46,6 +46,8 @@ extern "C" {
void); void);
uint32_t Life_Safety_Point_Index_To_Instance( uint32_t Life_Safety_Point_Index_To_Instance(
unsigned index); unsigned index);
unsigned Life_Safety_Point_Instance_To_Index(
uint32_t object_instance);
char *Life_Safety_Point_Name( char *Life_Safety_Point_Name(
uint32_t object_instance); uint32_t object_instance);
void Life_Safety_Point_Init( void Life_Safety_Point_Init(
+2
View File
@@ -46,6 +46,8 @@ extern "C" {
void); void);
uint32_t Multistate_Output_Index_To_Instance( uint32_t Multistate_Output_Index_To_Instance(
unsigned index); unsigned index);
unsigned Multistate_Output_Instance_To_Index(
uint32_t object_instance);
char *Multistate_Output_Name( char *Multistate_Output_Name(
uint32_t object_instance); uint32_t object_instance);
+2 -1
View File
@@ -30,6 +30,7 @@ BACNET_INCLUDE = ../include
INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER) INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER)
OPTIMIZATION = -Os OPTIMIZATION = -Os
DEBUGGING = DEBUGGING =
WARNINGS = -Wall -Wmissing-prototypes
ifeq (${BUILD},debug) ifeq (${BUILD},debug)
OPTIMIZATION = -O0 OPTIMIZATION = -O0
DEBUGGING = -g DEBUGGING = -g
@@ -37,7 +38,7 @@ ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
DEFINES += -DBIP_DEBUG DEFINES += -DBIP_DEBUG
endif endif
endif endif
CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES) CFLAGS = $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES)
CORE_SRC = \ CORE_SRC = \
$(BACNET_CORE)/apdu.c \ $(BACNET_CORE)/apdu.c \
+2 -2
View File
@@ -31,9 +31,9 @@ SIZE_OPTIONS = -t
# avr109 = bootloader # avr109 = bootloader
#AVRDUDE_PROGRAMMERID = avr109 #AVRDUDE_PROGRAMMERID = avr109
#AVRDUDE_PROGRAMMERID = jtag2fast #AVRDUDE_PROGRAMMERID = jtag2fast
AVRDUDE_PROGRAMMERID = avrispmkII #AVRDUDE_PROGRAMMERID = avrispmkII
#AVRDUDE_PROGRAMMERID = dragon_isp #AVRDUDE_PROGRAMMERID = dragon_isp
#AVRDUDE_PROGRAMMERID = dragon_jtag AVRDUDE_PROGRAMMERID = dragon_jtag
# #
# port--serial or parallel port to which your # port--serial or parallel port to which your
# hardware programmer is attached # hardware programmer is attached
+1
View File
@@ -35,6 +35,7 @@
#include "bacenum.h" #include "bacenum.h"
#include "bacdcode.h" #include "bacdcode.h"
#include "bacdef.h" #include "bacdef.h"
#include "abort.h"
/** @file abort.c Abort Encoding/Decoding */ /** @file abort.c Abort Encoding/Decoding */
/* Helper function to avoid needing additional entries in service data structures /* Helper function to avoid needing additional entries in service data structures
+1
View File
@@ -36,6 +36,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "config.h" #include "config.h"
#include "bacdef.h" #include "bacdef.h"
#include "bacaddr.h"
/** @file bacaddr.c BACnet Address structure utilities */ /** @file bacaddr.c BACnet Address structure utilities */
+1
View File
@@ -35,6 +35,7 @@
#include "bacenum.h" #include "bacenum.h"
#include "bacdcode.h" #include "bacdcode.h"
#include "bacdef.h" #include "bacdef.h"
#include "bacerror.h"
/** @file bacerror.c Encode/Decode BACnet Errors */ /** @file bacerror.c Encode/Decode BACnet Errors */
+1
View File
@@ -37,6 +37,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "config.h" #include "config.h"
#include "bacint.h"
/** @file bacint.c Encode/Decode Integer Types */ /** @file bacint.c Encode/Decode Integer Types */
+1
View File
@@ -35,6 +35,7 @@
#include <stdio.h> #include <stdio.h>
#include "indtext.h" #include "indtext.h"
#include "bacenum.h" #include "bacenum.h"
#include "bactext.h"
/** @file bactext.c Lookup or Translate BACnet Name Text */ /** @file bactext.c Lookup or Translate BACnet Name Text */
+5 -5
View File
@@ -214,7 +214,7 @@ int bvlc_encode_write_bdt_init(
return len; return len;
} }
int bvlc_encode_read_bdt( static int bvlc_encode_read_bdt(
uint8_t * pdu) uint8_t * pdu)
{ {
int len = 0; int len = 0;
@@ -339,7 +339,7 @@ static int bvlc_encode_register_foreign_device(
return len; return len;
} }
int bvlc_encode_read_fdt( static int bvlc_encode_read_fdt(
uint8_t * pdu) uint8_t * pdu)
{ {
int len = 0; int len = 0;
@@ -417,7 +417,7 @@ static int bvlc_encode_read_fdt_ack(
return pdu_len; return pdu_len;
} }
int bvlc_encode_delete_fdt_entry( static int bvlc_encode_delete_fdt_entry(
uint8_t * pdu, uint8_t * pdu,
struct in_addr *address, struct in_addr *address,
uint16_t port) uint16_t port)
@@ -440,7 +440,7 @@ int bvlc_encode_delete_fdt_entry(
return len; return len;
} }
int bvlc_encode_original_unicast_npdu( static int bvlc_encode_original_unicast_npdu(
uint8_t * pdu, uint8_t * pdu,
uint8_t * npdu, uint8_t * npdu,
unsigned npdu_length) unsigned npdu_length)
@@ -466,7 +466,7 @@ int bvlc_encode_original_unicast_npdu(
return len; return len;
} }
int bvlc_encode_original_broadcast_npdu( static int bvlc_encode_original_broadcast_npdu(
uint8_t * pdu, uint8_t * pdu,
uint8_t * npdu, uint8_t * npdu,
unsigned npdu_length) unsigned npdu_length)
+1
View File
@@ -33,6 +33,7 @@
####COPYRIGHTEND####*/ ####COPYRIGHTEND####*/
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "filename.h"
/** @file filename.c Function for filename manipulation */ /** @file filename.c Function for filename manipulation */
+1
View File
@@ -32,6 +32,7 @@
------------------------------------------- -------------------------------------------
####COPYRIGHTEND####*/ ####COPYRIGHTEND####*/
#include <stddef.h> #include <stddef.h>
#include "memcopy.h"
/** @file memcopy.c Custom memcopy function */ /** @file memcopy.c Custom memcopy function */
+1 -1
View File
@@ -40,7 +40,7 @@
/** @file ptransfer.c Encode/Decode Private Transfer data */ /** @file ptransfer.c Encode/Decode Private Transfer data */
/* encode service */ /* encode service */
int pt_encode_apdu( static int pt_encode_apdu(
uint8_t * apdu, uint8_t * apdu,
uint16_t max_apdu, uint16_t max_apdu,
BACNET_PRIVATE_TRANSFER_DATA * private_data) BACNET_PRIVATE_TRANSFER_DATA * private_data)