changeset 59337:40e71d36d71d foreign

8223033: panama_foreign.md should have a basic hello world example Reviewed-by: sundar
author jlaskey
date Fri, 26 Apr 2019 13:38:23 -0300
parents 664abc4e7063
children 327e2aa993f0
files doc/panama_foreign.html doc/panama_foreign.md
diffstat 2 files changed, 875 insertions(+), 779 deletions(-) [+]
line wrap: on
line diff
--- a/doc/panama_foreign.html	Fri Apr 26 18:27:32 2019 +0530
+++ b/doc/panama_foreign.html	Fri Apr 26 13:38:23 2019 -0300
@@ -1,80 +1,49 @@
 <!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
+<html>
 <head>
-  <meta charset="utf-8" />
-  <meta name="generator" content="pandoc" />
-  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+  <meta charset="utf-8">
+  <meta name="generator" content="pandoc">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
   <title>Using Panama &quot;foreign&quot; JDK</title>
+  <style type="text/css">code{white-space: pre;}</style>
   <style type="text/css">
-      code{white-space: pre-wrap;}
-      span.smallcaps{font-variant: small-caps;}
-      span.underline{text-decoration: underline;}
-      div.column{display: inline-block; vertical-align: top; width: 50%;}
+div.sourceCode { overflow-x: auto; }
+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
+  margin: 0; padding: 0; vertical-align: baseline; border: none; }
+table.sourceCode { width: 100%; line-height: 100%; }
+td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
+td.sourceCode { padding-left: 5px; }
+code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
+code > span.dt { color: #902000; } /* DataType */
+code > span.dv { color: #40a070; } /* DecVal */
+code > span.bn { color: #40a070; } /* BaseN */
+code > span.fl { color: #40a070; } /* Float */
+code > span.ch { color: #4070a0; } /* Char */
+code > span.st { color: #4070a0; } /* String */
+code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
+code > span.ot { color: #007020; } /* Other */
+code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
+code > span.fu { color: #06287e; } /* Function */
+code > span.er { color: #ff0000; font-weight: bold; } /* Error */
+code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
+code > span.cn { color: #880000; } /* Constant */
+code > span.sc { color: #4070a0; } /* SpecialChar */
+code > span.vs { color: #4070a0; } /* VerbatimString */
+code > span.ss { color: #bb6688; } /* SpecialString */
+code > span.im { } /* Import */
+code > span.va { color: #19177c; } /* Variable */
+code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
+code > span.op { color: #666666; } /* Operator */
+code > span.bu { } /* BuiltIn */
+code > span.ex { } /* Extension */
+code > span.pp { color: #bc7a00; } /* Preprocessor */
+code > span.at { color: #7d9029; } /* Attribute */
+code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
+code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
+code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
+code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
   </style>
-  <style type="text/css">
-a.sourceLine { display: inline-block; line-height: 1.25; }
-a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
-a.sourceLine:empty { height: 1.2em; }
-.sourceCode { overflow: visible; }
-code.sourceCode { white-space: pre; position: relative; }
-div.sourceCode { margin: 1em 0; }
-pre.sourceCode { margin: 0; }
-@media screen {
-div.sourceCode { overflow: auto; }
-}
-@media print {
-code.sourceCode { white-space: pre-wrap; }
-a.sourceLine { text-indent: -1em; padding-left: 1em; }
-}
-pre.numberSource a.sourceLine
-  { position: relative; left: -4em; }
-pre.numberSource a.sourceLine::before
-  { content: attr(data-line-number);
-    position: relative; left: -1em; text-align: right; vertical-align: baseline;
-    border: none; pointer-events: all; display: inline-block;
-    -webkit-touch-callout: none; -webkit-user-select: none;
-    -khtml-user-select: none; -moz-user-select: none;
-    -ms-user-select: none; user-select: none;
-    padding: 0 4px; width: 4em;
-    color: #aaaaaa;
-  }
-pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
-div.sourceCode
-  {  }
-@media screen {
-a.sourceLine::before { text-decoration: underline; }
-}
-code span.al { color: #ff0000; font-weight: bold; } /* Alert */
-code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
-code span.at { color: #7d9029; } /* Attribute */
-code span.bn { color: #40a070; } /* BaseN */
-code span.bu { } /* BuiltIn */
-code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
-code span.ch { color: #4070a0; } /* Char */
-code span.cn { color: #880000; } /* Constant */
-code span.co { color: #60a0b0; font-style: italic; } /* Comment */
-code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
-code span.do { color: #ba2121; font-style: italic; } /* Documentation */
-code span.dt { color: #902000; } /* DataType */
-code span.dv { color: #40a070; } /* DecVal */
-code span.er { color: #ff0000; font-weight: bold; } /* Error */
-code span.ex { } /* Extension */
-code span.fl { color: #40a070; } /* Float */
-code span.fu { color: #06287e; } /* Function */
-code span.im { } /* Import */
-code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
-code span.kw { color: #007020; font-weight: bold; } /* Keyword */
-code span.op { color: #666666; } /* Operator */
-code span.ot { color: #007020; } /* Other */
-code span.pp { color: #bc7a00; } /* Preprocessor */
-code span.sc { color: #4070a0; } /* SpecialChar */
-code span.ss { color: #bb6688; } /* SpecialString */
-code span.st { color: #4070a0; } /* String */
-code span.va { color: #19177c; } /* Variable */
-code span.vs { color: #4070a0; } /* VerbatimString */
-code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
-  </style>
-  <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css" />
+  <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css">
   <!--[if lt IE 9]>
     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
   <![endif]-->
@@ -87,6 +56,14 @@
 <ul>
 <li><a href="#using-panama-foreign-jdk">Using Panama &quot;foreign&quot; JDK</a><ul>
 <li><a href="#windows-notes">Windows notes</a></li>
+<li><a href="#hello-world">Hello World</a><ul>
+<li><a href="#hello-world-c-header-helloworld.h">Hello World C Header (helloworld.h)</a></li>
+<li><a href="#hello-world-c-source-helloworld.c">Hello World C Source (helloworld.c)</a></li>
+<li><a href="#building-hello-world">Building Hello World</a></li>
+<li><a href="#jextract-a-jar-file-for-helloworld.h">jextract a Jar file for helloworld.h</a></li>
+<li><a href="#java-program-that-uses-extracted-helloworld-interface">Java program that uses extracted helloworld interface</a></li>
+<li><a href="#running-the-java-code-that-invokes-helloworld">Running the Java code that invokes helloworld</a></li>
+</ul></li>
 <li><a href="#embedding-python-interpreter-in-your-java-program-mac-os">Embedding Python interpreter in your Java program (Mac OS)</a><ul>
 <li><a href="#jextract-a-jar-file-for-python.h">jextract a Jar file for Python.h</a></li>
 <li><a href="#java-program-that-uses-extracted-python-interface">Java program that uses extracted Python interface</a></li>
@@ -197,183 +174,227 @@
 <p>You will (almost always) need to have Visual Studio installed, since most libraries indirectly depend on Visual Studio runtime libraries and this currently means that jextract needs their header to extract successfully. Windows examples have been tested with <a href="https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017">Build Tools for Visual Studio 2017</a>.</p>
 <p>It is generally a good idea to give jextract a bunch of extra memory since a lot of big system headers are transitively included. The extra memory will make the jextract run significantly faster. Windows support was added only recently, and the memory usage of jextract has not been optimized yet, so this is a workaround. You can give extra memory by passing e.g. <code>-J-Xmx8G</code> to jextract as an additional argument, which in this example gives jextract 8 gigabytes of memory.</p>
 <p>Commands are tested in PowerShell.</p>
+<h2 id="hello-world">Hello World</h2>
+<h3 id="hello-world-c-header-helloworld.h">Hello World C Header (helloworld.h)</h3>
+<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c">
+<span class="pp">#ifndef helloworld_h</span>
+<span class="pp">#define helloworld_h</span>
+
+<span class="kw">extern</span> <span class="dt">void</span> helloworld(<span class="dt">void</span>);
+
+<span class="pp">#endif </span><span class="co">/* helloworld_h */</span>
+</code></pre></div>
+<h3 id="hello-world-c-source-helloworld.c">Hello World C Source (helloworld.c)</h3>
+<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c">
+<span class="pp">#include </span><span class="im">&lt;stdio.h&gt;</span>
+
+<span class="pp">#include </span><span class="im">&quot;helloworld.h&quot;</span>
+
+<span class="dt">void</span> helloworld(<span class="dt">void</span>) {
+    printf(<span class="st">&quot;Hello World!</span><span class="sc">\n</span><span class="st">&quot;</span>);
+}</code></pre></div>
+<h3 id="building-hello-world">Building Hello World</h3>
+<pre><code>
+cc -shared -o helloworld.dylib helloworld.c
+</code></pre>
+<h3 id="jextract-a-jar-file-for-helloworld.h">jextract a Jar file for helloworld.h</h3>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -t org.hello -L . -lhelloworld --record-library-path helloworld.h -o helloworld.jar</code></pre></div>
+<h3 id="java-program-that-uses-extracted-helloworld-interface">Java program that uses extracted helloworld interface</h3>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> org.hello.helloworld_lib;</span>
+
+<span class="kw">import static</span><span class="im"> org.hello.helloworld_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> HelloWorld {
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+        <span class="kw">try</span> (Scope s = helloworld_lib.<span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            <span class="fu">helloworld</span>();
+        }
+    }
+}</code></pre></div>
+<h3 id="running-the-java-code-that-invokes-helloworld">Running the Java code that invokes helloworld</h3>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp helloworld.jar HelloWorld.java
+
+<span class="ex">java</span> -cp helloworld.jar:. HelloWorld</code></pre></div>
 <h2 id="embedding-python-interpreter-in-your-java-program-mac-os">Embedding Python interpreter in your Java program (Mac OS)</h2>
 <h3 id="jextract-a-jar-file-for-python.h">jextract a Jar file for Python.h</h3>
-<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb1-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="ex">jextract</span> -l python2.7 \</a>
-<a class="sourceLine" id="cb1-3" data-line-number="3">  -L /System/Library/Frameworks/Python.framework/Versions/2.7/lib --record-library-path \</a>
-<a class="sourceLine" id="cb1-4" data-line-number="4">  --exclude-symbols .*_FromFormatV<span class="dt">\|</span>_.*<span class="dt">\|</span>PyOS_vsnprintf<span class="dt">\|</span>.*_VaParse.*<span class="dt">\|</span>.*_VaBuild.*<span class="dt">\|</span>PyBuffer_SizeFromFormat<span class="dt">\|</span>vasprintf<span class="dt">\|</span>vfprintf<span class="dt">\|</span>vprintf<span class="dt">\|</span>vsprintf \</a>
-<a class="sourceLine" id="cb1-5" data-line-number="5">  -t org.python \</a>
-<a class="sourceLine" id="cb1-6" data-line-number="6">  /usr/include/python2.7/Python.h \</a>
-<a class="sourceLine" id="cb1-7" data-line-number="7">  -o python.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -l python2.7 \
+  -L /System/Library/Frameworks/Python.framework/Versions/2.7/lib --record-library-path \
+  --exclude-symbols .*_FromFormatV<span class="dt">\|</span>_.*<span class="dt">\|</span>PyOS_vsnprintf<span class="dt">\|</span>.*_VaParse.*<span class="dt">\|</span>.*_VaBuild.*<span class="dt">\|</span>PyBuffer_SizeFromFormat<span class="dt">\|</span>vasprintf<span class="dt">\|</span>vfprintf<span class="dt">\|</span>vprintf<span class="dt">\|</span>vsprintf \
+  -t org.python \
+  /usr/include/python2.7/Python.h \
+  -o python.jar</code></pre></div>
 <h3 id="java-program-that-uses-extracted-python-interface">Java program that uses extracted Python interface</h3>
-<div class="sourceCode" id="cb2"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb2-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="co">// import java.foreign packages</span></a>
-<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.Libraries;</span></a>
-<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="kw">import</span><span class="im"> java.foreign.Scope;</span></a>
-<a class="sourceLine" id="cb2-5" data-line-number="5"><span class="kw">import</span><span class="im"> java.foreign.memory.Pointer;</span></a>
-<a class="sourceLine" id="cb2-6" data-line-number="6"></a>
-<a class="sourceLine" id="cb2-7" data-line-number="7"><span class="co">// import jextracted python &#39;header&#39; classes</span></a>
-<a class="sourceLine" id="cb2-8" data-line-number="8"><span class="kw">import static</span><span class="im"> org.python.Python_lib.*;</span></a>
-<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="kw">import static</span><span class="im"> org.python.pythonrun_lib.*;</span></a>
-<a class="sourceLine" id="cb2-10" data-line-number="10"></a>
-<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="kw">public</span> <span class="kw">class</span> PythonMain {</a>
-<a class="sourceLine" id="cb2-12" data-line-number="12">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb2-13" data-line-number="13">        <span class="fu">Py_Initialize</span>();</a>
-<a class="sourceLine" id="cb2-14" data-line-number="14">        <span class="kw">try</span> (Scope s = org.<span class="fu">python</span>.<span class="fu">Python_lib</span>.<span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb2-15" data-line-number="15">            <span class="fu">PyRun_SimpleStringFlags</span>(s.<span class="fu">allocateCString</span>(</a>
-<a class="sourceLine" id="cb2-16" data-line-number="16">                <span class="st">&quot;print(sum([33, 55, 66])); print(&#39;Hello from Python!&#39;)</span><span class="sc">\n</span><span class="st">&quot;</span>),</a>
-<a class="sourceLine" id="cb2-17" data-line-number="17">                Pointer.<span class="fu">ofNull</span>());</a>
-<a class="sourceLine" id="cb2-18" data-line-number="18">        }</a>
-<a class="sourceLine" id="cb2-19" data-line-number="19">        <span class="fu">Py_Finalize</span>();</a>
-<a class="sourceLine" id="cb2-20" data-line-number="20">    }</a>
-<a class="sourceLine" id="cb2-21" data-line-number="21">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="co">// import java.foreign packages</span>
+<span class="kw">import</span><span class="im"> java.foreign.Libraries;</span>
+<span class="kw">import</span><span class="im"> java.foreign.Scope;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Pointer;</span>
+
+<span class="co">// import jextracted python &#39;header&#39; classes</span>
+<span class="kw">import static</span><span class="im"> org.python.Python_lib.*;</span>
+<span class="kw">import static</span><span class="im"> org.python.pythonrun_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> PythonMain {
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+        <span class="fu">Py_Initialize</span>();
+        <span class="kw">try</span> (Scope s = org.<span class="fu">python</span>.<span class="fu">Python_lib</span>.<span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            <span class="fu">PyRun_SimpleStringFlags</span>(s.<span class="fu">allocateCString</span>(
+                <span class="st">&quot;print(sum([33, 55, 66])); print(&#39;Hello from Python!&#39;)</span><span class="sc">\n</span><span class="st">&quot;</span>),
+                Pointer.<span class="fu">ofNull</span>());
+        }
+        <span class="fu">Py_Finalize</span>();
+    }
+}</code></pre></div>
 <h3 id="running-the-java-code-that-calls-python-interpreter">Running the Java code that calls Python interpreter</h3>
-<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb3-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="ex">javac</span> -cp python.jar PythonMain.java</a>
-<a class="sourceLine" id="cb3-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="ex">java</span> -cp python.jar:. PythonMain</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp python.jar PythonMain.java
+
+<span class="ex">java</span> -cp python.jar:. PythonMain</code></pre></div>
 <h2 id="jlinking-python-interpreter-in-your-jdk-mac-os">jlinking Python Interpreter in your JDK (Mac OS)</h2>
 <h3 id="generating-jmod-using-jextract">Generating jmod using jextract</h3>
-<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb4-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="ex">jextract</span> -l python2.7 \</a>
-<a class="sourceLine" id="cb4-3" data-line-number="3">  -L /System/Library/Frameworks/Python.framework/Versions/2.7/lib \</a>
-<a class="sourceLine" id="cb4-4" data-line-number="4">  --exclude-symbols .*_FromFormatV<span class="dt">\|</span>_.*<span class="dt">\|</span>PyOS_vsnprintf<span class="dt">\|</span>.*_VaParse.*<span class="dt">\|</span>.*_VaBuild.*<span class="dt">\|</span>PyBuffer_SizeFromFormat<span class="dt">\|</span>vasprintf<span class="dt">\|</span>vfprintf<span class="dt">\|</span>vprintf<span class="dt">\|</span>vsprintf \</a>
-<a class="sourceLine" id="cb4-5" data-line-number="5">  -t org.python \</a>
-<a class="sourceLine" id="cb4-6" data-line-number="6">  /usr/include/python2.7/Python.h \</a>
-<a class="sourceLine" id="cb4-7" data-line-number="7">  -o org.python.jmod</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -l python2.7 \
+  -L /System/Library/Frameworks/Python.framework/Versions/2.7/lib \
+  --exclude-symbols .*_FromFormatV<span class="dt">\|</span>_.*<span class="dt">\|</span>PyOS_vsnprintf<span class="dt">\|</span>.*_VaParse.*<span class="dt">\|</span>.*_VaBuild.*<span class="dt">\|</span>PyBuffer_SizeFromFormat<span class="dt">\|</span>vasprintf<span class="dt">\|</span>vfprintf<span class="dt">\|</span>vprintf<span class="dt">\|</span>vsprintf \
+  -t org.python \
+  /usr/include/python2.7/Python.h \
+  -o org.python.jmod</code></pre></div>
 <h3 id="jlinking-python-module-to-create-a-jdk-with-python-in-it">Jlinking python module to create a JDK with Python in it</h3>
 <p>jdk.compiler and org.python modules are added to the generated (jlinked) JDK</p>
-<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb5-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="ex">jlink</span> --add-modules org.python,jdk.compiler --module-path . --output pythonjdk</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jlink</span> --add-modules org.python,jdk.compiler --module-path . --output pythonjdk</code></pre></div>
 <h3 id="compile-and-run-user-code-with-pythonjdk-jdk">Compile and run user code with &quot;pythonjdk&quot; jdk</h3>
 <p>In the following commands, it is assumed that you've put $pythonjdk/bin in your $PATH</p>
-<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb6-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="ex">javac</span> PythonMain.java</a>
-<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="ex">java</span> PythonMain</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> PythonMain.java
+<span class="ex">java</span> PythonMain</code></pre></div>
 <h2 id="embedding-python-interpreter-in-your-java-program-ubuntu-16.04">Embedding Python interpreter in your Java program (Ubuntu 16.04)</h2>
 <h3 id="jextract-a-jar-file-for-python.h-1">jextract a Jar file for Python.h</h3>
-<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb7-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="ex">jextract</span> -l python2.7 \</a>
-<a class="sourceLine" id="cb7-3" data-line-number="3">  -L /usr/lib/python2.7/config-x86_64-linux-gnu --record-library-path \</a>
-<a class="sourceLine" id="cb7-4" data-line-number="4">  --exclude-symbols .*_FromFormatV<span class="dt">\|</span>_.*<span class="dt">\|</span>PyOS_vsnprintf<span class="dt">\|</span>.*_VaParse.*<span class="dt">\|</span>.*_VaBuild.*<span class="dt">\|</span>PyBuffer_SizeFromFormat<span class="dt">\|</span>vasprintf<span class="dt">\|</span>vfprintf<span class="dt">\|</span>vprintf<span class="dt">\|</span>vsprintf \</a>
-<a class="sourceLine" id="cb7-5" data-line-number="5">  -t org.python \</a>
-<a class="sourceLine" id="cb7-6" data-line-number="6">  /usr/include/python2.7/Python.h \</a>
-<a class="sourceLine" id="cb7-7" data-line-number="7">  -o python.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -l python2.7 \
+  -L /usr/lib/python2.7/config-x86_64-linux-gnu --record-library-path \
+  --exclude-symbols .*_FromFormatV<span class="dt">\|</span>_.*<span class="dt">\|</span>PyOS_vsnprintf<span class="dt">\|</span>.*_VaParse.*<span class="dt">\|</span>.*_VaBuild.*<span class="dt">\|</span>PyBuffer_SizeFromFormat<span class="dt">\|</span>vasprintf<span class="dt">\|</span>vfprintf<span class="dt">\|</span>vprintf<span class="dt">\|</span>vsprintf \
+  -t org.python \
+  /usr/include/python2.7/Python.h \
+  -o python.jar</code></pre></div>
 <h3 id="compiling-and-running-python-java-example">Compiling and Running Python Java example</h3>
 <p>Follow the instructions from the Mac OS section</p>
 <h2 id="embedding-python-interpreter-in-your-java-program-windows">Embedding Python interpreter in your Java program (Windows)</h2>
 <h3 id="jextract-a-jar-file-for-python.h-2">jextract a Jar file for Python.h</h3>
 <p>Where python 2.7 is installed in the <code>C:\Python27</code> directory:</p>
-<div class="sourceCode" id="cb8"><pre class="sourceCode powershell"><code class="sourceCode powershell"><a class="sourceLine" id="cb8-1" data-line-number="1">jextract -L <span class="st">&quot;C:\Windows\System32&quot;</span> -l python27 -o python.<span class="fu">jar</span> -t <span class="st">&quot;org.python&quot;</span> --record-library-path C:\Python27\include\Python.<span class="fu">h</span></a></code></pre></div>
+<pre class="powershell"><code>jextract -L &quot;C:\Windows\System32&quot; -l python27 -o python.jar -t &quot;org.python&quot; --record-library-path C:\Python27\include\Python.h</code></pre>
 <h3 id="compiling-and-running-python-java-example-1">Compiling and Running Python Java example</h3>
-<div class="sourceCode" id="cb9"><pre class="sourceCode powershell"><code class="sourceCode powershell"><a class="sourceLine" id="cb9-1" data-line-number="1">javac -cp python.<span class="fu">jar</span> PythonMain.<span class="fu">java</span></a>
-<a class="sourceLine" id="cb9-2" data-line-number="2">java -cp <span class="st">&quot;python.jar;.&quot;</span> PythonMain</a></code></pre></div>
+<pre class="powershell"><code>javac -cp python.jar PythonMain.java
+java -cp &quot;python.jar;.&quot; PythonMain</code></pre>
 <h2 id="using-sqlite3-library-in-your-java-program-mac-os">Using sqlite3 library in your Java program (Mac OS)</h2>
 <h3 id="jextract-a-jar-file-for-sqlite3.h">jextract a jar file for sqlite3.h</h3>
-<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb10-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="ex">jextract</span>  /usr/include/sqlite3.h -t org.sqlite -lsqlite3 \</a>
-<a class="sourceLine" id="cb10-3" data-line-number="3">    -L /usr/lib --record-library-path         \</a>
-<a class="sourceLine" id="cb10-4" data-line-number="4">    --exclude-symbols sqlite3_vmprintf        \</a>
-<a class="sourceLine" id="cb10-5" data-line-number="5">    --exclude-symbols sqlite3_vsnprintf       \</a>
-<a class="sourceLine" id="cb10-6" data-line-number="6">    -o sqlite3.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span>  /usr/include/sqlite3.h -t org.sqlite -lsqlite3 \
+    -L /usr/lib --record-library-path         \
+    --exclude-symbols sqlite3_vmprintf        \
+    --exclude-symbols sqlite3_vsnprintf       \
+    -o sqlite3.jar</code></pre></div>
 <h3 id="java-sample-that-uses-sqlite3-library">Java sample that uses sqlite3 library</h3>
-<div class="sourceCode" id="cb11"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb11-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.lang.invoke.*;</span></a>
-<a class="sourceLine" id="cb11-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.*;</span></a>
-<a class="sourceLine" id="cb11-4" data-line-number="4"><span class="kw">import</span><span class="im"> java.foreign.memory.*;</span></a>
-<a class="sourceLine" id="cb11-5" data-line-number="5"><span class="kw">import</span><span class="im"> org.sqlite.sqlite3_h.*;</span></a>
-<a class="sourceLine" id="cb11-6" data-line-number="6"><span class="kw">import static</span><span class="im"> org.sqlite.sqlite3_lib.*;</span></a>
-<a class="sourceLine" id="cb11-7" data-line-number="7"></a>
-<a class="sourceLine" id="cb11-8" data-line-number="8"><span class="kw">public</span> <span class="kw">class</span> SqliteMain {</a>
-<a class="sourceLine" id="cb11-9" data-line-number="9">   <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) <span class="kw">throws</span> <span class="bu">Exception</span> {</a>
-<a class="sourceLine" id="cb11-10" data-line-number="10">        <span class="kw">try</span> (Scope scope = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb11-11" data-line-number="11">            <span class="co">// char* errMsg;</span></a>
-<a class="sourceLine" id="cb11-12" data-line-number="12">            Pointer&lt;Pointer&lt;<span class="bu">Byte</span>&gt;&gt; errMsg = scope.<span class="fu">allocate</span>(NativeTypes.<span class="fu">INT8</span>.<span class="fu">pointer</span>());</a>
-<a class="sourceLine" id="cb11-13" data-line-number="13"></a>
-<a class="sourceLine" id="cb11-14" data-line-number="14">            <span class="co">// sqlite3* db;</span></a>
-<a class="sourceLine" id="cb11-15" data-line-number="15">            Pointer&lt;Pointer&lt;sqlite3&gt;&gt; db = scope.<span class="fu">allocate</span>(LayoutType.<span class="fu">ofStruct</span>(sqlite3.<span class="fu">class</span>).<span class="fu">pointer</span>());</a>
-<a class="sourceLine" id="cb11-16" data-line-number="16"></a>
-<a class="sourceLine" id="cb11-17" data-line-number="17">            <span class="dt">int</span> rc = <span class="fu">sqlite3_open</span>(scope.<span class="fu">allocateCString</span>(<span class="st">&quot;employee.db&quot;</span>), db);</a>
-<a class="sourceLine" id="cb11-18" data-line-number="18">            <span class="kw">if</span> (rc != <span class="dv">0</span>) {</a>
-<a class="sourceLine" id="cb11-19" data-line-number="19">                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_open failed: &quot;</span> + rc);</a>
-<a class="sourceLine" id="cb11-20" data-line-number="20">                <span class="kw">return</span>;</a>
-<a class="sourceLine" id="cb11-21" data-line-number="21">            }</a>
-<a class="sourceLine" id="cb11-22" data-line-number="22"></a>
-<a class="sourceLine" id="cb11-23" data-line-number="23">            <span class="co">// create a new table</span></a>
-<a class="sourceLine" id="cb11-24" data-line-number="24">            Pointer&lt;<span class="bu">Byte</span>&gt; sql = scope.<span class="fu">allocateCString</span>(</a>
-<a class="sourceLine" id="cb11-25" data-line-number="25">                <span class="st">&quot;CREATE TABLE EMPLOYEE (&quot;</span>  +</a>
-<a class="sourceLine" id="cb11-26" data-line-number="26">                <span class="st">&quot;  ID INT PRIMARY KEY NOT NULL,&quot;</span>       +</a>
-<a class="sourceLine" id="cb11-27" data-line-number="27">                <span class="st">&quot;  NAME TEXT NOT NULL,&quot;</span>    +</a>
-<a class="sourceLine" id="cb11-28" data-line-number="28">                <span class="st">&quot;  SALARY REAL NOT NULL )&quot;</span></a>
-<a class="sourceLine" id="cb11-29" data-line-number="29">            );</a>
-<a class="sourceLine" id="cb11-30" data-line-number="30"></a>
-<a class="sourceLine" id="cb11-31" data-line-number="31">            rc = <span class="fu">sqlite3_exec</span>(db.<span class="fu">get</span>(), sql, <span class="bu">Callback</span>.<span class="fu">ofNull</span>(), Pointer.<span class="fu">ofNull</span>(), errMsg);</a>
-<a class="sourceLine" id="cb11-32" data-line-number="32"></a>
-<a class="sourceLine" id="cb11-33" data-line-number="33">            <span class="kw">if</span> (rc != <span class="dv">0</span>) {</a>
-<a class="sourceLine" id="cb11-34" data-line-number="34">                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_exec failed: &quot;</span> + rc);</a>
-<a class="sourceLine" id="cb11-35" data-line-number="35">                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;SQL error: &quot;</span> + Pointer.<span class="fu">toString</span>(errMsg.<span class="fu">get</span>()));</a>
-<a class="sourceLine" id="cb11-36" data-line-number="36">                <span class="fu">sqlite3_free</span>(errMsg.<span class="fu">get</span>());</a>
-<a class="sourceLine" id="cb11-37" data-line-number="37">            }</a>
-<a class="sourceLine" id="cb11-38" data-line-number="38"></a>
-<a class="sourceLine" id="cb11-39" data-line-number="39">            <span class="co">// insert two rows</span></a>
-<a class="sourceLine" id="cb11-40" data-line-number="40">            sql = scope.<span class="fu">allocateCString</span>(</a>
-<a class="sourceLine" id="cb11-41" data-line-number="41">                <span class="st">&quot;INSERT INTO EMPLOYEE (ID,NAME,SALARY) &quot;</span> +</a>
-<a class="sourceLine" id="cb11-42" data-line-number="42">                    <span class="st">&quot;VALUES (134, &#39;Xyz&#39;, 200000.0); &quot;</span> +</a>
-<a class="sourceLine" id="cb11-43" data-line-number="43">                <span class="st">&quot;INSERT INTO EMPLOYEE (ID,NAME,SALARY) &quot;</span> +</a>
-<a class="sourceLine" id="cb11-44" data-line-number="44">                    <span class="st">&quot;VALUES (333, &#39;Abc&#39;, 100000.0);&quot;</span></a>
-<a class="sourceLine" id="cb11-45" data-line-number="45">            );</a>
-<a class="sourceLine" id="cb11-46" data-line-number="46">            rc = <span class="fu">sqlite3_exec</span>(db.<span class="fu">get</span>(), sql, <span class="bu">Callback</span>.<span class="fu">ofNull</span>(), Pointer.<span class="fu">ofNull</span>(), errMsg);</a>
-<a class="sourceLine" id="cb11-47" data-line-number="47"></a>
-<a class="sourceLine" id="cb11-48" data-line-number="48">            <span class="kw">if</span> (rc != <span class="dv">0</span>) {</a>
-<a class="sourceLine" id="cb11-49" data-line-number="49">                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_exec failed: &quot;</span> + rc);</a>
-<a class="sourceLine" id="cb11-50" data-line-number="50">                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;SQL error: &quot;</span> + Pointer.<span class="fu">toString</span>(errMsg.<span class="fu">get</span>()));</a>
-<a class="sourceLine" id="cb11-51" data-line-number="51">                <span class="fu">sqlite3_free</span>(errMsg.<span class="fu">get</span>());</a>
-<a class="sourceLine" id="cb11-52" data-line-number="52">            }</a>
-<a class="sourceLine" id="cb11-53" data-line-number="53"></a>
-<a class="sourceLine" id="cb11-54" data-line-number="54">            <span class="dt">int</span>[] rowNum = <span class="kw">new</span> <span class="dt">int</span>[<span class="dv">1</span>];</a>
-<a class="sourceLine" id="cb11-55" data-line-number="55">            <span class="co">// callback to print rows from SELECT query</span></a>
-<a class="sourceLine" id="cb11-56" data-line-number="56">            <span class="bu">Callback</span>&lt;FI1&gt; callback = scope.<span class="fu">allocateCallback</span>(FI1.<span class="fu">class</span>, (a, argc, argv, columnNames) -&gt; {</a>
-<a class="sourceLine" id="cb11-57" data-line-number="57">                <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;Row num: &quot;</span> + rowNum[<span class="dv">0</span>]++);</a>
-<a class="sourceLine" id="cb11-58" data-line-number="58">                <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;numColumns = &quot;</span> + argc);</a>
-<a class="sourceLine" id="cb11-59" data-line-number="59">                <span class="kw">for</span> (<span class="dt">int</span> i = <span class="dv">0</span>; i &lt; argc; i++) {</a>
-<a class="sourceLine" id="cb11-60" data-line-number="60">                     <span class="bu">String</span> name = Pointer.<span class="fu">toString</span>(columnNames.<span class="fu">offset</span>(i).<span class="fu">get</span>());</a>
-<a class="sourceLine" id="cb11-61" data-line-number="61">                     <span class="bu">String</span> value = Pointer.<span class="fu">toString</span>(argv.<span class="fu">offset</span>(i).<span class="fu">get</span>());</a>
-<a class="sourceLine" id="cb11-62" data-line-number="62">                     <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">%s</span><span class="st"> = </span><span class="sc">%s\n</span><span class="st">&quot;</span>, name, value);</a>
-<a class="sourceLine" id="cb11-63" data-line-number="63">                }</a>
-<a class="sourceLine" id="cb11-64" data-line-number="64">                <span class="kw">return</span> <span class="dv">0</span>;</a>
-<a class="sourceLine" id="cb11-65" data-line-number="65">            });</a>
-<a class="sourceLine" id="cb11-66" data-line-number="66"></a>
-<a class="sourceLine" id="cb11-67" data-line-number="67">            <span class="co">// select query</span></a>
-<a class="sourceLine" id="cb11-68" data-line-number="68">            sql = scope.<span class="fu">allocateCString</span>(<span class="st">&quot;SELECT * FROM EMPLOYEE&quot;</span>);</a>
-<a class="sourceLine" id="cb11-69" data-line-number="69">            rc = <span class="fu">sqlite3_exec</span>(db.<span class="fu">get</span>(), sql, callback, Pointer.<span class="fu">ofNull</span>(), errMsg);</a>
-<a class="sourceLine" id="cb11-70" data-line-number="70"></a>
-<a class="sourceLine" id="cb11-71" data-line-number="71">            <span class="kw">if</span> (rc != <span class="dv">0</span>) {</a>
-<a class="sourceLine" id="cb11-72" data-line-number="72">                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_exec failed: &quot;</span> + rc);</a>
-<a class="sourceLine" id="cb11-73" data-line-number="73">                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;SQL error: &quot;</span> + Pointer.<span class="fu">toString</span>(errMsg.<span class="fu">get</span>()));</a>
-<a class="sourceLine" id="cb11-74" data-line-number="74">                <span class="fu">sqlite3_free</span>(errMsg.<span class="fu">get</span>());</a>
-<a class="sourceLine" id="cb11-75" data-line-number="75">            }</a>
-<a class="sourceLine" id="cb11-76" data-line-number="76"> </a>
-<a class="sourceLine" id="cb11-77" data-line-number="77">            <span class="fu">sqlite3_close</span>(db.<span class="fu">get</span>());</a>
-<a class="sourceLine" id="cb11-78" data-line-number="78">        }</a>
-<a class="sourceLine" id="cb11-79" data-line-number="79">   }</a>
-<a class="sourceLine" id="cb11-80" data-line-number="80">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> java.lang.invoke.*;</span>
+<span class="kw">import</span><span class="im"> java.foreign.*;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.*;</span>
+<span class="kw">import</span><span class="im"> org.sqlite.sqlite3_h.*;</span>
+<span class="kw">import static</span><span class="im"> org.sqlite.sqlite3_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> SqliteMain {
+   <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) <span class="kw">throws</span> <span class="bu">Exception</span> {
+        <span class="kw">try</span> (Scope scope = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            <span class="co">// char* errMsg;</span>
+            Pointer&lt;Pointer&lt;<span class="bu">Byte</span>&gt;&gt; errMsg = scope.<span class="fu">allocate</span>(NativeTypes.<span class="fu">INT8</span>.<span class="fu">pointer</span>());
+
+            <span class="co">// sqlite3* db;</span>
+            Pointer&lt;Pointer&lt;sqlite3&gt;&gt; db = scope.<span class="fu">allocate</span>(LayoutType.<span class="fu">ofStruct</span>(sqlite3.<span class="fu">class</span>).<span class="fu">pointer</span>());
+
+            <span class="dt">int</span> rc = <span class="fu">sqlite3_open</span>(scope.<span class="fu">allocateCString</span>(<span class="st">&quot;employee.db&quot;</span>), db);
+            <span class="kw">if</span> (rc != <span class="dv">0</span>) {
+                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_open failed: &quot;</span> + rc);
+                <span class="kw">return</span>;
+            }
+
+            <span class="co">// create a new table</span>
+            Pointer&lt;<span class="bu">Byte</span>&gt; sql = scope.<span class="fu">allocateCString</span>(
+                <span class="st">&quot;CREATE TABLE EMPLOYEE (&quot;</span>  +
+                <span class="st">&quot;  ID INT PRIMARY KEY NOT NULL,&quot;</span>       +
+                <span class="st">&quot;  NAME TEXT NOT NULL,&quot;</span>    +
+                <span class="st">&quot;  SALARY REAL NOT NULL )&quot;</span>
+            );
+
+            rc = <span class="fu">sqlite3_exec</span>(db.<span class="fu">get</span>(), sql, <span class="bu">Callback</span>.<span class="fu">ofNull</span>(), Pointer.<span class="fu">ofNull</span>(), errMsg);
+
+            <span class="kw">if</span> (rc != <span class="dv">0</span>) {
+                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_exec failed: &quot;</span> + rc);
+                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;SQL error: &quot;</span> + Pointer.<span class="fu">toString</span>(errMsg.<span class="fu">get</span>()));
+                <span class="fu">sqlite3_free</span>(errMsg.<span class="fu">get</span>());
+            }
+
+            <span class="co">// insert two rows</span>
+            sql = scope.<span class="fu">allocateCString</span>(
+                <span class="st">&quot;INSERT INTO EMPLOYEE (ID,NAME,SALARY) &quot;</span> +
+                    <span class="st">&quot;VALUES (134, &#39;Xyz&#39;, 200000.0); &quot;</span> +
+                <span class="st">&quot;INSERT INTO EMPLOYEE (ID,NAME,SALARY) &quot;</span> +
+                    <span class="st">&quot;VALUES (333, &#39;Abc&#39;, 100000.0);&quot;</span>
+            );
+            rc = <span class="fu">sqlite3_exec</span>(db.<span class="fu">get</span>(), sql, <span class="bu">Callback</span>.<span class="fu">ofNull</span>(), Pointer.<span class="fu">ofNull</span>(), errMsg);
+
+            <span class="kw">if</span> (rc != <span class="dv">0</span>) {
+                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_exec failed: &quot;</span> + rc);
+                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;SQL error: &quot;</span> + Pointer.<span class="fu">toString</span>(errMsg.<span class="fu">get</span>()));
+                <span class="fu">sqlite3_free</span>(errMsg.<span class="fu">get</span>());
+            }
+
+            <span class="dt">int</span>[] rowNum = <span class="kw">new</span> <span class="dt">int</span>[<span class="dv">1</span>];
+            <span class="co">// callback to print rows from SELECT query</span>
+            <span class="bu">Callback</span>&lt;FI1&gt; callback = scope.<span class="fu">allocateCallback</span>(FI1.<span class="fu">class</span>, (a, argc, argv, columnNames) -&gt; {
+                <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;Row num: &quot;</span> + rowNum[<span class="dv">0</span>]++);
+                <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;numColumns = &quot;</span> + argc);
+                <span class="kw">for</span> (<span class="dt">int</span> i = <span class="dv">0</span>; i &lt; argc; i++) {
+                     <span class="bu">String</span> name = Pointer.<span class="fu">toString</span>(columnNames.<span class="fu">offset</span>(i).<span class="fu">get</span>());
+                     <span class="bu">String</span> value = Pointer.<span class="fu">toString</span>(argv.<span class="fu">offset</span>(i).<span class="fu">get</span>());
+                     <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">%s</span><span class="st"> = </span><span class="sc">%s\n</span><span class="st">&quot;</span>, name, value);
+                }
+                <span class="kw">return</span> <span class="dv">0</span>;
+            });
+
+            <span class="co">// select query</span>
+            sql = scope.<span class="fu">allocateCString</span>(<span class="st">&quot;SELECT * FROM EMPLOYEE&quot;</span>);
+            rc = <span class="fu">sqlite3_exec</span>(db.<span class="fu">get</span>(), sql, callback, Pointer.<span class="fu">ofNull</span>(), errMsg);
+
+            <span class="kw">if</span> (rc != <span class="dv">0</span>) {
+                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;sqlite3_exec failed: &quot;</span> + rc);
+                <span class="bu">System</span>.<span class="fu">err</span>.<span class="fu">println</span>(<span class="st">&quot;SQL error: &quot;</span> + Pointer.<span class="fu">toString</span>(errMsg.<span class="fu">get</span>()));
+                <span class="fu">sqlite3_free</span>(errMsg.<span class="fu">get</span>());
+            }
+
+            <span class="fu">sqlite3_close</span>(db.<span class="fu">get</span>());
+        }
+   }
+}</code></pre></div>
 <h3 id="compiling-and-running-sqlite-java-example">Compiling and Running sqlite Java example</h3>
-<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb12-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="ex">javac</span> -cp sqlite3.jar SqlMain.java</a>
-<a class="sourceLine" id="cb12-3" data-line-number="3"><span class="ex">java</span> -cp sqlite3.jar:. SqlMain</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp sqlite3.jar SqlMain.java
+<span class="ex">java</span> -cp sqlite3.jar:. SqlMain</code></pre></div>
 <h2 id="using-sqlite3-library-in-your-java-program-ubuntu-16.04">Using sqlite3 library in your Java program (Ubuntu 16.04)</h2>
 <h3 id="installing-sqlite3">Installing sqlite3</h3>
 <p>On Ubuntu (16.04) to install sqlite3 headers and libraries the following command is required:</p>
-<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb13-1" data-line-number="1"><span class="fu">sudo</span> apt-get install libsqlite3-dev</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="fu">sudo</span> apt-get install libsqlite3-dev</code></pre></div>
 <p>This should install the sqlite3 header (under <code>/usr/include</code>), as well as the sqlite3 shared library (under <code>/usr/lib/x86_64-linux-gnu</code>).</p>
 <h3 id="jextract-a-jar-file-for-sqlite3.h-1">jextract a jar file for sqlite3.h</h3>
 <p>To extract sqlite, run the following command:</p>
-<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb14-1" data-line-number="1"><span class="ex">jextract</span>  /usr/include/sqlite3.h -t org.sqlite -lsqlite3 \</a>
-<a class="sourceLine" id="cb14-2" data-line-number="2">          -L /usr/lib/x86_64-linux-gnu --record-library-path \</a>
-<a class="sourceLine" id="cb14-3" data-line-number="3">           --exclude-symbols sqlite3_vmprintf \</a>
-<a class="sourceLine" id="cb14-4" data-line-number="4">           --exclude-symbols sqlite3_vsnprintf \</a>
-<a class="sourceLine" id="cb14-5" data-line-number="5">           -o sqlite3.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">jextract</span>  /usr/include/sqlite3.h -t org.sqlite -lsqlite3 \
+          -L /usr/lib/x86_64-linux-gnu --record-library-path \
+           --exclude-symbols sqlite3_vmprintf \
+           --exclude-symbols sqlite3_vsnprintf \
+           -o sqlite3.jar</code></pre></div>
 <h3 id="compiling-and-running-sqlite-java-example-1">Compiling and Running sqlite Java example</h3>
 <p>Please refer to the Mac OS instructions; once the library as been extracted (as per the instructions above), the sample program shown in that section should work on Ubuntu as well.</p>
 <h2 id="using-blas-library">Using BLAS library</h2>
@@ -382,313 +403,313 @@
 <p>On Mac, blas is available as part of the OpenBLAS library: <a href="https://github.com/xianyi/OpenBLAS/wiki" class="uri">https://github.com/xianyi/OpenBLAS/wiki</a></p>
 <p>OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.</p>
 <p>You can install openblas using HomeBrew</p>
-<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb15-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb15-2" data-line-number="2"><span class="ex">brew</span> install openblas</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">brew</span> install openblas</code></pre></div>
 <p>It installs include and lib directories under /usr/local/opt/openblas</p>
 <h3 id="installing-openblas-ubuntu-16.04">Installing OpenBLAS (Ubuntu 16.04)</h3>
 <p>On Ubuntu, blas is distributed as part of the atlas library: <a href="http://math-atlas.sourceforge.net/" class="uri">http://math-atlas.sourceforge.net/</a>.</p>
 <p>You can install atlas using apt</p>
-<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb16-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="fu">sudo</span> apt-get install libatlas-base-dev</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="fu">sudo</span> apt-get install libatlas-base-dev</code></pre></div>
 <p>This command will install include files under <code>/usr/include/atlas</code> and corresponding libraries under <code>/usr/lib/atlas-dev</code>.</p>
 <h3 id="jextracting-cblas.h-macos">jextracting cblas.h (MacOS)</h3>
 <p>The following command can be used to extract cblas.h on MacOs</p>
-<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb17-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb17-2" data-line-number="2"><span class="ex">jextract</span> -C <span class="st">&quot;-D FORCE_OPENBLAS_COMPLEX_STRUCT&quot;</span> \</a>
-<a class="sourceLine" id="cb17-3" data-line-number="3">  -L /usr/local/opt/openblas/lib \</a>
-<a class="sourceLine" id="cb17-4" data-line-number="4">  -l openblas -t blas --record-library-path /usr/local/opt/openblas/include/cblas.h \</a>
-<a class="sourceLine" id="cb17-5" data-line-number="5">  -o cblas.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -C <span class="st">&quot;-D FORCE_OPENBLAS_COMPLEX_STRUCT&quot;</span> \
+  -L /usr/local/opt/openblas/lib \
+  -l openblas -t blas --record-library-path /usr/local/opt/openblas/include/cblas.h \
+  -o cblas.jar</code></pre></div>
 <p>The FORCE_OPENBLAS_COMPLEX_STRUCT define is needed because jextract does not yet handle C99 <code>_Complex</code> types. The rest of the options are standard ones.</p>
 <h3 id="jextracting-cblas.h-ubuntu-16.04">jextracting cblas.h (Ubuntu 16.04)</h3>
 <p>The following command can be used to extract cblas.h on Ubuntu</p>
-<div class="sourceCode" id="cb18"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb18-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="ex">jextract</span> -L /usr/lib/atlas-base -I /usr/include/atlas/ \</a>
-<a class="sourceLine" id="cb18-3" data-line-number="3">   -l cblas -t blas --record-library-path \</a>
-<a class="sourceLine" id="cb18-4" data-line-number="4">   /usr/include/atlas/cblas.h -o cblas.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -L /usr/lib/atlas-base -I /usr/include/atlas/ \
+   -l cblas -t blas --record-library-path \
+   /usr/include/atlas/cblas.h -o cblas.jar</code></pre></div>
 <h3 id="java-sample-code-that-uses-cblas-library">Java sample code that uses cblas library</h3>
-<div class="sourceCode" id="cb19"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb19-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb19-2" data-line-number="2"><span class="kw">import</span><span class="im"> blas.cblas_h;</span></a>
-<a class="sourceLine" id="cb19-3" data-line-number="3"><span class="kw">import static</span><span class="im"> blas.cblas_lib.*;</span></a>
-<a class="sourceLine" id="cb19-4" data-line-number="4"><span class="kw">import static</span><span class="im"> blas.cblas_lib.CBLAS_ORDER.*;</span></a>
-<a class="sourceLine" id="cb19-5" data-line-number="5"><span class="kw">import static</span><span class="im"> blas.cblas_lib.CBLAS_TRANSPOSE.*;</span></a>
-<a class="sourceLine" id="cb19-6" data-line-number="6"></a>
-<a class="sourceLine" id="cb19-7" data-line-number="7"><span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span></a>
-<a class="sourceLine" id="cb19-8" data-line-number="8"><span class="kw">import</span><span class="im"> java.foreign.Scope;</span></a>
-<a class="sourceLine" id="cb19-9" data-line-number="9"><span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span></a>
-<a class="sourceLine" id="cb19-10" data-line-number="10"></a>
-<a class="sourceLine" id="cb19-11" data-line-number="11"><span class="kw">public</span> <span class="kw">class</span> TestBlas {</a>
-<a class="sourceLine" id="cb19-12" data-line-number="12">   <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb19-13" data-line-number="13">       <span class="at">@cblas_h</span>.<span class="fu">CBLAS_ORDER</span> <span class="dt">int</span> Layout;</a>
-<a class="sourceLine" id="cb19-14" data-line-number="14">       <span class="at">@cblas_h</span>.<span class="fu">CBLAS_TRANSPOSE</span> <span class="dt">int</span> transa;</a>
-<a class="sourceLine" id="cb19-15" data-line-number="15"></a>
-<a class="sourceLine" id="cb19-16" data-line-number="16">       <span class="dt">double</span> alpha, beta;</a>
-<a class="sourceLine" id="cb19-17" data-line-number="17">       <span class="dt">int</span> m, n, lda, incx, incy, i;</a>
-<a class="sourceLine" id="cb19-18" data-line-number="18"></a>
-<a class="sourceLine" id="cb19-19" data-line-number="19">       Layout = CblasColMajor;</a>
-<a class="sourceLine" id="cb19-20" data-line-number="20">       transa = CblasNoTrans;</a>
-<a class="sourceLine" id="cb19-21" data-line-number="21"></a>
-<a class="sourceLine" id="cb19-22" data-line-number="22">       m = <span class="dv">4</span>; <span class="co">/* Size of Column ( the number of rows ) */</span></a>
-<a class="sourceLine" id="cb19-23" data-line-number="23">       n = <span class="dv">4</span>; <span class="co">/* Size of Row ( the number of columns ) */</span></a>
-<a class="sourceLine" id="cb19-24" data-line-number="24">       lda = <span class="dv">4</span>; <span class="co">/* Leading dimension of 5 * 4 matrix is 5 */</span></a>
-<a class="sourceLine" id="cb19-25" data-line-number="25">       incx = <span class="dv">1</span>;</a>
-<a class="sourceLine" id="cb19-26" data-line-number="26">       incy = <span class="dv">1</span>;</a>
-<a class="sourceLine" id="cb19-27" data-line-number="27">       alpha = <span class="dv">1</span>;</a>
-<a class="sourceLine" id="cb19-28" data-line-number="28">       beta = <span class="dv">0</span>;</a>
-<a class="sourceLine" id="cb19-29" data-line-number="29"></a>
-<a class="sourceLine" id="cb19-30" data-line-number="30">       <span class="kw">try</span> (Scope sc = <span class="fu">scope</span>().<span class="fu">fork</span>()){</a>
-<a class="sourceLine" id="cb19-31" data-line-number="31">           <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; a = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, m * n);</a>
-<a class="sourceLine" id="cb19-32" data-line-number="32">           <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; x = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, n);</a>
-<a class="sourceLine" id="cb19-33" data-line-number="33">           <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; y = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, n);</a>
-<a class="sourceLine" id="cb19-34" data-line-number="34">           <span class="co">/* The elements of the first column */</span></a>
-<a class="sourceLine" id="cb19-35" data-line-number="35">           a.<span class="fu">set</span>(<span class="dv">0</span>, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-36" data-line-number="36">           a.<span class="fu">set</span>(<span class="dv">1</span>, <span class="fl">2.0</span>);</a>
-<a class="sourceLine" id="cb19-37" data-line-number="37">           a.<span class="fu">set</span>(<span class="dv">2</span>, <span class="fl">3.0</span>);</a>
-<a class="sourceLine" id="cb19-38" data-line-number="38">           a.<span class="fu">set</span>(<span class="dv">3</span>, <span class="fl">4.0</span>);</a>
-<a class="sourceLine" id="cb19-39" data-line-number="39">           <span class="co">/* The elements of the second column */</span></a>
-<a class="sourceLine" id="cb19-40" data-line-number="40">           a.<span class="fu">set</span>(m, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-41" data-line-number="41">           a.<span class="fu">set</span>(m + <span class="dv">1</span>, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-42" data-line-number="42">           a.<span class="fu">set</span>(m + <span class="dv">2</span>, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-43" data-line-number="43">           a.<span class="fu">set</span>(m + <span class="dv">3</span>, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-44" data-line-number="44">           <span class="co">/* The elements of the third column */</span></a>
-<a class="sourceLine" id="cb19-45" data-line-number="45">           a.<span class="fu">set</span>(m * <span class="dv">2</span>, <span class="fl">3.0</span>);</a>
-<a class="sourceLine" id="cb19-46" data-line-number="46">           a.<span class="fu">set</span>(m * <span class="dv">2</span> + <span class="dv">1</span>, <span class="fl">4.0</span>);</a>
-<a class="sourceLine" id="cb19-47" data-line-number="47">           a.<span class="fu">set</span>(m * <span class="dv">2</span> + <span class="dv">2</span>, <span class="fl">5.0</span>);</a>
-<a class="sourceLine" id="cb19-48" data-line-number="48">           a.<span class="fu">set</span>(m * <span class="dv">2</span> + <span class="dv">3</span>, <span class="fl">6.0</span>);</a>
-<a class="sourceLine" id="cb19-49" data-line-number="49">           <span class="co">/* The elements of the fourth column */</span></a>
-<a class="sourceLine" id="cb19-50" data-line-number="50">           a.<span class="fu">set</span>(m * <span class="dv">3</span>, <span class="fl">5.0</span>);</a>
-<a class="sourceLine" id="cb19-51" data-line-number="51">           a.<span class="fu">set</span>(m * <span class="dv">3</span> + <span class="dv">1</span>, <span class="fl">6.0</span>);</a>
-<a class="sourceLine" id="cb19-52" data-line-number="52">           a.<span class="fu">set</span>(m * <span class="dv">3</span> + <span class="dv">2</span>, <span class="fl">7.0</span>);</a>
-<a class="sourceLine" id="cb19-53" data-line-number="53">           a.<span class="fu">set</span>(m * <span class="dv">3</span> + <span class="dv">3</span>, <span class="fl">8.0</span>);</a>
-<a class="sourceLine" id="cb19-54" data-line-number="54">           <span class="co">/* The elemetns of x and y */</span></a>
-<a class="sourceLine" id="cb19-55" data-line-number="55">           x.<span class="fu">set</span>(<span class="dv">0</span>, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-56" data-line-number="56">           x.<span class="fu">set</span>(<span class="dv">1</span>, <span class="fl">2.0</span>);</a>
-<a class="sourceLine" id="cb19-57" data-line-number="57">           x.<span class="fu">set</span>(<span class="dv">2</span>, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-58" data-line-number="58">           x.<span class="fu">set</span>(<span class="dv">3</span>, <span class="fl">1.0</span>);</a>
-<a class="sourceLine" id="cb19-59" data-line-number="59">           y.<span class="fu">set</span>(<span class="dv">0</span>, <span class="fl">0.0</span>);</a>
-<a class="sourceLine" id="cb19-60" data-line-number="60">           y.<span class="fu">set</span>(<span class="dv">1</span>, <span class="fl">0.0</span>);</a>
-<a class="sourceLine" id="cb19-61" data-line-number="61">           y.<span class="fu">set</span>(<span class="dv">2</span>, <span class="fl">0.0</span>);</a>
-<a class="sourceLine" id="cb19-62" data-line-number="62">           y.<span class="fu">set</span>(<span class="dv">3</span>, <span class="fl">0.0</span>);</a>
-<a class="sourceLine" id="cb19-63" data-line-number="63"></a>
-<a class="sourceLine" id="cb19-64" data-line-number="64">           <span class="fu">cblas_dgemv</span>(Layout, transa, m, n, alpha, a.<span class="fu">elementPointer</span>(), lda, x.<span class="fu">elementPointer</span>(), incx, beta,</a>
-<a class="sourceLine" id="cb19-65" data-line-number="65">                   y.<span class="fu">elementPointer</span>(), incy);</a>
-<a class="sourceLine" id="cb19-66" data-line-number="66">           <span class="co">/* Print y */</span></a>
-<a class="sourceLine" id="cb19-67" data-line-number="67">           <span class="kw">for</span> (i = <span class="dv">0</span>; i &lt; n; i++)</a>
-<a class="sourceLine" id="cb19-68" data-line-number="68">               <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">print</span>(<span class="bu">String</span><span class="fu">.format</span>(<span class="st">&quot; y</span><span class="sc">%d</span><span class="st"> = </span><span class="sc">%f\n</span><span class="st">&quot;</span>, i, y.<span class="fu">get</span>(i)));</a>
-<a class="sourceLine" id="cb19-69" data-line-number="69">       }</a>
-<a class="sourceLine" id="cb19-70" data-line-number="70">   }</a>
-<a class="sourceLine" id="cb19-71" data-line-number="71">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> blas.cblas_h;</span>
+<span class="kw">import static</span><span class="im"> blas.cblas_lib.*;</span>
+<span class="kw">import static</span><span class="im"> blas.cblas_lib.CBLAS_ORDER.*;</span>
+<span class="kw">import static</span><span class="im"> blas.cblas_lib.CBLAS_TRANSPOSE.*;</span>
+
+<span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span>
+<span class="kw">import</span><span class="im"> java.foreign.Scope;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> TestBlas {
+   <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+       <span class="at">@cblas_h</span>.<span class="fu">CBLAS_ORDER</span> <span class="dt">int</span> Layout;
+       <span class="at">@cblas_h</span>.<span class="fu">CBLAS_TRANSPOSE</span> <span class="dt">int</span> transa;
+
+       <span class="dt">double</span> alpha, beta;
+       <span class="dt">int</span> m, n, lda, incx, incy, i;
+
+       Layout = CblasColMajor;
+       transa = CblasNoTrans;
+
+       m = <span class="dv">4</span>; <span class="co">/* Size of Column ( the number of rows ) */</span>
+       n = <span class="dv">4</span>; <span class="co">/* Size of Row ( the number of columns ) */</span>
+       lda = <span class="dv">4</span>; <span class="co">/* Leading dimension of 5 * 4 matrix is 5 */</span>
+       incx = <span class="dv">1</span>;
+       incy = <span class="dv">1</span>;
+       alpha = <span class="dv">1</span>;
+       beta = <span class="dv">0</span>;
+
+       <span class="kw">try</span> (Scope sc = <span class="fu">scope</span>().<span class="fu">fork</span>()){
+           <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; a = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, m * n);
+           <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; x = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, n);
+           <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; y = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, n);
+           <span class="co">/* The elements of the first column */</span>
+           a.<span class="fu">set</span>(<span class="dv">0</span>, <span class="fl">1.0</span>);
+           a.<span class="fu">set</span>(<span class="dv">1</span>, <span class="fl">2.0</span>);
+           a.<span class="fu">set</span>(<span class="dv">2</span>, <span class="fl">3.0</span>);
+           a.<span class="fu">set</span>(<span class="dv">3</span>, <span class="fl">4.0</span>);
+           <span class="co">/* The elements of the second column */</span>
+           a.<span class="fu">set</span>(m, <span class="fl">1.0</span>);
+           a.<span class="fu">set</span>(m + <span class="dv">1</span>, <span class="fl">1.0</span>);
+           a.<span class="fu">set</span>(m + <span class="dv">2</span>, <span class="fl">1.0</span>);
+           a.<span class="fu">set</span>(m + <span class="dv">3</span>, <span class="fl">1.0</span>);
+           <span class="co">/* The elements of the third column */</span>
+           a.<span class="fu">set</span>(m * <span class="dv">2</span>, <span class="fl">3.0</span>);
+           a.<span class="fu">set</span>(m * <span class="dv">2</span> + <span class="dv">1</span>, <span class="fl">4.0</span>);
+           a.<span class="fu">set</span>(m * <span class="dv">2</span> + <span class="dv">2</span>, <span class="fl">5.0</span>);
+           a.<span class="fu">set</span>(m * <span class="dv">2</span> + <span class="dv">3</span>, <span class="fl">6.0</span>);
+           <span class="co">/* The elements of the fourth column */</span>
+           a.<span class="fu">set</span>(m * <span class="dv">3</span>, <span class="fl">5.0</span>);
+           a.<span class="fu">set</span>(m * <span class="dv">3</span> + <span class="dv">1</span>, <span class="fl">6.0</span>);
+           a.<span class="fu">set</span>(m * <span class="dv">3</span> + <span class="dv">2</span>, <span class="fl">7.0</span>);
+           a.<span class="fu">set</span>(m * <span class="dv">3</span> + <span class="dv">3</span>, <span class="fl">8.0</span>);
+           <span class="co">/* The elemetns of x and y */</span>
+           x.<span class="fu">set</span>(<span class="dv">0</span>, <span class="fl">1.0</span>);
+           x.<span class="fu">set</span>(<span class="dv">1</span>, <span class="fl">2.0</span>);
+           x.<span class="fu">set</span>(<span class="dv">2</span>, <span class="fl">1.0</span>);
+           x.<span class="fu">set</span>(<span class="dv">3</span>, <span class="fl">1.0</span>);
+           y.<span class="fu">set</span>(<span class="dv">0</span>, <span class="fl">0.0</span>);
+           y.<span class="fu">set</span>(<span class="dv">1</span>, <span class="fl">0.0</span>);
+           y.<span class="fu">set</span>(<span class="dv">2</span>, <span class="fl">0.0</span>);
+           y.<span class="fu">set</span>(<span class="dv">3</span>, <span class="fl">0.0</span>);
+
+           <span class="fu">cblas_dgemv</span>(Layout, transa, m, n, alpha, a.<span class="fu">elementPointer</span>(), lda, x.<span class="fu">elementPointer</span>(), incx, beta,
+                   y.<span class="fu">elementPointer</span>(), incy);
+           <span class="co">/* Print y */</span>
+           <span class="kw">for</span> (i = <span class="dv">0</span>; i &lt; n; i++)
+               <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">print</span>(<span class="bu">String</span><span class="fu">.format</span>(<span class="st">&quot; y</span><span class="sc">%d</span><span class="st"> = </span><span class="sc">%f\n</span><span class="st">&quot;</span>, i, y.<span class="fu">get</span>(i)));
+       }
+   }
+}</code></pre></div>
 <h3 id="compiling-and-running-the-above-cblas-samples">Compiling and running the above cblas samples</h3>
-<div class="sourceCode" id="cb20"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb20-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb20-2" data-line-number="2"><span class="ex">javac</span> -cp cblas.jar TestBlas.java</a>
-<a class="sourceLine" id="cb20-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb20-4" data-line-number="4"><span class="ex">java</span> -cp cblas.jar:. TestBlas</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp cblas.jar TestBlas.java
+
+<span class="ex">java</span> -cp cblas.jar:. TestBlas</code></pre></div>
 <h2 id="using-lapack-library-ubuntu">Using LAPACK library (Ubuntu)</h2>
 <p>On Ubuntu, the same steps used to install the blas (via atlas) library also install headers and libraries for the LAPACK library, a linear algebra computation library built on top of blas.</p>
 <h3 id="jextracting-clapack.h-ubuntu-16.04">jextracting clapack.h (Ubuntu 16.04)</h3>
 <p>The following command can be used to extract the LAPACK header:</p>
-<div class="sourceCode" id="cb21"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb21-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="ex">jextract</span> -L /usr/lib/atlas-base/atlas -I /usr/include/atlas/ \</a>
-<a class="sourceLine" id="cb21-3" data-line-number="3">   -l lapack -t lapack --record-library-path /usr/include/atlas/clapack.h -o clapack.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -L /usr/lib/atlas-base/atlas -I /usr/include/atlas/ \
+   -l lapack -t lapack --record-library-path /usr/include/atlas/clapack.h -o clapack.jar</code></pre></div>
 <h3 id="java-sample-code-that-uses-lapack-library">Java sample code that uses LAPACK library</h3>
-<div class="sourceCode" id="cb22"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb22-1" data-line-number="1"><span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span></a>
-<a class="sourceLine" id="cb22-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.foreign.Scope;</span></a>
-<a class="sourceLine" id="cb22-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span></a>
-<a class="sourceLine" id="cb22-4" data-line-number="4"></a>
-<a class="sourceLine" id="cb22-5" data-line-number="5"><span class="kw">import static</span><span class="im"> lapack.clapack_lib.*;</span></a>
-<a class="sourceLine" id="cb22-6" data-line-number="6"><span class="kw">import static</span><span class="im"> lapack.cblas_lib.*;</span></a>
-<a class="sourceLine" id="cb22-7" data-line-number="7"></a>
-<a class="sourceLine" id="cb22-8" data-line-number="8"><span class="kw">public</span> <span class="kw">class</span> TestLapack {</a>
-<a class="sourceLine" id="cb22-9" data-line-number="9">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb22-10" data-line-number="10"></a>
-<a class="sourceLine" id="cb22-11" data-line-number="11">        <span class="co">/* Locals */</span></a>
-<a class="sourceLine" id="cb22-12" data-line-number="12">        <span class="kw">try</span> (Scope sc = lapack.<span class="fu">clapack_lib</span>.<span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb22-13" data-line-number="13">            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; A = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{</a>
-<a class="sourceLine" id="cb22-14" data-line-number="14">                    <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>, <span class="dv">5</span>, <span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">5</span>, <span class="dv">2</span>, <span class="dv">4</span>, <span class="dv">1</span>, <span class="dv">4</span>, <span class="dv">2</span>, <span class="dv">5</span>, <span class="dv">3</span></a>
-<a class="sourceLine" id="cb22-15" data-line-number="15">            });</a>
-<a class="sourceLine" id="cb22-16" data-line-number="16">            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; b = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{</a>
-<a class="sourceLine" id="cb22-17" data-line-number="17">                    <span class="dv">-10</span>, <span class="dv">12</span>, <span class="dv">14</span>, <span class="dv">16</span>, <span class="dv">18</span>, <span class="dv">-3</span>, <span class="dv">14</span>, <span class="dv">12</span>, <span class="dv">16</span>, <span class="dv">16</span></a>
-<a class="sourceLine" id="cb22-18" data-line-number="18">            });</a>
-<a class="sourceLine" id="cb22-19" data-line-number="19">            <span class="dt">int</span> info, m, n, lda, ldb, nrhs;</a>
-<a class="sourceLine" id="cb22-20" data-line-number="20"></a>
-<a class="sourceLine" id="cb22-21" data-line-number="21">            <span class="co">/* Initialization */</span></a>
-<a class="sourceLine" id="cb22-22" data-line-number="22">            m = <span class="dv">5</span>;</a>
-<a class="sourceLine" id="cb22-23" data-line-number="23">            n = <span class="dv">3</span>;</a>
-<a class="sourceLine" id="cb22-24" data-line-number="24">            nrhs = <span class="dv">2</span>;</a>
-<a class="sourceLine" id="cb22-25" data-line-number="25">            lda = <span class="dv">5</span>;</a>
-<a class="sourceLine" id="cb22-26" data-line-number="26">            ldb = <span class="dv">5</span>;</a>
-<a class="sourceLine" id="cb22-27" data-line-number="27"></a>
-<a class="sourceLine" id="cb22-28" data-line-number="28">            <span class="co">/* Print Entry Matrix */</span></a>
-<a class="sourceLine" id="cb22-29" data-line-number="29">            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Entry Matrix A&quot;</span>, m, n, A, lda );</a>
-<a class="sourceLine" id="cb22-30" data-line-number="30">            <span class="co">/* Print Right Rand Side */</span></a>
-<a class="sourceLine" id="cb22-31" data-line-number="31">            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Right Hand Side b&quot;</span>, n, nrhs, b, ldb );</a>
-<a class="sourceLine" id="cb22-32" data-line-number="32">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();</a>
-<a class="sourceLine" id="cb22-33" data-line-number="33"></a>
-<a class="sourceLine" id="cb22-34" data-line-number="34">            <span class="co">/* Executable statements */</span></a>
-<a class="sourceLine" id="cb22-35" data-line-number="35">            <span class="co">//            printf( &quot;LAPACKE_dgels (col-major, high-level) Example Program Results\n&quot; );</span></a>
-<a class="sourceLine" id="cb22-36" data-line-number="36">            <span class="co">/* Solve least squares problem*/</span></a>
-<a class="sourceLine" id="cb22-37" data-line-number="37">            info = <span class="fu">clapack_dgels</span>(CblasColMajor, CblasNoTrans, m, n, nrhs, A.<span class="fu">elementPointer</span>(), lda, b.<span class="fu">elementPointer</span>(), ldb);</a>
-<a class="sourceLine" id="cb22-38" data-line-number="38"></a>
-<a class="sourceLine" id="cb22-39" data-line-number="39">            <span class="co">/* Print Solution */</span></a>
-<a class="sourceLine" id="cb22-40" data-line-number="40">            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Solution&quot;</span>, n, nrhs, b, ldb );</a>
-<a class="sourceLine" id="cb22-41" data-line-number="41">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();</a>
-<a class="sourceLine" id="cb22-42" data-line-number="42">            <span class="bu">System</span>.<span class="fu">exit</span>(info);</a>
-<a class="sourceLine" id="cb22-43" data-line-number="43">        }</a>
-<a class="sourceLine" id="cb22-44" data-line-number="44">    }</a>
-<a class="sourceLine" id="cb22-45" data-line-number="45"></a>
-<a class="sourceLine" id="cb22-46" data-line-number="46">    <span class="dt">static</span> <span class="dt">void</span> <span class="fu">print_matrix_colmajor</span>(<span class="bu">String</span> msg, <span class="dt">int</span> m, <span class="dt">int</span> n, <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; mat, <span class="dt">int</span> ldm) {</a>
-<a class="sourceLine" id="cb22-47" data-line-number="47">        <span class="dt">int</span> i, j;</a>
-<a class="sourceLine" id="cb22-48" data-line-number="48">        <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">\n</span><span class="st"> </span><span class="sc">%s\n</span><span class="st">&quot;</span>, msg);</a>
-<a class="sourceLine" id="cb22-49" data-line-number="49"></a>
-<a class="sourceLine" id="cb22-50" data-line-number="50">        <span class="kw">for</span>( i = <span class="dv">0</span>; i &lt; m; i++ ) {</a>
-<a class="sourceLine" id="cb22-51" data-line-number="51">            <span class="kw">for</span>( j = <span class="dv">0</span>; j &lt; n; j++ ) <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot; </span><span class="sc">%6.2f</span><span class="st">&quot;</span>, mat.<span class="fu">get</span>(i+j*ldm));</a>
-<a class="sourceLine" id="cb22-52" data-line-number="52">            <span class="bu">System</span>.<span class="fu">out.printf</span>( <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span> );</a>
-<a class="sourceLine" id="cb22-53" data-line-number="53">        }</a>
-<a class="sourceLine" id="cb22-54" data-line-number="54">    }</a>
-<a class="sourceLine" id="cb22-55" data-line-number="55">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span>
+<span class="kw">import</span><span class="im"> java.foreign.Scope;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span>
+
+<span class="kw">import static</span><span class="im"> lapack.clapack_lib.*;</span>
+<span class="kw">import static</span><span class="im"> lapack.cblas_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> TestLapack {
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+
+        <span class="co">/* Locals */</span>
+        <span class="kw">try</span> (Scope sc = lapack.<span class="fu">clapack_lib</span>.<span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; A = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{
+                    <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>, <span class="dv">5</span>, <span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">5</span>, <span class="dv">2</span>, <span class="dv">4</span>, <span class="dv">1</span>, <span class="dv">4</span>, <span class="dv">2</span>, <span class="dv">5</span>, <span class="dv">3</span>
+            });
+            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; b = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{
+                    -<span class="dv">10</span>, <span class="dv">12</span>, <span class="dv">14</span>, <span class="dv">16</span>, <span class="dv">18</span>, -<span class="dv">3</span>, <span class="dv">14</span>, <span class="dv">12</span>, <span class="dv">16</span>, <span class="dv">16</span>
+            });
+            <span class="dt">int</span> info, m, n, lda, ldb, nrhs;
+
+            <span class="co">/* Initialization */</span>
+            m = <span class="dv">5</span>;
+            n = <span class="dv">3</span>;
+            nrhs = <span class="dv">2</span>;
+            lda = <span class="dv">5</span>;
+            ldb = <span class="dv">5</span>;
+
+            <span class="co">/* Print Entry Matrix */</span>
+            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Entry Matrix A&quot;</span>, m, n, A, lda );
+            <span class="co">/* Print Right Rand Side */</span>
+            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Right Hand Side b&quot;</span>, n, nrhs, b, ldb );
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();
+
+            <span class="co">/* Executable statements */</span>
+            <span class="co">//            printf( &quot;LAPACKE_dgels (col-major, high-level) Example Program Results\n&quot; );</span>
+            <span class="co">/* Solve least squares problem*/</span>
+            info = <span class="fu">clapack_dgels</span>(CblasColMajor, CblasNoTrans, m, n, nrhs, A.<span class="fu">elementPointer</span>(), lda, b.<span class="fu">elementPointer</span>(), ldb);
+
+            <span class="co">/* Print Solution */</span>
+            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Solution&quot;</span>, n, nrhs, b, ldb );
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();
+            <span class="bu">System</span>.<span class="fu">exit</span>(info);
+        }
+    }
+
+    <span class="dt">static</span> <span class="dt">void</span> <span class="fu">print_matrix_colmajor</span>(<span class="bu">String</span> msg, <span class="dt">int</span> m, <span class="dt">int</span> n, <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; mat, <span class="dt">int</span> ldm) {
+        <span class="dt">int</span> i, j;
+        <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">\n</span><span class="st"> </span><span class="sc">%s\n</span><span class="st">&quot;</span>, msg);
+
+        <span class="kw">for</span>( i = <span class="dv">0</span>; i &lt; m; i++ ) {
+            <span class="kw">for</span>( j = <span class="dv">0</span>; j &lt; n; j++ ) <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot; </span><span class="sc">%6.2f</span><span class="st">&quot;</span>, mat.<span class="fu">get</span>(i+j*ldm));
+            <span class="bu">System</span>.<span class="fu">out.printf</span>( <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span> );
+        }
+    }
+}</code></pre></div>
 <h3 id="compiling-and-running-the-above-lapack-sample">Compiling and running the above LAPACK sample</h3>
-<div class="sourceCode" id="cb23"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb23-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb23-2" data-line-number="2"><span class="ex">javac</span> -cp clapack.jar TestLapack.java</a>
-<a class="sourceLine" id="cb23-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb23-4" data-line-number="4"><span class="ex">java</span> -cp clapack.jar:. TestLapack</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp clapack.jar TestLapack.java
+
+<span class="ex">java</span> -cp clapack.jar:. TestLapack</code></pre></div>
 <h2 id="using-lapack-library-mac-os">Using LAPACK library (Mac OS)</h2>
 <p>On Mac OS, lapack is installed under /usr/local/opt/lapack directory.</p>
 <h3 id="jextracting-lapacke.h">jextracting lapacke.h</h3>
-<div class="sourceCode" id="cb24"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb24-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb24-2" data-line-number="2"><span class="ex">jextract</span> -L /usr/local/opt/lapack/lib \</a>
-<a class="sourceLine" id="cb24-3" data-line-number="3">  -l lapacke -t lapack --record-library-path \</a>
-<a class="sourceLine" id="cb24-4" data-line-number="4">  /usr/local/opt/lapack/include/lapacke.h -o clapack.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -L /usr/local/opt/lapack/lib \
+  -l lapacke -t lapack --record-library-path \
+  /usr/local/opt/lapack/include/lapacke.h -o clapack.jar</code></pre></div>
 <h3 id="java-sample-code-that-uses-lapack-library-1">Java sample code that uses LAPACK library</h3>
-<div class="sourceCode" id="cb25"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb25-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb25-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span></a>
-<a class="sourceLine" id="cb25-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.Scope;</span></a>
-<a class="sourceLine" id="cb25-4" data-line-number="4"><span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span></a>
-<a class="sourceLine" id="cb25-5" data-line-number="5"></a>
-<a class="sourceLine" id="cb25-6" data-line-number="6"><span class="kw">import static</span><span class="im"> lapack.lapacke_lib.*;</span></a>
-<a class="sourceLine" id="cb25-7" data-line-number="7"></a>
-<a class="sourceLine" id="cb25-8" data-line-number="8"><span class="kw">public</span> <span class="kw">class</span> TestLapack {</a>
-<a class="sourceLine" id="cb25-9" data-line-number="9">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb25-10" data-line-number="10"></a>
-<a class="sourceLine" id="cb25-11" data-line-number="11">        <span class="co">/* Locals */</span></a>
-<a class="sourceLine" id="cb25-12" data-line-number="12">        <span class="kw">try</span> (Scope sc = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb25-13" data-line-number="13">            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; A = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{</a>
-<a class="sourceLine" id="cb25-14" data-line-number="14">                    <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>, <span class="dv">5</span>, <span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">5</span>, <span class="dv">2</span>, <span class="dv">4</span>, <span class="dv">1</span>, <span class="dv">4</span>, <span class="dv">2</span>, <span class="dv">5</span>, <span class="dv">3</span></a>
-<a class="sourceLine" id="cb25-15" data-line-number="15">            });</a>
-<a class="sourceLine" id="cb25-16" data-line-number="16">            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; b = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{</a>
-<a class="sourceLine" id="cb25-17" data-line-number="17">                    <span class="dv">-10</span>, <span class="dv">12</span>, <span class="dv">14</span>, <span class="dv">16</span>, <span class="dv">18</span>, <span class="dv">-3</span>, <span class="dv">14</span>, <span class="dv">12</span>, <span class="dv">16</span>, <span class="dv">16</span></a>
-<a class="sourceLine" id="cb25-18" data-line-number="18">            });</a>
-<a class="sourceLine" id="cb25-19" data-line-number="19">            <span class="dt">int</span> info, m, n, lda, ldb, nrhs;</a>
-<a class="sourceLine" id="cb25-20" data-line-number="20"></a>
-<a class="sourceLine" id="cb25-21" data-line-number="21">            <span class="co">/* Initialization */</span></a>
-<a class="sourceLine" id="cb25-22" data-line-number="22">            m = <span class="dv">5</span>;</a>
-<a class="sourceLine" id="cb25-23" data-line-number="23">            n = <span class="dv">3</span>;</a>
-<a class="sourceLine" id="cb25-24" data-line-number="24">            nrhs = <span class="dv">2</span>;</a>
-<a class="sourceLine" id="cb25-25" data-line-number="25">            lda = <span class="dv">5</span>;</a>
-<a class="sourceLine" id="cb25-26" data-line-number="26">            ldb = <span class="dv">5</span>;</a>
-<a class="sourceLine" id="cb25-27" data-line-number="27"></a>
-<a class="sourceLine" id="cb25-28" data-line-number="28">            <span class="co">/* Print Entry Matrix */</span></a>
-<a class="sourceLine" id="cb25-29" data-line-number="29">            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Entry Matrix A&quot;</span>, m, n, A, lda );</a>
-<a class="sourceLine" id="cb25-30" data-line-number="30">            <span class="co">/* Print Right Rand Side */</span></a>
-<a class="sourceLine" id="cb25-31" data-line-number="31">            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Right Hand Side b&quot;</span>, n, nrhs, b, ldb );</a>
-<a class="sourceLine" id="cb25-32" data-line-number="32">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();</a>
-<a class="sourceLine" id="cb25-33" data-line-number="33"></a>
-<a class="sourceLine" id="cb25-34" data-line-number="34">            <span class="co">/* Executable statements */</span></a>
-<a class="sourceLine" id="cb25-35" data-line-number="35">            <span class="co">//            printf( &quot;LAPACKE_dgels (col-major, high-level) Example Program Results\n&quot; );</span></a>
-<a class="sourceLine" id="cb25-36" data-line-number="36">            <span class="co">/* Solve least squares problem*/</span></a>
-<a class="sourceLine" id="cb25-37" data-line-number="37">            info = <span class="fu">LAPACKE_dgels</span>(LAPACK_COL_MAJOR, (<span class="dt">byte</span>)<span class="ch">&#39;N&#39;</span>, m, n, nrhs, A.<span class="fu">elementPointer</span>(), lda, b.<span class="fu">elementPointer</span>(), ldb);</a>
-<a class="sourceLine" id="cb25-38" data-line-number="38"></a>
-<a class="sourceLine" id="cb25-39" data-line-number="39">            <span class="co">/* Print Solution */</span></a>
-<a class="sourceLine" id="cb25-40" data-line-number="40">            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Solution&quot;</span>, n, nrhs, b, ldb );</a>
-<a class="sourceLine" id="cb25-41" data-line-number="41">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();</a>
-<a class="sourceLine" id="cb25-42" data-line-number="42">            <span class="bu">System</span>.<span class="fu">exit</span>(info);</a>
-<a class="sourceLine" id="cb25-43" data-line-number="43">        }</a>
-<a class="sourceLine" id="cb25-44" data-line-number="44">    }</a>
-<a class="sourceLine" id="cb25-45" data-line-number="45"></a>
-<a class="sourceLine" id="cb25-46" data-line-number="46">    <span class="dt">static</span> <span class="dt">void</span> <span class="fu">print_matrix_colmajor</span>(<span class="bu">String</span> msg, <span class="dt">int</span> m, <span class="dt">int</span> n, <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; mat, <span class="dt">int</span> ldm) {</a>
-<a class="sourceLine" id="cb25-47" data-line-number="47">        <span class="dt">int</span> i, j;</a>
-<a class="sourceLine" id="cb25-48" data-line-number="48">        <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">\n</span><span class="st"> </span><span class="sc">%s\n</span><span class="st">&quot;</span>, msg);</a>
-<a class="sourceLine" id="cb25-49" data-line-number="49"></a>
-<a class="sourceLine" id="cb25-50" data-line-number="50">        <span class="kw">for</span>( i = <span class="dv">0</span>; i &lt; m; i++ ) {</a>
-<a class="sourceLine" id="cb25-51" data-line-number="51">            <span class="kw">for</span>( j = <span class="dv">0</span>; j &lt; n; j++ ) <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot; </span><span class="sc">%6.2f</span><span class="st">&quot;</span>, mat.<span class="fu">get</span>(i+j*ldm));</a>
-<a class="sourceLine" id="cb25-52" data-line-number="52">            <span class="bu">System</span>.<span class="fu">out.printf</span>( <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span> );</a>
-<a class="sourceLine" id="cb25-53" data-line-number="53">        }</a>
-<a class="sourceLine" id="cb25-54" data-line-number="54">    }</a>
-<a class="sourceLine" id="cb25-55" data-line-number="55">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span>
+<span class="kw">import</span><span class="im"> java.foreign.Scope;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span>
+
+<span class="kw">import static</span><span class="im"> lapack.lapacke_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> TestLapack {
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+
+        <span class="co">/* Locals */</span>
+        <span class="kw">try</span> (Scope sc = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; A = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{
+                    <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>, <span class="dv">5</span>, <span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">5</span>, <span class="dv">2</span>, <span class="dv">4</span>, <span class="dv">1</span>, <span class="dv">4</span>, <span class="dv">2</span>, <span class="dv">5</span>, <span class="dv">3</span>
+            });
+            <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; b = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">DOUBLE</span>, <span class="kw">new</span> <span class="dt">double</span>[]{
+                    -<span class="dv">10</span>, <span class="dv">12</span>, <span class="dv">14</span>, <span class="dv">16</span>, <span class="dv">18</span>, -<span class="dv">3</span>, <span class="dv">14</span>, <span class="dv">12</span>, <span class="dv">16</span>, <span class="dv">16</span>
+            });
+            <span class="dt">int</span> info, m, n, lda, ldb, nrhs;
+
+            <span class="co">/* Initialization */</span>
+            m = <span class="dv">5</span>;
+            n = <span class="dv">3</span>;
+            nrhs = <span class="dv">2</span>;
+            lda = <span class="dv">5</span>;
+            ldb = <span class="dv">5</span>;
+
+            <span class="co">/* Print Entry Matrix */</span>
+            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Entry Matrix A&quot;</span>, m, n, A, lda );
+            <span class="co">/* Print Right Rand Side */</span>
+            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Right Hand Side b&quot;</span>, n, nrhs, b, ldb );
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();
+
+            <span class="co">/* Executable statements */</span>
+            <span class="co">//            printf( &quot;LAPACKE_dgels (col-major, high-level) Example Program Results\n&quot; );</span>
+            <span class="co">/* Solve least squares problem*/</span>
+            info = <span class="fu">LAPACKE_dgels</span>(LAPACK_COL_MAJOR, (<span class="dt">byte</span>)<span class="ch">&#39;N&#39;</span>, m, n, nrhs, A.<span class="fu">elementPointer</span>(), lda, b.<span class="fu">elementPointer</span>(), ldb);
+
+            <span class="co">/* Print Solution */</span>
+            <span class="fu">print_matrix_colmajor</span>(<span class="st">&quot;Solution&quot;</span>, n, nrhs, b, ldb );
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>();
+            <span class="bu">System</span>.<span class="fu">exit</span>(info);
+        }
+    }
+
+    <span class="dt">static</span> <span class="dt">void</span> <span class="fu">print_matrix_colmajor</span>(<span class="bu">String</span> msg, <span class="dt">int</span> m, <span class="dt">int</span> n, <span class="bu">Array</span>&lt;<span class="bu">Double</span>&gt; mat, <span class="dt">int</span> ldm) {
+        <span class="dt">int</span> i, j;
+        <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">\n</span><span class="st"> </span><span class="sc">%s\n</span><span class="st">&quot;</span>, msg);
+
+        <span class="kw">for</span>( i = <span class="dv">0</span>; i &lt; m; i++ ) {
+            <span class="kw">for</span>( j = <span class="dv">0</span>; j &lt; n; j++ ) <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot; </span><span class="sc">%6.2f</span><span class="st">&quot;</span>, mat.<span class="fu">get</span>(i+j*ldm));
+            <span class="bu">System</span>.<span class="fu">out.printf</span>( <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span> );
+        }
+    }
+}</code></pre></div>
 <h3 id="compiling-and-running-the-above-lapack-sample-1">Compiling and running the above LAPACK sample</h3>
