Annotation of researchv9/jerq/sgs/libsdp/search.c, revision 1.1

1.1     ! root        1: static char ID[] = "@(#) search.c: 1.1 3/16/82";
        !             2: #include <stdio.h>
        !             3: #include "sdp.h"
        !             4: #include "define3.h"
        !             5: 
        !             6: 
        !             7: #ifdef SHORT
        !             8: #define S201   "S201 "
        !             9: #else
        !            10: #define S201   "%s","S201 -- stack sizes incorrectly configured\n"
        !            11: #endif
        !            12: 
        !            13: extern struct LIBFILE *Glib_file ;
        !            14: extern struct SPACE *first_space ;
        !            15: extern struct ENVIRON *first_environ ;
        !            16: 
        !            17: int                                    /* frame number or NOTFOUND */
        !            18: framesearch(sp,id)
        !            19: register struct SPACE *sp ;
        !            20: ITEMID id ;
        !            21: {
        !            22:        register int            i ;
        !            23:        register struct MANAGER *manager ;
        !            24: 
        !            25:        manager = (sp->environ)->manp ;
        !            26: 
        !            27:        id -= id % (sp->environ)->frame_size ;
        !            28:        for(i=manager[(sp->environ)->num_frames].backward; i!=(sp->environ)->num_frames; i=manager[i].backward)
        !            29:                if( (manager[i].space == sp) && (manager[i].page_id == id) )
        !            30:                        return(i) ;
        !            31:        return(NOTFOUND) ;
        !            32: }
        !            33: 
        !            34: int                                    /* frame number or NOTFOUND */
        !            35: nextsearch(environ)
        !            36: register struct ENVIRON *environ ;
        !            37: {
        !            38:        register int            i ;
        !            39:        register struct MANAGER *manager ;
        !            40: 
        !            41:        manager = environ->manp ;
        !            42: 
        !            43:        if( (i = environ->empties) != END )
        !            44:        {
        !            45:                environ->empties = manager[i].forward ;
        !            46:                ins_frame(environ,i,manager[environ->num_frames].forward) ;
        !            47:                return(i) ;
        !            48:        }
        !            49: 
        !            50:        for(i=manager[environ->num_frames].forward; i!=environ->num_frames; i=manager[i].forward)
        !            51:                if(manager[i].usecount == 0l)
        !            52:                        return(i) ;
        !            53:        return(NOTFOUND) ;
        !            54: }
        !            55: 
        !            56: 
        !            57: int                                    /* stack array index or NOTFOUND */
        !            58: stk1search(sp,howmuch)                 /* for sdp_allot */
        !            59: register struct SPACE *sp ;
        !            60: unsigned howmuch ;
        !            61: {
        !            62:        register int    i ;
        !            63: 
        !            64:        for(i=0; i<sp->numbstax; i++)
        !            65:                if(sp->staxinfo[i].size >= (long)howmuch)
        !            66:                        return(i) ;
        !            67:        return(NOTFOUND) ;
        !            68: }
        !            69: 
        !            70: 
        !            71: int                                    /* stack array index or NOTFOUND */
        !            72: stk2search(sp,howmuch)                 /* for sdp_redeem) */
        !            73: register struct SPACE *sp ;
        !            74: unsigned howmuch ;
        !            75: {
        !            76:        register int    i ;
        !            77: 
        !            78:        for(i=sp->numbstax-1; i>=0; i--)
        !            79:                if((long)howmuch >= sp->staxinfo[i].size)
        !            80:                        return(i) ;
        !            81:        ERR_RET(S201,ERROR)
        !            82: }
        !            83: 
        !            84: 
        !            85: 
        !            86: int                                    /* SUCCESS or NOTFOUND */
        !            87: spsearch(sp)
        !            88: struct SPACE *sp;
        !            89: {
        !            90: 
        !            91:        register struct SPACE   *i;
        !            92: 
        !            93:        for(i=first_space; i!=NULL; i=i->next_space)
        !            94:        {
        !            95:                if(sp == i)
        !            96:                        return(SUCCESS);
        !            97:        }
        !            98:        return(NOTFOUND);
        !            99: 
        !           100: }
        !           101: ensearch(en)
        !           102: struct ENVIRON *en;
        !           103: {
        !           104: 
        !           105:        register struct ENVIRON *i;
        !           106: 
        !           107:        for(i=first_environ; i!=NULL; i=i->next_environ)
        !           108:        {
        !           109:                if(en == i)
        !           110:                        return(SUCCESS);
        !           111:        }
        !           112:        return(NOTFOUND);
        !           113: 
        !           114: }

unix.superglobalmegacorp.com

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