Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Merge from POLY
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Dec 1, 2017
2 parents 7713411 + 2befc0a commit 32251ff
Show file tree
Hide file tree
Showing 66 changed files with 3,971 additions and 1,772 deletions.
6 changes: 5 additions & 1 deletion _vc2017.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
@echo off

set PROJDIR=%~dp0

for /f "usebackq tokens=*" %%i in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)

if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
call "%InstallDir%\Common7\Tools\VsDevCmd.bat"
pushd %PROJDIR%
"%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" /m:%NUMBER_OF_PROCESSORS% /nr:false /nologo /verbosity:minimal %*
)
popd
)
31 changes: 30 additions & 1 deletion include/caryll/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
#include <string.h>
#include <stdbool.h>

#include "ownership.h"

// We assume all T have trivial move constructors.
#define caryll_T(T) \
void (*init)(MODIFY T *); \
void (*copy)(MODIFY T *, const T *); \
void (*move)(MODIFY T *, T *); \
void (*dispose)(MOVE T *);
void (*dispose)(MOVE T *); \
void (*replace)(MODIFY T *, MOVE const T); \
void (*copyReplace)(MODIFY T *, const T);

#define caryll_VT(T) \
caryll_T(T); \
T (*empty)(); \
Expand All @@ -35,4 +40,28 @@
caryll_VT(T); \
}

/// Individual traits

#define caryll_Show(T) void (*show)(const T);
#define caryll_Eq(T) bool (*equal)(const T, const T);
#define caryll_Ord(T) \
caryll_Eq(T); \
int (*compare)(const T a, const T b); \
int (*compareRef)(const T *a, const T *b);
#define caryll_Monoid(T) \
T (*neutral)(); \
T (*plus)(const T a, const T b); \
void (*inplacePlus)(MODIFY T * a, const T b);
#define caryll_Group(T) \
caryll_Monoid(T); \
void (*inplaceNegate)(MODIFY T * a); \
T (*negate)(const T); \
void (*inplaceMinus)(MODIFY T *, const T); \
T (*minus)(const T, const T);
#define caryll_Module(T, TScale) \
caryll_Group(T); \
void (*inplaceScale)(MODIFY T * a, TScale b); \
void (*inplacePlusScale)(MODIFY T * a, TScale b, const T c); \
T (*scale)(const T a, TScale b);

#endif
5 changes: 3 additions & 2 deletions include/caryll/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
#define caryll_VectorInterfaceTrait(__TV, __T) \
caryll_RT(__TV); \
void (*initN)(MODIFY __TV * arr, size_t n); \
void (*initCapN)(MODIFY __TV * arr, size_t n); \
__TV *(*createN)(size_t n); \
void (*fill)(MODIFY __TV * arr, size_t n); \
void (*clear)(MODIFY __TV * arr); \
void (*replace)(MODIFY __TV * dst, MOVE const __TV *src); \
void (*push)(MODIFY __TV * arr, MOVE __T obj); \
void (*shrinkToFit)(MODIFY __TV * arr); \
__T (*pop)(MODIFY __TV * arr); \
void (*fill)(MODIFY __TV * arr, size_t n); \
void (*disposeItem)(MODIFY __TV * arr, size_t n); \
void (*filterEnv)(MODIFY __TV * arr, bool (*fn)(const __T *x, void *env), void *env); \
void (*sort)(MODIFY __TV * arr, int (*fn)(const __T *a, const __T *b));
Expand Down
Loading

0 comments on commit 32251ff

Please sign in to comment.