SMTStabilizer API
Public API documentation for SMTStabilizer
Loading...
Searching...
No Matches
stabilizer_c_api.h File Reference
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for stabilizer_c_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct stabilizer_options stabilizer_options
 
typedef struct stabilizer_handle stabilizer_handle
 
typedef enum stabilizer_status stabilizer_status
 Result status for C API calls.
 

Enumerations

enum  stabilizer_status { STABILIZER_STATUS_OK = 0 , STABILIZER_STATUS_INVALID_ARGUMENT = 1 , STABILIZER_STATUS_RUNTIME_ERROR = 2 }
 Result status for C API calls. More...
 

Functions

stabilizer_optionsstabilizer_options_create (void)
 Allocate a new options object with default values.
 
void stabilizer_options_destroy (stabilizer_options *options)
 Release an options object created by stabilizer_options_create.
 
void stabilizer_options_set_rewrite (stabilizer_options *options, bool value)
 Enable or disable parser rewrite normalization.
 
bool stabilizer_options_get_rewrite (const stabilizer_options *options)
 Query parser rewrite normalization flag.
 
void stabilizer_options_set_context_propagation (stabilizer_options *options, bool value)
 Enable or disable kernel context propagation.
 
bool stabilizer_options_get_context_propagation (const stabilizer_options *options)
 Query kernel context propagation flag.
 
void stabilizer_options_set_subgraph_pruning (stabilizer_options *options, bool value)
 Enable or disable kernel subgraph pruning/tie-breaking behavior.
 
bool stabilizer_options_get_subgraph_pruning (const stabilizer_options *options)
 Query kernel subgraph pruning/tie-breaking behavior.
 
stabilizer_handlestabilizer_create (const stabilizer_options *options)
 Create a stabilizer instance.
 
void stabilizer_destroy (stabilizer_handle *handle)
 Destroy a stabilizer instance and associated internal state.
 
void stabilizer_set_rewrite (stabilizer_handle *handle, bool value)
 Update rewrite normalization on a live stabilizer.
 
bool stabilizer_get_rewrite (const stabilizer_handle *handle)
 Query rewrite normalization on a live stabilizer.
 
void stabilizer_set_context_propagation (stabilizer_handle *handle, bool value)
 Update context propagation on a live stabilizer.
 
bool stabilizer_get_context_propagation (const stabilizer_handle *handle)
 Query context propagation on a live stabilizer.
 
void stabilizer_set_subgraph_pruning (stabilizer_handle *handle, bool value)
 Update subgraph pruning/tie-breaking behavior on a live stabilizer.
 
bool stabilizer_get_subgraph_pruning (const stabilizer_handle *handle)
 Query subgraph pruning/tie-breaking behavior on a live stabilizer.
 
stabilizer_status stabilizer_apply_file (stabilizer_handle *handle, const char *file_path, char **output)
 Apply stabilization pipeline to an SMT-LIB2 file.
 
stabilizer_status stabilizer_apply_text (stabilizer_handle *handle, const char *smt2_text, char **output)
 Apply stabilization pipeline to SMT-LIB2 text.
 
const char * stabilizer_last_error (const stabilizer_handle *handle)
 Return the last diagnostic message associated with a handle.
 
void stabilizer_free_string (char *value)
 Release strings returned through stabilizer_apply_*.
 

Typedef Documentation

◆ stabilizer_handle

Opaque stabilizer instance used by the C API.

Definition at line 33 of file stabilizer_c_api.h.

◆ stabilizer_options

Opaque public options object used by the C API.

Definition at line 31 of file stabilizer_c_api.h.

◆ stabilizer_status

Result status for C API calls.

Enumeration Type Documentation

◆ stabilizer_status

Result status for C API calls.

Enumerator
STABILIZER_STATUS_OK 

Call succeeded.

STABILIZER_STATUS_INVALID_ARGUMENT 

One or more arguments were null/invalid.

STABILIZER_STATUS_RUNTIME_ERROR 

Internal parsing or stabilization failure occurred.

