Changeset 11007 for trunk/Ohana/src/opihi/lib.data/page.c
- Timestamp:
- Jan 10, 2007, 7:43:40 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.data/page.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.data/page.c
r10997 r11007 24 24 } 25 25 26 /* return the given book*/26 /* return the given page */ 27 27 Page *GetPage (Book *book, int where) { 28 28 … … 33 33 if (where >= book[0].Npages) return NULL; 34 34 return (book[0].pages[where]); 35 } 36 37 /* return the given page with key restrictions */ 38 Page *GetPageRestricted (Book *book, int where, char *keyName, char *keyValue) { 39 40 int i; 41 int N, Nout; 42 char *value; 43 44 if (where < 0) where += book[0].Npages; 45 if (where < 0) return NULL; 46 if (where >= book[0].Npages) return NULL; 47 48 if (where >= 0) { 49 N = -1; 50 for (i = 0; (i < book[0].Npages) && (N < where); i++) { 51 value = BookGetWord (book[0].pages[i], keyName); 52 if ((value == NULL) && !strcmp (keyValue, "NULL")) { 53 N++; 54 Nout = i; 55 } 56 if ((value != NULL) && !strcmp (keyValue, value)) { 57 N++; 58 Nout = i; 59 } 60 } 61 } else { 62 N = 0; 63 for (i = book[0].Npages - 1; (i >= 0) && (N > where); i--) { 64 value = BookGetWord (book[0].pages[i], keyName); 65 if ((value == NULL) && !strcmp (keyValue, "NULL")) { 66 N--; 67 } 68 if ((value != NULL) && !strcmp (keyValue, value)) { 69 N--; 70 } 71 } 72 } 73 74 if (N != where) return NULL; 75 76 return (book[0].pages[Nout]); 35 77 } 36 78
Note:
See TracChangeset
for help on using the changeset viewer.