-<div class="sourceCode" id="cb26"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb26-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="ex">javac</span> -cp clapack.jar TestLapack.java</a>
-<a class="sourceLine" id="cb26-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb26-4" data-line-number="4"><span class="ex">java</span> -cp clapack.jar:. TestLapack</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp clapack.jar TestLapack.java
+
+<span class="ex">java</span> -cp clapack.jar:. TestLapack</code></pre></div>
 <h2 id="using-libproc-library-to-list-processes-from-java-mac-os">Using libproc library to list processes from Java (Mac OS)</h2>
 <h3 id="jextract-a-jar-file-for-libproc.h">jextract a jar file for libproc.h</h3>
 <p>jextract -t org.unix -lproc -L /usr/lib --record-library-path -o libproc.jar /usr/include/libproc.h</p>
 <h3 id="java-program-that-uses-libproc-to-list-processes">Java program that uses libproc to list processes</h3>
-<div class="sourceCode" id="cb27"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb27-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb27-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.foreign.*;</span></a>
-<a class="sourceLine" id="cb27-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.memory.*;</span></a>
-<a class="sourceLine" id="cb27-4" data-line-number="4"><span class="kw">import static</span><span class="im"> org.unix.libproc_lib.*;</span></a>
-<a class="sourceLine" id="cb27-5" data-line-number="5"></a>
-<a class="sourceLine" id="cb27-6" data-line-number="6"><span class="kw">public</span> <span class="kw">class</span> LibprocMain {</a>
-<a class="sourceLine" id="cb27-7" data-line-number="7">    <span class="kw">private</span> <span class="dt">static</span> <span class="dt">final</span> <span class="dt">int</span> NAME_BUF_MAX = <span class="dv">256</span>;</a>
-<a class="sourceLine" id="cb27-8" data-line-number="8"></a>
-<a class="sourceLine" id="cb27-9" data-line-number="9">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb27-10" data-line-number="10">        <span class="co">// Scope for native allocations</span></a>
-<a class="sourceLine" id="cb27-11" data-line-number="11">        <span class="kw">try</span> (Scope s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb27-12" data-line-number="12">            <span class="co">// get the number of processes</span></a>
-<a class="sourceLine" id="cb27-13" data-line-number="13">            <span class="dt">int</span> numPids = <span class="fu">proc_listallpids</span>(Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb27-14" data-line-number="14">            <span class="co">// allocate an array</span></a>
-<a class="sourceLine" id="cb27-15" data-line-number="15">            <span class="bu">Array</span>&lt;<span class="bu">Integer</span>&gt; pids = s.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">INT32</span>, numPids);</a>
-<a class="sourceLine" id="cb27-16" data-line-number="16">            <span class="co">// list all the pids into the native array</span></a>
-<a class="sourceLine" id="cb27-17" data-line-number="17">            <span class="fu">proc_listallpids</span>(pids.<span class="fu">elementPointer</span>(), numPids);</a>
-<a class="sourceLine" id="cb27-18" data-line-number="18">            <span class="co">// convert native array to java array</span></a>
-<a class="sourceLine" id="cb27-19" data-line-number="19">            <span class="dt">int</span>[] jpids = pids.<span class="fu">toArray</span>(num -&gt; <span class="kw">new</span> <span class="dt">int</span>[num]);</a>
-<a class="sourceLine" id="cb27-20" data-line-number="20">            <span class="co">// buffer for process name</span></a>
-<a class="sourceLine" id="cb27-21" data-line-number="21">            Pointer&lt;<span class="bu">Byte</span>&gt; nameBuf = s.<span class="fu">allocate</span>(NativeTypes.<span class="fu">INT8</span>, NAME_BUF_MAX);</a>
-<a class="sourceLine" id="cb27-22" data-line-number="22">            <span class="kw">for</span> (<span class="dt">int</span> i = <span class="dv">0</span>; i &lt; jpids.<span class="fu">length</span>; i++) {</a>
-<a class="sourceLine" id="cb27-23" data-line-number="23">                <span class="dt">int</span> pid = jpids[i];</a>
-<a class="sourceLine" id="cb27-24" data-line-number="24">                <span class="co">// get the process name</span></a>
-<a class="sourceLine" id="cb27-25" data-line-number="25">                <span class="fu">proc_name</span>(pid, nameBuf, NAME_BUF_MAX);</a>
-<a class="sourceLine" id="cb27-26" data-line-number="26">                <span class="bu">String</span> procName = Pointer.<span class="fu">toString</span>(nameBuf);</a>
-<a class="sourceLine" id="cb27-27" data-line-number="27">                <span class="co">// print pid and process name</span></a>
-<a class="sourceLine" id="cb27-28" data-line-number="28">                <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">%d</span><span class="st"> </span><span class="sc">%s\n</span><span class="st">&quot;</span>, pid, procName);</a>
-<a class="sourceLine" id="cb27-29" data-line-number="29">            }</a>
-<a class="sourceLine" id="cb27-30" data-line-number="30">        }</a>
-<a class="sourceLine" id="cb27-31" data-line-number="31">    }</a>
-<a class="sourceLine" id="cb27-32" data-line-number="32">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> java.foreign.*;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.*;</span>
+<span class="kw">import static</span><span class="im"> org.unix.libproc_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> LibprocMain {
+    <span class="kw">private</span> <span class="dt">static</span> <span class="dt">final</span> <span class="dt">int</span> NAME_BUF_MAX = <span class="dv">256</span>;
+
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+        <span class="co">// Scope for native allocations</span>
+        <span class="kw">try</span> (Scope s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            <span class="co">// get the number of processes</span>
+            <span class="dt">int</span> numPids = <span class="fu">proc_listallpids</span>(Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>);
+            <span class="co">// allocate an array</span>
+            <span class="bu">Array</span>&lt;<span class="bu">Integer</span>&gt; pids = s.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">INT32</span>, numPids);
+            <span class="co">// list all the pids into the native array</span>
+            <span class="fu">proc_listallpids</span>(pids.<span class="fu">elementPointer</span>(), numPids);
+            <span class="co">// convert native array to java array</span>
+            <span class="dt">int</span>[] jpids = pids.<span class="fu">toArray</span>(num -&gt; <span class="kw">new</span> <span class="dt">int</span>[num]);
+            <span class="co">// buffer for process name</span>
+            Pointer&lt;<span class="bu">Byte</span>&gt; nameBuf = s.<span class="fu">allocate</span>(NativeTypes.<span class="fu">INT8</span>, NAME_BUF_MAX);
+            <span class="kw">for</span> (<span class="dt">int</span> i = <span class="dv">0</span>; i &lt; jpids.<span class="fu">length</span>; i++) {
+                <span class="dt">int</span> pid = jpids[i];
+                <span class="co">// get the process name</span>
+                <span class="fu">proc_name</span>(pid, nameBuf, NAME_BUF_MAX);
+                <span class="bu">String</span> procName = Pointer.<span class="fu">toString</span>(nameBuf);
+                <span class="co">// print pid and process name</span>
+                <span class="bu">System</span>.<span class="fu">out.printf</span>(<span class="st">&quot;</span><span class="sc">%d</span><span class="st"> </span><span class="sc">%s\n</span><span class="st">&quot;</span>, pid, procName);
+            }
+        }
+    }
+}</code></pre></div>
 <h3 id="running-the-java-code-that-uses-libproc">Running the Java code that uses libproc</h3>
