SM Random Example

For data what.data:
   0.0000000000000000E+00   4.7909568685725046E-02
  1.9634954084936207E-01   4.7968249689847031E-02
  3.9269908169872414E-01   4.7943759031733590E-02
  5.8904862254808621E-01   4.8005944772810782E-02
  7.8539816339744828E-01   4.8105501496767400E-02
  9.8174770424681035E-01   4.8004768955687893E-02
  1.1780972450961724E+00   4.7942772481461726E-02
  1.3744467859455345E+00   4.7966670712059178E-02
  1.5707963267948966E+00   4.7905752015412806E-02
  1.7671458676442586E+00   4.7985883450737898E-02
  1.9634954084936207E+00   4.7962278105395828E-02
  2.1598449493429825E+00   4.8034473039392289E-02
  2.3561944901923448E+00   4.8062093578083886E-02
  2.5525440310417071E+00   4.8003781551272384E-02
  2.7488935718910690E+00   4.7971042897370197E-02
  2.9452431127404308E+00   4.7861939877618664E-02
  3.1415926535897931E+00   4.7895948767249841E-02

Make macro called whatever.sm:
> sm -m whatever.sm

example whatever.sm
whatever     define print 0
                    define print ? { postcript ? (n=0/y=1) }
                    if ($print == 0) {
                       ctype white
                       device X11
                    } else {
                       ctype black
                       device postencap  whatever.ps
                    }
                    data whatever.dat
                    read { x 1 y 2 }
                    ptype 1 0
                    limits x y
                    points x y
                    connect x y
                    expand 1.4
                    box
                    if ($print == 1) {
                    hardcopy
                    } else {define continue 1
                    define continue ? {}
                    erase
                    }

Or make input file whatever_sm:
>sm
: input whatever_sm

example whatever_sm
device x11
#device postencap  whatever.ps
erase
data what.data
read {x 1 y 2}
limits  x y
box
ptype 3 0
points x y
connect x y
expand 1.0001
xlabel x
ylabel y
 

To exit sm
:quit