Revision 127, 1.8 KB
(checked in by andreu, 12 years ago)
|
Change copyright timestamp - Some correction on WEB Section
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[2] | 1 | |
---|
| 2 | |
---|
| 3 | |
---|
[28] | 4 | |
---|
[2] | 5 | |
---|
[127] | 6 | |
---|
[2] | 7 | |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | #include <stdio.h> |
---|
| 27 | #include <stdlib.h> |
---|
| 28 | #include "fields_mgmt.h" |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | |
---|
[23] | 33 | void printFieldSet(FILE *file, FieldPtr pf) |
---|
[2] | 34 | { |
---|
| 35 | FieldPtr tmp = pf; |
---|
| 36 | for (; tmp; tmp=tmp->next) { |
---|
[120] | 37 | fprintf(file, "%hu;%hu ", tmp->fieldType, tmp->fieldLength); |
---|
[2] | 38 | } |
---|
[23] | 39 | fprintf(file,"\n"); |
---|
[2] | 40 | } |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | |
---|
[27] | 45 | void invPrintFieldSet(FILE *file, FieldPtr pf) |
---|
[2] | 46 | { |
---|
| 47 | FieldPtr tmp = pf; |
---|
| 48 | for (; tmp; tmp=tmp->prev) { |
---|
[27] | 49 | fprintf(file, "(%hu,%hu) ", tmp->fieldType, tmp->fieldLength); |
---|
[2] | 50 | } |
---|
[27] | 51 | fprintf(file,"\n"); |
---|
[2] | 52 | } |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | void freeField(FieldPtr pf) { |
---|
| 59 | if (pf) { |
---|
| 60 | free(pf); |
---|
| 61 | pf = NULL; |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | FieldPtr |
---|
| 69 | addField (FieldPtr fp, unsigned short type, unsigned short length) |
---|
| 70 | { |
---|
| 71 | FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); |
---|
| 72 | if (tmp==NULL) { |
---|
| 73 | fprintf(stderr, "ERROR in malloc in addField function\n"); |
---|
| 74 | exit(1); |
---|
| 75 | } else { |
---|
| 76 | tmp->fieldType = type; |
---|
| 77 | tmp->fieldLength = length; |
---|
| 78 | tmp->next = fp; |
---|
| 79 | tmp->prev = NULL; |
---|
| 80 | return tmp; |
---|
| 81 | } |
---|
| 82 | return NULL; |
---|
| 83 | } |
---|