AIMMS Domain.md 2.94 KB
Newer Older
1 2 3 4 5
AIMMS Domain for Sphinx
=========================

As first introduction to domains, please refer to [Sphinx Domain Docs](http://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html) to document your own AIMMS code.

ArthurH's avatar
ArthurH committed
6
This AIMMS Domain is build up from the [Javascript Domain](https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#the-javascript-domain)
7 8 9 10 11 12 13 14 15 16 17 18 19 20

Basic Usage
============

```
.. aimms:parameter:: spam(eggs)

   Spam or ham the foo.
```

This describes an AIMMS parameter called spam indexed over the eggs index.

The domains also provide roles that link back to these object descriptions. For example, to link to the parameter described in the example above, you could say

ArthurH's avatar
ArthurH committed
21
```
22
The function :aimms:parameter:`spam` does a similar thing.
ArthurH's avatar
ArthurH committed
23
```
24 25 26 27 28 29 30 31

As you can see, both directive and role names contain the domain name and the directive name. 



The AIMMS Domain
===================

ArthurH's avatar
ArthurH committed
32
The AIMMS domain (name ``aimms``) provides the following directives:
33

ArthurH's avatar
ArthurH committed
34
```
35
.. aimms:module:: name
ArthurH's avatar
ArthurH committed
36 37
```

38 39 40 41
This directive sets the module name for object declarations that follow after. The module name is used in the global module index and in cross references. This directive does not create an object heading like py:class would, for example.

By default, this directive will create a linkable entity and will cause an entry in the global module index, unless the noindex option is specified. If this option is specified, the directive will only update the current module name.

ArthurH's avatar
ArthurH committed
42
```
43
.. aimms:function:: name(signature)
ArthurH's avatar
ArthurH committed
44 45
```

46 47 48 49
Describes an AIMMS function. If you want to describe arguments as optional use square brackets as documented for Python signatures.

You can use fields to give more details about arguments and their expected types, errors which may be thrown by the function, and the value being returned:

ArthurH's avatar
ArthurH committed
50
```
51 52 53 54 55 56 57 58 59
.. aimms:function:: MyFunction(href, callback[, errback])

   :attribute string href: An URI to the location of the resource.
   :attribute callback: Gets called with the object.
   :attribute errback:
       Gets called in case the request fails. And a lot of other
       text so we need multiple lines.
   :throws SomeError: For whatever reason in that case.
   :returns: Something.
ArthurH's avatar
ArthurH committed
60
```
61 62 63

List of supported types, following the same rules as ``aimms:function::`` :

ArthurH's avatar
ArthurH committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77

* aimms:function::
* aimms:procedure::
* aimms:externalprocedure::
* aimms:parameter::
* aimms:elementparameter::
* aimms:stringparameter::
* aimms:set::
* aimms:variable::
* aimms:constraint::
* aimms:mathematicalprogram::
* aimms:file::
* aimms:handle::

78 79 80

List of supported types, following the same rules as ``aimms:module::`` :

ArthurH's avatar
ArthurH committed
81 82 83
* aimms:module::
* aimms:librarymodule::

84 85 86

These roles are provided to refer to the described objects:

ArthurH's avatar
ArthurH committed
87 88 89 90 91 92 93 94 95 96 97 98 99
* :aimms:func:
* :aimms:procedure:
* :aimms:librarymodule:
* :aimms:externalprocedure:
* :aimms:parameter:
* :aimms:elementparameter:
* :aimms:stringparameter:
* :aimms:set:
* :aimms:variable:
* :aimms:constraint:
* :aimms:mathematicalprogram:
* :aimms:file:
* :aimms:handle: