home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 018.lha / docs / manbody < prev    next >
Text File  |  1986-10-19  |  28KB  |  1,350 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                  AAAA LLLLiiiittttttttlllleeee SSSSmmmmaaaallllllllttttaaaallllkkkk UUUUsssseeeerrrr MMMMaaaannnnuuuuaaaallll
  11.  
  12.  
  13.                         Timothy A. Budd
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.   _1.  _I_n_t_r_o_d_u_c_t_i_o_n
  21.  
  22.        This manual is intended as an aid in using  the  Little
  23.   Smalltalk  system.   It  is  not  intended  to be used as an
  24.   introduction to the Smalltalk language.  Little Smalltalk is
  25.   largely (with exceptions listed in a later section) a subset
  26.   of  the  Smalltalk-80*  language  described  in  [.Smalltalk
  27.   blue.].   A  complete description of the classes included in
  28.   the Little Smalltalk system and the messages they accept  is
  29.   given in Appendix 1.
  30.  
  31.   _2.  _R_u_n_n_i_n_g _t_h_e _s_y_s_t_e_m
  32.  
  33.        The Little Smalltalk system is invoked  by  typing  the
  34.   command  sssstttt.   The system is interactive - that is, the user
  35.   types an expression at the keyboard and the system  responds
  36.   by  evaluating  the  expression  and typing the result.  For
  37.   example, typing the expression 3333 ++++ 4444 results in the value  7777
  38.   being  displayed  on the output.  Execution is terminated by
  39.   typing control-D.  A sample execution session  is  shown  in
  40.   Figure 1.
  41.  
  42.  
  43.                         % st
  44.                         Little Smalltalk
  45.                                 3 + 4
  46.                         7
  47.                                 ^D
  48.                         %
  49.  
  50.  
  51.           FFFFiiiigggguuuurrrreeee 1111:::: A Sample Little Smalltalk Session
  52.  
  53.  
  54.        Instance variables for the command level can be created
  55.   by  assigning  a  value  to a new variable name.  Thereafter
  56.   that variable can be used at the command level, although  it
  57.   is  not  known within the scope of any method.  The variable
  58.   _________________________
  59.   * Smalltalk-80 is a trademark of the Xerox Corporation.
  60.  
  61.  
  62.  
  63.  
  64.                        September 19, 1986
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                              - 2 -
  71.  
  72.  
  73.   ``last'' always contains the  value  returned  by  the  last
  74.   expression  typed.   Figure  2 shows the creation of a vari-
  75.   able.  Note that the assignment arrow is  formed  as  a  two
  76.   character sequence.
  77.  
  78.  
  79.                     newvar <- 2 / 3
  80.                     newvar
  81.                0.666667
  82.                     2 raisedTo: newvar + (4 / 3)
  83.                4
  84.                     last
  85.                4
  86.  
  87.  
  88.                   FFFFiiiigggguuuurrrreeee 2222:::: Creating Variables
  89.  
  90.  
  91.        The default behavior is for the value  of  expressions,
  92.   with the exception of assignments, to be typed automatically
  93.   as they are evaluated.  This behavior can be modified either
  94.   by  using the -d flag (see Appendix 2), or by passing a mes-
  95.   sage to the pseudo variable ssssmmmmaaaallllllllttttaaaallllkkkk (see Appendix 1).
  96.  
  97.        Class descriptions must be read  in  from  files,  they
  98.   cannot  be  entered  interactively.   Class descriptions are
  99.   entered using a system directive.  For example, to include a
  100.   class description contained in a file named nnnneeeewwwwccccllllaaaassssssss....sssstttt, the
  101.   following system directive should be issued:
  102.  
  103.                          )i newclass.st
  104.  
  105.   A list of files containing class descriptions  can  also  be
  106.   given as arguments to the st command.  The command
  107.  
  108.                       %st file1 ... filen
  109.   is equivalent to the sequence
  110.  
  111.                         %st
  112.                         Little Smalltalk
  113.                              )i file1
  114.                              ...
  115.                              )i filen
  116.  
  117.        A table of system directives is given in Figure 3.
  118.  
  119.        Note that the )e system directive invokes an editor  on
  120.   a file containing class descriptions, and then automatically
  121.   includes the file when the editor is  exited.  Classes  also
  122.   respond to the message eeeeddddiiiitttt, which will have the same effect
  123.   as the )e directive applied to the file containing the class
  124.   description.    Thus   the  typical  debug/edit/debug  cycle
  125.  
  126.  
  127.  
  128.                        September 19, 1986
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                              - 3 -
  135.  
  136.  
  137.  
  138.  
  139.   _____________________________________________________________
  140.  
  141.    )e filename
  142.                  Edit the named file.   The  Little  Smalltalk
  143.                  system  will  suspend, leaving the user in an
  144.                  editor for making changes to the named  file.
  145.                  Upon  leaving  the editor the named file will
  146.                  automatically  be  included,  as  if  the  )i
  147.                  directive had been typed.
  148.  
  149.    )g filename
  150.                  Search for an entry  in  the  system  library
  151.                  area  matching  the  filename.  If found, the
  152.                  class descriptions in the library  entry  are
  153.                  included.    This   command   is  useful  for
  154.                  including commonly used classes that are  not
  155.                  part of the standard prelude, such as classes
  156.                  for statistics applications or graphics.
  157.  
  158.    )i filename
  159.                  Include  the  named  file.   The  file   must
  160.                  contain  one or more class descriptions.  The
  161.                  class  descriptions  are   parsed,   and   if
  162.                  syntactically  legal  new  instances of class
  163.                  CCCCllllaaaassssssss are added to the Smalltalk system.
  164.  
  165.    )l filename
  166.                  Load a previously saved environment from  the
  167.                  named   file.   The  current  values  of  all
  168.                  variables are overridden.  The file must have
  169.                  been created using the )s directive (below).
  170.  
  171.    )r filename
  172.                  Read the named file.  The file  must  contain
  173.                  Smalltalk  statements,  as  would be typed at
  174.                  the keyboard.  The effect is just as  if  the
  175.                  lines  of  the  file  had  been  typed at the
  176.                  keyboard.   The  file  cannot  contain  class
  177.                  descriptions.
  178.  
  179.    )s filename
  180.                  Save the current state  in  the  named  file.
  181.                  The  values  of  all variables are saved, and
  182.                  can later be reloaded using the )l  directive
  183.                  (above).
  184.  
  185.    )!string
  186.                  Execute the remainder of the  line  following
  187.                  the  exclamation  point  as  a Unix* command.
  188.                  Nothing  is  done  with  the  output  of  the
  189.                  command,  nor  is the returning status of the
  190.                  command recorded.
  191.  
  192.   _____________________________________________________________
  193.   ||||||||||||||||||||||||||||||||||||||||||||||
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.                                                                ||||||||||||||||||||||||||||||||||||||||||||||
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.                   FFFFiiiigggguuuurrrreeee 3333:::: System Directives
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.                        September 19, 1986
  292.  
  293.  
  294.  
  295.  
  296.  
  297.                              - 4 -
  298.  
  299.  
  300.   involves repeated uses of the )e directive or the eeeeddddiiiitttt  mes-
  301.   sage  until  a  desired  outcome  is  achieved.   The editor
  302.   invoked by the )e directive can be changed  by  setting  the
  303.   EDITOR variable in the users environment.
  304.  
  305.   _3.  _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _L_i_t_t_l_e _S_m_a_l_l_t_a_l_k _a_n_d _t_h_e  _S_m_a_l_l_t_a_l_k-
  306.   _8_0 _s_y_s_t_e_m
  307.  
  308.        This section  describes  the  differences  between  the
  309.   language  accepted  by  the  Little Smalltalk system and the
  310.   language described in  [.Smalltalk  blue.].   The  principal
  311.   reasons for these changes are as follows:
  312.  
  313.   size  Classes which are largely unnecessary, or which  could
  314.         be  easily  simulated  by other classes (e.g. Associa-
  315.         tion, SortedCollection) have been  eliminated  in  the
  316.         interest  of  keeping the size of the standard library
  317.         as small as  possible.   Similarly,  indexed  instance
  318.         variables  are  not  supported,  since  to do so would
  319.         increase the size of every object in the  system,  and
  320.         they can be easily simulated in those classes in which
  321.         they are important (see below).
  322.  
  323.   portability
  324.         Classes which depend upon  particular  hardware  (e.g.
  325.         BitBlt)  are  not  included  as  part  of  the  Little
  326.         Smalltalk system.  The basic  system  assumes  nothing
  327.         more than ascii terminals.
  328.  
  329.   representation
  330.         The  need  for  a  textual  representation  for  class
  331.         descriptions required some small additions to the syn-
  332.         tax for class methods (see  Appendix  3).   Similarly,
  333.         the fact that classes and subclasses can be separately
  334.         parsed, in either order, forced some  changes  in  the
  335.         scoping rules for instance variables.
  336.  
  337.        The following sections describe these changes  in  more
  338.   detail.
  339.  
  340.   _3._1.  _N_o _B_r_o_w_s_e_r
  341.  
  342.        The Smalltalk-80 Programming Environment  described  in
  343.   [.Smalltalk  orange.]  is not included as part of the Little
  344.   Smalltalk system.  The Little Smalltalk system  is  designed
  345.   to  be  little, easily portable, and to rely on nothing more
  346.   than basic terminal capabilities.
  347.  
  348.   _3._2.  _I_n_t_e_r_n_a_l _R_e_p_r_e_s_e_n_t_a_t_i_o_n _D_i_f_f_e_r_e_n_t
  349.  
  350.        The  internal  representations  of  objects,  including
  351.   processes,  interpreters,  and  bytecodes,  is entirely dif-
  352.   ferent in the Little Smalltalk system from the  Smalltalk-80
  353.   system described in [.Smalltalk blue.].
  354.   _________________________
  355.   * Unix is a trademark of Bell Laboratories.
  356.  
  357.                        September 19, 1986
  358.  
  359.  
  360.  
  361.  
  362.  
  363.                              - 5 -
  364.  
  365.  
  366.   _3._3.  _F_e_w_e_r _C_l_a_s_s_e_s
  367.  
  368.        Many of the classes described in [.Smalltalk blue.] are
  369.   not  included  as part of the Little Smalltalk basic system.
  370.   Some of these are not necessary because of the decision  not
  371.   to  include  the  editor,  browser, and so on as part of the
  372.   basic system.  Others are omitted in the interest of keeping
  373.   the  standard  library of classes small.  A complete list of
  374.   included classes for the Little Smalltalk system is given in
  375.   Appendix 1.
  376.  
  377.   _3._4.  _N_o _C_l_a_s_s _P_r_o_t_o_c_o_l
  378.  
  379.        Protocol for all classes is defined as  part  of  class
  380.   CCCCllllaaaassssssss.   It  is  not  possible to redefine class protocol as
  381.   part of a class description, only  instance  protocol.   The
  382.   notion of metaclasses is not supported.
  383.  
  384.   _3._5.  _C_a_s_c_a_d_e_s _D_i_f_f_e_r_e_n_t
  385.  
  386.        The semantics of cascades has been simplified and  gen-
  387.   eralized.  The result of a cascaded expression is always the
  388.   result of the expression to the left of the first semicolon,
  389.   which is also the receiver for each subsequent continuation.
  390.   Continuations can include multiple messages.  A rather  non-
  391.   sensical, but illustrative, example is the following:
  392.  
  393.                      2 + 3 ; - 7 + 3 ; * 4
  394.  
  395.  
  396.   The result of this expression is 5 (the value yielded by 2 +
  397.   3).   5  is  also the receiver for the message - 7, and that
  398.   result (-2) is in turn the receiver for  the  message  +  3.
  399.   This  last  result  is thrown away.  5 is then again used as
  400.   the receiver for the message * 4, the  result  of  which  is
  401.   also thrown away.
  402.  
  403.   _3._6.  _I_n_s_t_a_n_c_e _V_a_r_i_a_b_l_e _N_a_m_e _S_c_o_p_e
  404.  
  405.        In the language described  in  [.Smalltalk  blue.],  an
  406.   instance variable is known not only to the class protocol in
  407.   which it is declared, but is also valid in  methods  defined
  408.   for  any  subclasses of that class.  In the Little Smalltalk
  409.   system an instance variable can be  referenced  only  within
  410.   the protocol for the class in which it is declared.
  411.  
  412.   _3._7.  _I_n_d_e_x_e_d _I_n_s_t_a_n_c_e _V_a_r_i_a_b_l_e_s
  413.  
  414.        Implicitly defined indexed instance variables  are  not
  415.   supported.   In  any  class for which these are desired they
  416.   can be easily simulated by including an additional  instance
  417.   variable,  containing  an Array, and including the following
  418.   methods:
  419.  
  420.  
  421.  
  422.  
  423.                        September 19, 1986
  424.  
  425.  
  426.  
  427.  
  428.  
  429.                              - 6 -
  430.  
  431.  
  432.  
  433.            Class Whatever
  434.            | indexVars |
  435.            [
  436.                new: size
  437.                    indexVars <- Array new: size
  438.  
  439.            |   at: location
  440.                    |^ indexVars at: location
  441.  
  442.            |   at: location put: value
  443.                    indexVars at: location put: value
  444.  
  445.                ...
  446.  
  447.  
  448.  
  449.        The message new: can be used with any  class,  with  an
  450.   effect  similar  to  new.  That is, if a new instance of the
  451.   class is created by sending the message new:  to  the  class
  452.   variable,  the  message  is immediately passed on to the new
  453.   instance, and the result returned is used as the  result  of
  454.   the creation message.
  455.  
  456.   _3._8.  _N_o _P_o_o_l _V_a_r_i_a_b_l_e_s
  457.  
  458.        The concepts of pool variables,  global  variables,  or
  459.   class  variables are not supported.  In their place there is
  460.   a new pseudo-variable, ssssmmmmaaaallllllllttttaaaallllkkkk, which responds to the mes-
  461.   sages  aaaatttt:::: and aaaatttt::::ppppuuuutttt::::.  The keys for this collection can be
  462.   arbitrary.  Although this facility is available, its use  is
  463.   often a sign of poor program design, and should be avoided.
  464.  
  465.   _3._9.  _N_o _A_s_s_o_c_i_a_t_i_o_n_s
  466.  
  467.        The class Dictionary stores keys and values separately,
  468.   rather than as instances of Association.  The class Associa-
  469.   tion, and all messages referring to Associations  have  been
  470.   removed.
  471.  
  472.   _3._1_0.  _G_e_n_e_r_a_t_o_r_s _i_n _p_l_a_c_e _o_f _S_t_r_e_a_m_s
  473.  
  474.        The notion of stream has been replaced by the  slightly
  475.   different notion of _g_e_n_e_r_a_t_o_r_s, in particular the use of the
  476.   messages _f_i_r_s_t and _n_e_x_t in subclasses of CCCCoooolllllllleeeeccccttttiiiioooonnnn.  Exter-
  477.   nal files are supported by an explicit class FFFFiiiilllleeee.
  478.  
  479.   _3._1_1.  _P_r_i_m_i_t_i_v_e_s _D_i_f_f_e_r_e_n_t
  480.  
  481.        Both the syntax and the  use  of  primitives  has  been
  482.   changed.    Primitives  provide  an  interface  between  the
  483.   Smalltalk world and the underlying  system,  permitting  the
  484.   execution   of   operations  that  cannot  be  specified  in
  485.   Smalltalk.  In Little Smalltalk, primitives cannot fail  and
  486.  
  487.  
  488.  
  489.                        September 19, 1986
  490.  
  491.  
  492.  
  493.  
  494.  
  495.                              - 7 -
  496.  
  497.  
  498.   must return a value (although they may, in error situations,
  499.   print an error message and  return  nnnniiiillll).   The  syntax  for
  500.   primitives  has  been altered to permit the specification of
  501.   primitives with an arbitrary number of arguments.  The  for-
  502.   mat for a primitive call is as follows:
  503.  
  504.                 <primitive nnnnuuuummmmbbbbeeeerrrr _a_r_g_u_m_e_n_t_l_i_s_t >
  505.  
  506.   Where nnnnuuuummmmbbbbeeeerrrr is the number of the primitive to  be  executed
  507.   (which  must be a value between 1 and 255), and _a_r_g_u_m_e_n_t_l_i_s_t
  508.   is a list of Smalltalk primary expressions (see Appendix 2).
  509.   Appendix  4  lists  the  meanings  of  each of the currently
  510.   recognized primitive numbers.
  511.  
  512.   _3._1_2.  _B_y_t_e _A_r_r_a_y_s
  513.  
  514.        A new syntax has been created  for  defining  an  array
  515.   composed  entirely  of unsigned integers in the range 0-255.
  516.   These arrays are given a very tight encoding.  The syntax is
  517.   a pound sign, followed by a left square brace, followed by a
  518.   sequence of numbers in the range 0 to  255,  followed  by  a
  519.   right square brace.
  520.  
  521.                           #[ _n_u_m_b_e_r_s ]
  522.  
  523.  
  524.   Byte Arrays are used extensively internally.
  525.  
  526.   _3._1_3.  _N_e_w _P_s_e_u_d_o _V_a_r_i_a_b_l_e_s
  527.  
  528.        In addition to the pseudo  variable  ssssmmmmaaaallllllllttttaaaallllkkkk  already
  529.   mentioned,  another  pseudo  variable, sssseeeellllffffPPPPrrrroooocccceeeessssssss, has beed
  530.   added to the Little Smalltalk system.   sssseeeellllffffPPPPrrrroooocccceeeessssssss  returns
  531.   the currently executing process, which can then be passed as
  532.   an argument to a semaphore, or be used as a receiver  for  a
  533.   message  valid  for  class  PPPPrrrroooocccceeeessssssss.   Like  sssseeeellllffff and ssssuuuuppppeeeerrrr,
  534.   sssseeeellllffffPPPPrrrroooocccceeeessssssss cannot be used at the command level.
  535.  
  536.   _3._1_4.  _N_o _D_e_p_e_n_d_e_n_c_y
  537.  
  538.        The notion  of  dependency,  and  automatic  dependency
  539.   updating, is not included in Little Smalltalk.
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.                        September 19, 1986
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.                            _A_p_p_e_n_d_i_x _1
  565.                        _C_l_a_s_s _D_e_s_c_r_i_p_t_i_o_n_s
  566.  
  567.        The messages accepted by the classes  included  in  the
  568.   Little  Smalltalk standard library are described in the fol-
  569.   lowing pages. A list of the classes defined, where  indenta-
  570.   tion is used to imply subclassing, is given below:
  571.  
  572.           Object
  573.              UndefinedObject
  574.              Symbol
  575.              Boolean
  576.                 True
  577.                 False
  578.              Magnitude
  579.                 Char
  580.                 Number
  581.                    Integer
  582.                    Float
  583.                 Radian
  584.                 Point
  585.              Random
  586.              Collection
  587.                 Bag
  588.                 Set
  589.                 KeyedCollection
  590.                    Dictionary
  591.                       Smalltalk
  592.                    File
  593.                    SequenceableCollection
  594.                       Interval
  595.                       LinkedList
  596.                          Semaphore
  597.                       File
  598.                       ArrayedCollection
  599.                          Array
  600.                          ByteArray
  601.                          String
  602.              Block
  603.              Class
  604.              Process
  605.  
  606.  
  607.        In the descriptions of each message the following notes
  608.   may occur:
  609.  
  610.   _d    Indicates the effect of the  message  differs  slightly
  611.        from that given in [.Smalltalk blue.].
  612.  
  613.   _n    Indicates the message is not included as  part  of  the
  614.        language defined in [.Smalltalk blue.].
  615.  
  616.   _r    Indicates the protocol for the message overrides a pro-
  617.        tocol given in some superclass.  Only where the logical
  618.  
  619.  
  620.  
  621.                        September 19, 1986
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.        effect of this overriding is important is  the  message
  631.        given  a  second time; some messages, such as copy, are
  632.        overridden in many classes but are not described in the
  633.        documentation  because  the  logical effect remains the
  634.        same.
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.                        September 19, 1986
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.                            _A_p_p_e_n_d_i_x _2
  697.                             _M_a_n _P_a_g_e
  698.  
  699.        A Unix man page for the st command is given on the fol-
  700.   lowing page.
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.                        September 19, 1986
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.                            _A_p_p_e_n_d_i_x _3
  763.                          _S_y_n_t_a_x _C_h_a_r_t_s
  764.  
  765.        Syntax charts for the language accepted by  the  Little
  766.   Smalltalk  system are described on the following pages.  The
  767.   following is an example class description:
  768.  
  769.   Class Set :Collection
  770.   | dict |
  771.   [
  772.           new
  773.                   dict <- Dictionary new
  774.  
  775.   |       add: newElement
  776.                   dict at: newElement
  777.                        ifAbsent: [dict at: newElement put: 1]
  778.  
  779.   |       remove: oldElement ifAbsent: exceptionBlock
  780.                   dict removeKey: oldElement ifAbsent: exceptionBlock
  781.  
  782.   |       size
  783.                   |^ dict size
  784.  
  785.   |       occurrencesOf: anElement
  786.                   |^ dict at: anElement ifAbsent: [0]
  787.  
  788.   |       first
  789.                   dict first.
  790.                   |^ dict currentKey
  791.  
  792.   |       next
  793.                   dict next.
  794.                   |^ dict currentKey
  795.  
  796.   ]
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.                        September 19, 1986
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.                            _A_p_p_e_n_d_i_x _4
  829.                        _P_r_i_m_i_t_i_v_e _N_u_m_b_e_r_s
  830.  
  831.        The following chart gives  the  function  performed  by
  832.   each primitive in the Little Smalltalk system.
  833.  
  834.   _I_n_f_o_r_m_a_t_i_o_n _a_b_o_u_t _o_b_j_e_c_t_s
  835.  
  836.   0    (not used )
  837.  
  838.   1    class of an object
  839.  
  840.   2    superobject of an object
  841.  
  842.   3    test if class responds to new
  843.  
  844.   4    size of object
  845.  
  846.   5    hash value
  847.  
  848.   6    test if two built-in objects are of the same type
  849.  
  850.   7    object equality testing ( == )
  851.  
  852.   8    various switch toggles
  853.  
  854.   9    numerical generality testing
  855.  
  856.   _I_n_t_e_g_e_r _m_a_n_i_p_u_l_a_t_i_o_n
  857.  
  858.   10   integer addition (both args must be integer)
  859.  
  860.   11   integer subtraction
  861.  
  862.   12   integer < test
  863.  
  864.   13   integer > test
  865.  
  866.   14   integer <_ test
  867.  
  868.   15   integer >_ test
  869.  
  870.   16   integer = test
  871.  
  872.   17   integer ~= test
  873.  
  874.   18   integer multiplication
  875.  
  876.   19   integer //
  877.  
  878.   _B_i_t _m_a_n_i_p_u_l_a_t_i_o_n _a_n_d _o_t_h_e_r _i_n_t_e_g_e_r _v_a_l_u_e_d _f_u_n_c_t_i_o_n_s
  879.  
  880.   20   gcd:
  881.  
  882.  
  883.  
  884.  
  885.                        September 19, 1986
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.   21   bitAt:
  895.  
  896.   22   bitOr:
  897.  
  898.   23   bitAnd:
  899.  
  900.   24   bitXor:
  901.  
  902.   25   bitShift:
  903.  
  904.   26   radix:
  905.  
  906.   27   not used
  907.  
  908.   28   integer quo:
  909.  
  910.   29   integer rem:
  911.  
  912.   _O_t_h_e_r _i_n_t_e_g_e_r _f_u_n_c_t_i_o_n_s
  913.  
  914.   30   doPrimitive:withArguments:
  915.  
  916.   31   not used
  917.  
  918.   32   convert random integer to random float
  919.  
  920.   33   bitInvert
  921.  
  922.   34   highBit
  923.  
  924.   35   randomNumber (argument is seed )
  925.  
  926.   36   asCharacter
  927.  
  928.   37   asString
  929.  
  930.   38   factorial
  931.  
  932.   39   asFloat
  933.  
  934.   _C_h_a_r_a_c_t_e_r _m_a_n_i_p_u_l_a_t_i_o_n
  935.  
  936.   40   not used
  937.  
  938.   41.  not used
  939.  
  940.   42   character < test
  941.  
  942.   43   character > test
  943.  
  944.   44   character <_ test
  945.  
  946.   45   character >_ test
  947.  
  948.  
  949.  
  950.  
  951.                        September 19, 1986
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.   46   character = test
  961.  
  962.   47   character ~= test
  963.  
  964.   48   not used
  965.  
  966.   49   not used
  967.  
  968.   _C_h_a_r_a_c_t_e_r _u_n_a_r_y _f_u_n_c_t_i_o_n_s
  969.  
  970.   50   digitValue
  971.  
  972.   51   isVowel
  973.  
  974.   52   isLetter
  975.  
  976.   53   isLowerCase
  977.  
  978.   54   isUpperCase
  979.  
  980.   55   isSeparator
  981.  
  982.   56   isAlphaNumeric
  983.  
  984.   57   caseShift
  985.  
  986.   58   asString
  987.  
  988.   59   asciiValue
  989.  
  990.   _F_l_o_a_t_i_n_g _p_o_i_n_t _m_a_n_i_p_u_l_a_t_i_o_n
  991.  
  992.   60   floating point addition (both args must be float)
  993.  
  994.   61   floating point subtraction
  995.  
  996.   62   floating point < test
  997.  
  998.   63   floating point > test
  999.  
  1000.   64   floating point <_ test
  1001.  
  1002.   65   floating point >_ test
  1003.  
  1004.   66   floating point = test
  1005.  
  1006.   67   floating point ~= test
  1007.  
  1008.   68   floating point multiplication
  1009.  
  1010.   69   floating point division
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.                        September 19, 1986
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.   _O_t_h_e_r _f_l_o_a_t_i_n_g _p_o_i_n_t _o_p_e_r_a_t_i_o_n_s
  1027.  
  1028.   70   ln
  1029.  
  1030.   71   sqrt
  1031.  
  1032.   72   floor
  1033.  
  1034.   73   ceiling
  1035.  
  1036.   74   not used
  1037.  
  1038.   75   integerPart
  1039.  
  1040.   76   fractionalPart
  1041.  
  1042.   77   gamma
  1043.  
  1044.   78   asString
  1045.  
  1046.   79   exp
  1047.  
  1048.   _O_t_h_e_r _n_u_m_e_r_i_c_a_l _f_u_n_c_t_i_o_n_s
  1049.  
  1050.   80   normalize number to be within 0 and 2J.
  1051.  
  1052.   81   sin
  1053.  
  1054.   82   cos
  1055.  
  1056.   83   not used
  1057.  
  1058.   84   arcSin
  1059.  
  1060.   85   arcCos
  1061.  
  1062.   86   arcTan
  1063.  
  1064.   87   not used
  1065.  
  1066.   88   raisedTo:
  1067.  
  1068.   89   radix:
  1069.  
  1070.   _S_y_m_b_o_l _C_o_m_m_a_n_d_s
  1071.  
  1072.   90.  not used
  1073.  
  1074.   91   symbol comparison, returns true or false.
  1075.  
  1076.   92   printString
  1077.  
  1078.   93   asString
  1079.  
  1080.  
  1081.  
  1082.  
  1083.                        September 19, 1986
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.   94   print (used internally)
  1093.  
  1094.   95   not used
  1095.  
  1096.   96   not used
  1097.  
  1098.   97   build a new class, arguments are class name, superclass
  1099.        name,  instance  variables,  messages, methods, context
  1100.        size.
  1101.  
  1102.   98   insert an object into class dictionary, first  argument
  1103.        is symbol, second argument is class definition
  1104.  
  1105.   99   find an object in class dictionary.  argument  is  sym-
  1106.        bol.
  1107.  
  1108.   _S_t_r_i_n_g _o_p_e_r_a_t_i_o_n_s
  1109.  
  1110.   100  string length
  1111.  
  1112.   101  string compare, case important - return -1, 0 or 1.
  1113.  
  1114.   102  string compare, case not important
  1115.  
  1116.   103  string catenation
  1117.  
  1118.   104  string at:
  1119.  
  1120.   105  string at:put:
  1121.  
  1122.   106  copyFrom:length:
  1123.  
  1124.   107  copy (new string with same chars)
  1125.  
  1126.   108  asSymbol
  1127.  
  1128.   109  string printString
  1129.  
  1130.   _A_r_r_a_y _m_a_n_i_p_u_l_a_t_i_o_n
  1131.  
  1132.   110  build an untyped object  of  given  size,  argument  is
  1133.        integer size.
  1134.  
  1135.   111  index variable get (first argument is object, second is
  1136.        index)
  1137.  
  1138.   112  index variable put (first argument is object, second is
  1139.        index, third argument is expression)
  1140.  
  1141.   113  object grow (returns a new object  with  same  instance
  1142.        variable  values  as  first  argument,  but with second
  1143.        argument tacked on end as new instance variable)
  1144.  
  1145.   114  build an instance of AAAArrrrrrrraaaayyyy of the given size.
  1146.  
  1147.  
  1148.  
  1149.                        September 19, 1986
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.   115  new string of given size
  1159.  
  1160.   116  ByteArray new:
  1161.  
  1162.   117  ByteArray size
  1163.  
  1164.   118  ByteArray at:
  1165.  
  1166.   119  ByteArray at:put:
  1167.  
  1168.   _O_u_t_p_u_t _a_n_d _e_r_r_o_r _m_e_s_s_a_g_e_s
  1169.  
  1170.   120  print string with no return
  1171.  
  1172.   121  print string with return
  1173.  
  1174.   122  general error - first argument is receiver,  second  is
  1175.        error string
  1176.  
  1177.   123  print string on error output (with return)
  1178.  
  1179.   124  not used
  1180.  
  1181.   125  unix system call
  1182.  
  1183.   126  print a string at a specific point on the terminal
  1184.  
  1185.   127  block return without surrounding context
  1186.  
  1187.   128  reference count  less  than  zero,  first  argument  is
  1188.        guilty object
  1189.  
  1190.   129  does not respond error,  first  argument  is  receiver,
  1191.        second is message.
  1192.  
  1193.   _F_i_l_e _o_p_e_r_a_t_i_o_n_s
  1194.  
  1195.   130  file open, first argument is name, second  argument  is
  1196.        mode
  1197.  
  1198.   131  file read
  1199.  
  1200.   132  file write
  1201.  
  1202.   133  set file mode, first argument is file, second  is  mode
  1203.        indicator (anInteger)
  1204.  
  1205.   134  compute file size in bytes
  1206.  
  1207.   135  file set location (at:)  second  argument  is  location
  1208.        (anInteger)
  1209.  
  1210.   136  return current file offset in bytes
  1211.  
  1212.  
  1213.  
  1214.  
  1215.                        September 19, 1986
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.   137  not used
  1225.  
  1226.   138  not used
  1227.  
  1228.   139  not used
  1229.  
  1230.   _P_r_o_c_e_s_s _m_a_n_a_g_e_m_e_n_t
  1231.  
  1232.   140  block execute (trapped by interpreter)
  1233.  
  1234.   141  new process (withArguments:)
  1235.  
  1236.   142  terminate a process
  1237.  
  1238.   143  perform:withArguments: (trapped by interpreter)
  1239.  
  1240.   144. not used
  1241.  
  1242.   145  set state
  1243.  
  1244.   146  return state
  1245.  
  1246.   148  start atomic action
  1247.  
  1248.   149  end atomic action
  1249.  
  1250.   _O_p_e_r_a_t_i_o_n_s _o_n _c_l_a_s_s_e_s
  1251.  
  1252.   150  class edit
  1253.  
  1254.   151  superclass of a class
  1255.  
  1256.   152  class name (a Symbol)
  1257.  
  1258.   153  new instance of a class
  1259.  
  1260.   154  list all commands class responds to
  1261.  
  1262.   155  respondsTo: , second argument is a symbol
  1263.  
  1264.   156  class view (drop into editor, but no include)
  1265.  
  1266.   157  class list
  1267.  
  1268.   158  variables (returns an array of symbols)
  1269.  
  1270.   159  not used
  1271.  
  1272.   _D_a_t_e _a_n_d _T_i_m_e
  1273.  
  1274.   160  current date and time as string
  1275.  
  1276.   161  seconds time counter
  1277.  
  1278.  
  1279.  
  1280.  
  1281.                        September 19, 1986
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.   162  clear the screen
  1291.  
  1292.   _P_l_o_t(_3) _i_n_t_e_r_f_a_c_e
  1293.  
  1294.   170  clear the screen
  1295.  
  1296.   171  move the cursor (move(x,y))
  1297.  
  1298.   172  draw a line (cont(x,y))
  1299.  
  1300.   173  draw a point (point(x,y))
  1301.  
  1302.   174  draw a circle (circle(x,y,r))
  1303.  
  1304.   175  draw an arc (arc(x,y,x0,y0,x1,y1))
  1305.  
  1306.   176  establish the coordinate space (space(a,b,c,d))
  1307.  
  1308.   177  draw a line (line(a,b,c,d))
  1309.  
  1310.   178  print a label (label(s))
  1311.  
  1312.   179  establish a line type (linemod(s))
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.                        September 19, 1986
  1348.  
  1349.  
  1350.