about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-17 09:12:29 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-17 09:12:29 +0200
commitbf357945070a9f4722b8dcbf61d61b34d1aae0aa (patch)
tree042634c777b10f3689d9aa530db54dddaa14cf12
parente7438365417ba4bb0cff56b44b029c797be18fe5 (diff)
downloaddwm-bf357945070a9f4722b8dcbf61d61b34d1aae0aa.tar.gz
ordered variables in structs and source files alphabetically
-rw-r--r--draw.c4
-rw-r--r--dwm.h38
-rw-r--r--dwm.html7
-rw-r--r--event.c35
-rw-r--r--main.c38
-rw-r--r--tag.c21
-rw-r--r--util.c4
7 files changed, 70 insertions, 77 deletions
diff --git a/draw.c b/draw.c
index ec0e964..b8cfffd 100644
--- a/draw.c
+++ b/draw.c
@@ -8,7 +8,7 @@
 #include <string.h>
 #include <X11/Xlocale.h>
 
-/* static functions */
+/* static */
 
 static void
 drawborder(void)
@@ -90,7 +90,7 @@ drawtext(const char *text, Bool invert, Bool border)
 	}
 }
 
-/* extern functions */
+/* extern */
 
 void
 drawall()
diff --git a/dwm.h b/dwm.h
index 75aa50c..de88527 100644
--- a/dwm.h
+++ b/dwm.h
@@ -37,28 +37,28 @@ union Arg {
 };
 
 /* atoms */
-enum { WMProtocols, WMDelete, WMLast };
 enum { NetSupported, NetWMName, NetLast };
+enum { WMProtocols, WMDelete, WMLast };
 
 /* cursor */
-enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
+enum { CurNormal, CurResize, CurMove, CurLast };
 
 struct Fnt {
-	XFontStruct *xfont;
-	XFontSet set;
 	int ascent;
 	int descent;
 	int height;
+	XFontSet set;
+	XFontStruct *xfont;
 };
 
 struct DC { /* draw context */
-	GC gc;
-	Drawable drawable;
 	int x, y, w, h;
-	Fnt font;
 	unsigned long bg;
 	unsigned long fg;
 	unsigned long border;
+	Drawable drawable;
+	Fnt font;
+	GC gc;
 };
 
 struct Client {
@@ -72,10 +72,10 @@ struct Client {
 	unsigned int border;
 	long flags; 
 	Bool isfloat;
-	Window win;
-	Window title;
 	Client *next;
 	Client *revert;
+	Window win;
+	Window title;
 };
 
 struct Rule {
@@ -92,20 +92,18 @@ struct Key {
 	Arg arg;
 };
 
-extern Display *dpy;
-extern Window root, barwin;
-extern Atom wmatom[WMLast], netatom[NetLast];
-extern Cursor cursor[CurLast];
-extern Bool running, issel;
+extern char *tags[TLast], stext[1024];
+extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
 extern void (*handler[LASTEvent])(XEvent *);
 extern void (*arrange)(Arg *);
-extern Key key[];
-
-extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
-extern char *tags[TLast], stext[1024];
-
-extern DC dc;
+extern Atom wmatom[WMLast], netatom[NetLast];
+extern Bool running, issel;
 extern Client *clients, *sel;
+extern Cursor cursor[CurLast];
+extern DC dc;
+extern Display *dpy;
+extern Key key[];
+extern Window root, barwin;
 
 /* client.c */
 extern void ban(Client *c);
diff --git a/dwm.html b/dwm.html
index 8f0aff6..0df44b5 100644
--- a/dwm.html
+++ b/dwm.html
@@ -39,10 +39,9 @@
 		</p>
 		<ul>
 			<li>
-			dwm has no 9P support, no menu, no editable tagbars,
-			no shell-based configuration and remote control and comes without
-			any additional tools like printing the selection or warping the
-			mouse.
+			dwm has no 9P support, no editable tagbars, no shell-based
+			configuration and remote control and comes without any additional
+			tools like printing the selection or warping the mouse.
 			</li>
 			<li>
 			dwm is only a single binary, it's source code is intended to never
diff --git a/event.c b/event.c
index ecbb8d2..0fce36b 100644
--- a/event.c
+++ b/event.c
@@ -11,45 +11,44 @@
 #define ButtonMask      (ButtonPressMask | ButtonReleaseMask)
 #define MouseMask       (ButtonMask | PointerMotionMask)
 
-/********** CUSTOMIZE **********/
-
+/* CUSTOMIZE */
+const char *browse[] = { "firefox", NULL };
+const char *gimp[] = { "gimp", NULL };
 const char *term[] = { 
 	"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
 	"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
 };
-const char *browse[] = { "firefox", NULL };
 const char *xlock[] = { "xlock", NULL };
 
 Key key[] = {
 	/* modifier				key			function	arguments */
-	{ Mod1Mask,				XK_Return,	zoom,		{ 0 } },
-	{ Mod1Mask,				XK_k,		focusprev,		{ 0 } },
-	{ Mod1Mask,				XK_j,		focusnext,		{ 0 } }, 
-	{ Mod1Mask,				XK_m,		maximize,		{ 0 } }, 
+	{ ControlMask,			XK_0,		appendtag,	{ .i = Tscratch } }, 
+	{ ControlMask,			XK_1,		appendtag,	{ .i = Tdev } }, 
+	{ ControlMask,			XK_2,		appendtag,	{ .i = Twww } }, 
+	{ ControlMask,			XK_3,		appendtag,	{ .i = Twork } }, 
 	{ Mod1Mask,				XK_0,		view,		{ .i = Tscratch } }, 
 	{ Mod1Mask,				XK_1,		view,		{ .i = Tdev } }, 
 	{ Mod1Mask,				XK_2,		view,		{ .i = Twww } }, 
 	{ Mod1Mask,				XK_3,		view,		{ .i = Twork } }, 
+	{ Mod1Mask,				XK_j,		focusnext,		{ 0 } }, 
+	{ Mod1Mask,				XK_k,		focusprev,		{ 0 } },
+	{ Mod1Mask,				XK_m,		maximize,		{ 0 } }, 
 	{ Mod1Mask,				XK_space,	dotile,		{ 0 } }, 
-	{ Mod1Mask|ShiftMask,	XK_space,	dofloat,	{ 0 } }, 
+	{ Mod1Mask,				XK_Return,	zoom,		{ 0 } },
 	{ Mod1Mask|ShiftMask,	XK_0,		replacetag,		{ .i = Tscratch } }, 
 	{ Mod1Mask|ShiftMask,	XK_1,		replacetag,		{ .i = Tdev } }, 
 	{ Mod1Mask|ShiftMask,	XK_2,		replacetag,		{ .i = Twww } }, 
 	{ Mod1Mask|ShiftMask,	XK_3,		replacetag,		{ .i = Twork } }, 
 	{ Mod1Mask|ShiftMask,	XK_c,		killclient,		{ 0 } }, 
+	{ Mod1Mask|ShiftMask,	XK_g,		spawn,		{ .argv = gimp } },
+	{ Mod1Mask|ShiftMask,	XK_l,		spawn,		{ .argv = xlock } },
 	{ Mod1Mask|ShiftMask,	XK_q,		quit,		{ 0 } },
-	{ Mod1Mask|ShiftMask,	XK_Return,	spawn,		{ .argv = term } },
+	{ Mod1Mask|ShiftMask,	XK_space,	dofloat,	{ 0 } }, 
 	{ Mod1Mask|ShiftMask,	XK_w,		spawn,		{ .argv = browse } },
-	{ Mod1Mask|ShiftMask,	XK_l,		spawn,		{ .argv = xlock } },
-	{ ControlMask,			XK_0,		appendtag,	{ .i = Tscratch } }, 
-	{ ControlMask,			XK_1,		appendtag,	{ .i = Tdev } }, 
-	{ ControlMask,			XK_2,		appendtag,	{ .i = Twww } }, 
-	{ ControlMask,			XK_3,		appendtag,	{ .i = Twork } }, 
+	{ Mod1Mask|ShiftMask,	XK_Return,	spawn,		{ .argv = term } },
 };
 
-/********** CUSTOMIZE **********/
-
-/* static functions */
+/* static */
 
 static void
 movemouse(Client *c)
@@ -337,7 +336,7 @@ unmapnotify(XEvent *e)
 		unmanage(c);
 }
 
-/* extern functions */
+/* extern */
 
 void (*handler[LASTEvent]) (XEvent *) = {
 	[ButtonPress] = buttonpress,
diff --git a/main.c b/main.c
index 2d132a5..27e2627 100644
--- a/main.c
+++ b/main.c
@@ -14,26 +14,12 @@
 #include <X11/Xatom.h>
 #include <X11/Xproto.h>
 
-Display *dpy;
-Window root, barwin;
-Atom wmatom[WMLast], netatom[NetLast];
-Cursor cursor[CurLast];
-Bool running = True;
-Bool issel = True;
-
-int tsel = Tdev; /* default tag */
-int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
-char stext[1024];
 
-DC dc = {0};
-Client *clients = NULL;
-Client *sel = NULL;
+/* static */
 
 static Bool otherwm;
 static int (*xerrorxlib)(Display *, XErrorEvent *);
 
-/* static functions */
-
 static void
 cleanup()
 {
@@ -97,7 +83,20 @@ xerrorstart(Display *dsply, XErrorEvent *ee)
 	return -1;
 }
 
-/* extern functions */
+/* extern */
+
+char stext[1024];
+int tsel = Tdev; /* default tag */
+int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
+Atom wmatom[WMLast], netatom[NetLast];
+Bool running = True;
+Bool issel = True;
+Client *clients = NULL;
+Client *sel = NULL;
+Cursor cursor[CurLast];
+Display *dpy;
+DC dc = {0};
+Window root, barwin;
 
 int
 getproto(Window w)
@@ -141,10 +140,9 @@ quit(Arg *arg)
 }
 
 /*
- * There's no way to check accesses to destroyed windows, thus
- * those cases are ignored (especially on UnmapNotify's).
- * Other types of errors call Xlib's default error handler, which
- * calls exit().
+ * There's no way to check accesses to destroyed windows, thus those cases are
+ * ignored (especially on UnmapNotify's).  Other types of errors call Xlibs
+ * default error handler, which calls exit().
  */
 int
 xerror(Display *dpy, XErrorEvent *ee)
diff --git a/tag.c b/tag.c
index 48f1f2a..5da5711 100644
--- a/tag.c
+++ b/tag.c
@@ -7,24 +7,23 @@
 #include <string.h>
 #include <X11/Xutil.h>
 
-/********** CUSTOMIZE **********/
-
-char *tags[TLast] = {
-	[Tscratch] = "scratch",
-	[Tdev] = "dev",
-	[Twww] = "www",
-	[Twork] = "work",
-};
+/* static */
 
+/* CUSTOMIZE */ 
 static Rule rule[] = {
 	/* class			instance	tags						isfloat */
 	{ "Firefox-bin",	"Gecko",	{ [Twww] = "www" },			False },
 };
 
-/********** CUSTOMIZE **********/
-
-/* extern functions */
+/* extern */
 
+/* CUSTOMIZE */
+char *tags[TLast] = {
+	[Tscratch] = "scratch",
+	[Tdev] = "dev",
+	[Twww] = "www",
+	[Twork] = "work",
+};
 void (*arrange)(Arg *) = dotile;
 
 void
diff --git a/util.c b/util.c
index f7e3e6f..3e5fd1e 100644
--- a/util.c
+++ b/util.c
@@ -10,7 +10,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
-/* static functions */
+/* static */
 
 static void
 bad_malloc(unsigned int size)
@@ -20,7 +20,7 @@ bad_malloc(unsigned int size)
 	exit(1);
 }
 
