Renamed project Ox and restructured it to allow it to become a baremetal
unikernel/stdlib.
This commit is contained in:
+1
-15
@@ -1,17 +1,3 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
add_library(
|
||||
WFS
|
||||
filestore.cpp
|
||||
filesystem.cpp
|
||||
_memops.cpp
|
||||
_strops.cpp
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
filestore.hpp
|
||||
_memops.hpp
|
||||
DESTINATION
|
||||
include/WFS
|
||||
)
|
||||
add_subdirectory(ox)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
add_subdirectory(fs)
|
||||
add_subdirectory(std)
|
||||
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
add_library(
|
||||
OxFS
|
||||
filestore.cpp
|
||||
filesystem.cpp
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
filestore.hpp
|
||||
filesystem.hpp
|
||||
DESTINATION
|
||||
include/ox/fs
|
||||
)
|
||||
|
||||
add_subdirectory(test)
|
||||
@@ -5,10 +5,4 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
#include "_memops.hpp"
|
||||
#include "filestore.hpp"
|
||||
|
||||
namespace wombat {
|
||||
namespace fs {
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,14 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "_memops.hpp"
|
||||
#include "_types.hpp"
|
||||
#include <ox/std/_memops.hpp>
|
||||
#include <ox/std/_types.hpp>
|
||||
|
||||
namespace wombat {
|
||||
namespace ox {
|
||||
namespace fs {
|
||||
|
||||
using namespace ox::std;
|
||||
|
||||
template<typename FsT>
|
||||
class FileStore {
|
||||
|
||||
@@ -6,9 +6,3 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
#include "filesystem.hpp"
|
||||
|
||||
namespace wombat {
|
||||
namespace fs {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "_memops.hpp"
|
||||
#include "_strops.hpp"
|
||||
#include "_types.hpp"
|
||||
#include <ox/std/_memops.hpp>
|
||||
#include <ox/std/_strops.hpp>
|
||||
#include <ox/std/_types.hpp>
|
||||
#include "filestore.hpp"
|
||||
|
||||
namespace wombat {
|
||||
namespace ox {
|
||||
namespace fs {
|
||||
|
||||
struct FileStat {
|
||||
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
add_executable(
|
||||
Format
|
||||
format.cpp
|
||||
)
|
||||
|
||||
add_executable(
|
||||
FileStoreIO
|
||||
filestoreio.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Format OxFS OxStd)
|
||||
target_link_libraries(FileStoreIO OxFS OxStd)
|
||||
|
||||
add_test("Format" Format)
|
||||
add_test("FileStoreIO" FileStoreIO)
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2015 - 2016 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
#include <ox/std/_strops.hpp>
|
||||
#include <ox/fs/filestore.hpp>
|
||||
|
||||
using namespace ox::fs;
|
||||
|
||||
template<typename FileStore>
|
||||
int test() {
|
||||
const auto size = 65535;
|
||||
uint8_t volume[size];
|
||||
char out[6];
|
||||
uint32_t err;
|
||||
typename FileStore::FsSize_t outSize;
|
||||
FileStore::format(volume, size);
|
||||
FileStore fs(volume, volume + size, &err);
|
||||
|
||||
if (fs.write(1, (void*) "Hello", 6) ||
|
||||
fs.read(1, (char*) out, &outSize) ||
|
||||
strcmp("Hello", out)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fs.write(2, (void*) "World", 6) ||
|
||||
fs.read(2, (char*) out, &outSize) ||
|
||||
strcmp("World", out)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// make sure first value was not overwritten
|
||||
if (fs.read(1, (char*) out, &outSize) ||
|
||||
strcmp("Hello", out)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
return test<FileStore16>() | test<FileStore32>() | test<FileStore64>();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2015 - 2016 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
#include <ox/fs/filestore.hpp>
|
||||
|
||||
using namespace ox::fs;
|
||||
|
||||
int main() {
|
||||
const auto size = 65535;
|
||||
uint8_t volume[size];
|
||||
uint32_t err;
|
||||
FileStore32::format(volume, size);
|
||||
FileStore32(volume, volume + size, &err);
|
||||
return err;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
add_library(
|
||||
OxStd
|
||||
_memops.cpp
|
||||
_strops.cpp
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
_memops.hpp
|
||||
_strops.hpp
|
||||
DESTINATION
|
||||
include/ox/std
|
||||
)
|
||||
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
#include "_memops.hpp"
|
||||
|
||||
namespace wombat {
|
||||
namespace fs {
|
||||
namespace ox {
|
||||
namespace std {
|
||||
|
||||
void memcpy(void *dest, void *src, int size) {
|
||||
char *srcBuf = (char*) src;
|
||||
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace wombat {
|
||||
namespace fs {
|
||||
namespace ox {
|
||||
namespace std {
|
||||
|
||||
void memcpy(void *src, void *dest, int size);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
namespace wombat {
|
||||
namespace fs {
|
||||
namespace ox {
|
||||
namespace std {
|
||||
|
||||
int strcmp(const char *str1, const char *str2) {
|
||||
auto retval = 0;
|
||||
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace wombat {
|
||||
namespace fs {
|
||||
namespace ox {
|
||||
namespace std {
|
||||
|
||||
int strcmp(const char *str1, const char *str2);
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace wombat {
|
||||
namespace fs {
|
||||
namespace ox {
|
||||
namespace std {
|
||||
|
||||
typedef char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
Reference in New Issue
Block a user