Skip to content

Commit

Permalink
charmxi: add option to only print module names
Browse files Browse the repository at this point in the history
The -module-name option prints each defined module in a .ci file,
one module per line.

Change-Id: I2b4da1b1e2dcf95bd30ea37d96d428c0b2ad3538
  • Loading branch information
matthiasdiener authored and evan-charmworks committed Feb 28, 2019
1 parent 1174d76 commit fa94701
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/xlat-i/xi-Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Module : public Construct {
void setMain(void) { _isMain = 1; }
int isMain(void) { return _isMain; }
bool isTramTarget();
void printName() { printf("%s\n", name); }

// DMK - Accel Support
int genAccels_spe_c_funcBodies(XStr& str);
Expand Down
16 changes: 14 additions & 2 deletions src/xlat-i/xi-main.C
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ int count_tokens(std::string& str) {
}

void abortxi(char* name) {
cout << "Usage : " << name << " [-ansi|-f90|-intrinsic|-M] module.ci" << endl;
cout << "Usage : " << name
<< " [-ansi|-f90|-intrinsic|-D|-M|-count-tokens|-chare-names|-module-names|-orig-file]"
<< " module.ci" << endl;
exit(1);
}

Expand Down Expand Up @@ -244,6 +246,7 @@ int main(int argc, char* argv[]) {
bool dependsMode = false;
bool countTokens = false;
bool chareNames = false;
bool moduleNames = false;

for (int i = 1; i < argc; i++) {
if (*argv[i] == '-') {
Expand All @@ -260,6 +263,8 @@ int main(int argc, char* argv[]) {
countTokens = true;
else if (strcmp(argv[i], "-chare-names") == 0)
chareNames = true;
else if (strcmp(argv[i], "-module-names") == 0)
moduleNames = true;
else if (strcmp(argv[i], "-orig-file") == 0)
origFile = argv[++i];
else
Expand All @@ -279,6 +284,13 @@ int main(int argc, char* argv[]) {
}

AstChildren<Module>* m = Parse(buffer);

if (moduleNames) {
extern xi::AstChildren<xi::Module>* modlist;
modlist->recursev(&Module::printName);
return 0;
}

return processAst(m, chareNames, dependsMode, fortranMode, internalMode, fname,
origFile);
}
}

0 comments on commit fa94701

Please sign in to comment.