forked from lei.chen/myxce
fix typo of perflag && reformat .peg
This commit is contained in:
parent
12dcc2a60d
commit
ff6d4eeccd
4 changed files with 165 additions and 165 deletions
|
|
@ -487,7 +487,7 @@ int calc_wanted_global_resvals(xvec_idval_t* resvals, resmgr_t* resmgr,
|
|||
}
|
||||
|
||||
int calc_wanted_host_resvals(xvec_idval_t* resvals, resmgr_t* resmgr,
|
||||
xlist_t* rusages, rusage_per_type_t perfflag,
|
||||
xlist_t* rusages, rusage_per_type_t perflag,
|
||||
int nhosts, int nslots)
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -2,87 +2,87 @@
|
|||
%value "char *"
|
||||
%auxil "rusage_context_t *"
|
||||
%source {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if 0
|
||||
static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" };
|
||||
#define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \
|
||||
#if 0
|
||||
static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" };
|
||||
#define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \
|
||||
fprintf(stderr, "%*s%s %s @%zu [%.*s]\n", (int)((level) * 2), "", dbg_str[event], rule, pos, (int)(length), buffer)
|
||||
#endif
|
||||
#define PCC_ERROR(auxil) my_rusage_error(auxil)
|
||||
#endif
|
||||
#define PCC_ERROR(auxil) my_rusage_error(auxil)
|
||||
|
||||
static void my_rusage_error(rusage_context_t *auxil) {
|
||||
/* Calculate line/column from max_err */
|
||||
auxil->has_error = 1;
|
||||
static void my_rusage_error(rusage_context_t *auxil) {
|
||||
/* Calculate line/column from max_err */
|
||||
auxil->has_error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%common {
|
||||
#include "resreq.h"
|
||||
#include "xlist.h"
|
||||
#include "resreq.h"
|
||||
#include "xlist.h"
|
||||
|
||||
#define PCC_GETCHAR(auxil) \
|
||||
({ int c = (auxil->input[auxil->pos] != '\0') ? (int)auxil->input[auxil->pos ++]: -1; \
|
||||
if (auxil->pos > auxil->err_pos) auxil->err_pos = auxil->pos; \
|
||||
c; \
|
||||
})
|
||||
#define PCC_GETCHAR(auxil) \
|
||||
({ int c = (auxil->input[auxil->pos] != '\0') ? (int)auxil->input[auxil->pos ++]: -1; \
|
||||
if (auxil->pos > auxil->err_pos) auxil->err_pos = auxil->pos; \
|
||||
c; \
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
rusage_spec <- _ rusage_params _ EOF
|
||||
|
||||
rusage_params <- first:rusage_param _ ',' _ rest:rusage_params
|
||||
/ rusage_param
|
||||
/ rusage_param
|
||||
|
||||
rusage_param <- key:identifier _ '=' v:resvalue _ duration _ decay {
|
||||
rusage_value_t *rusage = (rusage_value_t *)calloc(1, sizeof(*rusage));
|
||||
if (rusage != NULL) {
|
||||
rusage->res = auxil->resname;
|
||||
rusage->per_flag = auxil->per_flag;
|
||||
rusage->value = auxil->resvalue;
|
||||
rusage->duration = auxil->duration_value;
|
||||
rusage->decay_flag = auxil->decay_flag;
|
||||
auxil->resname = NULL;
|
||||
rusage_value_t *rusage = (rusage_value_t *)calloc(1, sizeof(*rusage));
|
||||
if (rusage != NULL) {
|
||||
rusage->res = auxil->resname;
|
||||
rusage->per_flag = auxil->per_flag;
|
||||
rusage->value = auxil->resvalue;
|
||||
rusage->duration = auxil->duration_value;
|
||||
rusage->decay_flag = auxil->decay_flag;
|
||||
auxil->resname = NULL;
|
||||
|
||||
xlist_store(auxil->rusages, rusage);
|
||||
}
|
||||
xlist_store(auxil->rusages, rusage);
|
||||
}
|
||||
|
||||
if (auxil->resname != NULL) {
|
||||
free(auxil->resname);
|
||||
auxil->resname = NULL;
|
||||
}
|
||||
if (auxil->resname != NULL) {
|
||||
free(auxil->resname);
|
||||
auxil->resname = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
duration <- ':duration=' _ duration_value _
|
||||
/ empty_duration
|
||||
/ empty_duration
|
||||
|
||||
empty_duration <- { } { auxil->duration_value = -1.0; }
|
||||
|
||||
decay <- ':decay=' _ decay_value _
|
||||
/ empty_decay
|
||||
/ empty_decay
|
||||
|
||||
empty_decay <- { } { auxil->decay_flag = 0; }
|
||||
|
||||
identifier <- [a-zA-Z_][a-zA-Z_0-9]* { auxil->resname = strdup($0); }
|
||||
|
||||
resvalue <- number '/' per_type { auxil->resvalue = auxil->tmp_value; }
|
||||
/ number { auxil->resvalue = auxil->tmp_value; auxil->per_flag = PER_DEFAULT; }
|
||||
/ number { auxil->resvalue = auxil->tmp_value; auxil->per_flag = PER_DEFAULT; }
|
||||
|
||||
per_type <- 'task' { auxil->per_flag = PER_TASK; }
|
||||
/ 'job' { auxil->per_flag = PER_JOB; }
|
||||
/ 'host' { auxil->per_flag = PER_HOST; }
|
||||
/ 'job' { auxil->per_flag = PER_JOB; }
|
||||
/ 'host' { auxil->per_flag = PER_HOST; }
|
||||
|
||||
duration_value <- v:number duration_unit { auxil->duration_value = auxil->tmp_value * auxil->duration_multiply; }
|
||||
/ v:number { auxil->duration_value = auxil->tmp_value * 60.0; }
|
||||
/ v:number { auxil->duration_value = auxil->tmp_value * 60.0; }
|
||||
|
||||
duration_unit <- 'h' { auxil->duration_multiply = 3600.0; }
|
||||
/ 'm' { auxil->duration_multiply = 60.0; }
|
||||
/ 's' { auxil->duration_multiply = 1.0; }
|
||||
/ 'm' { auxil->duration_multiply = 60.0; }
|
||||
/ 's' { auxil->duration_multiply = 1.0; }
|
||||
|
||||
decay_value <- '0' { auxil->decay_flag = 0; }
|
||||
/ '1' { auxil->decay_flag = 1; }
|
||||
/ '1' { auxil->decay_flag = 1; }
|
||||
|
||||
number <- < [0-9]+('.'[0-9]*)? > { auxil->tmp_value = atof($0); }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,45 +2,45 @@
|
|||
%value "char *"
|
||||
%auxil "section_context_t *"
|
||||
%source {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if 0
|
||||
static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" };
|
||||
#define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \
|
||||
#if 0
|
||||
static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" };
|
||||
#define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \
|
||||
fprintf(stderr, "%*s%s %s @%zu [%.*s]\n", (int)((level) * 2), "", dbg_str[event], rule, pos, (int)(length), buffer)
|
||||
#endif
|
||||
#define PCC_ERROR(auxil) my_report_error(auxil)
|
||||
#endif
|
||||
#define PCC_ERROR(auxil) my_report_error(auxil)
|
||||
|
||||
void my_report_error(section_context_t *auxil) {
|
||||
/* Calculate line/column from max_err */
|
||||
auxil->has_error = 1;
|
||||
void my_report_error(section_context_t *auxil) {
|
||||
/* Calculate line/column from max_err */
|
||||
auxil->has_error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%common {
|
||||
#include "resreq.h"
|
||||
#include "resreq.h"
|
||||
|
||||
#define PCC_GETCHAR(auxil) \
|
||||
({ int c = (auxil->input[auxil->pos] != '\0') ? (int)auxil->input[auxil->pos ++]: -1; \
|
||||
if (auxil->pos > auxil->err_pos) auxil->err_pos = auxil->pos; \
|
||||
c; \
|
||||
})
|
||||
#define PCC_GETCHAR(auxil) \
|
||||
({ int c = (auxil->input[auxil->pos] != '\0') ? (int)auxil->input[auxil->pos ++]: -1; \
|
||||
if (auxil->pos > auxil->err_pos) auxil->err_pos = auxil->pos; \
|
||||
c; \
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
statement <- _ resource_statement _ EOF
|
||||
|
||||
resource_statement <- select:select_clause? _ usage:usage_clause? _ span:span_clause? _ same:same_clause? _ affinity:affinity_clause? {
|
||||
auxil->data.selectString = select;
|
||||
auxil->data.rusageString = usage;
|
||||
auxil->data.spanString = span;
|
||||
auxil->data.sameString = same;
|
||||
auxil->data.affinityString = affinity;
|
||||
$$ = NULL;
|
||||
}
|
||||
auxil->data.selectString = select;
|
||||
auxil->data.rusageString = usage;
|
||||
auxil->data.spanString = span;
|
||||
auxil->data.sameString = same;
|
||||
auxil->data.affinityString = affinity;
|
||||
$$ = NULL;
|
||||
}
|
||||
|
||||
select_clause <- "select[" _ s:select_statement _ "]" { $$ = s; }
|
||||
/ s:select_statement {$$ = s; }
|
||||
|
|
@ -56,15 +56,15 @@ usage_clause <- "rusage[" _ usage:usage_statement _ "]" { $$ = usage; }
|
|||
|
||||
|
||||
usage_statement <- (!("span[" / "]") .)* { $$ = strdup($0); }
|
||||
/ (!("same[" / "]") .)* { $$ = strdup($0); }
|
||||
/ (!("affinity[" / "]") .)* { $$ = strdup($0); }
|
||||
/ (!("same[" / "]") .)* { $$ = strdup($0); }
|
||||
/ (!("affinity[" / "]") .)* { $$ = strdup($0); }
|
||||
|
||||
|
||||
span_clause <- "span[" _ span:span_statement _ "]" { $$ = span; }
|
||||
|
||||
|
||||
span_statement <- (!("same[" / "]") .)* { $$ = strdup($0); }
|
||||
/ (!("affinity[" / "]") .)* { $$ = strdup($0); }
|
||||
/ (!("affinity[" / "]") .)* { $$ = strdup($0); }
|
||||
|
||||
|
||||
same_clause <- "same[" _ same:same_statement _ "]" { $$ = same; }
|
||||
|
|
|
|||
|
|
@ -2,113 +2,113 @@
|
|||
%value "char *"
|
||||
%auxil "resreq_context_t *"
|
||||
%source {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if 0
|
||||
static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" };
|
||||
#define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \
|
||||
#if 0
|
||||
static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" };
|
||||
#define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \
|
||||
fprintf(stderr, "%*s%s %s @%zu [%.*s]\n", (int)((level) * 2), "", dbg_str[event], rule, pos, (int)(length), buffer)
|
||||
#endif
|
||||
#define PCC_ERROR(auxil) my_resreq_error(auxil)
|
||||
#endif
|
||||
#define PCC_ERROR(auxil) my_resreq_error(auxil)
|
||||
|
||||
static void my_resreq_error(resreq_context_t *auxil) {
|
||||
/* Calculate line/column from max_err */
|
||||
auxil->has_error = 1;
|
||||
static void my_resreq_error(resreq_context_t *auxil) {
|
||||
/* Calculate line/column from max_err */
|
||||
auxil->has_error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%common {
|
||||
#include "resreq.h"
|
||||
#include "xlist.h"
|
||||
#include "resreq.h"
|
||||
#include "xlist.h"
|
||||
|
||||
#define PCC_GETCHAR(auxil) \
|
||||
({ int c = (auxil->input[auxil->pos] != '\0') ? (int)auxil->input[auxil->pos ++]: -1; \
|
||||
if (auxil->pos > auxil->err_pos) auxil->err_pos = auxil->pos; \
|
||||
c; \
|
||||
})
|
||||
#define PCC_GETCHAR(auxil) \
|
||||
({ int c = (auxil->input[auxil->pos] != '\0') ? (int)auxil->input[auxil->pos ++]: -1; \
|
||||
if (auxil->pos > auxil->err_pos) auxil->err_pos = auxil->pos; \
|
||||
c; \
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
statement <- _ resreq _ EOF
|
||||
|
||||
resreq <- alter_resreq {
|
||||
xce_resreq_t *resreq = auxil->resreq;
|
||||
resreq->tag = XCE_RESREQ_ALTER;
|
||||
resreq->u.alter = auxil->alter;
|
||||
auxil->alter = NULL;
|
||||
}
|
||||
/ compound_resreq {
|
||||
xce_resreq_t *resreq = auxil->resreq;
|
||||
if (resreq != NULL) {
|
||||
resreq->tag = XCE_RESREQ_COMPOUND;
|
||||
resreq->u.compound = auxil->compound;
|
||||
auxil->compound = NULL;
|
||||
}
|
||||
}
|
||||
/ primary_resreq {
|
||||
xce_resreq_t *resreq = auxil->resreq;
|
||||
if (resreq != NULL) {
|
||||
resreq->tag = XCE_RESREQ_PRIMARY;
|
||||
resreq->u.primary = auxil->primary;
|
||||
auxil->primary = NULL;
|
||||
}
|
||||
}
|
||||
xce_resreq_t *resreq = auxil->resreq;
|
||||
resreq->tag = XCE_RESREQ_ALTER;
|
||||
resreq->u.alter = auxil->alter;
|
||||
auxil->alter = NULL;
|
||||
}
|
||||
/ compound_resreq {
|
||||
xce_resreq_t *resreq = auxil->resreq;
|
||||
if (resreq != NULL) {
|
||||
resreq->tag = XCE_RESREQ_COMPOUND;
|
||||
resreq->u.compound = auxil->compound;
|
||||
auxil->compound = NULL;
|
||||
}
|
||||
}
|
||||
/ primary_resreq {
|
||||
xce_resreq_t *resreq = auxil->resreq;
|
||||
if (resreq != NULL) {
|
||||
resreq->tag = XCE_RESREQ_PRIMARY;
|
||||
resreq->u.primary = auxil->primary;
|
||||
auxil->primary = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
alter_resreq <- alter_resreq_term _ ('||' _ alter_resreq_term _)*
|
||||
|
||||
alter_resreq_term <- '{' _ compound_resreq _ '}' _ {
|
||||
xce_alter_resreq_t *alter = auxil->alter;
|
||||
if (alter == NULL) {
|
||||
alter = (xce_alter_resreq_t *)calloc(1, sizeof(*alter));
|
||||
if (alter != NULL) {
|
||||
xlist_init(&(alter->compounds), 8);
|
||||
}
|
||||
xce_alter_resreq_t *alter = auxil->alter;
|
||||
if (alter == NULL) {
|
||||
alter = (xce_alter_resreq_t *)calloc(1, sizeof(*alter));
|
||||
if (alter != NULL) {
|
||||
xlist_init(&(alter->compounds), 8);
|
||||
}
|
||||
|
||||
auxil->alter = alter;
|
||||
}
|
||||
auxil->alter = alter;
|
||||
}
|
||||
|
||||
if (alter != NULL) {
|
||||
if (auxil->compound != NULL) {
|
||||
xlist_store(&(alter->compounds), auxil->compound);
|
||||
auxil->compound = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alter != NULL) {
|
||||
if (auxil->compound != NULL) {
|
||||
xlist_store(&(alter->compounds), auxil->compound);
|
||||
auxil->compound = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compound_resreq <- compound_resreq_term _ ('+' _ compound_resreq_term _)*
|
||||
|
||||
compound_resreq_term <- < int_num _ '*' _ '{' _ primary_resreq _ '}' _
|
||||
/ '{' _ primary_resreq _ '}' _ > {
|
||||
xce_compound_resreq_t *compound = auxil->compound;
|
||||
if (compound == NULL) {
|
||||
compound = (xce_compound_resreq_t *)calloc(1, sizeof(*compound));
|
||||
if (compound != NULL) {
|
||||
xlist_init(&(compound->primaries), 8);
|
||||
}
|
||||
auxil->compound = compound;
|
||||
}
|
||||
/ '{' _ primary_resreq _ '}' _ > {
|
||||
xce_compound_resreq_t *compound = auxil->compound;
|
||||
if (compound == NULL) {
|
||||
compound = (xce_compound_resreq_t *)calloc(1, sizeof(*compound));
|
||||
if (compound != NULL) {
|
||||
xlist_init(&(compound->primaries), 8);
|
||||
}
|
||||
auxil->compound = compound;
|
||||
}
|
||||
|
||||
if (compound != NULL) {
|
||||
xce_primary_resreq_t *primary = auxil->primary;
|
||||
if (compound != NULL) {
|
||||
xce_primary_resreq_t *primary = auxil->primary;
|
||||
|
||||
if (primary != NULL) {
|
||||
primary->minTasks = auxil->resreq_fact_count;
|
||||
primary->maxTasks = auxil->resreq_fact_count;
|
||||
xlist_store(&(compound->primaries), primary);
|
||||
auxil->primary = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (primary != NULL) {
|
||||
primary->minTasks = auxil->resreq_fact_count;
|
||||
primary->maxTasks = auxil->resreq_fact_count;
|
||||
xlist_store(&(compound->primaries), primary);
|
||||
auxil->primary = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
primary_resreq <- < (! ('{' / '}' ) .)* > {
|
||||
xce_primary_resreq_t *primary = (xce_primary_resreq_t *)calloc(1, sizeof(*primary));
|
||||
if (primary != NULL) {
|
||||
auxil->primary = primary;
|
||||
parse_resreq_primary(primary, (char *)$0, &(auxil->errmsg));
|
||||
}
|
||||
}
|
||||
xce_primary_resreq_t *primary = (xce_primary_resreq_t *)calloc(1, sizeof(*primary));
|
||||
if (primary != NULL) {
|
||||
auxil->primary = primary;
|
||||
parse_resreq_primary(primary, (char *)$0, &(auxil->errmsg));
|
||||
}
|
||||
}
|
||||
|
||||
int_num <- < [0-9]+ > { auxil->resreq_fact_count = atoi($0); }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue