| 651 | # Could revert back to using *argFams here now that Python 2.7 support is |
| 652 | # dropped. |
| 653 | def __init__(self, py_Name: Union[ast.AST, str], c_Template: str, |
| 654 | libs: Sequence, retFam: List[str], argFams: List[List[str]], |
| 655 | vecType: int=TYPE_LOOP, aliases: List[str]=[], autotest: bool=True): |
| 656 | # py_Name is either an ast.Node or a string such as 'sqrt' |
| 657 | self.py_Name = py_Name |
| 658 | # c_Template is the actual C-code that will be generated. |
| 659 | self.c_Template = c_Template |
| 660 | |
| 661 | self.vecType = vecType |
| 662 | |
| 663 | self.autotest = autotest |
| 664 | |
| 665 | # libs is a list, valid libraries are LIB_STD and LIB_VML, possibly |
| 666 | # LIB_SIMD later. |
| 667 | if type(libs) == list or type(libs) == tuple: |
| 668 | self.libs = libs |
| 669 | else: |
| 670 | self.libs = [libs] |
| 671 | |
| 672 | # List of valid return character identifiers |
| 673 | self.retFam = retFam |
| 674 | # List of lists of valid argument character identifiers |
| 675 | self.argFams = argFams |
| 676 | |
| 677 | if isinstance(aliases, (str, type)): |
| 678 | aliases = [aliases] |
| 679 | self.aliases = aliases |
| 680 | |
| 681 | self.opNums = [] |
| 682 | self.c_FunctionDeclares = {} |
| 683 | self.py_TupleKeys = {} |
| 684 | self.c_FunctionImpls = {} |
| 685 | self.c_OpTableEntrys = {} |
| 686 | |
| 687 | self.build() |
| 688 | |
| 689 | def build(self) -> None: |
| 690 | global OP_COUNT |