Partial move to new generator.
[panamaz] / test-api-object / api-object.api
1 # -*- Mode:text; tab-width:4; electric-indent-mode: nil; indent-line-function:insert-tab; -*-
2
3 # maps functions to objects
4
5 include types.api
6 include code.api
7
8 struct <default> default=all field:rename=studly-caps access=rw {
9 }
10 call <default> default=all call:rename=call access=rw {
11 }
12
13 struct api {
14         enum://;
15         define:API;
16         library:api-static;
17         library:api-calls;
18 }
19
20 struct data {
21         func:print_data instance:0 rename=print;
22 }
23
24 library api-static func:rename=s/^api_//,camel-case {
25         api_create      success:result$=!null scope:result$=global;
26         api_func;
27
28         # different forms of constructor
29         api_new_a       scope:result$=global;
30         api_new_b       scope:result$=global success:rc=0;
31         api_new_c       scope:apip=global success:result$=0 return:apip;
32         api_new_d       scope:apip=global success:api=!null return:apip;
33         api_new_e       scope:apip=global success:rc=0 return:apip;
34 }
35
36 # instance methods using library-level options
37 library api-calls func:rename=s/^api_//,camel-case instance:0 {
38         api_free;
39         api_data        array-size:data=size;
40         api_void        rename=avoid;
41 }
42
43 # grab all defines that come from api.h
44 define API api/api.h {
45         api.h   file-include;
46 }