english
version "1.0"
identify "xyz"

#: Copyright (c) 1997 by Wayne C. Gramlich.
#, All rights reserved.
#,
#, Permission to use, copy, modify, distribute, and sell this software
#, for any purpose is hereby granted without fee provided that the above
#, copyright notice and this permission are retained.  The author makes
#, no representations about the suitability of this software for any purpose.
#, It is provided "as is" without express or implied warranty.

module xlib_points

#: This module implements the {xlib_points} object.

import
    address
    integer
    logical
    out_stream
    string
    unsigned
    xlib_color_map
    xlib_pixel
    xlib_screen


define xlib_points
    external


#: {xlib_points} routines:

procedure address_get@xlib_points
    takes
	points xlib_points
    returns address
    external xlib_points__address_get

    #: This procedure will return the address assocaiated with {points}.


procedure append@xlib_points
    takes
	points xlib_points
	x integer
	y integer
    returns_nothing
    external xlib_points__append

    #: This procedure will append ({x}, {y}) to {points}.
    

procedure create@xlib_points
    takes_nothing
    returns xlib_points
    external xlib_points__create

    # This procedure will allocate and return an {xlib_points} object.


procedure size_get@xlib_points
    takes
	points xlib_points
    returns unsigned
    external xlib_points__size_get

    #: This procedure will return the number of points in {points}.


procedure trim@xlib_points
    takes
	points xlib_points
	new_size unsigned
    returns_nothing
    external xlib_points__trim

    #: This procedure will trim the number of points in {points} to {new_size}.


procedure print@xlib_points
    takes
	points xlib_points
	out_stream out_stream
    returns_nothing

    #: This procedure will print the contents of {points} to {out_stream}.

    put@("[", out_stream)
    print@(points.address, out_stream)
    put@(":", out_stream)

    size :@= points.size
    index :@= 0
    loop
	while index < size
	put@(" (", out_stream)
	x :@= x_fetch@(points, index)
	print@(x, out_stream)
	put@(":", out_stream)
	y :@= y_fetch@(points, index)
	print@(y, out_stream)
	put@(")", out_stream)
	index :+= 1
    put@("]", out_stream)


procedure x_fetch@xlib_points
    takes
	points xlib_points
	index unsigned
    returns integer
    external xlib_points__x_fetch

    #: This procedure will return the {index}'th x value from {points}.


procedure x_store@xlib_points
    takes
	points xlib_points
	index unsigned
	value integer
    returns_nothing
    external xlib_points__x_store

    #: This procedure will store {value} as the {index}'th x value in {points}.


procedure y_fetch@xlib_points
    takes
	points xlib_points
	index unsigned
    returns integer
    external xlib_points__y_fetch

    #: This procedure will return the {index}'th y value from {points}.


procedure y_store@xlib_points
    takes
	points xlib_points
	index unsigned
	value integer
    returns_nothing
    external xlib_points__y_store

    #: This procedure will store {value} as the {index}'th y value in {points}.