-<div class="sourceCode" id="cb28"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb28-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb28-2" data-line-number="2"><span class="ex">javac</span> -cp libproc.jar LibprocMain.java</a>
-<a class="sourceLine" id="cb28-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb28-4" data-line-number="4"><span class="ex">java</span> -cp libproc.jar:. LibprocMain</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp libproc.jar LibprocMain.java
+
+<span class="ex">java</span> -cp libproc.jar:. LibprocMain</code></pre></div>
 <h2 id="using-readline-library-from-java-code-mac-os">Using readline library from Java code (Mac OS)</h2>
 <h3 id="jextract-a-jar-file-for-readline.h">jextract a jar file for readline.h</h3>
-<div class="sourceCode" id="cb29"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb29-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb29-2" data-line-number="2"><span class="ex">jextract</span> -l readline -L /usr/local/opt/readline/lib/ --record-library-path \</a>
-<a class="sourceLine" id="cb29-3" data-line-number="3">    -t org.unix \</a>
-<a class="sourceLine" id="cb29-4" data-line-number="4">    /usr/include/readline/readline.h \</a>
-<a class="sourceLine" id="cb29-5" data-line-number="5">    --exclude-symbols readline_echoing_p -o readline.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -l readline -L /usr/local/opt/readline/lib/ --record-library-path \
+    -t org.unix \
+    /usr/include/readline/readline.h \
+    --exclude-symbols readline_echoing_p -o readline.jar</code></pre></div>
 <h3 id="java-code-that-uses-readline">Java code that uses readline</h3>
