<html>
<body>
<div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream/src</tt></b></td></tr>
<tr><td><tt><a href="#file1">Makefile.am</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+1</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">06923d1020de -> 1b836bf92653</td></tr>
<tr class="alt" style=";" ><td><tt><a href="#file2">Makefile.in</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+1</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">06923d1020de -> 1b836bf92653</td></tr>
<tr><td><tt>tools/<a href="#file3">genglsl.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+63</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-24</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">06923d1020de -> 1b836bf92653</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+65</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-26</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >3 modified files</small><br />
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Add some real option processing to genglsl and let it accept multiple glsl
input files (basically concatenate them together)
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>Makefile.am</b></big> <small id="info" style="color: #888888;" >06923d1020de -> 1b836bf92653</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/Makefile.am
+++ lxdream/src/Makefile.am
@@ -258,7 +258,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > $(GENDEC) $(srcdir)/sh4/sh4.def $(srcdir)/sh4/sh4stat.in -o $@
pvr2/shaders.def: $(GENGLSL) pvr2/shaders.glsl
$(mkdir_p) `dirname $@`
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- $(GENGLSL) $(srcdir)/pvr2/shaders.glsl $@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ $(GENGLSL) $(srcdir)/pvr2/shaders.glsl <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >-o </span>$@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > pvr2/shaders.h: pvr2/shaders.def
drivers/mac_keymap.h: dckeysyms.h drivers/mac_keymap.txt drivers/genkeymap.pl
$(mkdir_p) `dirname $@`
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>Makefile.in</b></big> <small id="info" style="color: #888888;" >06923d1020de -> 1b836bf92653</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/Makefile.in
+++ lxdream/src/Makefile.in
@@ -2720,7 +2720,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > $(GENDEC) $(srcdir)/sh4/sh4.def $(srcdir)/sh4/sh4stat.in -o $@
pvr2/shaders.def: $(GENGLSL) pvr2/shaders.glsl
$(mkdir_p) `dirname $@`
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- $(GENGLSL) $(srcdir)/pvr2/shaders.glsl $@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ $(GENGLSL) $(srcdir)/pvr2/shaders.glsl <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >-o </span>$@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > pvr2/shaders.h: pvr2/shaders.def
drivers/mac_keymap.h: dckeysyms.h drivers/mac_keymap.txt drivers/genkeymap.pl
$(mkdir_p) `dirname $@`
</pre></div>
<hr /><a name="file3" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/tools</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>genglsl.c</b></big> <small id="info" style="color: #888888;" >06923d1020de -> 1b836bf92653</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/tools/genglsl.c
+++ lxdream/src/tools/genglsl.c
@@ -7,7 +7,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > * a C file with appropriate escaping, as well as program definitions
* written as #program <name> = <shader1> <shader2> ... <shaderN>
*
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * Copyright (c) 2007-201<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >0</span> Nathan Keynes.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * Copyright (c) 2007-201<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >2</span> Nathan Keynes.
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -26,6 +26,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include <stdio.h>
#include <stdlib.h>
#include <string.h>
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include <getopt.h>
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include <glib/gstrfuncs.h>
#include <glib/glist.h>
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -144,7 +145,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-static struct glsldata *readInput( const char *filename )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static void readInput( const char *filename, glsldata_t result )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
char buf[MAX_LINE];
size_t current_size = 0, current_posn = 0;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -153,13 +154,17 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > FILE *f = fopen( filename, "ro" );
if( f == NULL ) {
fprintf( stderr, "Error: unable to open input file '%s': %s\n", filename, strerror(errno) );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- exit(<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >1</span>);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ exit(<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >2</span>);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
shader_t shader = NULL;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- glsldata_t result = g_malloc0(sizeof(struct glsldata));
- assert( result != NULL );
- result->filename = strdup(filename);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ if( result->filename == NULL ) {
+ result->filename = g_strdup(filename);
+ } else {
+ const gchar *tmp = result->filename;
+ result->filename = g_strdup_printf("%s, %s", tmp, filename);
+ g_free((gchar *)tmp);
+ }
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
while( fgets(buf, sizeof(buf), f) != NULL ) {
if( strlen(buf) == 0 )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -220,8 +225,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
fclose(f);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- linkPrograms(result);
- return result;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
/**
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -433,7 +436,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > fclose(f);
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-const char *makeExtension(const char *basename, const char *ext)
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >static </span>const char *makeExtension(const char *basename, const char *ext)
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
const char *oldext = strrchr(basename, '.');
if( oldext == NULL ) {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -443,29 +446,65 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
}
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static char *option_list = "hi:o:";
+static struct option long_option_list[] = {
+ { "help", no_argument, NULL, 'h' },
+ { "interface", required_argument, 'i' },
+ { "output", required_argument, NULL, 'o' },
+ { NULL, 0, 0, 0 } };
+
+static void usage() {
+ fprintf( stderr, "Usage: genglsl <glsl-source-list> [-o output.def] [-i output.h]\n");
+}
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > int main( int argc, char *argv[] )
{
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- if( argc < 2 ) {
- fprintf( stderr, "Usage: genglsl <glsl-source-file> [output.c [output.h]]\n");
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ const char *output_file = NULL;
+ const char *iface_file = NULL;
+ int opt;
+
+ while( (opt = getopt_long( argc, argv, option_list, long_option_list, NULL )) != -1 ) {
+ switch( opt ) {
+ case 'h':
+ usage();
+ exit(0);
+ break;
+ case 'i':
+ if( iface_file != NULL ) {
+ fprintf( stderr, "Error: at most one interface file can be supplied\n" );
+ usage();
+ exit(1);
+ }
+ iface_file = optarg;
+ break;
+ case 'o':
+ if( output_file != NULL ) {
+ fprintf( stderr, "Error: at most one output file can be supplied\n" );
+ usage();
+ exit(1);
+ }
+ output_file = optarg;
+ }
+ }
+
+ if( optind == argc ) {
+ usage();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > exit(1);
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- glsldata_t data = readInput(argv[1]);
-
- const char *sourcefile, *ifacefile;
- if( argc > 2 ) {
- sourcefile = argv[2];
- } else {
- sourcefile = makeExtension(argv[1], ".def");
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ if( output_file == NULL ) {
+ output_file = makeExtension(argv[optind], ".def");
+ }
+ if( iface_file == NULL ) {
+ iface_file = makeExtension(output_file, ".h");
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- if( argc > 3 ) {
- ifacefile = argv[3];
- } else {
- ifacefile = makeExtension(sourcefile, ".h");
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ glsldata_t data = g_malloc0(sizeof(struct glsldata));
+ while( optind < argc ) {
+ readInput(argv[optind++], data);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ linkPrograms(data);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- writeSource( sourcefile, data );
- writeInterface( ifacefile, data );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ writeSource( output_file, data );
+ writeInterface( iface_file, data );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > return 0;
}
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>