~kiwec/ke

842396976984e3cbd83251296dd90a46b9d53b3c — Wolf Clément 3 years ago 4e0a657
Downgrade to C++17, avoid stdlib
M Makefile => Makefile +1 -1
@@ 5,7 5,7 @@ TESTS    = $(wildcard test/*.cc)
TOBJ     = $(TESTS:.cc=.o)
TDEP     = $(TOBJ:.o=.d)
CXX      = clang
CXXFLAGS = -std=c++1z
CXXFLAGS = -std=c++17
LDFLAGS  = -ltermbox -lstdc++ -lm
TARGET   = ke
TESTTGT  = ke-tests

M src/Buffer.cc => src/Buffer.cc +0 -1
@@ 1,4 1,3 @@
#include <sstream>
#include <termbox.h>
#include "Buffer.h"
#include "Event.h"

M src/Buffer.h => src/Buffer.h +0 -2
@@ 1,6 1,4 @@
#pragma once
#include <memory>
#include <stack>
#include <string>
#include <termbox.h>
#include "Canvas.h"

M src/Conversion.h => src/Conversion.h +3 -2
@@ 1,8 1,9 @@
#pragma once
#include <cstdlib>
#include <cstring>
#include <stdlib.h>
#include <string.h>
#include <memory>

// TODO remove unique_ptr
namespace Convert {
	std::unique_ptr<char[]> from_wide_string(const wchar_t* wide_string);
	std::unique_ptr<wchar_t[]> to_wide_string(const char* multibyte_string);

M src/Document.cc => src/Document.cc +2 -2
@@ 1,5 1,5 @@
#include <cmath>
#include <cwchar>
#include <math.h>
#include <wchar.h>
#include "Document.h"
#include "Line.h"


M src/Editor.h => src/Editor.h +1 -0
@@ 3,6 3,7 @@
#include "Buffer.h"
#include "StatusBar.h"

// TODO remove shared_ptr
class Editor : public InputHandler {
private:
	std::shared_ptr<Buffer> m_buf;

M src/File.h => src/File.h +0 -1
@@ 1,5 1,4 @@
#pragma once
#include <memory>
#include <string>
#include "Document.h"


M src/Gutter.cc => src/Gutter.cc +1 -1
@@ 1,4 1,4 @@
#include <cmath>
#include <math.h>
#include "Buffer.h"
#include "Line.h"
#include "Gutter.h"

M src/History.h => src/History.h +0 -1
@@ 1,5 1,4 @@
#pragma once
#include <memory>
#include <stack>
#include "Event.h"


M src/Line.cc => src/Line.cc +1 -1
@@ 3,7 3,7 @@
#include "Document.h"
#include "Editor.h"
#include "Gutter.h"
#include <cmath>
#include <math.h>

void Line::calc_size() {
  if(m_doc == nullptr) {

M src/Line.h => src/Line.h +2 -0
@@ 3,6 3,8 @@
#include <memory>
#include "Syntax.h"

// TODO remove unique_ptr

class Buffer;
class Text;
using uint = uint32_t;

M src/Prompt.cc => src/Prompt.cc +0 -1
@@ 1,4 1,3 @@
#include <sstream>
#include <wchar.h>
#include "Editor.h"
#include "Line.h"

M src/Prompt.h => src/Prompt.h +0 -1
@@ 1,6 1,5 @@
#pragma once
#include <functional>
#include <memory>
#include <termbox.h>
#include <wchar.h>
#include "Document.h"

M src/main.cc => src/main.cc +4 -4
@@ 1,5 1,5 @@
#include <iostream>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <termbox.h>
#include <unistd.h>


@@ 17,13 17,13 @@ int main(int argc, const char** argv) {
	auto err = tb_init();
	switch(err) {
		case TB_EUNSUPPORTED_TERMINAL:
		std::cerr << "Termbox: Unsupported terminal." << std::endl;
		fprintf(stderr, "Termbox: Unsupported terminal.\n");
		return 1;
		case TB_EFAILED_TO_OPEN_TTY:
		std::cerr << "Termbox: Failed to open tty." << std::endl;
		fprintf(stderr, "Termbox: Failed to open tty.\n");
		return 1;
		case TB_EPIPE_TRAP_ERROR:
		std::cerr << "Termbox: Pipe trap error." << std::endl;
		fprintf(stderr, "Termbox: Pipe trap error.\n");
		return 1;
	}