-<div class="sourceCode" id="cb30"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb30-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb30-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.foreign.*;</span></a>
-<a class="sourceLine" id="cb30-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.memory.*;</span></a>
-<a class="sourceLine" id="cb30-4" data-line-number="4"><span class="kw">import static</span><span class="im"> org.unix.readline_lib.*;</span></a>
-<a class="sourceLine" id="cb30-5" data-line-number="5"></a>
-<a class="sourceLine" id="cb30-6" data-line-number="6"><span class="kw">public</span> <span class="kw">class</span> Readline {</a>
-<a class="sourceLine" id="cb30-7" data-line-number="7">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb30-8" data-line-number="8">        <span class="co">// Scope for native allocations</span></a>
-<a class="sourceLine" id="cb30-9" data-line-number="9">        <span class="kw">try</span> (Scope s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb30-10" data-line-number="10">            <span class="co">// allocate C memory initialized with Java string content</span></a>
-<a class="sourceLine" id="cb30-11" data-line-number="11">            var pstr = s.<span class="fu">allocateCString</span>(<span class="st">&quot;name? &quot;</span>);</a>
-<a class="sourceLine" id="cb30-12" data-line-number="12"></a>
-<a class="sourceLine" id="cb30-13" data-line-number="13">            <span class="co">// call &quot;readline&quot; API</span></a>
-<a class="sourceLine" id="cb30-14" data-line-number="14">            var p = <span class="fu">readline</span>(pstr);</a>
-<a class="sourceLine" id="cb30-15" data-line-number="15"></a>
-<a class="sourceLine" id="cb30-16" data-line-number="16">            <span class="co">// print char* as is</span></a>
-<a class="sourceLine" id="cb30-17" data-line-number="17">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(p);</a>
-<a class="sourceLine" id="cb30-18" data-line-number="18">            <span class="co">// convert char* ptr from readline as Java String &amp; print it</span></a>
-<a class="sourceLine" id="cb30-19" data-line-number="19">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(Pointer.<span class="fu">toString</span>(p));</a>
-<a class="sourceLine" id="cb30-20" data-line-number="20">        }</a>
-<a class="sourceLine" id="cb30-21" data-line-number="21">    }</a>
-<a class="sourceLine" id="cb30-22" data-line-number="22">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> java.foreign.*;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.*;</span>
+<span class="kw">import static</span><span class="im"> org.unix.readline_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> Readline {
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+        <span class="co">// Scope for native allocations</span>
+        <span class="kw">try</span> (Scope s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            <span class="co">// allocate C memory initialized with Java string content</span>
+            var pstr = s.<span class="fu">allocateCString</span>(<span class="st">&quot;name? &quot;</span>);
+
+            <span class="co">// call &quot;readline&quot; API</span>
+            var p = <span class="fu">readline</span>(pstr);
+
+            <span class="co">// print char* as is</span>
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(p);
+            <span class="co">// convert char* ptr from readline as Java String &amp; print it</span>
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(Pointer.<span class="fu">toString</span>(p));
+        }
+    }
+}</code></pre></div>
 <h3 id="running-the-java-code-that-uses-readline">Running the java code that uses readline</h3>
 <pre><code>
 javac -cp readline.jar Readline.java
@@ -697,331 +718,331 @@
 </code></pre>
 <h2 id="using-libcurl-from-java-mac-os">Using libcurl from Java (Mac OS)</h2>
 <h3 id="jextract-a-jar-for-curl.h">jextract a jar for curl.h</h3>
-<div class="sourceCode" id="cb32"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb32-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb32-2" data-line-number="2"><span class="ex">jextract</span> -t org.unix -L /usr/lib -lcurl --record-library-path /usr/include/curl/curl.h -o curl.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -t org.unix -L /usr/lib -lcurl --record-library-path /usr/include/curl/curl.h -o curl.jar</code></pre></div>
 <h3 id="java-code-that-uses-libcurl">Java code that uses libcurl</h3>
-<div class="sourceCode" id="cb33"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb33-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb33-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.lang.invoke.*;</span></a>
-<a class="sourceLine" id="cb33-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.*;</span></a>
-<a class="sourceLine" id="cb33-4" data-line-number="4"><span class="kw">import</span><span class="im"> java.foreign.memory.*;</span></a>
-<a class="sourceLine" id="cb33-5" data-line-number="5"><span class="kw">import</span><span class="im"> org.unix.curl_lib;</span></a>
-<a class="sourceLine" id="cb33-6" data-line-number="6"><span class="kw">import static</span><span class="im"> org.unix.curl_lib.*;</span></a>
-<a class="sourceLine" id="cb33-7" data-line-number="7"><span class="kw">import static</span><span class="im"> org.unix.easy_lib.*;</span></a>
-<a class="sourceLine" id="cb33-8" data-line-number="8"></a>
-<a class="sourceLine" id="cb33-9" data-line-number="9"><span class="kw">public</span> <span class="kw">class</span> CurlMain {</a>
-<a class="sourceLine" id="cb33-10" data-line-number="10">   <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb33-11" data-line-number="11">       <span class="kw">try</span> (Scope s = curl_lib.<span class="fu">scope</span>().<span class="fu">fork</span>()) { </a>
-<a class="sourceLine" id="cb33-12" data-line-number="12">           <span class="fu">curl_global_init</span>(CURL_GLOBAL_DEFAULT);</a>
-<a class="sourceLine" id="cb33-13" data-line-number="13">           Pointer&lt;<span class="bu">Void</span>&gt; curl = <span class="fu">curl_easy_init</span>();</a>
-<a class="sourceLine" id="cb33-14" data-line-number="14">           <span class="kw">if</span>(!curl.<span class="fu">isNull</span>()) {</a>
-<a class="sourceLine" id="cb33-15" data-line-number="15">               Pointer&lt;<span class="bu">Byte</span>&gt; url = s.<span class="fu">allocateCString</span>(args[<span class="dv">0</span>]);</a>
-<a class="sourceLine" id="cb33-16" data-line-number="16">               <span class="fu">curl_easy_setopt</span>(curl, CURLOPT_URL, url);</a>
-<a class="sourceLine" id="cb33-17" data-line-number="17">               <span class="dt">int</span> res = <span class="fu">curl_easy_perform</span>(curl);</a>
-<a class="sourceLine" id="cb33-18" data-line-number="18">               <span class="kw">if</span> (res != CURLE_OK) {</a>
-<a class="sourceLine" id="cb33-19" data-line-number="19">                   <span class="fu">curl_easy_cleanup</span>(curl);</a>
-<a class="sourceLine" id="cb33-20" data-line-number="20">               }</a>
-<a class="sourceLine" id="cb33-21" data-line-number="21">           }</a>
-<a class="sourceLine" id="cb33-22" data-line-number="22">           <span class="fu">curl_global_cleanup</span>();</a>
-<a class="sourceLine" id="cb33-23" data-line-number="23">       }</a>
-<a class="sourceLine" id="cb33-24" data-line-number="24">    }</a>
-<a class="sourceLine" id="cb33-25" data-line-number="25">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> java.lang.invoke.*;</span>
+<span class="kw">import</span><span class="im"> java.foreign.*;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.*;</span>
+<span class="kw">import</span><span class="im"> org.unix.curl_lib;</span>
+<span class="kw">import static</span><span class="im"> org.unix.curl_lib.*;</span>
+<span class="kw">import static</span><span class="im"> org.unix.easy_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> CurlMain {
+   <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+       <span class="kw">try</span> (Scope s = curl_lib.<span class="fu">scope</span>().<span class="fu">fork</span>()) {
+           <span class="fu">curl_global_init</span>(CURL_GLOBAL_DEFAULT);
+           Pointer&lt;<span class="bu">Void</span>&gt; curl = <span class="fu">curl_easy_init</span>();
+           <span class="kw">if</span>(!curl.<span class="fu">isNull</span>()) {
+               Pointer&lt;<span class="bu">Byte</span>&gt; url = s.<span class="fu">allocateCString</span>(args[<span class="dv">0</span>]);
+               <span class="fu">curl_easy_setopt</span>(curl, CURLOPT_URL, url);
+               <span class="dt">int</span> res = <span class="fu">curl_easy_perform</span>(curl);
+               <span class="kw">if</span> (res != CURLE_OK) {
+                   <span class="fu">curl_easy_cleanup</span>(curl);
+               }
+           }
+           <span class="fu">curl_global_cleanup</span>();
+       }
+    }
+}</code></pre></div>
 <h3 id="running-the-java-code-that-uses-libcurl">Running the java code that uses libcurl</h3>
-<div class="sourceCode" id="cb34"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb34-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb34-2" data-line-number="2"><span class="ex">javac</span> -cp curl.jar CurlMain.java</a>
-<a class="sourceLine" id="cb34-3" data-line-number="3"><span class="ex">java</span> -cp curl.jar:. CurlMain <span class="op">&lt;</span>url<span class="op">&gt;</span></a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp curl.jar CurlMain.java
+<span class="ex">java</span> -cp curl.jar:. CurlMain <span class="op">&lt;</span>url<span class="op">&gt;</span></code></pre></div>
 <h2 id="using-unistd.h-from-java-code-linux">Using unistd.h from Java code (Linux)</h2>
 <h3 id="jextract-a-jar-file-for-unistd.h">jextract a jar file for unistd.h</h3>
-<div class="sourceCode" id="cb35"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb35-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb35-2" data-line-number="2"><span class="ex">jextract</span> /usr/include/unistd.h -t org.unix -o unistd.jar</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> /usr/include/unistd.h -t org.unix -o unistd.jar</code></pre></div>
 <h3 id="java-code-that-calls-getpid">Java code that calls getpid</h3>
-<div class="sourceCode" id="cb36"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb36-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb36-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.foreign.*;</span></a>
-<a class="sourceLine" id="cb36-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.lang.invoke.*;</span></a>
-<a class="sourceLine" id="cb36-4" data-line-number="4"><span class="kw">import</span><span class="im"> org.unix.unistd_h;</span></a>
-<a class="sourceLine" id="cb36-5" data-line-number="5"></a>
-<a class="sourceLine" id="cb36-6" data-line-number="6"></a>
-<a class="sourceLine" id="cb36-7" data-line-number="7"><span class="kw">public</span> <span class="kw">class</span> Getpid {</a>
-<a class="sourceLine" id="cb36-8" data-line-number="8">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb36-9" data-line-number="9">        <span class="co">// bind unistd interface</span></a>
-<a class="sourceLine" id="cb36-10" data-line-number="10">        var u = Libraries.<span class="fu">bind</span>(MethodHandles.<span class="fu">lookup</span>(), unistd_h.<span class="fu">class</span>);</a>
-<a class="sourceLine" id="cb36-11" data-line-number="11">        <span class="co">// call getpid from the unistd.h</span></a>
-<a class="sourceLine" id="cb36-12" data-line-number="12">        <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(u.<span class="fu">getpid</span>());</a>
-<a class="sourceLine" id="cb36-13" data-line-number="13">        <span class="co">// check process id from Java API!</span></a>
-<a class="sourceLine" id="cb36-14" data-line-number="14">        <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(ProcessHandle.<span class="fu">current</span>().<span class="fu">pid</span>());</a>
-<a class="sourceLine" id="cb36-15" data-line-number="15">    }</a>
-<a class="sourceLine" id="cb36-16" data-line-number="16">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> java.foreign.*;</span>
+<span class="kw">import</span><span class="im"> java.lang.invoke.*;</span>
+<span class="kw">import</span><span class="im"> org.unix.unistd_h;</span>
+
+
+<span class="kw">public</span> <span class="kw">class</span> Getpid {
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+        <span class="co">// bind unistd interface</span>
+        var u = Libraries.<span class="fu">bind</span>(MethodHandles.<span class="fu">lookup</span>(), unistd_h.<span class="fu">class</span>);
+        <span class="co">// call getpid from the unistd.h</span>
+        <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(u.<span class="fu">getpid</span>());
+        <span class="co">// check process id from Java API!</span>
+        <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(ProcessHandle.<span class="fu">current</span>().<span class="fu">pid</span>());
+    }
+}</code></pre></div>
 <h3 id="running-the-java-code-that-uses-getpid">Running the Java code that uses getpid</h3>
-<div class="sourceCode" id="cb37"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb37-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb37-2" data-line-number="2"><span class="ex">javac</span> -cp unistd.jar Getpid.java</a>
-<a class="sourceLine" id="cb37-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb37-4" data-line-number="4"><span class="ex">java</span> -cp unistd.jar:. Getpid</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp unistd.jar Getpid.java
+
+<span class="ex">java</span> -cp unistd.jar:. Getpid</code></pre></div>
 <h2 id="using-opengl-graphic-library-ubuntu-16.04">Using OpenGL graphic library (Ubuntu 16.04)</h2>
 <p>OpenGL is a popular portable graphic library: <a href="https://www.opengl.org/" class="uri">https://www.opengl.org/</a></p>
 <h3 id="installing-opengl-ubuntu-16.04">Installing OpenGL (Ubuntu 16.04)</h3>
 <p>Installing relevant OpenGL headers and libraries can be a bit tricky, as it depends on what graphic card is installed on the target platform. The following instruction assume that the standard version of OpenGL is used (e.g. mesa), rather than a proprietary one (Nvidia or AMD), although the changes to get these working are rather small.</p>
 <p>OpenGL is always coupled with a bunch of other libraries, namely GLU and glut. You can install all those libraries using <code>apt</code>, as follows:</p>
-<div class="sourceCode" id="cb38"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb38-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb38-2" data-line-number="2"><span class="fu">sudo</span> apt-get install libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="fu">sudo</span> apt-get install libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev</code></pre></div>
 <p>If the installation was successful, OpenGL headers can be found under <code>/usr/include/GL</code>, while libraries can be found in the folder <code>/usr/lib/x86_64-linux-gnu/</code>.</p>
 <h3 id="jextracting-opengl-ubuntu-16.04">jextracting OpenGL (Ubuntu 16.04)</h3>
 <p>To extract the opengl libraries the following command suffices:</p>
-<div class="sourceCode" id="cb39"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb39-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb39-2" data-line-number="2"><span class="ex">jextract</span> -L /usr/lib/x86_64-linux-gnu  -l glut -l GLU -l GL --record-library-path -t opengl -o opengl.jar /usr/include/GL/glut.h</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -L /usr/lib/x86_64-linux-gnu  -l glut -l GLU -l GL --record-library-path -t opengl -o opengl.jar /usr/include/GL/glut.h</code></pre></div>
 <p>Since glut depends on the other libraries (GLU and GL), it is not necessary to give additional headers to jextract.</p>
 <h3 id="java-sample-code-that-uses-the-opengl-library">Java sample code that uses the OpenGL library</h3>
