---
includes:
    - "isl-noexceptions.h"

pre_setup:
    - "isl_ctx *ctx_ptr = isl_ctx_alloc();"

inputs:
    - name: 'params'
      type: 'unsigned int'
      range: '(0,5]'
    - name: 'dims'
      type: 'unsigned int'
      range: '(0,5]'
    - name: 'constraints'
      type: 'unsigned int'
      range: '[1,3]'
    - name: 'depth_max'
      type: 'unsigned int'
      range: '[10,10]'

types:
    - name: 'isl::val'
    - name: 'isl::pw_aff'
    - name: 'isl::set'
    - name: 'isl::point'

singleton_types:
    - name: 'isl::space'
      singleton: true
    - name: 'isl::local_space'
      singleton: true
    - name: 'isl::ctx'
      singleton: true

funcs:
    - name: 'two_exp'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: []
      conditions: ['<member>.is_int()']
    - name: 'abs'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: []
      conditions: []
    - name: 'ceil'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: []
      conditions: []
    - name: 'floor'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: []
      conditions: []
    - name: 'inv'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: []
      conditions: ['false']
    - name: 'neg'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: []
      conditions: []
    - name: 'trunc'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: []
      conditions: []
    - name: 'add'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: ['isl::val']
      conditions: []
    - name: 'div'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: ['isl::val']
      conditions: ['!<param=1>.is_zero()']
    - name: 'max'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: ['isl::val']
      conditions: []
    - name: 'min'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: ['isl::val']
      conditions: []
    - name: 'mul'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: ['isl::val']
      conditions: []
    - name: 'sub'
      member_type: 'isl::val'
      return_type: 'isl::val'
      param_types: ['isl::val']
      conditions: []
    - name: 'mod'
      member_type: 'isl::pw_aff'
      return_type: 'isl::pw_aff'
      param_types: ['isl::val']
      conditions: ['false']
    - name: 'scale'
      member_type: 'isl::pw_aff'
      return_type: 'isl::pw_aff'
      param_types: ['isl::val']
      conditions: ['false']
    - name: 'add'
      member_type: 'isl::pw_aff'
      return_type: 'isl::pw_aff'
      param_types: ['isl::pw_aff']
      conditions: []
    - name: 'sub'
      member_type: 'isl::pw_aff'
      return_type: 'isl::pw_aff'
      param_types: ['isl::pw_aff']
      conditions: []
    - name: 'max'
      member_type: 'isl::pw_aff'
      return_type: 'isl::pw_aff'
      param_types: ['isl::pw_aff']
      conditions: []
    - name: 'min'
      member_type: 'isl::pw_aff'
      return_type: 'isl::pw_aff'
      param_types: ['isl::pw_aff']
      conditions: []
    - name: 'dump'
      member_type: 'isl::set'
      return_type: ''
      param_types: []
      conditions: []
    - name: 'set_coordinate_val'
      member_type: 'isl::point'
      return_type: 'isl::point'
      param_types: ['<string=isl::dim::set>', '<range=[0,<input=dims>)>', 'isl::val']
      condition: []
    - name: 'set_coordinate_val'
      member_type: 'isl::point'
      return_type: 'isl::point'
      param_types: ['<string=isl::dim::param>', '<range=[0,<input=params>)>', 'isl::val']
      condition: []
    # Start special funcs
    - name: 'universe'
      member_type: 'isl::set'
      return_type: 'isl::set'
      param_types: ['isl::space']
      conditions: []
      special: true
      static: true
    - name: 'empty'
      member_type: 'isl::set'
      return_type: 'isl::set'
      param_types: ['isl::space']
      conditions: []
      special: true
      static: true
    - name: 'var_on_domain'
      member_type: 'isl::pw_aff'
      return_type: 'isl::pw_aff'
      param_types: ['isl::local_space', 'string', 'unsigned int']
      conditions: []
      special: true
      static: true
    - name: 'unite'
      member_type: 'isl::set'
      return_type: 'isl::set'
      param_types: ['isl::set']
      conditions: []
      special: true
    - name: 'convex_hull'
      member_type: 'isl::set'
      return_type: 'isl::set'
      param_types: []
      conditions: []
      special: true

constructors:
    - name: 'isl::space'
      param_types: ['isl::ctx', '<input=params>', '<input=dims>']
    - name: 'isl::local_space'
      param_types: ['isl::space']
    - name: 'isl::val'
      param_types: ['isl::ctx', 'unsigned int']
    - name: 'isl::ctx'
      param_types: ['<string=ctx_ptr>']
    - name: 'isl::point'
      param_types: ['isl::space']
    - name: 'isl::set'
      param_types: ['isl::point']

set_gen:
    - type: 'func'
      func: 'empty'
      return: '<var=s>'
    - type: 'for'
      counter: '[0,<input=constraints>]'
      func: 'unite'
      return: '<var=s>'
      func_params:
          - '<new=isl::set>'
    - type: 'func'
      func: 'convex_hull'
      target: '<var=s>'
    - type: 'func'
      func: 'dump'
      target: '<var=s>'

#    - isl::set < isl::point
#    - [isl::set].union
#    - isl::set.convex_hull
#    - [optional project]
