Commit 8ffeb570 authored by atl Upstream's avatar atl Upstream Committed by Atkins, Charles Vernon
Browse files

atl 2018-03-23 (247d5e86)

Code extracted from:

    https://github.com/GTkorvo/atl.git

at commit 247d5e865cd1e25893a9507eb5435112cfc902d4 (adios2).
parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+26 −0
Original line number Diff line number Diff line

# /
/*.exp
/*.la
/*.lib
/*.lo
/.deps
/.libs
/.~*
/Makefile
/atom_server
/atom_test
/attr_dump
/attr_test
/autom4te.cache
/config.cache
/config.h
/config.log
/config.status
/libtool
/msvc.txt
/stamp-h*
/stamp-h.in
/vc*.pch
/atl.vcproj.*
/atom_check

CMakeLists.txt

0 → 100644
+209 −0
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 2.8.3)

# Note that this whole if block is for backwards compatibility and can be
# replaced with a single project(ATL VERSION A.B.C) if the minum required is
# raised to > 3.0
if(POLICY CMP0048)
  cmake_policy(SET CMP0048 NEW)
  project(ATL VERSION 2.2.0 LANGUAGES C)
else()
  project(ATL C)
  set(ATL_MAJOR_VERSION 2)
  set(ATL_MINOR_VERSION 2)
  set(ATL_PATCH_VERSION 0)
  set(ATL_VERSION
    ${ATL_MAJOR_VERSION}.${ATL_MINOR_VERSION}.${ATL_PATCH_VERSION})
endif()

# Some boilerplate to setup nice output directories
set(CMAKE_INSTALL_BINDIR bin CACHE STRING "Installation runtime subdirectory")
set(CMAKE_INSTALL_LIBDIR lib CACHE STRING "Installation library subdirectory")
set(CMAKE_INSTALL_INCLUDEDIR include
  CACHE STRING "Installation include subdirectory")
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake
  CACHE STRING "Installation CMake subdirectory")
mark_as_advanced(CMAKE_INSTALL_BINDIR)
mark_as_advanced(CMAKE_INSTALL_LIBDIR)
mark_as_advanced(CMAKE_INSTALL_INCLUDEDIR)
mark_as_advanced(CMAKE_INSTALL_CMAKEDIR)

if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
    ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
    ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
    ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
endif()

# Default to a RelWithDebInfo build if not specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE RelWithDebugInfo)
endif()

include(CMakeDependentOption)

# Setup shared library defaults.  If explicitly specified somehow, then default 
# to that.  Otherwise base the default on whether or not shared libs are even
# supported.
get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
cmake_dependent_option(BUILD_SHARED_LIBS
  "Build shared libraries (so/dylib/dll)." ${SHARED_LIBS_SUPPORTED}
  "SHARED_LIBS_SUPPORTED" OFF
)
mark_as_advanced(BUILD_SHARED_LIBS)

# Setup PIC defaults.  If explicitly specified somehow, then default 
# to that.  Otherwise base the default on whether or not shared libs are even
# supported.
if(DEFINED ATL_ENABLE_PIC)
  set(ATL_ENABLE_PIC_DEFAULT ${ATL_ENABLE_PIC})
elseif(DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
  set(ATL_ENABLE_PIC_DEFAULT ${CMAKE_POSITION_INDEPENDENT_CODE})
else()
  set(ATL_ENABLE_PIC_DEFAULT ${SHARED_LIBS_SUPPORTED})
endif()
cmake_dependent_option(ATL_ENABLE_PIC
  "Build with Position Independent Code" ${ATL_ENABLE_PIC_DEFAULT}
  "SHARED_LIBS_SUPPORTED" OFF
)
mark_as_advanced(ATL_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ${ATL_ENABLE_PIC})
mark_as_advanced(CMAKE_POSITION_INDEPENDENT_CODE)

include(CheckTypeSize)
CHECK_TYPE_SIZE(double SIZEOF_DOUBLE)
CHECK_TYPE_SIZE(float SIZEOF_FLOAT)
CHECK_TYPE_SIZE(int SIZEOF_INT)
CHECK_TYPE_SIZE(short SIZEOF_SHORT)

include(CheckIncludeFiles)
CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILES(string.h HAVE_STRING_H)
CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES(windows.h HAVE_WINDOWS_H)

include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(fork unistd.h HAVE_FORK)

if(ATOM_SERVER_HOST)
  set(_atom_server_default "${ATOM_SERVER_HOST}")
else()
  set(_atom_server_default "atomhost.cercs.gatech.edu")
endif()
set(ATL_ATOM_SERVER_HOST "${_atom_server_default}" CACHE STRING
  "Default Atom server")
mark_as_advanced(ATL_ATOM_SERVER_HOST)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/config.h)

# Set up include-directories
include_directories(
  "${PROJECT_SOURCE_DIR}"   # to find foo/foo.h
  "${PROJECT_BINARY_DIR}")  # to find foo/config.h
 
set(ATL_LIBRARY_PREFIX "" CACHE STRING
  "Prefix to prepend to the output library name")
mark_as_advanced(ATL_LIBRARY_PREFIX)

add_library(atl atom.c attr.c lookup3.c tclHash.c)
if(ATL_LIBRARY_PREFIX)
  set_target_properties(atl PROPERTIES
    LIBRARY_OUTPUT_NAME ${ATL_LIBRARY_PREFIX}atl)
endif()

add_library(atl::atl ALIAS atl)
if(NOT ANDROID)
  find_package(Threads)
  target_link_libraries(atl ${CMAKE_THREADS_LIBS_INIT})
endif()

set_target_properties(atl PROPERTIES
  VERSION ${ATL_VERSION}
  SOVERSION ${ATL_VERSION_MAJOR}
  PUBLIC_HEADER atl.h)
 
install(FILES atl.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(TARGETS atl
  # IMPORTANT: Add the foo library to the "export-set"
  EXPORT atl-targets
  RUNTIME       DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
  LIBRARY       DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
  ARCHIVE       DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
  PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT dev)

target_include_directories(atl PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

option(ATL_LIBRARIES_ONLY "Don't built the ATL utility executables" OFF)
if(NOT ATL_LIBRARIES_ONLY)
  add_executable(atom_server atom_server.c)
  target_link_libraries(atom_server atl)

  add_executable(attr_dump attr_dump.c)
  target_link_libraries(attr_dump atl)

  install(TARGETS atom_server attr_dump
    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin)
endif()

include(CTest)
mark_as_advanced(BUILD_TESTING)
if(BUILD_TESTING)
  add_executable(attr_test attr_test.c)
  target_link_libraries(attr_test atl)
  add_test(NAME atl_attr_test COMMAND attr_test)

  add_executable(atom_test atom_test.c)
  target_link_libraries(atom_test atl)

  add_executable(atom_check atom_check.c)
  target_link_libraries(atom_check atl)
  add_test(NAME atl_atom_check COMMAND atom_check) 
endif()

# Setup packaging and configs
 
# Add all targets to the build-tree export set
export(TARGETS atl NAMESPACE atl::
  FILE "${PROJECT_BINARY_DIR}/atl-targets.cmake")
configure_file(atl-config.cmake.in
  "${PROJECT_BINARY_DIR}/atl-config.cmake" @ONLY)
configure_file(atl-config-version.cmake.in
  "${PROJECT_BINARY_DIR}/atl-config-version.cmake" @ONLY)
 
# Install the atl-config.cmake and atl-config-version.cmake
install(FILES
  "${PROJECT_BINARY_DIR}/atl-config.cmake"
  "${PROJECT_BINARY_DIR}/atl-config-version.cmake"
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}/atl" COMPONENT dev)
 
# Install the export set for use with the install-tree
install(EXPORT atl-targets NAMESPACE atl::
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}/atl" COMPONENT dev)

set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/atl.supp)

# Display status message for important variables
option(ATL_QUIET "Suppress info output at the end of configure" OFF)
mark_as_advanced(ATL_QUIET)
if(NOT ATL_QUIET)
  message(STATUS )
  message( STATUS "----------------------------------------------------------------------------" )
  message( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
  message( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
  message( STATUS "ATL_ATOM_SERVER_HOST = ${ATL_ATOM_SERVER_HOST}" )
  message( STATUS "ATL_LIBRARIES_ONLY = ${ATL_LIBRARIES_ONLY}" )
  message( STATUS "BUILD_TESTING = ${BUILD_TESTING}" )
  message( STATUS "Change a value with: cmake -D<Variable>=<Value>" )
  message( STATUS "----------------------------------------------------------------------------" )
  message( STATUS )
endif()
+11 −0
Original line number Diff line number Diff line
set(PACKAGE_VERSION @ATL_VERSION@)
 
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
  if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
    set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()

atl-config.cmake.in

0 → 100644
+24 −0
Original line number Diff line number Diff line
# - Config file for the Atl package
#
# It defines the following variables
#  ATL_INCLUDE_DIRS - include directories for Atl
#  ATL_LIBRARIES    - libraries to link against
#
# And the following imported targets:
#   atl::atl
#

include("${CMAKE_CURRENT_LIST_DIR}/atl-config-version.cmake")

include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)

if(NOT TARGET atl::atl)
  include("${CMAKE_CURRENT_LIST_DIR}/atl-targets.cmake")
endif()

set(ATL_LIBRARIES atl::atl)
set(ATL_INCLUDE_DIRS
  $<TARGET_PROPERTY:atl::atl,INTERFACE_INCLUDE_DIRECTORIES>
)

atl.h

0 → 100644
+209 −0
Original line number Diff line number Diff line
#ifndef ATL_H
#define ATL_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#ifndef	NULL
#define NULL	((void *) 0)
#endif
#else
#ifndef	NULL
#define NULL	0
#endif
#endif

typedef int atom_t;

/* opaque type for atom server handle */
typedef struct _atom_server *atom_server;

