Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

brc

 

Including binary data into application

 

 

simplebin.cpp

 

#include <Core/Core.h>

 

#include "simplebin.brc"

 

CONSOLE_APP_MAIN

{

    puts(NFormat("source (%d) = %s...%s", source_length, String(source, 20), String(source + source_length - 20, 20)));

    puts(NFormat("binsrc (%d) = %s...%s", binsrc_length, String(binsrc, 20), String(binsrc + binsrc_length - 20, 20)));

    puts(NFormat("array_count = %d", array_count));

    for(int i = 0; i < array_count; i++)

        puts(NFormat("array[%d] (%d) = %s...%s", i, array_length[i], String(array[i], 20), String(array[i] + array_length[i] - 20, 20)));

}

 

 

 

bin.cpp

 

#include <Core/Core.h>

#include "bin.brc"

#include <plugin/bz2/bz2.h>

 

using namespace Upp;

 

//**

 

CONSOLE_APP_MAIN

{

    puts(String().Cat() << "brc length: " << bin_brc_length);

    fflush(stdout);

    puts(String().Cat() << "cpp length: " << bin_cpp_length);

    fflush(stdout);

    puts(String().Cat() << "all count:  " << bin_all_count);

    fflush(stdout);

//    puts(String().Cat() << "cpp: <<<\n" << (const char *)bin_cpp << "\n>>>");

    MemReadStream in1(bin_cpp, bin_cpp_length);

    puts(String().Cat() << "cpp: <<<\n" << BZ2Decompress(in1) << "\n>>>");

    fflush(stdout);

//    puts(String().Cat() << "brc: <<<\n" << (const char *)bin_brc << "\n>>>");

    MemReadStream in2(bin_brc, bin_brc_length);

    puts(String().Cat() << "brc: <<<\n" << BZ2Decompress(in2) << "\n>>>");

    fflush(stdout);

    for(int i = 0; i < bin_all_count; i++) {

        puts(String().Cat() << "all length[" << i << "]: " << bin_all_length[i]);

        fflush(stdout);

        puts(String().Cat() << "all files[" << i << "]: " << bin_all_files[i]);

        fflush(stdout);

        MemReadStream in3(bin_all[i], bin_all_length[i]);

        puts(String().Cat() << "all[" << i << "]: <<<\n" << BZ2Decompress(in3) << "\n>>>");

        fflush(stdout);

    }

}

 

 

 

ship.usc

 

macro "Ship" Ctrl+Shift+W {

    ClearConsole();

    cout("Building BRC...");

    if(!Build(""))

        cout("Error building BRC.");

    else {

        cout("Shipping BRC...");

        if(!BuildProject("BRC/ship", ""))

            cout("Error shipping BRC.");

        else

            cout("Build finished successfully.");

    }

}

 

 

 

simplebin.brc

 

BINARY(source, "simplebin.cpp")

BINARY(binsrc, "simplebin.brc")

BINARY_ARRAY(array, 0, "simplebin.cpp")

BINARY_ARRAY(array, 1, "simplebin.brc")

BINARY_ARRAY(array, 2, "simplebin.upp")

 

 

 

bin.brc

 

BINARY(bin_cpp, "bin.cpp" BZ2)

BINARY(bin_brc, "bin.brc" BZ2)

BINARY_MASK(bin_all, "bin.*" BZ2)

 

 

 

 

Do you want to contribute?