. See the assignment turn-in page (last modified on 14 January 2006) for instructions on turning in your assignment.
Assuming a coordinate system in which x increases to the right and y increases going down, a diagram is neat if all the following properties hold:
All sticks can be the same length, or you can relate the length of the neat stick to the length of the sketched stick.
A stroke is a sequence of four or more integers interpreted as a sequence of two or more (x, y) point coordinates. Each integer is separated from adjacent integers by at least one non-newline space character. Every integer on the same line is part of the stroke defined by the line.
Any number of space characters may appear between adjacent strokes.
A stroke that doesn't appear to be a circle or a stick should be flagged as illegal input.
isspace()
true.
Also, the first line of output may be preceded by zero or more blank lines;
the last line of output may be followed by zero or more blank lines.
circles
followed by a positive integer interpreted as the
circle radius followed by a sequence of integers interpreted as a sequence of
(x, y) points describing the circle centers:
circles
r x1 y1 ...
Circle centers may be listed in any order. A valid circles
line must have
an odd number of integers.
sticks
followed by a sequence of integers interpreted as
a sequence of a sequence of (x, y) points describing stick endpoints:
sticks
x1,1 y1,1 x1,2 y1,2 ...
The first four integers describe the endpoints of the first stick, the second
four integers describe the endpoints of the next stick, and so on. Sticks may
be listed in any order. A valid sticks line must have an even number of
integers.
Adjacent elements in a non-blank output line must be separated by at least one
non-newline space character. circles
and sticks
lines may appear in
any order.
If the input is invalid, your program should output to std-err a single error message describing the problem; only the first problem discovered need be reported.
cas-sketch
produces
input in the format required by your program; cas-show
accepts output in
the format produced by your program and displays it. Both of these programs
can be found in the assignment directory /export/home/class/cs-306/pa1
.
Both cas-sketch
and cas-show
use the X Window System. You must be
sitting in front of a system that's running the X window system to to use
either program; if you are sitting in front of a system that's not running the
X window system, you can't use either program.
If you are sitting in front of a pc running linux and you're running a window manager, then you're sitting in front of a system running the X window system and you can use either program.
If you're sitting in front of a pc running ms software, then you are sitting in front of a system that is not running the X window system and you can't use either program.
However, you may still have problems if you're sitting in from of a system running the X window system. If you have remotely logged into another system (using telnet, rlogin, or rsh) and you're trying to run either program on the remote system, you have to also do the following:
hostname
command:
loc: hostname clayton loc:
DISPLAY
environment variable on the remote
system to
localsystemname:0.0
where localsystemname
is the name of your local system. For example, type
rem: export DISPLAY=clayton:0.0 rem:
if you're using ksh
.
xhost +
you should get an message like "access control disabled, clients can connect from any host":
loc: xhost + access control disabled, clients can connect from any host loc:
If you're paranoid about giving every host access to your screen, you can type instead (on the local host)
xhost remotesystemname
where
remotesystemname
is the name of the remote system:
loc: xhost cslab18 cslab18 being added to access control list loc:
This page last modified on 5 October 2007. |
|