/* DO NOT EDIT! ** This file has been automatically generated from "uberplayer.c" */ #ifdef __cplusplus # define EXTERN extern "C" #else # define EXTERN extern #endif EXTERN int Et_Eval(const char *,int,const char*,...); EXTERN int Et_EvalInt(const char *,int,const char*,...); EXTERN char *Et_EvalString(const char *,int,const char*,...); EXTERN double Et_EvalDouble(const char *,int,const char*,...); EXTERN void Et_EvalInclude(const char *,char *); EXTERN void Et_Init(int *, char **); EXTERN void Et_MainLoop(void); EXTERN void Et_ReadStdin(void); EXTERN struct Tcl_Interp *Et_Interp; EXTERN struct Tk_Window_ *Et_MainWindow; EXTERN struct _XDisplay *Et_Display; #define ET_OK 0 #define ET_ERROR 1 #undef EXTERN #define UNIX 1 #define WIN32 0 #line 1 "uberplayer.c" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "h261ctrl.h" int wait_for_connect(u_short port); void usage(char* progname) { fprintf(stderr, "Syntax: %s\n", progname); fprintf(stderr, "\t[-o format %d for QCIF %d for CIF\n", QCIF_TYPE, CIF_TYPE); } H261CtrlConn connector; void IncomingMissile(ClientData clientData, int mask) { fprintf(stderr, "IncomingMissile\n"); connector.RcvPkt(); } static int Et_Proc_h261connect(void *clientData,struct Tcl_Interp *interp,int argc,char **argv) { int rc = 0; if(!connector.is_connected) { fprintf(stderr, "connection req to %s\n", argv[1]); rc = connector.MakeConnect(argv[1]); } else connector.Disconnect(); return ET_OK; } static int Et_Proc_disengage(void *clientData,struct Tcl_Interp *interp,int argc,char **argv) { if(connector.encpid) kill(connector.encpid, SIGKILL); if(connector.decpid) kill(connector.decpid, SIGKILL); exit(0); return ET_OK; } void setconnstatus(int status) { if(status) Et_Eval(__FILE__,__LINE__,"s","set c_string Disconnect "); else Et_Eval(__FILE__,__LINE__,"s","set c_string Connect "); } int main(int argc, char** argv) { char ch; int read_fd = 0; int format = CIF_TYPE; char *servaddr = "127.0.0.1"; int filefd = 0; char *filename = NULL; ClientData tmpdata; while ((ch = getopt(argc, argv, "s:r:o:a:f:")) != -1) switch(ch) { case 'o': format = atoi(optarg); break; case 'a': servaddr = optarg; break; case 'f': filename = optarg; break; default: usage(argv[0]); goto quit; } if(format != QCIF_TYPE && format != CIF_TYPE) { usage(argv[0]); exit(0); } connector.format = format; if(!filename) { usage(argv[0]); exit(0); } if( (filefd=open(filename, O_RDONLY)) < 0) { perror("open "); exit(0); } close(filefd); connector.encfilename = filename; read_fd = wait_for_connect(H261CTRLPORT); connector.ctrlfd = read_fd; if(read_fd < 0) goto quit; Tcl_CreateFileHandler(connector.ctrlfd, TCL_READABLE, IncomingMissile, tmpdata); Et_Init(&argc, argv); {void Et_Init_uberplayer_c(void); Et_Init_uberplayer_c();}; { static char _ET_script_[] = "#!/usr/bin/wish\n" "\n" "\n" "global ipaddrs\n" "global c_string\n" "\n" "set c_string Connect\n" "set direction 1\n" "set numsteps 0\n" "set speed 0\n" "set step_id 0\n" "\n" "\n" "wm title . {H.261 UberPlayer}\n" "button .b -text {Quit} -command {Disengage; exit}; \n" "pack .b -side top -fill x\n" "\n" "\n" "\n" "#=========== Num of steps\n" "frame .stepfunc -borderwidth 2 -relief groove\n" "pack .stepfunc -side top -fill x\n" "\n" "\n" "#button .stepfunc.step -text Step -width 15 -command {Step $numsteps $direction};\n" "button .stepfunc.step -textvariable c_string -width 15 -command {H261Connect $ipaddrs};\n" "pack .stepfunc.step -side left\n" "\n" "label .stepfunc.steplbl -text {IP address} -relief flat\n" "pack .stepfunc.steplbl -side right\n" "\n" "entry .stepfunc.numsteps -width 16 -textvariable ipaddrs\n" "pack .stepfunc.numsteps \n" "#=============\n" "\n" ""; #line 129 "uberplayer.c" Et_EvalInclude("playergui.tk",_ET_script_); }; Et_MainLoop(); quit: return 0; } /******* Automatically generated code follows ********/ #ifdef __cplusplus # define EXTERN extern "C" #else # define EXTERN extern #endif EXTERN void Et_InstallCommand(char *,int (*)(void*,struct Tcl_Interp*,int,char**)); void Et_Init_uberplayer_c(void){ Et_InstallCommand("H261Connect",Et_Proc_h261connect); Et_InstallCommand("Disengage",Et_Proc_disengage); }