📄 dict.w,v
字号:
printf("Deleted %d:",i); dict_doall(d,prn); printf("\n------\n");/* Now test the two-child delete where the right child must itself be replaced */ for ( i=4;i>=0;i-- ) { dict_insert(d,a+i); } dict_find(d,a+3); dict_find(d,a+1); printf("Complex two-child delete:");dict_doall(d,prn);printf("\n"); dict_delete(d,a+1,del); printf("Deleted %d:",1);dict_doall(d,prn);printf("\n------\n"); dict_destroy(d,del); printf("\n------\nPassed all tests! (NOT EXHAUSTIVE)\n"); return 0;}@@*Index.@1.127log@Added the LGPL notice in each file.@text@d53 3d156 1a156 1const char *dict_rcs_id = "$Id: dict.w,v 1.126 1998/06/12 22:48:21 neto Exp neto $";d253 1a253 1dicitonary routines on this dictionary.@1.126log@Fixed a bug. delete min and delete max weren't returning the rightthink. (That's ok, LK wasn't using that stuff anyway...)@text@d1 47a48 1@@i copyrt.wd53 4d153 1a153 1const char *dict_rcs_id = "$Id: dict.w,v 1.125 1998/05/23 16:36:37 neto Exp neto $";@1.125log@Get rid of unused l in delete min and delete max.Give a value to variable here so GCC's dataflow analysis is satisfied.@text@d7 4d103 1a103 1const char *dict_rcs_id = "$Id: dict.w,v 1.124 1998/05/21 20:28:29 neto Exp neto $";d802 1d810 1a810 1 void (*action)(void*)=NULL;d814 1d817 1a817 1 return m->payload;d826 1a826 1 void (*action)(void*)=NULL;d830 1d833 1a833 1 return m->payload;@1.124log@Added dict size, dict delete min, dict delete max.@text@d7 3d99 1a99 1const char *dict_rcs_id = "$Id: dict.w,v 1.123 1997/09/27 18:05:36 neto Exp neto $";d757 1a757 1 dict_node_t *next, *here, *splay_this; int l;d804 1a804 1 dict_node_t *m, *next, *here, *splay_this; int l; d819 1a819 1 dict_node_t *m, *next, *here, *splay_this; int l; @1.123log@Fixed RCS log behaviour.@text@d2 1d7 3d96 1a96 1const char *dict_rcs_id = "$Id: dict.w,v 1.122 1997/08/15 20:18:25 neto Exp neto $";d177 5d185 4d197 9d217 2d220 1a220 1d265 1d302 1d320 1d364 1d387 1d666 1d754 6a759 2 void *ret = d->root->payload; dict_delete(d,ret,action);d782 2a783 1dict_max(dict_t *d) {d793 34d851 10@1.122log@Added Index major section.@text@d4 5a8 1{\obeylines$Log: dict.w,v $d92 1a92 1const char *dict_rcs_id = "$Id: dict.w,v 1.121 1997/05/16 22:39:33 neto Exp neto $";@1.121log@Fix the pointer print spec.@text@d5 3d88 1a88 1const char *dict_rcs_id = "$Id: dict.w,v 1.120 1997/05/16 21:30:19 neto Exp neto $";d1014 2@1.120log@Fixed a printf spec: from integer to pointer.(This is in dicttest).@text@d5 4d85 1a85 1const char *dict_rcs_id = "$Id: dict.w,v 1.119 1997/05/16 18:11:41 neto Exp neto $";d913 1a913 1 printf("r == %x != NULL when it should be.\n", r);@1.119log@Break locks by david and neto.Include <config.h> and "lkconfig.h"@text@d5 4d81 1a81 1const char *dict_rcs_id = "$Id: dict.w,v 1.118 1997/05/16 18:09:40 neto Exp neto $";d909 1a909 1 printf("r == %d != NULL when it should be.\n", r);@1.118log@Include <config.h> and lkconfig.h@text@d5 3d77 1a77 1const char *dict_rcs_id = "$Id: dict.w,v 1.117 1997/05/16 16:45:31 neto Exp neto $";@1.117log@Make dicttest's main conform to ANSI standard by making it takeint, char ** arguments.@text@d5 4d67 2d74 1a74 1const char *dict_rcs_id = "$Id: dict.w,v 1.116 1997/05/16 16:34:16 neto Exp neto $";@1.116log@Removed dumb conditional in dicttest.@text@d5 3d68 1a68 1const char *dict_rcs_id = "$Id: dict.w,v 1.115 1997/05/16 16:21:31 neto Exp neto $";d818 1a818 1int main(void);d837 1a837 1main(void) @1.115log@Dont discard const.@text@d5 3d65 1a65 1const char *dict_rcs_id = "$Id: dict.w,v 1.114 1997/05/16 16:20:20 neto Exp neto $";d892 2a893 1 if ( r != NULL,"r == %d != NULL", r) {@1.114log@Add prototypes for functions in dicttest.@text@d5 3d62 1a62 1const char *dict_rcs_id = "$Id: dict.w,v 1.113 1997/05/14 20:23:29 neto Exp neto $";d817 1a817 1 return (*(int *)a)-(*(int *)b);@1.113log@dicttest.w doesn't actually use resource measurement. removed.@text@d4 4a7 1{\obeylines$Log: dict.w,v $d59 1a59 1const char *dict_rcs_id = "$Id: dict.w,v 1.112 97/01/27 16:35:30 neto Exp Locker: neto $";d806 8a813 2intintcmp(const void *a, const void *b) {d817 2a818 1void prn(void *a) {d821 3a823 1void del(void *a) {d827 3a829 1int main(void) {@1.112log@Fixed the function definition for dict\_ create@text@d4 4a7 1{\obeylines$Log: dict.w,v $d56 1a56 1const char *dict_rcs_id = "$Id: dict.w,v 1.111 1997/01/21 21:55:55 david Exp david $";a798 1#include "resource.h"a818 1 resource_setup(5);@1.111log@Added standard copyright notice by including copyrt.w@text@d4 4a7 1{\obeylines$Log: dict.w,v $d53 1a53 1const char *dict_rcs_id = "$Id: dict.w,v 1.110 96/12/17 10:58:36 neto Exp $";d231 1a231 3dict_t *dict_create(int the_cmp(const void *a, const void *b), void (*the_prn)(void *a)) {@1.110log@Fixed some dataflow analysis warnings.@text@d5 3d50 1a50 1const char *dict_rcs_id = "$Id: dict.w,v 1.109 96/08/20 11:30:14 neto Exp Locker: neto $";@1.109log@Fixed uninitialized variable l. That was a bug.Also fixed ggpl. Not a bug, but a dataflow analysis warning.@text@d5 4d47 1a47 1const char *dict_rcs_id = "$Id: dict.w,v 1.108 96/08/16 13:04:40 neto Exp $";d377 1a377 1 dict_node_t *p, *gp, *ggp; /* Parent, grandparent, and great-grandparent */d607 7d616 1d620 1a620 1 else { errorif(1,"Bug"); l=NILLINK; /* Satisfy the GCC dataflow analysis. */}@1.108log@Added fixincludes.@text@d5 3d43 1a43 1const char *dict_rcs_id = "$Id: dict.w,v 1.107 96/08/15 14:14:53 neto Exp $";d208 1d322 6a327 1point to its node, and set |l| to |SELF|. Otherwise, |next==NULL|, and d332 1d374 3a376 1 int pl, gpl,ggpl; /* Parent and grandparent links down to |here|. */d488 7a494 2if ( ggp ) { SETLINK(ggp,ggpl,here); }else { here->parent = NULL; d->root = here; }d608 1a608 1 else { errorif(1,"Bug"); }@1.107log@Adde prototype to satisfy all the warning options of GCC.@text@d5 3d40 1a40 1const char *dict_rcs_id = "$Id: dict.w,v 1.106 96/08/15 13:14:35 neto Exp $";d50 1@1.106log@Make it pass -Wall@text@d5 3d37 1a37 1const char *dict_rcs_id = "$Id: dict.w,v 1.105 96/08/02 14:20:24 neto Exp $";d711 1@1.105log@Allow others to get dict without first getting pool.@text@d5 3d34 1a34 1const char *dict_rcs_id = "$Id: dict.w,v 1.104 96/08/01 15:50:44 neto Exp $";d299 1a299 1 if ( was_absent = (l!=SELF) ) {d549 1a549 1int l,pl;d728 1a728 1 printf("%x",h);d732 4a735 1 printf("\" p=%x l=%x r=%x}",h->parent, h->left, h->right);@1.104log@Maked dict\_delete return the item it just deleted.@text@d5 3a26 1@@<Early module headers@@>@@;d31 1a31 1const char *dict_rcs_id = "$Id: dict.w,v 1.103 96/07/29 17:09:58 neto Exp $";d46 3d52 1a58 1d181 5a185 2@@ We need the interface for the pool-oriented allocator.@@<Early module headers@@>=@1.103log@Fixed to compile.@text@d5 3d29 1a29 1const char *dict_rcs_id = "$Id: dict.w,v 1.102 96/07/29 16:19:45 neto Exp $";d84 1a84 1|void dict_delete(dict_t *d, void *e, void (*action)(void *))| d89 4d94 1d123 1a123 1void dict_delete(dict_t *d, void *e, void (*action)(void *));d521 1a521 1void d523 1a523 1 dict_node_t *next, *here, *splay_this;d527 1d530 1@1.102log@Added *\_rcs\_id.Made sure RCS log is activated within this file.@text@d4 5a8 1{\obeylines$Log$a19 1const char dict_rcs_id[] = "$Id$";d26 1d41 1a41 1extern const char dict_rcs_id[] = "$Id$";@1.101log@Added dict_update_all.@text@a0 1d2 1d4 3d16 1d37 1d45 1@1.100log@This version works. Needs improvement: command-line switches faster tabu check allow Papadimitriou tabu rule faster preprocessing different candidate lists@text@d91 8d110 1d648 25@1.5log@Cosmetic changes mostly.Moved a couple of routines to the supported section.Added braces in one place.@text@@1.4log@Initial implementation of LK. This is buggy.@text@d8 3d61 4a64 1copy is {\it not} added.d99 3d122 3d250 1a250 1add anythingd541 1a541 1if ( ep ) d545 1d570 1d598 2a599 1@@ The |dict_any| routine just returns the root node. This is easy.a638 5@@ We must declare these functions.@@<Exported subroutines@@>=void *dict_delete_any(dict_t *d, void (*action)(void *));void *dict_min(dict_t *d);void *dict_max(dict_t *d);@1.3log@Fixed a TeX error.@text@d11 1d75 10d120 3d134 1d137 4d168 1d184 2a211 1 dict_node_t *freed_node;d213 1a213 1 freed_node = prev = here;d215 1a215 1 free_mem(freed_node); /* Doh! |free_mem| sets the lvalue to NULL. */d284 1a284 1 dict_node_t *node = new_of(dict_node_t);d484 2a485 3 dict_node_t *next, *here, *e_node, *ep, *splay_this; int l,pl;d488 1a488 18 e_node = next; if ( e_node ) { if ( e_node->left == NULL && e_node->right == NULL ) { @@<Remove the leaf |e_node|@@>@@; splay_this = e_node->parent; } else if ( e_node->left == NULL ) { @@<Promote |e_node->right|@@>@@; splay_this = e_node->right; } else if ( e_node->right == NULL ) { @@<Promote |e_node->left|@@>@@; splay_this = e_node->left; } else { @@<Replace |e_node| by a merge of its two children@@>@@; } if ( action ) action(e_node->payload); free_mem(e_node); here = splay_this; }d492 26d584 46d671 2d675 1@1.2log@Added test code.@text@d405 2a406 2$$((1A2)b3) \becomes (1A(2b3))$$$(1a(2B3)) \becomes ((1a2)B3)$@1.1log@Initial revision@text@d589 1a589 1dict_doall(dict_t *d, void (*action)(void *));d591 1a591 1dict_show_node(dict_t *d,dict_node_t *h);d593 8d602 170@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -