ID |
Date |
Author![down down](down.png) |
Topic |
Subject |
609
|
03 Aug 2009 |
Exaos Lee | Forum | How to distinguish the status and value returned from "mvme_read_value(...)" |
The definition of mvme_read_value is as the following:unsigned int EXPRT mvme_read_value(MVME_INTERFACE * vme, mvme_addr_t vme_addr);
Read single data from VME bus. Useful for register access. See example in
mvme_open()
Parameters:
*vme VME structure
vme_addr source address (VME location).
Returns:
MVME_SUCCESS
Question: How to distinguish the status and value returned? Should the definition be something likeint EXPRT mvme_read_value(MVME_INTERFACE *mvme, mvme_addr_t vme_addr, unsigned int *var); |
612
|
04 Aug 2009 |
Exaos Lee | Forum | VME-related codes contribution |
Hi, all
I have some codes while using MIDAS. I upload them here. They are tested with
SIS3100. I haven't other VME controllers, so I don't know whether they work with
other controllers. I just hope that they are helpful. You may find information
from the file "00README.txt" in the package vme4midas.zip. My English is limited, I just hope
that you may catch my ideas. ![Smile Smile](icons/smile.png)
All my best.
Exaos Lee |
Attachment 1: vme4midas.zip
|
613
|
04 Aug 2009 |
Exaos Lee | Forum | Scripts to handle MIDAS sessions |
Hi, all again
I have some scripts in "bash" and "Python" to handle MIDAS sessions. Please see the attached utils4midas.zip. I didn't write instructions in detail of how to use them. But I think they are very simple. You may find how to use them by reading the codes and example files.
Best wishes.
Exaos Lee |
Attachment 1: utils4midas.zip
|
614
|
04 Aug 2009 |
Exaos Lee | Forum | About python interface |
Coding in Python is faster than in C (but running slower). So, some python interfaces are useful for testing purpose. I hope you may like the PyMVME module for VME bus testing. |
615
|
04 Aug 2009 |
Exaos Lee | Forum | The contents of the attachment |
As requested from K.O., I paste the "00README.txt" as the following:
#-*- mode: outline -*-
#-*- encoding: utf-8 -*-
#AUTHOR: Exaos Lee <Exaos DOT Lee AT gmail DOT com>
* Directories
+--> 00README.txt : This file
|
+--> bustester : Directory contains utilities for VME bus testing
|
+--> modules : APIs to handle VME modules
|
+--> pyutil : Uitilies in Python, including PyMVME
|
+--> sis3100 : Provide lib_sis3100mvme.a/so using with "mvmestd.h"
* Utilities in Python
** PyMVME module
The module "PyMVME" provides the following stuff:
a. class StdVME
-- contains standard VME informations.
b. class MVME_INTERFACE
-- the C structure MVME_INTERFACE wrapped in Python
c. dict MVME_STATUS
-- the return information defined in "mvmestd.h"
d. the related useful aliases from "mvmestd.h"
-- including "mvme_addr_t", "mvme_locaddr_t", "mvme_size_t"
e. class MvmeDev
-- the major class which provides methods to access VME bus.
You may find examples of how to use module "PyMVME" from "find_caen.py" or
scripts in dir "test". All of the examples are using "lib_sis3100mvme.so".
You may find information later in this introduction.
** find_caen.py
The script to find VME modules from CAEN. Now, it is still in test status
and can only find ADCs, TDCs or QDCs.
* SIS3100 library to be used togather with "mvmestd.h"
The directory "sis3100" contains sources to build libraries as the following:
a. lib_sis3100.a -- APIs declared in "sis3100_vme_calls.h"
b. lib_sis3100mvme.a -- APIs declared in "mvmestd.h". It also contains the
same APIs from lib_sis3100.a
If you want to use shared libraries, especially when you are using utilities
wrote in Python, you may rebuild the libraries as the following:
$ cd sis3100
$ make shared
* APIs to handle VME modules
** vadc_caen.h/c
Provides APIs to handle ADC-type modules from CAEN, including:
a. ADCs --- V785, V785N
b. TDCs --- V775, V775N
c. QDCs --- V792, V792N
* VME bus testers
Still under development.
|
619
|
21 Aug 2009 |
Exaos Lee | Forum | Link error of "mcnaf" |
The "utils/mcnaf.c" uses "camop()",
180: printf("camop\n");
181: camop();
But "drivers/camac/camacrpc.c" provides "cam_op()":
void cam_op()
{
}
If you compile each source into an object, you may encounter a link error as
mcnaf.c:(.text+0x3b1): undefined reference to `camop'
collect2: ld returned 1 exit status
The "mcstd.h" provides "camop". So, we need to change "camacrpc.c" to match the definition and fix the link error. |
621
|
29 Aug 2009 |
Exaos Lee | Forum | At last, I'm here again! |
I always got a 503 server error while I tried to connect this log book the latest
weeks. I don't know why. I hope it is not due to the network censorship because
of the coming National Day of China. Anyway, good luck to me when I want to paste
something here. |
622
|
31 Aug 2009 |
Exaos Lee | Forum | Link error of "mcnaf" |
I repeated the link error again. I also found the almost all sources located in "driver/camac/" using "cam_op()" but not "camop()". Please see the grep result below:
drivers/camac/camaclx.c:760:INLINE void cam_op()
drivers/camac/camacnul.c:200:INLINE void cam_op()
drivers/camac/camacrpc.c:563:void cam_op()
drivers/camac/cc7700pci.c:744:INLINE void cam_op()
drivers/camac/ces2117.c:227:void cam_op()
drivers/camac/ces8210.c:553:void cam_op(void)
drivers/camac/ces8210.c:576: cam_op();
drivers/camac/ces8210.c:625: cam_op();
drivers/camac/dsp004.c:692:void cam_op()
drivers/camac/hyt1331.c:1125:INLINE void cam_op()
drivers/camac/jorway73a.c:563:INLINE void cam_op()
drivers/camac/kcs2926.c:618:INLINE void cam_op()
drivers/camac/kcs2927.c:677:INLINE void cam_op()
drivers/camac/wecc32.c:554:INLINE void cam_op()
I also found why the default Makefile can pass away this problem. I found the "make" using the following command to compile the "mcnaf":
cc -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_MYSQL -I/usr/include/mysql -DHAVE_ODBC -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/bin/mcnaf utils/mcnaf.c drivers/camac/camacrpc.c linux/lib/libmidas.a -lutil -lpthread -lodbc -lz
I try to re-implement the link error again. So I wrote some test code.
1. anullf.h
#ifndef _ANULLF_H_
#define _ANULLF_H_ 1
#define EXTERNAL extern
#if defined( _MSC_VER )
#define INLINE __inline
#elif defined(__GNUC__)
#define INLINE __inline__
#else
#define INLINE
#endif
/* make functions under WinNT dll exportable */
#if defined(_MSC_VER) && defined(MIDAS_DLL)
#define EXPRT __declspec(dllexport)
#else
#define EXPRT
#endif
EXTERNAL INLINE void EXPRT camop() { };
#endif
2. ma_1.c
#include "anullf.h"
void cam_op() {}
3. ma.c
#include "anullf.h"
#include <stdio.h>
int main(int argc, char** argv)
{
camop();
}
Then, only compiling as below can pass:
$ gcc -O -o ma ma_1.c ma.c
If you remove the option "-O", compiling immediately fails in a link error. Whether you compile into objects then link them or just compile them together, you can pass with option "-O" or the similar options. It is because the compile could solve linking to a dummy function automatically with option "-O".
Anyway, we should fix this no matter changing the "mcstd.h" or codes located in "driver/camac/". |
623
|
31 Aug 2009 |
Exaos Lee | Forum | Why should we use "INLINE" here? |
There are many "INLINE" definitions in "include/*.h". Both GNU C and C99 permit using inline functions. I still wonder why. ![Smile Smile](icons/smile.png) |
628
|
03 Sep 2009 |
Exaos Lee | Bug Report | Prompt problem about odbedit |
I tried to use odbedit to set the "/System/Prompt" to "%h:%e:%s %p> " and got a
problem: pressing "Return" doesn't work any more. But "[%h:%e:%s]%p> " works fine.
Please see the attachment. |
Attachment 1: Screenshot-10.png
|
|
629
|
03 Sep 2009 |
Exaos Lee | Suggestion | Building MIDAS using CMake |
I write some configure file to build MIDAS using CMake. The usage is simple:
1. Unzip the attachment, copy "CMakeLists.txt" and directory "cmake" into the
midas source tree.
$ cp -rp CMakeLists.txt cmake/ <PATH-TO-MIDAS>/
2. make a separate directory, such as "build". It's a good habit to build a
project without polluting the source tree. :-)
$ mkdir build
3. Executing cmake
$ cd build && cmake <PATH-TO-MIDAS>
4. Make
$ make
Or, you can generate Xcode project files:
$ cmake -G Xcode <PATH-TO-MIDAS>
or using visual studio
$ cmake -G "Visual Studio" <PATH-TO-MIDAS>
(I havn't Visual Studio and windows, so the above command is not tested.)
or using other IDEs, such as KDevelop3, Eclipse, etc, just type:
$ cmake -G "KDevelop3" <PATH-TO-MIDAS>
or
$ cmake -G "Eclipse CDT4" <PATH-TO-MIDAS>
I test the configure file with GNU make and CMake 2.6.4 on Debian Lenny. I
havn't add installation commands now. Maybe later. If anyone interests in it, I
may check it again. Anyway, I'm using it. |
Attachment 1: cmake.zip
|
630
|
03 Sep 2009 |
Exaos Lee | Suggestion | Some screenshot using CMake with MIDAS |
I didn't add optimization flags to compile, so I got link error while generating mcnaf as I reported before.
The screen-shots show that the configure files works because I have modified the "driver/camac/camacrpc.c". |
Attachment 1: Screenshot-11.png
|
|
Attachment 2: Screenshot-13.png
|
|
633
|
06 Sep 2009 |
Exaos Lee | Bug Report | Delete key "/A_Str" problem |
Another problem while using odbedit.
I tried the batch mode of "odbedit". I created a key as "/A_Str" by mistake and
wanted to delete it. Then "odbedit" failed to accept the "Return" key. Please see
the screen-shot attached. :-( |
Attachment 1: odbedit.png
|
|
634
|
06 Sep 2009 |
Exaos Lee | Suggestion | Could not create strings other than 32 characters with odbedit -c "..." command |
> Ok, I added a command
>
> odbedit -c "create STRING Test[8][40]"
>
> which works now. Please update to SVN revision 4555 of odbedit.c
>
> - Stefan
If I want to create only one string, should I write like this:
odbedit -c "create STRING Test[] [256]"
OK. I need it. I will try the new odbedit. |
635
|
06 Sep 2009 |
Exaos Lee | Bug Report | Compiling error of "src/history_odbc.cxx" |
Version svn-r4556, I got a compiling error as below:
/opt/DAQ/bot/midas/src/history_odbc.cxx: In member function 'virtual int
SqlODBC::GetNumRows()':
/opt/DAQ/bot/midas/src/history_odbc.cxx:589: error: cannot convert 'SQLINTEGER*'
to 'long int*' for argument '2' to 'SQLRETURN SQLRowCount(void*, long int*)'
/opt/DAQ/bot/midas/src/history_odbc.cxx: In member function 'virtual const char*
SqlODBC::GetColumn(int)':
/opt/DAQ/bot/midas/src/history_odbc.cxx:638: error: cannot convert 'SQLINTEGER*'
to 'long int*' for argument '6' to 'SQLRETURN SQLGetData(void*, SQLUSMALLINT,
SQLSMALLINT, void*, long int, long int*)'
make[2]: *** [CMakeFiles/midas-static.dir/src/history_odbc.cxx.o] Error 1
make[2]: Leaving directory `/opt/DAQ/bot/midas/build'
make[1]: *** [CMakeFiles/midas-static.dir/all] Error 2
make[1]: Leaving directory `/opt/DAQ/bot/midas/build'
The detail error log is attached. I used my CMake script without any optimization flags. I will try the default Makefile again. |
Attachment 1: build-err.log
|
/usr/bin/cmake -H/opt/DAQ/bot/midas -B/opt/DAQ/bot/midas/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /opt/DAQ/bot/midas/build/CMakeFiles /opt/DAQ/bot/midas/build/CMakeFiles/progress.make
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/opt/DAQ/bot/midas/build'
make -f CMakeFiles/midas-static.dir/build.make CMakeFiles/midas-static.dir/depend
make[2]: Entering directory `/opt/DAQ/bot/midas/build'
cd /opt/DAQ/bot/midas/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/DAQ/bot/midas /opt/DAQ/bot/midas /opt/DAQ/bot/midas/build /opt/DAQ/bot/midas/build /opt/DAQ/bot/midas/build/CMakeFiles/midas-static.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/opt/DAQ/bot/midas/build'
make -f CMakeFiles/midas-static.dir/build.make CMakeFiles/midas-static.dir/build
make[2]: Entering directory `/opt/DAQ/bot/midas/build'
/usr/bin/cmake -E cmake_progress_report /opt/DAQ/bot/midas/build/CMakeFiles 41
[ 1%] Building CXX object CMakeFiles/midas-static.dir/src/history_odbc.cxx.o
/usr/bin/c++ -DOS_LINUX -D_LARGEFILE64_SOURCE -DHAVE_STRLCPY -DINCLUDE_FTPLIB -DHAVE_ODBC -DHAVE_ZLIB -I/opt/DAQ/bot/midas/include -I/opt/DAQ/bot/mxml -o CMakeFiles/midas-static.dir/src/history_odbc.cxx.o -c /opt/DAQ/bot/midas/src/history_odbc.cxx
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:95: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:116: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx:136: warning: deprecated conversion from string constant to 'char*'
/opt/DAQ/bot/midas/src/history_odbc.cxx: In member function 'virtual int SqlODBC::GetNumRows()':
/opt/DAQ/bot/midas/src/history_odbc.cxx:589: error: cannot convert 'SQLINTEGER*' to 'long int*' for argument '2' to 'SQLRETURN SQLRowCount(void*, long int*)'
/opt/DAQ/bot/midas/src/history_odbc.cxx: In member function 'virtual const char* SqlODBC::GetColumn(int)':
/opt/DAQ/bot/midas/src/history_odbc.cxx:638: error: cannot convert 'SQLINTEGER*' to 'long int*' for argument '6' to 'SQLRETURN SQLGetData(void*, SQLUSMALLINT, SQLSMALLINT, void*, long int, long int*)'
make[2]: *** [CMakeFiles/midas-static.dir/src/history_odbc.cxx.o] Error 1
make[2]: Leaving directory `/opt/DAQ/bot/midas/build'
make[1]: *** [CMakeFiles/midas-static.dir/all] Error 2
make[1]: Leaving directory `/opt/DAQ/bot/midas/build'
make: *** [all] Error 2
|
636
|
06 Sep 2009 |
Exaos Lee | Bug Report | Compiling error of "src/history_odbc.cxx" |
Exaos Lee wrote: | Version svn-r4556, I got a compiling error as below:
The detail error log is attached. I used my CMake script without any optimization flags. I will try the default Makefile again. |
BUG is confirmed using the default "Makefile". |
637
|
06 Sep 2009 |
Exaos Lee | Bug Fix | Maybe a fix |
Changing "SQLINTEGER" to "SQLLEN" maybe let the compiling pass. See the attached diff.
But I failed in another error. It was the problem in CMakeLists.txt. (FIXED) |
Attachment 1: history_odbc.cxx.diff
|
diff --git a/src/history_odbc.cxx b/src/history_odbc.cxx
index 5f00016..392062f 100644
--- a/src/history_odbc.cxx
+++ b/src/history_odbc.cxx
@@ -584,7 +584,7 @@ int SqlODBC::Exec(const char* sql)
int SqlODBC::GetNumRows()
{
- SQLINTEGER nrows = 0;
+ SQLLEN nrows = 0;
/* How many rows are there */
int status = SQLRowCount(fStmt, &nrows);
if (!SQL_SUCCEEDED(status)) {
@@ -634,7 +634,7 @@ int SqlODBC::Done()
const char* SqlODBC::GetColumn(int icol)
{
static char buf[1024];
- SQLINTEGER indicator;
+ SQLLEN indicator;
int status = SQLGetData(fStmt, icol, SQL_C_CHAR, buf, sizeof(buf), &indicator);
if (!SQL_SUCCEEDED(status)) {
|
638
|
06 Sep 2009 |
Exaos Lee | Suggestion | Updated "CMakeLists.txt" |
Add installation commands. Please see the attachment. |
Attachment 1: CMakeLists.txt
|
#-*- mode: cmake -*-
## CMake pre-settings
cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.6)
cmake_policy(SET CMP0011 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
## Project setup
project(MIDAS)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
enable_language(C)
enable_language(CXX)
## Include utilities and options
# Find mxml
include(FindMXML)
include_directories(include ${MXML_PATH})
# OS specific flags
# OS-related CMake variables:
# 1. OS_EXTRA_UTILS --- Extra utilities for specific OS
# 2. OS_EXTRA_LDFLAGS --- Extra link flags for specific OS
# 3. OS_EXTRA_DEFS --- Extra definitions for specific OS
# 4. Other flags switched on for specific OS
include(OSflags)
include(FindROOT) # Find ROOT environment
include(FindMySQL) # Find MySQL
include(FindODBC) # Find ODBC
include(FindZLIB) # Find zlib
## Options for MIDAS
set(NEED_CERNLIB TRUE) # Need CERNLIB or not?
set(NEED_SHLIB TRUE) # Need shared library?
set(NEED_ROOT TRUE) # Need root?
set(NEED_FTPLIB TRUE) # Need ftp protocol?
#set(NEED_STRLCPY TRUE) # Need strlcpy.h? -- maybe opened in OSflags.cmake
#set(MIDAS_MAX_EVENT_SIZE 1000000) # maxmimum event size = ?
##############################################################################
## Setup options
## OS-specific
add_definitions(${OS_EXTRA_DEFS})
set(LDFLAGS "${LDFLAGS} ${OS_EXTRA_LDFLAGS}")
set(EXTRA_UTILS ${EXTRA_UTILS} ${OS_EXTRA_UTILS})
## Midas max event size
if(MIDAS_MAX_EVENT_SIZE)
add_definitions(-DMAX_EVENT_SIZE=${MIDAS_MAX_EVENT_SIZE})
endif(MIDAS_MAX_EVENT_SIZE)
## strlcpy in "MXML"?
if(NEED_STRLCPY)
set(EXTRA_OBJS ${EXTRA_OBJS} strlcpy)
add_definitions( -DHAVE_STRLCPY )
message(STATUS "Using Stephen's own strlcpy()")
endif(NEED_STRLCPY)
## FTPLIB needed?
if(NEED_FTPLIB)
set(FTPLIB ftplib)
add_definitions(-DINCLUDE_FTPLIB)
message(STATUS "Using ftplib (FTP library)")
endif(NEED_FTPLIB)
## ODBC: -lodbc or -liodbc
if(ODBC_FOUND)
message(STATUS "Add ODBC-specified targets using ${ODBC_LIBRARY}")
set(EXTRA_UTILS ${EXTRA_UTILS} mh2sql)
add_definitions(-DHAVE_ODBC)
set(LDFLAGS "${LDFLAGS} -l${ODBC_NAME}")
else(ODBC_FOUND)
message(STATUS "ODBC not found!")
endif(ODBC_FOUND)
## ZLIB
if(ZLIB_FOUND)
add_definitions(-DHAVE_ZLIB)
set(LDFLAGS "${LDFLAGS} -lz")
endif(ZLIB_FOUND)
## ROOT
if(NEED_ROOT AND ROOT_FOUND)
message(STATUS "Using ROOT at ${ROOTSYS}")
if(NEED_RPATH) # Add rpath ..
set(ROOT_LIBS "${ROOT_LIBS} -Wl,-rpath,${ROOTSYS}/lib")
endif(NEED_RPATH)
## libRoot.a: Static ROOT library
if(NEED_LIBROOTA AND ROOT_LIBA)
set(LDFLAGS "${LDFLAGS} ${ROOTSYS}/lib/libRoot.a -lssl -ldl -lcrypt")
message(STATUS "Using statlic ROOT library: ${ROOT_LIBA}")
endif(NEED_LIBROOTA AND ROOT_LIBA)
endif(NEED_ROOT AND ROOT_FOUND)
####### MIDAS library and objects #########################
## Objects needed to build the libmidas(.a,.so,..)
foreach(obj ${FTPLIB} midas system mrpc odb ybos history alarm elog)
set(LIB_OBJS ${LIB_OBJS} src/${obj}.c)
endforeach(obj)
foreach(obj mxml ${EXTRA_OBJS})
set(LIB_OBJS ${LIB_OBJS} ${MXML_PATH}/${obj}.c)
endforeach(obj)
if(ODBC_FOUND)
set(LIB_OBJS ${LIB_OBJS} src/history_odbc.cxx)
endif(ODBC_FOUND)
## Library definition
## Add static lib
add_library(midas-static STATIC ${LIB_OBJS})
set_target_properties(midas-static PROPERTIES OUTPUT_NAME "midas")
if(NEED_SHLIB) # Add shared lib
add_library(midas-shared SHARED ${LIB_OBJS})
set_target_properties(midas-shared PROPERTIES OUTPUT_NAME "midas")
endif(NEED_SHLIB)
########## Utilities ######################################
## Core Utilties
set(CORE_UTILS mserver mhttpd mlogger odbedit lazylogger)
add_executable(mserver src/mserver.c)
add_executable(mlogger src/mlogger.c)
add_executable(mhttpd src/mhttpd.c src/mgd.c )
add_executable(odbedit src/odbedit.c src/cmdedit.c )
add_executable(lazylogger src/lazylogger.c)
foreach(exe ${CORE_UTILS})
target_link_libraries(${exe} midas-static)
set_target_properties(${exe} PROPERTIES LINK_FLAGS "${LDFLAGS}")
endforeach(exe)
set_target_properties( mhttpd PROPERTIES
LINK_FLAGS "-lm ${LDFLAGS}" LINKER_LANGUAGE CXX )
## for mlogger --- It's BAD to name a CXX source using ".c" file extension !!!
set_target_properties( mlogger
PROPERTIES
LINK_FLAGS "${MYSQL_LIBS} ${ROOT_LIBS} ${LDFLAGS}"
LINKER_LANGUAGE CXX
COMPILE_FLAGS "${ROOT_CFLAGS}" )
set_source_files_properties( src/mlogger.c PROPERTIES LANGUAGE CXX )
## Utilities
set(UTILS mtape mhist mstat mdump mchart
webpaw odbhist melog mcnaf
mhdump mtransition # C++ codes
${EXTRA_UTILS} )
foreach(exe mtape mhist mstat mdump melog mchart odbhist webpaw)
add_executable(${exe} utils/${exe}.c)
endforeach(exe)
add_executable(mhdump utils/mhdump.cxx)
add_executable(mcnaf utils/mcnaf.c drivers/camac/camacrpc.c)
add_executable(mtransition src/mtransition.cxx)
# optional utilities
if("${UTILS}" MATCHES "mh2sql")
add_executable(mh2sql utils/mh2sql.cxx src/history_odbc.cxx )
endif("${UTILS}" MATCHES "mh2sql")
if("${UTILS}" MATCHES "mlxspeaker")
add_executable(mlxspeaker utils/mlxspeaker.c)
endif("${UTILS}" MATCHES "mlxspeaker")
if("${UTILS}" MATCHES "dio")
add_executable(dio utils/dio.c)
endif("${UTILS}" MATCHES "dio")
foreach(exe ${UTILS})
add_dependencies(${exe} midas-static)
target_link_libraries(${exe} midas-static)
set_target_properties(${exe} PROPERTIES LINK_FLAGS "${LDFLAGS}")
endforeach(exe)
## Scripts
set(SCRIPTS stripchart.tcl ) # TCL script
## Special targets
## for generating mfe.o
add_custom_command( OUTPUT mfe.o DEPENDS src/mfe.c
COMMAND ${CMAKE_C_COMPILER}
ARGS -I${CMAKE_SOURCE_DIR}/include -c ${CMAKE_SOURCE_DIR}/src/mfe.c
WORKING_DIRECTORY lib )
add_custom_target(mfe ALL DEPENDS mfe.o)
## for generating mfe.o
add_custom_command( OUTPUT fal.o DEPENDS src/fal.c
COMMAND ${CMAKE_C_COMPILER}
ARGS -I${CMAKE_SOURCE_DIR}/include -Dextname -DMANA_LITE
-c ${CMAKE_SOURCE_DIR}/src/fal.c
WORKING_DIRECTORY lib )
add_custom_target(fal ALL DEPENDS fal.o)
## analyzer objects: mana.o
add_custom_command( OUTPUT mana.o DEPENDS src/mana.c
COMMAND ${CMAKE_C_COMPILER}
ARGS -I${CMAKE_SOURCE_DIR}/include -c ${CMAKE_SOURCE_DIR}/src/mana.c
WORKING_DIRECTORY lib )
add_custom_target(mana ALL DEPENDS mana.o)
set(EXTRA_MOBJS mfe.o fal.o mana.o)
# rmana.o
if(NEED_ROOT)
set(ARG_LIST "-DUSE_ROOT ${ROOT_CFLAGS} -I${CMAKE_SOURCE_DIR}/include -o rmana.o -c ${CMAKE_SOURCE_DIR}/src/mana.c")
separate_arguments(ARG_LIST)
add_custom_command( OUTPUT rmana.o DEPENDS src/mana.c
COMMAND ${CMAKE_CXX_COMPILER}
ARGS ${ARG_LIST} WORKING_DIRECTORY lib )
add_custom_target(rmana ALL DEPENDS rmana.o )
set(EXTRA_MOBJS ${EXTRA_MOBJS} rmana.o )
endif(NEED_ROOT)
## hmana.o
if(NEED_CERNLIB)
add_custom_command( OUTPUT hmana.o DEPENDS src/mana.c
COMMAND ${CMAKE_C_COMPILER}
ARGS -I${CMAKE_SOURCE_DIR}/include -Dextname -DHAVE_HBOOK -o hmana.o
-c ${CMAKE_SOURCE_DIR}/src/mana.c
WORKING_DIRECTORY lib )
add_custom_target(hmana ALL DEPENDS hmana.o)
set(EXTRA_MOBJS ${EXTRA_MOBJS} hmana.o )
endif(NEED_CERNLIB)
########## Drivers and modules ################################
#
########## Examples ###########################################
#
########## Installation########################################
#
## Library and objects (custom targets)
install(TARGETS midas-static ARCHIVE DESTINATION lib)
if(NEED_SHLIB)
install(TARGETS midas-shared LIBRARY DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_EXECUTE WORLD_READ)
endif(NEED_SHLIB)
foreach(obj ${EXTRA_MOBJS})
install(FILES ${PROJECT_BINARY_DIR}/lib/${obj} DESTINATION lib)
endforeach(obj)
## Core and extra utilities, scripts
install(TARGETS ${CORE_UTILS} ${UTILS}
RUNTIME DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_EXECUTE WORLD_READ)
#install ${SCRIPTS}
foreach(script ${SCRIPTS})
install(FILES utils/${script} DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_EXECUTE WORLD_READ)
endforeach(script)
## include, src, examples, drivers
# install(DIRECTORY include/ DESTINATION include/midas
# FILES_MATCHING PATTERN "*.h")
# install(DIRECTORY src DESTINATION share/midas)
# install(DIRECTORY examples DESTINATION share/midas)
# install(DIRECTORY drivers DESTINATION share/midas)
install(DIRECTORY include/ DESTINATION include
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY src/ DESTINATION src)
install(DIRECTORY examples/ DESTINATION examples)
install(DIRECTORY drivers/ DESTINATION drivers)
|
639
|
06 Sep 2009 |
Exaos Lee | Bug Report | Delete key "/A_Str" problem |
> Another problem while using odbedit.
> I tried the batch mode of "odbedit". I created a key as "/A_Str" by mistake and
> wanted to delete it. Then "odbedit" failed to accept the "Return" key. Please see
> the screen-shot attached. :-(
This bug has been fixed in the latest repository.
I encountered it in svn-r4488. |
640
|
06 Sep 2009 |
Exaos Lee | Suggestion | Could not create strings other than 32 characters with odbedit -c "..." command |
> > Ok, I added a command
> >
> > odbedit -c "create STRING Test[8][40]"
> >
> > which works now. Please update to SVN revision 4555 of odbedit.c
> >
> > - Stefan
>
> If I want to create only one string, should I write like this:
>
> odbedit -c "create STRING Test[] [256]"
>
> OK. I need it. I will try the new odbedit.
"create STRING test[1][256]" works. |