Example #1
0
//ReadSBML ...
func ReadSBML(file string) (doc *Document, err error) {
	cfile := C.CString(file)
	defer C.free(unsafe.Pointer(cfile))
	doc = &Document{}
	doc.d = C.readSBML(cfile)

	errors := int(C.SBMLDocument_getNumErrors(doc.d))

	if errors > 0 {
		fmt.Printf("Encountered the following SBML error(s):\n")
		C.SBMLDocument_printErrors(doc.d, (*C.FILE)(C.stdout))
		fmt.Printf("Conversion skipped.  Please correct the problems above first.\n")
		return nil, err
	}

	return doc, err
}
Example #2
0
//GetNumErrors ...
func (d *Document) GetNumErrors() int {
	return int(C.SBMLDocument_getNumErrors(d.d))
}