C Headers


 
Thread Tools Search this Thread
Top Forums Programming C Headers
# 1  
Old 01-22-2006
Question C Headers

Where can i get C/C++ headers for OS MINIX 2.0.3?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Email Headers

I'm trying to pick up some Unix SysAdmin skills on my own outside of work through the use of the "Unix and Linux System Administrators Handbook." I've found the exercises to be very beneficial, until I came to this.... "What path did the email take? To Whom was it addressed, and to whom was it... (0 Replies)
Discussion started by: ksmarine1980
0 Replies

2. UNIX for Dummies Questions & Answers

Modifying headers

I have a FASTA file with thousands of sequences that looks something like this: I need to modfy the header in such way that everything after the dot is remove. Thus, I will end up with something like this: Thanks (1 Reply)
Discussion started by: Xterra
1 Replies

3. Shell Programming and Scripting

editing headers

Hi, I have a folder that contains many (multiple) files 1.fasta 2.fasta 3.fasta 4.fasta 5.fasta . . 100's of files Each such file have data in the following format for example: vi 1.fasta 58 390 A GTATACATTATTGATGAAGTCCACATGCTTTCTATGGGTGCCTTCAATGCGCTTTTAAAA (7 Replies)
Discussion started by: Lucky Ali
7 Replies

4. Shell Programming and Scripting

Editing headers

Hi, I have a folder that contains many (multiple) files 1.fasta 2.fasta 3.fasta 4.fasta 5.fasta . . 100's of files Each such file have data in the following format for example: vi 1.fasta >AB_1 200bp MLKKPIIIGVTGGSGGGKTSVSRAILDSFPNARIAMIQHDSYYKDQSHMSFEERVKTNYDHPLAFDTDFM... (4 Replies)
Discussion started by: Lucky Ali
4 Replies

5. Programming

c - problem with headers?

I have a simple program to create a poker deck, shuffle it and deal cards. Here it is: #include <stdio.h> #include <stdlib.h> #include <time.h> struct Card { char *face, *suit; }; void fillDeck (Card *deck, char *face, char *suit); void shuffle (Card *deck); void... (4 Replies)
Discussion started by: Luke Bonham
4 Replies

6. UNIX for Dummies Questions & Answers

Grep Headers

Hi! Trying to find string and then put the above Headers of corresponding fist line. After executing a Property command a get this output: SP/CH-CH Span Name Type TG Idle InUse OffHk OnHk Ring -------- ------------------------------ ------ ---- ----- ----- ----- 02/01-24 CARRIERSS7... (6 Replies)
Discussion started by: Joel_john
6 Replies

7. Shell Programming and Scripting

Merging of files with different headers to make combined headers file

Hi , I have a typical situation. I have 4 files and with different headers (number of headers is varible ). I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only). For example - File 1 H1|H2|H3|H4 11|12|13|14 21|22|23|23... (1 Reply)
Discussion started by: marut_ashu
1 Replies

8. Shell Programming and Scripting

Remove text between headers while leaving headers intact

Hi, I'm trying to strip all lines between two headers in a file: ### BEGIN ### Text to remove, contains all kinds of characters ... Antispyware-Downloadserver.com (Germany)=http://www.antispyware-downloadserver.c om/updates/ Antispyware-Downloadserver.com #2... (3 Replies)
Discussion started by: Trones
3 Replies

9. Programming

headers of the query

when we are spooling query o/p to certain txt file,in that file how we can get headers in the query.(through unix shell scripting). for exmple q1="slect * from XXXXXX;"; sqlplus XXX/XXXX@XXXXX spool XXXX.txt $q1 spool off in the text file i want the headers of the query..... ... (0 Replies)
Discussion started by: bhagya.puccha
0 Replies

10. Shell Programming and Scripting

Removing Headers and a Column

I have a text file in unix with a layout like this Column 1 - 1-12 Column 2 - 13-39 Column 3 - 40-58 Column 4 - 59-85 Column 5 - 86-120 Columbn 6 - 121-131 The file also has a header on the first 6 lines of each page. Each page is 51 lines long. So I want to remove the header from each... (30 Replies)
Discussion started by: DerangedNick
30 Replies
Login or Register to Ask a Question
Moose::Cookbook::Basics::Recipe5(3)			User Contributed Perl Documentation		       Moose::Cookbook::Basics::Recipe5(3)

