--- /dev/null
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xft/Xft.h>
+
+void XSetForeground(Display* display, GC gc, unsigned long foreground);
+void XFillRectangle(Display* display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height);
--- /dev/null
+#!/bin/env ruby
+
+HEADER = <<-eos
+
+typedef struct {
+ char* name;
+ int ndata;
+ char data[];
+} MockValue_T;
+
+typedef struct {
+ char* name;
+ MockValue_T* retval;
+ int nvalues;
+ MockValue_T* values[];
+} MockCall_T;
+
+#ifndef MAX_CALLS
+#define MAX_CALLS 256
+#endif
+
+int CurrentExpected = 0;
+int CurrentCall = 0;
+MockCall_T* ExpectedCalls[MAX_CALLS];
+MockCall_T* ActualCalls[MAX_CALLS];
+
+void MockInit(void)
+{
+ CurrentExpected = 0;
+ CurrentCall = 0;
+}
+
+/* REGISTER MOCK CALL */
+/* allocate call structure with N values */
+/* foreach arg */
+ /* allocate named value structure */
+ /* initialize named value structure */
+ /* assign named value structure to slot in mock call */
+/* if call returns non-void */
+ /* allocate value structure */
+ /* initialize value structure */
+ /* assign value structure to slot in mock call */
+
+eos
+
+def parse_args(args)
+ args.map do |a|
+ a = a.match(/(.*) ([_a-zA-Z0-9]+)$/)
+ { type: a[1], name: a[2] }
+ end
+end
+
+def genmock(name, args, rettype)
+ args = args.map {|a| "#{a[:type]} #{a[:name]}" }
+ puts "#{rettype} #{name}(#{args.join(", ")})\n{\n"
+ puts "}"
+ puts
+end
+
+File.read(ARGV[0]).each_line do |ln|
+ ln = ln.gsub(/(const|volatile)/,'')
+ if ln =~ /(.*) ([_a-zA-Z0-9]+)\((.*)\)/
+ rettype = $1
+ name = $2
+ args = $3.sub(/^ *([^ ]*) *$/, '\1')
+ args = (args == "void" ? [] : args.split(","))
+ args = parse_args(args)
+ genmock(name, args, rettype)
+ else
+ puts ln
+ end
+end
\ No newline at end of file