Commit 1819efb7 authored by Chris Müller's avatar Chris Müller

define standard.h definitions for common types, prepare a matrix struct representation

parent b246bb57
cmake_minimum_required(VERSION 2.8)
project(crystal)
add_subdirectory(src)
find_package(PkgConfig)
macro(pkg_dependency DEP_VAR VARIABLE)
pkg_check_modules(${VARIABLE}PKG ${ARGN} ${VARIABLE})
add_definitions(${${VARIABLE}PKG_CFLAGS})
include_directories(${${VARIABLE}PKG_INCLUDE_DIRS})
link_directories(${${VARIABLE}PKG_LIBRARY_DIRS})
list(APPEND ${DEP_VAR} ${${VARIABLE}PKG_LIBRARIES})
endmacro()
include(${PROJECT_SOURCE_DIR}/macros/dependencies.cmake)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/libs)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(LIB crystal)
set(DESCRIPTION "Crystal Core Libs")
set(VERSION "0.1")
set(SOURCES
standard.c
)
set(HEADER
standard.h
)
add_library(${LIB} SHARED ${SOURCES})
configure_file(${CMAKE_SOURCE_DIR}/pkgconfig.pc.in ${CMAKE_BINARY_DIR}/pkgconfig.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/pkgconfig.pc DESTINATION lib/pkgconfig RENAME ${LIB}.pc)
install(FILES ${LIB} DESTINATION lib)
install(FILES ${HEADER} DESTINATION include/${LIB})
#include "matrix.h"
CrySingleMatrix
cry_singlematrix_new(unsigned int rows, unsigned int cols, float default)
{
}
CryDoubleMatrix
cry_doublematrix_new(unsigned int rows, unsigned int cols, double default)
{
}
CrySingleMatrix
cry_singlematrix_from_io(FILE* io)
{
}
CryDoubleMatrix
cry_doublematrix_from_io(FILE* io)
{
}
void
cry_singlematrix_print(FILE* io, CrySingleMatrix matrix)
{
}
void
cry_doublematrix_print(FILE* io, CryDoubleMatrix matrix)
{
}
void
cry_singlematrix_free(CrySingleMatrix matrix)
{
}
void
cry_doublematrix_free(CryDoubleMatrix matrix)
{
}
#ifndef CRYSTAL_MACHINELEARNING_MATRIX_H
#define CRYSTAL_MACHINELEARNING_MATRIX_H
#include "standard.h"
struct CryMatrix {
pointer data;
unsigned int rows;
unsigned int cols;
};
typedef struct CryMatrix CrySingleMatrix;
typedef struct CryMatrix CryDoubleMatrix;
crydefine__tuple(CryMatrix, tuple_matrix);
CrySingleMatrix cry_singlematrix_new(unsigned int rows, unsigned int cols, float default);
CryDoubleMatrix cry_doublematrix_new(unsigned int rows, unsigned int cols, double default);
CrySingleMatrix cry_singlematrix_from_io(FILE* io);
CryDoubleMatrix cry_doublematrix_from_io(FILE* io);
void cry_singlematrix_print(FILE* io, CrySingleMatrix matrix);
void cry_doublematrix_print(FILE* io, CryDoubleMatrix matrix);
void cry_singlematrix_free(CrySingleMatrix matrix);
void cry_doublematrix_free(CryDoubleMatrix matrix);
#endif // CRYSTAL_MACHINELEARNING_MATRIX_H
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include
Name: @TARGET_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Requires: @DEPS_PKGCONFIG@
Libs: -L${libdir} -l@TARGT_NAME@
Cflags: -I${includedir}
#ifndef CRYSTAL_STANDARD_H
#define CRYSTAL_STANDARD_H
#define crydefine__tuple(type, T) \
typedef struct T { \
return_code code; \
type data; \
} T
#define OKAY 0
typedef void* pointer;
typedef const void* const_pointer;
typedef unsigned int return_code;
crydefine__tuple(pointer, tuple_pointer);
crydefine__tuple(const char*, tuple_string);
crydefine__tuple(int, tuple_int);
crydefine__tuple(short, tuple_short);
crydefine__tuple(long, tuple_long);
crydefine__tuple(double, tuple_double);
crydefine__tuple(float, tuple_float);
#endif // CRYSTAL_STANDARD_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment