Main > Free Download Search >

Free inserit 3.0.0.0 software for linux

inserit 3.0.0.0

Sponsored Links
Sponsored Links
Sort by >> Relevance
rss
Secleted [ 0 ] software to compare
Results 1 - 15 of about 2
libmiASMaELF 0.0.1

libmiASMaELF 0.0.1


libmiASMaELF is a library for generating relocatable object files that conform to the ELF format. more>>
libmiASMaELF is a library for generating relocatable object files that conform to the ELF format.

libmiASMaELF library has no complex class hierarchy, hence it is extremly easy to use, unlike most other libraries that accomplish the same task. Documentation and examples are provided to demonstrate the use of the library.

< b >How does one use the library?< /b >

/* hello.c */
#include < iostream >
#include < vector >
#include "libmiasmaelf.h"

int main(void )
{
char text[] = {
xB8, x04, x00, x00, x00, // mov eax, 4
xBB, x01, x00, x00, x00, // mov ebx, 1
xB9, x00, x00, x00, x00, // mov ecx, myvariable
xBA, x0E, x00, x00, x00, // mov edx, 14
xCD, x80, // int 0x80
xB8, x01, x00, x00, x00, // mov eax, 1
xCD, x80 // int 0x80
};

char data[] = {
x48, x65, x6C, x6C, x6F,
x2C, x20, x57, x6F, x72,
x6C, x64, x21, x0A
}; //Hello,World!

vector< char > vtext(&text[0], &text[29]);
vector< char > vdata(&data[0], &data[14]);
miasmaELF obj;

obj.InitializeELFHeader();
obj.InitializeSymbolTable();

obj.AddNewSection(".shstrtab",SHT_STRTAB, 0,0,0,0,0,0);
obj.AddNewSection(".text", SHT_PROGBITS,6,0,0,0,16,0);
obj.AddNewSection(".data", SHT_PROGBITS,3,0,0,0,16,0);
obj.AddNewSection(".symtab", SHT_SYMTAB, 0,0,
obj.GetSectionIndexOfType(SHT_STRTAB, ".strtab"),
0,
4,sizeof(Elf32_Sym));

obj.AddNewSection(".rel.text",SHT_REL,0,0,
obj.GetSectionIndexOfType(SHT_SYMTAB),
obj.GetSectionIndexOfType(SHT_PROGBITS, ".text"),
4,sizeof(Elf32_Rel));

obj.AddContents(vtext, obj.GetSectionIndexOfType(SHT_PROGBITS,".text"));
obj.AddContents(vdata, obj.GetSectionIndexOfType(SHT_PROGBITS,".data"));

obj.AddSymbol("_start",0,0, STB_WEAK, STT_FUNC,
obj.GetSectionIndexOfType(SHT_PROGBITS, ".text"));
obj.AddSymbol("myvariable",0,0, STB_GLOBAL, STT_OBJECT,
obj.GetSectionIndexOfType(SHT_PROGBITS, ".data"));

obj.AddRelocationEntry(11, obj.ReturnSymbolIndex("myvariable"),
R_386_RELATIVE,
obj.GetSectionIndexOfType(SHT_REL, ".rel.text"));

obj.PrepareFile();
obj.WriteFile("hello.o");
}

The library makes extensive use of vectors - a data structure that is a part of the Standard Template Library. We first create the machine language equivalents of every instruction and populate the vectors accordingly.

We then initialize the ELFHeader, the SymbolTable Initialization follows next. This is done after defining an object of type miasmaELF.

We then go on to initialize individual sections. The function

obj.GetSectionIndexOfType(SHT_PROGBITS, ".text")

is used when one wants to obtain the SectionIndex of a given section. We find this function helps greatly in linking the various structures that are described in elf.h. Here, it is used in building the section header of a particular section. It is imperative that the user of the library must have a general idea of the various structures that are involved.

We then invoke

obj.AddContents(vtext, obj.GetSectionIndexOfType(SHT_PROGBITS,".text"));

which add the contents to the text section. The 2nd argument to AddContents is the section that we are referring to. In this case it is the .text section, and from our example the Index=3.

We employ a similar technique to add Symbols and Relocation Entries. To finally write the file one must first must prepare it by invoking the function PrepareFile(...), and only then invoke WriteFile(FileName)

To compile hello.c one must link it with libmiasmaelf.o
<<less
Download (0.017MB)
Added: 2006-05-26 License: GPL (GNU General Public License) Price:
1248 downloads
Graph::Weighted 0.1301

Graph::Weighted 0.1301


Graph::Weighted is an abstract, weighted graph implementation. more>>
Graph::Weighted is an abstract, weighted graph implementation.

SYNOPSIS

use Graph::Weighted;

$g = Graph::Weighted->new(
data => [
[ 0, 1, 2, 0, 0 ], # A vertex with two edges.
[ 1, 0, 3, 0, 0 ], # "
[ 2, 3, 0, 0, 0 ], # "
[ 0, 0, 1, 0, 0 ], # A vertex with one edge.
[ 0, 0, 0, 0, 0 ] # A vertex with no edges.
]
);

$g = Graph::Weighted->new(
data => {
weight => {
a => { b => 1, c => 2 }, # A vertex with two edges.
b => { a => 1, c => 3 }, # "
c => { a => 2, b => 3 }, # "
d => { c => 1 }, # A vertex with one edge.
e => {} # A vertex with no edges.
}
foo => [
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
],
}
);

$g = Graph::Weighted->new(
data => $Math_Matrix_object,
retrieve_as => ARRAY,
);

$data = $g->weight_data;

$w = $g->graph_weight;

$w = $g->vertex_weight($v1);
$w = $g->vertex_weight($v1, $w + 1);

$w = $g->edge_weight($v1, $v2);
$w = $g->edge_weight($v1, $v2, $w + 1);

$vertices = $g->heaviest_vertices;
$vertices = $g->lightest_vertices;

$w = $g->max_weight; # Weight of the largest vertices.
$w = $g->min_weight; # Weight of the smallest vertices.

# Call the weight methods of the inherited Graph module.
$x = $g->MST_Kruskal;
$x = $g->APSP_Floyd_Warshall;
$x = $g->MST_Prim($p);

<<less
Download (0.011MB)
Added: 2007-08-07 License: Perl Artistic License Price:
812 downloads
Secleted [ 0 ] software to compare
  • Page: 1 of 1
  • 1