diff options
-rw-r--r-- | CHANGELOG.txt | 7 | ||||
-rw-r--r-- | bowshock/CMakeLists.txt | 4 | ||||
-rw-r--r-- | bowshock/include/bow/bs.hxx | 36 | ||||
-rw-r--r-- | bowshock/include/bow/init.hxx | 2 | ||||
-rw-r--r-- | bowshock/include/bow/lgc.hxx | 4 | ||||
-rw-r--r-- | bowshock/include/bow/run.hxx | 2 | ||||
-rw-r--r-- | bowshock/include/bow/sav.hxx | 18 | ||||
-rw-r--r-- | bowshock/source/bs/rnd.cxx | 10 | ||||
-rw-r--r-- | bowshock/source/init/bow/chkParams.cxx | 14 | ||||
-rw-r--r-- | bowshock/source/init/bow/compShd.cxx | 48 | ||||
-rw-r--r-- | bowshock/source/init/bow/cred.cxx | 30 | ||||
-rw-r--r-- | bowshock/source/init/bow/getQuot.cxx | 2 | ||||
-rw-r--r-- | bowshock/source/init/bow/getSavPth.cxx | 24 | ||||
-rw-r--r-- | bowshock/source/init/bow/priQuot.cxx | 2 | ||||
-rw-r--r-- | bowshock/source/lgc/sim.cxx | 4 | ||||
-rw-r--r-- | bowshock/source/run/addObj.cxx | 4 | ||||
-rw-r--r-- | bowshock/source/run/genSys.cxx | 6 | ||||
-rw-r--r-- | bowshock/source/sav/cont.cxx | 24 | ||||
-rw-r--r-- | bowshock/source/sav/decSav.cxx | 6 | ||||
-rw-r--r-- | bowshock/source/sav/encSav.cxx | 6 | ||||
-rw-r--r-- | bowshock/source/sav/sav.cxx | 20 |
21 files changed, 140 insertions, 133 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d8eea37..e3f30ee 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,10 @@ +# 0.C.0 + +* Migrate from Zap to zp; +* Migrate from Flux to ly; +* Tag development versions; +* Use minimum-width types; + # 0.B.2 * Fix data directory not being set correctly by CMake; diff --git a/bowshock/CMakeLists.txt b/bowshock/CMakeLists.txt index 97d1130..3ceca37 100644 --- a/bowshock/CMakeLists.txt +++ b/bowshock/CMakeLists.txt @@ -65,11 +65,11 @@ target_include_directories( target_link_libraries( bowshock PRIVATE - flux glad glfw + ly m - zap + zp ) target_compile_definitions( diff --git a/bowshock/include/bow/bs.hxx b/bowshock/include/bow/bs.hxx index b2bf23e..c9faaf4 100644 --- a/bowshock/include/bow/bs.hxx +++ b/bowshock/include/bow/bs.hxx @@ -7,9 +7,9 @@ #endif #include <cstdio> -#include <zap/bs.hh> // We guarantee that this header is included. +#include <zp/bs> // We guarantee that this header is included. -static_assert(::zap::bytelen == 0x8u,"Bytes must contain exactly eight bits."); +static_assert(::zp::bytelen == 0x8u,"Bytes must contain exactly eight bits."); #define bow_logRaw(msg,...) fprintf(stderr,msg __VA_OPT__(,) __VA_ARGS__) @@ -25,23 +25,23 @@ static_assert(::zap::bytelen == 0x8u,"Bytes must contain exactly eight bits."); #define bow_logXyz(xyz) bow_logDbg("%s: %.03f %.03f %.03f",#xyz,(xyz).x,(xyz).y,(xyz).z) -#define bow_setStrLen(ptr,len,str) ((void)(ptr = str,len = sizeof (str) - 0x1u)) +#define bow_setStrLen(ptr,len,str) ((void)(ptr = str,len = sizeof (str)-0x1u)) namespace bow { - constexpr ::zap::i04 verMaj = 0x0u; - constexpr ::zap::i04 verMin = 0xBu; - constexpr ::zap::i04 verPat = 0x2u; + constexpr ::zp::i04m verMaj = 0x0u; + constexpr ::zp::i04m verMin = 0xCu; + constexpr ::zp::i04m verPat = 0x0u; constexpr bool dbg = bow_dbg; - constexpr ::zap::sz cmdrNmLen = 0xEu; + constexpr ::zp::siz cmdrNmLen = 0xEu; - enum struct stat : ::zap::i8 { + enum struct stat : ::zp::i8m { ok = 0x0u, err = 0x1u, }; - enum struct objTyp : ::zap::i8 { + enum struct objTyp : ::zp::i8m { can, // canister pl, // player ship, // ship @@ -50,7 +50,7 @@ namespace bow { wrld, // world (planet/moon) }; - enum struct wrld : ::zap::i8 { + enum struct wrld : ::zp::i8m { amm, // ammonium world gas, // gas giant ice, // icy world @@ -59,7 +59,7 @@ namespace bow { wat, // water world }; - enum struct ship : ::zap::i8 { + enum struct ship : ::zp::i8m { aq, // aquila cas, // cassiopeia cent, // centaurus @@ -74,7 +74,7 @@ namespace bow { // Remember maxShipId in sav }; - enum struct star : ::zap::i8 { + enum struct star : ::zp::i8m { a, // main sequence b, // main sequence c, // carbon @@ -93,7 +93,7 @@ namespace bow { z, // white hole }; - enum struct station : ::zap::i8 { + enum struct station : ::zp::i8m { station_glob, // globus station_orb, // orbis }; @@ -125,14 +125,14 @@ namespace bow { }; struct plDat { - char nm[::bow::cmdrNmLen+0x1u]; - ::zap::i04 tm; - ::zap::i04 sysId; + char nm[::bow::cmdrNmLen+0x1u]; + ::zp::i04m tm; + ::zp::i04m sysId; ::bow::obj ship; - float zoom; + float zoom; }; char const * objTypStr(::bow::objTyp typ) noexcept; - ::zap::i04 rnd() noexcept; + ::zp::i04 rnd() noexcept; } diff --git a/bowshock/include/bow/init.hxx b/bowshock/include/bow/init.hxx index 2dea576..60a8d50 100644 --- a/bowshock/include/bow/init.hxx +++ b/bowshock/include/bow/init.hxx @@ -33,7 +33,7 @@ namespace bow { ::bow::gfxDat gfxDat; char const * getSavPth() noexcept; - void getQuot( char const * * quot,char const * * src,::zap::i8 id) noexcept; + void getQuot( char const * * quot,char const * * src,::zp::i8m id) noexcept; void priQuot() noexcept; diff --git a/bowshock/include/bow/lgc.hxx b/bowshock/include/bow/lgc.hxx index 3646153..4db1a4e 100644 --- a/bowshock/include/bow/lgc.hxx +++ b/bowshock/include/bow/lgc.hxx @@ -13,11 +13,11 @@ namespace bow { constexpr double gravConst = 0x1.258688101B4BB16Dp-34*::bow::gravConstFac; // gravitational constant (s^2*m*t^2) - zap_attr_unseq double shipMass(::bow::ship id) noexcept; + zp_useq double shipMass(::bow::ship id) noexcept; void grav(::bow::objRoot & sys) noexcept; void grav(::bow::objRoot & objs,::bow::objRoot const & sys) noexcept; void mv( ::bow::objRoot & root) noexcept; - void sim(::bow::objRoot & sys,::zap::i04 dur) noexcept; + void sim(::bow::objRoot & sys,::zp::i04 dur) noexcept; } diff --git a/bowshock/include/bow/run.hxx b/bowshock/include/bow/run.hxx index f341df1..63311cb 100644 --- a/bowshock/include/bow/run.hxx +++ b/bowshock/include/bow/run.hxx @@ -10,5 +10,5 @@ namespace bow { void addObj( ::bow::objRoot & root,::bow::obj const & obj); void freeObjs(::bow::objRoot const & root) noexcept; - void genSys(::bow::objRoot & sys,::zap::i04 id,::zap::i04 tm); + void genSys(::bow::objRoot & sys,::zp::i04 id,::zp::i04 tm); } diff --git a/bowshock/include/bow/sav.hxx b/bowshock/include/bow/sav.hxx index 41ae867..6a3d130 100644 --- a/bowshock/include/bow/sav.hxx +++ b/bowshock/include/bow/sav.hxx @@ -5,11 +5,11 @@ #include <bow/bs.hxx> namespace bow { - constexpr ::zap::i04 savVer = 0x6u; + constexpr ::zp::i04 savVer = 0x6u; - constexpr ::zap::sz savLen = 0x79u+::bow::cmdrNmLen; + constexpr ::zp::siz savLen = 0x79u+::bow::cmdrNmLen; - constexpr ::zap::i8 maxShipId = static_cast<::zap::i8>(::bow::ship::vip); + constexpr ::zp::i8 maxShipId = static_cast<::zp::i8>(::bow::ship::vip); /* Save format: @@ -36,11 +36,11 @@ namespace bow { */ struct savDat { - ::zap::i04 fmtVer; + ::zp::i04 fmtVer; char cmdrNm[::bow::cmdrNmLen]; - ::zap::i04 tm; - ::zap::i04 sysId; - ::zap::i8 shipTyp; + ::zp::i04 tm; + ::zp::i04 sysId; + ::zp::i8 shipTyp; double shipPosX; double shipPosY; double shipPosZ; @@ -55,8 +55,8 @@ namespace bow { double shipRotVelZ; }; - void decSav(::bow::savDat & buf,::zap::i8 const * dat) noexcept; - void encSav(::zap::i8 * buf,::bow::savDat const & dat) noexcept; + void decSav(::bow::savDat & buf,::zp::i8 const * dat) noexcept; + void encSav(::zp::i8 * buf,::bow::savDat const & dat) noexcept; void newSav(::bow::plDat & dat) noexcept; diff --git a/bowshock/source/bs/rnd.cxx b/bowshock/source/bs/rnd.cxx index 32b1b0e..4ee7e4b 100644 --- a/bowshock/source/bs/rnd.cxx +++ b/bowshock/source/bs/rnd.cxx @@ -4,14 +4,14 @@ #include <cstdlib> -static_assert(sizeof (int) == sizeof (::zap::i02)); +static_assert(sizeof (int) == sizeof (::zp::i02)); -static_assert(RAND_MAX == ::zap::maxval<int>); +static_assert(RAND_MAX == ::zp::maxval<int>::val); unsigned long ::bow::rnd() noexcept { - ::zap::i02 const rnd0 = (::zap::i02)::std::rand(); - ::zap::i02 const rnd1 = (::zap::i02)::std::rand(); - ::zap::i04 const rnd = (::zap::i04)rnd0 | (::zap::i04)rnd1 >> 0x4u; + ::zp::i02 const rnd0 = (::zp::i02)::std::rand(); + ::zp::i02 const rnd1 = (::zp::i02)::std::rand(); + ::zp::i04 const rnd = (::zp::i04)rnd0 | (::zp::i04)rnd1 >> 0x4u; return rnd; } diff --git a/bowshock/source/init/bow/chkParams.cxx b/bowshock/source/init/bow/chkParams.cxx index eb49e5d..153838e 100644 --- a/bowshock/source/init/bow/chkParams.cxx +++ b/bowshock/source/init/bow/chkParams.cxx @@ -2,8 +2,8 @@ #include <bow/init.hxx> -#include <zap/mem.hh> -#include <zap/str.hh> +#include <zp/mem> +#include <zp/str> void ::bow::bow::chkParams(::bow::termOpts & opts,int const argc,char const * const * argv) noexcept { char const * const progNm = *argv; @@ -15,17 +15,17 @@ void ::bow::bow::chkParams(::bow::termOpts & opts,int const argc,char const * co }; if (argc >= 0x2) [[unlikely]] { - char const * const * const stop = (argv++)+(::zap::sz)argc; + char const * const * const stop = (argv++)+(::zp::siz)argc; for (;argv != stop;++argv) { char const * param = *argv; if (param[0x0u] == '-' && param[0x1u] == '-') { param += 0x2u; - if (::zap::streq(param,"credits")) cred(); - else if (::zap::streq(param,"help")) help(progNm); - else if (::zap::streq(param,"new")) opts.newSav = true; - else if (::zap::streq(param,"skip")) opts.skip = true; + if (::zp::strequ(param,"credits")) cred(); + else if (::zp::strequ(param,"help")) help(progNm); + else if (::zp::strequ(param,"new")) opts.newSav = true; + else if (::zp::strequ(param,"skip")) opts.skip = true; else bow_logErr("invalid parameter \"%s\"",param); continue; } diff --git a/bowshock/source/init/bow/compShd.cxx b/bowshock/source/init/bow/compShd.cxx index 7615a0d..e1d418c 100644 --- a/bowshock/source/init/bow/compShd.cxx +++ b/bowshock/source/init/bow/compShd.cxx @@ -3,18 +3,18 @@ #include <bow/init.hxx> #include <cstdlib> -#include <flux/io.hh> -#include <flux/stats.hh> +#include <ly/io> +#include <ly/fs> #include <glad/glad.h> #include <stdexcept> -#include <zap/mem.hh> -#include <zap/str.hh> +#include <zp/mem> +#include <zp/str> void ::bow::bow::compShd(GLuint & shd,char const * const nm,GLenum const typ) { char const * typStr; char const * typExt; - ::zap::sz typExtLen; + ::zp::siz typExtLen; switch (typ) { default: bow_logErr("bad shader type %lX",static_cast<unsigned long>(typ)); @@ -30,48 +30,48 @@ void ::bow::bow::compShd(GLuint & shd,char const * const nm,GLenum const typ) { } char const * dir; - ::zap::sz dirLen; + ::zp::siz dirLen; bow_setStrLen(dir,dirLen,bow_datDir "/shaders"); - ::zap::sz const nmLen = ::zap::strlen(nm); - ::zap::sz const pthLen = dirLen + 0x1u + nmLen + 0x1u + typExtLen + 0x1u + sizeof (::bow::shdFilExt); + ::zp::siz const nmLen = ::zp::strlen(nm); + ::zp::siz const pthLen = dirLen + 0x1u + nmLen + 0x1u + typExtLen + 0x1u + sizeof (::bow::shdFilExt); char * pth = new char[pthLen + 0x1u]; - pth = ::zap::cp(pth,dir,dirLen).dest; + pth = ::zp::cpy(pth,dir,dirLen).dst; *pth++ = '/'; - pth = ::zap::cp(pth,nm,nmLen).dest; + pth = ::zp::cpy(pth,nm,nmLen).dst; *pth++ = '.'; - pth = ::zap::cp(pth,typExt,typExtLen).dest; + pth = ::zp::cpy(pth,typExt,typExtLen).dst; *pth++ = '.'; - pth = ::zap::cp(pth,::bow::shdFilExt,sizeof (::bow::shdFilExt)).dest; + pth = ::zp::cpy(pth,::bow::shdFilExt,sizeof (::bow::shdFilExt)).dst; *pth = '\x00'; pth -= pthLen; bow_logDbg("compiling %s shader at \"%s\"",typStr,pth); - ::flux::fil fil; - ::flux::err err = fil.op(pth,::flux::md::rd,::flux::keep); + ::ly::fil fil; + ::ly::err err = fil.opn(pth,::ly::mod::red,::ly::kep); - if (err != ::flux::err::ok) [[unlikely]] {throw ::std::runtime_error {"unable to open shader source"};} + if (err != ::ly::err::ok) [[unlikely]] {throw ::std::runtime_error {"unable to open shader source"};} - ::zap::sz const filsz = [&pth]() { - ::flux::stats stats; - ::flux::stat(stats,pth); + ::zp::siz const filsiz = [&pth]() { + ::ly::pthinf pthinf; + ::ly::sttpth(pthinf,pth); - return stats.sz; + return pthinf.siz; }(); delete[] pth; static_assert(sizeof (GLchar) == sizeof (char)); - GLchar * const src = new GLchar[filsz + 0x1u]; + GLchar * const src = new GLchar[filsiz + 0x1u]; - err = fil.rd(src,filsz); - if (err != ::flux::err::ok) {throw ::std::runtime_error {"unable to read shader source"};} - fil.cl(); + err = fil.red(src,filsiz); + if (err != ::ly::err::ok) {throw ::std::runtime_error {"unable to read shader source"};} + fil.cls(); - src[filsz] = '\x00'; + src[filsiz] = '\x00'; shd = glCreateShader(typ); glShaderSource(shd,0x1,(GLchar const * const *)&src,nullptr); diff --git a/bowshock/source/init/bow/cred.cxx b/bowshock/source/init/bow/cred.cxx index f3a9f09..fe69aae 100644 --- a/bowshock/source/init/bow/cred.cxx +++ b/bowshock/source/init/bow/cred.cxx @@ -2,25 +2,25 @@ #include <bow/init.hxx> -#include <flux/io.hh> -#include <flux/stats.hh> +#include <ly/io> +#include <ly/fs> #include <cstdlib> #include <stdexcept> void ::bow::bow::cred() noexcept { char const * const pth = bow_datDir "/CREDITS.txt"; - ::zap::sz const filsz = [&pth]() { - ::flux::stats stats; - ::flux::stat(stats,pth); + ::zp::siz const filsiz = [&pth]() { + ::ly::pthinf pthinf; + ::ly::sttpth(pthinf,pth); - return stats.sz; + return pthinf.siz; }(); - ::flux::fil fil; - ::flux::err err = fil.op(pth,::flux::md::rd,::flux::keep); + ::ly::fil fil; + ::ly::err err = fil.opn(pth,::ly::mod::red,::ly::kep); - if (err != ::flux::err::ok) [[unlikely]] { + if (err != ::ly::err::ok) [[unlikely]] { bow_logErr("unable to open credits file"); ::std::exit(EXIT_FAILURE); @@ -28,7 +28,7 @@ void ::bow::bow::cred() noexcept { char * cred; - try {cred = new char[filsz + 0x3u];} + try {cred = new char[filsiz + 0x3u];} catch (::std::bad_alloc const & e) { bow_logErr("unable to allocate memory"); @@ -39,18 +39,18 @@ void ::bow::bow::cred() noexcept { *cred++ = '\n'; - fil.rd(cred,filsz); - fil.cl(); - cred += filsz; + fil.red(cred,filsiz); + fil.cls(); + cred += filsiz; *cred++ = '\n'; *cred++ = '\x00'; cred = credstart; - ::flux::dflout.wr(cred,filsz + 0x3u); + ::ly::dflout.wrt(cred,filsiz + 0x3u); - if (err != ::flux::err::ok) { + if (err != ::ly::err::ok) { bow_logErr("unable to write to defout"); ::std::exit(EXIT_FAILURE); diff --git a/bowshock/source/init/bow/getQuot.cxx b/bowshock/source/init/bow/getQuot.cxx index 8749310..8d41eea 100644 --- a/bowshock/source/init/bow/getQuot.cxx +++ b/bowshock/source/init/bow/getQuot.cxx @@ -4,7 +4,7 @@ #include <cinttypes> -void ::bow::bow::getQuot(char const * * const quot,char const * * src,::zap::i8 const id) noexcept { +void ::bow::bow::getQuot(char const * * const quot,char const * * src,::zp::i8m const id) noexcept { switch (id) { default: bow_logErr("invalid quote identifier (%" PRIX8 ")",id); diff --git a/bowshock/source/init/bow/getSavPth.cxx b/bowshock/source/init/bow/getSavPth.cxx index 030dfa1..e3068dc 100644 --- a/bowshock/source/init/bow/getSavPth.cxx +++ b/bowshock/source/init/bow/getSavPth.cxx @@ -3,31 +3,31 @@ #include <bow/init.hxx> #include <cstdlib> -#include <flux/stats.hh> -#include <zap/mem.hh> -#include <zap/str.hh> +#include <ly/fs> +#include <zp/mem> +#include <zp/str> char const * ::bow::bow::getSavPth() noexcept { - char const * hmDir = ::flux::hmdir(); + char const * homdir = ::ly::homdir(); char const * filNm; - ::zap::sz hmDirLen; - ::zap::sz filNmLen; + ::zp::siz hmDirLen; + ::zp::siz filNmLen; - if (hmDir == nullptr) [[unlikely]] { + if (homdir == nullptr) [[unlikely]] { bow_log("unable to get home directory, using current directory"); - bow_setStrLen(hmDir,hmDirLen,"./"); + bow_setStrLen(homdir,hmDirLen,"./"); } - else hmDirLen = ::zap::strlen(hmDir); + else hmDirLen = ::zp::strlen(homdir); bow_setStrLen(filNm,filNmLen,".save.bowshock"); - ::zap::sz pthLen = hmDirLen+filNmLen+0x1u; + ::zp::siz pthLen = hmDirLen+filNmLen+0x1u; char * pth = new char[pthLen + 0x1u]; - pth = ::zap::bytecp(pth,hmDir,hmDirLen).dest; + pth = ::zp::memcpy(pth,homdir,hmDirLen).dst; *pth++ = '/'; - pth = ::zap::bytecp(pth,filNm,filNmLen).dest; + pth = ::zp::memcpy(pth,filNm,filNmLen).dst; *pth = '\x00'; pth -= pthLen; diff --git a/bowshock/source/init/bow/priQuot.cxx b/bowshock/source/init/bow/priQuot.cxx index 51a2f20..6882c15 100644 --- a/bowshock/source/init/bow/priQuot.cxx +++ b/bowshock/source/init/bow/priQuot.cxx @@ -8,7 +8,7 @@ void ::bow::bow::priQuot() noexcept { ::std::srand(static_cast<unsigned int>(::std::time(nullptr))); - ::zap::i8 const quotId = (::zap::i8)rand() % 0x24u; + ::zp::i8 const quotId = (::zp::i8)rand() % 0x24u; char const * quot; char const * src; diff --git a/bowshock/source/lgc/sim.cxx b/bowshock/source/lgc/sim.cxx index 596b0c9..7832c64 100644 --- a/bowshock/source/lgc/sim.cxx +++ b/bowshock/source/lgc/sim.cxx @@ -6,10 +6,10 @@ #include <cinttypes> -void ::bow::sim(::bow::objRoot & sys,::zap::i04 const dur) noexcept { +void ::bow::sim(::bow::objRoot & sys,::zp::i04 const dur) noexcept { bow_log("simulating for (%" PRIX64 ") time units",dur); - for (::zap::i04 i = 0x0u;i <= dur;++i) { + for (::zp::i04 i = 0x0u;i <= dur;++i) { ::bow::grav(sys); ::bow::mv(sys); } diff --git a/bowshock/source/run/addObj.cxx b/bowshock/source/run/addObj.cxx index 54732db..06ad41a 100644 --- a/bowshock/source/run/addObj.cxx +++ b/bowshock/source/run/addObj.cxx @@ -3,13 +3,13 @@ #include <bow/run.hxx> #include <cstdlib> -#include <zap/mem.hh> +#include <zp/mem> void ::bow::addObj(::bow::objRoot & root,::bow::obj const & objVal) { bow_logDbg("adding object of type %s",::bow::objTypStr(objVal.typ)); ::bow::obj * const obj = new ::bow::obj; - ::zap::bytecp(obj,&objVal,sizeof (objVal)); + ::zp::memcpy(obj,&objVal,sizeof (objVal)); obj->next = root.objs; root.objs = obj; diff --git a/bowshock/source/run/genSys.cxx b/bowshock/source/run/genSys.cxx index 7f6f922..d8d199c 100644 --- a/bowshock/source/run/genSys.cxx +++ b/bowshock/source/run/genSys.cxx @@ -5,12 +5,12 @@ #include <cinttypes> -void ::bow::genSys(::bow::objRoot & sys,::zap::i04 const id,::zap::i04 const tm) { +void ::bow::genSys(::bow::objRoot & sys,::zp::i04 const id,::zp::i04 const tm) { bow_log("generating system (%" PRIXLEAST64 ")",id); sys.objs = nullptr; ::bow::obj objTmp; - objTmp = { + objTmp = ::bow::obj { .typ = ::bow::objTyp::star, .starTyp = ::bow::star::g, .pos = { @@ -37,7 +37,7 @@ void ::bow::genSys(::bow::objRoot & sys,::zap::i04 const id,::zap::i04 const tm) // next will be overwritten anyways. }; ::bow::addObj(sys,objTmp); - objTmp = { + objTmp = ::bow::obj { .typ = ::bow::objTyp::wrld, .wrldTyp = ::bow::wrld::rck, .pos = { diff --git a/bowshock/source/sav/cont.cxx b/bowshock/source/sav/cont.cxx index d50ded7..6d81798 100644 --- a/bowshock/source/sav/cont.cxx +++ b/bowshock/source/sav/cont.cxx @@ -3,35 +3,35 @@ #include <bow/sav.hxx> #include <cinttypes> -#include <flux/io.hh> -#include <zap/mem.hh> +#include <ly/io> +#include <zp/mem> void ::bow::cont(::bow::plDat & plDat,char const * const pth) noexcept { bow_log("loading save file at \"%s\"",pth); - ::flux::fil fil; + ::ly::fil fil; - ::flux::err err = fil.op(pth,::flux::md::rd,::flux::keep); + ::ly::err err = fil.opn(pth,::ly::mod::red,::ly::kep); - if (err != ::flux::err::ok) [[unlikely]] { + if (err != ::ly::err::ok) [[unlikely]] { bow_logErr("unable to open save file \"%s\"",pth); return ::bow::newSav(plDat); } - ::zap::i8 rawDat[::bow::savLen]; - err = fil.rd(rawDat,::bow::savLen); + ::zp::i8 rawDat[::bow::savLen]; + err = fil.red(rawDat,::bow::savLen); - if (err != ::flux::err::ok) [[unlikely]] { - fil.cl(); + if (err != ::ly::err::ok) [[unlikely]] { + fil.cls(); - if (err == ::flux::err::eof) bow_logErr("corrupt save file at \"%s\"",pth); + if (err == ::ly::err::eof) bow_logErr("corrupt save file at \"%s\"",pth); else bow_logErr("unable to read file at \"%s\"",pth); return ::bow::newSav(plDat); } - fil.cl(); + fil.cls(); ::bow::savDat dat; @@ -75,7 +75,7 @@ void ::bow::cont(::bow::plDat & plDat,char const * const pth) noexcept { }, }, }; - ::zap::cp(plDat.nm,dat.cmdrNm,::bow::cmdrNmLen); + ::zp::cpy(plDat.nm,dat.cmdrNm,::bow::cmdrNmLen); plDat.nm[::bow::cmdrNmLen] = '\x00'; ::bow::genDat(plDat); diff --git a/bowshock/source/sav/decSav.cxx b/bowshock/source/sav/decSav.cxx index 983dd3a..2141c48 100644 --- a/bowshock/source/sav/decSav.cxx +++ b/bowshock/source/sav/decSav.cxx @@ -2,11 +2,11 @@ #include <bow/sav.hxx> -#include <zap/mem.hh> +#include <zp/mem> -void ::bow::decSav(::bow::savDat & buf,::zap::i8 const * dat) noexcept { +void ::bow::decSav(::bow::savDat & buf,::zp::i8 const * dat) noexcept { auto const decVal = [&dat]<typename typ>(typ & buf) { - dat = ::zap::bytecp(&buf,dat,sizeof (buf)).src; + dat = ::zp::memcpy(&buf,dat,sizeof (buf)).src; }; decVal(buf.fmtVer); // fmtver diff --git a/bowshock/source/sav/encSav.cxx b/bowshock/source/sav/encSav.cxx index 245cd22..cefd92f 100644 --- a/bowshock/source/sav/encSav.cxx +++ b/bowshock/source/sav/encSav.cxx @@ -2,11 +2,11 @@ #include <bow/sav.hxx> -#include <zap/mem.hh> +#include <zp/mem> -void ::bow::encSav(::zap::i8 * buf,::bow::savDat const & dat) noexcept { +void ::bow::encSav(::zp::i8 * buf,::bow::savDat const & dat) noexcept { auto const encVal = [&buf]<typename typ>(typ const & val) { - buf = ::zap::bytecp(buf,&val,sizeof (val)).dest; + buf = ::zp::memcpy(buf,&val,sizeof (val)).dst; }; encVal(dat.fmtVer); // fmtver diff --git a/bowshock/source/sav/sav.cxx b/bowshock/source/sav/sav.cxx index 48e2ef6..3974ced 100644 --- a/bowshock/source/sav/sav.cxx +++ b/bowshock/source/sav/sav.cxx @@ -3,27 +3,27 @@ #include <bow/run.hxx> #include <bow/sav.hxx> -#include <flux/io.hh> -#include <zap/mem.hh> +#include <ly/io> +#include <zp/mem> void ::bow::sav(char const * const pth,::bow::plDat const & plDat) noexcept { bow_log("saving commander %s at \"%s\"",plDat.nm,pth); - ::flux::fil fil; - ::flux::err err = fil.mk(pth,0644u); + ::ly::fil fil; + ::ly::err err = fil.crt(pth,0644u); - if (err != ::flux::err::ok) [[unlikely]] { + if (err != ::ly::err::ok) [[unlikely]] { bow_logErr("unable to open save file \"%s\"",pth); ::bow::abrt(); } - ::zap::i8 dat[::bow::savLen]; + ::zp::i8 dat[::bow::savLen]; ::bow::savDat savDat = { .fmtVer = ::bow::savVer, .tm = plDat.tm, .sysId = plDat.sysId, - .shipTyp = static_cast<::zap::i8>(plDat.ship.shipTyp), + .shipTyp = static_cast<::zp::i8>(plDat.ship.shipTyp), .shipPosX = plDat.ship.pos.x, .shipPosY = plDat.ship.pos.y, .shipPosZ = plDat.ship.pos.z, @@ -37,10 +37,10 @@ void ::bow::sav(char const * const pth,::bow::plDat const & plDat) noexcept { .shipRotVelY = plDat.ship.rotVel.y, .shipRotVelZ = plDat.ship.rotVel.z, }; - ::zap::cp(savDat.cmdrNm,plDat.nm,sizeof (savDat.cmdrNm)); + ::zp::cpy(savDat.cmdrNm,plDat.nm,sizeof (savDat.cmdrNm)); ::bow::encSav(dat,savDat); - fil.wr(dat,::bow::savLen); - fil.cl(); + fil.wrt(dat,::bow::savLen); + fil.cls(); } |