-<div class="sourceCode" id="cb40"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb40-1" data-line-number="1"><span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span></a>
-<a class="sourceLine" id="cb40-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.foreign.Scope;</span></a>
-<a class="sourceLine" id="cb40-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span></a>
-<a class="sourceLine" id="cb40-4" data-line-number="4"><span class="kw">import</span><span class="im"> java.foreign.memory.Pointer;</span></a>
-<a class="sourceLine" id="cb40-5" data-line-number="5"></a>
-<a class="sourceLine" id="cb40-6" data-line-number="6"><span class="kw">import static</span><span class="im"> opengl.gl_lib.*;</span></a>
-<a class="sourceLine" id="cb40-7" data-line-number="7"><span class="kw">import static</span><span class="im"> opengl.freeglut_std_lib.*;</span></a>
-<a class="sourceLine" id="cb40-8" data-line-number="8"></a>
-<a class="sourceLine" id="cb40-9" data-line-number="9"><span class="kw">public</span> <span class="kw">class</span> Teapot {</a>
-<a class="sourceLine" id="cb40-10" data-line-number="10"></a>
-<a class="sourceLine" id="cb40-11" data-line-number="11">    <span class="dt">float</span> rot = <span class="dv">0</span>;</a>
-<a class="sourceLine" id="cb40-12" data-line-number="12"></a>
-<a class="sourceLine" id="cb40-13" data-line-number="13">    <span class="fu">Teapot</span>(Scope sc) {</a>
-<a class="sourceLine" id="cb40-14" data-line-number="14">        <span class="co">// Misc Parameters</span></a>
-<a class="sourceLine" id="cb40-15" data-line-number="15">        <span class="bu">Array</span>&lt;<span class="bu">Float</span>&gt; pos = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">FLOAT</span>, <span class="kw">new</span> <span class="dt">float</span>[] {<span class="fl">0.0f</span>, <span class="fl">15.0f</span>, <span class="fl">-15.0f</span>, <span class="dv">0</span>});</a>
-<a class="sourceLine" id="cb40-16" data-line-number="16">        <span class="bu">Array</span>&lt;<span class="bu">Float</span>&gt; spec = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">FLOAT</span>, <span class="kw">new</span> <span class="dt">float</span>[] {<span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>});</a>
-<a class="sourceLine" id="cb40-17" data-line-number="17">        <span class="bu">Array</span>&lt;<span class="bu">Float</span>&gt; shini = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">FLOAT</span>, <span class="kw">new</span> <span class="dt">float</span>[] {<span class="dv">113</span>});</a>
-<a class="sourceLine" id="cb40-18" data-line-number="18"></a>
-<a class="sourceLine" id="cb40-19" data-line-number="19">        <span class="co">// Reset Background</span></a>
-<a class="sourceLine" id="cb40-20" data-line-number="20">        <span class="fu">glClearColor</span>(<span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb40-21" data-line-number="21"></a>
-<a class="sourceLine" id="cb40-22" data-line-number="22">        <span class="co">// Setup Lighting</span></a>
-<a class="sourceLine" id="cb40-23" data-line-number="23">        <span class="fu">glShadeModel</span>(GL_SMOOTH);</a>
-<a class="sourceLine" id="cb40-24" data-line-number="24">        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_POSITION, pos.<span class="fu">elementPointer</span>());</a>
-<a class="sourceLine" id="cb40-25" data-line-number="25">        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_AMBIENT, spec.<span class="fu">elementPointer</span>());</a>
-<a class="sourceLine" id="cb40-26" data-line-number="26">        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_DIFFUSE, spec.<span class="fu">elementPointer</span>());</a>
-<a class="sourceLine" id="cb40-27" data-line-number="27">        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_SPECULAR, spec.<span class="fu">elementPointer</span>());</a>
-<a class="sourceLine" id="cb40-28" data-line-number="28">        <span class="fu">glMaterialfv</span>(GL_FRONT, GL_SHININESS, shini.<span class="fu">elementPointer</span>());</a>
-<a class="sourceLine" id="cb40-29" data-line-number="29">        <span class="fu">glEnable</span>(GL_LIGHTING);</a>
-<a class="sourceLine" id="cb40-30" data-line-number="30">        <span class="fu">glEnable</span>(GL_LIGHT0);</a>
-<a class="sourceLine" id="cb40-31" data-line-number="31">        <span class="fu">glEnable</span>(GL_DEPTH_TEST);</a>
-<a class="sourceLine" id="cb40-32" data-line-number="32">    }</a>
-<a class="sourceLine" id="cb40-33" data-line-number="33"></a>
-<a class="sourceLine" id="cb40-34" data-line-number="34">    <span class="dt">void</span> <span class="fu">display</span>() {</a>
-<a class="sourceLine" id="cb40-35" data-line-number="35">        <span class="fu">glClear</span>(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);</a>
-<a class="sourceLine" id="cb40-36" data-line-number="36">        <span class="fu">glPushMatrix</span>();</a>
-<a class="sourceLine" id="cb40-37" data-line-number="37">        <span class="fu">glRotatef</span>(-<span class="dv">20</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb40-38" data-line-number="38">        <span class="fu">glRotatef</span>(rot, <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb40-39" data-line-number="39">        <span class="fu">glutSolidTeapot</span>(<span class="fl">0.5</span>);</a>
-<a class="sourceLine" id="cb40-40" data-line-number="40">        <span class="fu">glPopMatrix</span>();</a>
-<a class="sourceLine" id="cb40-41" data-line-number="41">        <span class="fu">glutSwapBuffers</span>();</a>
-<a class="sourceLine" id="cb40-42" data-line-number="42">    }</a>
-<a class="sourceLine" id="cb40-43" data-line-number="43"></a>
-<a class="sourceLine" id="cb40-44" data-line-number="44">    <span class="dt">void</span> <span class="fu">onIdle</span>() {</a>
-<a class="sourceLine" id="cb40-45" data-line-number="45">        rot += <span class="fl">0.1</span>;</a>
-<a class="sourceLine" id="cb40-46" data-line-number="46">        <span class="fu">glutPostRedisplay</span>();</a>
-<a class="sourceLine" id="cb40-47" data-line-number="47">    }</a>
-<a class="sourceLine" id="cb40-48" data-line-number="48"></a>
-<a class="sourceLine" id="cb40-49" data-line-number="49">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {</a>
-<a class="sourceLine" id="cb40-50" data-line-number="50">        <span class="kw">try</span> (Scope sc = opengl.<span class="fu">gl_lib</span>.<span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb40-51" data-line-number="51">            Pointer&lt;<span class="bu">Integer</span>&gt; argc = sc.<span class="fu">allocate</span>(NativeTypes.<span class="fu">INT32</span>);</a>
-<a class="sourceLine" id="cb40-52" data-line-number="52">            argc.<span class="fu">set</span>(<span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb40-53" data-line-number="53">            <span class="fu">glutInit</span>(argc, Pointer.<span class="fu">ofNull</span>());</a>
-<a class="sourceLine" id="cb40-54" data-line-number="54">            <span class="fu">glutInitDisplayMode</span>(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);</a>
-<a class="sourceLine" id="cb40-55" data-line-number="55">            <span class="fu">glutInitWindowSize</span>(<span class="dv">900</span>, <span class="dv">900</span>);</a>
-<a class="sourceLine" id="cb40-56" data-line-number="56">            <span class="fu">glutCreateWindow</span>(sc.<span class="fu">allocateCString</span>(<span class="st">&quot;Hello Panama!&quot;</span>));</a>
-<a class="sourceLine" id="cb40-57" data-line-number="57">            Teapot teapot = <span class="kw">new</span> <span class="fu">Teapot</span>(sc);</a>
-<a class="sourceLine" id="cb40-58" data-line-number="58">            <span class="fu">glutDisplayFunc</span>(sc.<span class="fu">allocateCallback</span>(teapot::display));</a>
-<a class="sourceLine" id="cb40-59" data-line-number="59">            <span class="fu">glutIdleFunc</span>(sc.<span class="fu">allocateCallback</span>(teapot::onIdle));</a>
-<a class="sourceLine" id="cb40-60" data-line-number="60">            <span class="fu">glutMainLoop</span>();</a>
-<a class="sourceLine" id="cb40-61" data-line-number="61">        }</a>
-<a class="sourceLine" id="cb40-62" data-line-number="62">    }</a>
-<a class="sourceLine" id="cb40-63" data-line-number="63">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span>
+<span class="kw">import</span><span class="im"> java.foreign.Scope;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Pointer;</span>
+
+<span class="kw">import static</span><span class="im"> opengl.gl_lib.*;</span>
+<span class="kw">import static</span><span class="im"> opengl.freeglut_std_lib.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> Teapot {
+
+    <span class="dt">float</span> rot = <span class="dv">0</span>;
+
+    <span class="fu">Teapot</span>(Scope sc) {
+        <span class="co">// Misc Parameters</span>
+        <span class="bu">Array</span>&lt;<span class="bu">Float</span>&gt; pos = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">FLOAT</span>, <span class="kw">new</span> <span class="dt">float</span>[] {<span class="fl">0.</span>0f, <span class="fl">15.</span>0f, -<span class="fl">15.</span>0f, <span class="dv">0</span>});
+        <span class="bu">Array</span>&lt;<span class="bu">Float</span>&gt; spec = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">FLOAT</span>, <span class="kw">new</span> <span class="dt">float</span>[] {<span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>});
+        <span class="bu">Array</span>&lt;<span class="bu">Float</span>&gt; shini = sc.<span class="fu">allocateArray</span>(NativeTypes.<span class="fu">FLOAT</span>, <span class="kw">new</span> <span class="dt">float</span>[] {<span class="dv">113</span>});
+
+        <span class="co">// Reset Background</span>
+        <span class="fu">glClearColor</span>(<span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>);
+
+        <span class="co">// Setup Lighting</span>
+        <span class="fu">glShadeModel</span>(GL_SMOOTH);
+        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_POSITION, pos.<span class="fu">elementPointer</span>());
+        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_AMBIENT, spec.<span class="fu">elementPointer</span>());
+        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_DIFFUSE, spec.<span class="fu">elementPointer</span>());
+        <span class="fu">glLightfv</span>(GL_LIGHT0, GL_SPECULAR, spec.<span class="fu">elementPointer</span>());
+        <span class="fu">glMaterialfv</span>(GL_FRONT, GL_SHININESS, shini.<span class="fu">elementPointer</span>());
+        <span class="fu">glEnable</span>(GL_LIGHTING);
+        <span class="fu">glEnable</span>(GL_LIGHT0);
+        <span class="fu">glEnable</span>(GL_DEPTH_TEST);
+    }
+
+    <span class="dt">void</span> <span class="fu">display</span>() {
+        <span class="fu">glClear</span>(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+        <span class="fu">glPushMatrix</span>();
+        <span class="fu">glRotatef</span>(-<span class="dv">20</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>);
+        <span class="fu">glRotatef</span>(rot, <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">0</span>);
+        <span class="fu">glutSolidTeapot</span>(<span class="fl">0.5</span>);
+        <span class="fu">glPopMatrix</span>();
+        <span class="fu">glutSwapBuffers</span>();
+    }
+
+    <span class="dt">void</span> <span class="fu">onIdle</span>() {
+        rot += <span class="fl">0.1</span>;
+        <span class="fu">glutPostRedisplay</span>();
+    }
+
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span>[] args) {
+        <span class="kw">try</span> (Scope sc = opengl.<span class="fu">gl_lib</span>.<span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            Pointer&lt;<span class="bu">Integer</span>&gt; argc = sc.<span class="fu">allocate</span>(NativeTypes.<span class="fu">INT32</span>);
+            argc.<span class="fu">set</span>(<span class="dv">0</span>);
+            <span class="fu">glutInit</span>(argc, Pointer.<span class="fu">ofNull</span>());
+            <span class="fu">glutInitDisplayMode</span>(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
+            <span class="fu">glutInitWindowSize</span>(<span class="dv">900</span>, <span class="dv">900</span>);
+            <span class="fu">glutCreateWindow</span>(sc.<span class="fu">allocateCString</span>(<span class="st">&quot;Hello Panama!&quot;</span>));
+            Teapot teapot = <span class="kw">new</span> <span class="fu">Teapot</span>(sc);
+            <span class="fu">glutDisplayFunc</span>(sc.<span class="fu">allocateCallback</span>(teapot::display));
+            <span class="fu">glutIdleFunc</span>(sc.<span class="fu">allocateCallback</span>(teapot::onIdle));
+            <span class="fu">glutMainLoop</span>();
+        }
+    }
+}</code></pre></div>
 <h3 id="running-the-java-code-that-uses-opengl-ubuntu-16.04">Running the Java code that uses OpenGL (Ubuntu 16.04)</h3>
-<div class="sourceCode" id="cb41"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb41-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb41-2" data-line-number="2"><span class="ex">javac</span> -cp opengl.jar Teapot.java</a>
-<a class="sourceLine" id="cb41-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb41-4" data-line-number="4"><span class="ex">java</span> -cp opengl.jar:. Teapot</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp opengl.jar Teapot.java
+
+<span class="ex">java</span> -cp opengl.jar:. Teapot</code></pre></div>
 <h2 id="using-opengl-graphic-library-windows">Using OpenGL graphic library (Windows)</h2>
 <h3 id="installing-opengl">Installing OpenGL</h3>
 <p>Download the freeglut package for MSVC at <a href="https://www.transmissionzero.co.uk/software/freeglut-devel/" class="uri">https://www.transmissionzero.co.uk/software/freeglut-devel/</a></p>
 <p>Extract the freeglut zip.</p>
 <h3 id="jextracting-opengl">jextracting OpenGL</h3>
 <p>Navigate to the root directory of the extracted zip and run the following commands:</p>
-<div class="sourceCode" id="cb42"><pre class="sourceCode powershell"><code class="sourceCode powershell"><a class="sourceLine" id="cb42-1" data-line-number="1"><span class="va">$inc</span> = <span class="st">&quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0&quot;</span></a>
-<a class="sourceLine" id="cb42-2" data-line-number="2">jextract -L C:\Windows\System32\ -L .\freeglut\bin\x64\ -l opengl32 -l freeglut -t opengl -o opengl.<span class="fu">jar</span> --package-map <span class="st">&quot;$inc\um\gl=opengl&quot;</span> --record-library-path .\freeglut\include\<span class="fu">GL</span>\glut.<span class="fu">h</span></a></code></pre></div>
+<pre class="powershell"><code>$inc = &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0&quot;
+jextract -L C:\Windows\System32\ -L .\freeglut\bin\x64\ -l opengl32 -l freeglut -t opengl -o opengl.jar --package-map &quot;$inc\um\gl=opengl&quot; --record-library-path .\freeglut\include\GL\glut.h</code></pre>
 <p>The directory that is assigned to <code>$inc</code> is an example, and is system dependent. Make sure that the build number at the end of the path (in this case <code>10.0.17134.0</code>) is the latest one found in the parent folder (<code>C:\Program Files (x86)\Windows Kits\10\Include\</code>).</p>
 <p>There are a bunch of warnings generated, but as long as the jar file is generated in the working directory the extraction was successful.</p>
 <h3 id="java-sample-code-that-uses-the-opengl-library-1">Java sample code that uses the OpenGL library</h3>
 <p>This is the same as in the Ubuntu section</p>
 <h3 id="running-the-java-code-that-uses-opengl">Running the Java code that uses OpenGL</h3>
-<div class="sourceCode" id="cb43"><pre class="sourceCode powershell"><code class="sourceCode powershell"><a class="sourceLine" id="cb43-1" data-line-number="1">javac -cp .\opengl.<span class="fu">jar</span> Teapot.<span class="fu">java</span></a>
-<a class="sourceLine" id="cb43-2" data-line-number="2">java -cp <span class="st">&quot;opengl.jar;.&quot;</span> Teapot</a></code></pre></div>
+<pre class="powershell"><code>javac -cp .\opengl.jar Teapot.java
+java -cp &quot;opengl.jar;.&quot; Teapot</code></pre>
 <h2 id="using-tensorflow-c-api-mac-os">Using TensorFlow C API (Mac OS)</h2>
 <p>Quoted from <a href="https://www.tensorflow.org/install/lang_c" class="uri">https://www.tensorflow.org/install/lang_c</a></p>
 <p>&quot;TensorFlow provides a C API that can be used to build bindings for other languages. The API is defined in c_api.h and designed for simplicity and uniformity rather than convenience.&quot;</p>
 <h3 id="installing-libtensorflow">Installing libtensorflow</h3>
 <p>You can follow the setup procedure as described in the above page.</p>
 <p>Alternatively, on Mac, you can install libtensorflow using HomeBrew</p>
-<div class="sourceCode" id="cb44"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb44-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb44-2" data-line-number="2"><span class="ex">brew</span> install libtensorflow</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">brew</span> install libtensorflow</code></pre></div>
 <p>Tensorflow ship the libtensorflow with an .so extension, this doesn't work well for java on MacOS as java expect .dylib extension. To work around this, create a symbolic link.</p>
-<div class="sourceCode" id="cb45"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb45-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb45-2" data-line-number="2"><span class="fu">sudo</span> ln -s /usr/local/lib/libtensorflow.so /usr/local/lib/libtensorflow.dylib</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="fu">sudo</span> ln -s /usr/local/lib/libtensorflow.so /usr/local/lib/libtensorflow.dylib</code></pre></div>
 <h3 id="jextracting-libtensorflow-c_api.h">jextracting libtensorflow c_api.h</h3>
 <p>The following command can be used to extract c_api.h.</p>
-<div class="sourceCode" id="cb46"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb46-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb46-2" data-line-number="2"><span class="ex">jextract</span> -C -x -C c++  \</a>
-<a class="sourceLine" id="cb46-3" data-line-number="3">        -L /usr/local/lib -l tensorflow --record-library-path \</a>
-<a class="sourceLine" id="cb46-4" data-line-number="4">        -o tf.jar -t org.tensorflow.panama \</a>
-<a class="sourceLine" id="cb46-5" data-line-number="5">        /usr/local/include/tensorflow/c/c_api.h</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">jextract</span> -C -x -C c++  \
+        -L /usr/local/lib -l tensorflow --record-library-path \
+        -o tf.jar -t org.tensorflow.panama \
+        /usr/local/include/tensorflow/c/c_api.h</code></pre></div>
 <p>The caveat to extract tensorflow C API is that it declare function prototype without argument in C++ style, for example, TF_Version(), which is considered incomplete C function prototype instead of C style as in TF_Version(void). An incomplete function prototype will become vararg funciton. To avoid that, we need to pass clang '-x c++' options to jextract with '-C -x -C c++'</p>
 <h3 id="java-sample-code-that-uses-tensorflow-library">Java sample code that uses tensorflow library</h3>
-<div class="sourceCode" id="cb47"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb47-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb47-2" data-line-number="2"><span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span></a>
-<a class="sourceLine" id="cb47-3" data-line-number="3"><span class="kw">import</span><span class="im"> java.foreign.Scope;</span></a>
-<a class="sourceLine" id="cb47-4" data-line-number="4"><span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span></a>
-<a class="sourceLine" id="cb47-5" data-line-number="5"><span class="kw">import</span><span class="im"> java.foreign.memory.LayoutType;</span></a>
-<a class="sourceLine" id="cb47-6" data-line-number="6"><span class="kw">import</span><span class="im"> java.foreign.memory.Pointer;</span></a>
-<a class="sourceLine" id="cb47-7" data-line-number="7"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_DataType;</span></a>
-<a class="sourceLine" id="cb47-8" data-line-number="8"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Graph;</span></a>
-<a class="sourceLine" id="cb47-9" data-line-number="9"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Operation;</span></a>
-<a class="sourceLine" id="cb47-10" data-line-number="10"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_OperationDescription;</span></a>
-<a class="sourceLine" id="cb47-11" data-line-number="11"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Output;</span></a>
-<a class="sourceLine" id="cb47-12" data-line-number="12"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Session;</span></a>
-<a class="sourceLine" id="cb47-13" data-line-number="13"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_SessionOptions;</span></a>
-<a class="sourceLine" id="cb47-14" data-line-number="14"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Status;</span></a>
-<a class="sourceLine" id="cb47-15" data-line-number="15"><span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Tensor;</span></a>
-<a class="sourceLine" id="cb47-16" data-line-number="16"></a>
-<a class="sourceLine" id="cb47-17" data-line-number="17"><span class="kw">import static</span><span class="im"> org.tensorflow.panama.c_api_lib.*;</span></a>
-<a class="sourceLine" id="cb47-18" data-line-number="18"><span class="kw">import static</span><span class="im"> org.tensorflow.panama.c_api_lib.TF_DataType.*;</span></a>
-<a class="sourceLine" id="cb47-19" data-line-number="19"></a>
-<a class="sourceLine" id="cb47-20" data-line-number="20"><span class="kw">public</span> <span class="kw">class</span> TensorFlowExample {</a>
-<a class="sourceLine" id="cb47-21" data-line-number="21">    <span class="dt">static</span> Pointer&lt;TF_Operation&gt; <span class="fu">PlaceHolder</span>(Pointer&lt;TF_Graph&gt; graph, Pointer&lt;TF_Status&gt; status,</a>
-<a class="sourceLine" id="cb47-22" data-line-number="22">                                      <span class="at">@TF_DataType</span> <span class="dt">int</span> dtype, <span class="bu">String</span> name) {</a>
-<a class="sourceLine" id="cb47-23" data-line-number="23">        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb47-24" data-line-number="24">            Pointer&lt;TF_OperationDescription&gt; desc = <span class="fu">TF_NewOperation</span>(graph,</a>
-<a class="sourceLine" id="cb47-25" data-line-number="25">                    s.<span class="fu">allocateCString</span>(<span class="st">&quot;Placeholder&quot;</span>), s.<span class="fu">allocateCString</span>(name));</a>
-<a class="sourceLine" id="cb47-26" data-line-number="26">            <span class="fu">TF_SetAttrType</span>(desc, s.<span class="fu">allocateCString</span>(<span class="st">&quot;dtype&quot;</span>), TF_FLOAT);</a>
-<a class="sourceLine" id="cb47-27" data-line-number="27">            <span class="kw">return</span> <span class="fu">TF_FinishOperation</span>(desc, status);</a>
-<a class="sourceLine" id="cb47-28" data-line-number="28">        }</a>
-<a class="sourceLine" id="cb47-29" data-line-number="29">    }</a>
-<a class="sourceLine" id="cb47-30" data-line-number="30"></a>
-<a class="sourceLine" id="cb47-31" data-line-number="31">    <span class="dt">static</span> Pointer&lt;TF_Operation&gt; <span class="fu">ConstValue</span>(Pointer&lt;TF_Graph&gt; graph, Pointer&lt;TF_Status&gt; status,</a>
-<a class="sourceLine" id="cb47-32" data-line-number="32">                                Pointer&lt;TF_Tensor&gt; tensor, <span class="bu">String</span> name) {</a>
-<a class="sourceLine" id="cb47-33" data-line-number="33">        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb47-34" data-line-number="34">            Pointer&lt;TF_OperationDescription&gt; desc = <span class="fu">TF_NewOperation</span>(graph,</a>
-<a class="sourceLine" id="cb47-35" data-line-number="35">                    s.<span class="fu">allocateCString</span>(<span class="st">&quot;Const&quot;</span>), s.<span class="fu">allocateCString</span>(name));</a>
-<a class="sourceLine" id="cb47-36" data-line-number="36">            <span class="fu">TF_SetAttrTensor</span>(desc, s.<span class="fu">allocateCString</span>(<span class="st">&quot;value&quot;</span>), tensor, status);</a>
-<a class="sourceLine" id="cb47-37" data-line-number="37">            <span class="fu">TF_SetAttrType</span>(desc, s.<span class="fu">allocateCString</span>(<span class="st">&quot;dtype&quot;</span>), <span class="fu">TF_TensorType</span>(tensor));</a>
-<a class="sourceLine" id="cb47-38" data-line-number="38">            <span class="kw">return</span> <span class="fu">TF_FinishOperation</span>(desc, status);</a>
-<a class="sourceLine" id="cb47-39" data-line-number="39">        }</a>
-<a class="sourceLine" id="cb47-40" data-line-number="40">    }</a>
-<a class="sourceLine" id="cb47-41" data-line-number="41"></a>
-<a class="sourceLine" id="cb47-42" data-line-number="42">    <span class="dt">static</span> Pointer&lt;TF_Operation&gt; <span class="fu">Add</span>(Pointer&lt;TF_Graph&gt; graph, Pointer&lt;TF_Status&gt; status,</a>
-<a class="sourceLine" id="cb47-43" data-line-number="43">                              Pointer&lt;TF_Operation&gt; one, Pointer&lt;TF_Operation&gt; two,</a>
-<a class="sourceLine" id="cb47-44" data-line-number="44">                              <span class="bu">String</span> name) {</a>
-<a class="sourceLine" id="cb47-45" data-line-number="45">        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb47-46" data-line-number="46">            Pointer&lt;TF_OperationDescription&gt; desc = <span class="fu">TF_NewOperation</span>(graph,</a>
-<a class="sourceLine" id="cb47-47" data-line-number="47">                    s.<span class="fu">allocateCString</span>(<span class="st">&quot;AddN&quot;</span>), s.<span class="fu">allocateCString</span>(name));</a>
-<a class="sourceLine" id="cb47-48" data-line-number="48">            <span class="bu">Array</span>&lt;TF_Output&gt; add_inputs = s.<span class="fu">allocateArray</span>(</a>
-<a class="sourceLine" id="cb47-49" data-line-number="49">                    LayoutType.<span class="fu">ofStruct</span>(TF_Output.<span class="fu">class</span>),<span class="dv">2</span>);</a>
-<a class="sourceLine" id="cb47-50" data-line-number="50">            add_inputs.<span class="fu">get</span>(<span class="dv">0</span>).<span class="fu">oper</span>$<span class="fu">set</span>(one);</a>
-<a class="sourceLine" id="cb47-51" data-line-number="51">            add_inputs.<span class="fu">get</span>(<span class="dv">0</span>).<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb47-52" data-line-number="52">            add_inputs.<span class="fu">get</span>(<span class="dv">1</span>).<span class="fu">oper</span>$<span class="fu">set</span>(two);</a>
-<a class="sourceLine" id="cb47-53" data-line-number="53">            add_inputs.<span class="fu">get</span>(<span class="dv">1</span>).<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb47-54" data-line-number="54">            <span class="fu">TF_AddInputList</span>(desc, add_inputs.<span class="fu">elementPointer</span>(), <span class="dv">2</span>);</a>
-<a class="sourceLine" id="cb47-55" data-line-number="55">            <span class="kw">return</span> <span class="fu">TF_FinishOperation</span>(desc, status);</a>
-<a class="sourceLine" id="cb47-56" data-line-number="56">        }</a>
-<a class="sourceLine" id="cb47-57" data-line-number="57">    }</a>
-<a class="sourceLine" id="cb47-58" data-line-number="58"></a>
-<a class="sourceLine" id="cb47-59" data-line-number="59">    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span><span class="kw">... </span>args) {</a>
-<a class="sourceLine" id="cb47-60" data-line-number="60">        <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;TensorFlow C library version: &quot;</span> + Pointer.<span class="fu">toString</span>(<span class="fu">TF_Version</span>()));</a>
-<a class="sourceLine" id="cb47-61" data-line-number="61"></a>
-<a class="sourceLine" id="cb47-62" data-line-number="62">        Pointer&lt;TF_Graph&gt; graph = <span class="fu">TF_NewGraph</span>();</a>
-<a class="sourceLine" id="cb47-63" data-line-number="63">        Pointer&lt;TF_SessionOptions&gt; options = <span class="fu">TF_NewSessionOptions</span>();</a>
-<a class="sourceLine" id="cb47-64" data-line-number="64">        Pointer&lt;TF_Status&gt; status = <span class="fu">TF_NewStatus</span>();</a>
-<a class="sourceLine" id="cb47-65" data-line-number="65">        Pointer&lt;TF_Session&gt; session = <span class="fu">TF_NewSession</span>(graph, options, status);</a>
-<a class="sourceLine" id="cb47-66" data-line-number="66"></a>
-<a class="sourceLine" id="cb47-67" data-line-number="67">        <span class="dt">float</span> in_val_one = <span class="fl">4.0f</span>;</a>
-<a class="sourceLine" id="cb47-68" data-line-number="68">        <span class="dt">float</span> const_two = <span class="fl">2.0f</span>;</a>
-<a class="sourceLine" id="cb47-69" data-line-number="69"></a>
-<a class="sourceLine" id="cb47-70" data-line-number="70">        Pointer&lt;TF_Tensor&gt; tensor_in = <span class="fu">TF_AllocateTensor</span>(TF_FLOAT, Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>, <span class="bu">Float</span>.<span class="fu">BYTES</span>);</a>
-<a class="sourceLine" id="cb47-71" data-line-number="71">        <span class="fu">TF_TensorData</span>(tensor_in).<span class="fu">cast</span>(NativeTypes.<span class="fu">FLOAT</span>).<span class="fu">set</span>(in_val_one);</a>
-<a class="sourceLine" id="cb47-72" data-line-number="72">        Pointer&lt;TF_Tensor&gt; tensor_const_two = <span class="fu">TF_AllocateTensor</span>(TF_FLOAT, Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>, <span class="bu">Float</span>.<span class="fu">BYTES</span>);</a>
-<a class="sourceLine" id="cb47-73" data-line-number="73">        <span class="fu">TF_TensorData</span>(tensor_const_two).<span class="fu">cast</span>(NativeTypes.<span class="fu">FLOAT</span>).<span class="fu">set</span>(const_two);</a>
-<a class="sourceLine" id="cb47-74" data-line-number="74"></a>
-<a class="sourceLine" id="cb47-75" data-line-number="75">        <span class="co">// Operations</span></a>
-<a class="sourceLine" id="cb47-76" data-line-number="76">        Pointer&lt;TF_Operation&gt; feed = <span class="fu">PlaceHolder</span>(graph, status, TF_FLOAT, <span class="st">&quot;feed&quot;</span>);</a>
-<a class="sourceLine" id="cb47-77" data-line-number="77">        Pointer&lt;TF_Operation&gt; two = <span class="fu">ConstValue</span>(graph, status, tensor_const_two, <span class="st">&quot;const&quot;</span>);</a>
-<a class="sourceLine" id="cb47-78" data-line-number="78">        Pointer&lt;TF_Operation&gt; add = <span class="fu">Add</span>(graph, status, feed, two, <span class="st">&quot;add&quot;</span>);</a>
-<a class="sourceLine" id="cb47-79" data-line-number="79"></a>
-<a class="sourceLine" id="cb47-80" data-line-number="80"></a>
-<a class="sourceLine" id="cb47-81" data-line-number="81">        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {</a>
-<a class="sourceLine" id="cb47-82" data-line-number="82">            var ltPtrTensor = LayoutType.<span class="fu">ofStruct</span>(TF_Tensor.<span class="fu">class</span>).<span class="fu">pointer</span>();</a>
-<a class="sourceLine" id="cb47-83" data-line-number="83"></a>
-<a class="sourceLine" id="cb47-84" data-line-number="84">            <span class="co">// Session Inputs</span></a>
-<a class="sourceLine" id="cb47-85" data-line-number="85">            TF_Output input_operations = s.<span class="fu">allocateStruct</span>(TF_Output.<span class="fu">class</span>);</a>
-<a class="sourceLine" id="cb47-86" data-line-number="86">            input_operations.<span class="fu">oper</span>$<span class="fu">set</span>(feed);</a>
-<a class="sourceLine" id="cb47-87" data-line-number="87">            input_operations.<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb47-88" data-line-number="88">            Pointer&lt;Pointer&lt;TF_Tensor&gt;&gt; input_tensors = s.<span class="fu">allocate</span>(ltPtrTensor);</a>
-<a class="sourceLine" id="cb47-89" data-line-number="89">            input_tensors.<span class="fu">set</span>(tensor_in);</a>
-<a class="sourceLine" id="cb47-90" data-line-number="90"></a>
-<a class="sourceLine" id="cb47-91" data-line-number="91">            <span class="co">// Session Outputs</span></a>
-<a class="sourceLine" id="cb47-92" data-line-number="92">            TF_Output output_operations = s.<span class="fu">allocateStruct</span>(TF_Output.<span class="fu">class</span>);</a>
-<a class="sourceLine" id="cb47-93" data-line-number="93">            output_operations.<span class="fu">oper</span>$<span class="fu">set</span>(add);</a>
-<a class="sourceLine" id="cb47-94" data-line-number="94">            output_operations.<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb47-95" data-line-number="95">            Pointer&lt;Pointer&lt;TF_Tensor&gt;&gt; output_tensors = s.<span class="fu">allocate</span>(ltPtrTensor);</a>
-<a class="sourceLine" id="cb47-96" data-line-number="96">            <span class="fu">TF_SessionRun</span>(session, Pointer.<span class="fu">ofNull</span>(),</a>
-<a class="sourceLine" id="cb47-97" data-line-number="97">                <span class="co">// Inputs</span></a>
-<a class="sourceLine" id="cb47-98" data-line-number="98">                input_operations.<span class="fu">ptr</span>(), input_tensors, <span class="dv">1</span>,</a>
-<a class="sourceLine" id="cb47-99" data-line-number="99">                <span class="co">// Outputs</span></a>
-<a class="sourceLine" id="cb47-100" data-line-number="100">                output_operations.<span class="fu">ptr</span>(), output_tensors, <span class="dv">1</span>,</a>
-<a class="sourceLine" id="cb47-101" data-line-number="101">                <span class="co">// Target operations</span></a>
-<a class="sourceLine" id="cb47-102" data-line-number="102">                Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>, Pointer.<span class="fu">ofNull</span>(),</a>
-<a class="sourceLine" id="cb47-103" data-line-number="103">                status);</a>
-<a class="sourceLine" id="cb47-104" data-line-number="104"></a>
-<a class="sourceLine" id="cb47-105" data-line-number="105">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="bu">String</span><span class="fu">.format</span>(<span class="st">&quot;Session Run Status: </span><span class="sc">%d</span><span class="st"> - </span><span class="sc">%s</span><span class="st">&quot;</span>,</a>
-<a class="sourceLine" id="cb47-106" data-line-number="106">                    <span class="fu">TF_GetCode</span>(status), Pointer.<span class="fu">toString</span>(<span class="fu">TF_Message</span>(status))));</a>
-<a class="sourceLine" id="cb47-107" data-line-number="107">            Pointer&lt;TF_Tensor&gt; tensor_out = output_tensors.<span class="fu">get</span>();</a>
-<a class="sourceLine" id="cb47-108" data-line-number="108">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;Output Tensor Type: &quot;</span> + <span class="fu">TF_TensorType</span>(tensor_out));</a>
-<a class="sourceLine" id="cb47-109" data-line-number="109">            <span class="dt">float</span> outval = <span class="fu">TF_TensorData</span>(tensor_out).<span class="fu">cast</span>(NativeTypes.<span class="fu">FLOAT</span>).<span class="fu">get</span>();</a>
-<a class="sourceLine" id="cb47-110" data-line-number="110">            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;Output Tensor Value: &quot;</span> + outval);</a>
-<a class="sourceLine" id="cb47-111" data-line-number="111"></a>
-<a class="sourceLine" id="cb47-112" data-line-number="112">            <span class="fu">TF_CloseSession</span>(session, status);</a>
-<a class="sourceLine" id="cb47-113" data-line-number="113">            <span class="fu">TF_DeleteSession</span>(session, status);</a>
-<a class="sourceLine" id="cb47-114" data-line-number="114"></a>
-<a class="sourceLine" id="cb47-115" data-line-number="115">            <span class="fu">TF_DeleteSessionOptions</span>(options);</a>
-<a class="sourceLine" id="cb47-116" data-line-number="116"></a>
-<a class="sourceLine" id="cb47-117" data-line-number="117">            <span class="fu">TF_DeleteGraph</span>(graph);</a>
-<a class="sourceLine" id="cb47-118" data-line-number="118"></a>
-<a class="sourceLine" id="cb47-119" data-line-number="119">            <span class="fu">TF_DeleteTensor</span>(tensor_in);</a>
-<a class="sourceLine" id="cb47-120" data-line-number="120">            <span class="fu">TF_DeleteTensor</span>(tensor_out);</a>
-<a class="sourceLine" id="cb47-121" data-line-number="121">            <span class="fu">TF_DeleteTensor</span>(tensor_const_two);</a>
-<a class="sourceLine" id="cb47-122" data-line-number="122"></a>
-<a class="sourceLine" id="cb47-123" data-line-number="123">            <span class="fu">TF_DeleteStatus</span>(status);</a>
-<a class="sourceLine" id="cb47-124" data-line-number="124">        }</a>
-<a class="sourceLine" id="cb47-125" data-line-number="125">    }</a>
-<a class="sourceLine" id="cb47-126" data-line-number="126">}</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java">
+<span class="kw">import</span><span class="im"> java.foreign.NativeTypes;</span>
+<span class="kw">import</span><span class="im"> java.foreign.Scope;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Array;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.LayoutType;</span>
+<span class="kw">import</span><span class="im"> java.foreign.memory.Pointer;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_DataType;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Graph;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Operation;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_OperationDescription;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Output;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Session;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_SessionOptions;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Status;</span>
+<span class="kw">import</span><span class="im"> org.tensorflow.panama.c_api_h.TF_Tensor;</span>
+
+<span class="kw">import static</span><span class="im"> org.tensorflow.panama.c_api_lib.*;</span>
+<span class="kw">import static</span><span class="im"> org.tensorflow.panama.c_api_lib.TF_DataType.*;</span>
+
+<span class="kw">public</span> <span class="kw">class</span> TensorFlowExample {
+    <span class="dt">static</span> Pointer&lt;TF_Operation&gt; <span class="fu">PlaceHolder</span>(Pointer&lt;TF_Graph&gt; graph, Pointer&lt;TF_Status&gt; status,
+                                      <span class="at">@TF_DataType</span> <span class="dt">int</span> dtype, <span class="bu">String</span> name) {
+        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            Pointer&lt;TF_OperationDescription&gt; desc = <span class="fu">TF_NewOperation</span>(graph,
+                    s.<span class="fu">allocateCString</span>(<span class="st">&quot;Placeholder&quot;</span>), s.<span class="fu">allocateCString</span>(name));
+            <span class="fu">TF_SetAttrType</span>(desc, s.<span class="fu">allocateCString</span>(<span class="st">&quot;dtype&quot;</span>), TF_FLOAT);
+            <span class="kw">return</span> <span class="fu">TF_FinishOperation</span>(desc, status);
+        }
+    }
+
+    <span class="dt">static</span> Pointer&lt;TF_Operation&gt; <span class="fu">ConstValue</span>(Pointer&lt;TF_Graph&gt; graph, Pointer&lt;TF_Status&gt; status,
+                                Pointer&lt;TF_Tensor&gt; tensor, <span class="bu">String</span> name) {
+        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            Pointer&lt;TF_OperationDescription&gt; desc = <span class="fu">TF_NewOperation</span>(graph,
+                    s.<span class="fu">allocateCString</span>(<span class="st">&quot;Const&quot;</span>), s.<span class="fu">allocateCString</span>(name));
+            <span class="fu">TF_SetAttrTensor</span>(desc, s.<span class="fu">allocateCString</span>(<span class="st">&quot;value&quot;</span>), tensor, status);
+            <span class="fu">TF_SetAttrType</span>(desc, s.<span class="fu">allocateCString</span>(<span class="st">&quot;dtype&quot;</span>), <span class="fu">TF_TensorType</span>(tensor));
+            <span class="kw">return</span> <span class="fu">TF_FinishOperation</span>(desc, status);
+        }
+    }
+
+    <span class="dt">static</span> Pointer&lt;TF_Operation&gt; <span class="fu">Add</span>(Pointer&lt;TF_Graph&gt; graph, Pointer&lt;TF_Status&gt; status,
+                              Pointer&lt;TF_Operation&gt; one, Pointer&lt;TF_Operation&gt; two,
+                              <span class="bu">String</span> name) {
+        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            Pointer&lt;TF_OperationDescription&gt; desc = <span class="fu">TF_NewOperation</span>(graph,
+                    s.<span class="fu">allocateCString</span>(<span class="st">&quot;AddN&quot;</span>), s.<span class="fu">allocateCString</span>(name));
+            <span class="bu">Array</span>&lt;TF_Output&gt; add_inputs = s.<span class="fu">allocateArray</span>(
+                    LayoutType.<span class="fu">ofStruct</span>(TF_Output.<span class="fu">class</span>),<span class="dv">2</span>);
+            add_inputs.<span class="fu">get</span>(<span class="dv">0</span>).<span class="fu">oper</span>$<span class="fu">set</span>(one);
+            add_inputs.<span class="fu">get</span>(<span class="dv">0</span>).<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);
+            add_inputs.<span class="fu">get</span>(<span class="dv">1</span>).<span class="fu">oper</span>$<span class="fu">set</span>(two);
+            add_inputs.<span class="fu">get</span>(<span class="dv">1</span>).<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);
+            <span class="fu">TF_AddInputList</span>(desc, add_inputs.<span class="fu">elementPointer</span>(), <span class="dv">2</span>);
+            <span class="kw">return</span> <span class="fu">TF_FinishOperation</span>(desc, status);
+        }
+    }
+
+    <span class="kw">public</span> <span class="dt">static</span> <span class="dt">void</span> <span class="fu">main</span>(<span class="bu">String</span><span class="kw">... </span>args) {
+        <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;TensorFlow C library version: &quot;</span> + Pointer.<span class="fu">toString</span>(<span class="fu">TF_Version</span>()));
+
+        Pointer&lt;TF_Graph&gt; graph = <span class="fu">TF_NewGraph</span>();
+        Pointer&lt;TF_SessionOptions&gt; options = <span class="fu">TF_NewSessionOptions</span>();
+        Pointer&lt;TF_Status&gt; status = <span class="fu">TF_NewStatus</span>();
+        Pointer&lt;TF_Session&gt; session = <span class="fu">TF_NewSession</span>(graph, options, status);
+
+        <span class="dt">float</span> in_val_one = <span class="fl">4.</span>0f;
+        <span class="dt">float</span> const_two = <span class="fl">2.</span>0f;
+
+        Pointer&lt;TF_Tensor&gt; tensor_in = <span class="fu">TF_AllocateTensor</span>(TF_FLOAT, Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>, <span class="bu">Float</span>.<span class="fu">BYTES</span>);
+        <span class="fu">TF_TensorData</span>(tensor_in).<span class="fu">cast</span>(NativeTypes.<span class="fu">FLOAT</span>).<span class="fu">set</span>(in_val_one);
+        Pointer&lt;TF_Tensor&gt; tensor_const_two = <span class="fu">TF_AllocateTensor</span>(TF_FLOAT, Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>, <span class="bu">Float</span>.<span class="fu">BYTES</span>);
+        <span class="fu">TF_TensorData</span>(tensor_const_two).<span class="fu">cast</span>(NativeTypes.<span class="fu">FLOAT</span>).<span class="fu">set</span>(const_two);
+
+        <span class="co">// Operations</span>
+        Pointer&lt;TF_Operation&gt; feed = <span class="fu">PlaceHolder</span>(graph, status, TF_FLOAT, <span class="st">&quot;feed&quot;</span>);
+        Pointer&lt;TF_Operation&gt; two = <span class="fu">ConstValue</span>(graph, status, tensor_const_two, <span class="st">&quot;const&quot;</span>);
+        Pointer&lt;TF_Operation&gt; add = <span class="fu">Add</span>(graph, status, feed, two, <span class="st">&quot;add&quot;</span>);
+
+
+        <span class="kw">try</span> (var s = <span class="fu">scope</span>().<span class="fu">fork</span>()) {
+            var ltPtrTensor = LayoutType.<span class="fu">ofStruct</span>(TF_Tensor.<span class="fu">class</span>).<span class="fu">pointer</span>();
+
+            <span class="co">// Session Inputs</span>
+            TF_Output input_operations = s.<span class="fu">allocateStruct</span>(TF_Output.<span class="fu">class</span>);
+            input_operations.<span class="fu">oper</span>$<span class="fu">set</span>(feed);
+            input_operations.<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);
+            Pointer&lt;Pointer&lt;TF_Tensor&gt;&gt; input_tensors = s.<span class="fu">allocate</span>(ltPtrTensor);
+            input_tensors.<span class="fu">set</span>(tensor_in);
+
+            <span class="co">// Session Outputs</span>
+            TF_Output output_operations = s.<span class="fu">allocateStruct</span>(TF_Output.<span class="fu">class</span>);
+            output_operations.<span class="fu">oper</span>$<span class="fu">set</span>(add);
+            output_operations.<span class="fu">index</span>$<span class="fu">set</span>(<span class="dv">0</span>);
+            Pointer&lt;Pointer&lt;TF_Tensor&gt;&gt; output_tensors = s.<span class="fu">allocate</span>(ltPtrTensor);
+            <span class="fu">TF_SessionRun</span>(session, Pointer.<span class="fu">ofNull</span>(),
+                <span class="co">// Inputs</span>
+                input_operations.<span class="fu">ptr</span>(), input_tensors, <span class="dv">1</span>,
+                <span class="co">// Outputs</span>
+                output_operations.<span class="fu">ptr</span>(), output_tensors, <span class="dv">1</span>,
+                <span class="co">// Target operations</span>
+                Pointer.<span class="fu">ofNull</span>(), <span class="dv">0</span>, Pointer.<span class="fu">ofNull</span>(),
+                status);
+
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="bu">String</span><span class="fu">.format</span>(<span class="st">&quot;Session Run Status: </span><span class="sc">%d</span><span class="st"> - </span><span class="sc">%s</span><span class="st">&quot;</span>,
+                    <span class="fu">TF_GetCode</span>(status), Pointer.<span class="fu">toString</span>(<span class="fu">TF_Message</span>(status))));
+            Pointer&lt;TF_Tensor&gt; tensor_out = output_tensors.<span class="fu">get</span>();
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;Output Tensor Type: &quot;</span> + <span class="fu">TF_TensorType</span>(tensor_out));
+            <span class="dt">float</span> outval = <span class="fu">TF_TensorData</span>(tensor_out).<span class="fu">cast</span>(NativeTypes.<span class="fu">FLOAT</span>).<span class="fu">get</span>();
+            <span class="bu">System</span>.<span class="fu">out</span>.<span class="fu">println</span>(<span class="st">&quot;Output Tensor Value: &quot;</span> + outval);
+
+            <span class="fu">TF_CloseSession</span>(session, status);
+            <span class="fu">TF_DeleteSession</span>(session, status);
+
+            <span class="fu">TF_DeleteSessionOptions</span>(options);
+
+            <span class="fu">TF_DeleteGraph</span>(graph);
+
+            <span class="fu">TF_DeleteTensor</span>(tensor_in);
+            <span class="fu">TF_DeleteTensor</span>(tensor_out);
+            <span class="fu">TF_DeleteTensor</span>(tensor_const_two);
+
+            <span class="fu">TF_DeleteStatus</span>(status);
+        }
+    }
+}</code></pre></div>
 <h3 id="compiling-and-running-the-above-tensorflow-sample">Compiling and running the above TensorFlow sample</h3>
