예제 #1
0
파일: config.cpp 프로젝트: pnkfelix/glx-gle
void GLEGlobalConfig::initCmdLine() {
	m_AllowReadDirs.clear();
	if (getCmdLine()->hasOption(GLE_OPT_ALLOWREAD)) {
		GLEPathToVector(getCmdLine()->getOptionString(GLE_OPT_ALLOWREAD), &m_AllowReadDirs);
	}
	m_AllowWriteDirs.clear();
	if (getCmdLine()->hasOption(GLE_OPT_ALLOWWRITE)) {
		GLEPathToVector(getCmdLine()->getOptionString(GLE_OPT_ALLOWWRITE), &m_AllowWriteDirs);
	}
}
예제 #2
0
파일: WINEDIT.CPP 프로젝트: 1000copy/Piero
//////////////////
// Main entry point.  Command line argument is name of file to open
// 
void MyApp::main()
{
	char fname[80];
	getCmdLine(fname);
	mainWin = new EditWin(fname);
	run();
}
예제 #3
0
/***********************************************************************
 * line editor
 **********************************************************************/
static void getCommandLine(void)
{
    tmpPrompt = GetTemporaryPrompt();
    GetCurrentPrompt(Sci_Prompt);

    if (__CommandLine)
    {
        FREE(__CommandLine);
        __CommandLine = NULL;
    }

    if (getScilabMode() == SCILAB_STD)
    {
        /* Send new prompt to Java Console, do not display it */
        if (tmpPrompt != NULL)
        {
            SetConsolePrompt(tmpPrompt);
        }
        else
        {
            SetConsolePrompt(Sci_Prompt);
        }
        setSearchedTokenInScilabHistory(NULL);
        /* Call Java Console to get a string */
        __CommandLine = strdup(ConsoleRead());
    }
    else
    {
        /* Call Term Management for NW and NWNI to get a string */
        __CommandLine = getCmdLine();

    }
}
예제 #4
0
TEST_F(TestConsoleSystem, promptCmdCd) {
  sgConsole.getUi()->setCmdLine("cd " + d + "con");
  sgConsole.prompt();
  EXPECT_EQ("cd " + d + "consoleUi", getCmdLine());
  sgConsole.getUi()->setCmdLine("cd " + d + "di");
  sgConsole.prompt();
  EXPECT_EQ("cd " + d + "dir0", getCmdLine());
  sgConsole.getUi()->setCmdLine("cd " + d + "dir0");
  sgConsole.prompt();
  EXPECT_EQ("cd " + d + "dir0", getCmdLine());
  sgConsole.getUi()->setCmdLine("cd " + pathDir0 + "dir0_0");
  sgConsole.prompt();
  EXPECT_EQ("cd " + pathDir0 + "dir0_0", getCmdLine());
  sgConsole.getUi()->setCmdLine("cd " + pathDir0_0);
  sgConsole.prompt();
  EXPECT_EQ("cd " + pathDir0_0 + "dir0_0_", getCmdLine());
}
예제 #5
0
TEST_F(TestConsoleSystem, promptCmdSet) {
  sgConsole.setCwd(dir0);
  sgConsole.getUi()->setCmdLine("set paramString");
  sgConsole.prompt();
  EXPECT_EQ("set paramString", getCmdLine());
  sgConsole.getUi()->setCmdLine("set paramString ");
  sgConsole.prompt();

  EXPECT_EQ("set paramString ", getCmdLine());
  EXPECT_EQ("one  three  two  \n", getLastOutput());
  sgConsole.getUi()->setCmdLine("set paramString o");
  sgConsole.prompt();
  EXPECT_EQ("set paramString one", getCmdLine());
  sgConsole.getUi()->setCmdLine("set paramString tw");
  sgConsole.prompt();
  EXPECT_EQ("set paramString two", getCmdLine());
  sgConsole.getUi()->setCmdLine("set " + d + "di");
  sgConsole.prompt();
  EXPECT_EQ("set " + d + "dir0", getCmdLine());
  sgConsole.getUi()->setCmdLine("set " + pathDir0_0 + " paramString tw");
  sgConsole.prompt();
  EXPECT_EQ("set " + pathDir0_0 + " paramString two", getCmdLine());
  sgConsole.getUi()->setCmdLine("set " + pathDir0_0_0 + " paramBool f");
  sgConsole.prompt();
  EXPECT_EQ("set " + pathDir0_0_0 + " paramBool false", getCmdLine());
}
예제 #6
0
int		main(int argc, char **argv)
{
  WINDOW	*win;
  int		flag = 0;
  int		i = 1;

  while (argc > i)
    {
      if (argv[i][0] == '-')
	argv[i]++;
      if (argv[i]
	  && ((!strcmp(argv[i], "-full-grow") && i++)
	      || (argv[i][0] == 'g' && argv[i]++)))
	flag += OPT_GROW;
      if (argv[i]
	  && ((!strcmp(argv[i], "-artificial-intelligence") && i++)
	      || (argv[i][0] == 'i' && argv[i]++)))
	flag += OPT_IA;
      if (argv[i] != NULL && !argv[i][0])
	i++;
    }
  if ((win = initscr()) == NULL)
    {
      fprintf(stderr, "Can't creat a new window.\nExiting Soft.\n");
      return (EXIT_FAILURE);
    }
  if (!has_colors() || start_color() == ERR)
    {
      endwin();
      fprintf(stderr, "Can't enable color.\nExiting Soft.\n");
      return (EXIT_FAILURE);
    }

  init_pair(1, COLOR_BLACK, COLOR_WHITE);
  init_pair(2, COLOR_YELLOW, COLOR_BLACK);
  init_pair(3, COLOR_RED, COLOR_BLACK);
  init_pair(4, COLOR_BLUE, COLOR_BLACK);

  if (noecho() == ERR)
    {
      endwin();
      fprintf(stderr, "Can't disable echo.\nExiting Soft.\n");
      return (EXIT_FAILURE);
    }
  if (keypad(win, 1) == ERR)
    {
      endwin();
      fprintf(stderr, "Can't simplify keystroke.\nExiting Soft.\n");
      return (EXIT_FAILURE);
    }
  nodelay(win, 1);
  getCmdLine(win, flag);
  refresh();
  endwin();
  printf("Thanks for using my test.\n");
  return (EXIT_SUCCESS);
}
void prvCmdInterpreterTask(void *pvParameters)
	{
	unsigned char cmd_buff[CONSOLE_BUFFER_SIZE];
	unsigned char *tokptr;

	msleep(3000);

	cmd_buff_ptr= cmd_buff;
	cmd_pos= 0;

	while (1)
		{

		if (getCmdLine(cmd_buff) != 1)
			continue;

		tokptr= strtok(cmd_buff, cmd_inter_strtok_del);

		if (tokptr)
			executeCmdLine(tokptr);

		} // while (1)

	}
