<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Parsing_from_data_in_memory</id>
		<title>Parsing from data in memory - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Parsing_from_data_in_memory"/>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Parsing_from_data_in_memory&amp;action=history"/>
		<updated>2026-05-02T12:43:07Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Parsing_from_data_in_memory&amp;diff=518&amp;oldid=prev</id>
		<title>Hoa: Created page with &quot;It is possible to use &quot;stream input&quot; to parse data in memory.  The example below is For Verilog input, but it can be adapted to use for VHLD input as well.  If you run this ap...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Parsing_from_data_in_memory&amp;diff=518&amp;oldid=prev"/>
				<updated>2020-06-01T21:12:59Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;It is possible to use &amp;quot;stream input&amp;quot; to parse data in memory.  The example below is For Verilog input, but it can be adapted to use for VHLD input as well.  If you run this ap...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;It is possible to use &amp;quot;stream input&amp;quot; to parse data in memory.&lt;br /&gt;
&lt;br /&gt;
The example below is For Verilog input, but it can be adapted to use for VHLD input as well.&lt;br /&gt;
&lt;br /&gt;
If you run this application with arguments pointing to a physical/existing file, it will parse that file.&lt;br /&gt;
If you do not pass any argument, it will produce error if &amp;quot;non-existing-file&amp;quot; does not exist.&lt;br /&gt;
And if you use &amp;quot;non-existing-file-1&amp;quot; or &amp;quot; non-existing-file-2&amp;quot; arguments, it will parse from memory/string.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
verific_stream *my_stream(const char *file_name)&lt;br /&gt;
{&lt;br /&gt;
    // Handle normal physical files using Verific, by default:&lt;br /&gt;
    if (!file_name || FileSystem::IsFile(file_name)) return 0 ;&lt;br /&gt;
&lt;br /&gt;
    std::string design_str ;&lt;br /&gt;
    // Handle known mnemonics here:&lt;br /&gt;
    if (Strings::compare(file_name, &amp;quot;non-existing-file-1&amp;quot;)) {&lt;br /&gt;
        // Use your own string in memory:&lt;br /&gt;
        design_str = &amp;quot;module test (input in, output out) ; assign out = ~in ; endmodule&amp;quot; ;&lt;br /&gt;
    } else if (Strings::compare(file_name, &amp;quot;non-existing-file-2&amp;quot;)) {&lt;br /&gt;
          // Use your own string in memory for some other condition:&lt;br /&gt;
        design_str = &amp;quot;module test (input in, output out) ; buf (out, in) ; endmodule&amp;quot; ;&lt;br /&gt;
    } else {&lt;br /&gt;
        // Let Verific produce error:&lt;br /&gt;
        return 0 ;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Create a stream for this one:&lt;br /&gt;
    std::istringstream *design_ist = new std::istringstream(design_str) ;&lt;br /&gt;
    return new verific_istream(design_ist) ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, const char **argv)&lt;br /&gt;
{&lt;br /&gt;
    veri_file::RegisterFlexStreamCallBack(my_stream) ;&lt;br /&gt;
&lt;br /&gt;
    const char *file = (argc &amp;gt; 1) ? argv[1] : &amp;quot;non-existing-file&amp;quot; ;&lt;br /&gt;
    if (!veri_file::Analyze(file)) return 1 ;&lt;br /&gt;
&lt;br /&gt;
    veri_file::PrettyPrint(&amp;quot;out.v&amp;quot;, 0) ;&lt;br /&gt;
&lt;br /&gt;
    return 0 ;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hoa</name></author>	</entry>

	</feed>