Exemplo n.º 1
0
void *str_expr_gen_evaluate(str_expr *structure) {
    pystr *retptr = (pystr *)malloc(sizeof(pystr));
    retptr->type = pystr_t;
    retptr->value = strdup(strslice(structure->value, 1, -1, 1));
    return retptr;
}
Exemplo n.º 2
0
V charat(utf8 source, utf8index curr)
{
	return strslice(source, curr, nextchar(source, curr));
}
Exemplo n.º 3
0
Arquivo: main.c Projeto: akshaykb/Zeta
void initiate()
{
    //Prompt Start

    printf("\n:> ");
    fgets(input,sizeof(input),stdin);

    //----------------------------------------------------------------------------------------
    //EXIT COMMAND
    if((stricmp(input,"exit\n")==0)) //To exit command interpreter
    {
        main_exit();
    }
    //----------------------------------------------------------------------------------------

    //----------------------------------------------------------------------------------------
    //CLEAR SCREEN COMMAND
    else if(stricmp(input,"clr\n")==0) //To clear screen
    {
    	system("cls");
        initiate();
    }
    //----------------------------------------------------------------------------------------


    //----------------------------------------------------------------------------------------
    //TIME COMMANDS
    else if((stricmp(input,"time\n")==0)) //To show time (default format-24hr HH/MM/SS.MS)
    {
    	sys_time_def();
    	initiate();
    }

    else if((stricmp(input,"time-24\n")==0)) //To show time in 24hrformat (HH:MM)
    {
    	sys_time_24hr();
    	initiate();
    }

    else if((stricmp(input,"time-12\n")==0)) //To show time in 12hr format (HH:MM AM/PM)
    {
        sys_time_12hr();
        initiate();
    }

    else if((stricmp(input,"time-e\n")==0)) //To show time and provide 'editing' option
    {
        system("time");
        initiate();
    }
    //----------------------------------------------------------------------------------------

    //----------------------------------------------------------------------------------------
    //DATE COMMANDS
    else if((stricmp(input,"date\n")==0)) //To show date (default format:MM/DD/YYYY)
    {
    	sys_date_def();
    	initiate();
    }

    else if((stricmp(input,"date-e\n")==0)) //To show date and provide 'editing' option
    {
        system("date");
        initiate();
    }
    //----------------------------------------------------------------------------------------

    //----------------------------------------------------------------------------------------
    //DAY COMMANDS
    else if((stricmp(input,"day\n")==0)) //To show day/date of month
    {
    	sys_day();
    	initiate();
    }

    else if((stricmp(input,"day-i\n")==0)) //To show complete day info
    {
    	sys_day_info();
    	initiate();
    }
    //----------------------------------------------------------------------------------------

    //----------------------------------------------------------------------------------------
    // STRING MANIPULATION COMMANDS
    else if((stricmp(input,"strln\n")==0)) // Returns length of String
    {
        strln();
        initiate();
    }

    else if((stricmp(input,"strwht\n")==0)) // Returns no. of whitespaces in the String
    {
        strwht();
        initiate();
    }

    else if((stricmp(input,"strslice\n")==0)) // Returns a SubString from the given String using mentioned indices
    {
        strslice();
        initiate();
    }

    else if((stricmp(input,"strcap\n")==0)) // Capitalises the entered String
    {
        strcap();
        initiate();
    }

    else if((stricmp(input,"strtolow\n")==0)) // Converts uppercase String to lowercase
    {
        strtolow();
        initiate();
    }
    //----------------------------------------------------------------------------------------

	else
	{
        printf("\aCommand not found.\n");
        initiate();
	}

}