コード例 #1
0
ファイル: codeseg.c プロジェクト: gomachan46/otoge_burn
void CS_InsertEntry (CodeSeg* S, struct CodeEntry* E, unsigned Index)
/* Insert the code entry at the index given. Following code entries will be
 * moved to slots with higher indices.
 */
{
    /* Insert the entry into the collection */
    CollInsert (&S->Entries, E, Index);
}
コード例 #2
0
ファイル: attr.c プロジェクト: PanchoManera/cc65
void AddAttr (Collection* C, const char* Name, const char* Value)
/* Add an attribute to an alphabetically sorted attribute collection */
{
    /* Create a new attribute entry */
    Attr* A = NewAttr (Name, Value);

    /* Search for the attribute. If it is there, we have a duplicate, otherwise
     * we have the insert position.
     */
    unsigned Index;
    if (FindAttr (C, Name, &Index)) {
        Error ("Duplicate command line attribute `%s'", Name);
    }

    /* Insert the attribute */
    CollInsert (C, A, Index);
}
コード例 #3
0
ファイル: searchpath.c プロジェクト: FelipeBudinich/cc65
int PushSearchPath (SearchPaths* P, const char* NewPath)
/* Add a new search path to the head of an existing search path list, provided
** that it's not already there. If the path is already at the first position,
** return zero, otherwise return a non zero value.
*/
{                                      
    /* Generate a clean copy of NewPath */
    char* Path = CleanupPath (NewPath);   

    /* If we have paths, check if Path is already at position zero */
    if (CollCount (P) > 0 && strcmp (CollConstAt (P, 0), Path) == 0) {
        /* Match. Delete the copy and return to the caller */
        xfree (Path);
        return 0;
    }

    /* Insert a clean copy of the path at position 0, return success */
    CollInsert (P, Path, 0);
    return 1;
}
コード例 #4
0
ファイル: coll.c プロジェクト: Aliandrana/cc65
void CollMove (Collection* C, unsigned OldIndex, unsigned NewIndex)
/* Move an item from one position in the collection to another. OldIndex
** is the current position of the item, NewIndex is the new index after
** the function has done it's work. Existing entries with indices NewIndex
** and up are moved one position upwards.
*/
{
    /* Get the item and remove it from the collection */
    void* Item = CollAt (C, OldIndex);
    CollDelete (C, OldIndex);

    /* Correct NewIndex if needed */
    if (NewIndex >= OldIndex) {
        /* Position has changed with removal */
        --NewIndex;
    }

    /* Now insert it at the new position */
    CollInsert (C, Item, NewIndex);
}
コード例 #5
0
ファイル: coll.c プロジェクト: Aliandrana/cc65
void CollAppend (Collection* C, void* Item)
/* Append an item to the end of the collection */
{
    /* Insert the item at the end of the current list */
    CollInsert (C, Item, C->Count);
}