File: Libapi.cpp

package info (click to toggle)
afnix 1.5.2-3.3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,216 kB
  • ctags: 10,587
  • sloc: cpp: 73,617; xml: 28,868; makefile: 3,756; sh: 1,050; lisp: 249
file content (46 lines) | stat: -rw-r--r-- 1,874 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// ---------------------------------------------------------------------------
// - Libapi.cpp                                                              -
// - example:api module - declaration & implementation                       -
// ---------------------------------------------------------------------------
// - This program is free software;  you can redistribute it  and/or  modify -
// - it provided that this copyright notice is kept intact.                  -
// -                                                                         -
// - This program  is  distributed in  the hope  that it will be useful, but -
// - without  any  warranty;  without  even   the   implied    warranty   of -
// - merchantability or fitness for a particular purpose.  In no event shall -
// - the copyright holder be liable for any  direct, indirect, incidental or -
// - special damages arising in any way out of the use of this software.     -
// ---------------------------------------------------------------------------
// - copyright (c) 1999-2007 amaury darsch                                   -
// ---------------------------------------------------------------------------

#include "Libapi.hpp"
#include "Apicalls.hpp"
#include "Function.hpp"

namespace example {
  // use the afnix namespace
  using namespace afnix;

  // initialize the api module

  Object* init_example_api (Interp* interp, Vector* argv) {
    // make sure we are not called from something crazy
    if (interp == nilp) return nilp;

    // create the api nameset
    Nameset* api = interp->mknset ("api");

    // bind the add fucntion
    api->symcst ("add", new Function (api_add));

    // not used but needed
    return nilp;
  }
}

extern "C" {
  afnix::Object* dli_example_api (afnix::Interp* interp, afnix::Vector* argv) {
    return example::init_example_api (interp, argv);
  }
}