blob: a5ae650426abd77c7e449b2c63d8348a8de2dde9 [file] [log] [blame]
Robert Bieber81ba38e2010-07-22 08:22:20 +00001#!/usr/bin/php -q
2<?php
3/***************************************************************************
4 * __________ __ ___.
5 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
6 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
7 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
8 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * \/ \/ \/ \/ \/
10 * $Id$
11 *
12 * Copyright (C) 2010 Robert Bieber
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23
Robert Biebere1e51f92010-07-25 21:16:37 +000024// Printing the do-not-modify warning
25echo "# ----------------------------------------------------------- #\n";
26echo "# ----------------------------------------------------------- #\n";
27echo "# --- This file automatically generated, do not modify! --- #\n";
Robert Biebere1e51f92010-07-25 21:16:37 +000028echo "# ----------------------------------------------------------- #\n";
29echo "# ----------------------------------------------------------- #\n\n";
30
Robert Bieberd73c81f2010-07-30 20:47:25 +000031// Importing the target array
32system('./includetargets.pl');
33require('./targets.php');
34unlink('./targets.php');
Robert Bieber81ba38e2010-07-22 08:22:20 +000035
36// Looping through all the targets
37foreach($targets as $target => $plaintext)
38{
39 // Opening a cpp process
40 $configfile = '../../firmware/export/config/' . $target . '.h';
Robert Bieberd73c81f2010-07-30 20:47:25 +000041 if(!file_exists($configfile))
42 continue;
Robert Bieber81ba38e2010-07-22 08:22:20 +000043 $descriptor = array( 0 => array("pipe", "r"), //stdin
44 1 => array("pipe", "w") //stdout
45 );
46
47 $proc = proc_open('cpp', $descriptor, $pipes);
48
49 if($proc == false)
50 die("Failed to open process");
51
52 // Feeding the input to cpp
53 $input = "#include \"$configfile\"\n";
54 $input .= <<<STR
55lcd
56LCD_WIDTH
57LCD_HEIGHT
58LCD_DEPTH
59remote
60#ifdef HAVE_REMOTE_LCD
61LCD_REMOTE_WIDTH
62LCD_REMOTE_HEIGHT
63LCD_REMOTE_DEPTH
64#endif
65tuner
66#ifdef CONFIG_TUNER
67yes
68#endif
69recording
70#ifdef HAVE_RECORDING
71yes
72#endif
73unused
74STR;
75
76 fwrite($pipes[0], $input);
77 fclose($pipes[0]);
78
79 $results = stream_get_contents($pipes[1]);
80 fclose($pipes[1]);
81 $results = explode("\n", $results);
82
Robert Bieberd73c81f2010-07-30 20:47:25 +000083 $base = 0;
84 while($results[$base] != 'lcd')
85 $base++;
86
Robert Bieber81ba38e2010-07-22 08:22:20 +000087 // Header for the target
88 echo $target . "\n{\n";
89 echo ' name : ' . $plaintext . "\n";
90
91 // Writing the LCD dimensions
Robert Bieberd73c81f2010-07-30 20:47:25 +000092 echo ' screen : ' . $results[$base + 1] . ' x ' . $results[$base + 2] . ' @ ';
93 if($results[$base + 3] == 1)
Robert Bieber81ba38e2010-07-22 08:22:20 +000094 echo 'mono';
Robert Bieberd73c81f2010-07-30 20:47:25 +000095 else if($results[$base + 3] == 2)
Robert Bieber81ba38e2010-07-22 08:22:20 +000096 echo 'grey';
97 else
98 echo 'rgb';
99 echo "\n";
100
101 // Writing the remote dimensions if necessary
102 echo ' remote : ';
Robert Bieberd73c81f2010-07-30 20:47:25 +0000103 if($results[$base + 6] == 0)
Robert Bieber81ba38e2010-07-22 08:22:20 +0000104 {
105 echo 'no';
106 }
107 else
108 {
Robert Bieberd73c81f2010-07-30 20:47:25 +0000109 echo $results[$base + 6] . ' x ' .$results[$base + 7] . ' @ ';
110 if($results[$base + 8] == 1)
Robert Bieber81ba38e2010-07-22 08:22:20 +0000111 echo 'mono';
Robert Bieberd73c81f2010-07-30 20:47:25 +0000112 else if($results[$base + 8] == 2)
Robert Bieber81ba38e2010-07-22 08:22:20 +0000113 echo 'grey';
114 else
115 echo 'rgb';
116 }
117 echo "\n";
118
119 // Writing FM capability
120 echo ' fm : ';
Robert Bieberd73c81f2010-07-30 20:47:25 +0000121 if($results[$base + 12] == 'yes')
Robert Bieber81ba38e2010-07-22 08:22:20 +0000122 echo 'yes';
123 else
124 echo 'no';
125 echo "\n";
126
127 // Writing record capability
128 echo ' record : ';
Robert Bieberd73c81f2010-07-30 20:47:25 +0000129 if($results[$base + 16] == 'yes')
Robert Bieber81ba38e2010-07-22 08:22:20 +0000130 echo 'yes';
131 else
132 echo 'no';
133 echo "\n";
134
135 // Closing the target
136 echo "}\n\n";
137
138 proc_close($proc);
139}
140
141?>