~ubuntu-branches/ubuntu/natty/kdebindings/natty

« back to all changes in this revision

Viewing changes to perl/ktexteditor/src/KTextEditor.xs

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-12-01 11:14:38 UTC
  • mfrom: (1.1.41 upstream)
  • Revision ID: james.westby@ubuntu.com-20101201111438-1q61cvs8zw118t3m
Tags: 4:4.5.80-0ubuntu1
* New upstream release
* Remove build-dep on libqimageblitz-dev, causes smoke to segfault

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          KTextEditor.xs  -  KTextEditor perl extension
 
3
                             -------------------
 
4
    begin                : 11-14-2010
 
5
    copyright            : (C) 2010 by Chris Burel
 
6
    email                : chrisburel@gmail.com
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#include <QHash>
 
19
#include <QList>
 
20
 
 
21
// Perl headers
 
22
extern "C" {
 
23
#include "EXTERN.h"
 
24
#include "perl.h"
 
25
#include "XSUB.h"
 
26
#include "ppport.h"
 
27
}
 
28
 
 
29
#include <smoke/ktexteditor_smoke.h>
 
30
 
 
31
#include <smokeperl.h>
 
32
#include <handlers.h>
 
33
 
 
34
extern QList<Smoke*> smokeList;
 
35
extern SV* sv_this;
 
36
 
 
37
const char*
 
38
resolve_classname_ktexteditor(smokeperl_object * o)
 
39
{
 
40
    return perlqt_modules[o->smoke].binding->className(o->classId);
 
41
}
 
42
 
 
43
extern TypeHandler KTextEditor_handlers[];
 
44
 
 
45
static PerlQt4::Binding bindingktexteditor;
 
46
 
 
47
MODULE = KTextEditor            PACKAGE = KTextEditor::_internal
 
48
 
 
49
PROTOTYPES: DISABLE
 
50
 
 
51
SV*
 
52
getClassList()
 
53
    CODE:
 
54
        AV* classList = newAV();
 
55
        for (int i = 1; i < ktexteditor_Smoke->numClasses; i++) {
 
56
            if (ktexteditor_Smoke->classes[i].className && !ktexteditor_Smoke->classes[i].external)
 
57
                av_push(classList, newSVpv(ktexteditor_Smoke->classes[i].className, 0));
 
58
        }
 
59
        RETVAL = newRV_noinc((SV*)classList);
 
60
    OUTPUT:
 
61
        RETVAL
 
62
 
 
63
SV*
 
64
getEnumList()
 
65
    CODE:
 
66
        AV *av = newAV();
 
67
        for(int i = 1; i < ktexteditor_Smoke->numTypes; i++) {
 
68
            Smoke::Type curType = ktexteditor_Smoke->types[i];
 
69
            if( (curType.flags & Smoke::tf_elem) == Smoke::t_enum )
 
70
                av_push(av, newSVpv(curType.name, 0));
 
71
        }
 
72
        RETVAL = newRV_noinc((SV*)av);
 
73
    OUTPUT:
 
74
        RETVAL
 
75
 
 
76
MODULE = KTextEditor            PACKAGE = KTextEditor
 
77
 
 
78
PROTOTYPES: ENABLE
 
79
 
 
80
BOOT:
 
81
    init_ktexteditor_Smoke();
 
82
    smokeList << ktexteditor_Smoke;
 
83
 
 
84
    bindingktexteditor = PerlQt4::Binding(ktexteditor_Smoke);
 
85
 
 
86
    PerlQt4Module module = { "PerlKTextEditor", resolve_classname_ktexteditor, 0, &bindingktexteditor  };
 
87
    perlqt_modules[ktexteditor_Smoke] = module;
 
88
 
 
89
    install_handlers(KTextEditor_handlers);
 
 
b'\\ No newline at end of file'