gerbvhtdocs/doxygen/example1_8c-example.html

68 lines
4.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>gerbv: example1.c</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>example1.c</h1><div class="fragment"><pre class="fragment"><span class="comment">/*------------------------------------------------------------------------------</span>
<span class="comment"> Filename: example1.c</span>
<span class="comment"> </span>
<span class="comment"> Description: Loads example1-input.gbx into a project, and then exports</span>
<span class="comment"> the layer back to another RS274X file.</span>
<span class="comment"></span>
<span class="comment"> Instructions: Make sure you are in the example-code directory, and compile</span>
<span class="comment"> this program with the following command:</span>
<span class="comment"></span>
<span class="comment"> gcc -Wall -g `pkg-config --cflags gtk+-2.0 glib-2.0 libgerbv` `pkg-config \</span>
<span class="comment">--libs gtk+-2.0 glib-2.0 libgerbv` example1.c -o example1</span>
<span class="comment"></span>
<span class="comment"> Run with the following command:</span>
<span class="comment"> </span>
<span class="comment"> ./example1</span>
<span class="comment"></span>
<span class="comment">------------------------------------------------------------------------------*/</span>
<span class="preprocessor">#include "<a class="code" href="gerbv_8h.html" title="The main header file for the libgerbv library.">gerbv.h</a>"</span>
<span class="keywordtype">int</span>
main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]) {
<span class="comment">/* create a top level libgerbv structure */</span>
<a name="_a0"></a><a class="code" href="structgerbv__project__t.html">gerbv_project_t</a> *<a name="a1"></a><a class="code" href="main_8c.html#8d078d012e6d279c43966b2121226c43" title="Global state variable to keep track of what&amp;#39;s happening on the screen.">mainProject</a> = <a name="a2"></a><a class="code" href="gerbv_8c.html#5320e4f59b98078e635681ef0c5454c8" title="Create a new project structure and initialize some important variables.">gerbv_create_project</a>();
<span class="comment">/* parse a Gerber file and store it in the gerbv_project_t struct */</span>
<a name="a3"></a><a class="code" href="gerbv_8c.html#99cc1512fb3e47976604fde92ae3ce8c" title="Open a file, parse the contents, and add a new layer to an existing project.">gerbv_open_layer_from_filename</a> (mainProject, <span class="stringliteral">"example1-input.gbx"</span>);
<span class="comment">/* make sure we parsed the file */</span>
<span class="keywordflow">if</span> (mainProject-&gt;<a name="a4"></a><a class="code" href="structgerbv__project__t.html#3ecaa11fbc1cef45f458e2b88445ac35">file</a>[0] == NULL)
g_error (<span class="stringliteral">"There was an error parsing the file."</span>);
<span class="comment">/* export the first (and only) image in the project, which will be the</span>
<span class="comment"> one we just loaded */</span>
<a name="a5"></a><a class="code" href="export-rs274x_8c.html#49e264bfff8ce4ae783c173b48bba31d" title="Export an image to a new file in RS274X format.">gerbv_export_rs274x_file_from_image</a> (<span class="stringliteral">"example1-output.gbx"</span>,
mainProject-&gt;<a class="code" href="structgerbv__project__t.html#3ecaa11fbc1cef45f458e2b88445ac35">file</a>[0]-&gt;<a name="a6"></a><a class="code" href="structgerbv__fileinfo__t.html#0aec7123b754ed7cb0adc9c98e985f84">image</a>);
<span class="comment">/* destroy the top-level structure and free all memory */</span>
<a name="a7"></a><a class="code" href="gerbv_8c.html#2e09480d52ed08f73975eec160946b0c" title="Free a project and all related variables.">gerbv_destroy_project</a> (mainProject);
<span class="keywordflow">return</span> 0;
}
</pre></div> </div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Aug 19 00:14:47 2008 for gerbv by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>