Annotation of 43BSD/contrib/icon/operators/lexle.c, revision 1.1.1.1

1.1       root        1: #include "../h/rt.h"
                      2: 
                      3: /*
                      4:  * x <<= y - test if x is lexically less than or equal to y.
                      5:  */
                      6: 
                      7: lexle(nargs, arg2, arg1, arg0)
                      8: int nargs;
                      9: struct descrip arg2, arg1, arg0;
                     10:    {
                     11:    DclSave
                     12:    register int t;
                     13:    char sbuf1[MAXSTRING], sbuf2[MAXSTRING];
                     14:    extern char *alcstr();
                     15: 
                     16:    SetBound;
                     17:    /*
                     18:     * x and y must be strings.  Save the cvstr return value for y because
                     19:     *  y is the result (if any).
                     20:     */
                     21:    if (cvstr(&arg1, sbuf1) == NULL)
                     22:       runerr(103, &arg1);
                     23:    if ((t = cvstr(&arg2, sbuf2)) == NULL)
                     24:       runerr(103, &arg2);
                     25: 
                     26:    /*
                     27:     * lexcmp does the work.
                     28:     */
                     29:    if (lexcmp(&arg1, &arg2) > 0)
                     30:       fail();
                     31: 
                     32:    /*
                     33:     * Return y as the result of the comparison.  If y was converted to
                     34:     *  a string, a copy of it is allocated.
                     35:     */
                     36:    arg0 = arg2;
                     37:    if (t == 1)
                     38:       STRLOC(arg0) = alcstr(STRLOC(arg0), STRLEN(arg0));
                     39:    ClearBound;
                     40:    }
                     41: 
                     42: Opblock(lexle,2,"<<=")

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.