/* NMcmdLZ.c - * * This file contains routines to interpret commands typed inside * netlist windows. * * ********************************************************************* * * Copyright (C) 1985, 1990 Regents of the University of California. * * * Permission to use, copy, modify, and distribute this * * * software and its documentation for any purpose and without * * * fee is hereby granted, provided that the above copyright * * * notice appear in all copies. The University of California * * * makes no representations about the suitability of this * * * software for any purpose. It is provided "as is" without * * * express or implied warranty. Export of this software outside * * * of the United States of America may require an export license. * * ********************************************************************* */ #ifndef lint static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/netmenu/NMcmdLZ.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $"; #endif /* not lint */ #include #include #include "utils/magic.h" #include "utils/geometry.h" #include "tiles/tile.h" #include "utils/hash.h" #include "database/database.h" #include "windows/windows.h" #include "textio/txcommands.h" #include "netmenu/nmInt.h" #include "netmenu/netmenu.h" #include "dbwind/dbwind.h" #include "utils/styles.h" #include "utils/main.h" #include "textio/textio.h" #ifdef ROUTE_MODULE /* * ---------------------------------------------------------------------------- * * NMCmdMeasure -- * * Measure the metal, poly, and contacts on the selected net. If "all" * is specified, then measure for all nets. * * Results: * None. * * Side effects: * Prints the routing statistics. * * ---------------------------------------------------------------------------- */ /* ARGSUSED */ void NMCmdMeasure(w, cmd) MagWindow *w; /* Netlist window. */ TxCommand *cmd; /* Contains the command's argc and argv. */ { FILE * fp, * fopen(); if (cmd->tx_argc > 3) { TxError("Usage: measure [all [filename]]\n"); return; } if (cmd->tx_argc == 1) NMMeasureNet(); else if (NMNetlistName() == (char *) NULL) { TxError("First select a net list!\n"); return; } else if (strcmp(cmd->tx_argv[1], "all") != 0) { TxError("Unknown option \"%s\"\n", cmd->tx_argv[1]); return; } else if (cmd->tx_argc == 2) NMMeasureAll((FILE *) NULL); else { if((fp = fopen(cmd->tx_argv[2], "w"))==NULL) { TxError("Can't open %s\n", cmd->tx_argv[2]); return; } TxPrintf("Log file is %s\n", cmd->tx_argv[2]); NMMeasureAll(fp); (void) fclose(fp); } } #endif /* * ---------------------------------------------------------------------------- * * NMCmdNetlist -- * * Select a particular netlist for working on. * * Usage: * netlist [name] * * (name defaults to the name of the edit cell) * * Results: * None. * * Side effects: * The netlist name.net is read from disk (if it hasn't already * been loaded before) and is made the current netlist. * * ---------------------------------------------------------------------------- */ /* ARGSUSED */ void NMCmdNetlist(w, cmd) MagWindow *w; /* Netlist window. */ TxCommand *cmd; /* Contains the command's argc and argv. */ { if (cmd->tx_argc > 2) { TxError("Usage: netlist [name]\n"); return; } if (cmd->tx_argc < 2) NMNewNetlist(EditCellUse->cu_def->cd_name); else NMNewNetlist(cmd->tx_argv[1]); } /* * ---------------------------------------------------------------------------- * * NMCmdPrint -- * * Prints out the terminals in the current net. * * Usage: * print * * Results: * None. * * Side effects: * Stuff is printed. * * ---------------------------------------------------------------------------- */ /* ARGSUSED */ void NMCmdPrint(w, cmd) MagWindow *w; /* Netlist window. */ TxCommand *cmd; /* Contains the command's argc and argv. */ { extern int nmCmdPrintFunc(); int gotAny; char *name; if (cmd->tx_argc == 1) { if (NMCurNetName == NULL) { TxError("Can't print current net: there's nothing selected!\n"); return; } name = NMCurNetName; } else { name = cmd->tx_argv[1]; if (cmd->tx_argc != 2) { TxError("Usage: print [name]\n"); return; } } gotAny = FALSE; (void) NMEnumTerms(name, nmCmdPrintFunc, (ClientData) &gotAny); if (gotAny == FALSE) TxError("There's nothing in the current net!\n"); } int nmCmdPrintFunc(name, pGotAny) char *name; /* Name of terminal. */ int *pGotAny; /* Pointer to integer, initially FALSE. */ { if (*pGotAny == FALSE) { TxPrintf("Nodes in net:\n"); *pGotAny = TRUE; } TxPrintf(" %s\n", name); return 0; } /* * ---------------------------------------------------------------------------- * * NMCmdPushButton -- * * Perform the default button action for the netlist window. * This allows button actions to be bound to keys or buttons * arbitrarily, rather than being hardwired into the source. * * Usage: * pushbutton button * * Results: * None. * * Side effects: * Invokes the command associated with the button action. * * ---------------------------------------------------------------------------- */ void NMCmdPushButton(w, cmd) MagWindow *w; /* Netlist window. */ TxCommand *cmd; /* Contains the command's argc and argv. */ { int button, action; static char *NMButton[] = {"left", "middle", "right", NULL}; if (cmd->tx_argc != 2) { TxError("Usage: pushbutton