}
}
==[[D|D TODO]]==
[[Category:D]]
'''Compiler:''' [[DMD]],[[GDC]]
==[[Forth|Forth TODO]]==
[[Category:Forth]]
==[[Fortran|Fortran TODO]]==
[[Category:Fortran]]
==[[IDL]]==
;=> { 6 7}
==[[Java|Java TODO]]==
[[Category:Java]]
}
==[[JavaScript|JavaScript TODO]]==
[[Category:JavaScript]]
point.y = 2;
==[[JSON|JSON TODO]]==
[[Category:JSON]]
};
==[[Perl|Perl TODOPHP]]==
[[Category:Perl]]
'''Interpeter:''' [[Perl]]
# Please verify the code above... (from CPAN docs, not tested)
# Using Class::Struct
use Class::Struct;
struct Point => [ x => '$', y => '$' ];
my $point = new Point( x => 1, y => 2 );
# Using Inline::Struct with C code embedded
use Inline C;
my $point = new Inline::Struct::Point(1,2);
__C__
typedef struct Point
{
int x;
int y;
};
# Using Inline C, Struct
use Inline C => <<'END', ENABLE => 'STRUCTS';
struct Point {
int x;
int y;
};
END
my $point = Inline::Struct::Point->new(1,2);
print $point->x, $point->y, "\n";
# Using bytes packed data with pack/unpack
my $point = pack("ii", 1, 2);
my ($x, $y) = unpack("ii", $point);
# Using a hash for storage
my %point = ( x => 1, y => 2);
# Using Win32::API::Struct
use Win32::API;
Win32::API::Struct->typedef( 'Point', qw(
int x;
int y;
));
# Declarative
my $point = new Win32::API::Struct->new( 'Point' );
$point->{x} = 1;
$point->{y} = 2;
# Tie
tie %point, 'Win32::API::Struct', 'Point';
$point{x} = 1;
$point{y} = 2;
# Using C::DynaLib::Struct
use C::DynaLib::Struct;
Define C::DynaLib::Struct('Point', 'ii', [qw(x y)]);
# Using C::Include
use C::Include qw(point.h -cache);
my $point = $include->make_struct( 'Point' );
point.h:
#ifdef __PERL__
// Anything that should be parsed by C::Include only
#endif
typedef struct Point { int x; int y; } Point;
==[[PHP|PHP TODO]]==
[[Category:PHP]]
# => Point is {4,7}
==[[OCaml|OCaml TODO]]==
[[Category:OCaml]]
|