native compiler return value 128 .
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 4524
JavaNativeCompiler 1.1.1
JavaNativeCompiler (JNC) is a Java to native compiler. more>>
JavaNativeCompiler (JNC) is a Java to native compiler. The project allows AOT (ahead of time) compilation of your Java applications. With JNC, you can create real standalone native binaries (.exe on Windows) which will no longer depend on a JRE.
This is especially useful when applications have to be deployed to end-users. All vexatious problems of deploying Java applications can be solved by compiling them to native. They will be:
- Easy to deploy
No JRE dependency. Most end-users dont know what they have installed.
No more problems on how to create an executable file out of a JAR or class file.
- Hard to decompile
Java can easily be decompiled. Native compilation will protect your source code.
- Run fast from the start
No more overhead for loading a JRE.
Enhancements:
- This release fixes a couple of problems with AWT/Swing and XML.
- It also once again contains a version for Linux.
- The compiler binary downloads are smaller.
<<lessThis is especially useful when applications have to be deployed to end-users. All vexatious problems of deploying Java applications can be solved by compiling them to native. They will be:
- Easy to deploy
No JRE dependency. Most end-users dont know what they have installed.
No more problems on how to create an executable file out of a JAR or class file.
- Hard to decompile
Java can easily be decompiled. Native compilation will protect your source code.
- Run fast from the start
No more overhead for loading a JRE.
Enhancements:
- This release fixes a couple of problems with AWT/Swing and XML.
- It also once again contains a version for Linux.
- The compiler binary downloads are smaller.
Download (MB)
Added: 2007-03-05 License: Other/Proprietary License with Source Price:
965 downloads
cid-compiler 0.1
cid-compiler is a language tool to easily create C code with object oriented features. more>>
cid-compiler is a language tool to easily create C code with object oriented features. Its compiler generates header (.h) files and implementations (.c) from a specification file (.i).
The generated C code consists of a struct, a opaque pointer to it (in the header file) and rewritten functions. The defined functions will get prefixed with the class name, they will also get a new first argument that is a pointer to the newly defined struct.
Functions that do not have a return value are considered constructors and will not get a new 1st argument but will automatically get a return value of pointer to the struct. The place between @class "name" and @attributes is e. g. for include statements and will make it into the header file.
To ease renaming the class, you can use the define CLASS, which will always be a define to a pointer of the new struct type.
Interface example
@class cstring
#include < stdio.h >
#include < string.h >
@attributes
char *c;
@methods
new(char *n) {
CLASS i = NEWCLASS;
i->c = strdup(n);
return i;
}
int length() {
return strlen(this->c);
}
@end
will yield a cstring.h file:
#ifndef _CSTRING_H_
#define _CSTRING_H_
#include < stdio.h >
#include < string.h >
typedef struct cstring *cstring;
cstring cstring_new(char *n);
int cstring_length(cstring this);
#endif
and a cstring.c file:
#include "cstring.h"
#define CLASS cstring
#define NEWCLASS malloc(sizeof(struct cstring));
#define NEWCLASS_M malloc(sizeof(struct cstring));
#define NEWCLASS_C calloc(1,sizeof(struct cstring));
struct cstring {
char *c;
};
cstring cstring_new(char *n) {
CLASS i = NEWCLASS;
i->c = strdup(n);
return i;
}
int cstring_length(cstring this) {
return strlen(this->c);
}
Issues:
The current compiler (v0.1) will reject quite some valid C code. Also the given error is not very helpful;
<<lessThe generated C code consists of a struct, a opaque pointer to it (in the header file) and rewritten functions. The defined functions will get prefixed with the class name, they will also get a new first argument that is a pointer to the newly defined struct.
Functions that do not have a return value are considered constructors and will not get a new 1st argument but will automatically get a return value of pointer to the struct. The place between @class "name" and @attributes is e. g. for include statements and will make it into the header file.
To ease renaming the class, you can use the define CLASS, which will always be a define to a pointer of the new struct type.
Interface example
@class cstring
#include < stdio.h >
#include < string.h >
@attributes
char *c;
@methods
new(char *n) {
CLASS i = NEWCLASS;
i->c = strdup(n);
return i;
}
int length() {
return strlen(this->c);
}
@end
will yield a cstring.h file:
#ifndef _CSTRING_H_
#define _CSTRING_H_
#include < stdio.h >
#include < string.h >
typedef struct cstring *cstring;
cstring cstring_new(char *n);
int cstring_length(cstring this);
#endif
and a cstring.c file:
#include "cstring.h"
#define CLASS cstring
#define NEWCLASS malloc(sizeof(struct cstring));
#define NEWCLASS_M malloc(sizeof(struct cstring));
#define NEWCLASS_C calloc(1,sizeof(struct cstring));
struct cstring {
char *c;
};
cstring cstring_new(char *n) {
CLASS i = NEWCLASS;
i->c = strdup(n);
return i;
}
int cstring_length(cstring this) {
return strlen(this->c);
}
Issues:
The current compiler (v0.1) will reject quite some valid C code. Also the given error is not very helpful;
Download (0.098MB)
Added: 2006-03-07 License: BSD License Price:
1327 downloads
Tie::FileLRUCache 1.05
Tie::FileLRUCache is a lightweight but robust filesystem based persistent LRU cache. more>>
Tie::FileLRUCache is a lightweight but robust filesystem based persistent LRU cache.
SYNOPSIS
OBJECT INTERFACE
use Tie::FileLRUCache;
my $cache = Tie::FileLRUCache->new({ -cache_dir => $directory, -keep_last => 100 });
# Inserting value into LRU cache using -key
$cache->update({ -key => $key, -value => $value });
# Inserting value into LRU cache using -cache_key
my $cache_key = $cache->make_cache_key({ -key => $key });
$cache->update({ -cache_key => $cache_key, -value => $value });
# Checking LRU cache
my ($in_cache,$value) = $cache->check({ -key => $key });
if ($in_cache) {
return $value;
}
# Not in cache - do something else
# Checking LRU cache with speed up hack for objects, hashes, arrays etc used as keys
my $cache_key = $cache->make_cache_key({ -key => $something });
my ($in_cache,$value) = $cache->check({ -cache_key => $cache_key });
if ($in_cache) {
return $value;
}
# Not in cache - do something else
# Deleting a key and its value from the cache
$cache->delete({ -key => $key });
# Clearing LRU cache
$cache->clear;
TIED INTERFACE
use Tie::FileLRUCache;
[$X =] tie %hash, Tie::FileLRUCache, $cache_dir, $keep_last_n;
# Adding a key/value to the cache
$hash{$key} = $value;
# Checking the cache
if (not exists $hash{$key}) {;
# No match
.
.
.
} else {
my $value = $hash{$key};
.
.
.
}
# Removing a value from the cache;
delete $hash{$key};
# Clearing the cache
%hash = ();
Note: Iteration over the cache (each, keys, values) is _NOT_ supported.
<<lessSYNOPSIS
OBJECT INTERFACE
use Tie::FileLRUCache;
my $cache = Tie::FileLRUCache->new({ -cache_dir => $directory, -keep_last => 100 });
# Inserting value into LRU cache using -key
$cache->update({ -key => $key, -value => $value });
# Inserting value into LRU cache using -cache_key
my $cache_key = $cache->make_cache_key({ -key => $key });
$cache->update({ -cache_key => $cache_key, -value => $value });
# Checking LRU cache
my ($in_cache,$value) = $cache->check({ -key => $key });
if ($in_cache) {
return $value;
}
# Not in cache - do something else
# Checking LRU cache with speed up hack for objects, hashes, arrays etc used as keys
my $cache_key = $cache->make_cache_key({ -key => $something });
my ($in_cache,$value) = $cache->check({ -cache_key => $cache_key });
if ($in_cache) {
return $value;
}
# Not in cache - do something else
# Deleting a key and its value from the cache
$cache->delete({ -key => $key });
# Clearing LRU cache
$cache->clear;
TIED INTERFACE
use Tie::FileLRUCache;
[$X =] tie %hash, Tie::FileLRUCache, $cache_dir, $keep_last_n;
# Adding a key/value to the cache
$hash{$key} = $value;
# Checking the cache
if (not exists $hash{$key}) {;
# No match
.
.
.
} else {
my $value = $hash{$key};
.
.
.
}
# Removing a value from the cache;
delete $hash{$key};
# Clearing the cache
%hash = ();
Note: Iteration over the cache (each, keys, values) is _NOT_ supported.
Download (0.017MB)
Added: 2007-03-03 License: Perl Artistic License Price:
965 downloads
Steel Bank Common Lisp 1.0.8
Steel Bank Common Lisp is a common Lisp native compiler. more>>
Steel Bank Common Lisp is a development environment for Common Lisp, with excellent support for the ANSI standard: garbage collection, lexical closures, powerful macros, strong dynamic typing, incremental compilation, and the famous Common Lisp Object System (multimethods and all).
Steel Bank Common Lisp also includes many extensions, such as native threads, socket support, a statistical profiler, programmable streams, and more. These are all available through an integrated, interactive native compiler which feels like an interpreter.
SBCL is unique in being a multiplatform native compiler which bootstraps itself completely from source, using a C compiler and any other ANSI Common Lisp implementation.
Whats New in This Release:
* enhancement: experimental macro SB-EXT:COMPARE-AND-SWAP provides
atomic compare-and-swap operations on threaded platforms.
* enhancement: experimental function SB-EXT:RESTRICT-COMPILER-POLICY
allows assining a global minimum value to optimization qualities
(overriding proclamations and declarations).
* enhancement: closed over variables can be stack-allocated on x86
and x86-64.
* performance bug fix: GETHASH and (SETF GETHASH) are once again
non-consing.
* optimization: slot definition lookup is now O(1). This speeds up
eg. SLOT-VALUE and (SETF SLOT-VALUE) with variable slot names.
* optimization: STRING-TO-OCTETS is now up to 60% faster for UTF-8.
* optimization: ASSOC and MEMBER can now be open-coded for all
combinations of keyword arguments when second argument is constant
and SPEED >= SPACE. In other cases a specialized version is
selected.
* bug fix: using obsoleted structure instances with TYPEP and
generic functions now signals a sensible error.
* bug fix: threads waiting on GET-FOREGROUND can be interrupted.
(reported by Kristoffer Kvello)
* bug fix: backtrace construction is now more careful when making
lisp-objects from pointers on the stack, to avoid creating bogus
objects that can be seen by the GC.
* bug fix: defaulting of values in contexts expecting more than 7
variables now works on x86-64. (reported by Christopher Laux)
* bug fix: modifications to packages (INTERN, EXPORT, etc) are now
thread safe.
* bug fix: (SETF SYMBOL-PLIST) no longer allows assigning a non-list
as the property-list of a symbol.
* bug fix: DEFMETHOD forms with CALL-NEXT-METHOD in the method body,
in EVAL-WHEN forms with both :COMPILE-TOPLEVEL and :LOAD-TOPLEVEL
situations requested, are once again file-compileable. (reported
by Sascha Wilde)
<<lessSteel Bank Common Lisp also includes many extensions, such as native threads, socket support, a statistical profiler, programmable streams, and more. These are all available through an integrated, interactive native compiler which feels like an interpreter.
SBCL is unique in being a multiplatform native compiler which bootstraps itself completely from source, using a C compiler and any other ANSI Common Lisp implementation.
Whats New in This Release:
* enhancement: experimental macro SB-EXT:COMPARE-AND-SWAP provides
atomic compare-and-swap operations on threaded platforms.
* enhancement: experimental function SB-EXT:RESTRICT-COMPILER-POLICY
allows assining a global minimum value to optimization qualities
(overriding proclamations and declarations).
* enhancement: closed over variables can be stack-allocated on x86
and x86-64.
* performance bug fix: GETHASH and (SETF GETHASH) are once again
non-consing.
* optimization: slot definition lookup is now O(1). This speeds up
eg. SLOT-VALUE and (SETF SLOT-VALUE) with variable slot names.
* optimization: STRING-TO-OCTETS is now up to 60% faster for UTF-8.
* optimization: ASSOC and MEMBER can now be open-coded for all
combinations of keyword arguments when second argument is constant
and SPEED >= SPACE. In other cases a specialized version is
selected.
* bug fix: using obsoleted structure instances with TYPEP and
generic functions now signals a sensible error.
* bug fix: threads waiting on GET-FOREGROUND can be interrupted.
(reported by Kristoffer Kvello)
* bug fix: backtrace construction is now more careful when making
lisp-objects from pointers on the stack, to avoid creating bogus
objects that can be seen by the GC.
* bug fix: defaulting of values in contexts expecting more than 7
variables now works on x86-64. (reported by Christopher Laux)
* bug fix: modifications to packages (INTERN, EXPORT, etc) are now
thread safe.
* bug fix: (SETF SYMBOL-PLIST) no longer allows assigning a non-list
as the property-list of a symbol.
* bug fix: DEFMETHOD forms with CALL-NEXT-METHOD in the method body,
in EVAL-WHEN forms with both :COMPILE-TOPLEVEL and :LOAD-TOPLEVEL
situations requested, are once again file-compileable. (reported
by Sascha Wilde)
Download (2.7MB)
Added: 2007-07-25 License: BSD License Price:
822 downloads
Pod::Compiler 0.20
Pod::Compiler can compile POD into an object tree. more>>
Pod::Compiler can compile POD into an object tree.
This package, based on Pod::Parser, compiles a given POD document into an object tree (based on Tree::DAG_Node). It prints errors and warnings about the POD it reads. The result can be used to conveniently convert the POD into any other format.
The resulting objects have a variety of methods to ease the subsequent conversion.
There are two script based on this package, namely podchecker2, an enhanced POD syntax checker and podlint, which beautifies the POD of a given file.
This package is object-oriented, which means that you can quite easily build a derived package and override some methods in case the given behaviour does not exactly suit your needs.
Package Functions
The following functions can be imported and called from a script, e.g. like this:
use Pod::Compiler qw(pod_compile);
my $root = pod_compile(myfile.pod);
pod_compile( { %options } , $file )
pod_compile( $file )
Compile the given $file using some %options and return the root of the object tree representing the POD in $file. The return value is either undef if some fatal error occured or an object of type Pod::root. See below for methods applicable to this class and for the options.
The special option -compiler => class lets you specify an alternate (derived) compiler class rather than Pod::Compiler.
Compiler Object Interface
The following section describes the OO interface of Pod::Compiler.
$c = Pod::Compiler->new( %options )
Set up a new compiler object. Options (see below) can be passed as a hash, e.g.
$c = Pod::Compiler->new( -warnings => 0 ); # dont be silly
Pod::Compiler inherits from Pod::Parser. See Pod::Parser for additional methods.
$c->initialize()
Initalize, set defaults. The following options are set to the given defaults unless they have been defined at object creation:
-errors => 1
Print POD syntax errors (using messagehandler) if option value is true.
-warnings => 1
Print POD syntax warnings (using messagehandler) if option value is true.
-idlength => 20
Pod::Compiler creates a unique node id for each =head, =item and X, consisting only of w characters. The option value specifies how many characters from the original node text are used for the node id by the built-in make_unique_node_id method. See below for more information.
-ignore => BCFS
This option specifies which interior sequences (e.g. B< ... >) are ignored when nested in itself, e.g. B< ...B< ... >... >. The inner B is simply discarded if the corresponding letter appears in the option value string.
-unwrap => I
This option specifies which interior sequences (e.g. I< ... >) are unwrapped when nested in itself, e.g. I< ...I< ... >... > is turned into I< ... >...I< ... >. While some destination formats may handle such nestings appropriately, other might have problems. This option solves it right away. By the way, from a typographical point of view, italics are often used for emphasis. In order to emphasize something within an emphasis, one reverts to the non-italic font.
name =>
This is used to store the (logical) name of the POD, i.e. for example the module name as it appears in use module;. It is used internally only to detect internal links pointing to the explicit page name. Example: You compile the file Compiler.pm which contains the package Pod::Compiler. You set name to Pod::Compiler (there is no safe automatic way to do so). Thus if the file includes a link like L< Pod::Compiler/messagehandler > it is recognized as an internal link and it is checked whether it resolves. Of course you should have written the link as L< /messagehandler >...
-perlcode => 0
If set to true, the compiler will also return the Perl code blocks as objects Pod::perlcode, rather than only the POD embedded in the file. This is used e.g. by podlint.
$c->option( $name , $value )
Get or set the compile option (see above) given by $name. If $value is defined, the option is set to this value. The resulting (or unchanged) value is returned.
$c->messagehandler( $severity , $message )
This method is called every time a warning or error occurs. $severity is one of ERROR or WARNING, $message is a one-line string. The built-in method simply does
warn "$severity: $messagen";
$c->name( [ $name ] )
Set/retrieve the name property, i.e. the canonical Pod name (e.g. Pod::HTML). See above for more details.
$c->root()
Return the root element (instance of class Pod::root) representing the compiled POD document. See below for more info about its methods.
$c->make_unique_node_id($string)
Turn given text string into a document unique node id. Can be overridden to adapt this to specific formatter needs. Basically this method takes a string and must return something (more or less dependent on the string) that is unique for this POD document. The built-in method maps all consecutive non-word characters and underlines to a single underline and truncates the result to -idlength (see options above). If the result already exists, a suffix _n is appended, where n is a number starting with 1. A different method could e.g. just return ascending numbers, but if you think of HTML output, a node id that resembles the text and has a fair chance to remain constant over subsequent compiles of the same document gives the opportunity to link to such anchors from external documents.
<<lessThis package, based on Pod::Parser, compiles a given POD document into an object tree (based on Tree::DAG_Node). It prints errors and warnings about the POD it reads. The result can be used to conveniently convert the POD into any other format.
The resulting objects have a variety of methods to ease the subsequent conversion.
There are two script based on this package, namely podchecker2, an enhanced POD syntax checker and podlint, which beautifies the POD of a given file.
This package is object-oriented, which means that you can quite easily build a derived package and override some methods in case the given behaviour does not exactly suit your needs.
Package Functions
The following functions can be imported and called from a script, e.g. like this:
use Pod::Compiler qw(pod_compile);
my $root = pod_compile(myfile.pod);
pod_compile( { %options } , $file )
pod_compile( $file )
Compile the given $file using some %options and return the root of the object tree representing the POD in $file. The return value is either undef if some fatal error occured or an object of type Pod::root. See below for methods applicable to this class and for the options.
The special option -compiler => class lets you specify an alternate (derived) compiler class rather than Pod::Compiler.
Compiler Object Interface
The following section describes the OO interface of Pod::Compiler.
$c = Pod::Compiler->new( %options )
Set up a new compiler object. Options (see below) can be passed as a hash, e.g.
$c = Pod::Compiler->new( -warnings => 0 ); # dont be silly
Pod::Compiler inherits from Pod::Parser. See Pod::Parser for additional methods.
$c->initialize()
Initalize, set defaults. The following options are set to the given defaults unless they have been defined at object creation:
-errors => 1
Print POD syntax errors (using messagehandler) if option value is true.
-warnings => 1
Print POD syntax warnings (using messagehandler) if option value is true.
-idlength => 20
Pod::Compiler creates a unique node id for each =head, =item and X, consisting only of w characters. The option value specifies how many characters from the original node text are used for the node id by the built-in make_unique_node_id method. See below for more information.
-ignore => BCFS
This option specifies which interior sequences (e.g. B< ... >) are ignored when nested in itself, e.g. B< ...B< ... >... >. The inner B is simply discarded if the corresponding letter appears in the option value string.
-unwrap => I
This option specifies which interior sequences (e.g. I< ... >) are unwrapped when nested in itself, e.g. I< ...I< ... >... > is turned into I< ... >...I< ... >. While some destination formats may handle such nestings appropriately, other might have problems. This option solves it right away. By the way, from a typographical point of view, italics are often used for emphasis. In order to emphasize something within an emphasis, one reverts to the non-italic font.
name =>
This is used to store the (logical) name of the POD, i.e. for example the module name as it appears in use module;. It is used internally only to detect internal links pointing to the explicit page name. Example: You compile the file Compiler.pm which contains the package Pod::Compiler. You set name to Pod::Compiler (there is no safe automatic way to do so). Thus if the file includes a link like L< Pod::Compiler/messagehandler > it is recognized as an internal link and it is checked whether it resolves. Of course you should have written the link as L< /messagehandler >...
-perlcode => 0
If set to true, the compiler will also return the Perl code blocks as objects Pod::perlcode, rather than only the POD embedded in the file. This is used e.g. by podlint.
$c->option( $name , $value )
Get or set the compile option (see above) given by $name. If $value is defined, the option is set to this value. The resulting (or unchanged) value is returned.
$c->messagehandler( $severity , $message )
This method is called every time a warning or error occurs. $severity is one of ERROR or WARNING, $message is a one-line string. The built-in method simply does
warn "$severity: $messagen";
$c->name( [ $name ] )
Set/retrieve the name property, i.e. the canonical Pod name (e.g. Pod::HTML). See above for more details.
$c->root()
Return the root element (instance of class Pod::root) representing the compiled POD document. See below for more info about its methods.
$c->make_unique_node_id($string)
Turn given text string into a document unique node id. Can be overridden to adapt this to specific formatter needs. Basically this method takes a string and must return something (more or less dependent on the string) that is unique for this POD document. The built-in method maps all consecutive non-word characters and underlines to a single underline and truncates the result to -idlength (see options above). If the result already exists, a suffix _n is appended, where n is a number starting with 1. A different method could e.g. just return ascending numbers, but if you think of HTML output, a node id that resembles the text and has a fair chance to remain constant over subsequent compiles of the same document gives the opportunity to link to such anchors from external documents.
Download (0.030MB)
Added: 2007-08-10 License: Perl Artistic License Price:
805 downloads
Contextual::Return 0.1.0
Contextual::Return is a Perl module to create context-senstive return values. more>>
Contextual::Return is a Perl module to create context-senstive return values.
SYNOPSIS
use Contextual::Return;
use Carp;
sub foo {
return
SCALAR { thirty-twelve }
BOOL { 1 }
NUM { 7*6 }
STR { forty-two }
LIST { 1,2,3 }
HASHREF { {name => foo, value => 99} }
ARRAYREF { [3,2,1] }
GLOBREF { *STDOUT }
CODEREF { croak "Dont use this result as code!"; }
;
}
# and later...
if (my $foo = foo()) {
for my $count (1..$foo) {
print "$count: $foo is:n"
. " array: @{$foo}n"
. " hash: $foo->{name} => $foo->{value}n"
;
}
print {$foo} $foo->();
}
Usually, when you need to create a subroutine that returns different values in different contexts (list, scalar, or void), you write something like:
sub get_server_status {
my ($server_ID) = @_;
# Acquire server data somehow...
my %server_data = _ascertain_server_status($server_ID);
# Return different components of that data,
# depending on call context...
if (wantarray()) {
return @server_data{ qw(name uptime load users) };
}
if (defined wantarray()) {
return $server_data{load};
}
if (!defined wantarray()) {
carp Useless use of get_server_status() in void context;
return;
}
else {
croak q{Bad context! No biscuit!};
}
}
That works okay, but the code could certainly be more readable. In its simplest usage, this module makes that code more readable by providing three subroutines--LIST(), SCALAR(), VOID()--that are true only when the current subroutine is called in the corresponding context:
use Contextual::Return;
sub get_server_status {
my ($server_ID) = @_;
# Acquire server data somehow...
my %server_data = _ascertain_server_status($server_ID);
# Return different components of that data
# depending on call context...
if (LIST) { return @server_data{ qw(name uptime load users) } }
if (SCALAR) { return $server_data{load} }
if (VOID) { print "$server_data{load}n" }
else { croak q{Bad context! No biscuit!} }
}
Contextual returns
Those three subroutines can also be used in another way: as labels on a series of contextual return blocks (collectively known as a context sequence). When a context sequence is returned, it automatically selects the appropriate contextual return block for the calling context. So the previous example could be written even more cleanly as:
use Contextual::Return;
sub get_server_status {
my ($server_ID) = @_;
# Acquire server data somehow...
my %server_data = _ascertain_server_status($server_ID);
# Return different components of that data
# depending on call context...
return (
LIST { return @server_data{ qw(name uptime load users) } }
SCALAR { return $server_data{load} }
VOID { print "$server_data{load}n" }
DEFAULT { croak q{Bad context! No biscuit!} }
);
}
The context sequence automatically selects the appropriate block for each call context.
<<lessSYNOPSIS
use Contextual::Return;
use Carp;
sub foo {
return
SCALAR { thirty-twelve }
BOOL { 1 }
NUM { 7*6 }
STR { forty-two }
LIST { 1,2,3 }
HASHREF { {name => foo, value => 99} }
ARRAYREF { [3,2,1] }
GLOBREF { *STDOUT }
CODEREF { croak "Dont use this result as code!"; }
;
}
# and later...
if (my $foo = foo()) {
for my $count (1..$foo) {
print "$count: $foo is:n"
. " array: @{$foo}n"
. " hash: $foo->{name} => $foo->{value}n"
;
}
print {$foo} $foo->();
}
Usually, when you need to create a subroutine that returns different values in different contexts (list, scalar, or void), you write something like:
sub get_server_status {
my ($server_ID) = @_;
# Acquire server data somehow...
my %server_data = _ascertain_server_status($server_ID);
# Return different components of that data,
# depending on call context...
if (wantarray()) {
return @server_data{ qw(name uptime load users) };
}
if (defined wantarray()) {
return $server_data{load};
}
if (!defined wantarray()) {
carp Useless use of get_server_status() in void context;
return;
}
else {
croak q{Bad context! No biscuit!};
}
}
That works okay, but the code could certainly be more readable. In its simplest usage, this module makes that code more readable by providing three subroutines--LIST(), SCALAR(), VOID()--that are true only when the current subroutine is called in the corresponding context:
use Contextual::Return;
sub get_server_status {
my ($server_ID) = @_;
# Acquire server data somehow...
my %server_data = _ascertain_server_status($server_ID);
# Return different components of that data
# depending on call context...
if (LIST) { return @server_data{ qw(name uptime load users) } }
if (SCALAR) { return $server_data{load} }
if (VOID) { print "$server_data{load}n" }
else { croak q{Bad context! No biscuit!} }
}
Contextual returns
Those three subroutines can also be used in another way: as labels on a series of contextual return blocks (collectively known as a context sequence). When a context sequence is returned, it automatically selects the appropriate contextual return block for the calling context. So the previous example could be written even more cleanly as:
use Contextual::Return;
sub get_server_status {
my ($server_ID) = @_;
# Acquire server data somehow...
my %server_data = _ascertain_server_status($server_ID);
# Return different components of that data
# depending on call context...
return (
LIST { return @server_data{ qw(name uptime load users) } }
SCALAR { return $server_data{load} }
VOID { print "$server_data{load}n" }
DEFAULT { croak q{Bad context! No biscuit!} }
);
}
The context sequence automatically selects the appropriate block for each call context.
Download (0.022MB)
Added: 2007-01-18 License: Perl Artistic License Price:
1009 downloads
Scriptol to binary Compiler
Scriptol to binary Compiler is a C++ native compiler. more>>
Scriptol to binary Compiler is a C++ native compiler.
Installation:
It is better to install Scriptol at root of a disk, for example:
c:scriptolc
Once the archive is extracted into the scriptolc directory, you have just to change to this directory to run the compiler.
To use the compiler at command line from any directory, you have to put the compiler into the path variable.
The setup script installs required file into sub-directories, or into the directory given as argument. Before to use the compiler, you have to read the licence, in the doc
directory: licence.html.
Usage:
Just type:
./solc mysource
Type "solc" only to list the options.
If your program is a multi-file project, the source given as parameter must be the main source file, the compiler will know dependencies from "include" statements and will build what is needed.
Exemples:
Type from the main scriptol directory:
./solc -bre demosfibo
Configuring:
By editing the solc.ini file, you may change the second pass compiler (you may have to rebuild the libsol library for this compiler), change the options of the compiler or add header files to include.
To add header files, just add "header=someheader.hpp" lines into the config file.
A xxx.cfg file may be written for each project main source beeing xxx, and if present, it overloads the solc.ini file.
<<lessInstallation:
It is better to install Scriptol at root of a disk, for example:
c:scriptolc
Once the archive is extracted into the scriptolc directory, you have just to change to this directory to run the compiler.
To use the compiler at command line from any directory, you have to put the compiler into the path variable.
The setup script installs required file into sub-directories, or into the directory given as argument. Before to use the compiler, you have to read the licence, in the doc
directory: licence.html.
Usage:
Just type:
./solc mysource
Type "solc" only to list the options.
If your program is a multi-file project, the source given as parameter must be the main source file, the compiler will know dependencies from "include" statements and will build what is needed.
Exemples:
Type from the main scriptol directory:
./solc -bre demosfibo
Configuring:
By editing the solc.ini file, you may change the second pass compiler (you may have to rebuild the libsol library for this compiler), change the options of the compiler or add header files to include.
To add header files, just add "header=someheader.hpp" lines into the config file.
A xxx.cfg file may be written for each project main source beeing xxx, and if present, it overloads the solc.ini file.
Added: 2005-12-02 License: Freeware Price:
1423 downloads
The Glasgow Haskell Compiler 6.6
The Glasgow Haskell Compiler is a compiler for Haskell 98. more>>
The Glasgow Haskell Compiler is a state-of-the-art, open source, compiler and interactive environment for the functional language Haskell.
Main features:
- GHC supports the entire Haskell 98 language plus a wide variety of extensions.
- GHC works on several platforms including Windows and most varieties of Unix, and several different processor architectures. There are detailed instructions for porting GHC to a new platform.
- GHC has extensive optimisation capabilities, including inter-module optimisation.
- GHC compiles Haskell code either by using an intermediate C compiler (GCC), or by generating native code on some platforms. The interactive environment compiles Haskell to bytecode, and supports execution of mixed bytecode/compiled programs.
- Profiling is supported, both by time/allocation and various kinds of heap profiling.
- GHC comes with a wide range of libraries.
GHC is heavily dependent on its users and contributors. Please come and join the mailing lists and send us your comments, suggestions, bug reports and contributions!
Enhancements:
- SMP support and impredicative polymorphism were added.
- The libraries were split into core and extra.
- Many more changes were made.
<<lessMain features:
- GHC supports the entire Haskell 98 language plus a wide variety of extensions.
- GHC works on several platforms including Windows and most varieties of Unix, and several different processor architectures. There are detailed instructions for porting GHC to a new platform.
- GHC has extensive optimisation capabilities, including inter-module optimisation.
- GHC compiles Haskell code either by using an intermediate C compiler (GCC), or by generating native code on some platforms. The interactive environment compiles Haskell to bytecode, and supports execution of mixed bytecode/compiled programs.
- Profiling is supported, both by time/allocation and various kinds of heap profiling.
- GHC comes with a wide range of libraries.
GHC is heavily dependent on its users and contributors. Please come and join the mailing lists and send us your comments, suggestions, bug reports and contributions!
Enhancements:
- SMP support and impredicative polymorphism were added.
- The libraries were split into core and extra.
- Many more changes were made.
Download (6.7MB)
Added: 2006-10-15 License: BSD License Price:
1105 downloads
Sun::Solaris::Privilege 1.2
Sun::Solaris::Privilege is a Perl interface to Privileges. more>>
Sun::Solaris::Privilege is a Perl interface to Privileges.
SYNOPSIS
use Sun::Solaris::Privilege qw(:ALL);
This module provides wrappers for the Privilege-related system and library calls. Also provided are constants from the various Privilege-related headers and dynamically generated constants for all the privileges and privilege sets.
Functions
getppriv($which)
This function returns the process privilege set specified by $which.
setppriv($op, $which, $set)
This function modified the privilege set specified by $which in the as specified by the $op and $set arguments. If $op is PRIV_ON the privileges in $set are added to the set specified; if $op is PRIV_OFF, the privileges in $set are removed from the set specified; if $op is PRIV_SET, the specified set is made equal to $set.
getpflags($flag)
Returns the value associated with process $flag or undef on error. Possible values for $flag are PRIV_AWARE and PRIV_DEBUG.
setppflags($flag, $val)
Sets the process flag $flag to $val.
priv_fillset()
This returns a new privilege set with all privileges set.
priv_emptyset()
This returns a new empty privilege set.
priv_isemptyset($set)
This function returns whether $set is empty or not.
priv_isfullset($set)
This function returns whether $set is full or not.
priv_isequalset($a, $b)
This function returns whether sets $a and $b are equal.
priv_issubset($a, $b)
This function returns whether set $a is a subset of $b.
priv_ismember($set, $priv)
This function returns whether $priv is a member of $set.
priv_ineffect($priv)
This function returned whether $priv is in the process effective set.
priv_intersect($a, $b)
This function returns a new privilege set which is the intersection of $a and $b
priv_union($a, $b)
This function returns a new privilege set which is the union of $a and $b
priv_inverse($a)
This function returns a new privilege set which is the inverse of $a.
priv_addset($set, $priv)
This functon adds the privilege $priv to $set.
priv_copyset($a)
This function returns a copy of the privilege set $a.
priv_delset($set, $priv)
This function remove the privilege $priv from $set.
<<lessSYNOPSIS
use Sun::Solaris::Privilege qw(:ALL);
This module provides wrappers for the Privilege-related system and library calls. Also provided are constants from the various Privilege-related headers and dynamically generated constants for all the privileges and privilege sets.
Functions
getppriv($which)
This function returns the process privilege set specified by $which.
setppriv($op, $which, $set)
This function modified the privilege set specified by $which in the as specified by the $op and $set arguments. If $op is PRIV_ON the privileges in $set are added to the set specified; if $op is PRIV_OFF, the privileges in $set are removed from the set specified; if $op is PRIV_SET, the specified set is made equal to $set.
getpflags($flag)
Returns the value associated with process $flag or undef on error. Possible values for $flag are PRIV_AWARE and PRIV_DEBUG.
setppflags($flag, $val)
Sets the process flag $flag to $val.
priv_fillset()
This returns a new privilege set with all privileges set.
priv_emptyset()
This returns a new empty privilege set.
priv_isemptyset($set)
This function returns whether $set is empty or not.
priv_isfullset($set)
This function returns whether $set is full or not.
priv_isequalset($a, $b)
This function returns whether sets $a and $b are equal.
priv_issubset($a, $b)
This function returns whether set $a is a subset of $b.
priv_ismember($set, $priv)
This function returns whether $priv is a member of $set.
priv_ineffect($priv)
This function returned whether $priv is in the process effective set.
priv_intersect($a, $b)
This function returns a new privilege set which is the intersection of $a and $b
priv_union($a, $b)
This function returns a new privilege set which is the union of $a and $b
priv_inverse($a)
This function returns a new privilege set which is the inverse of $a.
priv_addset($set, $priv)
This functon adds the privilege $priv to $set.
priv_copyset($a)
This function returns a copy of the privilege set $a.
priv_delset($set, $priv)
This function remove the privilege $priv from $set.
Download (0.006MB)
Added: 2007-04-13 License: Perl Artistic License Price:
924 downloads
NullableTypes 1.2
NullableTypes for .NET are a very reliable and efficient version of built-in value-types that can be Null. more>>
NullableTypes for .NET are a very reliable and efficient version of built-in value-types that can be Null. NullableTypes pass more than 800 differents test cases and have close-to-optimal efficiency as built-in value-types. They may be used every time you need to store a Null value in a .NET built-in value-type.
Types implemented by NullableTypes are: NullableBoolean, NullableByte, NullableInt16, NullableInt32, NullableInt64, NullableSingle, NullableDouble, NullableDecimal, NullableString and NullableDateTime.
Helper functions provide seamless integration with Windows and ASP.NET user controls and with ADO.NET.
NullableTypes will let you write code like this:
public sealed class Order{
public int OrderID {get {/*...*/}}
public int CustomerID {get {/*...*/}}
public NullableDateTime RequestedDeliveryDate {get {/*...*/}}
// remaining members elided for clarity
}
where RequestedDeliveryDate can be either NullableDateTime.Null or a valid DateTime value.
The property RequestedDeliveryDate.IsNull tests if the date is Null, and when it is not Null the property RequestedDeliveryDate.Value returns a valid DateTime value.
<<lessTypes implemented by NullableTypes are: NullableBoolean, NullableByte, NullableInt16, NullableInt32, NullableInt64, NullableSingle, NullableDouble, NullableDecimal, NullableString and NullableDateTime.
Helper functions provide seamless integration with Windows and ASP.NET user controls and with ADO.NET.
NullableTypes will let you write code like this:
public sealed class Order{
public int OrderID {get {/*...*/}}
public int CustomerID {get {/*...*/}}
public NullableDateTime RequestedDeliveryDate {get {/*...*/}}
// remaining members elided for clarity
}
where RequestedDeliveryDate can be either NullableDateTime.Null or a valid DateTime value.
The property RequestedDeliveryDate.IsNull tests if the date is Null, and when it is not Null the property RequestedDeliveryDate.Value returns a valid DateTime value.
Download (0.76MB)
Added: 2006-09-06 License: MIT/X Consortium License Price:
1143 downloads
Math::BigInt::Calc 1.87
Math::BigInt::Calc is a pure Perl module to support Math::BigInt. more>>
Math::BigInt::Calc is a pure Perl module to support Math::BigInt.
SYNOPSIS
Provides support for big integer calculations. Not intended to be used by other modules. Other modules which sport the same functions can also be used to support Math::BigInt, like Math::BigInt::GMP or Math::BigInt::Pari.
In order to allow for multiple big integer libraries, Math::BigInt was rewritten to use library modules for core math routines. Any module which follows the same API as this can be used instead by using the following:
use Math::BigInt lib => libname;
libname is either the long name (Math::BigInt::Pari), or only the short version like Pari.
METHODS
The following functions MUST be defined in order to support the use by Math::BigInt v1.70 or later:
api_version() return API version, 1 for v1.70, 2 for v1.83
_new(string) return ref to new object from ref to decimal string
_zero() return a new object with value 0
_one() return a new object with value 1
_two() return a new object with value 2
_ten() return a new object with value 10
_str(obj) return ref to a string representing the object
_num(obj) returns a Perl integer/floating point number
NOTE: because of Perl numeric notation defaults,
the _numified obj may lose accuracy due to
machine-dependent floating point size limitations
_add(obj,obj) Simple addition of two objects
_mul(obj,obj) Multiplication of two objects
_div(obj,obj) Division of the 1st object by the 2nd
In list context, returns (result,remainder).
NOTE: this is integer math, so no
fractional part will be returned.
The second operand will be not be 0, so no need to
check for that.
_sub(obj,obj) Simple subtraction of 1 object from another
a third, optional parameter indicates that the params
are swapped. In this case, the first param needs to
be preserved, while you can destroy the second.
sub (x,y,1) => return x - y and keep x intact!
_dec(obj) decrement object by one (input is guaranteed to be > 0)
_inc(obj) increment object by one
_acmp(obj,obj) operator for objects (return -1, 0 or 1)
_len(obj) returns count of the decimal digits of the object
_digit(obj,n) returns the nth decimal digit of object
_is_one(obj) return true if argument is 1
_is_two(obj) return true if argument is 2
_is_ten(obj) return true if argument is 10
_is_zero(obj) return true if argument is 0
_is_even(obj) return true if argument is even (0,2,4,6..)
_is_odd(obj) return true if argument is odd (1,3,5,7..)
_copy return a ref to a true copy of the object
_check(obj) check whether internal representation is still intact
return 0 for ok, otherwise error message as string
_from_hex(str) return new object from a hexadecimal string
_from_bin(str) return new object from a binary string
_from_oct(str) return new object from an octal string
_as_hex(str) return string containing the value as
unsigned hex string, with the 0x prepended.
Leading zeros must be stripped.
_as_bin(str) Like as_hex, only as binary string containing only
zeros and ones. Leading zeros must be stripped and a
0b must be prepended.
_rsft(obj,N,B) shift object in base B by N digits right
_lsft(obj,N,B) shift object in base B by N digits left
_xor(obj1,obj2) XOR (bit-wise) object 1 with object 2
Note: XOR, AND and OR pad with zeros if size mismatches
_and(obj1,obj2) AND (bit-wise) object 1 with object 2
_or(obj1,obj2) OR (bit-wise) object 1 with object 2
_mod(obj1,obj2) Return remainder of div of the 1st by the 2nd object
_sqrt(obj) return the square root of object (truncated to int)
_root(obj) return the nth (n >= 3) root of obj (truncated to int)
_fac(obj) return factorial of object 1 (1*2*3*4..)
_pow(obj1,obj2) return object 1 to the power of object 2
return undef for NaN
_zeros(obj) return number of trailing decimal zeros
_modinv return inverse modulus
_modpow return modulus of power ($x ** $y) % $z
_log_int(X,N) calculate integer log() of X in base N
X >= 0, N >= 0 (return undef for NaN)
returns (RESULT, EXACT) where EXACT is:
1 : result is exactly RESULT
0 : result was truncated to RESULT
undef : unknown whether result is exactly RESULT
_gcd(obj,obj) return Greatest Common Divisor of two objects
The following functions are REQUIRED for an api_version of 2 or greater:
_1ex($x) create the number 1Ex where x >= 0
_alen(obj) returns approximate count of the decimal digits of the
object. This estimate MUST always be greater or equal
to what _len() returns.
_nok(n,k) calculate n over k (binomial coefficient)
The following functions are optional, and can be defined if the underlying lib has a fast way to do them. If undefined, Math::BigInt will use pure Perl (hence slow) fallback routines to emulate these:
_signed_or
_signed_and
_signed_xor
Input strings come in as unsigned but with prefix (i.e. as 123, 0xabc or 0b1101).
So the library needs only to deal with unsigned big integers. Testing of input parameter validity is done by the caller, so you need not worry about underflow (f.i. in _sub(), _dec()) nor about division by zero or similar cases.
The first parameter can be modified, that includes the possibility that you return a reference to a completely different object instead. Although keeping the reference and just changing its contents is preferred over creating and returning a different reference.
Return values are always references to objects, strings, or true/false for comparison routines.
<<lessSYNOPSIS
Provides support for big integer calculations. Not intended to be used by other modules. Other modules which sport the same functions can also be used to support Math::BigInt, like Math::BigInt::GMP or Math::BigInt::Pari.
In order to allow for multiple big integer libraries, Math::BigInt was rewritten to use library modules for core math routines. Any module which follows the same API as this can be used instead by using the following:
use Math::BigInt lib => libname;
libname is either the long name (Math::BigInt::Pari), or only the short version like Pari.
METHODS
The following functions MUST be defined in order to support the use by Math::BigInt v1.70 or later:
api_version() return API version, 1 for v1.70, 2 for v1.83
_new(string) return ref to new object from ref to decimal string
_zero() return a new object with value 0
_one() return a new object with value 1
_two() return a new object with value 2
_ten() return a new object with value 10
_str(obj) return ref to a string representing the object
_num(obj) returns a Perl integer/floating point number
NOTE: because of Perl numeric notation defaults,
the _numified obj may lose accuracy due to
machine-dependent floating point size limitations
_add(obj,obj) Simple addition of two objects
_mul(obj,obj) Multiplication of two objects
_div(obj,obj) Division of the 1st object by the 2nd
In list context, returns (result,remainder).
NOTE: this is integer math, so no
fractional part will be returned.
The second operand will be not be 0, so no need to
check for that.
_sub(obj,obj) Simple subtraction of 1 object from another
a third, optional parameter indicates that the params
are swapped. In this case, the first param needs to
be preserved, while you can destroy the second.
sub (x,y,1) => return x - y and keep x intact!
_dec(obj) decrement object by one (input is guaranteed to be > 0)
_inc(obj) increment object by one
_acmp(obj,obj) operator for objects (return -1, 0 or 1)
_len(obj) returns count of the decimal digits of the object
_digit(obj,n) returns the nth decimal digit of object
_is_one(obj) return true if argument is 1
_is_two(obj) return true if argument is 2
_is_ten(obj) return true if argument is 10
_is_zero(obj) return true if argument is 0
_is_even(obj) return true if argument is even (0,2,4,6..)
_is_odd(obj) return true if argument is odd (1,3,5,7..)
_copy return a ref to a true copy of the object
_check(obj) check whether internal representation is still intact
return 0 for ok, otherwise error message as string
_from_hex(str) return new object from a hexadecimal string
_from_bin(str) return new object from a binary string
_from_oct(str) return new object from an octal string
_as_hex(str) return string containing the value as
unsigned hex string, with the 0x prepended.
Leading zeros must be stripped.
_as_bin(str) Like as_hex, only as binary string containing only
zeros and ones. Leading zeros must be stripped and a
0b must be prepended.
_rsft(obj,N,B) shift object in base B by N digits right
_lsft(obj,N,B) shift object in base B by N digits left
_xor(obj1,obj2) XOR (bit-wise) object 1 with object 2
Note: XOR, AND and OR pad with zeros if size mismatches
_and(obj1,obj2) AND (bit-wise) object 1 with object 2
_or(obj1,obj2) OR (bit-wise) object 1 with object 2
_mod(obj1,obj2) Return remainder of div of the 1st by the 2nd object
_sqrt(obj) return the square root of object (truncated to int)
_root(obj) return the nth (n >= 3) root of obj (truncated to int)
_fac(obj) return factorial of object 1 (1*2*3*4..)
_pow(obj1,obj2) return object 1 to the power of object 2
return undef for NaN
_zeros(obj) return number of trailing decimal zeros
_modinv return inverse modulus
_modpow return modulus of power ($x ** $y) % $z
_log_int(X,N) calculate integer log() of X in base N
X >= 0, N >= 0 (return undef for NaN)
returns (RESULT, EXACT) where EXACT is:
1 : result is exactly RESULT
0 : result was truncated to RESULT
undef : unknown whether result is exactly RESULT
_gcd(obj,obj) return Greatest Common Divisor of two objects
The following functions are REQUIRED for an api_version of 2 or greater:
_1ex($x) create the number 1Ex where x >= 0
_alen(obj) returns approximate count of the decimal digits of the
object. This estimate MUST always be greater or equal
to what _len() returns.
_nok(n,k) calculate n over k (binomial coefficient)
The following functions are optional, and can be defined if the underlying lib has a fast way to do them. If undefined, Math::BigInt will use pure Perl (hence slow) fallback routines to emulate these:
_signed_or
_signed_and
_signed_xor
Input strings come in as unsigned but with prefix (i.e. as 123, 0xabc or 0b1101).
So the library needs only to deal with unsigned big integers. Testing of input parameter validity is done by the caller, so you need not worry about underflow (f.i. in _sub(), _dec()) nor about division by zero or similar cases.
The first parameter can be modified, that includes the possibility that you return a reference to a completely different object instead. Although keeping the reference and just changing its contents is preferred over creating and returning a different reference.
Return values are always references to objects, strings, or true/false for comparison routines.
Download (0.19MB)
Added: 2007-08-03 License: Perl Artistic License Price:
499 downloads
Oracle::Trace 1.06
Oracle::Trace is a Perl Module for parsing Oracle Trace files. more>>
Oracle::Trace is a Perl Module for parsing Oracle Trace files.
SYNOPSIS
use Oracle::Trace;
print Oracle::Trace->new($tracefilename)->parse->test_report;
Currently the parsing and statistics are very rudimentary, and in certain matters may be fundamentally flawed - you have been warned! Expect this to improve as further development takes place.
new
Create a new object for a given Orace Trace file.
my $o_trc = Oracle::Trace->new($tracefile);
init
Initialise the object (check the tracefile).
$o_trc->init.
opentracefile
Perform basic exists/read/etc. checks on given tracefile.
Returns object or undef.
$o_trc = $o_trc->checkfile($tfile);
header
Return the Header object.
my $o_hdr = $o_trc->header;
entries
Return Entry objects which comply with given regex criteria.
my @o_ents = $o_trc->entries(type=>EXEC #d+, key=>dep, value=>0);
oids
Return the unique object ids for the currently known Entryies
my @oids = $o_trc->oids;
footer
Return the Footer object
my $o_ftr = $o_trc->footer;
test_report
Return a simple test_report of the current object.
print $o_trc->test_report(string);
mini_report
Return a simple string of descending order timings for the statements retrieved from the given objects.
my $s_str = $o_trc->mini_report($i_max, @o_objs);
Note that we use microsecond resolution for Oracle 9i and above and centisecond resolution otherwise
<<lessSYNOPSIS
use Oracle::Trace;
print Oracle::Trace->new($tracefilename)->parse->test_report;
Currently the parsing and statistics are very rudimentary, and in certain matters may be fundamentally flawed - you have been warned! Expect this to improve as further development takes place.
new
Create a new object for a given Orace Trace file.
my $o_trc = Oracle::Trace->new($tracefile);
init
Initialise the object (check the tracefile).
$o_trc->init.
opentracefile
Perform basic exists/read/etc. checks on given tracefile.
Returns object or undef.
$o_trc = $o_trc->checkfile($tfile);
header
Return the Header object.
my $o_hdr = $o_trc->header;
entries
Return Entry objects which comply with given regex criteria.
my @o_ents = $o_trc->entries(type=>EXEC #d+, key=>dep, value=>0);
oids
Return the unique object ids for the currently known Entryies
my @oids = $o_trc->oids;
footer
Return the Footer object
my $o_ftr = $o_trc->footer;
test_report
Return a simple test_report of the current object.
print $o_trc->test_report(string);
mini_report
Return a simple string of descending order timings for the statements retrieved from the given objects.
my $s_str = $o_trc->mini_report($i_max, @o_objs);
Note that we use microsecond resolution for Oracle 9i and above and centisecond resolution otherwise
Download (0.011MB)
Added: 2007-04-25 License: Perl Artistic License Price:
551 downloads
Color::Object 0.1_02
Color::Object is a OO-Color Module. more>>
Color::Object is a OO-Color Module.
A module for manipulation Colors within RGB, HSV and HSL color-spaces for usage within PDF-Documents especially with the Text::PDF::API modules.
SYNOPSIS
use Color::Object;
$cl = Color::Object->new;
$cl = Color::Object->newRGB($r,$g,$b);
$cl = Color::Object->newHSV($h,$s,$v);
$cl = Color::Object->newHSL($h,$s,$l);
$cl->setRGB($r,$g,$b);
$cl->addBrightness($br);
($h,$s,$l) = $cl->asHSL;
METHODS
Color::Object->new
Color::Object->newRGB $r, $g, $b
Color::Object->newHSV $h, $s, $v
Color::Object->newHSL $h, $s, $l
Color::Object->newGrey $grey
( $r, $g, $b ) = $cl->asRGB
Returns $cls rgb values. Range [0 .. 1].
( $h, $s, $v ) = $cl->asHSV
Returns $cls hsv values. Ranges h [0 .. 360], s/v [0 .. 1].
( $h, $s, $l ) = $cl->asHSL
Returns $cls hsl values. Ranges h [0 .. 360], s/l [0 .. 1].
$grey = $cl->asGrey
$grey = $cl->asGrey2
Returns $cls grey value. Range [0 .. 1]. Functions 2 returns the geometric mean of the corresponding RGB values.
( $c, $m, $y )= $cl->asCMY
Returns $cls cmy values. Range [0 .. 1].
( $c, $m, $y, $k )= $cl->asCMYK
( $c, $m, $y, $k )= $cl->asCMYK2
( $c, $m, $y, $k )= $cl->asCMYK3
Returns $cls cmyk values. Range [0 .. 1]. Function 2 returns a 25% lighter color-equivalent. Function 3 returns a 25% lighter color-equivalent.
$hex = $cl->asHex
Returns $cls rgb values as 6 hex-digits.
$cl->setRGB $r, $g, $b
Sets the $cls rgb values. Valid range [0 .. 1].
$cl->setHSV $h, $s, $v
Sets the $cls hsv values. Valid ranges: h [0..360], s/v [0..1].
$cl->setHSL $h, $s, $l
Sets the $cls hsl values. Valid ranges: h [0..360], s/l [0..1].
$cl->setGrey $grey
Sets the $cls grey value. Valid range [0 .. 1].
$cl->setHex $hex
Sets the $cls rgb values using 6 hex-nibbles.
$cl->addSaturation $saturation
Adds to the $cls saturation in the HSV model. Valid range [-1 .. 1].
$cl->setSaturation $saturation
Sets the $cls saturation in the HSV model. Valid range [0 .. 1].
$cl->rotHue $degrees
Rotates the $cls hue in the HSV/L model. Valid range [-360 .. 360].
$cl->setHue $hue
Sets the $cls hue in the HSV/L model. Valid range [0 .. 360].
$cl->addBrightness $brightness
Adds to the $cls brightness in the HSV model. Valid range [-1 .. 1].
$cl->setBrightness $brightness
Sets the $cls brightness in the HSV model. Valid range [0 .. 1].
$cl->addLightness $lightness
Adds to the $cls lightness in the HSL model. Valid range [-1 .. 1].
$cl->setLightness $lightness
Sets the $cls lightness in the HSL model. Valid range [0 .. 1].
<<lessA module for manipulation Colors within RGB, HSV and HSL color-spaces for usage within PDF-Documents especially with the Text::PDF::API modules.
SYNOPSIS
use Color::Object;
$cl = Color::Object->new;
$cl = Color::Object->newRGB($r,$g,$b);
$cl = Color::Object->newHSV($h,$s,$v);
$cl = Color::Object->newHSL($h,$s,$l);
$cl->setRGB($r,$g,$b);
$cl->addBrightness($br);
($h,$s,$l) = $cl->asHSL;
METHODS
Color::Object->new
Color::Object->newRGB $r, $g, $b
Color::Object->newHSV $h, $s, $v
Color::Object->newHSL $h, $s, $l
Color::Object->newGrey $grey
( $r, $g, $b ) = $cl->asRGB
Returns $cls rgb values. Range [0 .. 1].
( $h, $s, $v ) = $cl->asHSV
Returns $cls hsv values. Ranges h [0 .. 360], s/v [0 .. 1].
( $h, $s, $l ) = $cl->asHSL
Returns $cls hsl values. Ranges h [0 .. 360], s/l [0 .. 1].
$grey = $cl->asGrey
$grey = $cl->asGrey2
Returns $cls grey value. Range [0 .. 1]. Functions 2 returns the geometric mean of the corresponding RGB values.
( $c, $m, $y )= $cl->asCMY
Returns $cls cmy values. Range [0 .. 1].
( $c, $m, $y, $k )= $cl->asCMYK
( $c, $m, $y, $k )= $cl->asCMYK2
( $c, $m, $y, $k )= $cl->asCMYK3
Returns $cls cmyk values. Range [0 .. 1]. Function 2 returns a 25% lighter color-equivalent. Function 3 returns a 25% lighter color-equivalent.
$hex = $cl->asHex
Returns $cls rgb values as 6 hex-digits.
$cl->setRGB $r, $g, $b
Sets the $cls rgb values. Valid range [0 .. 1].
$cl->setHSV $h, $s, $v
Sets the $cls hsv values. Valid ranges: h [0..360], s/v [0..1].
$cl->setHSL $h, $s, $l
Sets the $cls hsl values. Valid ranges: h [0..360], s/l [0..1].
$cl->setGrey $grey
Sets the $cls grey value. Valid range [0 .. 1].
$cl->setHex $hex
Sets the $cls rgb values using 6 hex-nibbles.
$cl->addSaturation $saturation
Adds to the $cls saturation in the HSV model. Valid range [-1 .. 1].
$cl->setSaturation $saturation
Sets the $cls saturation in the HSV model. Valid range [0 .. 1].
$cl->rotHue $degrees
Rotates the $cls hue in the HSV/L model. Valid range [-360 .. 360].
$cl->setHue $hue
Sets the $cls hue in the HSV/L model. Valid range [0 .. 360].
$cl->addBrightness $brightness
Adds to the $cls brightness in the HSV model. Valid range [-1 .. 1].
$cl->setBrightness $brightness
Sets the $cls brightness in the HSV model. Valid range [0 .. 1].
$cl->addLightness $lightness
Adds to the $cls lightness in the HSL model. Valid range [-1 .. 1].
$cl->setLightness $lightness
Sets the $cls lightness in the HSL model. Valid range [0 .. 1].
Download (0.003MB)
Added: 2007-07-31 License: Perl Artistic License Price:
815 downloads
MySQL Global User Variables UDF 1.0
MySQL Global User Variables UDF is a MySQL extension to store persistent variables. more>>
MySQL Global User Variables UDF is a MySQL extension to store persistent variables.
This shared library adds simple user functions to MySQL in order to keep persistent shared variables in memory. These variables and their values are available to all clients. Any data can be stored into these persistent variables, including BLOBs. Since updates are atomic and way faster than MEMORY tables, this is an easy and efficient way to handle counters and sequences.
Usage:
Storing a value
An unlimited number of user variables can be created, as long as memory is available.
The GLOBAL_STORE(, ) stores a new shared global variable.
Examples:
mysql> DO GLOBAL_STORE("online_users", 42);
mysql> DO GLOBAL_STORE("secret_key", "pajfUyfnd");
The GLOBAL_STORE() function always returns 1 unless an error occurred.
Fetching a value
Reading the value of a variable is the job of the GLOBAL_GET() function.
The value is returned, or NULL is the variable is undefined.
Example:
mysql> SELECT GLOBAL_GET("online_users;);
42
mysql> SELECT id FROM pxs WHERE secret_key = GLOBAL_GET("secret_key");
1
Atomic increments
A single function call can read the previous value, add an integer (that can be negative), and store the new value into the variable.
The function is GLOBAL_ADD(, ) and the return value is the new value of the variable.
Updates are always atomic, if the old value is 18 and you add 1, you will always get back 19.
Example:
mysql> DO GLOBAL_ADD("online_users", 1);
mysql> SELECT GLOBAL_ADD("online_users", -4);
39
If the value of a variable was a string, the new value is the increment:
mysql> SELECT GLOBAL_ADD("secret_key", 12);
12
Adding a value to an undefined variable returns NULL.
A handy variant is GLOBAL_ADDP(, ). GLOBAL_ADDP() is similar to GLOBAL_ADD() but returns the PREVIOUS value of the variable instead of the new one.
Example:
mysql> DO GLOBAL_SET("xxx", 10);
mysql> SELECT GLOBAL_ADDP("xxx", 1);
10
mysql> SELECT GLOBAL_ADDP("xxx", 1);
11
Installation:
On most systems, compiling and installing the library should be as simple as typing (as root):
make install
The shared library is installed as /usr/local/lib/udf_global_user_variables.so
If the base directory of your MySQL installation is not in /usr/local, just type:
make
and then copy udf_global_user_variables.so to the right location for UDFs on your system (maybe /usr/lib/).
The name of a variable is limited to 256 bytes. If that limit is too low for your specific application, just edit the MAX_NAME_LENGTH variable on top of the .c file and reinstall. Variable names can contain binary characters.
Values are limited to 65536 bytes. If that limit is too low for you, edit the MAX_VALUE_LENGTH variable and reinstall.
<<lessThis shared library adds simple user functions to MySQL in order to keep persistent shared variables in memory. These variables and their values are available to all clients. Any data can be stored into these persistent variables, including BLOBs. Since updates are atomic and way faster than MEMORY tables, this is an easy and efficient way to handle counters and sequences.
Usage:
Storing a value
An unlimited number of user variables can be created, as long as memory is available.
The GLOBAL_STORE(, ) stores a new shared global variable.
Examples:
mysql> DO GLOBAL_STORE("online_users", 42);
mysql> DO GLOBAL_STORE("secret_key", "pajfUyfnd");
The GLOBAL_STORE() function always returns 1 unless an error occurred.
Fetching a value
Reading the value of a variable is the job of the GLOBAL_GET() function.
The value is returned, or NULL is the variable is undefined.
Example:
mysql> SELECT GLOBAL_GET("online_users;);
42
mysql> SELECT id FROM pxs WHERE secret_key = GLOBAL_GET("secret_key");
1
Atomic increments
A single function call can read the previous value, add an integer (that can be negative), and store the new value into the variable.
The function is GLOBAL_ADD(, ) and the return value is the new value of the variable.
Updates are always atomic, if the old value is 18 and you add 1, you will always get back 19.
Example:
mysql> DO GLOBAL_ADD("online_users", 1);
mysql> SELECT GLOBAL_ADD("online_users", -4);
39
If the value of a variable was a string, the new value is the increment:
mysql> SELECT GLOBAL_ADD("secret_key", 12);
12
Adding a value to an undefined variable returns NULL.
A handy variant is GLOBAL_ADDP(, ). GLOBAL_ADDP() is similar to GLOBAL_ADD() but returns the PREVIOUS value of the variable instead of the new one.
Example:
mysql> DO GLOBAL_SET("xxx", 10);
mysql> SELECT GLOBAL_ADDP("xxx", 1);
10
mysql> SELECT GLOBAL_ADDP("xxx", 1);
11
Installation:
On most systems, compiling and installing the library should be as simple as typing (as root):
make install
The shared library is installed as /usr/local/lib/udf_global_user_variables.so
If the base directory of your MySQL installation is not in /usr/local, just type:
make
and then copy udf_global_user_variables.so to the right location for UDFs on your system (maybe /usr/lib/).
The name of a variable is limited to 256 bytes. If that limit is too low for your specific application, just edit the MAX_NAME_LENGTH variable on top of the .c file and reinstall. Variable names can contain binary characters.
Values are limited to 65536 bytes. If that limit is too low for you, edit the MAX_VALUE_LENGTH variable and reinstall.
Download (0.004MB)
Added: 2007-03-19 License: GPL (GNU General Public License) Price:
951 downloads
Tree::BPTree 1.07
Tree::BPTree is a Perl implementation of B+ trees. more>>
Tree::BPTree is a Perl implementation of B+ trees.
SYNOPSIS
use Tree::BPTree;
# These arguments are actually the defaults
my $tree = new Tree::BPTree(
-n => 3,
-unique => 0,
-keycmp => sub { $_[0] cmp $_[1] },
-valuecmp => sub { $_[0] $_[1] },
);
# index the entries in this string:
my $string = "THERES MORE THAN ONE WAY TO DO IT"; # TMTOWTDI
my $i = 0;
$tree->insert($_, $i++) foreach (split //, $string);
# find the index of the first T
my $t = $tree->find(T);
# find the indexes of every T
my @t = $tree->find(T);
# We dont like the word WAY , so lets remove it
my $i = index $string, W;
$tree->delete($_, $i++) foreach (split //, substr($string, $i, 4));
# Reverse the sort order
$tree->reverse;
# Iterate through each key/value pair just like built-in each operator
while (my ($key, $value) = $tree->each) {
print "$key => $valuen";
}
# Reset the iterator when we quit from an "each-loop" early
$tree->reset;
# You might also be interested in using multiple each loops at once, which is
# possible through the cursor syntax. You can even delete individual pairs
# from the list during iteration.
my $cursor = $tree->new_cursor;
while (my ($key, $value) = $cursor->each) {
my $nested = $tree->new_cursor;
while (my ($nkey, $nvalue) = $nested->each) {
if ($key->shouldnt_be_in_this_tree_with($nkey)) {
$nested->delete;
}
}
}
# Iterate using an iterator subroutine
$tree->iterate(sub { print "$_[0] => $_[1]n" });
# Iterate using an iterator subroutine that returns the list of return values
# returned by the iterator
print join(, , $tree->map(sub { "$_[0] => $_[1]" })),"n";
# Grep-like operations
my @pairs = $tree->grep (sub { $_[0] =~ /S/ });
my @keys = $tree->grep_keys (sub { $_[0] =~ /S/ });
my @values = $tree->grep_values (sub { $_[0] =~ /S/ });
# Get all keys, values
my @all_keys = $tree->keys;
my @all_values = $tree->values;
# Clear it out and start over
$tree->clear;
B+ trees are balanced trees which provide an ordered map from keys to values. They are useful for indexing large bodies of data. They are similar to 2-3-4 Trees and Red-Black Trees. This implementation supports B+ trees using an arbitrary n value.
<<lessSYNOPSIS
use Tree::BPTree;
# These arguments are actually the defaults
my $tree = new Tree::BPTree(
-n => 3,
-unique => 0,
-keycmp => sub { $_[0] cmp $_[1] },
-valuecmp => sub { $_[0] $_[1] },
);
# index the entries in this string:
my $string = "THERES MORE THAN ONE WAY TO DO IT"; # TMTOWTDI
my $i = 0;
$tree->insert($_, $i++) foreach (split //, $string);
# find the index of the first T
my $t = $tree->find(T);
# find the indexes of every T
my @t = $tree->find(T);
# We dont like the word WAY , so lets remove it
my $i = index $string, W;
$tree->delete($_, $i++) foreach (split //, substr($string, $i, 4));
# Reverse the sort order
$tree->reverse;
# Iterate through each key/value pair just like built-in each operator
while (my ($key, $value) = $tree->each) {
print "$key => $valuen";
}
# Reset the iterator when we quit from an "each-loop" early
$tree->reset;
# You might also be interested in using multiple each loops at once, which is
# possible through the cursor syntax. You can even delete individual pairs
# from the list during iteration.
my $cursor = $tree->new_cursor;
while (my ($key, $value) = $cursor->each) {
my $nested = $tree->new_cursor;
while (my ($nkey, $nvalue) = $nested->each) {
if ($key->shouldnt_be_in_this_tree_with($nkey)) {
$nested->delete;
}
}
}
# Iterate using an iterator subroutine
$tree->iterate(sub { print "$_[0] => $_[1]n" });
# Iterate using an iterator subroutine that returns the list of return values
# returned by the iterator
print join(, , $tree->map(sub { "$_[0] => $_[1]" })),"n";
# Grep-like operations
my @pairs = $tree->grep (sub { $_[0] =~ /S/ });
my @keys = $tree->grep_keys (sub { $_[0] =~ /S/ });
my @values = $tree->grep_values (sub { $_[0] =~ /S/ });
# Get all keys, values
my @all_keys = $tree->keys;
my @all_values = $tree->values;
# Clear it out and start over
$tree->clear;
B+ trees are balanced trees which provide an ordered map from keys to values. They are useful for indexing large bodies of data. They are similar to 2-3-4 Trees and Red-Black Trees. This implementation supports B+ trees using an arbitrary n value.
Download (0.017MB)
Added: 2006-07-04 License: Perl Artistic License Price:
1208 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above native compiler return value 128 . search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed