aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--c/main.cpp16
-rw-r--r--eb.el27
3 files changed, 41 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 87a055d..9873d7a 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ CLFLAGS = -DUNICODE -D_UNICODE
CLFLAGS += -cc-options,-std=c++17 -O2
CLFLAGS += -Wall -Wextra -Wpedantic -Wno-missing-field-initializers -Wno-parentheses
CLFLAGS += -ld-options,-mwindows,-static-libstdc++ -lcomctl32
-#CLFLAGS += -ld-options,-mconsole
+CLFLAGS += -DDEBUG
all: showdeps b/$(EXE)
cp b/$(EXE) "C:\Users\John\Desktop\Delat"
diff --git a/c/main.cpp b/c/main.cpp
index e51e0f9..60504b2 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -12,6 +12,14 @@
#include "pl.h"
#include "util.h"
+#ifdef DEBUG
+#define XMAIN 30
+#define YMAIN 30
+#else
+#define XMAIN CW_USEDEFAULT
+#define YMAIN CW_USEDEFAULT
+#endif
+
/* main.cpp defines all global (non-template) variables used in the
* program. `extern' is used to access them from other files, when
* need be. */
@@ -96,12 +104,14 @@ static void OnTerminate() noexcept
int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, const int nCmdShow)
{
+ setbuf(stdout, nullptr);
+
/* Exit gracefully on uncaught exception. */
std::set_terminate(OnTerminate);
/* Initialize Prolog. */
- char* argv[] = {const_cast<char*>("EpisodeBrowser"), nullptr};
- if (!PL_initialise(1, argv))
+ const char* argv[] = {"EpisodeBrowser", nullptr};
+ if (!PL_initialise(1, const_cast<char**>(argv)))
throw std::runtime_error("Could not initialize Prolog.");
if (!Pl("track_episodes","attach") || !Pl("episode_data","attach"))
throw std::runtime_error("Could not attach databases.");
@@ -137,7 +147,7 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons
L"Episode Browser",
L"Episode Browser",
WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 0, 0,
+ XMAIN, YMAIN, 0, 0,
nullptr, nullptr, hInstance, nullptr));
g_hWndStatus = Require(CreateWindowEx(
diff --git a/eb.el b/eb.el
new file mode 100644
index 0000000..594c4e3
--- /dev/null
+++ b/eb.el
@@ -0,0 +1,27 @@
+;;; eb --- Episode Browser development functions for Emacs
+
+;;; Commentary:
+
+;;; Code:
+
+(defcustom eb-cwd "b"
+ "Working directory for executable."
+ :group 'eb
+ :type 'directory)
+
+;;;###autoload
+(defun eb-run ()
+ "Launch built executable, displaying its output in a buffer."
+ (interactive)
+ (require 'project)
+ (let ((buf (get-buffer-create "*eb-run*"))
+ (exe (concat (project-root (project-current))
+ "/b/EpisodeBrowser.exe"))
+ (default-directory eb-cwd))
+ (with-current-buffer buf
+ (compilation-mode))
+ (start-process "EpisodeBrowser" buf exe)
+ (display-buffer buf)))
+
+(provide 'eb)
+;;; eb.el ends here