diff --git a/!LibZVector/a/libzvector b/!LibZVector/a/libzvector index 45e42b3..cab548c 100644 Binary files a/!LibZVector/a/libzvector and b/!LibZVector/a/libzvector differ diff --git a/!LibZVector/h/zvector_checks b/!LibZVector/h/zvector_checks new file mode 100644 index 0000000..0077ad2 --- /dev/null +++ b/!LibZVector/h/zvector_checks @@ -0,0 +1,149 @@ +/* + * Name: ZVector_Checks + * Purpose: Header used by ZVector Library to identify for which + * platform ZVector is being compiled. + * Author: Paolo Fabio Zaino + * Domain: General + * License: Copyright 2021 by Paolo Fabio Zaino, all rights reserved + * Distributed under MIT license + * + */ + +#ifndef SRC_ZVECTOR_CHECKS_H_ +#define SRC_ZVECTOR_CHECKS_H_ + +// Try to determine the Operating System being used: +#if defined(__APPLE__) && defined(__MACH__) +# define macOS +#endif + +#if ( defined(__GNU__) || defined(__gnu_linux__) || \ + defined(__linux__) || defined(macOS) ) +# define OS_TYPE 1 +#elif ( defined(__WIN32__) || defined(WIN32) || defined(_WIN32) ) +# define OS_TYPE 2 +#else +# define OS_TYPE 0 +#endif + +// Try to determine compiler being used: +#if defined(__GNUC__) +# define compiler gcc +# define ZVECT_COMPTYPE 1 +# define COMP_MAJRELEASE (__GNUC__) +# define COMP_MINRELEASE (__GNUC_MINOR__) +# define COMP_PATRELEASE (__GNUC_PATCHLEVEL__) +#elif defined(__NORCROFT_C__) || defined(__CC_NORCROFT) || \ + defined(__ARMCC_VERSION) +// For Norcroft C please remember to specify: +// -c99 +# define compiler norcroftc +# define ZVECT_COMPTYPE 6 +# define COMP_MAJRELEASE (__ARMCC_VERSION) +# define _MSC_VER 0 +#elif defined(_MSC_VER) +# define compiler msc +# define ZVECT_COMPTYPE 2 +# define COMP_MAJRELEASE (_MSC_VER) +# define COMP_MINRELEASE 0 +# define COMP_PATRELEASE 0 +#elif defined(__clang__) +# define compiler clang +# define ZVECT_COMPTYPE 3 +# define COMP_MAJRELEASE (__clang_major__) +# define COMP_MINRELEASE (__clang_minor__) +# define COMP_PATRELEASE (__clang_patchlevel__) +#elif defined(__INTEL_COMPILER) || defined(__ICC) || \ + defined(__ECC) || defined(__ICL) +// For intel c compiler please remember to specify: +// /Qstd=c99 (on Windows) +// -std=c99 on Linux and/or macOS +# define compiler intelc +# define ZVECT_COMPTYPE 4 +# define COMP_MAJRELEASE (__INTEL_COMPILER) +# define COMP_MINRELEASE 0 +# define COMP_PATRELEASE 0 +#elif defined (__LCC__) +# define compiler lcc +# define ZVECT_COMPTYPE 5 +# define COMP_MAJRELEASE (__LCC) +# define COMP_MINRELEASE 0 +# define COMP_PATRELEASE 0 +#elif defined(_CRAYC) +// For Cray C please remember to specify: +// -hc99 +# define compiler crayc +# define ZVECT_COMPTYPE 10 +# define COMP_MAJRELEASE (_RELEASE) +# define COMP_MINRELEASE (_RELEASE_MINOR) +# define COMP_PATRELEASE 0 +#elif defined(__HP_cc) +// For HP CC please remember to specify: +// -ansi -std=c99 +# define compiler hpc +# define ZVECT_COMPTYPE 11 +# define COMP_MAJRELEASE 1 +# define COMP_MINRELEASE 21 +# define COMP_PATRELEASE 0 +#elif defined(__IBMC__) +// For IBM C please remember to specify: +// C99 flags +# define compiler ibmc +# define ZVECT_COMPTYPE 12 +#elif defined(__TINYC__) +# define compiler tinyc +# define ZVECT_COMPTYPE 6 +# define COMP_MAJRELEASE 0 +# define COMP_MINRELEASE 0 +# define COMP_PATRELEASE 0 +#else +# define compiler unknown +# define ZVECT_COMPTYPE 0 +#endif +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +// Try to determine CPU Architecture: +#define ARM32 0 +#define ARM64 1 +#define x86_64 2 +#define unknown -1 +#if defined(__aarch64__) +# define CPU_TYPE ARM64 +# define Arch64 +#elif defined(__aarch32__) +# define CPU_TYPE ARM32 +# define Arch32 +#elif defined(__amd64__) || defined(__x86_64__) || \ + defined(__ia64__) || defined(_M_IA64) || \ + defined(_M_AMD64) || defined(_M_X64) +# define CPU_TYPE x86_64 +# define Arch64 +#else +# define CPU_TYPE unknown +# define Arch32 +#endif + +// Start setting up macros based on the platform we detected +// above. + +#if ( OS_TYPE == 1 ) + // We are on a Unix-like OS so we can use pthreads! +# define MUTEX_TYPE 1 +# elif ( OS_TYPE == 2 ) && ( defined(__CYGWIN__) || \ + defined(__MINGW32__) || defined(__MINGW64__) ) + // We are on MS Windows using CIGWIN so we can use pthreads! +# define MUTEX_TYPE 1 +# elif ( OS_TYPE == 2 ) && ( !defined(__CYGWIN__) && \ + !defined(__MINGW32__) && !defined(__MINGW64__) ) + // We are on MS Windows, so we need to use + // Windows stuff: +# define MUTEX_TYPE 2 +#else + // I have no idea on which platform are we, + // hence I have to use fake mutexes and go with the flow! +# define MUTEX_TYPE 0 +#endif + +#endif // SRC_ZVECTOR_CHECKS_H_ diff --git a/!LibZVector/h/zvector_config b/!LibZVector/h/zvector_config new file mode 100644 index 0000000..9c34b09 --- /dev/null +++ b/!LibZVector/h/zvector_config @@ -0,0 +1,90 @@ +/* + * Name: Vector_config + * Purpose: Base configuration for the ZVector library + * Author: Paolo Fabio Zaino + * Domain: General + * License: Copyright by Paolo Fabio Zaino, all rights reserved + * Distributed under MIT license + * + */ + +#ifndef SRC_ZVECTOR_CONFIG_H_ +#define SRC_ZVECTOR_CONFIG_H_ +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +// Include some standard C lib header +#include +#include + +// Data alignment configuration +#if ( ZVECT_COMPTYPE == 1 ) +#define ZVECT_DATAALIGN __attribute__((aligned)) +#define ZVECT_PACKING __attribute__((__packed__)) +#define ZVECT_ALWAYSINLINE __attribute__ ((__always_inline__)) +#else +#define ZVECT_DATAALIGN +#define ZVECT_PACKING +#define ZVECT_ALWAYSINLINE +#endif + +// Default vector Index type +// This is set to unsigned int of 32bit +// size (so all different architectures +// and OS behaves in a similar way) +// If you want a larger index you can +// change it to, for example, uint64_t +typedef uint32_t zvect_index; +#define zvect_index_max UINT32_MAX // If you change zvect_index type make sure you update this value + // it's the maximum number that can be stored in a zvect_index. + +// Default vector return type for +// error codes. +// Generally negative numbers identify +// an error. +// 0 identify completed successful +// Positive numbers identify return +// attributes, like 1 is generally true +typedef int32_t zvect_retval; + +// Default vector storage size +// This will be used when the user +// specifies 0 (zero) as data type +// size. +#define ZVECT_DEFAULT_DATA_SIZE sizeof(int) + +// Default vector capacity +// This will be used when the user +// does NOT specify an Initial Capacity +// or set it to 0 (zero): +#define ZVECT_INITIAL_CAPACITY 8 + +// The following options are handled by Make +// So you should not need to modify them here. + +// Choose which type of memory functions you want +// to use for your case: +// 0 = Use Standard memcpy and memmove +// 1 = Use Optimized memcpy and memmove +#define ZVECT_MEMX_METHOD 0 + +// Enable/Disable thread safe code: +#define ZVECT_THREAD_SAFE 0 + +// Enable/Disable reentrant code: +#define ZVECT_FULL_REENTRANT 0 + +// Enable/Disable DMF Extensions: +#define ZVECT_DMF_EXTENSIONS 1 + +// Enable/Disable SFMD Extensions: +#define ZVECT_SFMD_EXTENSIONS 1 + +// If you are using ZVector on a system +// that supports cooperative multitasking +// (like RISC OS or some embedded systems) +// then uncomment the following line: +//#define ZVECT_COOPERATIVE + +#endif // SRC_ZVECTOR_CONFIG_H_ diff --git a/!LibZVector/so/libzvector.so.1.0.0 b/!LibZVector/so/libzvector.so.1.0.0 index 65b58df..cd4e764 100644 Binary files a/!LibZVector/so/libzvector.so.1.0.0 and b/!LibZVector/so/libzvector.so.1.0.0 differ diff --git a/MkDDE,fd7 b/MkDDE,fd7 index 2c1e591..9fce939 100644 --- a/MkDDE,fd7 +++ b/MkDDE,fd7 @@ -20,6 +20,8 @@ amu all_libs THROWBACK=-throwback -f MakeFileDDE IfThere @.o.zvectorlib Then copy @.o.zvectorlib @.^.!LibZVector.o.zvectorlib ~C N Ifthere @.o.zvectorlibzm Then copy @.o.zvectorlibzm @.^.!LibZVector.o.zvectorlibzm ~C N Ifthere @.h.zvector Then copy @.h.zvector @.^.!LibZVector.h.zvector ~C N +Ifthere @.h.zvector_checks Then copy @.h.zvector_checks @.^.!LibZVector.h.zvector_checks ~C N +Ifthere @.h.zvector_config Then copy @.h.zvector_config @.^.!LibZVector.h.zvector_config ~C N echo echo --------------------- diff --git a/MkGCC,fd7 b/MkGCC,fd7 index 23c202a..b807314 100644 --- a/MkGCC,fd7 +++ b/MkGCC,fd7 @@ -20,6 +20,9 @@ make all THROWBACK=-throwback -f MakeFileGCC |IfThere @.libzvector/a Then copy @.libzvector/a @.^.!LibZVector.a.libzvector ~C N |IfThere @.libzvector/so/* Then copy @.libzvector/so/* @.^.LibZVector.so.* ~C N |IfThere @.h.libzvector Then copy @.h.ezini @.^.!LibEzINI.h.ezini ~C N +Ifthere @.h.zvector Then copy @.h.zvector @.^.!LibZVector.h.zvector ~C N +Ifthere @.h.zvector_checks Then copy @.h.zvector_checks @.^.!LibZVector.h.zvector_checks ~C N +Ifthere @.h.zvector_config Then copy @.h.zvector_config @.^.!LibZVector.h.zvector_config ~C N echo echo --------------------- diff --git a/examples/dde/CApp/Makefile b/examples/dde/CApp/Makefile new file mode 100644 index 0000000..e064024 --- /dev/null +++ b/examples/dde/CApp/Makefile @@ -0,0 +1,36 @@ +# Makefile for exampleapp + +COMPONENT = exampleapp + +# The name of the linked file defaults to COMPONENT, which is often the case +# for single-file programs. But when the linked file lives in an application +# directory, it is normally called !RunImage. +TARGET = !RunImage + +# The list of source/object files defaults to TARGET, which again is often +# the case for single-file programs. But we don't want our source file to be +# called !RunImage. +OBJS = main + +INSTDIR ?= + +# The shared makefiles don't attempt to guess the application directory name +# Usually you'll want to place it inside INSTDIR, which is passed in from +# either the MkInstall file, or (for !Builder builds) the components file. +# SEP expands to the directory separator character - we use this instead of +# a literal '.' character to help with cross-compilation. +INSTAPP = ${INSTDIR}${SEP}!Example + +# You need to specify all the files that go into the application directory. +# The shared makefiles handle merging the various subdirectories of the +# Resources directory for you. +INSTAPP_FILES = !Boot !Run !Sprites !Sprites11 !Sprites22 !RunImage + +include CApp +CINCLUDES += -ILibZVector:zvector.h +LIBS += LibZVector:o.zvectorlib + +clean:: + ${WIPE} ${INSTAPP} ${WFLAGS} + +# Dynamic dependencies: diff --git a/examples/dde/CApp/Mk,fd7 b/examples/dde/CApp/Mk,fd7 new file mode 100644 index 0000000..0321e6c --- /dev/null +++ b/examples/dde/CApp/Mk,fd7 @@ -0,0 +1,3 @@ +Dir +WimpSlot -min 1024k +amu all THROWBACK=-throwback diff --git a/examples/dde/CApp/MkClean,fd7 b/examples/dde/CApp/MkClean,fd7 new file mode 100644 index 0000000..1023e4a --- /dev/null +++ b/examples/dde/CApp/MkClean,fd7 @@ -0,0 +1,3 @@ +Dir +amu clean +stripdepnd diff --git a/examples/dde/CApp/MkDebug,fd7 b/examples/dde/CApp/MkDebug,fd7 new file mode 100644 index 0000000..a48bb41 --- /dev/null +++ b/examples/dde/CApp/MkDebug,fd7 @@ -0,0 +1,2 @@ +Dir +amu debug THROWBACK=-throwback diff --git a/examples/dde/CApp/MkInstall,fd7 b/examples/dde/CApp/MkInstall,fd7 new file mode 100644 index 0000000..fe204ea --- /dev/null +++ b/examples/dde/CApp/MkInstall,fd7 @@ -0,0 +1,2 @@ +Dir +amu install INSTTYPE=app INSTDIR= USERIF=Iyonix diff --git a/examples/dde/CApp/Resources/!Boot,feb b/examples/dde/CApp/Resources/!Boot,feb new file mode 100644 index 0000000..a0d0cd4 --- /dev/null +++ b/examples/dde/CApp/Resources/!Boot,feb @@ -0,0 +1,2 @@ +| !Boot files are normally locale-independent +IconSprites .!Sprites diff --git a/examples/dde/CApp/Resources/Iyonix/UK/!Sprites,ff9 b/examples/dde/CApp/Resources/Iyonix/UK/!Sprites,ff9 new file mode 100644 index 0000000..fb979fb Binary files /dev/null and b/examples/dde/CApp/Resources/Iyonix/UK/!Sprites,ff9 differ diff --git a/examples/dde/CApp/Resources/Iyonix/UK/!Sprites11,ff9 b/examples/dde/CApp/Resources/Iyonix/UK/!Sprites11,ff9 new file mode 100644 index 0000000..e75fdfe Binary files /dev/null and b/examples/dde/CApp/Resources/Iyonix/UK/!Sprites11,ff9 differ diff --git a/examples/dde/CApp/Resources/Iyonix/UK/!Sprites22,ff9 b/examples/dde/CApp/Resources/Iyonix/UK/!Sprites22,ff9 new file mode 100644 index 0000000..4c2b031 Binary files /dev/null and b/examples/dde/CApp/Resources/Iyonix/UK/!Sprites22,ff9 differ diff --git a/examples/dde/CApp/Resources/UK/!Run,feb b/examples/dde/CApp/Resources/UK/!Run,feb new file mode 100644 index 0000000..7e9d2e0 --- /dev/null +++ b/examples/dde/CApp/Resources/UK/!Run,feb @@ -0,0 +1,11 @@ +| !Run files are normally locale-dependent, if only for the error messages + +RMEnsure UtilityModule 3.10 Error This application requires RISC OS 3.10 or later +RMEnsure UtilityModule 5.00 RMEnsure CallASWI 0.03 RMLoad System:Modules.CallASWI +RMEnsure UtilityModule 5.00 RMEnsure CallASWI 0.03 Error This app requires CallASWI 0.03 or later +RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator +RMEnsure FPEmulator 4.03 Error This application requires FPEmulator 4.03 or later +RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib +RMEnsure SharedCLibrary 5.34 Error This application requires SharedCLibrary 5.34 or later + +Run .!RunImage diff --git a/examples/dde/CApp/c/main b/examples/dde/CApp/c/main new file mode 100644 index 0000000..59c6bfc --- /dev/null +++ b/examples/dde/CApp/c/main @@ -0,0 +1,20 @@ +#include +#include +#include "LibZVector:zvector.h" + +int main(void) +{ + vector v = vect_create(16, sizeof(int), ZV_SEC_WIPE); + + for (int i = 1; i <= 10; i++) + vect_add(v, &i); + + for (int i=1; i <= 10; i++) + { + int *val = (int *)vect_pop(v); + printf ("Value %d: %d\n", i, *val); + } + + vect_destroy(v); + exit(EXIT_SUCCESS); +}