diff options
author | Andrea Smith <smit9523@umn.edu> | 2020-10-04 13:32:13 -0500 |
---|---|---|
committer | Andrea Smith <smit9523@umn.edu> | 2020-10-04 13:32:13 -0500 |
commit | f3c52c4ba22bf4f127ec7a94823b606f253dfdf3 (patch) | |
tree | 5eeff4370e7d9a934da3b70beefdd531186878f3 | |
parent | Finally fixes #4 (diff) | |
download | csci4061-f3c52c4ba22bf4f127ec7a94823b606f253dfdf3.tar csci4061-f3c52c4ba22bf4f127ec7a94823b606f253dfdf3.tar.gz csci4061-f3c52c4ba22bf4f127ec7a94823b606f253dfdf3.tar.bz2 csci4061-f3c52c4ba22bf4f127ec7a94823b606f253dfdf3.tar.lz csci4061-f3c52c4ba22bf4f127ec7a94823b606f253dfdf3.tar.xz csci4061-f3c52c4ba22bf4f127ec7a94823b606f253dfdf3.tar.zst csci4061-f3c52c4ba22bf4f127ec7a94823b606f253dfdf3.zip |
Update mapper
-rw-r--r-- | P1/src/mapper.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/P1/src/mapper.c b/P1/src/mapper.c index 3e0307d..d0db9a0 100644 --- a/P1/src/mapper.c +++ b/P1/src/mapper.c @@ -1,5 +1,7 @@ #include "mapper.h" +intermediateDS DS; + // combined value list corresponding to a word <1,1,1,1....> valueList *createNewValueListNode(char *value){ valueList *newNode = (valueList *)malloc (sizeof(valueList)); @@ -78,7 +80,7 @@ while (root != NULL) { // emit the <key, value> into intermediate DS // eats the data into the DS void emit(char *key, char *value) { - + insertPairToInterDS(&DS, key, value); } // map function @@ -95,9 +97,30 @@ void map(char *chunkData){ // write intermediate data to separate word.txt files // Each file will have only one line : word 1 1 1 1 1 ... -// poops the data out into separate .txt files +// poops the data out into separate .txt files named after the word void writeIntermediateDS() { + // Iterate through intermediate DS + // Create new word.txt + // Insert <word, value list> + + intermediateDS *tempNode = DS; + intermediateDS *tempNode2 = DS; + + // Traverse valueList + tempNode2 = tempNode2 -> value; + while(tempNode2 != NULL) { + + tempNode2 = tempNode -> next; + } + + // while(tempNode != NULL) { + // char filename[20]; + // sprintf(filename, "%s.txt", foo); + // FILE* fptr = fopen("%s.txt", "w"); + + // tempNode = tempNode -> next; + // } } int main(int argc, char *argv[]) { |