Skip to content

Args - #59

Open
raykpridgen wants to merge 2 commits into
MigeljanImeri:xdd-2.0from
raykpridgen:args
Open

Args#59
raykpridgen wants to merge 2 commits into
MigeljanImeri:xdd-2.0from
raykpridgen:args

Conversation

@raykpridgen

Copy link
Copy Markdown

Issue #58

Initial errors / typos

Logic changes

New parse function: bytes to suffix

Testing Changes

Updated documentation
Comment thread src/client/parse.c Outdated
Comment thread src/client/parse_func.c
int args, i;
int target_number;
int args = 0;
int i;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c Outdated
Comment thread src/common/parse.h

/* The format of the entries in the xdd function table */
typedef int (*func_ptr)(xdd_plan_t *planp, int32_t argc, char *argv[], uint32_t flags);
typedef int (*func_ptr)(xdd_plan_t *planp, int32_t argc, char *argv[], uint32_t flags, int32_t target);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment saying what return values mean

@calccrypto calccrypto mentioned this pull request Jul 31, 2026
Comment thread src/client/parse_func.c
int args, args_index;
int target_number;
int args = 0;
int args_index;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c
int args, i;
int target_number;
int args = 0;
int i;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c Outdated
int args, i; // Number of args and a counter
int target_number; // The specific target number to update
int args = 0; // args
int i; // counter

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c
int args, i;
int target_number;
int args = 0;
int i;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c
int args, i;
int target_number;
int args = 0;
int i;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

Comment thread src/client/parse_func.c
Comment thread src/client/parse_func.c
Comment on lines +2573 to 2576
int args = 0;
int i;

target_data_t *tdp;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c Outdated
Comment on lines 2614 to 2618
int args = 0;
int i;

target_data_t *tdp;
int64_t numreqs;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align or dont; either way clean these up

Comment thread src/client/parse_func.c
{
int args;
int target_number;
int args = 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is args ever used with a value that is not 0?

Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c Outdated
Comment thread src/client/parse_func.c Outdated
Comment thread tests/functional/test_xdd_arg_scope_logic.sh Outdated
finalize_test 1 "${name} crashed on bad grammar (exit ${rc}): $* (see ${log_file})"
fi
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe pass in some 0s to make sure you can distinguish between errors and 0 values

@raykpridgen
raykpridgen force-pushed the args branch 2 times, most recently from d3726e7 to 24311c6 Compare August 5, 2026 16:02
Comment thread src/client/parse_func.c
Comment on lines +4529 to +4539
else if (strtol(argv[1], NULL, 0) < 0)
{
fprintf(xgp->errout,
"%s: ERROR in '%s': number of targets cannnot be negative: %s\n", xgp->progname, argv[0], argv[1]);
return(-1);
}

// Phase 1
if (flags & XDD_PARSE_PHASE1) {
k = planp->number_of_targets; // Keep the current number of targets we have
planp->number_of_targets = atoi(argv[1]); // get the number of targets to add to the list
if (planp->number_of_targets < 0) { // Set all the target names to the single name specified
// Check to see if the target name is actually an "option" - this may be a syntax error on the command line
if (*argv[2] == '-') {
status = xdd_check_option(argv[2]);
if (status != 0) {
fprintf(xgp->errout,"%s: syntax error in '%s' specification: target name cannot be an xdd 'option': %s\n",
xgp->progname, argv[0], argv[2]);
return(-1);
}
}
i = 3; // Set for the return value
planp->number_of_targets *= -1; // make this a positive number
planp->number_of_targets += k; // add in the previous number of targets
for (j=k; j<planp->number_of_targets; j++) { // This will add targets to the end of the current list of targets
// Call xdd_get_target_datap() for each target and put the same target name in each Target Data
// Make sure the Target Data for this target exists - if it does not, the xdd_get_target_datap() subroutine will create one
tdp = xdd_get_target_datap(planp, j, argv[0]);
if (tdp == NULL) return(-1);

tdp->td_target_basename = argv[2];
if (strcmp(tdp->td_target_basename,"null") == 0)
tdp->td_target_options |= TO_NULL_TARGET;
} // end of FOR loop that places a single target name on each of the associated Target Data
} else { // Set all target names to the appropriate name
i = 2; // start with the third argument
planp->number_of_targets += k; // add in the previous number of targets
for (j=k; j<planp->number_of_targets; j++) { // This will add targets to the end of the current list of targets
// Make sure the Target Data for this target exists - if it does not, the xdd_get_target_datap() subroutine will create one
tdp = xdd_get_target_datap(planp, j, argv[0]);
if (tdp == NULL) return(-1);
tdp->td_target_basename = argv[i];
if (strcmp(tdp->td_target_basename,"null") == 0)
tdp->td_target_options |= TO_NULL_TARGET;
i++;
}
}
return(i);
} else { // Phase 2 we need to figure out how many targets are specified but not to process them
k = atoi(argv[1]); // get the number of targets to add to the list
if (k < 0) { // Set all the target names to the single name specified
i = 3; // Set for the return value
} else { // Set all target names to the appropriate name
i = k+2; // start with the third argument
k = planp->number_of_targets; // current targets
planp->number_of_targets = atoi(argv[1]); // new targets

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants