<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "SeqNode.h"
#include "SeqUtil.h"
static char* FamilyTypeString = "Family";
static char* TaskTypeString = "Task";
static char* NpassTaskTypeString = "NpassTask";
static char* LoopTypeString = "Loop";
static char* CaseTypeString = "Case";
static char* CaseItemTypeString = "CaseItem";
static char* ModuleTypeString = "Module";

/* this function is just a simple enabling of printf calls when
the user passes -d option */
char* SeqNode_getTypeString( SeqNodeType _node_type ) {
   char* typePtr = NULL;
   switch (_node_type) {
      case Task:
         typePtr = TaskTypeString;
         break;
      case NpassTask:
         typePtr = NpassTaskTypeString;
         break;
      case Family:
         typePtr = FamilyTypeString;
         break;
      case Module:
         typePtr = ModuleTypeString;
         break;
      case Loop:
         typePtr = LoopTypeString;
         break;
      case Case:
         typePtr = CaseTypeString;
         break;
      case CaseItem:
         typePtr = CaseItemTypeString;
         break;
      default:
         typePtr = TaskTypeString;
   }
   return typePtr;
}

void SeqNode_setName ( SeqNodeDataPtr node_ptr, const char* name ) {
   if ( name != NULL ) {
      free( node_ptr->name );
      node_ptr->name = malloc( strlen(name) + 1 );
      strcpy( node_ptr->name, name );
   }
}

void SeqNode_setNodeName ( SeqNodeDataPtr node_ptr, const char* nodeName ) {
   if ( nodeName != NULL ) {
      free( node_ptr->nodeName );
      node_ptr->nodeName = malloc( strlen(nodeName) + 1 );
      strcpy( node_ptr->nodeName, nodeName );
   }
}

void SeqNode_setModule ( SeqNodeDataPtr node_ptr, const char* module ) {
   if ( module != NULL ) {
      free( node_ptr->module );
      node_ptr->module = malloc( strlen(module) + 1 );
      strcpy( node_ptr->module, module );
   }
}

void SeqNode_setIntramoduleContainer ( SeqNodeDataPtr node_ptr, const char* intramodule_container ) {
   if( intramodule_container != NULL ) {
      free( node_ptr->intramodule_container );
      node_ptr->intramodule_container = malloc( strlen(intramodule_container) + 1 );
      strcpy( node_ptr->intramodule_container, intramodule_container );
   }
}

void SeqNode_setContainer ( SeqNodeDataPtr node_ptr, const char* container ) {
   if( container != NULL ) {
      free( node_ptr->container );
      node_ptr->container = malloc( strlen(container) + 1 );
      strcpy( node_ptr->container, container );
   }
}

void SeqNode_setCpu ( SeqNodeDataPtr node_ptr, const char* cpu ) {
   char *tmpstrtok=NULL;
   char *tmpCpu=NULL;
   if ( cpu != NULL ) {
      free( node_ptr->cpu );
      node_ptr->cpu = malloc( strlen(cpu) + 1 );
      strcpy( node_ptr->cpu, cpu );
      tmpCpu=strdup(cpu);
  
      /* parse NPEX */
      tmpstrtok = (char*) strtok( tmpCpu, "x" );
      if ( tmpstrtok != NULL ) {
          free( node_ptr->npex );
	  node_ptr->npex=malloc( strlen(tmpstrtok) +1); 
	  strcpy(node_ptr->npex, tmpstrtok);
      }
      /* NPEY */
      tmpstrtok = (char*) strtok( NULL, "x" );
      if ( tmpstrtok != NULL ) {
          free( node_ptr->npey );
	  node_ptr->npey=malloc( strlen(tmpstrtok) +1); 
	  strcpy(node_ptr->npey, tmpstrtok);
      }
      /* OMP */
      tmpstrtok = (char*) strtok( NULL, "x" );
      if ( tmpstrtok != NULL ) {
          free( node_ptr->omp );
	  node_ptr->omp=malloc( strlen(tmpstrtok) +1); 
	  strcpy(node_ptr->omp, tmpstrtok);
      }
   free (tmpCpu);
   }
}

void SeqNode_setCpuMultiplier ( SeqNodeDataPtr node_ptr, const char* cpu_multiplier ) {
  char *tmpMult=NULL;
  char *tmpMultTok=NULL;
  int mult=1;
  tmpMult = strdup(cpu_multiplier);
  if ( cpu_multiplier != NULL ) {
    tmpMultTok = (char*) strtok( tmpMult, "x" );
    while ( tmpMultTok != NULL ) {
      mult = mult * atoi(tmpMultTok);
      tmpMultTok = (char*) strtok( NULL, "x" );
    }
    sprintf(tmpMult,"%d",mult);
    free( node_ptr->cpu_multiplier );
    node_ptr->cpu_multiplier = malloc( strlen(cpu_multiplier) + 1 );
    strcpy( node_ptr->cpu_multiplier, tmpMult );
    free (tmpMultTok);
  }
   free (tmpMult);
}