extern
atom_t
atom_from_string (atom_server as, char *str);

extern
char *
string_from_atom (atom_server as, atom_t atom);

typedef enum {
    no_atom_cache, atom_cache, prefill_atom_cache
} atom_cache_type;

extern
atom_server
init_atom_server (atom_cache_type cache_style);

extern
char *
get_server_id (atom_server as);

typedef enum _attr_value_type { Attr_Undefined, Attr_Int4, Attr_Int8, 
				Attr_String, Attr_Opaque, Attr_Atom, 
				Attr_List, Attr_Float16, Attr_Float8, 
				Attr_Float4 } attr_value_type;

/* opaque type for attr_lists */
typedef struct _attr_list_struct *attr_list;

typedef void *attr_value;

typedef struct Attr_tmp_buffer *AttrBuffer;

#define ATL_CHAR_CONS(a,b,c,d) ((((unsigned char)a) << 24) + (((unsigned char)b) << 16) + (((unsigned char)c) << 8) + ((unsigned char)d))

typedef struct attr_opaque {
    int length;
    void *buffer;
} attr_opaque, *attr_opaque_p;

/* operations on attr_lists */
extern attr_list create_attr_list(void);

extern void free_attr_list (attr_list list);

extern attr_list add_ref_attr_list (attr_list list);

extern int attr_list_ref_count (attr_list list);

extern attr_list attr_join_lists (attr_list list1, attr_list list2);

extern attr_list attr_add_list (attr_list list1, attr_list list2);

extern void attr_merge_lists (attr_list list1, attr_list list2);

extern attr_list attr_copy_list (attr_list list);

extern int add_attr (attr_list attrs, atom_t attr_id, 
			  attr_value_type val_type,
			  attr_value value );

extern int add_float_attr (attr_list attrs, atom_t attr_id, 
				 double value );

extern int add_double_attr (attr_list attrs, atom_t attr_id, 
				 double value );

extern int add_int_attr (attr_list attrs, atom_t attr_id, 
			      int value );

extern int add_long_attr (attr_list attrs, atom_t attr_id, 
			      long value );

extern int add_string_attr (attr_list attrs, atom_t attr_id, 
			      char *value );

extern int add_opaque_attr (attr_list attrs, atom_t attr_id, 
				 int length, char *buffer );

extern int set_attr (attr_list attrs, atom_t attr_id, 
			  attr_value_type val_type,
			  attr_value value );

extern int set_float_attr (attr_list attrs, atom_t attr_id, 
				double value );

extern int set_double_attr (attr_list attrs, atom_t attr_id, 
				 double value );

extern int set_int_attr (attr_list attrs, atom_t attr_id, 
			      int value );