NAME
Moose::Cookbook::Basics::Recipe5 - More subtypes, coercion in a Request class VERSION
version 2.0205 SYNOPSIS
package Request; use Moose; use Moose::Util::TypeConstraints; use HTTP::Headers (); use Params::Coerce (); use URI (); subtype 'My::Types::HTTP::Headers' => as class_type('HTTP::Headers'); coerce 'My::Types::HTTP::Headers' => from 'ArrayRef' => via { HTTP::Headers->new( @{$_} ) } => from 'HashRef' => via { HTTP::Headers->new( %{$_} ) }; subtype 'My::Types::URI' => as class_type('URI'); coerce 'My::Types::URI' => from 'Object' => via { $_->isa('URI') ? $_ : Params::Coerce::coerce( 'URI', $_ ); } => from 'Str' => via { URI->new( $_, 'http' ) }; subtype 'Protocol' => as 'Str' => where { /^HTTP/[0-9].[0-9]$/ }; has 'base' => ( is => 'rw', isa => 'My::Types::URI', coerce => 1 ); has 'uri' => ( is => 'rw', isa => 'My::Types::URI', coerce => 1 ); has 'method' => ( is => 'rw', isa => 'Str' ); has 'protocol' => ( is => 'rw', isa => 'Protocol' ); has 'headers' => ( is => 'rw', isa => 'My::Types::HTTP::Headers', coerce => 1, default => sub { HTTP::Headers->new } ); DESCRIPTION
This recipe introduces type coercions, which are defined with the "coerce" sugar function. Coercions are attached to existing type constraints, and define a (one-way) transformation from one type to another. This is very powerful, but it can also have unexpected consequences, so you have to explicitly ask for an attribute to be coerced. To do this, you must set the "coerce" attribute option to a true value. First, we create the subtype to which we will coerce the other types: subtype 'My::Types::HTTP::Headers' => as class_type('HTTP::Headers'); We are creating a subtype rather than using "HTTP::Headers" as a type directly. The reason we do this is that coercions are global, and a coercion defined for "HTTP::Headers" in our "Request" class would then be defined for all Moose-using classes in the current Perl interpreter. It's a best practice to avoid this sort of namespace pollution. The "class_type" sugar function is simply a shortcut for this: subtype 'HTTP::Headers' => as 'Object' => where { $_->isa('HTTP::Headers') }; Internally, Moose creates a type constraint for each Moose-using class, but for non-Moose classes, the type must be declared explicitly. We could go ahead and use this new type directly: has 'headers' => ( is => 'rw', isa => 'My::Types::HTTP::Headers', default => sub { HTTP::Headers->new } ); This creates a simple attribute which defaults to an empty instance of HTTP::Headers. The constructor for HTTP::Headers accepts a list of key-value pairs representing the HTTP header fields. In Perl, such a list could be stored in an ARRAY or HASH reference. We want our "headers" attribute to accept those data structures instead of an HTTP::Headers instance, and just do the right thing. This is exactly what coercion is for: coerce 'My::Types::HTTP::Headers' => from 'ArrayRef' => via { HTTP::Headers->new( @{$_} ) } => from 'HashRef' => via { HTTP::Headers->new( %{$_} ) }; The first argument to "coerce" is the type to which we are coercing. Then we give it a set of "from"/"via" clauses. The "from" function takes some other type name and "via" takes a subroutine reference which actually does the coercion. However, defining the coercion doesn't do anything until we tell Moose we want a particular attribute to be coerced: has 'headers' => ( is => 'rw', isa => 'My::Types::HTTP::Headers', coerce => 1, default => sub { HTTP::Headers->new } ); Now, if we use an "ArrayRef" or "HashRef" to populate "headers", it will be coerced into a new HTTP::Headers instance. With the coercion in place, the following lines of code are all equivalent: $foo->headers( HTTP::Headers->new( bar => 1, baz => 2 ) ); $foo->headers( [ 'bar', 1, 'baz', 2 ] ); $foo->headers( { bar => 1, baz => 2 } ); As you can see, careful use of coercions can produce a very open interface for your class, while still retaining the "safety" of your type constraint checks. (1) Our next coercion shows how we can leverage existing CPAN modules to help implement coercions. In this case we use Params::Coerce. Once again, we need to declare a class type for our non-Moose URI class: subtype 'My::Types::URI' => as class_type('URI'); Then we define the coercion: coerce 'My::Types::URI' => from 'Object' => via { $_->isa('URI') ? $_ : Params::Coerce::coerce( 'URI', $_ ); } => from 'Str' => via { URI->new( $_, 'http' ) }; The first coercion takes any object and makes it a "URI" object. The coercion system isn't that smart, and does not check if the object is already a URI, so we check for that ourselves. If it's not a URI already, we let Params::Coerce do its magic, and we just use its return value. If Params::Coerce didn't return a URI object (for whatever reason), Moose would throw a type constraint error. The other coercion takes a string and converts it to a URI. In this case, we are using the coercion to apply a default behavior, where a string is assumed to be an "http" URI. Finally, we need to make sure our attributes enable coercion. has 'base' => ( is => 'rw', isa => 'My::Types::URI', coerce => 1 ); has 'uri' => ( is => 'rw', isa => 'My::Types::URI', coerce => 1 ); Re-using the coercion lets us enforce a consistent API across multiple attributes. CONCLUSION
This recipe showed the use of coercions to create a more flexible and DWIM-y API. Like any powerful feature, we recommend some caution. Sometimes it's better to reject a value than just guess at how to DWIM. We also showed the use of the "class_type" sugar function as a shortcut for defining a new subtype of "Object". FOOTNOTES
(1) This particular example could be safer. Really we only want to coerce an array with an even number of elements. We could create a new "EvenElementArrayRef" type, and then coerce from that type, as opposed to a plain "ArrayRef" AUTHOR
Stevan Little <stevan@iinteractive.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.12.5 2011-09-06 Moose::Cookbook::Basics::Recipe5(3)