RTimothyEdwards / magic

Magic VLSI Layout Tool
Other
447 stars 100 forks source link

select more cell <instance> does not work. #295

Open d-m-bailey opened 3 months ago

d-m-bailey commented 3 months ago

magic version 8.3.465

Opening a hierarchical layout and executing cellname childinst will give a list of use instance names.

select cell <instance_name> will select one cell, but select more cell <instance_name> gives the following error

Couldn't find a cell use named "at"

This is caused by the argument count being decremented (for example, after processing more or less), but not accounted for when adding a coordinate value. For example, in commands/CmdRS.c tx_argc is decremented here

        if (!strncmp(cmd->tx_argv[1], "more", arg1len))
        {
            more = TRUE;
            less = FALSE;
            optionArgs = &cmd->tx_argv[2];
            cmd->tx_argc--;
        }

but when coordinates added to original command array, since tx_argc hasa been decremented, the last value will be overwritten with at.

            {
                char *aptr;
                int i;

                window = CmdGetRootPoint((Point *) NULL, &scx.scx_area);

                /* Recast command with "at x y" at the end for logging */
                for (i = 0; i < cmd->tx_argc; i++)
                {
                    aptr = cmd->tx_argv[i] + strlen(cmd->tx_argv[i]);
                    *aptr = ' ';
                }
                sprintf(aptr + 1, "at %di %di", scx.scx_area.r_xbot,
                                scx.scx_area.r_ybot);
                TxRebuildCommand(cmd);

            }

Pull request will be posted shortly.