diff options
Diffstat (limited to 'curses')
-rw-r--r-- | curses/Makefile | 37 | ||||
-rw-r--r-- | curses/ScintillaCurses.cxx | 2 | ||||
-rw-r--r-- | curses/jinx/Makefile | 18 | ||||
-rw-r--r-- | curses/jinx/jinx.c | 10 |
4 files changed, 44 insertions, 23 deletions
diff --git a/curses/Makefile b/curses/Makefile index 42a8e4e0c..77bfd14dd 100644 --- a/curses/Makefile +++ b/curses/Makefile @@ -3,10 +3,11 @@ .SUFFIXES: .cxx .c .o .h .a AR = ar +CC = gcc CXX = g++ INCLUDEDIRS = -I ../include -I ../src -I ../lexlib -CXXFLAGS = -std=c++11 -pedantic -DCURSES -DSCI_LEXER $(INCLUDEDIRS) -Wall \ - -Wextra -Wno-missing-field-initializers +CFLAGS = -std=c99 -pedantic -Wall +CXXFLAGS = -std=c++11 -pedantic -DCURSES -DSCI_LEXER $(INCLUDEDIRS) -Wall ifdef DEBUG CXXFLAGS += -DDEBUG -g else @@ -15,23 +16,35 @@ endif CURSES_FLAGS = scintilla = ../bin/scintilla.a +sci = AutoComplete.o CallTip.o CaseConvert.o CaseFolder.o Catalogue.o \ + CellBuffer.o CharacterCategory.o CharClassify.o ContractionState.o \ + Decoration.o Document.o EditModel.o Editor.o EditView.o ExternalLexer.o \ + Indicator.o KeyMap.o LineMarker.o MarginView.o PerLine.o PositionCache.o \ + RESearch.o RunStyles.o ScintillaBase.o Selection.o Style.o \ + UniConversion.o ViewStyle.o XPM.o \ + Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerNoExceptions.o \ + LexerSimple.o PropSetSimple.o StyleContext.o WordList.o lexers = $(addsuffix .o,$(basename $(sort $(notdir $(wildcard ../lexers/Lex*.cxx))))) +ifdef LPEG_LEXER + CXXFLAGS += -DLPEG_LEXER -I ../lua/src + LUA_CFLAGS = -I ../lua/src -DLUA_USE_POSIX -DLUA_USE_DLOPEN + lua = lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o linit.o \ + llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o \ + ltable.o ltm.o lundump.o lvm.o lzio.o \ + lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o \ + loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o \ + lpcap.o lpcode.o lpprint.o lptree.o lpvm.o +endif vpath %.h ../src ../include ../lexlib vpath %.cxx ../src ../lexlib ../lexers all: $(scintilla) -.cxx.o: +$(sci) $(lexers) ScintillaCurses.o: %.o: %.cxx $(CXX) $(CXXFLAGS) $(CURSES_FLAGS) -c $< -$(scintilla): AutoComplete.o CallTip.o CaseConvert.o CaseFolder.o Catalogue.o \ - CellBuffer.o CharacterCategory.o CharClassify.o \ - ContractionState.o Decoration.o Document.o EditModel.o Editor.o \ - EditView.o ExternalLexer.o Indicator.o KeyMap.o LineMarker.o \ - MarginView.o PerLine.o PositionCache.o RESearch.o RunStyles.o \ - ScintillaBase.o Selection.o Style.o UniConversion.o ViewStyle.o \ - XPM.o Accessor.o CharacterSet.o LexerBase.o LexerModule.o \ - LexerNoExceptions.o LexerSimple.o PropSetSimple.o StyleContext.o \ - WordList.o $(lexers) ScintillaCurses.o +$(lua): %.o: ../lua/src/%.c + $(CC) $(CFLAGS) $(LUA_CFLAGS) -c $< +$(scintilla): $(sci) $(lexers) $(lua) ScintillaCurses.o $(AR) rc $@ $^ touch $@ clean: diff --git a/curses/ScintillaCurses.cxx b/curses/ScintillaCurses.cxx index 3e78f1cca..8d0c99d47 100644 --- a/curses/ScintillaCurses.cxx +++ b/curses/ScintillaCurses.cxx @@ -80,7 +80,7 @@ Font::~Font() {} * The curses attributes are not constructed from various fields in *fp* since * there is no `underline` parameter. Instead, you need to manually set the * `weight` parameter to be the union of your desired attributes. - * Scintillua (http://foicica.com/scintillua) has an example of this. + * Scintilla's lexers/LexLPeg.cxx has an example of this. */ void Font::Create(const FontParameters &fp) { Release(); diff --git a/curses/jinx/Makefile b/curses/jinx/Makefile index 6811d4f7e..cd34e14cf 100644 --- a/curses/jinx/Makefile +++ b/curses/jinx/Makefile @@ -3,17 +3,15 @@ CC = gcc CXX = g++ INCLUDEDIRS = -I ../../include -I ../../src -I ../../lexlib -I ../ -CFLAGS = -DCURSES -DSCI_LEXER -D_XOPEN_SOURCE_EXTENDED -W -Wall $(INCLUDEDIRS) \ - -Wno-unused-parameter +CFLAGS = -DCURSES -DSCI_LEXER -Wall $(INCLUDEDIRS) CXXFLAGS = $(CFLAGS) +ifdef LPEG_LEXER + CFLAGS += -DLPEG_LEXER -I ../src/lua +endif -scintilla = ../../bin/scintilla_curses.a -lexers = $(wildcard ../Lex*.o) +scintilla = ../../bin/scintilla.a all: jinx -jinx.o: jinx.c - $(CC) $(CFLAGS) -c $< -jinx: jinx.o $(lexers) $(scintilla) - $(CXX) -DCURSES $^ -o $@ -lncursesw -clean: - rm -f jinx *.o +jinx.o: jinx.c ; $(CC) $(CFLAGS) -c $< +jinx: jinx.o $(scintilla) ; $(CXX) $^ -o $@ -lncursesw +clean: ; rm -f jinx *.o diff --git a/curses/jinx/jinx.c b/curses/jinx/jinx.c index 83a955cb4..bea88f67f 100644 --- a/curses/jinx/jinx.c +++ b/curses/jinx/jinx.c @@ -24,6 +24,7 @@ int main(int argc, char **argv) { SSM(SCI_STYLESETFORE, STYLE_DEFAULT, 0xFFFFFF); SSM(SCI_STYLESETBACK, STYLE_DEFAULT, 0); SSM(SCI_STYLECLEARALL, 0, 0); +#if !LPEG_LEXER SSM(SCI_SETLEXER, SCLEX_CPP, 0); SSM(SCI_SETKEYWORDS, 0, (sptr_t)"int char"); SSM(SCI_STYLESETFORE, SCE_C_COMMENT, 0x00FF00); @@ -32,6 +33,15 @@ int main(int argc, char **argv) { SSM(SCI_STYLESETFORE, SCE_C_WORD, 0xFF0000); SSM(SCI_STYLESETFORE, SCE_C_STRING, 0xFF00FF); SSM(SCI_STYLESETBOLD, SCE_C_OPERATOR, 1); +#else + SSM(SCI_SETLEXER, SCLEX_LPEG, 0); + SSM(SCI_SETPROPERTY, (uptr_t)"lexer.lpeg.home", (sptr_t)"../../lexlua"); + SSM(SCI_SETPROPERTY, (uptr_t)"lexer.lpeg.color.theme", (sptr_t)"curses"); + SSM(SCI_PRIVATELEXERCALL, SCI_GETDIRECTFUNCTION, + SSM(SCI_GETDIRECTFUNCTION, 0, 0)); + SSM(SCI_PRIVATELEXERCALL, SCI_SETDOCPOINTER, SSM(SCI_GETDIRECTPOINTER, 0, 0)); + SSM(SCI_PRIVATELEXERCALL, SCI_SETLEXERLANGUAGE, (sptr_t)"ansi_c"); +#endif SSM(SCI_INSERTTEXT, 0, (sptr_t) "int main(int argc, char **argv) {\n" " // Start up the gnome\n" |