示例#1
0
bool ContextIntersect::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
	for (_i=_skipFirstArgs; _i < argc; _i++) {
		if (isUsed(_i - _skipFirstArgs)) {
			continue;
		}
		if (strcmp(_argv[_i], "-a") == 0) {
			if (!handle_a()) return false;
		}
        else if (strcmp(_argv[_i], "-abam") == 0) {
			if (!handle_abam()) return false;
        }
        else if (strcmp(_argv[_i], "-b") == 0) {
			if (!handle_b()) return false;
		}
        else if (strcmp(_argv[_i], "-names") == 0) {
			if (!handle_names()) return false;
		}
        else if (strcmp(_argv[_i], "-filenames") == 0) {
			if (!handle_filenames()) return false;
		}
        else if (strcmp(_argv[_i], "-u") == 0) {
			if (!handle_u()) return false;
        }
        else if (strcmp(_argv[_i], "-f") == 0) {
			if (!handle_f()) return false;
        }
        else if (strcmp(_argv[_i], "-F") == 0) {
			if (!handle_F()) return false;
        }
        else if (strcmp(_argv[_i], "-wa") == 0) {
			if (!handle_wa()) return false;
        }
        else if (strcmp(_argv[_i], "-wao") == 0) {
			if (!handle_wao()) return false;
        }
       else if (strcmp(_argv[_i], "-wb") == 0) {
			if (!handle_wb()) return false;
        }
        else if (strcmp(_argv[_i], "-wo") == 0) {
			if (!handle_wo()) return false;
        }
        else if (strcmp(_argv[_i], "-c") == 0) {
			if (!handle_c()) return false;
        }
        else if(strcmp(_argv[_i], "-r") == 0) {
			if (!handle_r()) return false;
        }
        else if(strcmp(_argv[_i], "-e") == 0) {
			if (!handle_e()) return false;
        }
        else if (strcmp(_argv[_i], "-v") == 0) {
			if (!handle_v()) return false;
        }
        else if (strcmp(_argv[_i], "-s") == 0) {
			if (!handle_s()) return false;
        }
        else if (strcmp(_argv[_i], "-S") == 0) {
			if (!handle_S()) return false;
        }
        else if (strcmp(_argv[_i], "-loj") == 0) {
			if (!handle_loj()) return false;
        }
	}
	return ContextBase::parseCmdArgs(argc, argv, _skipFirstArgs);
}
示例#2
0
bool ContextIntersect::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
	_argc = argc;
	_argv = argv;
	_skipFirstArgs = skipFirstArgs;
	if (_argc < 2) {
		setShowHelp(true);
		return false;
	}

	setProgram(_programNames[argv[0]]);

	_argsProcessed.resize(_argc - _skipFirstArgs, false);

	for (_i=_skipFirstArgs; _i < argc; _i++) {
		if (isUsed(_i - _skipFirstArgs)) {
			continue;
		}
		if (strcmp(_argv[_i], "-a") == 0) {
			if (!handle_a()) return false;
		}
        else if (strcmp(_argv[_i], "-abam") == 0) {
			if (!handle_abam()) return false;
        }
        else if (strcmp(_argv[_i], "-b") == 0) {
			if (!handle_b()) return false;
		}
        else if (strcmp(_argv[_i], "-names") == 0) {
			if (!handle_names()) return false;
		}
        else if (strcmp(_argv[_i], "-filenames") == 0) {
			if (!handle_filenames()) return false;
		}
        else if (strcmp(_argv[_i], "-u") == 0) {
			if (!handle_u()) return false;
        }
        else if (strcmp(_argv[_i], "-f") == 0) {
			if (!handle_f()) return false;
        }
        else if (strcmp(_argv[_i], "-wa") == 0) {
			if (!handle_wa()) return false;
        }
        else if (strcmp(_argv[_i], "-wao") == 0) {
			if (!handle_wao()) return false;
        }
       else if (strcmp(_argv[_i], "-wb") == 0) {
			if (!handle_wb()) return false;
        }
        else if (strcmp(_argv[_i], "-wo") == 0) {
			if (!handle_wo()) return false;
        }
        else if (strcmp(_argv[_i], "-c") == 0) {
			if (!handle_c()) return false;
        }
        else if(strcmp(_argv[_i], "-r") == 0) {
			if (!handle_r()) return false;
        }
        else if (strcmp(_argv[_i], "-v") == 0) {
			if (!handle_v()) return false;
        }
        else if (strcmp(_argv[_i], "-s") == 0) {
			if (!handle_s()) return false;
        }
        else if (strcmp(_argv[_i], "-S") == 0) {
			if (!handle_S()) return false;
        }
        else if (strcmp(_argv[_i], "-loj") == 0) {
			if (!handle_loj()) return false;
        }
	}
	return ContextBase::parseCmdArgs(argc, argv, _skipFirstArgs);
}
示例#3
0
void foo(void)
{
   switch(ch)
   {
   // handle 'a'
   case 'a':
      {
         handle_a();
         multiline(123,
                   345);
         break;
      }

   // handle 'b'
   case 'b':
      handle_b();
      multiline(123,
                345);
      break;

   // handle 'c' and 'd'
   case 'c':
   case 'd':
      // c and d are really the same thing
      handle_cd();
      multiline(123,
                345);
      break;

   case 'e':
      {
         handle_a();
         multiline(123,
                   345);
      }
      break;
      // case1
   case (case1):
   {
           //do stuff
       break;
   }
   case (case2):
       {
           //do stuff
       break;
       }
   case (case3):

           /*do stuff*/
       break;
   case (case3):
       statement();
       {
          another_statement();
       }
       break;

 // really should not get here
   default:
      handle_default();
      multiline(123,
                345);
      break;
   }
   multiline(123,
             345);
}