void SeqNode_setMachine ( SeqNodeDataPtr node_ptr, const char* machine ) {
   if ( machine != NULL ) {
      free( node_ptr->machine );
      node_ptr->machine = malloc( strlen(machine) + 1 );
      strcpy( node_ptr->machine, machine );
   }
}

void SeqNode_setMemory ( SeqNodeDataPtr node_ptr, const char* memory ) {
   if ( memory != NULL ) {
      free( node_ptr->memory );
      node_ptr->memory = malloc( strlen(memory) + 1 );
      strcpy( node_ptr->memory, memory );
   }
}

void SeqNode_setQueue ( SeqNodeDataPtr node_ptr, const char* queue ) {
   if ( queue != NULL ) {
      free( node_ptr->queue );
      node_ptr->queue = malloc( strlen(queue) + 1 );
      strcpy( node_ptr->queue, queue );
   }
}

void SeqNode_setSuiteName ( SeqNodeDataPtr node_ptr, const char* suiteName ) {
   if ( suiteName != NULL ) {
      free( node_ptr->suiteName );
      node_ptr->suiteName = malloc( strlen(suiteName) + 1 );
      strcpy( node_ptr->suiteName, suiteName );
   }
}

void SeqNode_setInternalPath ( SeqNodeDataPtr node_ptr, const char* path ) {
   if ( path != NULL ) {
      free( node_ptr->taskPath );
      node_ptr->taskPath = malloc( strlen(path) + 1 );
      strcpy( node_ptr->taskPath, path );
   }
}

void SeqNode_setArgs ( SeqNodeDataPtr node_ptr, const char* args ) {
   if ( args != NULL ) {
      free( node_ptr->args );
      node_ptr->args = malloc( strlen(args) + 1 );
      strcpy( node_ptr->args, args );
   }
}

void SeqNode_setSoumetArgs ( SeqNodeDataPtr node_ptr, char* soumetArgs ) {
   if ( soumetArgs != NULL ) {
      printf("extra args 2 %s \n", soumetArgs);
      free( node_ptr->soumetArgs );
      node_ptr->soumetArgs = malloc( strlen(soumetArgs) + 1 );
      strcpy( node_ptr->soumetArgs, soumetArgs );
   }
}

