Example #1
0
*/	int main(int argc, char **argv)
/*
***********************************************************************/
{
	char *cmd;

	// Parse command line arguments. Done early. May affect REBOL boot.
	Parse_Args(argc, argv, &Main_Args);

	Print_Str("REBOL 3.0\n");

	REBOL_Init(&Main_Args);

	// Evaluate user input:
	while (TRUE) {
		cmd = Prompt_User();
		REBOL_Do_String(cmd);
		if (!IS_UNSET(DS_TOP)) {
			//if (DSP > 0) {
				if (!IS_ERROR(DS_TOP)) {
					Prin("== ");
					Print_Value(DS_TOP, 0, TRUE);
				} else
					Print_Value(DS_TOP, 0, FALSE);
			//}
		}
		//DS_DROP; // result
	}

	return 0;
}
Example #2
0
//
//  Prompt_User: C
//
char *Prompt_User(void)
{
    char *text;

    Prin("DSP: %d Mem: %d >> ", DSP, PG_Mem_Usage);
    text = Input_Str();
    if (*text == '\n') exit(0);
    return text;
}
Example #3
0
int main()
{
    int i,j;
    position p;
    LIST L;
    L=new mylist;
    p=new mylist;
    printf("what do you want,1-creat,2-insert,3-deleat,4-next,5-retrieve,6-makenull,7-printf,8-locate,0-exit\n");
    while(scanf("%d",&j))
    {
        if(j==1)
        Creat(L);
    if(j==2)
    {printf("which position do you want to in,and what number\n");
    scanf("%d %d",&p,&i);
    Insert(i,p);
    }
    if(j==3)
    {
     printf("which position do you want to deleat\n");
    scanf("%d %d",&p,&i);
    Delete(p);
    }
    if(j==4)
    {
        printf("which next\n");
        scanf("%d",&p);
        p=Next(p,L);
        printf("the next is %d\n",p->n);
    }
    if(j==5)
    {
        printf("which do you retrieve\n");
        scanf("%d",&p);
        printf("the element is %d\n",Retrieve(p,L));
    }
    if(j==6)
    {
        MakeNull(L);
    }
    if(j==7)
    {
        Prin(L);
    }
    if(j==8)
    {
        printf("which do you locate\n");
        scanf("%d",&i);
        p=Locate(i,L);
       if(p)
       {
           printf("%d",p->next->n);

       }
       else
        printf("no find");

    }
    if(j==0)
        return 0;
    }

}