⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tclshell.c

📁 linux下的一些小游戏编程
💻 C
字号:
/* A simple but functional Tcl shell. */#include <stdio.h>#include <stdlib.h>#include <tcl.h>int main(){    Tcl_Interp *interp;    char input[16384];    /* Create an interpreter structure. */    interp = Tcl_CreateInterp();    if (interp == NULL) {	printf("Unable to create interpreter.\n");	return 1;    }    /* Add custom commands here. */    /* Loop indefinitely (we'll break on end-of-file). */    for (;;) {	int result;	char *message;	/* Print a prompt and make it appear immediately. */	printf("> ");	fflush(stdout);	/* Read up to 16k of input. */	if (fgets(input, 16383, stdin) == NULL) {	    printf("End of input.\n");	    break;	}	/* Evaluate the input as a script. */	result = Tcl_Eval(interp, input);	/* Print the return code and the result. */	switch (result) {	case TCL_OK:	    message = " OK ";	    break;	case TCL_ERROR:	    message = "ERR ";	    break;	case TCL_CONTINUE:	    message = "CONT";	    break;	default:	    message = " ?? ";	    break;	}	printf("[%s] %s\n", message, Tcl_GetStringResult(interp));    }    /* Delete the interpreter. */    Tcl_DeleteInterp(interp);    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -