Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
/openbyond-core/grammar/parser.tab.h
/openbyond-core/grammar/test.exe
/openbyond-core/grammar/test.exe.stackdump
/build
/?build
/bin
/openbyond-core/bin/Debug/*.pdb

CMakeFiles/
Expand Down
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
## OpenBYOND - Compile Script
##########################################

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

## WHAT A CREATIVE NAME WOW
set(PROJECT_NAME openbyond)
project(openbyond)

## Versioning shit
set(VERSION_MAJOR 0)
Expand Down Expand Up @@ -41,9 +41,9 @@ endif()

#
# Every module has a CMakeLists.txt in it's root.
add_subdirectory (${CMAKE_SOURCE_DIR}/openbyond-core)
include_directories(${CMAKE_SOURCE_DIR}/openbyond-core/include)
add_subdirectory (${CMAKE_SOURCE_DIR}/openbyond-tools)
# ${CMAKE_SOURCE_DIR}/openbyond-server
# ${CMAKE_SOURCE_DIR}/openbyond-client
# ${CMAKE_SOURCE_DIR}/openbyond-ide
add_subdirectory(openbyond-core)
include_directories(openbyond-core/include)
add_subdirectory(openbyond-tools)
add_subdirectory(openbyond-server)
add_subdirectory(openbyond-client)
add_subdirectory(openbyond-ide)
19 changes: 10 additions & 9 deletions openbyond-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
###################################

## Project Setup
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

## WHAT A CREATIVE NAME WOW
set(MODULE_NAME ${PROJECT_NAME}-core)
project(${CMAKE_PROJECT_NAME}-core)

## Versioning shit
set(VERSION_MAJOR 0)
Expand All @@ -15,8 +15,6 @@ set(VERSION_PATCH 1)

set(TARGET_NAME "openbyond-core")

project(${MODULE_NAME})

## Configurations

## Configure the build system
Expand Down Expand Up @@ -53,8 +51,11 @@ configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/grammar
${CMAKE_CURRENT_SOURCE_DIR}/include
${FLEX_INCLUDE_DIR})
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include
${FLEX_INCLUDE_DIR})

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/grammar)

# Set the source files, headers, and link libraries
##################
Expand Down Expand Up @@ -101,14 +102,14 @@ set(DMSCRIPT_INCLUDE
SOURCE_GROUP("src\\script" FILES ${DMSCRIPT_INCLUDE})
SOURCE_GROUP("src\\script" FILES ${DMSCRIPT_SOURCE})

set(OPENBYOND_CORE_INCLUDE_DIR CACHE STRING ${CMAKE_CURRENT_BINARY_DIR}/include)
set(OPENBYOND_CORE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")

set(OPENBYOND_CORE_INCLUDE CACHE STRING
${BASICS_INCLUDE}
${DMSCRIPT_INCLUDE}
)

set(${MODULE_NAME}_LINK_LIBS
set(${PROJECT_NAME}_LINK_LIBS
#${FLEX_LIBRARIES}
)

Expand All @@ -119,4 +120,4 @@ add_library(${TARGET_NAME}
${DMSCRIPT_INCLUDE} ${DMSCRIPT_SOURCE}
)
set(OPENBYOND_CORE_LIBRARY CACHE STRING ${TARGET_NAME})
target_link_libraries(${TARGET_NAME} ${${MODULE_NAME}_LINK_LIBS})
target_link_libraries(${TARGET_NAME} ${${PROJECT_NAME}_LINK_LIBS})
10 changes: 5 additions & 5 deletions openbyond-core/grammar/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ THE SOFTWARE.
%skeleton "lalr1.cc"
%require "2.3"
%defines
%define "parser_class_name" "Parser"
%define "namespace" "DM"
%define api.parser.class {Parser}
%define api.namespace {DM}

%token AS
%token DECREMENT
Expand Down Expand Up @@ -108,7 +108,7 @@ class Atom;
%parse-param {class Driver& driver}
%debug

%error-verbose
%define parse.error verbose

%%
script
Expand Down Expand Up @@ -283,7 +283,7 @@ procdefs

const_expression
: NUMBER
| STRING { $$ = new DMString($1); }
| STRING /* { $$ = new DMString($1); } */
| '(' const_expression ')'
| const_expression '*' const_expression
| const_expression '/' const_expression
Expand Down Expand Up @@ -320,4 +320,4 @@ return
void DM::Parser::error(const Parser::location_type& l, const std::string& m)
{
driver.error(l, m);
}
}
4 changes: 2 additions & 2 deletions openbyond-core/include/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ THE SOFTWARE.
*/
#ifndef HAVE_STRING_UTILS_H
#define HAVE_STRING_UTILS_H
#include "config.h"
#include <config.h>
#include <string>
#include <vector>
std::string string_format(const std::string fmt_str, ...);
Expand All @@ -46,4 +46,4 @@ std::string trim(const std::string& str,
std::string reduce(const std::string& str,
const std::string& fill = " ",
const std::string& whitespace = " \t");
#endif // HAVE_STRING_UTILS_H
#endif // HAVE_STRING_UTILS_H
19 changes: 3 additions & 16 deletions openbyond-core/src/scripting/Preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,7 @@ void Preprocessor::rewindStream(std::iostream &stream, int numchars) {

std::string Preprocessor::ParseFile(std::string filename) {
std::fstream fin(filename, std::fstream::in);
if (fin==NULL)
{
return "";
}
std::fstream fout(filename+".tmp", std::fstream::out);
if (fout==NULL)
{
fin.close();
return "";
}

ParseStream(fin,fout,filename);

Expand Down Expand Up @@ -270,9 +261,7 @@ void Preprocessor::consumeUntil(std::iostream &fin, std::iostream &fout, char en
char c;
while (fin >> std::noskipws >> c) {
if(c==endmarker) return;
if(fout!=NULL) {
fout << c;
}
fout << c;
}
}
void Preprocessor::consumeUntil(std::iostream &fin, std::iostream &fout, std::string endtoken) {
Expand All @@ -286,9 +275,7 @@ void Preprocessor::consumeUntil(std::iostream &fin, std::iostream &fout, std::st
token += c;
lastchar=c;
if(token==endtoken) return;
if(fout!=NULL) {
fout << c;
}
fout << c;
}
}

Expand All @@ -306,4 +293,4 @@ void Preprocessor::consumePPToken(std::iostream &fin, std::iostream &fout) {
consumePreprocessorToken(token,args);

//fout << " (ignore:" << (this->IsIgnoring()?"y":"n") << "). */";
}
}
4 changes: 2 additions & 2 deletions openbyond-core/src/string_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "config.h"
#include <config.h>
#include "string_utils.h"
#include <string>
#include <memory>
Expand Down Expand Up @@ -252,4 +252,4 @@ std::string reduce(const std::string& str,
}

return result;
}
}
11 changes: 4 additions & 7 deletions openbyond-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
###################################

## Project Setup
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

## WHAT A CREATIVE NAME WOW
set(MODULE_NAME ${PROJECT_NAME}-tools)

set(${MODULE_NAME}_LINK_LIBS
${OPENBYOND_CORE_LIBRARY}
)
project(${CMAKE_PROJECT_NAME}-tools)

## Versioning shit
set(VERSION_MAJOR 0)
Expand All @@ -24,6 +20,7 @@ set(VERSION_PATCH 1)

# Add the include folder to the include path
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../openbyond-core/include # I am very sorry
${OPENBYOND_CORE_INCLUDE_DIR}
${TCLAP_INCLUDE_DIR}
)
Expand All @@ -45,4 +42,4 @@ add_executable(${TARGET_NAME}
${OPENBYOND_CORE_INCLUDE}
${PARSER_SOURCE}
)
target_link_libraries(${TARGET_NAME} openbyond-core)
target_link_libraries(${TARGET_NAME} openbyond-core)