* portability fixes

* On some arch (win32), backends cannot use exported global variables as initializers


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1443 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Stéphane Fillod, F8CFE 2003-04-16 22:33:18 +00:00
rodzic 960c83c4c5
commit f9c5661564
6 zmienionych plików z 125 dodań i 47 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - API header
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
*
* $Id: rig.h,v 1.78 2003-04-06 18:40:35 fillods Exp $
* $Id: rig.h,v 1.79 2003-04-16 22:33:18 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -26,10 +26,11 @@
#include <hamlib/riglist.h> /* list in another file to not mess up w/ this one */
#include <stdio.h> /* required for FILE definition */
#include <sys/time.h> /* required for struct timeval */
#include <sys/socket.h> /* required for struct sockaddr */
#if defined(__CYGWIN__) || defined(_WIN32)
#include <windows.h> /* HANDLE definition */
#else
#include <sys/socket.h> /* required for struct sockaddr */
#endif
/*! \file rig.h
@ -58,7 +59,7 @@
* that don't understand ANSI C prototypes still work, and ANSI C
* compilers can issue warnings about type mismatches. */
#undef HAMLIB_PARAMS
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN__) || defined(__cplusplus)
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN__) || defined(_WIN32) || defined(__cplusplus)
# define HAMLIB_PARAMS(protos) protos
# define rig_ptr_t void*
#else
@ -1179,7 +1180,10 @@ typedef struct {
int pin; /*!< Parrallel port pin number */
} parallel; /*!< parallel attributes */
struct {
#if defined(__CYGWIN__) || defined(_WIN32)
#else
struct sockaddr saddr; /*!< Dest socket address */
#endif
} network; /*!< Network attributes */
} parm; /*!< Port parameter union */
} port_t;

Wyświetl plik

@ -1,4 +1,4 @@
/* $Id: rig_dll.h,v 1.6 2002-11-14 19:27:34 fillods Exp $ */
/* $Id: rig_dll.h,v 1.7 2003-04-16 22:33:18 fillods Exp $ */
/*
@ -44,18 +44,25 @@
#if defined(__CYGWIN__)
# undef BACKEND_EXPORT_VAR
# undef HAMLIB_IMPEXP
# undef BACKEND_IMPEXP
# undef HAMLIB_API
# undef HAMLIB_EXPORT
# undef HAMLIB_EXPORT_VAR
# undef BACKEND_EXPORT
# undef BACKEND_EXPORT_VAR
# ifdef DLL_EXPORT
# define HAMLIB_API __cdecl
# ifdef IN_HAMLIB
# define BACKEND_EXPORT_VAR(type) __declspec(dllexport) type
# define HAMLIB_EXPORT_VAR(type) __declspec(dllexport) type
# define BACKEND_IMPEXP __declspec(dllexport)
# define HAMLIB_IMPEXP __declspec(dllexport)
# else
# define BACKEND_EXPORT_VAR(type) __declspec(dllimport) type
/* FIXME: HAMLIB_EXPORT_VAR import */
# define BACKEND_IMPEXP __declspec(dllexport)
# define HAMLIB_IMPEXP __declspec(dllimport)
# endif
# else
/* must be static build, no directive */
# define HAMLIB_IMPEXP __declspec(dllimport)
/* must be static build, no directive? */
# endif
#endif
@ -82,3 +89,14 @@
#if !defined(BACKEND_EXPORT_VAR)
# define BACKEND_EXPORT_VAR(type) BACKEND_IMPEXP type
#endif
#ifdef DECLARE_RIG_BACKEND
#undef DECLARE_RIG_BACKEND
#define DECLARE_RIG_BACKEND(backend) extern BACKEND_EXPORT(int) initrigs##API_VER##_##backend(void *be_handle)
#endif
#ifdef DECLARE_PROBERIG_BACKEND
#undef DECLARE_PROBERIG_BACKEND
#define DECLARE_PROBERIG_BACKEND(backend) extern BACKEND_EXPORT(rig_model_t) probeallrigs##API_VER##_##backend(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data)
#endif

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - event handling
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
*
* $Id: event.c,v 1.15 2003-04-02 07:24:28 fillods Exp $
* $Id: event.c,v 1.16 2003-04-16 22:33:18 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -31,7 +31,9 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <fcntl.h>
#include <signal.h>
#include <errno.h>

Wyświetl plik

@ -4,7 +4,7 @@
* Parts of the PTT handling are derived from soundmodem, an excellent
* ham packet softmodem written by Thomas Sailer, HB9JNX.
*
* $Id: serial.c,v 1.29 2003-02-23 22:36:30 fillods Exp $
* $Id: serial.c,v 1.30 2003-04-16 22:33:18 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -35,7 +35,9 @@
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
@ -47,9 +49,11 @@
#ifdef HAVE_TERMIO_H
#include <termio.h>
#else /* sgtty */
#ifdef HAVE_SGTTY_H
#include <sgtty.h>
#endif
#endif
#endif
/* for CTS/RTS and DTR/DSR control under Win32 --SF */
#ifdef HAVE_WINDOWS_H

