From: lyndon@angelo.amd.com (Lyndon C. Lim)
Subject: edge skill (continued)
Organization: Advanced Micro Devices, Inc.
Date: Tue, 21 Jul 1992 21:08:38 GMT

thanks to karl and chuck for their suggestions.

below i attached my original solution to the problem.
---------------------------------------------------------------------
/* %W%     %G%
**
** function:  PsvCheckType
**  purpose:  Check type of argument
**
**  history:
**     20 Jul 92   lyndon   - Created.
*/

/* ({[ */

procedure( PsvCheckType(var type 
                        @optional
                        (message1 "Type mismatch")
                        (message2 "")
                        "gt")

    prog( (function definition)

        /* un-define an previous definions */
        putd('PsvDoCheck nil)

        /* define the check function, and execute it */
        definition = "procedure( PsvDoCheck(n \"%s\") t)"
        sprintf(function, definition, type)
        loadstring(function)

        if( errset(PsvDoCheck(var)) then
            return(t)
        else
            error(message1 message2)
        )
    )
)

/* ]}) */

---------------------------------------------------------------------



i liked karl's suggestion, which then looks like the following:
---------------------------------------------------------------------
/* %W%     %G%
**
** function:  PsvCheckType
**  purpose:  Check type of argument
**
**  history:
**     20 Jul 92   lyndon   - Created.
*/

/* ({[ */

procedure( PsvCheckType(var type 
                        @optional
                        (message1 "Type mismatch")
                        (message2 "")
                        "gt")

    /* un-define any previous definions, prevents pop-up window */
    putd('PsvDoCheck nil)

    /* define the check function, and execute it */
    apply('procedure list(list('PsvDoCheck 'var type) t))

    if( ! errset(PsvDoCheck(var)) then
        error(message1 message2)
    )
)

/* ]}) */
---------------------------------------------------------------------

looking over the type() function, i realized i could've
implemented 90% of the functionality using it, and it would be
more readable.  the only thing i would miss is the conglomerate
types, such as S (symbol or string) and n (fixnum, flonum, bignum).

below, i attached the code which calls these type checking
functions, which will make it more clear the context in which
they are used.


---------------------------------------------------------------------
/* %W%     %G%
**
** function:  PsvHiCopy
**  purpose:  Copy and repeat selected objects.
**
**  history:
**     17 Jul 92   lyndon   - Created.
*/

/* ({[ */

procedure( PsvHiCopy()
    prog( (p1 p2 xcnt ycnt delx dely reply finished selSet)

        selSet = selectedSet()
        if(selSet == nil then
            error("" "No objects have been selected.")
        )



        /* interactive prompting */
        reply = linereadstring( textEntry("x & y count?") )
        xcnt  = nth(0 reply)
        ycnt  = nth(1 reply)
        PsvCheckType(xcnt "x" "x count" "Should be an integer.")
        PsvCheckType(ycnt "x" "y count" "Should be an integer.")

        reply = linereadstring( textEntry("x & y offset?") )
        delx  = nth(0 reply)
        dely  = nth(1 reply)
        PsvCheckType(delx "n" "x offset" "Should be a number.")
        PsvCheckType(dely "n" "y offset" "Should be a number.")



        p1 = getCurrentLocation()

        /* prompt for first point only if not infix
        ** or current location is not valid
        */
        if( ! (getEnvVar("infix?") &&  p1)  then
            p1 = getPoint("Point to source point.")
        )

        finished = (p1 == nil)

        while(! finished

            /* keep resetting anchor because getResponse changes it */
            setRubberBand(p1)

            reply = getResponse("Point to destination point."
                                "line"
                                list("point" "point" "cancel")
                               )

            if( (p2 = reply->userCoord) then
                case( (reply->buttons)
                    ( (4 2) /* copy */
                        PsvCopy(selSet p1 p2 xcnt ycnt delx dely)
                        finished = t
                    )

                    ( (1 )
                        finished = t
                    )

                    (0  /* no button */
                        /* allow nesting of other bindkey commands */
                        finished = ( ! stDoKeyboard(reply->key))
                    )
                ) /* end decode */
            )

        ) /* end while */

    )
)

/* ]}) */
---------------------------------------------------------------------

by the way, any comments on how the rubberbanding and infix are
handled would be welcomed.  i'm pretty new to skill still; only
been at it a few weeks.

thanks,
lyndon c.