~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to deprecated/management/profile-editor/src/wxStyledTextCtrl/ExternalLexer.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

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
#define EXT_LEXER_DECL 
 
12
 
 
13
// External Lexer function definitions...
 
14
typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle,
 
15
                  char *words[], WindowID window, char *props);
 
16
typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle,
 
17
                  char *words[], WindowID window, char *props);
 
18
typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index);
 
19
typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
 
20
typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
 
21
 
 
22
//class DynamicLibrary;
 
23
 
 
24
/// Sub-class of LexerModule to use an external lexer.
 
25
class ExternalLexerModule : protected LexerModule {
 
26
protected:
 
27
        ExtLexerFunction fneLexer;
 
28
        ExtFoldFunction fneFolder;
 
29
        int externalLanguage;
 
30
        char name[100];
 
31
public:
 
32
        ExternalLexerModule(int language_, LexerFunction fnLexer_, 
 
33
                const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){
 
34
                strncpy(name, languageName_, sizeof(name));
 
35
                languageName = name;
 
36
        };
 
37
        virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
 
38
                                        WordList *keywordlists[], Accessor &styler) const;
 
39
        virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
 
40
                                        WordList *keywordlists[], Accessor &styler) const;
 
41
        virtual void SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index);
 
42
};
 
43
 
 
44
/// LexerMinder points to an ExternalLexerModule - so we don't leak them.
 
45
class LexerMinder {
 
46
public:
 
47
        ExternalLexerModule *self;
 
48
        LexerMinder *next;
 
49
};
 
50
 
 
51
/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders.
 
52
class LexerLibrary {
 
53
        DynamicLibrary  *lib;
 
54
        LexerMinder             *first;
 
55
        LexerMinder             *last;
 
56
 
 
57
public:
 
58
        LexerLibrary(const char* ModuleName);
 
59
        ~LexerLibrary();
 
60
        void Release();
 
61
        
 
62
        LexerLibrary    *next;
 
63
        SString                 m_sModuleName;
 
64
};
 
65
 
 
66
/// LexerManager manages external lexers, contains LexerLibrarys.
 
67
class LexerManager {
 
68
public:
 
69
        ~LexerManager();
 
70
        
 
71
        static LexerManager *GetInstance();
 
72
        static void DeleteInstance();
 
73
        
 
74
        void Load(const char* path);
 
75
        void Clear();
 
76
 
 
77
private:
 
78
        LexerManager();
 
79
        static LexerManager *theInstance;
 
80
 
 
81
        void LoadLexerLibrary(const char* module);
 
82
        LexerLibrary *first;
 
83
        LexerLibrary *last;
 
84
};
 
85
 
 
86
class LMMinder {
 
87
public:
 
88
        ~LMMinder();
 
89
};
 
90
 
 
91
#endif