Wyświetl plik

@ -3,13 +3,13 @@
* \ingroup rig
* \brief CTCSS and DCS interface and tables
* \author Stephane Fillod
* \date 2000-2002
* \date 2000-2003
*/
/*
* Hamlib Interface - CTCSS and DCS interface and tables
* Copyright (c) 2000-2002 by Stephane Fillod
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: tones.c,v 1.3 2002-11-04 22:21:42 fillods Exp $
* $Id: tones.c,v 1.4 2003-04-16 22:33:18 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -31,19 +31,15 @@
#include "config.h"
#endif
#include <hamlib/rig.h>
#include "hamlib/rig.h"
#include "tones.h"
#if !defined(_WIN32) && !defined(__CYGWIN__)
/**
* 52 CTCSS sub-audible tones
*/
const tone_t full_ctcss_list[] = {
600, 670, 693, 719, 744, 770, 797, 825, 854, 885, 915,
948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1200, 1230, 1273,
1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679,
1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995,
2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541,
0,
};
const tone_t full_ctcss_list[] = { FULL_CTCSS_LIST };
/**
* 50 CTCSS sub-audible tones, from 67.0Hz to 254.1Hz
@ -52,30 +48,14 @@ const tone_t full_ctcss_list[] = {
* backends depend on it. If you need to, create a copy for your
* own caps. --SF
*/
const tone_t common_ctcss_list[] = {
670, 693, 719, 744, 770, 797, 825, 854, 885, 915,
948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273,
1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679,
1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995,
2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541,
0,
};
const tone_t common_ctcss_list[] = { COMMON_CTCSS_LIST };
/**
* 106 DCS codes
*/
const tone_t full_dcs_list[] = {
17, 23, 25, 26, 31, 32, 36, 43, 47, 50, 51, 53,
54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131,
132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205,
212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261,
263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343,
346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432,
445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516,
523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654,
662, 664, 703, 712, 723, 731, 732, 734, 743, 754,
0,
};
const tone_t full_dcs_list[] = { FULL_DCS_LIST };
#endif
#ifndef DOC_HIDDEN

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Interface - CTCSS and DCS tables header
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
*
* $Id: tones.h,v 1.1 2001-12-19 03:18:44 fillods Exp $
* $Id: tones.h,v 1.2 2003-04-16 22:33:18 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -23,12 +23,82 @@
#ifndef _TONES_H
#define _TONES_H 1
#include <hamlib/rig.h> /* and implicitly rig_dll.h */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "hamlib/rig.h" /* and implicitly rig_dll.h */
/*
* 52 CTCSS sub-audible tones
*/
#define FULL_CTCSS_LIST \
600, 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, \
948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1200, 1230, 1273, \
1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679, \
1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995, \
2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \
0,
static const tone_t static_full_ctcss_list[] = {
FULL_CTCSS_LIST
};
/*
* 50 CTCSS sub-audible tones, from 67.0Hz to 254.1Hz
*
* \note Don't even think about changing a bit of this array, several
* backends depend on it. If you need to, create a copy for your
* own caps. --SF
*/
#define COMMON_CTCSS_LIST \
670, 693, 719, 744, 770, 797, 825, 854, 885, 915, \
948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, \
1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679, \
1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995, \
2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \
0,
static const tone_t static_common_ctcss_list[] = {
COMMON_CTCSS_LIST
};
/*
* 106 DCS codes
*/
#define FULL_DCS_LIST \
17, 23, 25, 26, 31, 32, 36, 43, 47, 50, 51, 53, \
54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, \
132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, \
212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, \
263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, \
346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, \
445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, \
523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, \
662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \
0,
static const tone_t static_full_dcs_list[] = {
FULL_DCS_LIST
};
/*
* These arrays cannot be shared on Win32 systems,
* because DLL's vars don't have constant address.
*/
#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(DLL_EXPORT) && !defined(IN_HAMLIB)
#error tones.h
#define common_ctcss_list static_common_ctcss_list
#define full_ctcss_list static_full_ctcss_list
#define full_dcs_list static_full_dcs_list
#else
extern const HAMLIB_EXPORT_VAR(tone_t) full_ctcss_list[];
extern const HAMLIB_EXPORT_VAR(tone_t) common_ctcss_list[];
extern const HAMLIB_EXPORT_VAR(tone_t) full_dcs_list[];
#endif
#endif /* _TONES_H */