1
0
Fork 0

split Basics into BasicsC and Basics

This commit is contained in:
Frank Celler 2011-12-20 11:14:22 +01:00
parent 1f86f0a665
commit 9aa453f628
201 changed files with 1943 additions and 907 deletions

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_BORNHOLM_ADMIN_REST_HANDLER_CREATOR_H
#define TRIAGENS_BORNHOLM_ADMIN_REST_HANDLER_CREATOR_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace rest {

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_BORNHOLM_ADMIN_RIGHT_H
#define TRIAGENS_BORNHOLM_ADMIN_RIGHT_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/Logger.h>

View File

@ -32,7 +32,7 @@
#include <pwd.h>
#include <grp.h>
#include <Basics/conversions.h>
#include <BasicsC/conversions.h>
#include <Basics/DeleteObject.h>
#include <Basics/FileUtils.h>
#include <Basics/Logger.h>

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_FYN_APPLICATION_SERVER_APPLICATION_SERVER_IMPL_H
#define TRIAGENS_FYN_APPLICATION_SERVER_APPLICATION_SERVER_IMPL_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/ProgramOptions.h>
#include <Basics/ProgramOptionsDescription.h>
@ -124,44 +124,44 @@
namespace triagens {
namespace rest {
////////////////////////////////////////////////////////////////////////////////
/// @brief application server implementation
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief application server implementation
////////////////////////////////////////////////////////////////////////////////
class ApplicationServerImpl : virtual public ApplicationServer {
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
ApplicationServerImpl (string const& description, string const& version);
////////////////////////////////////////////////////////////////////////////////
/// @brief destructor
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief destructor
////////////////////////////////////////////////////////////////////////////////
~ApplicationServerImpl ();
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void addFeature (ApplicationFeature*);
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void setSystemConfigFile (string const& name) {
systemConfigFile = name;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void setUserConfigFile (string const& name) {
userConfigFile = name;
@ -169,92 +169,92 @@ namespace triagens {
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
basics::ProgramOptions& programOptions () {
return options;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
vector<string> programArguments () {
return arguments;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool parse (int argc, char* argv[], map<string, basics::ProgramOptionsDescription>);
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void start ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void wait ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void beginShutdown ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void shutdown ();
protected:
////////////////////////////////////////////////////////////////////////////////
/// @brief add options to description
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief add options to description
////////////////////////////////////////////////////////////////////////////////
virtual void setupOptions (map<string, basics::ProgramOptionsDescription>&);
////////////////////////////////////////////////////////////////////////////////
/// @brief parsing phase 1, before config file
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief parsing phase 1, before config file
////////////////////////////////////////////////////////////////////////////////
virtual bool parsePhase1 ();
////////////////////////////////////////////////////////////////////////////////
/// @brief parsing phase 2, after config file
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief parsing phase 2, after config file
////////////////////////////////////////////////////////////////////////////////
virtual bool parsePhase2 ();
protected:
////////////////////////////////////////////////////////////////////////////////
/// @brief program options
///
/// @CMDOPT{--help}
///
/// @CMDOPT{-h}
///
/// Prints a list of the most common options available and then
/// exits. In order to see all options use @CODE{--help-all}.
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief program options
///
/// @CMDOPT{--help}
///
/// @CMDOPT{-h}
///
/// Prints a list of the most common options available and then
/// exits. In order to see all options use @CODE{--help-all}.
////////////////////////////////////////////////////////////////////////////////
basics::ProgramOptions options;
////////////////////////////////////////////////////////////////////////////////
/// @brief defined features
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief defined features
////////////////////////////////////////////////////////////////////////////////
vector<ApplicationFeature*> features;
@ -266,15 +266,15 @@ namespace triagens {
private:
string title;
////////////////////////////////////////////////////////////////////////////////
/// @brief program options
///
/// @CMDOPT{--version}
///
/// @CMDOPT{-v}
///
/// Prints the version of the server and exits.
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief program options
///
/// @CMDOPT{--version}
///
/// @CMDOPT{-v}
///
/// Prints the version of the server and exits.
////////////////////////////////////////////////////////////////////////////////
string version;

View File

@ -40,7 +40,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_ASSOCIATIVE_ARRAY_H
#define TRIAGENS_JUTLAND_BASICS_ASSOCIATIVE_ARRAY_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_CONDITION_LOCKER_H
#define TRIAGENS_JUTLAND_BASICS_CONDITION_LOCKER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/ConditionVariable.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_CONDITION_VARIABLE_POSIX_H
#define TRIAGENS_JUTLAND_BASICS_CONDITION_VARIABLE_POSIX_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_CONDITION_VARIABLE_H
#define TRIAGENS_JUTLAND_BASICS_CONDITION_VARIABLE_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef TRI_HAVE_POSIX_THREADS
#include <Basics/ConditionVariable-posix.h>

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_DELETE_OBJECT_H
#define TRIAGENS_JUTLAND_BASICS_DELETE_OBJECT_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -32,10 +32,10 @@
#ifndef TRIAGENS_JUTLAND_BASICS_DICTIONARY_H
#define TRIAGENS_JUTLAND_BASICS_DICTIONARY_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/AssociativeArray.h>
#include <Basics/hashes.h>
#include <BasicsC/hashes.h>
namespace triagens {
namespace basics {

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_EXCEPTIONS_H
#define TRIAGENS_JUTLAND_BASICS_EXCEPTIONS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <errno.h>

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_FILE_UTILS_H
#define TRIAGENS_JUTLAND_BASICS_FILE_UTILS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_FUNCTOR_H
#define TRIAGENS_JUTLAND_BASICS_FUNCTOR_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -27,10 +27,10 @@
#include <Basics/Initialise.h>
#include <Basics/init.h>
#include <Basics/error.h>
#include <Basics/hashes.h>
#include <Basics/randomx.h>
#include <BasicsC/init.h>
#include <BasicsC/error.h>
#include <BasicsC/hashes.h>
#include <BasicsC/random.h>
#include <Basics/Logger.h>
#include <Basics/Random.h>

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_INITIALISE_H
#define TRIAGENS_JUTLAND_BASICS_INITIALISE_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {

View File

@ -29,9 +29,9 @@
#ifndef TRIAGENS_JUTLAND_BASICS_LOGGER_H
#define TRIAGENS_JUTLAND_BASICS_LOGGER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/logging.h>
#include <BasicsC/logging.h>
#include <Basics/LoggerInfo.h>
#include <Basics/LoggerTiming.h>
#include <Basics/LoggerStream.h>

View File

@ -29,9 +29,9 @@
#ifndef TRIAGENS_JUTLAND_BASICS_LOGGER_DATA_H
#define TRIAGENS_JUTLAND_BASICS_LOGGER_DATA_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/logging.h>
#include <BasicsC/logging.h>
#include <Basics/Thread.h>
// -----------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_LOGGER_INFO_H
#define TRIAGENS_JUTLAND_BASICS_LOGGER_INFO_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/LoggerData.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_LOGGER_STREAM_H
#define TRIAGENS_JUTLAND_BASICS_LOGGER_STREAM_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/LoggerInfo.h>

View File

@ -29,9 +29,9 @@
#ifndef TRIAGENS_JUTLAND_BASICS_MUTEX_H
#define TRIAGENS_JUTLAND_BASICS_MUTEX_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/locks.h>
#include <BasicsC/locks.h>
// -----------------------------------------------------------------------------
// --SECTION-- class Mutex

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_MUTEX_LOCKER_H
#define TRIAGENS_JUTLAND_BASICS_MUTEX_LOCKER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/Mutex.h>

View File

@ -29,8 +29,8 @@
#include <fstream>
#include <Basics/strings.h>
#include <Basics/conversions.h>
#include <BasicsC/strings.h>
#include <BasicsC/conversions.h>
#include <Basics/Exceptions.h>
#include <Basics/Logger.h>

View File

@ -28,9 +28,9 @@
#ifndef TRIAGENS_JUTLAND_BASICS_PROGRAM_OPTIONS_H
#define TRIAGENS_JUTLAND_BASICS_PROGRAM_OPTIONS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/vector.h>
#include <BasicsC/vector.h>
#include <Basics/ProgramOptionsDescription.h>
// -----------------------------------------------------------------------------

View File

@ -27,9 +27,10 @@
#include "ProgramOptionsDescription.h"
#include <BasicsC/terminal-utils.h>
#include <Basics/Exceptions.h>
#include <Basics/StringUtils.h>
#include <Basics/TerminalUtils.h>
using namespace std;
using namespace triagens::basics;
@ -599,7 +600,7 @@ string ProgramOptionsDescription::usage (set<string> const& help, bool addHelpOp
}
// construct the parameters
size_t tWidth = TerminalUtils::columnsWidth();
size_t tWidth = TRI_ColumnsWidth();
if (tWidth < 40) {
tWidth = 40;

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_PROGRAM_OPTIONS_DESCRIPTION_H
#define TRIAGENS_JUTLAND_BASICS_PROGRAM_OPTIONS_DESCRIPTION_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_RANDOM_H
#define TRIAGENS_JUTLAND_BASICS_RANDOM_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -34,7 +34,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_RANDOM_HEAP_H
#define TRIAGENS_JUTLAND_BASICS_RANDOM_HEAP_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_READ_LOCKER_H
#define TRIAGENS_JUTLAND_BASICS_READ_LOCKER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/ReadWriteLock.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_READ_UNLOCKER_H
#define TRIAGENS_JUTLAND_BASICS_READ_UNLOCKER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/ReadWriteLock.h>

View File

@ -29,9 +29,9 @@
#ifndef TRIAGENS_JUTLAND_BASICS_READ_WRITE_LOCK_H
#define TRIAGENS_JUTLAND_BASICS_READ_WRITE_LOCK_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/locks.h>
#include <BasicsC/locks.h>
#undef READ_WRITE_LOCK_COUNTER

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_ROUND_ROBIN_FIGURES_H
#define TRIAGENS_JUTLAND_BASICS_ROUND_ROBIN_FIGURES_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <math.h>

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_SOCKET_UTILS_H
#define TRIAGENS_JUTLAND_BASICS_SOCKET_UTILS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -35,7 +35,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_STRING_BUFFER_H
#define TRIAGENS_JUTLAND_BASICS_STRING_BUFFER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
// -----------------------------------------------------------------------------
// string buffer with formatting routines

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_STRING_UTILS_H
#define TRIAGENS_JUTLAND_BASICS_STRING_UTILS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -1,89 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief implements the routine columnWidths with the api of the ncurseslib
///
/// @file
/// DISCLAIMER
///
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Esteban Lombeyda
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "Basics/TerminalUtils.h"
#ifdef HAVE_NCURSES
#ifdef TRI_HAVE_NCURSES_CURSES_H
#include <ncurses/term.h>
#include <ncurses/curses.h>
#endif
#ifdef TRI_HAVE_CURSES_H
#include <term.h>
#include <curses.h>
#endif
#endif
#include <stdlib.h>
#include <Basics/StringUtils.h>
namespace triagens {
namespace basics {
namespace TerminalUtils {
#ifdef HAVE_NCURSES
int columnsWidth () {
int ret = 0;
/* initializing terminfo */
int init_ret = setupterm(NULL, fileno(stdin), NULL);
if (init_ret != 0) {
return DEFAULT_COLUMNS;
}
union {
char * a;
char const * b;
}c;
c.b = "cols";
ret = tigetnum(c.a);
return ret == -1 ? DEFAULT_COLUMNS : ret;
}
#else
int columnsWidth () {
static int DEFAULT_COLUMNS = 80;
char* e = getenv("COLUMNS");
if (e != 0) {
int c = StringUtils::int32(e);
if (c == 0) {
return DEFAULT_COLUMNS;
}
return c;
}
return DEFAULT_COLUMNS;
}
#endif
}
}
}

View File

@ -1,59 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief collections of terminal functions
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_JUTLAND_BASICS_TERMINAL_UTILS_H
#define TRIAGENS_JUTLAND_BASICS_TERMINAL_UTILS_H 1
#include <Basics/Common.h>
namespace triagens {
namespace basics {
////////////////////////////////////////////////////////////////////////////////
/// @brief collection of terminal functions
////////////////////////////////////////////////////////////////////////////////
namespace TerminalUtils {
////////////////////////////////////////////////////////////////////////////////
/// @brief default value for number of columns of a terminal
////////////////////////////////////////////////////////////////////////////////
static int const DEFAULT_COLUMNS = 80;
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the columns
////////////////////////////////////////////////////////////////////////////////
int columnsWidth ();
}
}
}
#endif

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_THREAD_POSIX_H
#define TRIAGENS_JUTLAND_BASICS_THREAD_POSIX_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
////////////////////////////////////////////////////////////////////////////////
/// @defgroup Threads Threads, Locks, and Conditions

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_THREAD_H
#define TRIAGENS_JUTLAND_BASICS_THREAD_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef TRI_HAVE_POSIX_THREADS
#include <Basics/Thread-posix.h>

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_TIMING_H
#define TRIAGENS_JUTLAND_BASICS_TIMING_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
namespace triagens {
namespace basics {

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_VARIANT_OBJECT_H
#define TRIAGENS_JUTLAND_BASICS_VARIANT_OBJECT_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/Exceptions.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_WRITE_LOCKER_H
#define TRIAGENS_JUTLAND_BASICS_WRITE_LOCKER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/ReadWriteLock.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_WRITE_UNLOCKER_H
#define TRIAGENS_JUTLAND_BASICS_WRITE_UNLOCKER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/ReadWriteLock.h>

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_JUTLAND_BASICS_SAFE_CAST_H
#define TRIAGENS_JUTLAND_BASICS_SAFE_CAST_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/Exceptions.h>

View File

@ -38,8 +38,8 @@
////////////////////////////////////////////////////////////////////////////////
#define TRI_WITHIN_COMMON 1
#include <Basics/OperatingSystem.h>
#include <Basics/LocalConfiguration.h>
#include <BasicsC/operating-system.h>
#include <BasicsC/LocalConfiguration.h>
#undef TRI_WITHIN_COMMON
////////////////////////////////////////////////////////////////////////////////
@ -130,9 +130,9 @@
////////////////////////////////////////////////////////////////////////////////
#define TRI_WITHIN_COMMON 1
#include <Basics/error.h>
#include <Basics/memory.h>
#include <Basics/structures.h>
#include <BasicsC/error.h>
#include <BasicsC/memory.h>
#include <BasicsC/structures.h>
#undef TRI_WITHIN_COMMON
////////////////////////////////////////////////////////////////////////////////
@ -149,8 +149,8 @@
////////////////////////////////////////////////////////////////////////////////
#define TRI_WITHIN_COMMON 1
#include <Basics/system-compiler.h>
#include <Basics/system-functions.h>
#include <BasicsC/system-compiler.h>
#include <BasicsC/system-functions.h>
#undef TRI_WITHIN_COMMON
////////////////////////////////////////////////////////////////////////////////

View File

@ -29,10 +29,10 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_ASSOCIATIVE_MULTI_H
#define TRIAGENS_PHILADELPHIA_BASICS_ASSOCIATIVE_MULTI_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/locks.h>
#include <Basics/vector.h>
#include <BasicsC/locks.h>
#include <BasicsC/vector.h>
#ifdef __cplusplus
extern "C" {

View File

@ -29,9 +29,9 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_ASSOCIATIVE_H
#define TRIAGENS_PHILADELPHIA_BASICS_ASSOCIATIVE_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/locks.h>
#include <BasicsC/locks.h>
#ifdef __cplusplus
extern "C" {

View File

@ -29,8 +29,8 @@
#include <limits.h>
#include <Basics/strings.h>
#include <Basics/string-buffer.h>
#include <BasicsC/strings.h>
#include <BasicsC/string-buffer.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions for string to number

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_CONVERSIONS_H
#define TRIAGENS_PHILADELPHIA_BASICS_CONVERSIONS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_CSV_H
#define TRIAGENS_PHILADELPHIA_BASICS_CSV_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {

View File

@ -25,14 +25,14 @@
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifndef TRI_GCC_THREAD_LOCAL_STORAGE
#include <pthread.h>
#endif
#include <Basics/strings.h>
#include <Basics/vector.h>
#include <BasicsC/strings.h>
#include <BasicsC/vector.h>
// -----------------------------------------------------------------------------
// --SECTION-- private types

View File

@ -35,9 +35,9 @@
#include <direct.h>
#endif
#include <Basics/logging.h>
#include <Basics/strings.h>
#include <Basics/string-buffer.h>
#include <BasicsC/logging.h>
#include <BasicsC/strings.h>
#include <BasicsC/string-buffer.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions

View File

@ -28,9 +28,9 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_FILES_H
#define TRIAGENS_PHILADELPHIA_BASICS_FILES_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/vector.h>
#include <BasicsC/vector.h>
#ifdef __cplusplus
extern "C" {

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_HASHES_H
#define TRIAGENS_PHILADELPHIA_BASICS_HASHES_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {

View File

@ -27,9 +27,9 @@
#include "init.h"
#include <Basics/hashes.h>
#include <Basics/logging.h>
#include <Basics/randomx.h>
#include <BasicsC/hashes.h>
#include <BasicsC/logging.h>
#include <BasicsC/random.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_INIT_H
#define TRIAGENS_PHILADELPHIA_BASICS_INIT_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {

View File

@ -27,10 +27,10 @@
#include "json.h"
#include <Basics/files.h>
#include <Basics/logging.h>
#include <Basics/string-buffer.h>
#include <Basics/strings.h>
#include <BasicsC/files.h>
#include <BasicsC/logging.h>
#include <BasicsC/string-buffer.h>
#include <BasicsC/strings.h>
// -----------------------------------------------------------------------------
// --SECTION-- JSON

View File

@ -28,10 +28,10 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_JSON_H
#define TRIAGENS_PHILADELPHIA_BASICS_JSON_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/associative.h>
#include <Basics/vector.h>
#include <BasicsC/associative.h>
#include <BasicsC/vector.h>
#ifdef __cplusplus
extern "C" {

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_LOCKS_MACOS_H
#define TRIAGENS_PHILADELPHIA_BASICS_LOCKS_MACOS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <libkern/OSAtomic.h>

View File

@ -27,7 +27,7 @@
#include "locks.h"
#include <Basics/logging.h>
#include <BasicsC/logging.h>
// -----------------------------------------------------------------------------
// --SECTION-- MUTEX

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_LOCKS_POSIX_H
#define TRIAGENS_PHILADELPHIA_BASICS_LOCKS_POSIX_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <pthread.h>

View File

@ -28,14 +28,14 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_LOCKS_H
#define TRIAGENS_PHILADELPHIA_BASICS_LOCKS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
////////////////////////////////////////////////////////////////////////////////
/// @brief posix threads
////////////////////////////////////////////////////////////////////////////////
#ifdef TRI_HAVE_POSIX_THREADS
#include <Basics/locks-posix.h>
#include <BasicsC/locks-posix.h>
#endif
////////////////////////////////////////////////////////////////////////////////
@ -43,7 +43,7 @@
////////////////////////////////////////////////////////////////////////////////
#ifdef TRI_HAVE_POSIX_THREADS
#include <Basics/locks-posix.h>
#include <BasicsC/locks-posix.h>
#endif
////////////////////////////////////////////////////////////////////////////////

View File

@ -34,11 +34,11 @@
#include <syslog.h>
#endif
#include <Basics/files.h>
#include <Basics/locks.h>
#include <Basics/strings.h>
#include <Basics/threads.h>
#include <Basics/vector.h>
#include <BasicsC/files.h>
#include <BasicsC/locks.h>
#include <BasicsC/strings.h>
#include <BasicsC/threads.h>
#include <BasicsC/vector.h>
// -----------------------------------------------------------------------------
// --SECTION-- LOGGING

View File

@ -28,9 +28,9 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_LOGGING_H
#define TRIAGENS_PHILADELPHIA_BASICS_LOGGING_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/vector.h>
#include <BasicsC/vector.h>
#ifdef __cplusplus
extern "C" {

View File

@ -25,7 +25,7 @@
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include <Basics/Common.h>
#include <BasicsC/Common.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions

View File

@ -25,9 +25,9 @@
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "randomx.h"
#include "random.h"
#include <Basics/threads.h>
#include <BasicsC/threads.h>
// -----------------------------------------------------------------------------
// --SECTION-- private variables

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_RANDOMX_H
#define TRIAGENS_PHILADELPHIA_BASICS_RANDOMX_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_STRING_BUFFER_H
#define TRIAGENS_PHILADELPHIA_BASICS_STRING_BUFFER_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {

View File

@ -28,9 +28,9 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_STRINGS_H
#define TRIAGENS_PHILADELPHIA_BASICS_STRINGS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/vector.h>
#include <BasicsC/vector.h>
#ifdef __cplusplus
extern "C" {

View File

@ -25,7 +25,7 @@
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include <Basics/Common.h>
#include <BasicsC/Common.h>
// -----------------------------------------------------------------------------
// --SECTION-- BLOB

View File

@ -25,7 +25,7 @@
/// @author Copyright 2009-2011, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include <Basics/Common.h>
#include <BasicsC/Common.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions

View File

@ -25,7 +25,7 @@
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include <Basics/Common.h>
#include <BasicsC/Common.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions

View File

@ -0,0 +1,75 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief terimnal utilities using ncurses
///
/// @file
/// DISCLAIMER
///
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Esteban Lombeyda
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include <BasicsC/terminal-utils.h>
#ifdef HAVE_NCURSES
#include <term.h>
#include <curses.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Terminal
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the columns width
////////////////////////////////////////////////////////////////////////////////
int TRI_ColumnsWidth () {
union { char * a; char const * b; } c;
int ret;
// initializing terminfo
ret = setupterm(NULL, fileno(stdin), NULL);
if (ret != 0) {
return TRI_DEFAULT_COLUMNS;
}
// and extract the columns
c.b = "cols";
ret = tigetnum(c.a);
return ret == -1 ? TRI_DEFAULT_COLUMNS : ret;
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
// End:

75
BasicsC/terminal-utils.c Normal file
View File

@ -0,0 +1,75 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief collections of terminal functions
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "terminal-utils.h"
#include <BasicsC/conversions.h>
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Terminal
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the columns width
////////////////////////////////////////////////////////////////////////////////
#ifndef HAVE_NCURSES
int TRI_ColumnsWidth () {
char* e;
int c;
e = getenv("COLUMNS");
if (e != 0) {
c = TRI_Int32String(e);
if (c == 0 || TRI_errno() != TRI_ERROR_NO_ERROR) {
return TRI_DEFAULT_COLUMNS;
}
return c;
}
return TRI_DEFAULT_COLUMNS;
}
#endif
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
// End:

84
BasicsC/terminal-utils.h Normal file
View File

@ -0,0 +1,84 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief collections of terminal functions
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_JUTLAND_BASICS_TERMINAL_UTILS_H
#define TRIAGENS_JUTLAND_BASICS_TERMINAL_UTILS_H 1
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {
#endif
// -----------------------------------------------------------------------------
// --SECTION-- public constants
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Terminal
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief default value for number of columns of a terminal
////////////////////////////////////////////////////////////////////////////////
#define TRI_DEFAULT_COLUMNS (80)
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Terminal
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the columns width
////////////////////////////////////////////////////////////////////////////////
int TRI_ColumnsWidth (void);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif
#endif
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
// End:

View File

@ -27,7 +27,7 @@
#include "threads.h"
#include <Basics/logging.h>
#include <BasicsC/logging.h>
// -----------------------------------------------------------------------------
// --SECTION-- THREAD

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_THREADS_POSIX_H
#define TRIAGENS_PHILADELPHIA_BASICS_THREADS_POSIX_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <pthread.h>

View File

@ -28,14 +28,14 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_THREADS_H
#define TRIAGENS_PHILADELPHIA_BASICS_THREADS_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
////////////////////////////////////////////////////////////////////////////////
/// @brief posix threads
////////////////////////////////////////////////////////////////////////////////
#ifdef TRI_HAVE_POSIX_THREADS
#include <Basics/threads-posix.h>
#include <BasicsC/threads-posix.h>
#endif
////////////////////////////////////////////////////////////////////////////////

View File

@ -27,7 +27,7 @@
#include "vector.h"
#include <Basics/strings.h>
#include <BasicsC/strings.h>
// -----------------------------------------------------------------------------
// --SECTION-- private constants

View File

@ -28,7 +28,7 @@
#ifndef TRIAGENS_PHILADELPHIA_BASICS_VECTOR_H
#define TRIAGENS_PHILADELPHIA_BASICS_VECTOR_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#ifdef __cplusplus
extern "C" {

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_IMPL_H
#define TRIAGENS_FYN_DISPATCHER_DISPATCHER_IMPL_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Rest/Dispatcher.h>
#include <Basics/Mutex.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_QUEUE_H
#define TRIAGENS_FYN_DISPATCHER_DISPATCHER_QUEUE_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/ConditionVariable.h>
#include <Rest/Dispatcher.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_THREAD_H
#define TRIAGENS_FYN_DISPATCHER_DISPATCHER_THREAD_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/Thread.h>
#include <Rest/Job.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_GENERAL_SERVER_GENERAL_COMM_TASK_H
#define TRIAGENS_FYN_GENERAL_SERVER_GENERAL_COMM_TASK_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/Logger.h>
#include <Basics/StringBuffer.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_GENERAL_SERVER_GENERAL_FIGURES_H
#define TRIAGENS_FYN_GENERAL_SERVER_GENERAL_FIGURES_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Basics/RoundRobinFigures.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_GENERAL_SERVER_GENERAL_LISTEN_TASK_H
#define TRIAGENS_FYN_GENERAL_SERVER_GENERAL_LISTEN_TASK_H 1
#include <Basics/Common.h>
#include <BasicsC/Common.h>
#include <Rest/ListenTask.h>

Some files were not shown because too many files have changed in this diff Show More