changed c++ comments to c comments using comment.sh script.

This commit is contained in:
skarg
2006-02-19 01:33:30 +00:00
parent dee63d45bc
commit b686fa7ca7
34 changed files with 975 additions and 1030 deletions
+8 -8
View File
@@ -37,8 +37,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h> // for standard integer types uint8_t etc.
#include <stdbool.h> // for the standard bool type.
#include <stdint.h> /* for standard integer types uint8_t etc. */
#include <stdbool.h> /* for the standard bool type. */
#include "bacdcode.h"
#include "bip.h"
#include "net.h"
@@ -102,7 +102,7 @@ void bip_set_interface(char *ifname)
bool bip_init(void)
{
int rv = 0; // return from socket lib calls
int rv = 0; /* return from socket lib calls */
struct sockaddr_in sin = { -1 };
int value = 1;
int sock_fd = -1;
@@ -112,7 +112,7 @@ bool bip_init(void)
struct in_addr address;
Result = WSAStartup((1 << 8) | 1, &wd);
//Result = WSAStartup(MAKEWORD(2,2), &wd);
/*Result = WSAStartup(MAKEWORD(2,2), &wd); */
if (Result != 0) {
Code = WSAGetLastError();
printf("TCP/IP stack initialization failed, error code: %i\n",
@@ -140,8 +140,8 @@ bool bip_init(void)
fprintf(stderr, "bip: failed to allocate a socket.\n");
return false;
}
// Allow us to use the same socket for sending and receiving
// This makes sure that the src port is correct when sending
/* Allow us to use the same socket for sending and receiving */
/* This makes sure that the src port is correct when sending */
rv = setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR,
(char *) &value, sizeof(value));
if (rv < 0) {
@@ -150,7 +150,7 @@ bool bip_init(void)
bip_set_socket(-1);
return false;
}
// allow us to send a broadcast
/* allow us to send a broadcast */
rv = setsockopt(sock_fd, SOL_SOCKET, SO_BROADCAST,
(char *) &value, sizeof(value));
if (rv < 0) {
@@ -159,7 +159,7 @@ bool bip_init(void)
bip_set_socket(-1);
return false;
}
// bind the socket to the local port number and IP address
/* bind the socket to the local port number and IP address */
sin.sin_family = AF_INET;
#if USE_INADDR
/* by setting sin.sin_addr.s_addr to INADDR_ANY,
+21 -21
View File
@@ -23,8 +23,8 @@
*
*********************************************************************/
// This is one way to use the embedded BACnet stack under Win32
// compiled with Borland C++ 5.02 or Visual C++ 6.0
/* This is one way to use the embedded BACnet stack under Win32 */
/* compiled with Borland C++ 5.02 or Visual C++ 6.0 */
#include <winsock2.h>
#include <stddef.h>
#include <stdint.h>
@@ -42,7 +42,7 @@
#include "datalink.h"
#include "txbuf.h"
// buffer used for receive
/* buffer used for receive */
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
/* send a whois to see who is on the network */
@@ -102,7 +102,7 @@ static void Read_Properties(void)
if (object_props[property] < 0)
next_device = true;
else {
status = Send_Read_Property_Request(device_id, // destination device
status = Send_Read_Property_Request(device_id, /* destination device */
OBJECT_DEVICE,
device_id, object_props[property], BACNET_ARRAY_ALL);
if (status)
@@ -147,29 +147,29 @@ static void LocalIAmHandler(uint8_t * service_request,
static void Init_Service_Handlers(void)
{
// we need to handle who-is to support dynamic device binding
/* we need to handle who-is to support dynamic device binding */
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS,
handler_who_is);
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM,
LocalIAmHandler);
// set the handler for all the services we don't implement
// It is required to send the proper reject message...
/* set the handler for all the services we don't implement */
/* It is required to send the proper reject message... */
apdu_set_unrecognized_service_handler_handler
(handler_unrecognized_service);
// we must implement read property - it's required!
/* we must implement read property - it's required! */
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
handler_read_property);
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
handler_write_property);
// handle the data coming back from confirmed requests
/* handle the data coming back from confirmed requests */
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
handler_read_property_ack);
}
static void print_address(char *name, BACNET_ADDRESS * dest) // destination address
{
int i = 0; // counter
static void print_address(char *name, BACNET_ADDRESS * dest)
{ /* destination address */
int i = 0; /* counter */
if (dest) {
printf("%s: ", name);
@@ -203,16 +203,16 @@ static void print_address_cache(void)
int main(int argc, char *argv[])
{
BACNET_ADDRESS src = { 0 }; // address where message came from
BACNET_ADDRESS src = { 0 }; /* address where message came from */
uint16_t pdu_len = 0;
unsigned timeout = 100; // milliseconds
unsigned timeout = 100; /* milliseconds */
BACNET_ADDRESS my_address, broadcast_address;
(void) argc;
(void) argv;
Device_Set_Object_Instance_Number(124);
Init_Service_Handlers();
// init the data link layer
/* init the data link layer */
/* configure standard BACnet/IP port */
bip_set_port(0xBAC0);
if (!bip_init())
@@ -224,14 +224,14 @@ int main(int argc, char *argv[])
print_address("Address", &my_address);
printf("BACnet stack running...\n");
// loop forever
/* loop forever */
for (;;) {
// input
/* input */
// returns 0 bytes on timeout
/* returns 0 bytes on timeout */
pdu_len = bip_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
// process
/* process */
if (pdu_len) {
npdu_handler(&src, &Rx_Buf[0], pdu_len);
@@ -246,9 +246,9 @@ int main(int argc, char *argv[])
Read_Properties();
}
// output
/* output */
// blink LEDs, Turn on or off outputs, etc
/* blink LEDs, Turn on or off outputs, etc */
/* wait for ESC from keyboard before quitting */
if (kbhit() && (getch() == 0x1B))
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef STDBOOL_H
#define STDBOOL_H
// C99 Boolean types for compilers without C99 support
/* C99 Boolean types for compilers without C99 support */
#ifndef __cplusplus
typedef int _Bool;
+12 -12
View File
@@ -1,19 +1,19 @@
// Defines the standard integer types that are used in code
// for the x86 processor and Borland Compiler
/* Defines the standard integer types that are used in code */
/* for the x86 processor and Borland Compiler */
#ifndef STDINT_H
#define STDINT_H
#include <stddef.h>
typedef unsigned char uint8_t; // 1 byte 0 to 255
typedef signed char int8_t; // 1 byte -127 to 127
typedef unsigned short uint16_t; // 2 bytes 0 to 65535
typedef signed short int16_t; // 2 bytes -32767 to 32767
//typedef unsigned short long uint24_t; // 3 bytes 0 to 16777215
typedef unsigned long uint32_t; // 4 bytes 0 to 4294967295
typedef signed long int32_t; // 4 bytes -2147483647 to 2147483647
// typedef signed long long int64_t;
// typedef unsigned long long uint64_t;
typedef unsigned char uint8_t; /* 1 byte 0 to 255 */
typedef signed char int8_t; /* 1 byte -127 to 127 */
typedef unsigned short uint16_t; /* 2 bytes 0 to 65535 */
typedef signed short int16_t; /* 2 bytes -32767 to 32767 */
/*typedef unsigned short long uint24_t; // 3 bytes 0 to 16777215 */
typedef unsigned long uint32_t; /* 4 bytes 0 to 4294967295 */
typedef signed long int32_t; /* 4 bytes -2147483647 to 2147483647 */
/* typedef signed long long int64_t; */
/* typedef unsigned long long uint64_t; */
#endif // STDINT_H
#endif /* STDINT_H */