-<div class="sourceCode" id="cb48"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb48-1" data-line-number="1"></a>
-<a class="sourceLine" id="cb48-2" data-line-number="2"><span class="ex">javac</span> -cp tf.jar TensorFlowExample.java</a>
-<a class="sourceLine" id="cb48-3" data-line-number="3"></a>
-<a class="sourceLine" id="cb48-4" data-line-number="4"><span class="ex">java</span> -cp tf.jar:. TensorFlowExample</a></code></pre></div>
+<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash">
+<span class="ex">javac</span> -cp tf.jar TensorFlowExample.java
+
+<span class="ex">java</span> -cp tf.jar:. TensorFlowExample</code></pre></div>
 <h2 id="using-tensorflow-c-api-windows">Using TensorFlow C API (Windows)</h2>
 <h3 id="installing-libtensorflow-1">Installing libtensorflow</h3>
 <p>You can download a binary distribution from <a href="https://www.tensorflow.org/install/lang_c" class="uri">https://www.tensorflow.org/install/lang_c</a></p>
 <p>Extract the zip file.</p>
 <h3 id="jextracting-libtensorflow-c_api.h-1">jextracting libtensorflow c_api.h</h3>
-<p>The problem outlined in the Mac OS instruction w.r.t. incorrect function prototypes still exists (though it has been solved in the Tensorflow github repository, this change has not yet made it into the binary distributions). On Windows there is however no jextract command that works around this, so the only way to extract the \include\c\c_api.h header successfully is to first manually fix the incorrect function prototypes:</p>
-<div class="sourceCode" id="cb49"><pre class="sourceCode c"><code class="sourceCode c"><a class="sourceLine" id="cb49-1" data-line-number="1">TF_Version() -&gt; TF_Version(<span class="dt">void</span>)  </a>
-<a class="sourceLine" id="cb49-2" data-line-number="2">TF_NewGraph() -&gt; TF_NewGraph(<span class="dt">void</span>)  </a>
-<a class="sourceLine" id="cb49-3" data-line-number="3">TF_NewSessionOptions() -&gt; TF_NewSessionOptions(<span class="dt">void</span>)  </a>
-<a class="sourceLine" id="cb49-4" data-line-number="4">TF_NewStatus() -&gt; TF_NewStatus(<span class="dt">void</span>)</a>
-<a class="sourceLine" id="cb49-5" data-line-number="5">TF_NewBuffer() -&gt; TF_NewBuffer(<span class="dt">void</span>)</a>
-<a class="sourceLine" id="cb49-6" data-line-number="6">TF_NewImportGraphDefOptions() -&gt; TF_NewImportGraphDefOptions(<span class="dt">void</span>)</a>
-<a class="sourceLine" id="cb49-7" data-line-number="7">TF_GetAllOpList() -&gt; TF_GetAllOpList(<span class="dt">void</span>)</a></code></pre></div>
+<p>The problem outlined in the Mac OS instruction w.r.t. incorrect function prototypes still exists (though it has been solved in the Tensorflow github repository, this change has not yet made it into the binary distributions). On Windows there is however no jextract command that works around this, so the only way to extract the api.h header successfully is to first manually fix the incorrect function prototypes:</p>
+<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c">TF_Version() -&gt; TF_Version(<span class="dt">void</span>)
+TF_NewGraph() -&gt; TF_NewGraph(<span class="dt">void</span>)
+TF_NewSessionOptions() -&gt; TF_NewSessionOptions(<span class="dt">void</span>)
+TF_NewStatus() -&gt; TF_NewStatus(<span class="dt">void</span>)
+TF_NewBuffer() -&gt; TF_NewBuffer(<span class="dt">void</span>)
+TF_NewImportGraphDefOptions() -&gt; TF_NewImportGraphDefOptions(<span class="dt">void</span>)
+TF_GetAllOpList() -&gt; TF_GetAllOpList(<span class="dt">void</span>)</code></pre></div>
 <p>Once you've done this you can use the following jextract command from the libtensorflow root directory:</p>
-<div class="sourceCode" id="cb50"><pre class="sourceCode powershell"><code class="sourceCode powershell"><a class="sourceLine" id="cb50-1" data-line-number="1">jextract -L .\lib -l tensorflow -o tf.<span class="fu">jar</span> -t <span class="st">&quot;org.tensorflow.panama&quot;</span> --record-library-path .\include\tensorflow\c\c_api.<span class="fu">h</span></a></code></pre></div>
+<pre class="powershell"><code>jextract -L .\lib -l tensorflow -o tf.jar -t &quot;org.tensorflow.panama&quot; --record-library-path .\include\tensorflow\c\c_api.h</code></pre>
 <h3 id="java-sample-code-that-uses-tensorflow-library-1">Java sample code that uses tensorflow library</h3>
 <p>This is the same as for the Mac OS section.</p>
 <h3 id="compiling-and-running-the-above-tensorflow-sample-1">Compiling and running the above TensorFlow sample</h3>
-<div class="sourceCode" id="cb51"><pre class="sourceCode powershell"><code class="sourceCode powershell"><a class="sourceLine" id="cb51-1" data-line-number="1">javac -cp tf.<span class="fu">jar</span> TensorFlowExample.<span class="fu">java</span></a>
-<a class="sourceLine" id="cb51-2" data-line-number="2">java -cp <span class="st">&quot;tf.jar;.&quot;</span> TensorFlowExample</a></code></pre></div>
+<pre class="powershell"><code>javac -cp tf.jar TensorFlowExample.java
+java -cp &quot;tf.jar;.&quot; TensorFlowExample</code></pre>
 </body>
 </html>
--- a/doc/panama_foreign.md	Fri Apr 26 18:27:32 2019 +0530
+++ b/doc/panama_foreign.md	Fri Apr 26 13:38:23 2019 -0300
@@ -23,6 +23,81 @@
 
 Commands are tested in PowerShell.
 
+## Hello World
+
+### Hello World C Header (helloworld.h)
+
+```C
+
+#ifndef helloworld_h
+#define helloworld_h
+
+extern void helloworld(void);
+
+#endif /* helloworld_h */
+
+
+```
+
+### Hello World C Source (helloworld.c)
+
+```C
+
+#include <stdio.h>
+
+#include "helloworld.h"
+
+void helloworld(void) {
+    printf("Hello World!\n");
+}
+
+```
+
+### Building Hello World
+
+```
+
+cc -shared -o helloworld.dylib helloworld.c
+
+```
+
+
+### jextract a Jar file for helloworld.h
+
+```sh
+
+jextract -t org.hello -L . -lhelloworld --record-library-path helloworld.h -o helloworld.jar
+
+```
+
+### Java program that uses extracted helloworld interface
+
+```java
+
+import org.hello.helloworld_lib;
+
+import static org.hello.helloworld_lib.*;
+
+public class HelloWorld {
+    public static void main(String[] args) {
+        try (Scope s = helloworld_lib.scope().fork()) {
+            helloworld();
+        }
+    }
+}
+
+```
+
+### Running the Java code that invokes helloworld
+
+```sh
+
+javac -cp helloworld.jar HelloWorld.java
+
+java -cp helloworld.jar:. HelloWorld
+
+```
+
 ## Embedding Python interpreter in your Java program (Mac OS)
 
 ### jextract a Jar file for Python.h
@@ -239,7 +314,7 @@
                 System.err.println("SQL error: " + Pointer.toString(errMsg.get()));
                 sqlite3_free(errMsg.get());
             }
- 
+
             sqlite3_close(db.get());
         }
    }
@@ -731,7 +806,7 @@
 
 public class CurlMain {
    public static void main(String[] args) {
-       try (Scope s = curl_lib.scope().fork()) { 
+       try (Scope s = curl_lib.scope().fork()) {
            curl_global_init(CURL_GLOBAL_DEFAULT);
            Pointer<Void> curl = curl_easy_init();
            if(!curl.isNull()) {
@@ -1145,9 +1220,9 @@
 The problem outlined in the Mac OS instruction w.r.t. incorrect function prototypes still exists (though it has been solved in the Tensorflow github repository, this change has not yet made it into the binary distributions). On Windows there is however no jextract command that works around this, so the only way to extract the \include\tensorflow\c\c_api.h header successfully is to first manually fix the incorrect function prototypes:
 
 ```C
-TF_Version() -> TF_Version(void)  
-TF_NewGraph() -> TF_NewGraph(void)  
-TF_NewSessionOptions() -> TF_NewSessionOptions(void)  
+TF_Version() -> TF_Version(void)
+TF_NewGraph() -> TF_NewGraph(void)
+TF_NewSessionOptions() -> TF_NewSessionOptions(void)
 TF_NewStatus() -> TF_NewStatus(void)
 TF_NewBuffer() -> TF_NewBuffer(void)
 TF_NewImportGraphDefOptions() -> TF_NewImportGraphDefOptions(void)