VIS

src/hrc/hrcModify.c

Go to the documentation of this file.
00001 
00037 #include "hrcInt.h"
00038 
00039 static char rcsid[] UNUSED = "$Id: hrcModify.c,v 1.4 2005/04/16 04:23:47 fabio Exp $";
00040 
00041 /*---------------------------------------------------------------------------*/
00042 /* Constant declarations                                                     */
00043 /*---------------------------------------------------------------------------*/
00044 
00045 
00046 /*---------------------------------------------------------------------------*/
00047 /* Stucture declarations                                                     */
00048 /*---------------------------------------------------------------------------*/
00049 
00050 
00051 /*---------------------------------------------------------------------------*/
00052 /* Type declarations                                                         */
00053 /*---------------------------------------------------------------------------*/
00054 
00055 
00056 /*---------------------------------------------------------------------------*/
00057 /* Variable declarations                                                     */
00058 /*---------------------------------------------------------------------------*/
00059 
00060 
00061 /*---------------------------------------------------------------------------*/
00062 /* Macro declarations                                                        */
00063 /*---------------------------------------------------------------------------*/
00064 
00065 
00068 /*---------------------------------------------------------------------------*/
00069 /* Static function prototypes                                                */
00070 /*---------------------------------------------------------------------------*/
00071 
00072 
00076 /*---------------------------------------------------------------------------*/
00077 /* Definition of exported functions                                          */
00078 /*---------------------------------------------------------------------------*/
00079 
00080 
00081 
00098 boolean
00099 Hrc_ModelAddSubckt(
00100   Hrc_Model_t *callerModel,
00101   Hrc_Model_t *calleeModel,
00102   char *instanceName,
00103   array_t *actualInputVars,
00104   array_t *actualOutputVars)
00105 {
00106   Hrc_Subckt_t *subckt; 
00107   
00108   if(!st_is_member(callerModel->subcktTable, instanceName)) {
00109     subckt = ALLOC(Hrc_Subckt_t, 1);     
00110     subckt->model = calleeModel;
00111     subckt->instanceName = util_strsav(instanceName);
00112     subckt->actualInputVars = actualInputVars;
00113     subckt->actualOutputVars = actualOutputVars;
00114     st_insert(callerModel->subcktTable, subckt->instanceName, (char *) subckt);
00115     return TRUE;
00116   }
00117   else {
00118     return FALSE;
00119   }
00120 }
00121 
00133 void
00134 Hrc_ModelAddNameTable(
00135   Hrc_Model_t *model,
00136   Tbl_Table_t *table)
00137 {
00138   array_insert_last(Tbl_Table_t *, model->masterNode->nameTables, table);
00139 }
00140 
00156 boolean
00157 Hrc_NodeAddChild(
00158   Hrc_Node_t *parent,
00159   Hrc_Node_t *child,
00160   array_t *actualInputs,
00161   array_t *actualOutputs)
00162 {
00163   if(!st_is_member(parent->childTable, child->instanceName)) {
00164     st_insert(parent->childTable, child->instanceName, (char *) child);
00165     child->parentNode = parent;
00166     child->actualInputs = actualInputs;
00167     child->actualOutputs = actualOutputs;
00168     return TRUE;
00169   }
00170   else {
00171     return FALSE;
00172   }
00173 }
00174 
00187 boolean
00188 Hrc_NodeAddLatch(
00189   Hrc_Node_t *node,
00190   Hrc_Latch_t *latch)
00191 {
00192   char *latchOutputName = Var_VariableReadName(latch->latchOutput);
00193   
00194   if(!st_is_member(node->latchTable, latchOutputName)) {
00195     st_insert(node->latchTable, latchOutputName, (char *) latch);
00196     return TRUE;
00197   }
00198   else {
00199     return FALSE;
00200   }
00201 }
00202 
00215 boolean
00216 Hrc_NodeAddVariable(
00217   Hrc_Node_t *node,
00218   Var_Variable_t *var)
00219 {
00220   char *varName = Var_VariableReadName(var);
00221   
00222   if(!st_is_member(node->varTable, varName)) {
00223     st_insert(node->varTable, varName, (char *) var);
00224     return TRUE;
00225   }
00226   else {
00227     return FALSE;
00228   }
00229 }
00230 
00245 boolean
00246 Hrc_NodeDeleteVariable(
00247   Hrc_Node_t *node,
00248   Var_Variable_t *var)
00249 {
00250   char *varName = Var_VariableReadName(var);
00251   
00252   return st_delete(node->varTable, &varName, &var);
00253 }
00254 
00267 boolean
00268 Hrc_NodeDeleteLatch(
00269   Hrc_Node_t *node,
00270   Hrc_Latch_t *latch)
00271 {
00272   char *latchOutputName = Var_VariableReadName(latch->latchOutput);
00273   
00274   return st_delete(node->latchTable, &latchOutputName, &latch);
00275 }
00276 
00277 /*---------------------------------------------------------------------------*/
00278 /* Definition of internal functions                                          */
00279 /*---------------------------------------------------------------------------*/
00293 Hrc_Node_t *
00294 HrcNodeDeleteChild(
00295   Hrc_Node_t *node,
00296   char *childName)
00297 {
00298   Hrc_Node_t *childNode;
00299   
00300   if(st_delete(node->childTable, &childName, &childNode)) {
00301     return childNode;
00302   }
00303   else {
00304     return NIL(Hrc_Node_t);
00305   }
00306 }
00307 
00308 
00309 /*---------------------------------------------------------------------------*/
00310 /* Definition of static functions                                            */
00311 /*---------------------------------------------------------------------------*/
00312 
00313 
00314 
00315 
00316 
00317 
00318 
00319 
00320 
00321 
00322 
00323 
00324 
00325 
00326 
00327 
00328 
00329 
00330 
00331 
00332 
00333 
00334 
00335 
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343 
00344 
00345 
00346 
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362 
00363 
00364 
00365 
00366 
00367 
00368 
00369 
00370 
00371 
00372 
00373 
00374 
00375 
00376 
00377 
00378 
00379 
00380 
00381 
00382 
00383 
00384 
00385 
00386 
00387 
00388 
00389 
00390 
00391 
00392 
00393 
00394 
00395 
00396 
00397 
00398 
00399