예제 #8
0
TEST_F(TestConsoleSystem, promptCmd) {
  sgConsole.getUi()->setCmdLine("");
  sgConsole.prompt();
  EXPECT_EQ("", getCmdLine());
  sgConsole.getUi()->setCmdLine("p");
  sgConsole.prompt();
  EXPECT_EQ("pwd", getCmdLine());
  sgConsole.getUi()->setCmdLine("pwd");
  sgConsole.prompt();
  EXPECT_EQ("pwd", getCmdLine());
  sgConsole.getUi()->setCmdLine(" ct");
  sgConsole.prompt();
  EXPECT_EQ(" ctd", getCmdLine());
  sgConsole.getUi()->setCmdLine("  ");
  sgConsole.prompt();
  EXPECT_EQ("  ", getCmdLine());
  sgConsole.getUi()->setCmdLine("s");
  sgConsole.prompt();
  EXPECT_EQ("s", getCmdLine());
  sgConsole.getUi()->setCmdLine("se");
  sgConsole.prompt();
  EXPECT_EQ("set", getCmdLine());
}
예제 #9
0
TEST_F(TestConsoleSystem, promptCmdPwd) {
  sgConsole.getUi()->setCmdLine("pwd  ");
  sgConsole.prompt();
  EXPECT_EQ("pwd  ", getCmdLine());
}
예제 #10
0
void WindowSystemInit( HINSTANCE hInstance )
{
	WNDCLASS wc;

    memset (&wc, 0, sizeof(wc));
    
    wc.style         = 0;
    wc.lpfnWndProc   = (WNDPROC)WinProcInstance;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon   (NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(BLACK_BRUSH);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = "mainWindow";

    RegisterClass(&wc);

	mainhWnd = CreateWindow (
				"mainWindow" , 
				FILENAME,
                WINDOW_STYLE,
                0, 0, 
				1000, // unfortunately I can't just #ifdef these 2 lines because CreateWindow is also a macro and C can't nest 'em... <sigh>
				600,	//
                0,
                LoadMenu(hInstance,MAKEINTRESOURCE(IDR_MENU1)),
                hInstance,
                NULL);

    ShowWindow ( mainhWnd, SW_SHOW );
    UpdateWindow ( mainhWnd );	

	hMainMenu = GetMenu(mainhWnd);
	hMenuUpperAnims = CreateMenu();
	hMenuLowerAnims = CreateMenu();

	AppendMenu(	hMainMenu,					// HMENU hMenu,         // handle to menu to be changed
				MF_POPUP|MF_STRING,			// UINT uFlags,         // menu-item flags
				(UINT_PTR) hMenuUpperAnims,	// UINT_PTR uIDNewItem, // menu-item identifier or handle to drop-down menu or submenu
				"(Upper Anim Sequences)"	// LPCTSTR lpNewItem    // menu-item content
				);

	AppendMenu(	hMainMenu,					// HMENU hMenu,         // handle to menu to be changed
				MF_POPUP|MF_STRING,			// UINT uFlags,         // menu-item flags
				(UINT_PTR) hMenuLowerAnims,	// UINT_PTR uIDNewItem, // menu-item identifier or handle to drop-down menu or submenu
				"(Lower Anim Sequences)"	// LPCTSTR lpNewItem    // menu-item content
				);

	Menu_UpperAnims_Clear();
	Menu_LowerAnims_Clear();

	DrawMenuBar(mainhWnd);

	if (getCmdLine() != NULL )
	{
		SysOnCommand(mainhWnd, ID_FILE_OPEN, 0, 0);
//		if (!loadmdl( getCmdLine() )) {
//			Debug( "could not load %s", getCmdLine() );		
	}
}