extern int set_long_attr (attr_list attrs, atom_t attr_id, 
			      long value );

extern int set_string_attr (attr_list attrs, atom_t attr_id, 
				 char *string );

extern int set_opaque_attr (attr_list attrs, atom_t attr_id, 
				 int length, char *buffer );

extern int replace_attr (attr_list attrs, atom_t attr_id, 
			      attr_value_type val_type, attr_value value );

extern int replace_float_attr (attr_list attrs, atom_t attr_id, 
				    double value );

extern int replace_double_attr (attr_list attrs, atom_t attr_id, 
				 double value );

extern int replace_int_attr (attr_list attrs, atom_t attr_id, 
			      int value );

extern int replace_long_attr (attr_list attrs, atom_t attr_id, 
			      long value );

extern int replace_string_attr (attr_list attrs, atom_t attr_id, 
				 char *string );

extern int replace_opaque_attr (attr_list attrs, atom_t attr_id, 
				     int length, char *buffer );

extern int query_attr ( attr_list attrs, atom_t attr_id, 
			    attr_value_type *val_type_p, attr_value *value_p);

extern int get_int_attr ( attr_list attrs, atom_t attr_id, int *value_p);
extern int get_long_attr ( attr_list attrs, atom_t attr_id, long *value_p);
extern int get_double_attr ( attr_list attrs, atom_t attr_id, double *value_p);
extern int get_float_attr ( attr_list attrs, atom_t attr_id, float *value_p);
extern int get_string_attr ( attr_list attrs, atom_t attr_id, char **value_p);

extern int get_opaque_attr ( attr_list attrs, atom_t attr_id, int *length_p, char **value_p);

extern void dump_attr_list ( attr_list attrs );
extern void fdump_attr_list ( void *file, attr_list attrs );

extern int get_attr_id(attr_list list, int item_no, atom_t *item);

extern int get_attr (attr_list list,int index, atom_t *name,
			  attr_value_type *val_type, attr_value *value);

typedef void (*atl_lock_func)(void *client_data);
extern void
atl_install_mutex_funcs(atl_lock_func lock, atl_lock_func unlock, void *client_data);

extern
atom_t
attr_atom_from_string (const char *str);

extern
char *
attr_string_from_atom (atom_t atom);

extern int attr_count (attr_list attrs);

extern
char *
attr_list_to_string (attr_list attrs);

extern
attr_list
attr_list_from_string (const char * str);

extern
AttrBuffer create_AttrBuffer(void);

void
free_AttrBuffer(AttrBuffer buf);

extern
int
attr_list_subset(attr_list l1, attr_list l2);

extern void *
encode_attr_for_xmit(attr_list l, AttrBuffer b, int *length);

extern attr_list 
decode_attr_from_xmit(void * buf);

extern int 
atl_base64_decode(unsigned char *input, unsigned char *output);

extern char *
atl_base64_encode(char *buffer, unsigned int len);

#if defined(__cplusplus) || defined(c_plusplus)
	   }
#endif

#endif