~ubuntu-branches/ubuntu/raring/geany/raring-proposed

« back to all changes in this revision

Viewing changes to scintilla/src/ExternalLexer.h

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Scintilla source code edit control
 
2
/** @file ExternalLexer.h
 
3
 ** Support external lexers in DLLs.
 
4
 **/
 
5
// Copyright 2001 Simon Steele <ss@pnotepad.org>, portions copyright Neil Hodgson.
 
6
// The License.txt file describes the conditions under which this software may be distributed.
 
7
 
 
8
#ifndef EXTERNALLEXER_H
 
9
#define EXTERNALLEXER_H
 
10
 
 
11
#if PLAT_WIN
 
12
#define EXT_LEXER_DECL __stdcall
 
13
#else
 
14
#define EXT_LEXER_DECL
 
15
#endif
 
16
 
 
17
#ifdef SCI_NAMESPACE
 
18
namespace Scintilla {
 
19
#endif
 
20
 
 
21
typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index);
 
22
typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
 
23
typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
 
24
typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index);
 
25
 
 
26
/// Sub-class of LexerModule to use an external lexer.
 
27
class ExternalLexerModule : public LexerModule {
 
28
protected:
 
29
        GetLexerFactoryFunction fneFactory;
 
30
        char name[100];
 
31
public:
 
32
        ExternalLexerModule(int language_, LexerFunction fnLexer_,
 
33
                const char *languageName_=0, LexerFunction fnFolder_=0) :
 
34
                LexerModule(language_, fnLexer_, 0, fnFolder_),
 
35
                fneFactory(0) {
 
36
                strncpy(name, languageName_, sizeof(name));
 
37
                name[sizeof(name)-1] = '\0';
 
38
                languageName = name;
 
39
        }
 
40
        virtual void SetExternal(GetLexerFactoryFunction fFactory, int index);
 
41
};
 
42
 
 
43
/// LexerMinder points to an ExternalLexerModule - so we don't leak them.
 
44
class LexerMinder {
 
45
public:
 
46
        ExternalLexerModule *self;
 
47
        LexerMinder *next;
 
48
};
 
49
 
 
50
/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders.
 
51
class LexerLibrary {
 
52
        DynamicLibrary  *lib;
 
53
        LexerMinder             *first;
 
54
        LexerMinder             *last;
 
55
 
 
56
public:
 
57
        LexerLibrary(const char *ModuleName);
 
58
        ~LexerLibrary();
 
59
        void Release();
 
60
 
 
61
        LexerLibrary    *next;
 
62
        std::string                     m_sModuleName;
 
63
};
 
64
 
 
65
/// LexerManager manages external lexers, contains LexerLibrarys.
 
66
class LexerManager {
 
67
public:
 
68
        ~LexerManager();
 
69
 
 
70
        static LexerManager *GetInstance();
 
71
        static void DeleteInstance();
 
72
 
 
73
        void Load(const char *path);
 
74
        void Clear();
 
75
 
 
76
private:
 
77
        LexerManager();
 
78
        static LexerManager *theInstance;
 
79
 
 
80
        void LoadLexerLibrary(const char *module);
 
81
        LexerLibrary *first;
 
82
        LexerLibrary *last;
 
83
};
 
84
 
 
85
class LMMinder {
 
86
public:
 
87
        ~LMMinder();
 
88
};
 
89
 
 
90
#ifdef SCI_NAMESPACE
 
91
}
 
92
#endif
 
93
 
 
94
#endif