提交 282a1885 authored 作者: Giovanni Maruzzelli's avatar Giovanni Maruzzelli

gsmopen: adding libctb-0.16

上级 fc4c6157
Copyright
Copyright (C) 1999-2010 Joachim Buermann (jbuermann@iftools.com)
ctb is free software; you can redistribute it and/or modify it under
the term of the GNU Library General Public Licence as published by the
Free Software Foundation.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public Licence for more details
EXCEPTION NOTICE
As a special exception, you may use, copy, link, modify and distribute
under the user's own terms, binary object code versions of works based
on the library.
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.5 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# 'install' program location
INSTALL ?= install
# Location where the package is installed by 'make install'
prefix ?= /usr/local
# Destination root (/ is used if empty)
DESTDIR ?=
#
AR ?= ar
#
RANLIB ?= ranlib
# Compiler flags to link shared library
LINK_DLL_FLAGS ?= -shared
# C++ compiler
CXX = g++
# Standard flags for C++
CXXFLAGS ?=
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=
# Standard linker flags
LDFLAGS ?=
# Set to 1 to build debug version [0,1]
DEBUG ?= 0
#
GPIB ?= 0
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
CPPDEPS = -MT$@ -MF`echo $@ | sed -e 's,\.o$$,.d,'` -MD -MP
CTB_LIB_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -D_THREAD_SAFE -pthread \
$(__OPTIMIZE_FLAG) -I../include $(CPPFLAGS) $(CXXFLAGS)
CTB_LIB_OBJECTS = \
$(OUTPUT)/ctb_lib_fifo.o \
$(OUTPUT)/ctb_lib_getopt.o \
$(OUTPUT)/ctb_lib_iobase.o \
$(OUTPUT)/ctb_lib_portscan.o \
$(OUTPUT)/ctb_lib_serportx.o \
$(OUTPUT)/ctb_lib_serport.o \
$(OUTPUT)/ctb_lib_timer.o \
$(__GPIBSRC_OBJECTS)
CTB_DLL_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -D_THREAD_SAFE -pthread \
$(__OPTIMIZE_FLAG) -I../include -fPIC -DPIC $(CPPFLAGS) $(CXXFLAGS)
CTB_DLL_OBJECTS = \
$(OUTPUT)/ctb_dll_fifo.o \
$(OUTPUT)/ctb_dll_getopt.o \
$(OUTPUT)/ctb_dll_iobase.o \
$(OUTPUT)/ctb_dll_portscan.o \
$(OUTPUT)/ctb_dll_serportx.o \
$(OUTPUT)/ctb_dll_serport.o \
$(OUTPUT)/ctb_dll_timer.o \
$(__GPIBSRC_OBJECTS_1)
CTBTEST_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -DGPIB=$(GPIB) -D_THREAD_SAFE \
-pthread $(__OPTIMIZE_FLAG) -I../include $(CPPFLAGS) $(CXXFLAGS)
CTBTEST_OBJECTS = \
$(OUTPUT)/ctbtest_ctbtest.o
### Conditionally set variables: ###
ifeq ($(DEBUG),0)
OUTPUT = release
endif
ifeq ($(DEBUG),1)
OUTPUT = debug
endif
ifeq ($(DEBUG),1)
LIBFLAG = d
endif
ifeq ($(GPIB),1)
GPIBFLAG = _gpib
endif
ifeq ($(GPIB),1)
GPIBINC = gpib.h
endif
ifeq ($(GPIB),1)
__GPIBSRC_OBJECTS = \
$(OUTPUT)/ctb_lib_gpib.o
endif
ifeq ($(GPIB),1)
__GPIBSRC_OBJECTS_1 = \
$(OUTPUT)/ctb_dll_gpib.o
endif
ifeq ($(DEBUG),0)
____DEBUG = -DNDEBUG
endif
ifeq ($(DEBUG),1)
____DEBUG =
endif
ifeq ($(DEBUG),0)
__OPTIMIZE_FLAG = -O0
endif
ifeq ($(DEBUG),1)
__OPTIMIZE_FLAG = -O2
endif
ifeq ($(GPIB),1)
__SYSLIB2_p = -lgpib
endif
ifeq ($(DEBUG),0)
____DEBUG_1 =
endif
ifeq ($(DEBUG),1)
____DEBUG_1 = -g
endif
all: $(OUTPUT)
$(OUTPUT):
@mkdir -p $(OUTPUT)
### Targets: ###
all: ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so $(OUTPUT)/ctbtest tip-linux
install: install_ctb_lib install_ctb_dll
$(INSTALL) -d $(DESTDIR)$(prefix)/include/ctb-0.16
for f in ctb.h fifo.h getopt.h $(GPIBINC) iobase.h linux/serport.h linux/timer.h portscan.h serport.h serportx.h timer.h; do \
if test ! -d $(DESTDIR)$(prefix)/include/ctb-0.16/`dirname $$f` ; then \
$(INSTALL) -d $(DESTDIR)$(prefix)/include/ctb-0.16/`dirname $$f`; \
fi; \
$(INSTALL) -m 644 ../include/ctb-0.16/$$f $(DESTDIR)$(prefix)/include/ctb-0.16/$$f; \
done
uninstall: uninstall_ctb_lib uninstall_ctb_dll
for f in ctb.h fifo.h getopt.h $(GPIBINC) iobase.h linux/serport.h linux/timer.h portscan.h serport.h serportx.h timer.h; do \
rm -f $(DESTDIR)$(prefix)/include/ctb-0.16/$$f; \
done
clean:
rm -f $(OUTPUT)/*.o
rm -f $(OUTPUT)/*.d
rm -f ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a
rm -f ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so
rm -f ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so
rm -f $(OUTPUT)/ctbtest
htmldoc:
(cd ..; tar -cvzf manual/libctb-0.16-htmldoc.tar.gz docs/html/ )
tarball:
(cd ../..; tar -cvzf libctb-0.16.tar.gz \
libctb-0.16/build/ \
libctb-0.16/manual/refman.pdf \
libctb-0.16/include \
libctb-0.16/python \
libctb-0.16/samples \
libctb-0.16/src \
libctb-0.16/lib/gpib32.lib \
--exclude=release \
--exclude=debug \
--exclude=install \
--exclude=output \
--exclude=website \
--exclude=*~ \
--exclude=buildall.sh \
--exclude=buildall.bat \
--exclude=version-update.sh \
--exclude=libctb-0.16.tar.gz \
--exclude=*.ilk \
--exclude=*.log \
--exclude=*.o* \
--exclude=*.pdb \
--exclude=*.pyc \
--exclude=.svn; mv libctb-0.16.tar.gz libctb-0.16/build )
../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a: $(CTB_LIB_OBJECTS)
rm -f $@
$(AR) rcu $@ $(CTB_LIB_OBJECTS)
$(RANLIB) $@
install_ctb_lib: ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a
$(INSTALL) -d $(DESTDIR)$(prefix)/lib
$(INSTALL) -m 644 ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a $(DESTDIR)$(prefix)/lib
uninstall_ctb_lib:
rm -f $(DESTDIR)$(prefix)/lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a
../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so: $(CTB_DLL_OBJECTS)
$(CXX) $(LINK_DLL_FLAGS) -fPIC -o $@ $(CTB_DLL_OBJECTS) $(____DEBUG_1) -pthread -L../lib $(LDFLAGS) -lpthread $(__SYSLIB2_p)
install_ctb_dll: ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so
$(INSTALL) -d $(DESTDIR)$(prefix)/lib
$(INSTALL) -m 644 ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so $(DESTDIR)$(prefix)/lib
install -c ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so $(DESTDIR)$(prefix)/lib
uninstall_ctb_dll:
rm -f $(DESTDIR)$(prefix)/lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so
rm -f $(DESTDIR)$(prefix)/lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so
$(OUTPUT)/ctbtest: $(CTBTEST_OBJECTS) ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a
$(CXX) -o $@ $(CTBTEST_OBJECTS) $(____DEBUG_1) -pthread -L../lib $(LDFLAGS) ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a -lpthread $(__SYSLIB2_p)
tip-linux:
@echo " "
@echo "================================================================"
@echo " The building of ctb is finished. On Linux you'll now"
@echo " have to run (as root):"
@echo " "
@echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) install"
@echo " "
@echo " to install the libraries in $(prefix)/lib"
@echo " and the header files in $(prefix)/include/ctb-0.16"
@echo " "
@echo " Don't forget to run ldconfig (also as root)"
@echo " "
@echo " ctb comes with no guarantees and doesn't claim"
@echo " to be suitable for any purpose."
@echo "================================================================"
@echo " "
$(OUTPUT)/ctb_lib_fifo.o: ./../src/fifo.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_lib_getopt.o: ./../src/getopt.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_lib_iobase.o: ./../src/iobase.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_lib_portscan.o: ./../src/portscan.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_lib_serportx.o: ./../src/serportx.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_lib_serport.o: ./../src/linux/serport.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_lib_timer.o: ./../src/linux/timer.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_lib_gpib.o: ./../src/gpib.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_fifo.o: ./../src/fifo.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_getopt.o: ./../src/getopt.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_iobase.o: ./../src/iobase.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_portscan.o: ./../src/portscan.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_serportx.o: ./../src/serportx.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_serport.o: ./../src/linux/serport.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_timer.o: ./../src/linux/timer.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctb_dll_gpib.o: ./../src/gpib.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)/ctbtest_ctbtest.o: ./../samples/ctbtest.cpp
$(CXX) -c -o $@ $(CTBTEST_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all install uninstall clean install_ctb_lib uninstall_ctb_lib \
install_ctb_dll uninstall_ctb_dll
# Dependencies tracking:
-include $(OUTPUT)/*.d
CTB (Communication toolbox library) 08.02.2010
======================================================================
Website: http://www.iftools.com/opensource/ctb.en.php
Version: 0.16
Linux GCC compiliation
----------------------------------------------------------------
Type 'make DEBUG=x GPIB=x' or 'make -f GNUmakefile DEBUG=x GPIB=x'
Type the same command with an additional install as root to copy the
headers and libs to there according system places
(i.e. /usr/local/include/ctb-0.16 and /usr/local/lib/libctb-0.16.a)
like:
sudo make DEBUG=x GPIB=x install
Microsoft MingW32 compilation
----------------------------------------------------------------
Type mingw32-make -f makefile.gcc DEBUG=x GPIB=x
Please note! Currently only a shared ctb library will be created.
You have to copy the ctb-VERSION.dll in the application path of
your application linked with ctb or in a global dll folder (but
not recommented!)
Microsoft Visual C++ compilation
----------------------------------------------------------------
Type 'nmake -f makefile.vc DEBUG=x GPIB=x'
To create all libs (debug/release with and without gpib support)
just input: ./buildall.bat in the build folder.
Borland C++ 5.0/5.5 compilation
----------------------------------------------------------------
Type 'make -f makefile.bcc DEBUG=x GPIB=x'
Watcom C++ 10.6/11 and OpenWatcom compilation
----------------------------------------------------------------
Type 'wmake -f makefile.wat'
Python support
--------------
Since version 0.9 ctb also includes a python module ctb.py.
To build the python module by yourself, your system has to satisfy
the following requirements:
- the SWIG program, you get it at http://www.swig.org/ (for linux,
take a look in your favorite distribution package manager).
The current ctb module was build with SWIG version 1.3.29 (linux)
and version 1.3.40 (Windows)
- the develop files for python (means the header and the library
files). I tested it with Python 2.4. You will get it at:
http://www.python.org/ftp/python/2.4.4/python-2.4.4.msi
- if you want to communicate via GPIB, a GPIB installation (GPIB
controller and software, for instance a Nation Instruments or
Keithley card). On Linux the libgpib.
Like the building of the wxctb C++ library, you also can choose
between GPIB and non GPIB (default) support.
Compile the python module
Linux
cd in the python/src/linux folder and type:
./makepy.sh USE_GPIB
or
./makepy.sh
if you don't need any GPIB support
Windows
cd in the python/src/windows folder. Open the makepy.bat with your
favorite editor and set the commented enviroment variables. See the
makepy.bat file for more information, how you can do that.
After that, just type:
./makepy.sh USE_GPIB
(for GPIB support) or
./makepy.sh
if you don't need any GPIB support
At last set the python modul path to the ctb-0.15/python/module
path.
On linux:
export PYTHONPATH=somepath/ctb-0.15/python/module/linux
On Windows:
set PYTHONPATH=drive:\somepath\ctb-0.15\python\module\win32
ChangeLog
---------
0.16
- added port scan function.
- bug fixes for MingW build.
0.15
- added ctb namespace and removed all wx prefix (also in the header
path).
- Linux: A serial port cannot opened twice or more any longer.
- 9 bit data transmission support using the parity bit as ninth bit.
- improved documentation
- Some more documentation
0.14
- Support for non-standard baudrates (depends on the used UART
or USB to RS232 converter.
0.13
- remove the expect and match mechanism. They didn't work very
well, and a future implementation should be done as a
independent library. If someone missed this functions, please
let me know.
0.12
- more documentation for doxygen
- replace the ugly GetSettingsAsString methods by a more intuitive
one.
- wxGPIB::Read now checks the MAV bit before reading. This resolves
some stderr stuff on linux.
0.11
- the gpib sources are no longer depending on the OS. They are
identical for linux and windows.
- add the current version to the ctb include path, so you can
handle a parallel installation of different versions.
For instance: The header path wx/ctb is replaced by wx/ctb-0.11
0.10
- replace the former gpib async io access with the standard
NI-488 functions (ibrd,ibwrt). To avoid blocking, the internal
gpib timeout was set to the lowest value, whereas the wxIOBase
methods handles the timeout in a global and transparent manner.
- add a FindListener method in the wxGPIB class to look for all
connected gpib devices (listeners).
- The Read and Readv method of the python wxIOBase class returns
additional zero bytes, fixed.
0.9
- added python support for both, serial and gpib
0.8
- added bakefile support
0.7
- added GPIB (Nation Instruments GPIB cards) support
Authors' info
-------------
Joachim Buermann jbuermann@iftools.com
<?xml version="1.0" ?>
<makefile>
<requires version="0.1.1"/>
<include file="presets/simple.bkl"/>
<using module="datafiles"/>
<!-- default is NO GPIB support, you can change this by -->
<!-- calling make with the Option GPIB=1 -->
<option name="GPIB">
<default-value>0</default-value>
</option>
<!-- the actual ctb library version -->
<set var="VERSION">0.16</set>
<set var="NAME">libctb</set>
<!-- The directory where wxWidgets is installed: -->
<set var="ENV_VAR">
<if cond="FORMAT=='watcom'">%</if>
<if cond="FORMAT!='watcom'"></if>
</set>
<option name="WXDIR">
<default-value>$(DOLLAR)($(ENV_VAR)WXWIN)</default-value>
</option>
<option name="INSTALLDIR">
<default-value>$(DOLLAR)($(ENV_VAR)WXWIN)</default-value>
</option>
<!-- the output of the compiler/linker will be put in a release -->
<!-- or debug folder! -->
<set var="OUTPUT">
<if cond="DEBUG=='1'">debug</if>
<if cond="DEBUG=='0'">release</if>
</set>
<set var="BUILDDIR">$(OUTPUT)</set>
<set var="INSTALLDIR">
<if cond="PLATFORM_WIN32=='1' and WXDIR==''">..$(DIRSEP)lib</if>
</set>
<!-- set the library name dependent on debug/gpib support -->
<set var="LIBFLAG">
<if cond="DEBUG=='1'">d</if>
</set>
<set var="SYSLIB1">
<if cond="PLATFORM_UNIX=='1'">pthread</if>
<if cond="PLATFORM_WIN32=='1'">winmm</if>
</set>
<set var="SYSLIB2">
<if cond="PLATFORM_UNIX=='1' and GPIB=='1'">gpib</if>
<if cond="PLATFORM_WIN32=='1' and GPIB=='1'">gpib32</if>
</set>
<set var="OS">
<if cond="PLATFORM_UNIX=='1'">linux</if>
<if cond="PLATFORM_WIN32=='1'">win32</if>
</set>
<set var="GPIBFLAG">
<if cond="GPIB=='1'">_gpib</if>
</set>
<set var="GPIBSRC">
<if cond="GPIB=='1'">
../src/gpib.cpp
</if>
</set>
<set var="GPIBINC">
<if cond="GPIB=='1'">
gpib.h
</if>
</set>
<set var="OPTIMIZE_FLAG">
<if cond="DEBUG=='0'">off</if>
<if cond="DEBUG=='1'">speed</if>
</set>
<set var="FILES">
../src/fifo.cpp
../src/getopt.cpp
../src/iobase.cpp
../src/portscan.cpp
../src/serportx.cpp
../src/$(OS)/serport.cpp
../src/$(OS)/timer.cpp
</set>
<define-tag name="run-htmldoc" rules="action">
<command>
(cd ..; tar -cvzf manual/$(value) docs/html/ )
</command>
</define-tag>
<if cond="PLATFORM_UNIX=='1'">
<action id="htmldoc">
<run-htmldoc>$(NAME)-$(VERSION)-htmldoc.tar.gz</run-htmldoc>
</action>
</if>
<define-tag name="run-tarball" rules="action">
<command>
(cd ../..; tar -cvzf $(value) \
$(NAME)-$(VERSION)/build/ \
$(NAME)-$(VERSION)/manual/refman.pdf \
$(NAME)-$(VERSION)/include \
$(NAME)-$(VERSION)/python \
$(NAME)-$(VERSION)/samples \
$(NAME)-$(VERSION)/src \
$(NAME)-$(VERSION)/lib/gpib32.lib \
--exclude=release \
--exclude=debug \
--exclude=install \
--exclude=output \
--exclude=website \
--exclude=*~ \
--exclude=buildall.sh \
--exclude=buildall.bat \
--exclude=g++.sh \
--exclude=version-update.sh \
--exclude=$(value) \
--exclude=*.ilk \
--exclude=*.log \
--exclude=*.o* \
--exclude=*.pdb \
--exclude=*.pyc \
--exclude=.svn; mv $(value) $(NAME)-$(VERSION)/build )
</command>
</define-tag>
<if cond="PLATFORM_UNIX=='1'">
<action id="tarball">
<run-tarball>$(NAME)-$(VERSION).tar.gz</run-tarball>
</action>
</if>
<!-- This is only for UNIX like OS -->
<data-files-tree id="install-headers">
<srcdir>..$(DIRSEP)include$(DIRSEP)ctb-$(VERSION)</srcdir>
<files>
ctb.h
fifo.h
getopt.h
$(GPIBINC)
iobase.h
linux/serport.h
linux/timer.h
portscan.h
serport.h
serportx.h
timer.h
</files>
<install-to>$(INCLUDEDIR)$(DIRSEP)ctb-$(VERSION)</install-to>
</data-files-tree>
<lib id="ctb_lib" template="simple">
<dirname>../lib</dirname>
<libname>ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION)</libname>
<!-- for /MT -->
<threading>multi</threading>
<runtime-libs>static</runtime-libs>
<optimize>$(OPTIMIZE_FLAG)</optimize>
<sources>
$(FILES)
$(GPIBSRC)
</sources>
<lib-path>../lib</lib-path>
<sys-lib>$(SYSLIB1)</sys-lib>
<sys-lib>$(SYSLIB2)</sys-lib>
<include>../include</include>
<install-to>$(LIBDIR)</install-to>
</lib>
<dll id="ctb_dll" template="simple">
<dirname>../lib</dirname>
<threading>multi</threading>
<dllname>ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION)</dllname>
<runtime-libs>static</runtime-libs>
<optimize>$(OPTIMIZE_FLAG)</optimize>
<libname>ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION)</libname>
<sources>
$(FILES)
$(GPIBSRC)
</sources>
<lib-path>../lib</lib-path>
<sys-lib>$(SYSLIB1)</sys-lib>
<sys-lib>$(SYSLIB2)</sys-lib>
<include>../include</include>
<install-to>$(LIBDIR)</install-to>
</dll>
<!-- The sample of ctb -->
<!-- ==================== -->
<exe id="ctbtest" template="simple">
<define>GPIB=$(GPIB)</define>
<threading>multi</threading>
<runtime-libs>static</runtime-libs>
<optimize>$(OPTIMIZE_FLAG)</optimize>
<sources>
../samples/ctbtest.cpp
</sources>
<include>../include</include>
<lib-path>../lib</lib-path>
<library>ctb_lib</library>
<sys-lib>$(SYSLIB1)</sys-lib>
<sys-lib>$(SYSLIB2)</sys-lib>
</exe>
<set var="LIBNAME">
<if cond="FORMAT=='msvc'">vc</if>
<if cond="FORMAT!='msvc'">$(FORMAT)</if>
</set>
<action id="wxinstall" cond="PLATFORM_WIN32=='1'">
<command>
<!-- create the lib directory if it doesn't exist -->
@if not exist $(INSTALLDIR)\lib\$(LIBNAME)_lib mkdir $(INSTALLDIR)\lib\$(LIBNAME)_lib
<!-- copy the libraries (lib,dll) -->
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION).lib $(INSTALLDIR)\lib\$(LIBNAME)_lib
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION).dll $(INSTALLDIR)\lib\$(LIBNAME)_lib
<!-- copy the header files -->
@if not exist $(INSTALLDIR)\include\ctb-$(VERSION)\win32 mkdir $(INSTALLDIR)\include\ctb-$(VERSION)\win32
@copy ..\include\ctb-$(VERSION)\*.h $(INSTALLDIR)\include\ctb-$(VERSION)
@copy ..\include\ctb-$(VERSION)\win32\*.h $(INSTALLDIR)\include\ctb-$(VERSION)\win32
</command>
</action>
<action id="tip-linux" cond="PLATFORM_UNIX=='1'">
<dependency-of>all</dependency-of>
<command>
@echo " "
@echo "================================================================"
@echo " The building of ctb is finished. On Linux you'll now"
@echo " have to run (as root):"
@echo " "
@echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) install"
@echo " "
@echo " to install the libraries in $(LIBDIR)"
@echo " and the header files in $(INCLUDEDIR)/ctb-$(VERSION)"
@echo " "
@echo " Don't forget to run ldconfig (also as root)"
@echo " "
@echo " ctb comes with no guarantees and doesn't claim"
@echo " to be suitable for any purpose."
@echo "================================================================"
@echo " "
</command>
</action>
<action id="tip-win32" cond="PLATFORM_WIN32=='1'">
<dependency-of>all</dependency-of>
<command>
@echo " "
@echo "================================================================"
@echo " The building of ctb is finished. If you have an installed "
@echo " wxWidget package (WXWIN must be defined in the enviroment), "
@echo " you'll now have to run: "
@echo " "
@echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall "
@echo " "
@echo " to install the libraries in: "
@echo " $(INSTALLDIR)$(DIRSEP)lib$(DIRSEP)$(LIBNAME)_lib "
@echo " and the header files in"
@echo " $(INSTALLDIR)$(DIRSEP)ctb-$(VERSION)"
@echo " "
@echo " If you are using another compiler (Borland, Watcom, mingw,...) "
@echo " take a look in the README in this directory! "
@echo " "
@echo " ctb comes with no guarantees and doesn't claim "
@echo " to be suitable for any purpose. "
@echo "================================================================"
@echo " "
</command>
</action>
</makefile>
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.5 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
.autodepend
!ifndef BCCDIR
!ifndef MAKEDIR
!error Your Borland compiler does not define MAKEDIR. Please define the BCCDIR variable, e.g. BCCDIR=d:\bc4
!endif
BCCDIR = $(MAKEDIR)\..
!endif
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# C++ compiler
!ifndef CXX
CXX = bcc32
!endif
# Standard flags for C++
!ifndef CXXFLAGS
CXXFLAGS =
!endif
# Standard preprocessor flags (common for CC and CXX)
!ifndef CPPFLAGS
CPPFLAGS = -a8 -g0
!endif
# Standard linker flags
!ifndef LDFLAGS
LDFLAGS =
!endif
# Set to 1 to build debug version [0,1]
!ifndef DEBUG
DEBUG = 0
!endif
#
!ifndef GPIB
GPIB = 0
!endif
#
!ifndef WXDIR
WXDIR = $(WXWIN)
!endif
#
!ifndef INSTALLDIR
INSTALLDIR = $(WXWIN)
!endif
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
CTB_LIB_CXXFLAGS = -I$(BCCDIR)\include $(____DEBUG) $(____DEBUG_2) -tWM \
$(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS)
CTB_LIB_OBJECTS = \
$(OUTPUT)\ctb_lib_fifo.obj \
$(OUTPUT)\ctb_lib_getopt.obj \
$(OUTPUT)\ctb_lib_iobase.obj \
$(OUTPUT)\ctb_lib_portscan.obj \
$(OUTPUT)\ctb_lib_serportx.obj \
$(OUTPUT)\ctb_lib_serport.obj \
$(OUTPUT)\ctb_lib_timer.obj \
$(____GPIBSRC_FILENAMES_OBJECTS)
CTB_DLL_CXXFLAGS = -I$(BCCDIR)\include $(____DEBUG) $(____DEBUG_2) -tWM \
$(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS)
CTB_DLL_OBJECTS = \
$(OUTPUT)\ctb_dll_fifo.obj \
$(OUTPUT)\ctb_dll_getopt.obj \
$(OUTPUT)\ctb_dll_iobase.obj \
$(OUTPUT)\ctb_dll_portscan.obj \
$(OUTPUT)\ctb_dll_serportx.obj \
$(OUTPUT)\ctb_dll_serport.obj \
$(OUTPUT)\ctb_dll_timer.obj \
$(____GPIBSRC_FILENAMES_1_OBJECTS)
CTBTEST_CXXFLAGS = -I$(BCCDIR)\include $(____DEBUG) $(____DEBUG_2) \
-DGPIB=$(GPIB) -tWM $(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS)
CTBTEST_OBJECTS = \
$(OUTPUT)\ctbtest_ctbtest.obj
### Conditionally set variables: ###
!if "$(DEBUG)" == "0"
OUTPUT = release
!endif
!if "$(DEBUG)" == "1"
OUTPUT = debug
!endif
!if "$(WXDIR)" == ""
INSTALLDIR = ..\lib
!endif
!if "$(DEBUG)" == "1"
LIBFLAG = d
!endif
!if "$(GPIB)" == "1"
GPIBFLAG = _gpib
!endif
!if "$(GPIB)" == "1"
____GPIBSRC_FILENAMES_OBJECTS = \
$(OUTPUT)\ctb_lib_gpib.obj
!endif
!if "$(GPIB)" == "1"
____GPIBSRC_FILENAMES_1_OBJECTS = \
$(OUTPUT)\ctb_dll_gpib.obj
!endif
!if "$(DEBUG)" == "0"
____DEBUG = -DNDEBUG
!endif
!if "$(DEBUG)" == "1"
____DEBUG =
!endif
!if "$(DEBUG)" == "0"
__OPTIMIZE_FLAG = -Od
!endif
!if "$(DEBUG)" == "1"
__OPTIMIZE_FLAG = -O2
!endif
!if "$(GPIB)" == "1"
__SYSLIB2_p = gpib32.lib
!endif
!if "$(DEBUG)" == "0"
____DEBUG_2 = -v-
!endif
!if "$(DEBUG)" == "1"
____DEBUG_2 = -v
!endif
all: $(OUTPUT)
$(OUTPUT):
-if not exist $(OUTPUT) mkdir $(OUTPUT)
### Targets: ###
all: ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32
clean:
-if exist $(OUTPUT)\*.obj del $(OUTPUT)\*.obj
-if exist $(OUTPUT)\*.res del $(OUTPUT)\*.res
-if exist $(OUTPUT)\*.csm del $(OUTPUT)\*.csm
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.tds del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.tds
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilc del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilc
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ild del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ild
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilf del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilf
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ils del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ils
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
-if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe
-if exist $(OUTPUT)\ctbtest.tds del $(OUTPUT)\ctbtest.tds
-if exist $(OUTPUT)\ctbtest.ilc del $(OUTPUT)\ctbtest.ilc
-if exist $(OUTPUT)\ctbtest.ild del $(OUTPUT)\ctbtest.ild
-if exist $(OUTPUT)\ctbtest.ilf del $(OUTPUT)\ctbtest.ilf
-if exist $(OUTPUT)\ctbtest.ils del $(OUTPUT)\ctbtest.ils
..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib: $(CTB_LIB_OBJECTS)
if exist $@ del $@
tlib /a /p4096 $@ @&&|
$(CTB_LIB_OBJECTS)
|
..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll: $(CTB_DLL_OBJECTS)
ilink32 -Tpd -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(____DEBUG_2) -L..\lib $(LDFLAGS) @&&|
c0d32.obj $(CTB_DLL_OBJECTS),$@,, winmm.lib $(__SYSLIB2_p) import32.lib cw32mt.lib,,
|
implib -f ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16 $@
$(OUTPUT)\ctbtest.exe: $(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(____DEBUG_2) -L..\lib $(LDFLAGS) @&&|
c0x32.obj $(CTBTEST_OBJECTS),$@,, ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib winmm.lib $(__SYSLIB2_p) import32.lib cw32mt.lib,,
|
wxinstall:
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\borland_lib
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\borland_lib
@if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32
@copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16
@copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32
tip-win32:
@echo " "
@echo "================================================================"
@echo " The building of ctb is finished. If you have an installed "
@echo " wxWidget package (WXWIN must be defined in the enviroment), "
@echo " you'll now have to run: "
@echo " "
@echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall "
@echo " "
@echo " to install the libraries in: "
@echo " $(INSTALLDIR)\lib\borland_lib "
@echo " and the header files in"
@echo " $(INSTALLDIR)\ctb-0.16"
@echo " "
@echo " If you are using another compiler (Borland, Watcom, mingw,...) "
@echo " take a look in the README in this directory! "
@echo " "
@echo " ctb comes with no guarantees and doesn't claim "
@echo " to be suitable for any purpose. "
@echo "================================================================"
@echo " "
$(OUTPUT)\ctb_lib_fifo.obj: .\..\src\fifo.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\fifo.cpp
$(OUTPUT)\ctb_lib_getopt.obj: .\..\src\getopt.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\getopt.cpp
$(OUTPUT)\ctb_lib_iobase.obj: .\..\src\iobase.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\iobase.cpp
$(OUTPUT)\ctb_lib_portscan.obj: .\..\src\portscan.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\portscan.cpp
$(OUTPUT)\ctb_lib_serportx.obj: .\..\src\serportx.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\serportx.cpp
$(OUTPUT)\ctb_lib_serport.obj: .\..\src\win32\serport.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\serport.cpp
$(OUTPUT)\ctb_lib_timer.obj: .\..\src\win32\timer.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\timer.cpp
$(OUTPUT)\ctb_lib_gpib.obj: .\..\src\gpib.cpp
$(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\gpib.cpp
$(OUTPUT)\ctb_dll_fifo.obj: .\..\src\fifo.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\fifo.cpp
$(OUTPUT)\ctb_dll_getopt.obj: .\..\src\getopt.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\getopt.cpp
$(OUTPUT)\ctb_dll_iobase.obj: .\..\src\iobase.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\iobase.cpp
$(OUTPUT)\ctb_dll_portscan.obj: .\..\src\portscan.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\portscan.cpp
$(OUTPUT)\ctb_dll_serportx.obj: .\..\src\serportx.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\serportx.cpp
$(OUTPUT)\ctb_dll_serport.obj: .\..\src\win32\serport.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\serport.cpp
$(OUTPUT)\ctb_dll_timer.obj: .\..\src\win32\timer.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\timer.cpp
$(OUTPUT)\ctb_dll_gpib.obj: .\..\src\gpib.cpp
$(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\gpib.cpp
$(OUTPUT)\ctbtest_ctbtest.obj: .\..\samples\ctbtest.cpp
$(CXX) -q -c -P -o$@ $(CTBTEST_CXXFLAGS) .\..\samples\ctbtest.cpp
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.5 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# Compiler flags to link shared library
LINK_DLL_FLAGS ?= -shared
# C++ compiler
CXX = g++
# Standard flags for C++
CXXFLAGS ?=
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=
# Standard linker flags
LDFLAGS ?=
# Set to 1 to build debug version [0,1]
DEBUG ?= 0
#
GPIB ?= 0
#
WXDIR ?= $(WXWIN)
#
INSTALLDIR ?= $(WXWIN)
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
CPPDEPS = -MT$@ -MF$@.d -MD -MP
CTB_LIB_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -mthreads $(__OPTIMIZE_FLAG) \
-I..\include $(CPPFLAGS) $(CXXFLAGS)
CTB_LIB_OBJECTS = \
$(OUTPUT)\ctb_lib_fifo.o \
$(OUTPUT)\ctb_lib_getopt.o \
$(OUTPUT)\ctb_lib_iobase.o \
$(OUTPUT)\ctb_lib_portscan.o \
$(OUTPUT)\ctb_lib_serportx.o \
$(OUTPUT)\ctb_lib_serport.o \
$(OUTPUT)\ctb_lib_timer.o \
$(____GPIBSRC_FILENAMES_OBJECTS)
CTB_DLL_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -mthreads $(__OPTIMIZE_FLAG) \
-I..\include $(CPPFLAGS) $(CXXFLAGS)
CTB_DLL_OBJECTS = \
$(OUTPUT)\ctb_dll_fifo.o \
$(OUTPUT)\ctb_dll_getopt.o \
$(OUTPUT)\ctb_dll_iobase.o \
$(OUTPUT)\ctb_dll_portscan.o \
$(OUTPUT)\ctb_dll_serportx.o \
$(OUTPUT)\ctb_dll_serport.o \
$(OUTPUT)\ctb_dll_timer.o \
$(____GPIBSRC_FILENAMES_1_OBJECTS)
CTBTEST_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -DGPIB=$(GPIB) -mthreads \
$(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS)
CTBTEST_OBJECTS = \
$(OUTPUT)\ctbtest_ctbtest.o
### Conditionally set variables: ###
ifeq ($(DEBUG),0)
OUTPUT = release
endif
ifeq ($(DEBUG),1)
OUTPUT = debug
endif
ifeq ($(WXDIR),)
INSTALLDIR = ..\lib
endif
ifeq ($(DEBUG),1)
LIBFLAG = d
endif
ifeq ($(GPIB),1)
GPIBFLAG = _gpib
endif
ifeq ($(GPIB),1)
____GPIBSRC_FILENAMES_OBJECTS = \
$(OUTPUT)\ctb_lib_gpib.o
endif
ifeq ($(GPIB),1)
____GPIBSRC_FILENAMES_1_OBJECTS = \
$(OUTPUT)\ctb_dll_gpib.o
endif
ifeq ($(DEBUG),0)
____DEBUG = -DNDEBUG
endif
ifeq ($(DEBUG),1)
____DEBUG =
endif
ifeq ($(DEBUG),0)
__OPTIMIZE_FLAG = -O0
endif
ifeq ($(DEBUG),1)
__OPTIMIZE_FLAG = -O2
endif
ifeq ($(GPIB),1)
__SYSLIB2_p = -lgpib32
endif
ifeq ($(DEBUG),0)
____DEBUG_1 =
endif
ifeq ($(DEBUG),1)
____DEBUG_1 = -g
endif
all: $(OUTPUT)
$(OUTPUT):
-if not exist $(OUTPUT) mkdir $(OUTPUT)
### Targets: ###
all: ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32
clean:
-if exist $(OUTPUT)\*.o del $(OUTPUT)\*.o
-if exist $(OUTPUT)\*.d del $(OUTPUT)\*.d
-if exist ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a del ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll
-if exist ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a del ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a
-if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe
..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a: $(CTB_LIB_OBJECTS)
if exist $@ del $@
ar rcu $@ $(CTB_LIB_OBJECTS)
ranlib $@
..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll: $(CTB_DLL_OBJECTS)
$(CXX) $(LINK_DLL_FLAGS) -fPIC -o $@ $(CTB_DLL_OBJECTS) $(____DEBUG_1) -mthreads -Wl,--out-implib=..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a -L..\lib $(LDFLAGS) -lwinmm $(__SYSLIB2_p)
$(OUTPUT)\ctbtest.exe: $(CTBTEST_OBJECTS) ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a
$(CXX) -o $@ $(CTBTEST_OBJECTS) $(____DEBUG_1) -mthreads -L..\lib $(LDFLAGS) ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a -lwinmm $(__SYSLIB2_p)
wxinstall:
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\mingw_lib
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\mingw_lib
@if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32
@copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16
@copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32
tip-win32:
@echo " "
@echo "================================================================"
@echo " The building of ctb is finished. If you have an installed "
@echo " wxWidget package (WXWIN must be defined in the enviroment), "
@echo " you'll now have to run: "
@echo " "
@echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall "
@echo " "
@echo " to install the libraries in: "
@echo " $(INSTALLDIR)\lib\mingw_lib "
@echo " and the header files in"
@echo " $(INSTALLDIR)\ctb-0.16"
@echo " "
@echo " If you are using another compiler (Borland, Watcom, mingw,...) "
@echo " take a look in the README in this directory! "
@echo " "
@echo " ctb comes with no guarantees and doesn't claim "
@echo " to be suitable for any purpose. "
@echo "================================================================"
@echo " "
$(OUTPUT)\ctb_lib_fifo.o: ./../src/fifo.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_lib_getopt.o: ./../src/getopt.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_lib_iobase.o: ./../src/iobase.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_lib_portscan.o: ./../src/portscan.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_lib_serportx.o: ./../src/serportx.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_lib_serport.o: ./../src/win32/serport.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_lib_timer.o: ./../src/win32/timer.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_lib_gpib.o: ./../src/gpib.cpp
$(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_fifo.o: ./../src/fifo.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_getopt.o: ./../src/getopt.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_iobase.o: ./../src/iobase.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_portscan.o: ./../src/portscan.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_serportx.o: ./../src/serportx.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_serport.o: ./../src/win32/serport.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_timer.o: ./../src/win32/timer.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctb_dll_gpib.o: ./../src/gpib.cpp
$(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $<
$(OUTPUT)\ctbtest_ctbtest.o: ./../samples/ctbtest.cpp
$(CXX) -c -o $@ $(CTBTEST_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all clean
SHELL := $(COMSPEC)
# Dependencies tracking:
-include $(OUTPUT)/*.d
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.5 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# C++ compiler
CXX = cl
# Standard flags for C++
CXXFLAGS =
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS =
# Standard linker flags
LDFLAGS =
# Set to 1 to build debug version [0,1]
# 0 - Release
# 1 - Debug
DEBUG = 0
#
GPIB = 0
#
WXDIR = $(WXWIN)
#
INSTALLDIR = $(WXWIN)
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
CTB_LIB_CXXFLAGS = /MT$(____DEBUG_4) /DWIN32 $(____DEBUG) $(____DEBUG_2) \
$(______DEBUG) /Fd..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb \
$(__OPTIMIZE_FLAG) /I..\include /GR /EHsc $(CPPFLAGS) $(CXXFLAGS)
CTB_LIB_OBJECTS = \
$(OUTPUT)\ctb_lib_fifo.obj \
$(OUTPUT)\ctb_lib_getopt.obj \
$(OUTPUT)\ctb_lib_iobase.obj \
$(OUTPUT)\ctb_lib_portscan.obj \
$(OUTPUT)\ctb_lib_serportx.obj \
$(OUTPUT)\ctb_lib_serport.obj \
$(OUTPUT)\ctb_lib_timer.obj \
$(____GPIBSRC_FILENAMES_OBJECTS)
CTB_DLL_CXXFLAGS = /MT$(____DEBUG_4) /DWIN32 $(____DEBUG) $(____DEBUG_2) \
$(______DEBUG) /Fd..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb \
$(__OPTIMIZE_FLAG) /I..\include /GR /EHsc $(CPPFLAGS) $(CXXFLAGS)
CTB_DLL_OBJECTS = \
$(OUTPUT)\ctb_dll_fifo.obj \
$(OUTPUT)\ctb_dll_getopt.obj \
$(OUTPUT)\ctb_dll_iobase.obj \
$(OUTPUT)\ctb_dll_portscan.obj \
$(OUTPUT)\ctb_dll_serportx.obj \
$(OUTPUT)\ctb_dll_serport.obj \
$(OUTPUT)\ctb_dll_timer.obj \
$(____GPIBSRC_FILENAMES_1_OBJECTS)
CTBTEST_CXXFLAGS = /MT$(____DEBUG_4) /DWIN32 $(____DEBUG) $(____DEBUG_2) \
$(______DEBUG) /Fd$(OUTPUT)\ctbtest.pdb /DGPIB=$(GPIB) $(__OPTIMIZE_FLAG) \
/I..\include /GR /EHsc $(CPPFLAGS) $(CXXFLAGS)
CTBTEST_OBJECTS = \
$(OUTPUT)\ctbtest_ctbtest.obj
### Conditionally set variables: ###
!if "$(DEBUG)" == "0"
OUTPUT = release
!endif
!if "$(DEBUG)" == "1"
OUTPUT = debug
!endif
!if "$(WXDIR)" == ""
INSTALLDIR = ..\lib
!endif
!if "$(DEBUG)" == "1"
LIBFLAG = d
!endif
!if "$(GPIB)" == "1"
GPIBFLAG = _gpib
!endif
!if "$(GPIB)" == "1"
____GPIBSRC_FILENAMES_OBJECTS = \
$(OUTPUT)\ctb_lib_gpib.obj
!endif
!if "$(GPIB)" == "1"
____GPIBSRC_FILENAMES_1_OBJECTS = \
$(OUTPUT)\ctb_dll_gpib.obj
!endif
!if "$(DEBUG)" == "0"
____DEBUG = /DNDEBUG
!endif
!if "$(DEBUG)" == "1"
____DEBUG =
!endif
!if "$(DEBUG)" == "0"
____DEBUG_2 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_2 = /Zi
!endif
!if "$(DEBUG)" == "0"
____DEBUG_3 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_3 = /DEBUG
!endif
!if "$(DEBUG)" == "0"
______DEBUG =
!endif
!if "$(DEBUG)" == "1"
______DEBUG = /D_DEBUG
!endif
!if "$(DEBUG)" == "0"
____DEBUG_4 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_4 = d
!endif
!if "$(DEBUG)" == "0"
__OPTIMIZE_FLAG = /Od
!endif
!if "$(DEBUG)" == "1"
__OPTIMIZE_FLAG = /O2
!endif
!if "$(GPIB)" == "1"
__SYSLIB2_p = gpib32.lib
!endif
all: $(OUTPUT)
$(OUTPUT):
-if not exist $(OUTPUT) mkdir $(OUTPUT)
### Targets: ###
all: ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32
clean:
-if exist $(OUTPUT)\*.obj del $(OUTPUT)\*.obj
-if exist $(OUTPUT)\*.res del $(OUTPUT)\*.res
-if exist $(OUTPUT)\*.pch del $(OUTPUT)\*.pch
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilk del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilk
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
-if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe
-if exist $(OUTPUT)\ctbtest.ilk del $(OUTPUT)\ctbtest.ilk
-if exist $(OUTPUT)\ctbtest.pdb del $(OUTPUT)\ctbtest.pdb
..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib: $(CTB_LIB_OBJECTS)
if exist $@ del $@
link /LIB /NOLOGO /OUT:$@ @<<
$(CTB_LIB_OBJECTS)
<<
..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll: $(CTB_DLL_OBJECTS)
link /DLL /NOLOGO /OUT:$@ $(____DEBUG_3) /pdb:"..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb" /LIBPATH:..\lib $(LDFLAGS) @<<
$(CTB_DLL_OBJECTS) winmm.lib $(__SYSLIB2_p) /IMPLIB:..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
<<
$(OUTPUT)\ctbtest.exe: $(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
link /NOLOGO /OUT:$@ $(____DEBUG_3) /pdb:"$(OUTPUT)\ctbtest.pdb" /LIBPATH:..\lib $(LDFLAGS) @<<
$(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib winmm.lib $(__SYSLIB2_p)
<<
wxinstall:
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\vc_lib
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\vc_lib
@if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32
@copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16
@copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32
tip-win32:
@echo " "
@echo "================================================================"
@echo " The building of ctb is finished. If you have an installed "
@echo " wxWidget package (WXWIN must be defined in the enviroment), "
@echo " you'll now have to run: "
@echo " "
@echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall "
@echo " "
@echo " to install the libraries in: "
@echo " $(INSTALLDIR)\lib\vc_lib "
@echo " and the header files in"
@echo " $(INSTALLDIR)\ctb-0.16"
@echo " "
@echo " If you are using another compiler (Borland, Watcom, mingw,...) "
@echo " take a look in the README in this directory! "
@echo " "
@echo " ctb comes with no guarantees and doesn't claim "
@echo " to be suitable for any purpose. "
@echo "================================================================"
@echo " "
$(OUTPUT)\ctb_lib_fifo.obj: .\..\src\fifo.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\fifo.cpp
$(OUTPUT)\ctb_lib_getopt.obj: .\..\src\getopt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\getopt.cpp
$(OUTPUT)\ctb_lib_iobase.obj: .\..\src\iobase.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\iobase.cpp
$(OUTPUT)\ctb_lib_portscan.obj: .\..\src\portscan.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\portscan.cpp
$(OUTPUT)\ctb_lib_serportx.obj: .\..\src\serportx.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\serportx.cpp
$(OUTPUT)\ctb_lib_serport.obj: .\..\src\win32\serport.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\serport.cpp
$(OUTPUT)\ctb_lib_timer.obj: .\..\src\win32\timer.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\timer.cpp
$(OUTPUT)\ctb_lib_gpib.obj: .\..\src\gpib.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\gpib.cpp
$(OUTPUT)\ctb_dll_fifo.obj: .\..\src\fifo.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\fifo.cpp
$(OUTPUT)\ctb_dll_getopt.obj: .\..\src\getopt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\getopt.cpp
$(OUTPUT)\ctb_dll_iobase.obj: .\..\src\iobase.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\iobase.cpp
$(OUTPUT)\ctb_dll_portscan.obj: .\..\src\portscan.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\portscan.cpp
$(OUTPUT)\ctb_dll_serportx.obj: .\..\src\serportx.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\serportx.cpp
$(OUTPUT)\ctb_dll_serport.obj: .\..\src\win32\serport.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\serport.cpp
$(OUTPUT)\ctb_dll_timer.obj: .\..\src\win32\timer.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\timer.cpp
$(OUTPUT)\ctb_dll_gpib.obj: .\..\src\gpib.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\gpib.cpp
$(OUTPUT)\ctbtest_ctbtest.obj: .\..\samples\ctbtest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CTBTEST_CXXFLAGS) .\..\samples\ctbtest.cpp
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.5 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# C++ compiler
CXX = wpp386
# Standard flags for C++
CXXFLAGS =
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS =
# Standard linker flags
LDFLAGS =
# Set to 1 to build debug version [0,1]
# 0 - Release
# 1 - Debug
DEBUG = 0
#
GPIB = 0
#
WXDIR = $(%WXWIN)
#
INSTALLDIR = $(%WXWIN)
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
# Speed up compilation a bit:
!ifdef __LOADDLL__
! loaddll wcc wccd
! loaddll wccaxp wccdaxp
! loaddll wcc386 wccd386
! loaddll wpp wppdi86
! loaddll wppaxp wppdaxp
! loaddll wpp386 wppd386
! loaddll wlink wlink
! loaddll wlib wlibd
!endif
# We need these variables in some bakefile-made rules:
WATCOM_CWD = $+ $(%cdrive):$(%cwd) $-
### Conditionally set variables: ###
OUTPUT =
!ifeq DEBUG 0
OUTPUT = release
!endif
!ifeq DEBUG 1
OUTPUT = debug
!endif
INSTALLDIR =
!ifeq WXDIR
INSTALLDIR = ..\lib
!endif
LIBFLAG =
!ifeq DEBUG 1
LIBFLAG = d
!endif
GPIBFLAG =
!ifeq GPIB 1
GPIBFLAG = _gpib
!endif
____GPIBSRC_FILENAMES_OBJECTS =
!ifeq GPIB 1
____GPIBSRC_FILENAMES_OBJECTS = &
$(OUTPUT)\ctb_lib_gpib.obj
!endif
____GPIBSRC_FILENAMES_1_OBJECTS =
!ifeq GPIB 1
____GPIBSRC_FILENAMES_1_OBJECTS = &
$(OUTPUT)\ctb_dll_gpib.obj
!endif
____DEBUG =
!ifeq DEBUG 0
____DEBUG = -dNDEBUG
!endif
!ifeq DEBUG 1
____DEBUG =
!endif
____DEBUG_0 =
!ifeq DEBUG 0
____DEBUG_0 = -d0
!endif
!ifeq DEBUG 1
____DEBUG_0 = -d2
!endif
____DEBUG_2 =
!ifeq DEBUG 0
____DEBUG_2 =
!endif
!ifeq DEBUG 1
____DEBUG_2 = debug all
!endif
__OPTIMIZE_FLAG =
!ifeq DEBUG 0
__OPTIMIZE_FLAG = -od
!endif
!ifeq DEBUG 1
__OPTIMIZE_FLAG = -ot -ox
!endif
__SYSLIB2_p =
!ifeq GPIB 1
__SYSLIB2_p = gpib32.lib
!endif
### Variables: ###
CTB_LIB_CXXFLAGS = $(____DEBUG) $(____DEBUG_0) -bm $(__OPTIMIZE_FLAG) &
-i=..\include $(CPPFLAGS) $(CXXFLAGS)
CTB_LIB_OBJECTS = &
$(OUTPUT)\ctb_lib_fifo.obj &
$(OUTPUT)\ctb_lib_getopt.obj &
$(OUTPUT)\ctb_lib_iobase.obj &
$(OUTPUT)\ctb_lib_portscan.obj &
$(OUTPUT)\ctb_lib_serportx.obj &
$(OUTPUT)\ctb_lib_serport.obj &
$(OUTPUT)\ctb_lib_timer.obj &
$(____GPIBSRC_FILENAMES_OBJECTS)
CTB_DLL_CXXFLAGS = -bd $(____DEBUG) $(____DEBUG_0) -bm $(__OPTIMIZE_FLAG) &
-i=..\include $(CPPFLAGS) $(CXXFLAGS)
CTB_DLL_OBJECTS = &
$(OUTPUT)\ctb_dll_fifo.obj &
$(OUTPUT)\ctb_dll_getopt.obj &
$(OUTPUT)\ctb_dll_iobase.obj &
$(OUTPUT)\ctb_dll_portscan.obj &
$(OUTPUT)\ctb_dll_serportx.obj &
$(OUTPUT)\ctb_dll_serport.obj &
$(OUTPUT)\ctb_dll_timer.obj &
$(____GPIBSRC_FILENAMES_1_OBJECTS)
CTBTEST_CXXFLAGS = $(____DEBUG) $(____DEBUG_0) -dGPIB=$(GPIB) -bm &
$(__OPTIMIZE_FLAG) -i=..\include $(CPPFLAGS) $(CXXFLAGS)
CTBTEST_OBJECTS = &
$(OUTPUT)\ctbtest_ctbtest.obj
all : $(OUTPUT)
$(OUTPUT) :
-if not exist $(OUTPUT) mkdir $(OUTPUT)
### Targets: ###
all : .SYMBOLIC ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32
clean : .SYMBOLIC
-if exist $(OUTPUT)\*.obj del $(OUTPUT)\*.obj
-if exist $(OUTPUT)\*.res del $(OUTPUT)\*.res
-if exist $(OUTPUT)\*.lbc del $(OUTPUT)\*.lbc
-if exist $(OUTPUT)\*.ilk del $(OUTPUT)\*.ilk
-if exist $(OUTPUT)\*.pch del $(OUTPUT)\*.pch
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll
-if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
-if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe
..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib : $(CTB_LIB_OBJECTS)
@%create $(OUTPUT)\ctb_lib.lbc
@for %i in ($(CTB_LIB_OBJECTS)) do @%append $(OUTPUT)\ctb_lib.lbc +%i
wlib -q -p4096 -n -b $^@ @$(OUTPUT)\ctb_lib.lbc
..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll : $(CTB_DLL_OBJECTS)
@%create $(OUTPUT)\ctb_dll.lbc
@%append $(OUTPUT)\ctb_dll.lbc option quiet
@%append $(OUTPUT)\ctb_dll.lbc name $^@
@%append $(OUTPUT)\ctb_dll.lbc option caseexact
@%append $(OUTPUT)\ctb_dll.lbc $(____DEBUG_2) libpath ..\lib $(LDFLAGS)
@for %i in ($(CTB_DLL_OBJECTS)) do @%append $(OUTPUT)\ctb_dll.lbc file %i
@for %i in ( winmm.lib $(__SYSLIB2_p)) do @%append $(OUTPUT)\ctb_dll.lbc library %i
@%append $(OUTPUT)\ctb_dll.lbc
@%append $(OUTPUT)\ctb_dll.lbc system nt_dll
wlink @$(OUTPUT)\ctb_dll.lbc
wlib -q -n -b ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib +$^@
$(OUTPUT)\ctbtest.exe : $(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib
@%create $(OUTPUT)\ctbtest.lbc
@%append $(OUTPUT)\ctbtest.lbc option quiet
@%append $(OUTPUT)\ctbtest.lbc name $^@
@%append $(OUTPUT)\ctbtest.lbc option caseexact
@%append $(OUTPUT)\ctbtest.lbc $(____DEBUG_2) libpath ..\lib $(LDFLAGS)
@for %i in ($(CTBTEST_OBJECTS)) do @%append $(OUTPUT)\ctbtest.lbc file %i
@for %i in ( ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib winmm.lib $(__SYSLIB2_p)) do @%append $(OUTPUT)\ctbtest.lbc library %i
@%append $(OUTPUT)\ctbtest.lbc
@for %i in () do @%append $(OUTPUT)\ctbtest.lbc option stack=%i
wlink @$(OUTPUT)\ctbtest.lbc
wxinstall :
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\watcom_lib
@copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\watcom_lib
@if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32
@copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16
@copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32
tip-win32 :
@echo " "
@echo "================================================================"
@echo " The building of ctb is finished. If you have an installed "
@echo " wxWidget package (WXWIN must be defined in the enviroment), "
@echo " you'll now have to run: "
@echo " "
@echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall "
@echo " "
@echo " to install the libraries in: "
@echo " $(INSTALLDIR)\lib\watcom_lib "
@echo " and the header files in"
@echo " $(INSTALLDIR)\ctb-0.16"
@echo " "
@echo " If you are using another compiler (Borland, Watcom, mingw,...) "
@echo " take a look in the README in this directory! "
@echo " "
@echo " ctb comes with no guarantees and doesn't claim "
@echo " to be suitable for any purpose. "
@echo "================================================================"
@echo " "
$(OUTPUT)\ctb_lib_fifo.obj : .AUTODEPEND .\..\src\fifo.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_lib_getopt.obj : .AUTODEPEND .\..\src\getopt.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_lib_iobase.obj : .AUTODEPEND .\..\src\iobase.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_lib_portscan.obj : .AUTODEPEND .\..\src\portscan.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_lib_serportx.obj : .AUTODEPEND .\..\src\serportx.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_lib_serport.obj : .AUTODEPEND .\..\src\win32\serport.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_lib_timer.obj : .AUTODEPEND .\..\src\win32\timer.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_lib_gpib.obj : .AUTODEPEND .\..\src\gpib.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_fifo.obj : .AUTODEPEND .\..\src\fifo.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_getopt.obj : .AUTODEPEND .\..\src\getopt.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_iobase.obj : .AUTODEPEND .\..\src\iobase.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_portscan.obj : .AUTODEPEND .\..\src\portscan.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_serportx.obj : .AUTODEPEND .\..\src\serportx.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_serport.obj : .AUTODEPEND .\..\src\win32\serport.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_timer.obj : .AUTODEPEND .\..\src\win32\timer.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctb_dll_gpib.obj : .AUTODEPEND .\..\src\gpib.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $<
$(OUTPUT)\ctbtest_ctbtest.obj : .AUTODEPEND .\..\samples\ctbtest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CTBTEST_CXXFLAGS) $<
#ifndef LIBCTB_CTB_H_INCLUDED_
#define LIBCTB_CTB_H_INCLUDED_
#include "ctb-0.16/fifo.h"
#if ( GPIB )
# include "ctb-0.16/gpib.h"
#endif
#include "ctb-0.16/getopt.h"
#include "ctb-0.16/iobase.h"
#include "ctb-0.16/kbhit.h"
#include "ctb-0.16/portscan.h"
#include "ctb-0.16/serport.h"
#include "ctb-0.16/serportx.h"
#include "ctb-0.16/timer.h"
/*!
\mainpage ctb overview
The ctb (communication toolbox) library was realized, to simplify the
communication with other instruments throughout the serial com ports
(at first). To make my life easier, it should works with Linux and
all win32 plattforms (excepted windows 3.1, which is a only 16bit OS)
because I develope my applications for both plattforms).\n
Some times later GPIB support was added to make ctb an integrated part
for the extensive test and calibration system of a company I worked
these days.\n
The main goal of the library was a non-blocked communication to avoid
frozen GUIs waiting for data which in some conditions never arrives.
On the base ctb defines an abstract class IOBase, which must be
derivate for several interfaces (at now this was done for the
RS232 comports and GPIB IEEE488 interface).
This leads to another feature: Because all classes depends on one
super class, you have just open your wanted interface and don't
worry about it's special typ later. This is like the 'Virtual
Instrument' featured by Nation Instruments LabView.
Last not least: ctb provides one written code for Linux and Windows
(compiles well with GNU G++ and VC++). Without any dependences (execept
for a standard C++ compilier) ctb runs also in small enviroments like
embedded systems and doesn't need any graphic stuff for use.
ctb is composed of five parts:
- ctb::IOBase class
- ctb::SerialPort class
- ctb::GpibDevice class
- ctb::Timer class
- ctb::Fifo class
\section IOBase IOBase class
An abstract class for different interfaces. The idea behind this:
Similar to the virtual file system this class defines a lot of
preset member functions, which the derivate classes must be
overload.\n
In the main thing these are: open a interface (such as RS232),
reading and writing non blocked through the interface and at
last, close it.\n
For special interface settings the method ioctl was defined.
(control interface). ioctl covers some interface dependent
settings like switch on/off the RS232 status lines and must also
be defined from each derivated class.
\section SerialPort SerialPort class
The class for the serial ports is named as
ctb::SerialPort. SerialPort is a wrapper for non blocked reading and
writing. This is easy under linux, but with windows a lot more
tricky. SerialPort is as simple as possible. It doesn't create any
gui events or signals, so it works also standalone. It's also not a
device driver, means, you must call the read method, if you look for
receiving data.
You can write any desired data with any length (length type is
size_t, I think, on win32 and linux this is a 32Bit integer) and
SerialPort returns the really writen data length, also you can read
a lot of data and SerialPort returns the really received data count.
Both, read and write returns immediatelly. Using these, the program
never blocks. Also IOBase implements a blocked read and write. You can
use these functions, if you want a definitiv count of data and never
accept less than this. Because there is a difficulty, when the
communication is interrupted or death, both blocked functions get a
timeout flag to returns after a given time interval. The timeouts
will be handled with the second timer class.
As an additional benefit ctb features also 9 Bit transmission (with
take advantage of the parity bit), non-standard baudrates (depending
on your hardware but not on ctb) and all parity eventualities
including static parity settings like Mark and Space.
\section GpibDevice GpibDevice class
Named as ctb::GpibDevice. In the philosophy of the SerialPort class
GpibDevice also supports non-blocking communication. You can instant
as many GpibDevice objects as you need for instance to communicate
with a lot of different bus participants in a typical GPIB enviroment.
GPIB support was tested with PCI cards and USB adapter from Nation
Instrument and Keithley.
\section Timer Timer class
The idea of the ctb::Timer class is to base on the Unix C alarm
function. You create a Timer with a given alarm time and a adress of
flag, which the timer must set after the time is over.
Because the alarm function cannot used more than once in the same
process (under windows I don't know a similar function), every timer
instance will be a separate thread after starting it. So you can start
a timer and continue in your program, make a lot of things and test
the flag whenever you want this. (For example, you read/write a
given count of data).
\note
I think, it's a better style, to request a given count of data in
100ms (for example) and trap the situation, if there are not enough
data after this time. And not do this for every byte!
\section Fifo Fifo cass
Provides a simple thread safe fifo to realize a fast and simple
communication pipe between two threads (and was used also as a put
back mechanism for the wxIOBase and it's derivated classes).\n
ctb::Fifo tackles the concurrently access from different threads with an
internal temporary pointer asignment which was atomic. From there no
mutex or semaphore is involved and lead to a fast access.
Please note:\n
The thread safeness is limited to the put/get write/read methods but
which should be sufficent for a fifo.
\latexonly \newpage \endlatexonly
*/
#endif
#ifndef __LIBCTB_FIFO_H_INCLUDED_
#define __LIBCTB_FIFO_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: fifo.h
// Purpose:
// Author: Joachim Buermann, Michael Hungershausen
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <sys/types.h>
/**
\file fifo.h
*/
namespace ctb {
/*!
\class Fifo
A simple thread safe fifo to realize a put back mechanism for the
wxIOBase and it's derivated classes.
*/
class Fifo
{
protected:
/*! the size of the fifo */
size_t m_size;
/*! the start of the internal fifo buffer */
char* m_begin;
/*!
the end of the internal fifo buffer (m_end marks the first
invalid byte AFTER the internal buffer)
*/
char* m_end;
/*! the current read position */
char* m_rdptr;
/*! the current write position */
char* m_wrptr;
public:
/*!
\brief the constructor initialize a fifo with the given size.
\param size size of the fifo
*/
Fifo(size_t size);
/*!
\brief the destructor destroys all internal memory.
*/
virtual ~Fifo();
/*!
\brief clear all internal memory and set the read and write
pointers to the start of the internal memory.
\Note This function is not thread safe! Don't use it, if another
thread takes access to the fifo instance. Use a looping get() or
read() call instead of this.
*/
virtual void clear();
/*!
\brief fetch the next available byte from the fifo.
\param ch points to a charater to store the result
\return 1 if successful, 0 otherwise
*/
virtual int get(char* ch);
/*!
\brief query the fifo for it's available bytes.
\return count of readable bytes, storing in the fifo
*/
size_t items();
/*!
\brief put a character into the fifo.
\param ch the character to put in
\return 1 if successful, 0 otherwise
*/
virtual int put(char ch);
/*!
\brief read a given count of bytes out of the fifo.
\param data memory to store the readed data
\param count number of bytes to read
\return On success, the number of bytes read are returned,
0 otherwise
*/
virtual int read(char* data,int count);
/*!
\brief write a given count of bytes into the fifo.
\param data start of the data to write
\param count number of bytes to write
\return On success, the number of bytes written are returned,
0 otherwise
*/
virtual int write(char* data,int count);
};
} // namespace ctb
#endif
#ifndef LIBCTB_GETOPT_H_INCLUDED_
#define LIBCTB_GETOPT_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: getopt.h
// Purpose: Simple wrapper file
// Author: Joachim Buermann
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined (WIN32)
# include "win32/getopt.h"
#else
# include <getopt.h>
#endif
#endif
// __WX_GETOPT_H
#ifndef LIBCTB_KBHIT_H_INCLUDED_
#define LIBCTB_KBHIT_H_INCLUDED_
namespace ctb {
char GetKey();
} // namespace ctb
#endif
#ifndef LIBCTB_LINUX_SERPORT_H_INCLUDED_
#define LIBCTB_LINUX_SERPORT_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: linux/serport.h
// Purpose:
// Author: Joachim Buermann
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "ctb-0.16/serportx.h"
#include <linux/serial.h>
#include <termios.h>
namespace ctb {
/*!
\class SerialPort
\brief the linux version
*/
class SerialPort : public SerialPort_x
{
protected:
/*!
\brief under Linux, the serial ports are normal file descriptor
*/
int fd;
/*!
\brief Linux defines this struct termios for controling asynchronous
communication. t covered the active settings, save_t the original
settings.
*/
struct termios t, save_t;
/*!
\brief The Linux serial driver summing all breaks, framings, overruns
and parity errors for each port during system runtime. Because we only
need the errors during a active connection, we must save the actual
error numbers in this separate structurs.
*/
struct serial_icounter_struct save_info, last_info;
/*!
\brief adaptor member function, to convert the plattform independent
type wxBaud into a linux conform value.
\param baud the baudrate as wxBaud type
\return speed_t linux specific data type, defined in termios.h
*/
speed_t AdaptBaudrate( int baud );
int CloseDevice();
int OpenDevice(const char* devname, void* dcs);
/*!
\brief internal member function to set an unusal (non-standard)
baudrate. Called by SetBaudrate.
*/
int SetBaudrateAny( int baudrate );
/*!
\brief internal member function to set a standard baudrate.
Called by SetBaudrate.
*/
int SetBaudrateStandard( int baudrate );
public:
SerialPort();
~SerialPort();
int ChangeLineState( SerialLineState flags );
int ClrLineState( SerialLineState flags );
int GetLineState();
int Ioctl(int cmd,void* args);
int IsOpen();
int Read(char* buf,size_t len);
int SendBreak(int duration);
int SetBaudrate( int baudrate );
int SetParityBit( bool parity );
int SetLineState( SerialLineState flags );
int Write(char* buf,size_t len);
};
} // namespace ctb
#endif
#ifndef LIBCTB_LINUX_TIMER_H_INCLUDED_
#define LIBCTB_LINUX_TIMER_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: linux/timer.h
// Purpose:
// Author: Joachim Buermann
// Id: $Id: timer.h,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $
// Copyright: (c) 2001 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
\file timer.h
*/
#include <pthread.h>
namespace ctb {
/*!
\brief A data struct, using from class timer.
*/
struct timer_control
{
/*!
under linux, we used usec internally
*/
unsigned int usecs;
/*!
covers the adress of the exitflag
*/
int *exitflag;
/*!
covers the adress of the exit function. NULL, if
there was no exit function.
*/
void* (*exitfnc)(void*);
};
/*!
\class Timer
\brief A thread based timer class for handling timeouts in
an easier way.
On starting every timer instance will create it's own thread.
The thread makes simply nothing, until it's given time is over.
After that, he set a variable, refer by it's adress to one
and exit.
There are a lot of situations, which the timer class must handle.
The timer instance leaves his valid range (for example, the
timer instance is local inside a function, and the function fished)
BEFORE the thread was ending. In this case, the destructor must
terminate the thread in a correct way. (This is very different
between the OS. threads are a system resource like file descriptors
and must be deallocated after using it).
The thread should be asynchronously stopped. Means, under all
circumstance, it must be possible, to finish the timer and start
it again.
Several timer instance can be used simultanously.
*/
class Timer
{
protected:
/*!
control covers the time interval, the adress
of the exitflag, and if not null, a function, which will
be called on the end.
*/
timer_control control;
/*!
stopped will be set by calling the stop() method.
Internaly the timer thread steadily tests the state of
this variable. If stopped not zero, the thread will be
finished.
*/
int stopped;
/*!
under linux we use the pthread library. tid covers the
identifier for a separate threads.
*/
pthread_t tid;
/*!
here we store the time interval, whilst the timer run.
This is waste!!!
*/
unsigned int timer_secs;
public:
/*!
The constructor creates an timer object with the given
properties. The timer at this moment is not started. This
will be done with the start() member function.
\param msec time interval after that the the variable
pointed by exitflag is setting to one.
\param exitflag the adress of an integer, which was set
to one after the given time interval.
\warning The integer variable shouldn't leave it's valid
range, before the timer was finished. So never take a
local variable.
\param exitfnc A function, which was called after msec.
If you don't want this, refer a NULL pointer.
*/
Timer(unsigned int msec,int* exitflag,void*(*exitfnc)(void*));
/*!
the destructor. If his was called (for example by leaving the
valid range of the timer object), the timer thread automaticaly
will finished. The exitflag wouldn't be set, also the exitfnc
wouldn't be called.
*/
~Timer();
/*!
starts the timer. But now a thread will created and started.
After this, the timer thread will be running until he was stopped
by calling stop() or reached his given time interval.
*/
int start();
/*!
stops the timer and canceled the timer thread. After timer::stop() a new
start() will started the timer from beginning.
*/
int stop();
};
/*!
\brief sleepms
A plattform independent function, to go to sleep for the given
time interval.
\param ms time interval in milli seconds
*/
void sleepms(unsigned int ms);
} // namespace ctb
#endif
#ifndef LIBCTB_PORTSCAN_H_INCLUDED_
#define LIBCTB_PORTSCAN_H_INCLUDED_
#include <string>
#include <vector>
/**
\file portscan.h
*/
namespace ctb {
/*!
\brief returns all available COM ports as an array of strings.
\param result stores the available COM ports
\param checkInUse return only ports which are available AND
unused (default)
\return true if successful, false otherwise
*/
bool GetAvailablePorts( std::vector<std::string>& result,
bool checkInUse = true );
} // namespace ctb
#endif
#ifndef LIBCTB_SERPORT_H_INCLUDED_
#define LIBCTB_SERPORT_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: serport.h
// Purpose: simple wrapper file
// Author: Joachim Buermann
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined (WIN32)
# include "ctb-0.16/win32/serport.h"
#else
# include "ctb-0.16/linux/serport.h"
#endif
#endif
// __SERPORT_BASE_H
#ifndef LIBCTB_TIMER_H_INCLUDED_
#define LIBCTB_TIMER_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: timer.h
// Purpose: simple wrapper file
// Author: Joachim Buermann
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined (WIN32)
# include "win32/timer.h"
#else
# include "linux/timer.h"
#endif
#endif
#ifndef LIBCTB_WIN32_GETOPT_H_INCLUDED_
#define LIBCTB_WIN32_GETOPT_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: win32/getopt.h
// Purpose:
// Author: Joachim Buermann
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
extern char* optarg;
extern int optind;
int getopt(int argc, char* argv[], char* optstring);
#endif
#ifndef LIBCTB_WIN32_TIMER_H_INCLUDED_
#define LIBCTB_WIN32_TIMER_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: win32/serport.h
// Purpose:
// Author: Joachim Buermann
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "../serportx.h"
#include <windows.h>
namespace ctb {
/*!
\class SerialPort
\brief the win32 version
*/
class SerialPort : public SerialPort_x
{
protected:
/*!
\brief the win32 api equivalent for the Linux
file descriptor
*/
HANDLE fd;
/*!
\brief a very special struct in the win32 api for controling
an asynchronous serial communication through the com ports.
*/
OVERLAPPED m_ov;
/*!
\brief The win32 API only allows to test for an existing
break, framing, overrun or parity, not for the occured numbers.
So every error event decrement this internal error struct and
can request by an Ioctl call.
*/
SerialPort_EINFO einfo;
/*!
\brief The win32 API doesn't have any function to detect the
current state of the output lines RST and DTR (if someone knows
some function, please contact me).
So we save the state always after changing one or both lines
(for example, on Open, SetLineState and ChangeLineState)
*/
int m_rtsdtr_state;
int CloseDevice();
int OpenDevice(const char* devname, void* dcs);
public:
SerialPort();
~SerialPort();
int ChangeLineState( SerialLineState flags );
int ClrLineState( SerialLineState flags );
int GetLineState();
int Ioctl(int cmd,void* args);
int IsOpen();
int Read(char* buf,size_t len);
int SendBreak(int duration);
int SetBaudrate( int baudrate );
int SetLineState( SerialLineState flags );
int SetParityBit( bool parity );
int Write(char* buf,size_t len);
};
} // namespace ctb
#endif
#ifndef LIBCTB_WINDOWS_TIMER_H_INCLUDED_
#define LIBCTB_WINDOWS_TIMER_H_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// Name: win32/timer.h
// Purpose:
// Author: Joachim Buermann
// Copyright: (c) 2010 Joachim Buermann
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <windows.h>
namespace ctb {
/*!
\brief A data struct, using from class timer.
*/
struct timer_control
{
/*!
under win32, we used msec internally
*/
unsigned int msecs;
/*!
covers the adress of the exitflag
*/
int *exitflag;
/*!
the running thread steadily polls this variable (only under win32).
If it's not zero, the thread terminate.
*/
MMRESULT stop;
/*!
covers the adress of the exit function. NULL, if
there was no exit function.
*/
void* (*exitfnc)(void*);
};
/*!
\class Timer
\brief A thread based timer class for handling timeouts in
an easier way.
On starting every timer instance will create it's own thread.
The thread makes simply nothing, until it's given time is over.
After that, he set a variable, refer by it's adress to one
and exit.
There are a lot of situations, which the timer class must handle.
The timer instance leaves his valid range (for example, the
timer instance is local inside a function, and the function fished)
BEFORE the thread was ending. In this case, the destructor must
terminate the thread in a correct way. (This is very different
between the OS. threads are a system resource like file descriptors
and must be deallocated after using it).
The thread should be asynchronously stopped. Means, under all
circumstance, it must be possible, to finish the timer and start
it again.
Several timer instance can be used simultanously.
*/
class Timer
{
protected:
/*!
\brief win32 needs this
*/
DWORD id;
/*!
\brief in win32 internal handle for the timer thread
*/
MMRESULT h;
/*!
control covers the time interval, the adress
of the exitflag, and if not null, a function, which will
be called on the end.
*/
timer_control control;
/*!
here we store the time interval, whilst the timer run.
This is waste!!!
*/
unsigned int timer_secs;
public:
/*!
The constructor creates an timer object with the given
properties. The timer at this moment is not started. This
will be done with the start() member function.
\param msec time interval after that the the variable
pointed by exitflag is setting to one.
\param exitflag the adress of an integer, which was set
to one after the given time interval.
\warning The integer variable shouldn't leave it's valid
range, before the timer was finished. So never take a
local variable.
\param exitfnc A function, which was called after msec.
If you don't want this, refer a NULL pointer.
*/
Timer(unsigned int msec,int* exitflag,void*(*exitfnc)(void*));
/*!
the destructor. If his was called (for example by leaving the
valid range of the timer object), the timer thread automaticaly
will finished. The exitflag wouldn't be set, also the exitfnc
wouldn't be called.
*/
~Timer();
/*!
starts the timer. But now a thread will created and started.
After this, the timer thread will be running until he was stopped
by calling stop() or reached his given time interval.
*/
int start();
/*!
stops the timer and canceled the timer thread. After timer::stop() a new
start() will started the timer from beginning.
*/
int stop();
};
/*!
\fn kill_all_timer()
\warning This function don't works under win32 and will be removed next
time. So don't use that!
*/
void kill_all_timer();
/*!
\fn
A plattform independent function, to go to sleep for the given
time interval.
\param ms time interval in milli seconds
*/
void sleepms(unsigned int ms);
} // namespace ctb
#endif
#!/usr/bin/python
import getopt, time, sys
sys.path.insert( 0, r'/home/jb/project/libctb-0.16/python/module/linux')
import ctb
def main():
baudrate = 19200
devname = ""
protocol = '8N1'
try:
opt,arg = getopt.getopt(sys.argv[1:],
'b:d:p:',
['baudrate=',
'device=',
'protocol='
])
except getopt.GetoptError:
print "usage: parity.py [options]\n"\
"\t-b baudrate\n"\
"\t--baudrate=baudrate"\
"\t-d device\n"\
"\t--device=serial device name like /dev/ttyS0 or COM1\n"\
"\t-h\n"\
"\t--help print this\n"\
"\n"
sys.exit(0)
for o,a in opt:
if o in ("-b","--baudrate"):
baudrate = int(a)
if o in ("-d","--device"):
devname = a
if o in ("-p","--protocol"):
protocol = a
print "Using ctb version " + ctb.GetVersion()
dev = ctb.SerialPort()
if dev.Open( devname, baudrate, protocol ) < 0:
print "Cannot open " + devname + "\n"
# send the following string with a always set parity bit
dev.SetParityBit( 1 )
dev.Writev( "Hello World" )
# send the following string with a always cleared parity bit
dev.SetParityBit( 0 )
dev.Writev( "Hello World" )
main()
#!/usr/bin/python
import getopt, time, sys
sys.path.insert( 0, r'/home/jb/project/libctb-0.16/python/module/linux')
import ctb
def main():
devname = ""
try:
opt,arg = getopt.getopt(sys.argv[1:],
'd:',
['device='
])
except getopt.GetoptError:
print "usage: parity.py [options]\n"\
"\t-d device\n"\
"\t--device=serial device name like /dev/ttyS0 or COM1\n"\
"\t-h\n"\
"\t--help print this\n"\
"\n"
sys.exit(0)
for o,a in opt:
if o in ("-d","--device"):
devname = a
print "Using ctb version " + ctb.GetVersion()
dev = ctb.SerialPort()
if dev.Open( devname, 38400 ) < 0:
print "Cannot open " + devname + "\n"
dev.SetLineState( ctb.DTR )
dev.ClrLineState( ctb.RTS )
for i in range( 0, 100 ) :
time.sleep( 0.01 )
dev.ChangeLineState( ctb.DTR | ctb.RTS )
main()
%{
#include "ctb-0.16/kbhit.h"
%}
namespace ctb {
char GetKey();
};
// This file is created automatically, don't change it!
%module wxctb
typedef int size_t;
%include timer.i
%include serport.i
%include ../kbhit.i
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论