From f3c52c4ba22bf4f127ec7a94823b606f253dfdf3 Mon Sep 17 00:00:00 2001 From: Andrea Smith Date: Sun, 4 Oct 2020 13:32:13 -0500 Subject: Update mapper --- P1/src/mapper.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'P1') 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 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 + + 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[]) { -- cgit v1.2.3