From d198b9cd52236d5b9b961e1364515294bdfbf82d Mon Sep 17 00:00:00 2001 From: Paolo Fabio Zaino Date: Fri, 29 Dec 2023 22:35:47 +0000 Subject: [PATCH] Added DDE example in C and fixed a minor bug in the build process --- !LibZVector/a/libzvector | Bin 125908 -> 125992 bytes !LibZVector/h/zvector_checks | 149 ++++++++++++++++++ !LibZVector/h/zvector_config | 90 +++++++++++ !LibZVector/so/libzvector.so.1.0.0 | Bin 124956 -> 124956 bytes MkDDE,fd7 | 2 + MkGCC,fd7 | 3 + examples/dde/CApp/Makefile | 36 +++++ examples/dde/CApp/Mk,fd7 | 3 + examples/dde/CApp/MkClean,fd7 | 3 + examples/dde/CApp/MkDebug,fd7 | 2 + examples/dde/CApp/MkInstall,fd7 | 2 + examples/dde/CApp/Resources/!Boot,feb | 2 + .../dde/CApp/Resources/Iyonix/UK/!Sprites,ff9 | Bin 0 -> 2504 bytes .../CApp/Resources/Iyonix/UK/!Sprites11,ff9 | Bin 0 -> 3320 bytes .../CApp/Resources/Iyonix/UK/!Sprites22,ff9 | Bin 0 -> 1416 bytes examples/dde/CApp/Resources/UK/!Run,feb | 11 ++ examples/dde/CApp/c/main | 20 +++ 17 files changed, 323 insertions(+) create mode 100644 !LibZVector/h/zvector_checks create mode 100644 !LibZVector/h/zvector_config create mode 100644 examples/dde/CApp/Makefile create mode 100644 examples/dde/CApp/Mk,fd7 create mode 100644 examples/dde/CApp/MkClean,fd7 create mode 100644 examples/dde/CApp/MkDebug,fd7 create mode 100644 examples/dde/CApp/MkInstall,fd7 create mode 100644 examples/dde/CApp/Resources/!Boot,feb create mode 100644 examples/dde/CApp/Resources/Iyonix/UK/!Sprites,ff9 create mode 100644 examples/dde/CApp/Resources/Iyonix/UK/!Sprites11,ff9 create mode 100644 examples/dde/CApp/Resources/Iyonix/UK/!Sprites22,ff9 create mode 100644 examples/dde/CApp/Resources/UK/!Run,feb create mode 100644 examples/dde/CApp/c/main diff --git a/!LibZVector/a/libzvector b/!LibZVector/a/lib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oYA{~<2ysX}p zUad)LOf{vWv?|Y5F$fHaExXg^VY%!nO2d@RHhXIOXtgc1mxn}&+fgMq4Mr$dtJByp zEQ-??)Ur2eF5$2!%8*_|J!&gNOH!lq+tUA#H7Q}$;f}ueuqh=SRbnA)d=_g#U6Du$swEHpNxpY49TTcQnMb9*(%HuGhLYs_MI

=%%jfgienS(92LdSxu4haN@qWC zV^kE{ZXXR6KUJ+l`)SKjQf~k zl;SSqW#o+$-a&wI8ZzTM^fK;Ygi(M6#tRUa2tiaZda$2y5gm+0oMJqQZx}VW&uB#P zWkL_?7#E;2enmec2jh$yEHY$xuMqlB$r!^S#vODsy!et)gBy&)SYo_~vI)Wv>KQ+v zmEig3ah#kG<)Q>rJh~Tm87;`WO85W)#xP{YPv|9hmeyeODy`U#1s>f8F-dq66^uUY zXC%-;@GRuu^GQ+ed60v7qA16Gp52GyYlJB37#~ArB+yUr+XZNCPnh--h;{;j>o{6_P{DWu`x(d3!T1cP2%anJFh4^} zep`pXm=D%r(=0808g;Xzs)9<$^R3Uy@@B1mdT?r1Y!r1EXHh*C84d8x5oA=(iRVQt TqH|)K(9q9=dlKVwBEJ1!hL?Z5 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 65b58dfb13a6f9b9b2114e7b30d5b955e84a1887..cd4e764d99ef52501387ddacd44575c1764c9da7 100644 GIT binary patch delta 2684 zcma)8O>fgc5M?jqf)J>Xq_m|%J#oMw(kc}d58++rd@Wl2L~p;?V@v6bUA25JTvLSCS{8F8$)#V zL_S`~)7nP<6ezNZOCq8YFFp>@0;K&hM9b@?w2m}{q9NkuNX7Yhq$(gjKsE7Ugep+P z=Mh?N>O@eVM&_f$!(j5_!X8@GSpSdlrG6gasLMfo*1{BNxdewrSP}1`rM^yR#-T|x zb&pNtBM6{LbBgkh_99pvX;R8f;xW~Gl|woOd;a_ts^2ayCFN`phr&0S(?@(8)GCgT zQT1*K`yuO3Cjv7J#%O7^Bm?X64vhRXMsu1Wrj?g&fPbiV82HeYxgN>)GppnL%3AOU zAcP=s?*J`mHe)KQ#pTMf6h==r?pn!cF=H-VLE@*(Tlz+lP?NTS2Xf}O0>zg&hoL?v z`TG0N#L5qDjw-<%LX}5Cg@ZCK!|FRBX0WaQL3%jUeNc>$w6*uiCy81`kgMr$p-n8e U2$2H#mKWg`7{a^B8+3i`H~q6VX8-^I delta 2684 zcma)8!EVz)5M?jqf)J>Xq_m|%J#oMgAW21q#0Mb64Uhn9V{e=lj=k(UsR}~L2XNrF zmkMzyO-iUMgv1T;1t^@jaN!#`AcTZin}DfjZTGtS=FOX#w_|TkOPkZu@GW|=b&FhF zZIEWI*0kyu8np&FWH?^Wa0A~osOM6T7&!>m;@9s>lyxRDvQt zkI`~7PXzU7U_OdG3??tn?V!aR>;Eyn(k}uW^aO}cS{NfOmtdZSmEjIr8srI0IC2ur z++!2<2z+SLl%n*bJr7n#oRkWabeZnGsv(_#J%9cRRc~jP5_7hQL*W}u=_8&EYL!PP zsC>78{ebny6M-3q6SQ=>AOq`(4vhRXL324nj4LnP0RK>J?t9RcsUE5KvtP&AeY-y< z%X(u^U!(b)jTpzWUWy;mD~R?9|5Egqiu&lY{qhyPWV`6(aqaOubejT~Ww?tD!>end zmPZ|z=X5(Kx+rt(Ihxg}?iPzoA=a^`nr9)ZjPcpznd%h!B~QyA(A zlCFOMO|1Rkrl=y!0aSGf*ElHQGOU5aF@tUW57Ngx?}K7+($2k)K1tNdf?SP%3vFV# VS%?@QHo5_Bfg!w`zCqXPzX9N|IAs6; 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 0000000000000000000000000000000000000000..fb979fbaf1b9a7a74285d115830c22c6437120ab GIT binary patch literal 2504 zcmZQ%U|@QmfmjEKO@L~)I&d5O|Noz16px0% bXc`zz1EXnRG!2ZVfzdQDLel`y+XD{(RCG.!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); +}