Definition at line 38 of file stabilizer_c_api.h.

Function Documentation

◆ stabilizer_apply_file()

stabilizer_status stabilizer_apply_file ( stabilizer_handle handle,
const char *  file_path,
char **  output 
)

Apply stabilization pipeline to an SMT-LIB2 file.

Parameters
handleStabilizer handle, must not be null.
file_pathInput file path, must not be null/empty.
outputOutput pointer for heap-allocated UTF-8 result string.

On success, *output receives memory that must be released with stabilizer_free_string(). The handle remains valid after the call.

Returns
STABILIZER_STATUS_OK on success; STABILIZER_STATUS_INVALID_ARGUMENT for null/invalid inputs; STABILIZER_STATUS_RUNTIME_ERROR on parser/kernel failures.

Definition at line 179 of file c_api.cpp.

References stabilizer::api::SMTStabilizer::apply_file(), stabilizer_handle::last_error, stabilizer_handle::stabilizer, and STABILIZER_STATUS_INVALID_ARGUMENT.

◆ stabilizer_apply_text()

stabilizer_status stabilizer_apply_text ( stabilizer_handle handle,
const char *  smt2_text,
char **  output 
)

Apply stabilization pipeline to SMT-LIB2 text.

Parameters
handleStabilizer handle, must not be null.
smt2_textFull SMT-LIB2 script text, must not be null/empty.
outputOutput pointer for heap-allocated UTF-8 result string.

On success, *output receives memory that must be released with stabilizer_free_string(). The handle remains valid after the call.

Returns
STABILIZER_STATUS_OK on success; STABILIZER_STATUS_INVALID_ARGUMENT for null/invalid inputs; STABILIZER_STATUS_RUNTIME_ERROR on parser/kernel failures.

Definition at line 192 of file c_api.cpp.

References stabilizer::api::SMTStabilizer::apply_text(), stabilizer_handle::last_error, stabilizer_handle::stabilizer, and STABILIZER_STATUS_INVALID_ARGUMENT.

◆ stabilizer_create()

stabilizer_handle * stabilizer_create ( const stabilizer_options options)

Create a stabilizer instance.

Parameters
optionsOptional options pointer. When null, defaults are used.
Returns
Non-null handle on success; null on allocation failure.

Definition at line 132 of file c_api.cpp.

◆ stabilizer_destroy()

void stabilizer_destroy ( stabilizer_handle handle)

Destroy a stabilizer instance and associated internal state.

Parameters
handleStabilizer handle, nullable.

Definition at line 136 of file c_api.cpp.

◆ stabilizer_free_string()

void stabilizer_free_string ( char *  value)

Release strings returned through stabilizer_apply_*.

Parameters
valueString buffer previously returned by this API, nullable.

Definition at line 209 of file c_api.cpp.

◆ stabilizer_get_context_propagation()

bool stabilizer_get_context_propagation ( const stabilizer_handle handle)

Query context propagation on a live stabilizer.

Parameters
handleStabilizer handle, must not be null.
Returns
Current flag. Returns false when handle is null.

Definition at line 162 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::get_context_propagation(), stabilizer::api::SMTStabilizer::options(), and stabilizer_handle::stabilizer.

◆ stabilizer_get_rewrite()

bool stabilizer_get_rewrite ( const stabilizer_handle handle)

Query rewrite normalization on a live stabilizer.

Parameters
handleStabilizer handle, must not be null.
Returns
Current rewrite flag. Returns false when handle is null.

Definition at line 149 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::get_rewrite(), stabilizer::api::SMTStabilizer::options(), and stabilizer_handle::stabilizer.

◆ stabilizer_get_subgraph_pruning()

bool stabilizer_get_subgraph_pruning ( const stabilizer_handle handle)

Query subgraph pruning/tie-breaking behavior on a live stabilizer.

Parameters
handleStabilizer handle, must not be null.
Returns
Current flag. Returns false when handle is null.

Definition at line 175 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::get_subgraph_pruning(), stabilizer::api::SMTStabilizer::options(), and stabilizer_handle::stabilizer.

