gattrib
|
#include <stdio.h>
#include <ctype.h>
#include <libgeda/libgeda.h>
#include "../include/struct.h"
#include "../include/prototype.h"
#include "../include/globals.h"
Go to the source code of this file.
Functions | |
int | cmp (STRING_LIST *al, STRING_LIST *bl) |
Compare values of string data. | |
STRING_LIST * | listsort (STRING_LIST *list, int is_circular, int is_double) |
Sort the linked list. |
Linked list sorting code taken from http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html and hacked to serve in gattrib by SDB.
Definition in file listsort.c.
int cmp | ( | STRING_LIST * | al, |
STRING_LIST * | bl | ||
) |
Comparison function -- compare values of string data.
al | pointer to first STRING_LIST item to be compared |
bl | pointer to second STRING_LIST item to be compared |
Definition at line 87 of file listsort.c.
STRING_LIST* listsort | ( | STRING_LIST * | list, |
int | is_circular, | ||
int | is_double | ||
) |
This is the actual sort function. Notice that it returns the new head of the list. (It has to, because the head will not generally be the same element after the sort.) So unlike sorting an array, where you can do
you now have to do
list | The linked STRING_LIST to be sorted |
is_circular | TRUE if this is a circularly linked list |
is_double | TRUE if this is a doubly-linked list |
Definition at line 139 of file listsort.c.