Skip to content

Commit

Permalink
Add optional guards
Browse files Browse the repository at this point in the history
This not really necessary right now, but it is a good future-proof measure anyway
  • Loading branch information
tobiolo committed Nov 2, 2024
1 parent d363448 commit 7795fda
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/cell.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef TREESHEETS_CELL_H
#define TREESHEETS_CELL_H

/* The evaluation types for a cell.
CT_DATA: "Data"
Expand Down Expand Up @@ -540,3 +542,5 @@ struct Cell {
return this;
}
};

#endif
5 changes: 5 additions & 0 deletions src/document.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef TREESHEETS_DOCUMENT_H
#define TREESHEETS_DOCUMENT_H

#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION __DATE__
#endif
Expand Down Expand Up @@ -2336,3 +2339,5 @@ struct Document {
Refresh();
}
};

#endif
4 changes: 4 additions & 0 deletions src/evaluator.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef TREESHEETS_EVALUATOR_H
#define TREESHEETS_EVALUATOR_H

/*
A structure describing an operation.
Expand Down Expand Up @@ -210,3 +212,5 @@ struct Evaluator {
ClearVars();
}
};

#endif
4 changes: 4 additions & 0 deletions src/grid.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef TREESHEETS_GRID_H
#define TREESHEETS_GRID_H

struct Grid {
// owning cell.
Expand Down Expand Up @@ -1111,3 +1113,5 @@ struct Grid {

void ClearImages(const Selection &s) { foreachcellinsel(c, s) c->text.image = nullptr; }
};

#endif
5 changes: 3 additions & 2 deletions src/lobster_impl.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef TREESHEETS_LOBSTER_IMPL_H
#define TREESHEETS_LOBSTER_IMPL_H

#include "lobster/stdafx.h"

#include "script_interface.h"

#include "lobster/compiler.h"

using namespace lobster;
Expand Down Expand Up @@ -228,3 +228,4 @@ FileLoader EnginePreInit(NativeRegistry &nfr) {
extern "C" void GLFrame(StackPtr, VM &) {}
string BreakPoint(lobster::VM &vm, string_view reason) { return {}; }

#endif
4 changes: 4 additions & 0 deletions src/myapp.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef TREESHEETS_MYAPP_H
#define TREESHEETS_MYAPP_H

struct IPCServer : wxServer {
wxConnectionBase *OnAcceptConnection(const wxString &topic) {
Expand Down Expand Up @@ -182,3 +184,5 @@ struct MyApp : wxApp {

DECLARE_EVENT_TABLE()
};

#endif
5 changes: 5 additions & 0 deletions src/mycanvas.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef TREESHEETS_MYCANVAS_H
#define TREESHEETS_MYCANVAS_H

struct TSCanvas : public wxScrolledCanvas {
MyFrame *frame;
Document *doc {nullptr};
Expand Down Expand Up @@ -187,3 +190,5 @@ struct TSCanvas : public wxScrolledCanvas {

DECLARE_EVENT_TABLE()
};

#endif
5 changes: 5 additions & 0 deletions src/myframe.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef TREESHEETS_MYFRAME_H
#define TREESHEETS_MYFRAME_H

struct MyFrame : wxFrame {
wxString exepath_;
MyApp *app;
Expand Down Expand Up @@ -1326,3 +1329,5 @@ struct MyFrame : wxFrame {

DECLARE_EVENT_TABLE()
};

#endif
4 changes: 4 additions & 0 deletions src/mywxtools.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef TREESHEETS_MYWXTOOLS_H
#define TREESHEETS_MYWXTOOLS_H

static void DrawRectangle(wxDC &dc, uint c, int x, int y, int xs, int ys, bool outline = false) {
if (outline)
Expand Down Expand Up @@ -252,3 +254,5 @@ static uint64_t CalculateHash(vector<uint8_t> &idv) {
int max = 4096;
return FNV1A64(idv.data(), min(idv.size(), max));
}

#endif
5 changes: 5 additions & 0 deletions src/script_interface.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef TREESHEETS_SCRIPT_INTERFACE_H
#define TREESHEETS_SCRIPT_INTERFACE_H

typedef int64_t (*FileLoader)(string_view_nt absfilename, std::string *dest, int64_t start, int64_t len);

namespace script {
Expand Down Expand Up @@ -45,3 +48,5 @@ extern std::string RunLobster(std::string_view filename, std::string_view code,
extern void TSDumpBuiltinDoc();

} // namespace script

#endif
4 changes: 4 additions & 0 deletions src/selection.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef TREESHEETS_SELECTION_H
#define TREESHEETS_SELECTION_H

class Selection {
bool textedit {false};
Expand Down Expand Up @@ -398,3 +400,5 @@ class Selection {
doc->DrawSelectMove(dc, *this);
}
};

#endif
5 changes: 5 additions & 0 deletions src/system.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef TREESHEETS_SYSTEM_H
#define TREESHEETS_SYSTEM_H

struct Image {
vector<uint8_t> image_data;
char image_type;
Expand Down Expand Up @@ -632,3 +635,5 @@ struct System {

void ImageDraw(wxBitmap *bm, wxDC &dc, int x, int y) { dc.DrawBitmap(*bm, x, y); }
};

#endif
4 changes: 4 additions & 0 deletions src/text.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef TREESHEETS_TEXT_H
#define TREESHEETS_TEXT_H

struct Text {
Cell *cell {nullptr};
Expand Down Expand Up @@ -505,3 +507,5 @@ struct Text {
}
}
};

#endif

0 comments on commit 7795fda

Please sign in to comment.