[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: g_list_sort() or local mergesort?



> For my gnetlist hacking I need to sort the netlist according to refdes. 
> There are two options:
>
> a) use the function g_list_sort() provided by glib
> This would involve routines to convert NETLIST to GList and back.
>
> b) add a sorting algorithm to libgeda. A sensible choice would be 
> mergesort. 
>
> Which option do you prefer?

Instead of providing clarity, I'll muddy the waters.  There is a
sorting algorithm already implemented in gattrib:
gattrib/src/listsort.c.

If you choose option B, then you could just move this code into
libgeda instead of writing something from scratch.  In fact, it would
be better to have one sort implementation for gaf, instead of
different one scattered around the source tree.  However, this depends
upon the requirements of your sort, i.e. are you sorting single- or
double-linked lists?  Sorting numbers or strings?   Long or short
lists?  And so on....

Stuart


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user