/*------------------------------------------------------------------*/ /* circuit.h */ /*------------------------------------------------------------------*/ #ifndef CIRCUIT_INCLUDED #define CIRCUIT_INCLUDED #include "expr.h" enum SymbolType {FLIPFLOP_SYMBOL, INPUT_SYMBOL, UNKNOWN_SYMBOL}; /* These functions are called by the Parser: */ int Circuit_declareInput(char *pcName); /* If pcName was previously declared as a Circuit input name or as a Circuit flip flop name, then return 0 (FALSE). Otherwise, record pcName as a Circuit input name and return 1 (TRUE). It is a checked runtime error for pcName to be NULL. */ int Circuit_declareFlipFlop(char *pcName); /* If pcName was previously declared as a Circuit flip flop name or as a Circuit input, then return 0 (FALSE). Otherwise, record pcName as a Circuit flip flop name, and return 1 (TRUE). It is a checked runtime error for pcName to be NULL. */ enum SymbolType Circuit_getSymbolType(char *pcName); /* Return FLIPFLOP_SYMBOL if pcName is the name of a Circuit flip flop, INPUT_SYMBOL if pcName is the name of a Circuit input, or UNKNOWN_SYMBOL if pcName the name of neither a Circuit flip flop nor a Circuit input. It is a checked runtime error for pcName to be NULL. */ int Circuit_getFlipFlopIndex(char *pcName); /* Return the (zero-based) index of the Circuit flip flop whose name is pcName, or -1 if there is no such Circuit flip flop. It is a checked runtime error for pcName to be NULL. */ int Circuit_getInputIndex(char *pcName); /* Return the (zero-based) index of the Circuit input whose name is pcName, or -1 if there is no such Circuit input. It is a checked runtime error for pcName to be NULL. */ int Circuit_defineFlipFlop(int iIndex, Expr_T oExpr); /* If the Circuit flip flop whose index is iIndex is already defined, then return 0 (FALSE). Otherwise, record oExpr as the definition of the Circuit flip flop whose index is iIndex, and return 1 (TRUE). It is a checked runtime error for iIndex to be negative or for oExpr to be NULL. */ char *Circuit_findUndefinedFlipFlop(void); /* Return the name of the first declared Circuit flip flop that has not been defined, or NULL if there is no undefined Circuit flip flop. */ void Circuit_complete(void); /* The Parser is finished parsing the Circuit description, so do whatever (if any) work is required to complete the Circuit internal form. */ #endif