Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ucbvax!parc.xerox.com!janssen From: janssen@parc.xerox.com (Bill Janssen) Newsgroups: comp.soft-sys.andrew Subject: Meta-X package Message-ID: Date: 20 Jul 90 23:08:24 GMT References: Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 226 Here it is (meta-x) as a shar file: ---- Enclosure ---- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'Imakefile' <<'END_OF_FILE' XLOCALINCLUDES = -I/import/local/andrew/include/atk X XDOBJS = metax.do X XIHFILES = metax.ih X XDESTDIR = /import/local/andrew X XNormalObjectRule() XNormalATKRule() XDependTarget() X XDynamicObject(metax,,$(UTILLIB)) XInstallClassFiles($(DOBJS),$(IHFILES)) END_OF_FILE if test 248 -ne `wc -c <'Imakefile'`; then echo shar: \"'Imakefile'\" unpacked with wrong size! fi # end of 'Imakefile' fi if test -f 'metax.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'metax.c'\" else echo shar: Extracting \"'metax.c'\" \(2947 characters\) sed "s/^X//" >'metax.c' <<'END_OF_FILE' X/*| -*- Mode: C -*- X/*|------------------------------------------------------------ X/*| X/*| File: metax.c X/*| Created: Thu Jun 7 19:07:32 1990 X/*| Author: Bill Janssen (janssen@holmes) X/*| $Locker$ X/*| X/*|------------------------------------------------------------ X/*| X/*| Description: X/*| X/*| Behaviour code to implement meta-x for Andrew. X/*| X/*|------------------------------------------------------------ X/*| X/*| Copyright 1990 Xerox Corporation X/*| All Rights Reserved Worldwide. X/*/ X static char xerox_copyright[] = "\ X \ X Copyright 1990 Xerox Corporation \ X All Rights Reserved"; X/*|------------------------------------------------------------ X/*| X/*| "$Header$" X/*/ X static char rcs_id[] = "$Header$"; X/*| X/*|------------------------------------------------------------ X/*/ X X#include X X#include X#include X#include X#include X#include X X#include "metax.eh" X Xstatic char lastCommand[1000]; X Xstatic void callProcedure (self, key) X struct view *self; X char key; X{ X char buf[1000]; X X if (message_AskForString (self, 0 , "M-x ", "", X buf, sizeof(buf)) == -1) X { X message_DisplayString (self, 0, ""); X return; X } X X CallNamedProcedure (self, buf); X X strcpy (lastCommand, buf); X} X XCallNamedProcedure (self, procname) X struct view *self; X char *procname; X{ X char buf[1000]; X struct proctable_Entry *pe; X int stat; X X /* should lookup synonyms here... */ X X pe = proctable_Lookup (procname); X if (pe == NULL) X { X message_DisplayString (self, 0, "No such command."); X return; X } X X if (pe->proc != NULL X && (pe->module == NULL || (class_Load(pe->module) != NULL))) X { X if (pe->doc != NULL) X message_DisplayString (self, 0, pe->doc); X im_ForceUpdate(); X stat = (*pe->proc)(self, 0); X sprintf (buf, "%s returns %d.", pe->name, stat); X message_DisplayString (self, 0, buf); X }; X} X Xstatic void repeatProcedure (view, key) X struct view *view; X char key; X{ X char buf[1000]; X X if (*lastCommand != 0) X { X if (message_AskForString (view, 0 , "M-x ", lastCommand, X buf, sizeof(buf)) == -1) X { X message_DisplayString (view, 0, ""); X return; X } X X CallNamedProcedure (view, buf); X } X else X message_DisplayString (view, 0, "No previous Meta-X command."); X} X Xboolean metax__InitializeClass(classID) X struct classheader *classID; X{ X static struct bind_Description fns[] = { X {"view-call-named-procedure", "\033x", 0, NULL, 0, 0, callProcedure, "Call the procedure named as an argument", "metax" }, X {"view-repeat-named-procedure", "\030\033", 0, NULL, 0, 0, repeatProcedure, "Call the procedure named as an argument", "metax" }, X NULL }; X struct classinfo *viewClassinfo; X X viewClassinfo = class_Load("view"); X if (viewClassinfo != NULL) { X bind_BindList(fns, NULL, NULL, viewClassinfo); X return TRUE; X } X else X return FALSE; X} X END_OF_FILE if test 2947 -ne `wc -c <'metax.c'`; then echo shar: \"'metax.c'\" unpacked with wrong size! fi # end of 'metax.c' fi if test -f 'metax.ch' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'metax.ch'\" else echo shar: Extracting \"'metax.ch'\" \(717 characters\) sed "s/^X//" >'metax.ch' <<'END_OF_FILE' X/*| -*- Mode: C -*- X/*|------------------------------------------------------------ X/*| X/*| File: metax.ch X/*| Created: Thu Jun 7 19:06:27 1990 X/*| Author: Bill Janssen (janssen@holmes) X/*| $Locker$ X/*| X/*|------------------------------------------------------------ X/*| X/*| Description: X/*| X/*| Package declaration for meta-x code. X/*| X/*|------------------------------------------------------------ X/*| X/*| Copyright 1990 Xerox Corporation X/*| All Rights Reserved Worldwide. X/*|------------------------------------------------------------ X/*| X/*| "$Header$" X/*| X/*|------------------------------------------------------------ X/*/ X Xpackage metax { X X classprocedures: X InitializeClass() returns boolean; X}; END_OF_FILE if test 717 -ne `wc -c <'metax.ch'`; then echo shar: \"'metax.ch'\" unpacked with wrong size! fi # end of 'metax.ch' fi echo shar: End of shell archive. exit 0 ---- Enclosure ----