home *** CD-ROM | disk | FTP | other *** search
- /* Wimp info commands for tcl */
- /* (c) C.T.Stretch */
- /* Sun 3rd March 1996 */
-
- #include "h.WInt"
- #include "h.taskmanager"
-
- /*
- * hashlist --
- * Returns a list of names from a hash table.
- *
- * Results:
- * returns TCL_OK.
- *
- * Side effects:
- * None.
- *
- */
-
- static int hashlist(Tcl_HashTable *t)
- { Tcl_HashEntry *e;
- Tcl_HashSearch s;
- for(e=Tcl_FirstHashEntry(t,&s);e;e=Tcl_NextHashEntry(&s))
- Tcl_AppendElement(w_Interp,Tcl_GetHashKey(t,e));
- return TCL_OK;
- }
-
- /*
- * wimptasklist --
- * Returns a list of wimp tasks.
- *
- * Results:
- * A standard tcl result.
- *
- * Side effects:
- * None.
- *
- */
-
- static int wimptasklist(void)
- { os_error *e;
- int c=0;
- taskmanager_task t;
- while(1)
- { e=xtaskmanager_enumerate_tasks(c,&t,sizeof(taskmanager_task),&c,0);
- if(c<0) return TCL_OK;
- Tcl_AppendElement(w_Interp,t.name);
- }
- }
-
- /*
- * w_InfoCmd --
- * Implements the w_info command.
- *
- * Results:
- * A standard tcl result.
- *
- * Side effects:
- * None.
- *
- */
-
- int w_InfoCmd(ClientData dummy,Tcl_Interp *interp,int argc,char **argv)
- {
- if(argc<2) return wrong(WNA,"w_info <option>");
- if(!strcmp(argv[1],"templates")) return hashlist(&boxTable);
- if(!strcmp(argv[1],"diagrams")) return hashlist(&diagramTable);
- if(!strcmp(argv[1],"documents")) return hashlist(&documentTable);
- if(!strcmp(argv[1],"tasks")) return hashlist(&taskTable);
- if(!strcmp(argv[1],"wimptasks")) return wimptasklist();
- return wrong("unknown w_info option: ",argv[1]);
- }
-
-