void SeqNode_setLoopArgs ( SeqNodeDataPtr node_ptr, SeqNameValuesPtr _loop_args ) {
   if ( _loop_args != NULL ) {
      SeqNameValues_deleteWholeList( &(node_ptr->loop_args) );
      node_ptr->loop_args = SeqNameValues_clone( _loop_args );<commit_msg>Removed testing trace<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "SeqNode.h"
#include "SeqUtil.h"
static char* FamilyTypeString = "Family";
static char* TaskTypeString = "Task";
static char* NpassTaskTypeString = "NpassTask";
static char* LoopTypeString = "Loop";
static char* CaseTypeString = "Case";
static char* CaseItemTypeString = "CaseItem";
static char* ModuleTypeString = "Module";

/* this function is just a simple enabling of printf calls when
the user passes -d option */
char* SeqNode_getTypeString( SeqNodeType _node_type ) {
   char* typePtr = NULL;
   switch (_node_type) {
      case Task:
         typePtr = TaskTypeString;
         break;
      case NpassTask:
         typePtr = NpassTaskTypeString;
         break;
      case Family:
         typePtr = FamilyTypeString;
         break;
      case Module:
         typePtr = ModuleTypeString;
         break;
      case Loop:
         typePtr = LoopTypeString;
         break;
      case Case:
         typePtr = CaseTypeString;
         break;
      case CaseItem:
         typePtr = CaseItemTypeString;
         break;
      default:
         typePtr = TaskTypeString;
   }
   return typePtr;
}

void SeqNode_setName ( SeqNodeDataPtr node_ptr, const char* name ) {
   if ( name != NULL ) {
      free( node_ptr->name );
      node_ptr->name = malloc( strlen(name) + 1 );
      strcpy( node_ptr->name, name );
   }
}

void SeqNode_setNodeName ( SeqNodeDataPtr node_ptr, const char* nodeName ) {
   if ( nodeName != NULL ) {
      free( node_ptr->nodeName );
      node_ptr->nodeName = malloc( strlen(nodeName) + 1 );
      strcpy( node_ptr->nodeName, nodeName );
   }
}

void SeqNode_setModule ( SeqNodeDataPtr node_ptr, const char* module ) {
   if ( module != NULL ) {
      free( node_ptr->module );
      node_ptr->module = malloc( strlen(module) + 1 );
      strcpy( node_ptr->module, module );
   }
}

void SeqNode_setIntramoduleContainer ( SeqNodeDataPtr node_ptr, const char* intramodule_container ) {
   if( intramodule_container != NULL ) {
      free( node_ptr->intramodule_container );
      node_ptr->intramodule_container = malloc( strlen(intramodule_container) + 1 );
      strcpy( node_ptr->intramodule_container, intramodule_container );
   }
}

void SeqNode_setContainer ( SeqNodeDataPtr node_ptr, const char* container ) {
   if( container != NULL ) {
      free( node_ptr->container );
      node_ptr->container = malloc( strlen(container) + 1 );
      strcpy( node_ptr->container, container );
   }
}

void SeqNode_setCpu ( SeqNodeDataPtr node_ptr, const char* cpu ) {
   char *tmpstrtok=NULL;
   char *tmpCpu=NULL;
   if ( cpu != NULL ) {
      free( node_ptr->cpu );
      node_ptr->cpu = malloc( strlen(cpu) + 1 );
      strcpy( node_ptr->cpu, cpu );
      tmpCpu=strdup(cpu);
  
      /* parse NPEX */
      tmpstrtok = (char*) strtok( tmpCpu, "x" );
      if ( tmpstrtok != NULL ) {
          free( node_ptr->npex );
	  node_ptr->npex=malloc( strlen(tmpstrtok) +1); 
	  strcpy(node_ptr->npex, tmpstrtok);
      }
      /* NPEY */
      tmpstrtok = (char*) strtok( NULL, "x" );
      if ( tmpstrtok != NULL ) {
          free( node_ptr->npey );
	  node_ptr->npey=malloc( strlen(tmpstrtok) +1); 
	  strcpy(node_ptr->npey, tmpstrtok);
      }
      /* OMP */
      tmpstrtok = (char*) strtok( NULL, "x" );
      if ( tmpstrtok != NULL ) {
          free( node_ptr->omp );
	  node_ptr->omp=malloc( strlen(tmpstrtok) +1); 
	  strcpy(node_ptr->omp, tmpstrtok);
      }
   free (tmpCpu);
   }
}

void SeqNode_setCpuMultiplier ( SeqNodeDataPtr node_ptr, const char* cpu_multiplier ) {
  char *tmpMult=NULL;
  char *tmpMultTok=NULL;
  int mult=1;
  tmpMult = strdup(cpu_multiplier);
  if ( cpu_multiplier != NULL ) {
    tmpMultTok = (char*) strtok( tmpMult, "x" );
    while ( tmpMultTok != NULL ) {
      mult = mult * atoi(tmpMultTok);
      tmpMultTok = (char*) strtok( NULL, "x" );
    }
    sprintf(tmpMult,"%d",mult);
    free( node_ptr->cpu_multiplier );
    node_ptr->cpu_multiplier = malloc( strlen(cpu_multiplier) + 1 );
    strcpy( node_ptr->cpu_multiplier, tmpMult );
    free (tmpMultTok);
  }
   free (tmpMult);
}

void SeqNode_setMachine ( SeqNodeDataPtr node_ptr, const char* machine ) {
   if ( machine != NULL ) {
      free( node_ptr->machine );
      node_ptr->machine = malloc( strlen(machine) + 1 );
      strcpy( node_ptr->machine, machine );
   }
}

void SeqNode_setMemory ( SeqNodeDataPtr node_ptr, const char* memory ) {
   if ( memory != NULL ) {
      free( node_ptr->memory );
      node_ptr->memory = malloc( strlen(memory) + 1 );
      strcpy( node_ptr->memory, memory );
   }
}

void SeqNode_setQueue ( SeqNodeDataPtr node_ptr, const char* queue ) {
   if ( queue != NULL ) {
      free( node_ptr->queue );
      node_ptr->queue = malloc( strlen(queue) + 1 );
      strcpy( node_ptr->queue, queue );
   }
}

void SeqNode_setSuiteName ( SeqNodeDataPtr node_ptr, const char* suiteName ) {
   if ( suiteName != NULL ) {
      free( node_ptr->suiteName );
      node_ptr->suiteName = malloc( strlen(suiteName) + 1 );
      strcpy( node_ptr->suiteName, suiteName );
   }
}

void SeqNode_setInternalPath ( SeqNodeDataPtr node_ptr, const char* path ) {
   if ( path != NULL ) {
      free( node_ptr->taskPath );
      node_ptr->taskPath = malloc( strlen(path) + 1 );
      strcpy( node_ptr->taskPath, path );
   }
}

void SeqNode_setArgs ( SeqNodeDataPtr node_ptr, const char* args ) {
   if ( args != NULL ) {
      free( node_ptr->args );
      node_ptr->args = malloc( strlen(args) + 1 );
      strcpy( node_ptr->args, args );
   }
}

void SeqNode_setSoumetArgs ( SeqNodeDataPtr node_ptr, char* soumetArgs ) {
   if ( soumetArgs != NULL ) {
      free( node_ptr->soumetArgs );
      node_ptr->soumetArgs = malloc( strlen(soumetArgs) + 1 );
      strcpy( node_ptr->soumetArgs, soumetArgs );
   }
}

void SeqNode_setLoopArgs ( SeqNodeDataPtr node_ptr, SeqNameValuesPtr _loop_args ) {
   if ( _loop_args != NULL ) {
      SeqNameValues_deleteWholeList( &(node_ptr->loop_args) );
      node_ptr->loop_args = SeqNameValues_clone( _loop_args );
{'fraction_non_alphanumeric': 0.12674683132921677, 'fraction_numerical': 0.0030061748456288594, 'mean_word_length': 2.9604247104247103, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2429728', 'n_tokens_mistral': 4295, 'n_tokens_neox': 4213, 'n_words': 950}