BEGIN { max_of_instances = 0; }

$1 == "PROCESS" {if( $6=="-" ){if( $5=="0" ){max_of_instances += 1}else{max_of_instances += $5}}else{max_of_instances += $6}}

END { print "#ifndef _RTDS_MEM_H_";
      print "#define _RTDS_MEM_H_";
      print "";
      print "#ifdef __cplusplus";
      print "extern \"C\" {";
      print "#endif";
      print ""
      print "#define MAX_INSTANCES", max_of_instances
      print "#define STACK_SIZE 150"
      print ""
      print "struct mappingOfTableOfStack"
      print "{"
      print "   int isFree;"
      print "   int numberOfTheInstance;"
      print "   struct mappingOfTableOfStack * next;"
      print "};"
      print ""
      print "struct mappingOfTableOfStack * my_mappingOfTableOfStack = NULL;"
      print ""
      print "/* This variable handles a multidimensionnal table where we can find a stack for any task of the system */ "
      print "OS_STACKPTR int tableOfStack[ MAX_INSTANCES ][ STACK_SIZE ];";
      print "";
      print "#ifdef __cplusplus";
      print "}";
      print "#endif";
      print "#endif /* _RTDS_MEM_H_ */"
      }