-/* extern functions */
+/* extern */
 
 void *
 emallocz(unsigned int size)
pan class="w"> break $evaluate:process-word } { var is-sub?/eax: boolean <- stream-data-equal? curr-stream, "-" compare is-sub?, 0 break-if-= var _b/eax: int <- pop-int-stack out var b/edx: int <- copy _b var a/eax: int <- pop-int-stack out a <- subtract b push-int-stack out, a break $evaluate:process-word } { var is-mul?/eax: boolean <- stream-data-equal? curr-stream, "*" compare is-mul?, 0 break-if-= var _b/eax: int <- pop-int-stack out var b/edx: int <- copy _b var a/eax: int <- pop-int-stack out a <- multiply b push-int-stack out, a break $evaluate:process-word } # if curr-stream is a known function name, call it appropriately { var callee-h: (handle function) var callee-ah/eax: (addr handle function) <- address callee-h find-function defs, curr-stream, callee-ah var callee/eax: (addr function) <- lookup *callee-ah compare callee, 0 break-if-= perform-call callee, out, defs break $evaluate:process-word } # if it's a name, push its value { compare bindings, 0 break-if-= var tmp: (handle array byte) var curr-string-ah/edx: (addr handle array byte) <- address tmp stream-to-string curr-stream, curr-string-ah var _curr-string/eax: (addr array byte) <- lookup *curr-string-ah var curr-string/edx: (addr array byte) <- copy _curr-string var result/eax: int <- copy 0 var found?/ecx: boolean <- copy 0 # false result, found? <- lookup-binding bindings, curr-string compare found?, 0 # false break-if-= #? print-string-to-real-screen "value of " #? print-string-to-real-screen curr-string #? print-string-to-real-screen " is " #? print-int32-hex-to-real-screen result #? print-string-to-real-screen "\n" push-int-stack out, result break $evaluate:process-word } # otherwise assume it's a literal int and push it { var n/eax: int <- parse-decimal-int-from-stream curr-stream push-int-stack out, n } } # termination check compare curr, end break-if-= # update var next-word-ah/edx: (addr handle word) <- get curr, next curr <- lookup *next-word-ah # loop } } fn find-function first: (addr handle function), name: (addr stream byte), out: (addr handle function) { var curr/esi: (addr handle function) <- copy first $find-function:loop: { var _f/eax: (addr function) <- lookup *curr var f/ecx: (addr function) <- copy _f compare f, 0 break-if-= var curr-name-ah/eax: (addr handle array byte) <- get f, name var curr-name/eax: (addr array byte) <- lookup *curr-name-ah var done?/eax: boolean <- stream-data-equal? name, curr-name compare done?, 0 # false { break-if-= copy-handle *curr, out break $find-function:loop } curr <- get f, next loop } } fn perform-call _callee: (addr function), caller-stack: (addr int-stack), defs: (addr handle function) { var callee/ecx: (addr function) <- copy _callee # create bindings for args var table-storage: table var table/esi: (addr table) <- address table-storage initialize-table table, 0x10 # var curr-arg-ah/eax: (addr handle word) <- get callee, args var curr-arg/eax: (addr word) <- lookup *curr-arg-ah # var curr-key-storage: (handle array byte) var curr-key/edx: (addr handle array byte) <- address curr-key-storage { compare curr-arg, 0 break-if-= # create binding word-to-string curr-arg, curr-key { #? var tmp/eax: (addr array byte) <- lookup *curr-key #? print-string-to-real-screen "binding " #? print-string-to-real-screen tmp #? print-string-to-real-screen " to " var curr-val/eax: int <- pop-int-stack caller-stack #? print-int32-decimal-to-real-screen curr-val #? print-string-to-real-screen "\n" bind-int-in-table table, curr-key, curr-val } # var next-arg-ah/edx: (addr handle word) <- get curr-arg, next curr-arg <- lookup *next-arg-ah loop } # obtain body var body-ah/eax: (addr handle line) <- get callee, body var body/eax: (addr line) <- lookup *body-ah # perform call var stack-storage: int-stack var stack/edi: (addr int-stack) <- address stack-storage initialize-int-stack stack, 0x10 #? print-string-to-real-screen "about to enter recursive eval\n" evaluate defs, table, body, 0, stack #? print-string-to-real-screen "exited recursive eval\n" # stitch result from stack into caller var result/eax: int <- pop-int-stack stack push-int-stack caller-stack, result } # Copy of 'simplify' that just tracks the maximum stack depth needed # Doesn't actually need to simulate the stack, since every word has a predictable effect. fn max-stack-depth first-word: (addr word), final-word: (addr word) -> result/edi: int { var curr-word/eax: (addr word) <- copy first-word var curr-depth/ecx: int <- copy 0 result <- copy 0 $max-stack-depth:loop: { $max-stack-depth:process-word: { # handle operators { var is-add?/eax: boolean <- word-equal? curr-word, "+" compare is-add?, 0 break-if-= curr-depth <- decrement break $max-stack-depth:process-word } { var is-sub?/eax: boolean <- word-equal? curr-word, "-" compare is-sub?, 0 break-if-= curr-depth <- decrement break $max-stack-depth:process-word } { var is-mul?/eax: boolean <- word-equal? curr-word, "*" compare is-mul?, 0 break-if-= curr-depth <- decrement break $max-stack-depth:process-word } # otherwise it's an int (do we need error-checking?) curr-depth <- increment # update max depth if necessary { compare curr-depth, result break-if-<= result <- copy curr-depth } } # if curr-word == final-word break compare curr-word, final-word break-if-= # curr-word = curr-word->next var next-word-ah/edx: (addr handle word) <- get curr-word, next curr-word <- lookup *next-word-ah # loop } }