1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-24 14:10:37 +02:00
Commit Graph

521 Commits

Author SHA1 Message Date
Werner Almesberger
e1814ce372 qpkg: converted dumb binary trees to red-black trees (in progress)
This is a change of the underlying mechanism but it's not polished or
optimized yet. The compare functions haven't been updated, so they work
but produce compiler warnings because of type mismatches.

- Makefile (OBJS): added jrb.o
- id.h, id.c: use jrb instead of own dumb binary trees
- TODO: brag about the efficiency improvement
2010-11-19 21:53:38 -03:00
Werner Almesberger
a8ed4dcb23 qpkg: use -Wmissing-prototypes
- Makefile (CFLAGS): use -Wmissing-prototypes
- jrb.c (lprev, rprev): made "static"
- prereq.c: include prereq.h
2010-11-19 20:51:49 -03:00
Werner Almesberger
47abebe364 qpkg: renamed "struct jrb_node" to "struct jrb" replaced JRB with "struct jrb *" 2010-11-19 20:48:49 -03:00
Werner Almesberger
da7a6feb4b qpkg/jrb.c: reordered recolor and single_rotate and removed prototypes 2010-11-19 20:39:41 -03:00
Werner Almesberger
c060b883a9 qpkg: mention in jrb-related files that they've been heavily edited 2010-11-19 20:37:29 -03:00
Werner Almesberger
7e641d2655 qpkg/jrb.[ch]: remove trailing spaces 2010-11-19 20:35:43 -03:00
Werner Almesberger
a463773c12 qpkg: simplify jrb_delete_node and more whitespace cleanup
- jrb.c (recolor, jrb_delete_node, jrb_nblack, jrb_free_tree): add space
  to while(...
- jrb.c (jrb_delete_node): flatten deletion of internal node
- rbtest.c (main): add test of jrb_delete_node
2010-11-19 20:30:24 -03:00
Werner Almesberger
5a422a470d qpkg/jrb.c (mk_new_ext): converted from macro to function 2010-11-19 20:23:16 -03:00
Werner Almesberger
009f56c927 qpkg/jrb.c: major whitespace readjustment (converted from GNU to K&R style) 2010-11-19 20:18:59 -03:00
Werner Almesberger
dec07f359a qpkg/jrb.h: general code cleanup
- jrb.h: fixed indentation
- jrb.h: named anonymous parameters
- jrb.h: removed "extern" from function prototypes
2010-11-19 19:57:38 -03:00
Werner Almesberger
cc92c67080 qpkg: (jrb) remove _gen suffix, since we removed the non-generic variants
- jrb.h, jrb.c (jrb_find_gte_gen): renamed to jrb_find_gte
- jrb.h, jrb.c (jrb_find_gen): renamed to jrb_find
- jrb.h, jrb.c (jrb_insert_gen): renamed to jrb_insert
- rbtest.c (INSERT): track jrb_insert_gen name change
2010-11-19 19:52:39 -03:00
Werner Almesberger
7f05c9e284 qpkg: remove Jval
- jrb.h (struct jrb_node): changed "key" and "val" from "Jval" to "void *"
- jrb.h, jval.c (jrb_insert_gen, jrb_find_gen, jrb_find_gte_gen, jrb_val):
  replaced "Jval" with "void *" or "const void *", respectively
- rbtest.c (cmp, INSERT): updated for Jval removal
- rbtest.c (main): use jrb_val(jrb) instead of jval_v(jrb->val)
- Makefile (OBJS_rbtest): removed jval.o
- jval.h, jval.c: removed
2010-11-19 19:47:52 -03:00
Werner Almesberger
769d31581d qpkg: removed non-generic jrb access functions
- jrb.h, jrb.c (jrb_insert_str, jrb_insert_int, jrb_insert_dbl): removed
- jrb.h, jrb.c (jrb_find_str, jrb_find_int, jrb_find_dbl): removed
- jrb.h, jrb.c (jrb_find_gte_str, jrb_find_gte_int, jrb_find_gte_dbl): removed
- jrb.c (jrb_print_tree, jrb_iprint_tree): removed unused tree dump functions
2010-11-19 19:36:31 -03:00
Werner Almesberger
b4ff969a24 qpkg: added simple regression test for red-black trees 2010-11-19 19:33:05 -03:00
Werner Almesberger
2787a45c43 qpkg: added James S. Plank's red-black trees 2010-11-19 19:17:47 -03:00
Werner Almesberger
908f6c9c0f qpkg/TODO: list of to do items 2010-11-19 19:16:00 -03:00
Werner Almesberger
9b5480ab3e qpkg: merge identical versions in package databases
This avoids turning a prerequisite search into a massacre of, guessed,
O(sqrt(2^requisites)).

- gobble.c (gobble_buf, compact_pkg): if a package being added has the same
  version as an existing package with the same name, merge them and keep
  only one
2010-11-19 16:27:55 -03:00
Werner Almesberger
0ca4751b77 qpkg: some cleanup, prerequisite search speedup
With the reduction of search depth, "prereq abiword" takes about 3 minutes
on my PC. (Obviously, this can still be improved.)

- gobble.c (gobble_buf): if pkg->id->value is NULL, just it as such
- prereq.c (push): abort if trying to consider a package already considered
  or installed
- prereq.c (conflicts): before being satisfied with using an installed
  package, make sure it really satisfies the requirement
- prereq.c (conflicts): abort if an installed package conflicts
- prereq.c (conflicts): added some debugging output (temporary)
- prereq.c (conflicts): cut the search if we can't do better than a
  previous match
2010-11-19 15:26:24 -03:00
Werner Almesberger
fe14aa01d5 qpkg/prereq.c (resolve): simplify requisites chaining logic
Tried to keep next_dep at the beginning, but that's actually unnecessary.
The historical background is that the dependency list pointer was
originally thought to point to the list currently being processes. But
since it's a list following it, we don't need to maintain the original
order.
2010-11-19 14:25:33 -03:00
Werner Almesberger
c90fcba126 qpkg/qpkg.c (main): show usage if there are no arguments or any options 2010-11-19 14:21:55 -03:00
Werner Almesberger
43b9dc1972 qpkg/: initial commit (sneak preview only, doesn't work properly yet) 2010-11-19 14:00:15 -03:00