Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sc(1) — Dell System V Release 4 Issue 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bc(1)

dc(1)

crypt(1)



SC(1)                            UNIX System V                            SC(1)


NAME
      sc - spread sheet calculator

SYNOPSIS
      sc [ -x ] [ file ]


DESCRIPTION
      The spread sheet calculator sc is based on rectangular tables much like a
      financial spread sheet.  When it is invoked it presents you with an empty
      table organized as rows and columns of cells.  Each cell may have a label
      string associated with it and an expression.  The expression may be a
      constant or it may compute something based on other entries.

      The single option -x causes the put and get commands to encrypt and
      decrypt the data files.

      When sc is running, the screen is divided into four regions. The top line
      is for entering commands. The second line is for messages from sc.  The
      third line and the first four columns show the row and column numbers.
      The rest of the screen forms a window looking at the table.  The screen
      has two cursors: a cell cursor (indicated by a '<' on the screen) and a
      character cursor (indicated by the terminal's hardware cursor).  The cell
      and character cursors are often the same.  They will differ when a
      command is being typed on the top line.

      Commands which use the terminal's control key such as ^N will work both
      when a command is being typed and when in normal mode.

      The cursor control commands and the row, column commands can be prefixed
      by a numeric argument indicating how many times the command is to be
      executed.  "^U" can be used before the number if the number is to be
      entered while a command is being typed into the command line.

      Cursor control commands:


      ^N    Move the cell cursor to the next row.


      ^P    Move the cell cursor to the previous row.


      ^F    Move the cell cursor forward one column.


      ^B    Move the cell cursor backward one column.


      ^H    Backspace one character.




10/89                                                                    Page 1







SC(1)                            UNIX System V                            SC(1)


      h, j, k, l
            Alternate cursor controls (left, down, up, right).


      Arrow Keys
            The terminal's arrow keys provide another alternate set of cell
            cursor controls if they exist and are supported in the termcap
            entry.  Some terminals have arrow keys which conflict with other
            control key codes.  For example, a terminal could send ^H when the
            back arrow key is depressed.  In these cases, the conflicting arrow
            key performs the same function as the key combination it mimics.


      0     Move the cell cursor to column 0 of the current row.


      $     Move the cell cursor to the last valid column in the current row.


      ^     Move the cell cursor to row 0 of the current column.


      #     Move the cell cursor to the last valid row in the current column.


      g     Go to a cell.  The program will prompt for the name of a cell.
            Enter a cell number such as "a0" or "ae122".


      Cell entry and editing commands:


      =     Prompts for an expression which will be evaluated dynamically to
            produce a value for the cell pointed at by the cell cursor.  This
            may be used in conjunction with ^V to make one entries value be
            dependent on anothers.


      "     Enter a label for the current cell.


      <     Enter a label that will be flushed left against the left edge of
            the cell.


      >     Enter a label that will be flushed right against the right edge of
            the cell.


      x     Clears the current cell.  You may prefix this command with a count
            of the number of cells on the current row to clear.  Cells cleared
            with this command may be recalled with any of the variations of the


Page 2                                                                    10/89







SC(1)                            UNIX System V                            SC(1)


            pull command.


      e     Edit the value associated with the current cell.  This is identical
            to '=' except that the command line starts out containing the old
            value or expression associated with the cell.


      E     Edit the string associated with the current cell.  This is the same
            as either "leftstring", "rightstring", or "label", with the
            additional fact that the command line starts out with the old
            string.


      m     Mark a cell to be used as the source for the copy command.


      c     Copy the last marked cell to the current cell, updating the row and
            column references.


      ^T    Toggle cell display.  The current cell's contents are displayed in
            line one when no command being entered or edited.  ^T turns the
            display on or off.


      File operations


      G     Get a new database from a file.  If the encryption option -x was
            specified, the file is decrypted before it is loaded into the
            spread sheet.


      P     Put the current database into a file.  If the encryption option -x
            was specified, the file is encrypted before it is saved.


      W     Write a listing of the current database in a form that matches its
            appearance on the screen.  This differs from the "put" command in
            that "put"s files are intended to be reloaded with "get", while
            "write" produces a file for people to look at.


      T     Write a listing of the current database to a file, but put ":"s
            between each field.  This  is useful for tables that will be
            further formatted by the tbl preprocessor of nroff.


      M     Merges the database from the named file into the current database.
            Values, expressions and names defined in the named file are written
            into the current file, overwriting the existing entries at those


10/89                                                                    Page 3







SC(1)                            UNIX System V                            SC(1)


            locations.


      The three output operators, put, write and tbl can pipe their output to a
      program.  To use this option, enter "| program" to the prompt asking for
      a file name.  For example, to redirect the output of the write command to
      the printer, you could enter "| lpr -p".


      Row and Column operations.  Members of this class of commands can be used
      on either rows or columns.  The second letter of the command is either a
      column designator (one of the characters c, j, k, ^N, ^p) or a row
      designator (one of r, l, h, ^B, ^F).  Commands which move or copy cells
      also modify the variable references in affected cell expressions.
      Variable references may be frozen by using the "fixed" operator.


      ar, ac
            Creates a new row (column) immediately following the current row
            (column).  It is initialized to be a copy of the current one.


      dr, dc
            Delete this row (column).


      pr, pc, pm
            Pull deleted rows (columns) back into the spread sheet.  The last
            deleted set of cells is put back into the spread sheet at the
            current location.  Pr inserts enough rows to hold the data.  Pc
            inserts enough columns to hold the data.  Pm (merge) does not
            insert rows or columns. It overwrites the cells beginning at the
            current cursor location.


      ir, ic
            Insert a new row (column) by moving the row (column) containing the
            cell cursor, and all following, down (right) one.  The new position
            will be empty.


      zr, zc
            Hide ("zap") the current row (column).  This keeps a row or column
            from being displayed but keeps it in the data base.


      vr, vc
            Removes expressions from the affected rows (columns), leaving only
            the values which were in the cells before the command was executed.





Page 4                                                                    10/89







SC(1)                            UNIX System V                            SC(1)


      sr, sc
            Show hidden rows (columns).  Type in a range of rows or columns to
            be revealed.  The command default is the first range of rows or
            columns currently hidden.


      f     Sets the output format to be used for printing the numbers in each
            cell in the current column.  Type in two numbers which will be the
            width in characters of a column and the number of digits which will
            follow the decimal point.  Note that this command has only a column
            version and does not have a second letter.  A preceeding count can
            be used to specify that more than one column be formatted.


      Range Operations:  Range operations affect a rectangular region on the
      screen. All of the commands in this class start with a slash; the second
      letter of the command indicates which command.  The program will prompt
      for needed parameters.  Phrases surrounded by square brackets in the
      prompt are informational only and may be erased with the backspace key.

      Prompts requesting variable names may be satisfied with either an
      explicit variable name, such as "A10" or with a variable name previously
      defined in a /d command.  Range name prompts require either an explicit
      range such as "A10:B20" or a range name previously defined with a /d
      command.


      /x    Clear a region.  Cells cleared with this command may be recalled
            via any of the pull row or column commands.


      /c    Copy a region to the area starting at the current cell.


      /f    Fill a region with constant values.  The start and increment
            numbers may be positive or negative.


      /d    This command is used to assign a symbolic name to a single cell or
            a rectangular range of cells on the screen.  The parameters are the
            name, surrounded by quotation marks, and either a single cell name
            such as "A10" or a range such as "A10:B20".  Names defined in this
            fashion will be used by the program in future prompts, may be
            entered in response to prompts requesting a cell or range name, and
            will be saved when the spread sheet is saved with a Put command.
            Names defined must be more than two alpha characters long to
            differentiate them from a column names, and must not have embedded
            special characters.  Names may include the character "_" or
            numerals as long as they occur after the first three alpha
            characters.




10/89                                                                    Page 5







SC(1)                            UNIX System V                            SC(1)


      /s    This command will list the defined range names.


      /u    This command is used to undefine a range name.  The range must have
            been previously defined.


      Miscellaneous commands:


      q     Exit from sc.  If you were editing a file, and you modified it,
            then sc will ask about saving before exiting. If you aren't editing
            a file and haven't saved the data you entered, you will get a
            chance to save the data before you exit.


      ^C    Alternate exit command.


      ?     Types a brief helpful message.


      ^G or ESC
            Abort entry of the current command.


      ^R or ^L
            Redraw the screen.


      ^V    Types, in the command line, the name of the cell referenced by the
            cell cursor.  This is used when typing in expressions which refer
            to entries in the table.


      ^E    Types, in the command line, the expression of the cell referenced
            by the cell cursor.


      ^A    Types, in the command line, the value of the cell referenced by the
            cell cursor.


      Expressions that are used with the '=' and 'e' commands have a fairly
      conventional syntax.  Terms may be variable names (from the ^V command),
      parenthesised expressions, negated terms, and constants. Rectangular
      regions of the screen may be operated upon with '@' functions such as sum
      (@sum), average (@avg) and product (@prod).  Terms may be combined using
      many binary operators.  Their precedences (from highest to lowest) are:
      ^; *,/; +,-; <,=,>,<=,>=; &; |; ?.




Page 6                                                                    10/89







SC(1)                            UNIX System V                            SC(1)


      e+e            Addition.


      e-e            Subtraction.


      e*e            Multiplication.


      e/e            Division.


      e^e            Exponentiation.


      @sum(v:v)      Sum all valid (nonblank) entries in the region whose two
                     corners are defined by the two variable (cell) names
                     given.


      @avg(v:v)      Average all valid (nonblank) entries in the region whose
                     two corners are defined by the two variable (cell) names
                     given.


      @prod(v:v)     Multiply together all valid (nonblank) entries in the
                     region whose two corners are defined by the two variable
                     (cell) names given.


      @max(v:v)      Return the maximum value in specified region.


      @min(v:v)      Return the minimum value in the specified region.


      @stddev(v:v)   Return the sample standard deviation of the specified
                     region.


      e?e:e          Conditional: If the first expression is true then the
                     value of the second is returned, otherwise the value of
                     the third is.


      <,=,>,<=,>=    Relationals: true iff the indicated relation holds.


      &,|            Boolean connectives.





10/89                                                                    Page 7







SC(1)                            UNIX System V                            SC(1)


      fixed          To make a variable not change automatically when a cell
                     moves, put the word fixed in front of the reference.  I.e.
                     B1*fixed C3


      Assorted math functions.  Most of these are standard system functions
      more fully described in math(3).  All of them operate on floating point
      numbers (doubles); the trig functions operate with angles in radians.


      @exp(expr)     Returns exponential function of <expr>.


      @ln(expr)      Returns the natural logarithm of <expr>.


      @log(expr)     Returns the base 10 logarithm of <expr>.


      @pow(expr1,expr2)
                     Returns <expr1> raised to the power of <expr2>.


      @floor(expr)   Returns returns the largest integer not greater than
                     <expr>.


      @ceil(expr)    Returns the smallest integer not less than <expr>.


      @rnd(expr)     Rounds <expr> to the nearest integer.


      @hypot(x,y)    Returns SQRT(x*x+y*y), taking precautions against
                     unwarranted overflows.


      @fabs(expr)    Returns the absolute value |expr|.


      @sin(expr), @cos(expr), @tan(expr)
                     Return trigonometric functions of radian arguments. The
                     magnitude of the arguments are not checked to assure
                     meaningful results.


      @asin(expr)    Returns the arc sin in the range -pi/2 to pi/2


      @acos(expr)    Returns the arc cosine in the range 0 to pi.  }i(<|J




Page 8                                                                    10/89







SC(1)                            UNIX System V                            SC(1)


      @atan(expr)    Returns the arc tangent of <expr> in the range -pi/2 to
                     pi/2.


      @dtr(expr)     Converts <expr> in degrees to radians.


      @rtd(expr)     Converts <expr> in radians to degrees.


      pi             A constant quite close to pi.


      @gamma(expr1)  Returns the natural log of the gamma function.


SEE ALSO
      bc(1), dc(1), crypt(1)


BUGS
      Expression reevaluation is done in the same top-to-bottom, left-to-right
      manner as is done in other spread sheet calculators.  This is silly.  A
      proper following of the dependency graph with (perhaps) recourse to
      relaxation should be implemented.

      At most 200 rows and 40 columns.



























10/89                                                                    Page 9





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026