Commits

Iruatã Souza committed 7ec3973

Initial import.

Comments (0)

Files changed (3)

+include $(GOROOT)/src/Make.inc
+
+TARG=eqwin
+GOFILES=\
+	eqwin.go\
+
+include $(GOROOT)/src/Make.cmd
+#!/usr/bin/env rc
+
+cat | 9 eqn | 9 troff | 9 page -w
+
+
+
+package main
+
+import (
+	"fmt"
+	"os"
+
+	"goplan9.googlecode.com/hg/plan9/acme"
+)
+
+var envelope string = ".PS\n.fp 1 R R.nomath\n\n.ps 14\n.EQ\n%s\n.EN\n"
+
+func main() {
+	w, err := acme.New()
+	if err != nil {
+		fmt.Fprintf(os.Stderr, "error creating window: %s\n", err)
+		os.Exit(1)
+	}
+	w.Name("eqwin")
+
+	c := w.EventChan()
+	for {	
+		ev := <-c
+		if closed(c) {
+			break
+		}
+
+		// mouse button 2 event in the body
+		if ev.C1 == 'M' && ev.C2 == 'L' {
+			pr, pw, err := os.Pipe();
+			_, err = os.ForkExec("eqshow", []string{"eqshow"}, os.Envs, "",
+									[]*os.File{pr, os.Stdout, os.Stderr})
+			if err != nil {
+				fmt.Fprintf(os.Stderr, "could now fork: %s\n", err)
+				os.Exit(1)
+			}
+
+			fmt.Fprintf(pw, envelope, ev.Text)
+			pw.Close()		// sends EOF to eqshow
+		} else {
+			w.WriteEvent(ev)
+		}
+	}
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.