[Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/sf serialsource.c, 1.3, 1.4

David Gay idgay at users.sourceforge.net
Fri Dec 5 16:04:34 PST 2008


Update of /cvsroot/tinyos/tinyos-2.x/support/sdk/c/sf
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13598

Modified Files:
	serialsource.c 
Log Message:
fix cygwinland

Index: serialsource.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/support/sdk/c/sf/serialsource.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** serialsource.c	19 Sep 2008 19:36:23 -0000	1.3
--- serialsource.c	6 Dec 2008 00:04:32 -0000	1.4
***************
*** 1,3 ****
! #ifndef _WIN32
  #include <sys/types.h>
  #include <sys/stat.h>
--- 1,8 ----
! #if defined(_WIN32) && !defined(__CYGWIN__)
! /* Avoid confusing windows w/o cygwin w/ cygwin */
! #define LOSE32
! #endif
! 
! #ifndef LOSE32
  #include <sys/types.h>
  #include <sys/stat.h>
***************
*** 19,23 ****
  #endif
  
! #ifdef _WIN32
  #include <windows.h>
  #include <stdint.h>
--- 24,28 ----
  #endif
  
! #ifdef LOSE32
  #include <windows.h>
  #include <stdint.h>
***************
*** 36,40 ****
  enum {
  #ifndef __CYGWIN__
! #ifndef _WIN32
    FALSE = 0,
    TRUE = 1,
--- 41,45 ----
  enum {
  #ifndef __CYGWIN__
! #ifndef LOSE32
    FALSE = 0,
    TRUE = 1,
***************
*** 61,65 ****
  
  struct serial_source_t {
! #ifndef _WIN32
    int fd;
  #else
--- 66,70 ----
  
  struct serial_source_t {
! #ifndef LOSE32
    int fd;
  #else
***************
*** 86,90 ****
  };
  
! #ifndef _WIN32
  static tcflag_t parse_baudrate(int requested)
  {
--- 91,95 ----
  };
  
! #ifndef LOSE32
  static tcflag_t parse_baudrate(int requested)
  {
***************
*** 210,214 ****
  static int serial_read(serial_source src, int non_blocking, void *buffer, int n)
  {
! #ifndef _WIN32
    fd_set fds;
    int cnt;
--- 215,219 ----
  static int serial_read(serial_source src, int non_blocking, void *buffer, int n)
  {
! #ifndef LOSE32
    fd_set fds;
    int cnt;
***************
*** 242,246 ****
  	  return cnt;
        }
! #else // _WIN32
    int cnt;
  
--- 247,251 ----
  	  return cnt;
        }
! #else // LOSE32
    int cnt;
  
***************
*** 278,282 ****
   */
  {
! #ifndef _WIN32
    struct termios newtio;
    int fd;
--- 283,287 ----
   */
  {
! #ifndef LOSE32
    struct termios newtio;
    int fd;
***************
*** 330,334 ****
  
    return NULL;
! #else // _WIN32
  	LPCTSTR       ComName = (LPCTSTR)device;
      HANDLE        hComm;
--- 335,339 ----
  
    return NULL;
! #else // LOSE32
  	LPCTSTR       ComName = (LPCTSTR)device;
      HANDLE        hComm;
***************
*** 372,379 ****
  	return src;
  
! #endif // _WIN32
  }
  
! #ifndef _WIN32
  int serial_source_fd(serial_source src)
  /* Returns: the file descriptor used by serial source src (useful when
--- 377,384 ----
  	return src;
  
! #endif // LOSE32
  }
  
! #ifndef LOSE32
  int serial_source_fd(serial_source src)
  /* Returns: the file descriptor used by serial source src (useful when
***************
*** 385,389 ****
  #endif
  
! #ifdef _WIN32
  HANDLE serial_source_handle(serial_source src)
  /* Returns: the file descriptor used by serial source src (useful when
--- 390,394 ----
  #endif
  
! #ifdef LOSE32
  HANDLE serial_source_handle(serial_source src)
  /* Returns: the file descriptor used by serial source src (useful when
***************
*** 401,405 ****
   */
  {
! #ifndef _WIN32
    int ok = close(src->fd);
  #else
--- 406,410 ----
   */
  {
! #ifndef LOSE32
    int ok = close(src->fd);
  #else
***************
*** 418,422 ****
  */
  {
! #ifndef _WIN32
    struct timeval tv;
    fd_set fds;
--- 423,427 ----
  */
  {
! #ifndef LOSE32
    struct timeval tv;
    fd_set fds;
***************
*** 456,460 ****
        return 0;
      }
! #else // _WIN32
      // FIXME: the deadline is ignored here
  
--- 461,465 ----
        return 0;
      }
! #else // LOSE32
      // FIXME: the deadline is ignored here
  
***************
*** 472,476 ****
  static int source_write(serial_source src, const void *buffer, int count)
  {
! #ifndef _WIN32
    int actual = 0;
  
--- 477,481 ----
  static int source_write(serial_source src, const void *buffer, int count)
  {
! #ifndef LOSE32
    int actual = 0;
  
***************
*** 503,507 ****
      }
    return actual;
! #else // _WIN32
      int actual = 0;
      int n;
--- 508,512 ----
      }
    return actual;
! #else // LOSE32
      int actual = 0;
      int n;
***************
*** 628,632 ****
  	      break;
  	    }
! #ifndef _WIN32
  	  if (errno == EAGAIN)
  	    return -1;
--- 633,637 ----
  	      break;
  	    }
! #ifndef LOSE32
  	  if (errno == EAGAIN)
  	    return -1;
***************
*** 896,900 ****
    // FIXME: the WIN32 implementation of source_wait()
    //        disregards the deadline parameter anyway
! #ifndef _WIN32
    gettimeofday(&deadline, NULL);
    add_timeval(&deadline, ACK_TIMEOUT);
--- 901,905 ----
    // FIXME: the WIN32 implementation of source_wait()
    //        disregards the deadline parameter anyway
! #ifndef LOSE32
    gettimeofday(&deadline, NULL);
    add_timeval(&deadline, ACK_TIMEOUT);



More information about the Tinyos-2-commits mailing list