-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into README-restructured
- Loading branch information
Showing
23 changed files
with
486 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// SPDX-FileCopyrightText: 2023 The Naja authors | ||
// <https://github.com/najaeda/naja/blob/main/AUTHORS> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "PySNLOccurrence.h" | ||
#include "PyInterface.h" | ||
#include "SNLDesignObject.h" | ||
#include "PySNLDesignObject.h" | ||
#include "PySNLPath.h" | ||
#include "SNLDesignObject.h" | ||
#include "SNLPath.h" | ||
#include "SNLOccurrence.h" | ||
|
||
namespace PYSNL { | ||
|
||
using namespace naja::SNL; | ||
|
||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(SNLOccurrence, function) | ||
|
||
static int PySNLOccurrence_Init(PySNLOccurrence* self, PyObject* args, PyObject* kwargs) { | ||
SNLOccurrence* snlOccurrence = nullptr; | ||
PyObject* arg0 = nullptr; | ||
PyObject* arg1 = nullptr; | ||
|
||
//SNLOccurrence has three types of constructors: | ||
if (not PyArg_ParseTuple(args, "|OO:SNLOccurrence", &arg0, &arg1)) { | ||
setError("malformed SNLOccurrence create method"); | ||
return -1; | ||
} | ||
if (arg0 == nullptr) { | ||
snlOccurrence = new SNLOccurrence(); | ||
} else if (arg1 == nullptr) { | ||
if (IsPySNLDesignObject(arg0)) { | ||
snlOccurrence = new SNLOccurrence(PYSNLDesignObject_O(arg0)); | ||
} else { | ||
setError("SNLOccurrence create accepts SNLDesignObject as only argument"); | ||
return -1; | ||
} | ||
} else if (IsPySNLPath(arg0) and IsPySNLDesignObject(arg1)) { | ||
snlOccurrence = new SNLOccurrence(*PYSNLPath_O(arg0), PYSNLDesignObject_O(arg1)); | ||
} else { | ||
setError("invalid number of parameters for Occurrence constructor."); | ||
return -1; | ||
} | ||
self->object_ = snlOccurrence; | ||
return 0; | ||
} | ||
|
||
//LCOV_EXCL_START | ||
ManagedTypeLinkCreateMethod(SNLOccurrence) | ||
//LCOV_EXCL_STOP | ||
ManagedTypeDeallocMethod(SNLOccurrence) | ||
|
||
PyMethodDef PySNLOccurrence_Methods[] = { | ||
{NULL, NULL, 0, NULL} /* sentinel */ | ||
}; | ||
|
||
PyTypeManagedSNLObjectWithoutSNLIDLinkPyType(SNLOccurrence) | ||
PyTypeObjectDefinitions(SNLOccurrence) | ||
|
||
} // namespace PYSNL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-FileCopyrightText: 2024 The Naja authors <https://github.com/najaeda/naja/blob/main/AUTHORS> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef __PY_SNL_OCCURRENCE_H_ | ||
#define __PY_SNL_OCCURRENCE_H_ | ||
|
||
#include <Python.h> | ||
|
||
namespace naja::SNL { | ||
class SNLOccurrence; | ||
} | ||
|
||
namespace PYSNL { | ||
|
||
typedef struct { | ||
PyObject_HEAD | ||
naja::SNL::SNLOccurrence* object_; | ||
} PySNLOccurrence; | ||
|
||
extern PyTypeObject PyTypeSNLOccurrence; | ||
|
||
extern PyObject* PySNLOccurrence_Link(naja::SNL::SNLOccurrence* occurrence); | ||
extern void PySNLOccurrence_LinkPyType(); | ||
|
||
#define IsPySNLOccurrence(v) (PyObject_TypeCheck(v, &PyTypeSNLOccurrence)) | ||
#define PYSNLOccurrence(v) ((PySNLOccurrence*)(v)) | ||
#define PYSNLOccurrence_O(v) (PYSNLOccurrence(v)->object_) | ||
|
||
} // PYSNL namespace | ||
|
||
#endif // __PY_SNL_INSTANCE_H_ |
Oops, something went wrong.