python-module/cpplmodule.cc
/**
 * Compress an uncompressed cppl policy and write the result to a file.
 */
Compress an uncompressed cppl policy and write the result to a file.
Compress an uncompressed cppl policy and write the result to a file .
static PyObject *cpplmodule_compress_policy_to_file(PyObject *self, PyObject *args)
{
  PyObject *retval;
  long long ret, pd_key;
  bool ret_bool;
  char *policy, *outputFile;
  PolicyDefinition *pd;
  if (!PyArg_ParseTuple(args, "sLs", &policy, &pd_key, &outputFile)) {
    return NULL;
  }
  bool traceParsingEnabled = false;
  bool traceScanningEnabled = false;
  pd = pd_list.at(pd_key);
  try {
    ret_bool = cppl_compress_policy_to_file(policy, *pd, outputFile, traceParsingEnabled, traceScanningEnabled);
  }
  catch (std::runtime_error e) {
    return PyErr_Format(CpplError, "%s", e.what());
  }
  if( ret_bool ) {
    ret = 1;
  } else {
    ret = 0;
  }
  retval = Py_BuildValue("i", ret);
  return retval;
}
static PyObject * cpplmodule_compress_policy_to_file ( PyObject * self , PyObject * args ) { PyObject * retval ; long long ret , pd_key ; bool ret_bool ; char * policy , * outputFile ; PolicyDefinition * pd ; if ( ! PyArg_ParseTuple ( args , " " , & policy , & pd_key , & outputFile ) ) { return NULL ; } bool traceParsingEnabled = false ; bool traceScanningEnabled = false ; pd = pd_list . at ( pd_key ) ; try { ret_bool = cppl_compress_policy_to_file ( policy , * pd , outputFile , traceParsingEnabled , traceScanningEnabled ) ; } catch ( std :: runtime_error e ) { return PyErr_Format ( CpplError , " " , e . what ( ) ) ; } if ( ret_bool ) { ret = 1 ; } else { ret = 0 ; } retval = Py_BuildValue ( " " , ret ) ; return retval ; }
Compress an uncompressed cppl policy and write the result to a file.
Compress an uncompressed cppl policy and write the result to a file .