◆ stabilizer_last_error()

const char * stabilizer_last_error ( const stabilizer_handle handle)

Return the last diagnostic message associated with a handle.

Parameters
handleStabilizer handle.
Returns
Null-terminated string owned by the handle; do not free.

Definition at line 205 of file c_api.cpp.

References stabilizer_handle::last_error.

◆ stabilizer_options_create()

stabilizer_options * stabilizer_options_create ( void  )

Allocate a new options object with default values.

Returns
Non-null pointer on success; null on allocation failure.

Definition at line 94 of file c_api.cpp.

◆ stabilizer_options_destroy()

void stabilizer_options_destroy ( stabilizer_options options)

Release an options object created by stabilizer_options_create.

Parameters
optionsOptions handle, nullable.

Definition at line 98 of file c_api.cpp.

◆ stabilizer_options_get_context_propagation()

bool stabilizer_options_get_context_propagation ( const stabilizer_options options)

Query kernel context propagation flag.

Parameters
optionsOptions handle, must not be null.
Returns
Current context propagation flag. Returns false when options is null.

Definition at line 118 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::get_context_propagation(), and stabilizer_options::value.

◆ stabilizer_options_get_rewrite()

bool stabilizer_options_get_rewrite ( const stabilizer_options options)

Query parser rewrite normalization flag.

Parameters
optionsOptions handle, must not be null.
Returns
Current rewrite flag. Returns false when options is null.

Definition at line 108 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::get_rewrite(), and stabilizer_options::value.

◆ stabilizer_options_get_subgraph_pruning()

bool stabilizer_options_get_subgraph_pruning ( const stabilizer_options options)

Query kernel subgraph pruning/tie-breaking behavior.

Parameters
optionsOptions handle, must not be null.
Returns
Current subgraph pruning flag. Returns false when options is null.

Definition at line 128 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::get_subgraph_pruning(), and stabilizer_options::value.

◆ stabilizer_options_set_context_propagation()

void stabilizer_options_set_context_propagation ( stabilizer_options options,
bool  value 
)

Enable or disable kernel context propagation.

Parameters
optionsOptions handle, must not be null.
valueNew context propagation flag.

Definition at line 112 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::set_context_propagation(), and stabilizer_options::value.

◆ stabilizer_options_set_rewrite()

void stabilizer_options_set_rewrite ( stabilizer_options options,
bool  value 
)

Enable or disable parser rewrite normalization.

Parameters
optionsOptions handle, must not be null.
valueNew rewrite flag.

Definition at line 102 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::set_rewrite(), and stabilizer_options::value.

◆ stabilizer_options_set_subgraph_pruning()

void stabilizer_options_set_subgraph_pruning ( stabilizer_options options,
bool  value 
)

Enable or disable kernel subgraph pruning/tie-breaking behavior.

Parameters
optionsOptions handle, must not be null.
valueNew subgraph pruning flag.

Definition at line 122 of file c_api.cpp.

References stabilizer::api::SMTStabilizerOptions::set_subgraph_pruning(), and stabilizer_options::value.

◆ stabilizer_set_context_propagation()

void stabilizer_set_context_propagation ( stabilizer_handle handle,
bool  value 
)

Update context propagation on a live stabilizer.

Parameters
handleStabilizer handle, must not be null.
valueNew context propagation flag.

Definition at line 153 of file c_api.cpp.

◆ stabilizer_set_rewrite()

void stabilizer_set_rewrite ( stabilizer_handle handle,
bool  value 
)

Update rewrite normalization on a live stabilizer.

Parameters
handleStabilizer handle, must not be null.
valueNew rewrite flag.

Definition at line 140 of file c_api.cpp.

◆ stabilizer_set_subgraph_pruning()

void stabilizer_set_subgraph_pruning ( stabilizer_handle handle,
bool  value 
)

Update subgraph pruning/tie-breaking behavior on a live stabilizer.

Parameters
handleStabilizer handle, must not be null.
valueNew subgraph pruning flag.

Definition at line 166 of file c_api.cpp.