AcePerl

 view release on metacpan or  search on metacpan

Ace.pm  view on Meta::CPAN

If that does not exist, then Ace will default to Ace::Object.

The value of B<-class> can also be an object or a classname that
implements a class_for() method.  This method will receive three
arguments containing the AceDB class name, object ID and database
handle.  It should return a string indicating the perl class to
create.

=item B<-timeout>

If no response from the server is received within $timeout seconds,
the call will return an undefined value.  Internally timeout sets an
alarm and temporarily intercepts the ALRM signal.  You should be aware
of this if you use ALRM for your own purposes.

NOTE: this feature is temporarily disabled (as of version 1.40)
because it is generating unpredictable results when used with
Apache/mod_perl.

=item B<-query_timeout>

If any query takes longer than $query_timeout seconds, will return an
undefined value.  This value can only be set at connect time, and cannot
be changed once set.

=back

If arguments are omitted, they will default to the following values:

    -host          localhost
    -port          200005;
    -path          no default

Ace.pm  view on Meta::CPAN

referenced by that time, or undef, if no such object exists.  In an
array context, it will return an empty list.

When called with a class and a name pattern in a list context, fetch()
returns the list of objects that match the name.  When called with a
pattern in a scalar context, fetch() returns the I<number> of objects
that match without actually retrieving them from the database.  Thus,
it is similar to count().

In the examples below, the first line of code will fetch the Sequence
object whose database ID is I<D12345>.  The second line will retrieve
all objects matching the pattern I<D1234*>.  The third line will
return the count of objects that match the same pattern.

   $object =  $db->fetch(Sequence => 'D12345');
   @objects = $db->fetch(Sequence => 'D1234*');
   $cnt =     $db->fetch(Sequence =>'D1234*');

A variety of communications and database errors may occur while
processing the request.  When this happens, undef or an empty list
will be returned, and a string describing the error can be retrieved

Ace.pm  view on Meta::CPAN


  @objects = $db->parse_file('/path/to/file');
  @objects = $db->parse_file('/path/to/file',1);

This will call parse() to parse each of the objects found in the
indicated .ace file, returning the list of objects successfully loaded
into the database.

By default, parsing will stop at the first object that causes a parse
error.  If you wish to forge on after an error, pass a true value as
the second argument to this method.

Any parse error messages are accumulated in Ace->error().

=head2 new() method

  $object = $db->new($class => $name);

This method creates a new object in the database of type $class and
name $name.  If successful, it returns the newly-created object.
Otherwise it returns undef and sets $db->error().

Ace.pm  view on Meta::CPAN

to $db->status->{database}{version};

=head2 date_style() method

  $style = $db->date_style();
  $style = $db->date_style('ace');
  $style = $db->date_style('java');

For historical reasons, AceDB can display dates using either of two
different formats.  The first format, which I call "ace" style, puts
the year first, as in "1997-10-01".  The second format, which I call
"java" style, puts the day first, as in "01 Oct 1997 00:00:00" (this
is also the style recommended for Internet dates).  The default is to
use the latter notation.

B<date_style()> can be used to set or retrieve the current style.
Called with no arguments, it returns the current style, which will be
one of "ace" or "java."  Called with an argument, it will set the
style to one or the other.

=head2 timestamps() method

Ace.pm  view on Meta::CPAN

There's also a global named $Ace::Error that you are free to use.

=head2 datetime() and date()

  $datetime = Ace->datetime($time);
  $today    = Ace->datetime();
  $date     = Ace->date($time);
  $today    = Ace->date([$time]);

These convenience functions convert the UNIX timestamp given by $time
(seconds since the epoch) into a datetime string in the format that
ACEDB requires.  date() will truncate the time portion.

If not provided, $time defaults to localtime().

=head1 OTHER METHODS

=head2 debug()

  $debug_level = Ace->debug([$new_level])

Ace.pm  view on Meta::CPAN

strings to the server and to retrieve the results.  The class that
exports the low-level calls is named Ace::AceDB.

The following methods are available in Ace::AceDB:

=over 4

=item new($host,$port,$query_timeout)

Connect to the host $host at port $port. Queries will time out after
$query_timeout seconds.  If timeout is not specified, it defaults to
120 (two minutes).

If successful, this call returns an Ace::AceDB connection object.
Otherwise, it returns undef.  Example:

  $acedb = Ace::AceDB->new('localhost',200005,5) 
           || die "Couldn't connect";

The Ace::AceDB object can also be accessed from the high-level Ace
interface by calling the ACE::db() method:

Ace.pm  view on Meta::CPAN


# Return a hash of miscellaneous status information from the server
# (to be expanded later)
sub status {
  my $self = shift;
  my $data = $self->raw_query('status');
  study $data;

  my %status;

  # -Code section
  my ($program)    = $data=~/Program:\s+(.+)/m;
  my ($aceversion) = $data=~/Version:\s+(.+)/m;
  my ($build)      = $data=~/Build:\s+(.+)/m;
  $status{code}    = { program=>$program,
		       version=>$aceversion,
		       build  =>$build};

  # -Database section
  my ($title)      = $data=~/Title:\s+(.+)/m;
  my ($name)       = $data=~/Name:\s+(.+)/m;
  my ($release)    = $data=~/Release:\s+(.+)/m;
  my ($directory)  = $data=~/Directory:\s+(.+)/m;
  my ($session)    = $data=~/Session:\s+(\d+)/m;
  my ($user)       = $data=~/User:\s+(.+)/m;
  my ($write)      = $data=~/Write Access:\s+(.+)/m;
  my ($address)    = $data=~/Global Address:\s+(\d+)/m;
  $status{database} = {
		       title     => $title,

Ace.pm  view on Meta::CPAN

    return;
  }

  splice(@$list,$i,1);   # remove from position
  return 1;
}

sub datetime {
  my $self = shift;
  my $time = shift || time;
  my ($sec,$min,$hour,$day,$mon,$year) = localtime($time);
  $year += 1900;   # avoid Y3K bug
  sprintf("%4d-%02d-%02d %02d:%02d:%02d",$year,$mon+1,$day,$hour,$min,$sec);
}

sub date {
  my $self = shift;
  my $time = shift || time;
  my ($sec,$min,$hour,$day,$mon,$year) = localtime($time);
  $year += 1900;   # avoid Y3K bug
  sprintf("%4d-%02d-%02d",$year,$mon+1,$day);
}

Ace/Browser/AceSubs.pm  view on Meta::CPAN

These are not called with any CGI parameters on their first
invocation, but can define their own parameter lists by creating
fill-out forms.  The AceBrowser system remembers the last search
performed by a search script in a cookie and regenerates the CGI
parameters the next time the user selects that search script.

=back

=head1 SUBROUTINES

The following sections describe the exported subroutines.

=over 4

=cut

use strict;
use Ace::Browser::SiteDefs;
use Ace 1.76;
use CGI qw(:standard escape);
use CGI::Cookie;

Ace/Browser/AceSubs.pm  view on Meta::CPAN


# Subroutines used by all scripts.
# Will generate an HTTP 'document not found' error if you try to get an 
# undefined database name.  Check the return code from this function and
# return immediately if not true (actually, not needed because we exit).
sub AceInit   {
  $HEADER   = 0;
  $TOP      = 0;
  @COOKIES  = ();

  # keeps track of what sections should be open
  %OPEN = param('open') ? map {$_ => 1} split(' ',param('open')) : () ;

  return 1 if Configuration();

  # if we get here, it is a big NOT FOUND error
  print header(-status=>'404 Not Found',-type=>'text/html');
  $HEADER++;
  print start_html(-title => 'Database Not Found',
		   -style => Ace::Browser::SiteDefs->getConfig(DEFAULT_DATABASE)->Style,
		  ),

Ace/Browser/AceSubs.pm  view on Meta::CPAN

  $obj = GetAceObject();
  if ($obj->CDS) {
    my $protein	= $obj->Corresponding_protein;
    AceRedirect('protein',$protein);
  }

AceRedirect must be called b<before> PrintTop() or  AceHeader().  It
invokes exit(), so it will not return.

This subroutine is not exported by default.  It differs from
DoRedirect() in that it displays a message to the user for two seconds
before it generates the new page. It also allows the display to be set
explicitly, rather than determined automatically by the AceBrowser
system.

=cut

###############  redirect to a different report #####################
sub AceRedirect {
  my ($report,$object) = @_;

Ace/Browser/AceSubs.pm  view on Meta::CPAN

  my $destination = ResolveUrl($url => $args);
  AceHeader(-Refresh => "1; URL=$destination");
  print start_html (
			 '-Title' => 'Redirect',
			 '-Style' => Style(),
		         '-head'  => meta({-http_equiv=>'Refresh',-content=>"1; URL=$destination"})
			),
    h1('Redirect'),
    p("This request is being redirected to the \U$report\E display"),
    p("This page will automatically display the requested object in",
	   "one seconds",a({-href=>$destination},'Click on this link'),
	'to load the page immediately.'),
    end_html();
    Apache->exit(0) if defined &Apache::exit;
    exit(0);
}

=item $configuration = Configuration()

The Configuration() function returns the Ace::Browser::SiteDefs object
for the current session.  From this object you can retrieve

Ace/Browser/AceSubs.pm  view on Meta::CPAN

    }
    my $display = url(-relative=>1);
    my ($disp,$parameters) = Configuration()->map_url($display,$name,$class);
    return $disp unless $parameters;
    return Url($disp,$parameters);
}

=item $link = ObjectLink($object [,$link_text])

This function converts an AceDB object into a hypertext link.  The
first argument is an Ace::Object.  The second, optional argument is
the text to use for the link.  If not provided, the object's name
becomes the link text.

This function is used extensively to create cross references between
Ace::Objects on AceBrowser pages.

Example:

  my $author = $db->fetch(Author => 'Sulston JE');
  print ObjectLink($author,$author->Full_name);

Ace/Browser/AceSubs.pm  view on Meta::CPAN

    $main .= "#$frag" if $frag;
    return $main;
}

# A consistent stylesheet across pages
sub Style {
    my $stylesheet = Configuration()->Stylesheet;
    return { -src => $stylesheet };
}

=item $boolean = Toggle($section,[$label,$object_count,$add_plural,$add_count])

=item ($link,$bool) = Toggle($section,$label,$object_count,$add_plural,$add_count)

The Toggle() subroutine makes it easy to create HTML sections that
open and close when the user selects a toggle icon (a yellow
triangle).

Toggle() can be used to manage multiple collapsible HTML sections, but
each section must have a unique name.  The required first argument is
the section name.  Optional arguments are:

  $label         The text of the generated link, for example "sequence"

  $object_count  The number of objects that opening the section will reveal

  $add_plural    If true, the label will be pluralized when
		 appropriate

  $add_count	 If true, the label will have the object count added
		 when appropriate

In a scalar context, Toggle() prints the link HTML and returns a
boolean flag.  A true result indicates that the section is expanded
and should be generated.  A false result indicates that the section is 
collapsed.

In a list context, Toggle() returns a two-element list.  The first
element is the HTML link that expands and contracts the section.  The
second element is a boolean that indicates whether the section is
currently open or closed.

This example indicates typical usage:

  my $sequence = GetAceObject();
  print "sequence name = ",$sequence,"\n";
  print "sequence clone = ",$sequence->Clone,"\n";
  if (Toggle('dna','Sequence DNA')) {
      print $sequence->asDNA;
  }

Ace/Browser/AceSubs.pm  view on Meta::CPAN


  my $sequence = GetAceObject();
  print "sequence name = ",$sequence,"\n";
  print "sequence clone = ",$sequence->Clone,"\n";
  my ($link,$open) = Toggle('dna','Sequence DNA');
  print $link;
  print $sequence->asDNA if $open;

=cut

# Toggle a subsection open and close
sub Toggle {
    my ($section,$label,$count,$addplural,$addcount,$max_open) = @_;
    $OPEN{$section}++ if defined($max_open) && $count <= $max_open;

    my %open = %OPEN;
    $label ||= $section;
    my $img;
    if (exists $open{$section}) {
	delete $open{$section};
	$img =  img({-src=>'/ico/triangle_down.gif',-alt=>'^',
			-height=>6,-width=>11,-border=>0}),
    } else {
	$open{$section}++;
	$img =  img({-src=>'/ico/triangle_right.gif',-alt=>'&gt;',
			-height=>11,-width=>6,-border=>0}),
	my $plural = ($addplural and $label !~ /s$/) ? "${label}s" : "$label";
	$label = font({-class=>'toggle'},!$addcount ? $plural : "$count $plural");
    }
    param(-name=>'open',-value=>join(' ',keys %open));
    my $url = url(-absolute=>1,-path_info=>1,-query=>1);

    my $link = a({-href=>"$url#$section",-name=>$section},$img.'&nbsp;'.$label);
    if (wantarray ){
      return ($link,$OPEN{$section})
    } else {
      print $link,br;
      return $OPEN{$section};
    }
}

=item $html = TypeSelector($name,$class)

This subroutine generates the HTML for the type selector navigation
bar.  The links in the bar are dynamically generated based on the
values of $name and $class.  This function is called by PrintTop().
It is not exported by default.

Ace/Graphics/Glyph.pm  view on Meta::CPAN

glyph is a wrapper around an Ace::Sequence::Feature object, knows how
to render itself on an Ace::Graphics::Panel, and has a variety of
configuration variables.

End developers will not ordinarily work directly with
Ace::Graphics::Glyph, but may want to subclass it for customized
displays.

=head1 METHODS

This section describes the class and object methods for
Ace::Graphics::Glyph.

=head2 CONSTRUCTORS

Ace::Graphics::Glyph objects are constructed automatically by an
Ace::Graphics::GlyphFactory, and are not usually created by
end-developer code.

=over 4

Ace/Graphics/Glyph.pm  view on Meta::CPAN

Ace::Graphics::GlyphFactory object from which the glyph will fetch all
its run-time configuration information.

A standard set of options are recognized.  See L<OPTIONS>.

=back

=head2 OBJECT METHODS

Once a glyph is created, it responds to a large number of methods.  In
this section, these methods are grouped into related categories.

Retrieving glyph context:

=over 4

=item $factory = $glyph->factory

Get the Ace::Graphics::GlyphFactory associated with this object.  This
cannot be changed once it is set.

Ace/Graphics/GlyphFactory.pm  view on Meta::CPAN


=head1 DESCRIPTION

The Ace::Graphics::GlyphFactory class is used internally by
Ace::Graphics::Track and Ace::Graphics::Glyph to hold the options
pertaining to a set of related glyphs and creating them on demand.
This class is not ordinarily useful to the end-developer.

=head1 METHODS

This section describes the class and object methods for
Ace::Graphics::GlyphFactory.

=head2 CONSTRUCTORS

There is only one constructor, the new() method.  It is ordinarily
called by Ace::Graphics::Track, in the make_factory() subroutine.

=over 4

=item $factory = Ace::Graphics::GlyphFactory->new($glyph_name,@options)

Ace/Graphics/GlyphFactory.pm  view on Meta::CPAN

=over 4

=item $glyph = $factory->glyph($feature)

Given a sequence feature, creates an Ace::Graphics::Glyph object to
display it.  The various attributes of the glyph are set from the
options provided at factory creation time.

=item $option = $factory->option($option_name [,$new_option])

Given an option name, returns its value.  If a second argument is
provided, sets the option to the new value and returns its previous
one.

=item $index = $factory->fgcolor

Returns the desired foreground color for the glyphs in the form of an
GD::Image color index.  This may be the one of the special colors
gdBrushed and gdStyled.  This is only useful while the enclosing
Ace::Graphics::Panel object is rendering the object.  In other
contexts it returns undef.

Ace/Graphics/Panel.pm  view on Meta::CPAN

  my $key_glyphs = $self->{key_glyphs} or return;

  my $color = $self->translate($self->{keycolor});
  $gd->filledRectangle($left,$top,$self->width,$self->height,$color);
  $gd->string(KEYLABELFONT,$left,KEYPADTOP+$top,"KEY:",1);
  $top += KEYLABELFONT->height + KEYPADTOP;

  $_->draw($gd,$left,$top) foreach @$key_glyphs;
}

# Format the key section, and return its height
sub format_key {
  my $self = shift;

  return $self->{key_height} if defined $self->{key_height};

  my ($height,$width) = (0,0);
  my %tracks;
  my @glyphs;

  # determine how many glyphs become part of the key

Ace/Graphics/Panel.pm  view on Meta::CPAN

You will then call add_track() one or more times to add sets of
related features to the picture.  When you have added all the features
you desire, you may call png() to convert the image into a PNG-format
image, or boxes() to return coordinate information that can be used to
create an imagemap.

Note that this modules depends on GD.

=head1 METHODS

This section describes the class and object methods for
Ace::Graphics::Panel.

=head2 CONSTRUCTORS

There is only one constructor, the new() method.

=over 4

=item $panel = Ace::Graphics::Panel->new(@options)

Ace/Graphics/Panel.pm  view on Meta::CPAN

cause overlapping glyphs to bump downwards until there is room for
them.  A -bump value of -1 will cause overlapping glyphs to bump
upwards.

The -key argument declares that the track is to be shown in a key
appended to the bottom of the image.  The key contains a picture of a
glyph and a label describing what the glyph means.  The label is
specified in the argument to -key.

If present, the -glyph argument overrides the glyph given in the first
or second argument.

add_track() returns an Ace::Graphics::Track object.  You can use this
object to add additional features or to control the appearance of the
track with greater detail, or just ignore it.  Tracks are added in
order from the top of the image to the bottom.  To add tracks to the
top of the image, use unshift_track().

Typical usage is:

 $panel->add_track( thistle    => \@genes,

Ace/Graphics/Track.pm  view on Meta::CPAN



=head1 DESCRIPTION

The Ace::Graphics::Track class is used by Ace::Graphics::Panel to lay
out a set of sequence features using a uniform glyph type. You will
ordinarily work with panels rather than directly with tracks.

=head1 METHODS

This section describes the class and object methods for
Ace::Graphics::Panel.

=head2 CONSTRUCTORS

There is only one constructor, the new() method.  It is ordinarily
called by Ace::Graphics::Panel, and not in end-developer code.

=over 4

=item $track = Ace::Graphics::Track->new($glyph_name,$features,@options)

Ace/Object.pm  view on Meta::CPAN

# Pseudonyms and deprecated methods.
*isClass        =  \&isObject;
*pick           =  \&fetch;
*get            =  \&search;
*add            =  \&add_row;

sub AUTOLOAD {
    my($pack,$func_name) = $AUTOLOAD=~/(.+)::([^:]+)$/;
    my $self = $_[0];

    # This section works with Autoloader
    my $presumed_tag = $func_name =~ /^[A-Z]/ && $self->isObject;  # initial_cap 

    if ($presumed_tag) {
      croak "Invalid object tag \"$func_name\"" 
	if $self->db && $self->model && !$self->model->valid_tag($func_name);

      shift();  # get rid of the object
      my $no_dereference;
      if (defined($_[0])) {
	if ($_[0] eq '@') {

Ace/Object.pm  view on Meta::CPAN

    my $db = shift;
    $self->{db} = "$db";  # store string representation, not object
  }
  Ace->name2db($self->{db});
}

### Return a portion of the tree at the indicated tag path     ###
#### In a list context returns the column.  In an array context ###
#### returns a pointer to the subtree ####
#### Usually returns what is pointed to by the tag.  Will return
#### the parent object if you pass a true value as the second argument
sub at {
    my $self = shift;
    my($tag,$pos,$return_parent) = rearrange(['TAG','POS','PARENT'],@_);
    return $self->right unless $tag;
    $tag = lc $tag;

    # Removed a $` here to increase speed -- tim.cutts@incyte.com 2 Sep 1999

    if (!defined($pos) and $tag=~/(.*?)\[(\d+)\]$/) {
      $pos = $2;

Ace/Object.pm  view on Meta::CPAN

number of steps (zero indicates no movement).

     $full_name = $object->right->right;
     $full_name = $object->right(2);

     $city = $object->right->down->down->right->right->down->down;
     $city = $object->right->down(2)->right(2)->down(2);

If $object contains the "Thierry-Mieg J" Author object, then the first
series of accesses shown above retrieves the string "Jean
Thierry-Mieg" and the second retrieves "34033 Montpellier."  If the
right or bottom pointers are NULL, these methods will return undef.

In addition to being somewhat awkard, you will probably never need to
use these methods.  A simpler way to retrieve the same information
would be to use the at() method described in the next section.  

The right() and down() methods always walk through the tree of the
current object.  They do not follow object pointers into the database.
Use B<fetch()> (or the deprecated B<pick()> or B<follow()> methods)
instead.

=head2 at() method

    $subtree    = $object->at($tag_path);
    @values     = $object->at($tag_path);

Ace/Object.pm  view on Meta::CPAN

at() is a simple way to fetch the portion of the tree that you are
interested in.  It takes a single argument, a simple tag or a path.  A
simple tag, such as "Full_name", must correspond to a tag in the
column immediately to the right of the root of the tree.  A path such
as "Address.Mail" is a dot-delimited path to the subtree.  Some
examples are given below.

    ($full_name)   = $object->at('Full_name');
    @address_lines = $object->at('Address.Mail');

The second line above is equivalent to:

    @address = $object->at('Address')->at('Mail');

Called without a tag name, at() just dereferences the object,
returning whatever is to the right of it, the same as
$object->right

If a path component already has a dot in it, you may escape the dot
with a backslash, as in:

Ace/Object.pm  view on Meta::CPAN

The list versus scalar context semantics are the same as in at(), so
if you want to retrieve the scalar value pointed to by the indicated
tag, either use a list context as shown in the example, above, or a
dereference, as in:

     $fax_no = $object->get('Fax');
         --> "Fax"
     $fax_no = $object->get('Fax')->at;
         --> "33-67-521559"

An optional second argument to B<get()>, $position, allows you to
navigate the tree relative to the retrieved subtree.  Like the B<at()>
navigational indexes, $position must be a number greater than or equal
to zero.  In a scalar context, $position moves rightward through the
tree.  In an array context, $position implements "tag[2]" semantics.

For example:

     $fax_no = $object->get('Fax',0);
          --> "Fax"

Ace/Object.pm  view on Meta::CPAN

   $object->asHTML;
   $object->asHTML(\&tree_traversal_code);

asHTML() returns an HTML 3 table representing the object, suitable for
incorporation into a Web browser page.  The callback routine, if
provided, will have a chance to modify the object representation
before it is incorporated into the table, for example by turning it
into an HREF link.  The callback takes a single argument containing
the object, and must return a string-valued result.  It may also
return a list as its result, in which case the first member of the
list is the string representation of the object, and the second
member is a boolean indicating whether to prune the table at this
level.  For example, you can prune large repetitive lists.

Here's a complete example:

   sub process_cell {
     my $obj = shift;
     return "$obj" unless $obj->isObject || $obj->isTag;

     my @col = $obj->col;

Ace/Object.pm  view on Meta::CPAN


The option B<-coords> argument allows you to provide the top and
bottom of the display for MAP objects only.  These coordinates are in
the map's native coordinate system (cM, bp).  By default, AceDB will
show most (but not necessarily all) of the map according to xace's
display rules.  If you call this method with the B<-getcoords>
argument and a true value, it will return a two-element array
containing the coordinates of the top and bottom of the map.

asGIF() returns a two-element array.  The first element is the GIF
data.  The second element is an array reference that indicates special 
areas of the image called "boxes."  Boxes are rectangular areas that
surround buttons, and certain displayed objects.  Using the contents
of the boxes array, you can turn the GIF image into a client-side
image map.  Unfortunately, not everything that is clickable is
represented as a box.  You still have to pass clicks on unknown image
areas back to the server for processing.

Each box in the array is a hash reference containing the following
keys:

Ace/Object.pm  view on Meta::CPAN


=head2 add_row() method

    $result_code = $object->add_row($tag=>$value);    
    $result_code = $object->add_row($tag=>[list,of,values]);    
    $result_code = $object->add(-path=>$tag,
				-value=>$value);

add_row() updates the tree by adding data to the indicated tag path.  The
example given below adds the value "555-1212" to a new Address entry
named "Pager".  You may call add_row() a second time to add a new value
under this tag, creating multi-valued entries.

 $object->add_row('Address.Pager'=>'555-1212');

You may provide a list of values to add an entire row of data.  For
example:

 $sequence->add_row('Assembly_tags'=>['Finished Left',38949,38952,'AC3']);

Actually, the array reference is not entirely necessary, and if you

Ace/Object.pm  view on Meta::CPAN

See also the Ace->new() method.

=head2 add_tree()

  $result_code = $object->add_tree($tag=>$ace_object);
  $result_code = $object->add_tree(-tag=>$tag,-tree=>$ace_object);

The add_tree() method will insert an entire Ace subtree into the object
to the right of the indicated tag.  This can be used to build up
complex Ace objects, or to copy portions of objects from one database
to another.  The first argument is a tag path, and the second is the
tree that you wish to insert.  As with add_row() the database will
only be updated when you call commit().

When inserting a subtree, you must be careful to remember that
everything to the *right* of the node that you are pointing at will be
inserted; not the node itself.  For example, given this Sequence
object:

  Sequence AC3
    DB_info     Database    EMBL

Ace/Object.pm  view on Meta::CPAN

  foreach (@lines) {
    my @data = split("\t");
    push(@data,('')x(@max-@data));
    formline ($format1,@data);
    formline ($format2,@data);
  }
  return ($result = $^A,$^A='')[0];
}

# run a series of GIF commands and return the Gif and the semi-parsed
# "boxes" structure.  Commands is typically a series of mouseclicks
# ($gif,$boxes) = $aceObject->asGif(-clicks=>[[$x1,$y1],[$x2,$y2]...],
#                                   -dimensions=>[$x,$y]);
sub asGif {
  my $self = shift;
  my ($clicks,$dimensions,$display,$view,$coords,$getcoords) = rearrange(['CLICKS',
									  ['DIMENSIONS','DIM'],
									  'DISPLAY',
									  'VIEW',
									  'COORDS',
									  'GETCOORDS',

Ace/Object.pm  view on Meta::CPAN

  if ($coords) {
    $c    =  ref($coords) ? "-coords @$coords" : "-coords $coords";
  }
  my @commands;
  if ($view || $c || $self->class =~ /Map/i) {
      @commands = "gif map \"@{[$self->name]}\" $view $c";
  } else {
      @commands = "gif display $display $view @{[$self->class]} \"@{[$self->name]}\"";
  }
  push(@commands,"Dimensions @$dimensions") if ref($dimensions);
  push(@commands,map { "mouseclick @{$_}" } @$clicks) if ref($clicks);

  if ($getcoords) { # just want the coordinates
    my ($start,$stop);
    my $data = $self->db->raw_query(join(' ; ',@commands));    
    return unless $data =~ /\"[^\"]+\" ([\d.-]+) ([\d.-]+)/;
    ($start,$stop) = ($1,$2);
    return ($start,$stop);
  }

  push(@commands,"gifdump -");

Ace/Sequence/Feature.pm  view on Meta::CPAN


=item source()

=item method()

=item subtype()

  $source = $feature->source;

These three methods are all synonyms for the same thing.  They return
the second field of the GFF format, called "source" in the
documentation.  This is usually the method or algorithm used to
predict the feature, such as "GeneFinder" or "tRNA" scan.  To avoid
ambiguity and enhance readability, the method() and subtype() synonyms
are also recognized.

=item feature()

=item type()

  $type = $feature->type;

Ace/Sequence/Multi.pm  view on Meta::CPAN

use Ace::Sequence;

use vars '@ISA';
@ISA = 'Ace::Sequence';

# backward compatibility
*db_id = \&db;

sub new {
  my $pack = shift;
  my ($secondary,$rest) = rearrange([['SECONDARY','DBS']],@_);
  return unless my $obj = $pack->SUPER::new($rest);

  if (defined $secondary) {
    my @s = ref $secondary eq 'ARRAY' ? @$secondary : $secondary;
    $obj->{'secondary'} = { map { $_=> $_} @s };
  }

  return bless $obj,$pack;
}

sub secondary {
  return unless my $s = $_[0]->{'secondary'};
  return values %{$s};
}

sub add_secondary {
  my $self = shift;
  foreach (@_) {
    $self->{'secondary'}->{$_}=$_;
  }
}

sub delete_secondary {
  my $self = shift;
  foreach (@_) {
    delete $self->{'secondary'}->{$_};
  }
}

sub db {
  return $_[0]->SUPER::db() unless $_[1];
  return $_[0]->{'secondary'}->{$_[1]} || $_[0]->SUPER::db();
}

# return list of features quickly
sub feature_list {
  my $self = shift;
  return $self->{'feature_list'} if $self->{'feature_list'};
  my $raw;

  for my $db ($self->db,$self->secondary) {
    $raw .= $self->_query($db,'seqfeatures -version 2 -list');
    $raw .= "\n";  # avoid nulls
  }

  return $self->{'feature_list'} = Ace::Sequence::FeatureList->new($raw);
}

# return a unified gff file
sub gff {
  my $self = shift;
  my ($abs,$features) = rearrange([['ABS','ABSOLUTE'],'FEATURES'],@_);
  my   $db = $self->db;

  my $gff = $self->SUPER::gff(-Abs=>$abs,-Features=>$features,-Db=>$db);
  return unless $gff;
  return $gff unless $self->secondary;

  my(%seen,@lines);

  foreach (grep !$seen{$_}++,split("\n",$gff)) {  #ignore duplicates
    next if m!^//!;  # ignore comments
    push @lines,/^\#/ ? $_ : join "\t",$_,$db;
  }

  my $opt = $self->_feature_filter($features);

  for my $db ($self->secondary) {
    my $supplement = $self->_gff($opt,$db);
    $self->transformGFF(\$supplement) unless $abs;

    my $string = $db->asString;

    foreach (grep !$seen{$_}++,split("\n",$supplement)) {  #ignore duplicates
      next if m!^(//|\#)!;  # ignore comments
      push(@lines, join "\t",$_,$string);   # add database as an eighth field
    }
  }

  return join("\n",@lines,'');
}

# turn a GFF file and a filter into a list of Ace::Sequence::Feature objects
sub _make_features {
  my $self = shift;
  my ($gff,$filter) = @_;

  my @dbs = ($self->db,$self->secondary);
  my %dbs = map { $_->asString => $_ } @dbs;

  my ($r,$r_offset,$r_strand) = $self->refseq;
  my $abs = $self->absolute;
  if ($abs) {
    $r_offset  = 0;
    $r = $self->parent;
    $r_strand = '+1';
  }
  my @features;

Ace/Sequence/Multi.pm  view on Meta::CPAN


Ace::Sequence::Multi - Combine Feature Tables from Multiple Databases

=head1 SYNOPSIS

    use Ace::Sequence::Multi;

    # open reference database
    $ref = Ace->connect(-host=>'stein.cshl.org',-port=>200009);

    # open some secondary databases
    $db1 = Ace->connect(-host=>'stein.cshl.org',-port=>200010);
    $db2 = Ace->connect(-path=>'/usr/local/acedb/mydata');

    # Make an Ace::Sequence::Multi object
    $seq = Ace::Sequence::Multi->new(-name   => 'CHROMOSOME_I,
                                     -db     => $ref,
			             -offset => 3_000_000,
			             -length => 1_000_000);

    # add the secondary databases
    $seq->add_secondary($db1,$db2);

    # get all the homologies (a list of Ace::Sequence::Feature objs)
    @homol = $seq->features('Similarity');

    # Get information about the first one -- goes to the correct db
    $feature = $homol[0];
    $type    = $feature->type;
    $subtype = $feature->subtype;
    $start   = $feature->start;
    $end     = $feature->end;

Ace/Sequence/Multi.pm  view on Meta::CPAN

database of origin and go back to that database for information.

This class will only work properly if the reference database and all
annotation databases share the same cosmid map.

=head1  OBJECT CREATION

You will use the new() method to create new Ace::Sequence::Multi
objects.  The arguments are identical to the those in the
Ace::Sequence parent class, with the addition of an option
B<-secondary> argument, which points to one or more secondary databases 
from which to fetch annotation information.

=over 4

=item -source

The sequence source.  This must be an I<Ace::Object> of the "Sequence" 
class, or be a sequence-like object containing the SMap tag (see
below).

Ace/Sequence/Multi.pm  view on Meta::CPAN

The I<Ace::Sequence> module will use the provided database accessor to
fetch a Sequence object with the specified name. new() will return
undef is no Sequence by this name is known.

=item -db

This argument is required if the source sequence is specified by name
rather than by object reference.  It must be a previously opened
handle to the reference database.

=item -secondary

This argument points to one or more previously-opened annotation
databases.  You may use a scalar if there is only one annotation
database.  Otherwise, use an array reference.  You may add and delete
annotation databases after the object is created by using the
add_secondary() and delete_secondary() methods.

=back

If new() is successful, it will create an I<Ace::Sequence::Multi>
object and return it.  Otherwise it will return undef and return a
descriptive message in Ace->error().  Certain programming errors, such
as a failure to provide required arguments, cause a fatal error.


=head1 OBJECT METHODS

Most methods are inherited from I<Ace::Sequence>.  The following
additional methods are supported:

=over 4

=item secondary()

  @databases = $seq->secondary;

Return a list of the secondary databases currently in use, or an empty 
list if none.

=item add_secondary()

  $seq->add_secondary($db1,$db2,...)

Add one or more secondary databases to the list of annotation
databases.  Duplicate databases will be silently ignored.

=item delete_secondary()

  $seq->delete_secondary($db1,$db2,...)

Delete one or more secondary databases from the list of annotation
databases.  Databases not already in use will be silently ignored.

=back

=head1 SEE ALSO

L<Ace>, L<Ace::Object>, L<Ace::Sequence>,L<Ace::Sequence::Homol>,
L<Ace::Sequence::FeatureList>, L<Ace::Sequence::Feature>, L<GFF>

=head1 AUTHOR

README  view on Meta::CPAN

   a handful of tests fail.  Do be alarmed if all of the tests fail.

  6. make install

  This will install AcePerl into your perl5 library directory.

  You may need to be root (superuser) in order to "make install".  This
  is because Perl will want to install the newly-built files into its
  library tree, /usr/local/lib/perl5/site_perl (or something similar),
  and this tree is usually not writable by mere mortals.  Do not
  despair: see the next section.

INSTALLING ACEPERL IN A NON-STANDARD LOCATION

By default, Perl will install AcePerl's library files within the
site-specific subdirectory of its library tree, usually
/usr/local/lib/perl5/site_perl.  If you wish, you can install the
library files elsewhere.

Simply change to the AcePerl distribution directory and run the
Makefile.PL script with the INSTALLSITELIB switch set to the full path 

README.ACEBROWSER  view on Meta::CPAN

 $STYLESHEET = "$DOCROOT/stylesheets/aceperl.css";

This is the cascading stylesheet used to set the background color,
font, table colors, and so forth.  You probably don't need to change
this, but you might want to modify the stylesheet itself.

 @PICTURES = ($IMAGES => "$HTML_PATH/images");

This array indicates the location of the "images" subdirectory.  The
first element of the array is the location of the directory as a URL,
and the second element is the location of the directory as a physical
path on the file system.  This array is ignored when running under
modperl/Apache::Registry; modperl uses $IMAGES to look up the
corresponding physical path.

 @SEARCHES   = (
	       basic => {
			name   => 'Basic Search',
			url    =>"$ROOT/searches/basic",
		       },
	       text => {

README.ACEBROWSER  view on Meta::CPAN

			  },
	       query => {
			 name => 'Acedb Query',
			 url  => "$ROOT/searches/query",
			 },
	       );
 $SEARCH_ICON = "$ICONS/unknown.gif";

The @SEARCHES array sets the searches made available to users.  The
first element in each pair is the symbolic name for the search.  The
second element is a hash reference containing the keys "name" and
"url".  The name is the bit of human readable text printed in the
list of searches located at the top of the AceBrowser page.  The url
is the URL of the script that performs the search.

The $SEARCH_ICON variable selects an icon to use for the search
button.


 @HOME      = (
	      $DOCROOT => 'Home Page'

README.ACEBROWSER  view on Meta::CPAN


 @FEEDBACK_RECIPIENTS = (
			[ " $ENV{SERVER_ADMIN}", 'general complaints and suggestions', 1 ]
 );

This array contains a list of recipient e-mail addresses for the
"feedback" page.  Each recipient is an array reference containing
least two elements, the e-mail address and a comment.  A third,
optional, element, if true, indicates that this recipient should be
selected by default.  The default is the webmaster's e-mail address.
Comment out the entire section of you do not want the feedback link to 
appear.

 # configuration for the "basic" search script
 @BASIC_OBJECTS = 
   ('Any'          =>   '<i>Anything</i>',
    'Locus'        =>   'Confirmed Gene',
    'Predicted_gene'    =>   'Predicted Gene',
    'Sequence'     =>   'Sequence (any)',
    'Genome_sequence', => 'Sequence (genomic)',
    'Author'       =>    'Author',

README.ACEBROWSER  view on Meta::CPAN

use in searching the Acedb class "Locus".

USING ACEBROWSER WITH MOD-PERL

Acebrowser is designed to work well with modperl
(http://perl.apache.org).  In fact, using it with a modperl-enabled
Apache server will increase its performance dramatically.

To use Acebrowser with modperl, install the CGI scripts into a
directory that is under the control of Apache::Registry.  The
<Location> section in httpd.conf should look like this:

 Alias /acedb/ /usr/local/apache/cgi-bin/ace/

 <Location /acedb>
   SetHandler Perl-script
   PerlHandler Apache::Registry
   PerlSendHeader On
   Options +ExecCGI +Indexes
 </Location>

acebrowser/cgi-bin/generic/pic  view on Meta::CPAN


  my $map_start = param ('map_start');
  my $map_stop  = param ('map_stop');

  my($start,$stop) = $obj->asGif(-getcoords=>1);
  $map_start ||= $start;
  $map_stop  ||= $stop;

  my($min,$max)    = get_extremes($obj->db,$name);

  # this section is responsible for centering on the place the user clicks
  if (param('click')) {
    my ($x,$y) = split '-',param('click');
    my $pos    = $map_start + $y/HEIGHT * ($map_stop - $map_start);

    my $offset = $pos - ($map_start + $map_stop)/2;

    $map_start += $offset;
    $map_stop  += $offset;
    param('map_start' => $map_start);
    param('map_stop'  => $map_stop);

acelib/aceclientlib.c  view on Meta::CPAN

	  printf ("//   directory %s not readable\n", dirName) ;
	return 0 ;
      }
    fclose (f) ;
  }

  { int i ;
    struct itimerval tval ;
    
    signal (SIGALRM, wakeUp) ;
    tval.it_interval.tv_sec = 0 ;
    tval.it_interval.tv_usec = 5000 ; /* 5ms reload */
    tval.it_value.tv_sec = 0 ;
    tval.it_value.tv_usec = 1000 ; /* 1ms initial */
    setitimer (ITIMER_REAL, &tval, 0) ;

    for (i = 0 ; i < 1000 ; ++i) /* 5 seconds */
      { pause () ;		/* wait until SIGALRM handled */
	f = fopen (name, "r") ;
	if (f) 
	  { if (accessDebug) 
	      printf ("//   found %s after %d msecs\n", name, 5*i+1) ;
	    tval.it_interval.tv_usec = tval.it_value.tv_usec = 0 ;
	    setitimer (ITIMER_REAL, &tval, 0) ;
	    return f ;
	  }
      }

    if (accessDebug)
      printf ("//   failed to find %s after %d msecs\n", name, 5*i+1) ;
    tval.it_interval.tv_usec = tval.it_value.tv_usec = 0 ;
    setitimer (ITIMER_REAL, &tval, 0) ;
  }

  return 0 ;
}

static int getMagic (int magic1, char *nm)
{ int magic = 0, magic2 = 0, magic3 = 0 ;
  FILE *f ;
  int level ;

acelib/aceclientlib.c  view on Meta::CPAN


    at least on a dec alpha, the first connection keeps hanging and the
  inetd daemon keeps restrating the server for ever

    the advantage of this kludge is that the first client connection no 
    longer fails, and it is otherwise harmless since the restarting
    server happenned before i introduced this kludge
    */
  if (first)
    { first = 0 ;
      tv.tv_sec = 5 ;
      tv.tv_usec = 0;
      clnt_control(clnt, CLSET_TIMEOUT, (char *)&tv);

      reponse = ace_server_1(&question, clnt);
      if (!reponse) /* i ll try a second time */
	{ clnt_destroy(clnt); goto lao ; }
    }
#endif

  tv.tv_sec = timeOut;
  tv.tv_usec = 0;
  clnt_control(clnt, CLSET_TIMEOUT, (char *)&tv);
  
  if (!reponse) /* hopefully first connection worked */
    reponse = ace_server_1(&question, clnt);
  if (!reponse) return ((ace_handle *)NULL);
  
  clientId = reponse->ace_reponse_u.res_data.clientId;
  magic1 = reponse->ace_reponse_u.res_data.magic;
  if (!clientId) {
    xdr_free((xdrproc_t )xdr_ace_reponse, (char *)reponse); 

acelib/aceclientlib.c  view on Meta::CPAN

  int aceError, length, i, encore = 0 ;

/* generate question structure */
  question.clientId = handle->clientId;
  question.magic = handle->magic;
  question.reponse.reponse_len = 0;
  question.reponse.reponse_val = "";
  question.kBytes = chunkSize;
  question.aceError = 0;
/* check if request contains a local command */
  if (!strncasecmp(request,"encore",6)) 
    {
      /* encore request */
      question.encore = WANT_ENCORE;
      question.question = ""; 
    } 
  else if (!strncasecmp(request,"noencore",8)) 
    {
      /* encore request */
      question.encore = DROP_ENCORE;
      question.question = ""; 
    } 
  else if (!strncasecmp(request,"quit",4)) 
    { /* ignore quit request. Must go through closeServer routine */
      *answerLength = 0;
      *answerPtr = NULL;
      return 0;
    } 
  else
    { question.encore = 0;
      question.question = request;
    }
  

acelib/arraysub.c  view on Meta::CPAN

BOOL uAssFindNext (Associator a, void* xin, void** pout)
/* if found, updates *pout and returns TRUE, else returns FALSE	*/
{ int	hash, delta ;
  void* test ;

  if (!assExists(a))
    messcrash ("assFindNext received corrupted associator") ;
  if (!xin || xin == moins_un || !a->in[a->i]) 
    return FALSE ;
  if (a->in[a->i] != xin)
    messcrash ("Non consecutive call to assFindNext") ;

  hash = a->i ;
  DELTA(xin) ;
  while (TRUE)
    { test = a->in[hash] ;
      if (test == xin)
	{ if (pout)
	    *pout = a->out[hash] ;
	  while (TRUE) /* locate on next entry */
	    { hash = (hash + delta) & a->mask ; 

acelib/arraysub.c  view on Meta::CPAN

BOOL uAssNext (Associator a, void* *pin, void* *pout)
{ int size ;
  void *test ;

  if (!assExists(a))
     messcrash("uAssNext received a non existing associator") ;
  size = 1 << a->m ;
  if (!*pin)
    a->i = -1 ;
  else if (*pin != a->in[a->i])
    { messerror ("Non-consecutive call to assNext()") ;
      return FALSE ;
    }

  while (++a->i < size)
    { test = a->in[a->i] ;
      if (test && test != moins_un) /* not empty or deleted */
	{ *pin = a->in[a->i] ;
	  if (pout)
	    *pout = a->out[a->i] ;
	  return TRUE ;

acelib/filsubs.c  view on Meta::CPAN


      return path_copy ;
    }
  else
    return 0 ;  /* signals error that the path was not found */
} /* filGetFullPath */

/*******************************/

static BOOL filCheck (char *name, char *spec)
	/* allow 'd' as second value of spec for a directory */
{
  char *cp ;
  BOOL result ;
  struct stat status ;

  if (!spec) /* so filName returns full file name (for error messages) */
    return TRUE ;
				/* directory check */
  if (spec[1] == 'd'  &&
      (stat (name, &status) || !(status.st_mode & S_IFDIR)))

acelib/freesubs.c  view on Meta::CPAN

  freespecial ("") ;
  freecard (level) ;
}
 
/********************/
 
char* freecard (int level)	/* returns 0 when streamlevel drops below level */
{ 
  unsigned char *in,ch,*cp ;
  int kpar ;
  int isecho = FALSE ;		/* could reset sometime? */
  FILE *fil ;
  BOOL acceptShell, acceptCommand ;

restart :
  if (level > streamlevel)
    return 0 ;

  if (isecho)
    printf (!currfil ? "From text >" : "From file >") ;
  in = card ; --in ;

  acceptCommand = special['@'] ;
  acceptShell = special['$'] ;
 
  while (TRUE)
    { if (++in >= cardEnd)
	freeExtend (&in) ;

acelib/freesubs.c  view on Meta::CPAN

		  continue ; /* ignore carriage returns */ 
#endif
	  case '\n':		/* == '\x0a' */
	  case ';':		/* card break for multiple commands on one line */
	    goto got_line ;
	  case (unsigned char) EOF:
	  case '\0':
	    freeclose(streamlevel) ;
	    goto got_line;
	  case '\t':     /* tabs should get rounded to 8 spaces */
	    if (isecho)	/* write it out */
	      putchar (*in) ;
            *in++ = ' ' ;
            while ((in - card) % 8)
              { if (in >= cardEnd)
                  freeExtend (&in) ;
                *in++ = ' ' ;
              }
	    --in ;
	    continue ;  
	  case '/':		/* // means start of comment */
	    if ((ch = _FREECHAR) == '/')
	      { while ((ch = _FREECHAR) != '\n' && ch != (unsigned char)EOF) ;
		goto got_line ;
	      }
	    else
	      { if (isecho) putchar (*in) ;
		if (currfil)                     /* push back ch */
		  ungetc (ch, currfil) ;
		else
		  --currtext ;
	      }
	    break ;
	  case '%':		/* possible parameter */
	    --in ; kpar = 0 ;
	    while (isdigit (ch = _FREECHAR))
	      kpar = kpar*10 + (ch - '0') ;
	    if (kpar > 0 && kpar <= stream[streamlevel].npar)
	      for (cp = (unsigned char *) stackText (parStack, 
			     stream[streamlevel].parMark[kpar-1]) ; *cp ; ++cp)
		{ if (++in >= cardEnd)
		    freeExtend (&in) ;
		  *in = *cp ;
		  if (isecho)
		    putchar (*in) ;
		}
	    else
	      messout ("Parameter %%%d can not be substituted", kpar) ;
	    if (++in >= cardEnd)
	      freeExtend (&in) ;
	    *in = ch ; 
	    goto lao ; /* mieg */
	  case '\\':		/* escapes next character - interprets \n */
	    *in = _FREECHAR ;

acelib/freesubs.c  view on Meta::CPAN

		  freeExtend (&in) ;
	      }
	    break ;
	  default:
	    messerror ("freesubs got unrecognised special character 0x%x = %c\n",
		     *in, *in) ;
	  }
      else
	{ if (!isprint(*in) && *in != '\t' && *in != '\n') /* mieg dec 15 94 */
	    --in ;
	  else if (isecho)	/* write it out */
	    putchar (*in) ;
	}
    }				/* while TRUE loop */
 
got_line:
  stream[streamlevel].line++ ;
  *in = 0 ;
  if (isecho)
    putchar ('\n') ;
  pos = card ;
  _losewhite ;
  if (acceptCommand && _stepover ('@'))        /* command file */
    { char *name ;
      if ((name = freeword ()) && 
	  (fil = filopen (name, 0, "r")))
	freesetfile (fil, (char*) pos) ;
      goto restart ;
    }

acelib/helpsubs.c  view on Meta::CPAN

	  int i;
	  int matches;
	  char *s;
	  
	  /* first look for an exact case-insensitive match */
	  strcpy (filename, "");
	  for (i = 0 ; i < arrayMax(dirList) ; i++)
	    {
	      s = arr(dirList,i,char*);
	      
	      if (strcasecmp (s, subject_copy) == 0)
		{
		  sprintf(filename, "%s%s%s.%s", 
			  filGetFullPath(helpGetDir()),
			  SUBDIR_DELIMITER_STR,
			  s, HELP_FILE_EXTENSION);
		  if (filName(filename, 0, "r"))
		    break;	/* exit for-loop */

		  strcpy (filename, "");
		}

acelib/helpsubs.c  view on Meta::CPAN

	  if (strlen(filename) > 0)
	    break;		/* exit while(true) loop */

	  /* count the number of filenames starting with the
	     given subject string */
	  matches = 0;
	  for (i = 0 ; i < arrayMax(dirList) ; i++)
	    {
	      s = arr(dirList,i,char*);
	      
	      if (strncasecmp (s, subject_copy, 
			       strlen(subject_copy)) == 0)
		{
		  sprintf(filename, "%s%s%s.%s", 
			  filGetFullPath(helpGetDir()),
			  SUBDIR_DELIMITER_STR,
			  s, HELP_FILE_EXTENSION);
		  ++matches;
		}
	    }

acelib/helpsubs.c  view on Meta::CPAN

	  break;		/* exit while(true)loop */
	}
    } /* end-while(true) */

  messfree (subject_copy);


  if (strcmp(filename, "") != 0)
    return filename;		/* success */

  if ((strcasecmp(subject, "index") == 0) ||
      (strcasecmp(subject, "home") == 0) ||
      (strcasecmp(subject, "toc") == 0))
    {
      /* we asked for some kind of index-page but couldn't find it,
	 so we can always try to return the question mark '?'
	 which will ask the calling function to display a
	 dynamically created index of help-subjects. */

      strcpy (filename, "?");
      return filename;
    }

acelib/helpsubs.c  view on Meta::CPAN


      return page;
    }

  if (!(filName(helpFilename, "", "r")))
    return 0;			/* prevent error caused 
				   by unsucsessful filopen */


  /* create a page inlining the image */
  if (strcasecmp (helpFilename + (strlen(helpFilename)-4), ".gif") == 0)
    {
      page = messalloc (sizeof(HtmlPage));
      page->handle = handleCreate();
      page->htmlText = makeHtmlImagePage(helpFilename, page->handle);
      if (!(page->root = parseHtmlText(page->htmlText, page->handle)))
	htmlPageDestroy(page);

      return page;
    }

acelib/helpsubs.c  view on Meta::CPAN

   quotation mark                       &#34;  --> "    &quot;   --> "
   ampersand                            &#38;  --> &    &amp;    --> &
   less-than sign                       &#60;  --> <    &lt;     --> <
   greater-than sign                    &#62;  --> >    &gt;     --> >
*/
  
  s = cp ;

  while (*s)
    {
      if (strncasecmp (s, "&#34;", 5) == 0)
	{
	  s[0] = '"' ; s[1] = 0 ;
	  strcat (s+1, s+5) ;
	}
      else if (strncasecmp (s, "&#38;", 5) == 0)
	{
	  s[0] = '&' ; s[1] = 0 ;
	  strcat (s+1, s+5) ;
	}
      else if (strncasecmp (s, "&#60;", 5) == 0)
	{
	  s[0] = '<' ; s[1] = 0 ;
	  strcat (s+1, s+5) ;
	}
      else if (strncasecmp (s, "&#62;", 5) == 0)
	{
	  s[0] = '>' ; s[1] = 0 ;
	  strcat (s+1, s+5) ;
	}
      else if (strncasecmp (s, "&quot;", 6) == 0)
	{
	  s[0] = '"' ; s[1] = 0 ;
	  strcat (s+1, s+6) ;
	}
      else if (strncasecmp (s, "&amp;", 5) == 0)
	{
	  s[0] = '&' ; s[1] = 0 ;
	  strcat (s+1, s+5) ;
	}
      else if (strncasecmp (s, "&lt;", 4) == 0)
	{
	  s[0] = '<' ; s[1] = 0 ;
	  strcat (s+1, s+4) ;
	}
      else if (strncasecmp (s, "&gt;", 4) == 0)
	{
	  s[0] = '>' ; s[1] = 0 ;
	  strcat (s+1, s+4) ;
	}
      else if (strncasecmp (s, "&nbsp;", 4) == 0)
	{
	  s[0] = ' ' ; s[1] = 0 ;
	  strcat (s+1, s+6) ;
	}

      ++s ;
    }
 
  return ;
} /* replaceEscapeCodes */

acelib/helpsubs.c  view on Meta::CPAN


  node = makeNode (HTML_DOC, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : text inside <HTML> not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</HTML>", 7) == 0)
    {
      *cp += 7 ;
    }
  else
    {
      printf ("Warning : <HTML> tag not closed by </HTML> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN


  node = makeNode (HTML_HEAD, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : HTML inside <head> not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</HEAD>", 7) == 0)
    {
      *cp += 7 ;
    }
  else
    {
      printf ("Warning : <HEAD> tag not closed by </HEAD> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN


  node = makeNode (HTML_BODY, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : HTML inside <BODY> not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</BODY>", 7) == 0)
    {
      *cp += 7 ;
    }
  else
    {
      printf ("Warning : <BODY> tag not closed by </BODY> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN

  char *start ;

  *cp += 7 ;			/* skip <TITLE> */

  skipSpaces (cp) ;

  start = *cp ;

  while (**cp)
    {
      if (strncasecmp (*cp, "</title>", 8) == 0)
	break ;
      if (isspace((int)**cp))
	++numspaces ;
      else
	numspaces = 0 ;
      ++(*cp) ;
    }
  
  node = makeNode (HTML_TITLE, handle) ;
  

acelib/helpsubs.c  view on Meta::CPAN

  node = makeNode (HTML_HEADER, handle) ;
  node->hlevel = level ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : heading%d text not valid !!\n", level) ;
    }

  skipSpaces (cp) ;

  if ((strncasecmp (*cp, "</H", 3) == 0) &&
      (*cp)[3]-'0' == level && (*cp)[4] == '>')
    {
      *cp += 5 ;
    }
  else
    {
      printf ("Warning : <H%d> tag not closed by </H%d> !!\n", level, level) ;
    }
  
  node->left = leftnode ;

acelib/helpsubs.c  view on Meta::CPAN


  node = makeNode (HTML_CODE_STYLE, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : <code> text not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</CODE>", 7) == 0)
    {
      *cp += 7 ;
    }
  else
    {
      printf ("Warning : <CODE> tag not closed by </CODE> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN


  node = makeNode (HTML_BOLD_STYLE, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : HTML inside <B> not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</B>", 3) == 0)
    {
      *cp += 4 ;
    }
  else
    {
      printf ("Warning : <B> tag not closed by </B> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN


  node = makeNode (HTML_STRONG_STYLE, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : strong text not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</STRONG>", 9) == 0)
    {
      *cp += 9 ;
    }
  else
    {
      printf ("Warning : <STRONG> tag not closed by </STRONG> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN


  node = makeNode (HTML_ITALIC_STYLE, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : bold text not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</I>", 3) == 0)
    {
      *cp += 4 ;
    }
  else
    {
      printf ("Warning : <I> tag not closed by </I> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN

{
  HtmlNode *node ;
  int len ;
  char *start ;

  start = *cp ;

  while (**cp)
    {
      /* read until beginning of new TAG */
      if (strncasecmp (*cp, "<", 1) == 0)
	break ;
      ++(*cp) ;
    }
  
  if (*cp == start)
    {
      /* an unknown tag had been reached, the text read until that
	 will be of length zero, because parseSection() couldn't
	 recognise it, and passed the text here, where it reads
	 until it finds a '<', which it'll find imediately,
	 so the length will be zero */

      while (**cp)
	{
	  /* read until beginning of new TAG */
	  if (strncasecmp (*cp, ">", 1) == 0)
	    break ;
	  ++(*cp) ;
	}
      ++(*cp) ;
      
      node = makeNode (HTML_UNKNOWN, handle) ;

      /* copy unknown tag into node->text */
      len = (*cp-start) ;
      node->text = (char*)halloc ((len+1) * sizeof(char), handle);

acelib/helpsubs.c  view on Meta::CPAN

  int hlen = -1;		/* init for compiler happiness */
  int numspaces ;
  char *hstart = NULL;		/* init for compiler happiness */
  BOOL HAVE_HREF, IS_NAME_REF ;

  *cp += 2 ;			/* skip '<A' */

  skipSpaces (cp) ;

  IS_NAME_REF = FALSE ;
  if (strncasecmp (*cp, "HREF=", 5) == 0)
    {
      HAVE_HREF = TRUE ;
      *cp += 5 ;		/* skip 'HREF=' */
    }
  else if (strncasecmp (*cp, "NAME=", 5) == 0)
    {

      HAVE_HREF = TRUE ; 
      IS_NAME_REF = TRUE ;
      *cp += 5 ;		/* skip 'NAME=' */
    }
  else
    {
      printf ("Warning : anchor tag <A without argument !!\n");
      HAVE_HREF = FALSE ;
    }

  if (HAVE_HREF)
    hstart = *cp ;

  /* parse the href destination or if no arg given
     just forward to next '>'*/
  numspaces = 0 ;
  while (**cp)
    {
      if (strncasecmp (*cp, ">", 1) == 0)
	break ;
      if (isspace((int)**cp))
	++numspaces ;
      else
	numspaces = 0 ;
      ++(*cp) ;
    }
  if (HAVE_HREF)
    hlen = (*cp-hstart) - numspaces ;

acelib/helpsubs.c  view on Meta::CPAN

    }
  else
    node->link = 0 ;		/* no link then */

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : referenced text not valid !!\n") ;
    }

  skipSpaces (cp) ;
  if (strncasecmp (*cp, "</a>", 4) == 0)
    {
      *cp += 4 ;
    }
  else
    {
      printf ("Warning : anchor tag not closed by </A> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

acelib/helpsubs.c  view on Meta::CPAN

  *cp += 4 ;			/* skip '<IMG' */

  skipSpaces (cp) ;

  start = *cp ;

  /* read in the arguments list until next '>'*/
  numspaces = 0 ;
  while (**cp)
    {
      if (strncasecmp (*cp, ">", 1) == 0)
	break ;
      if (isspace((int)**cp))
	++numspaces ;
      else
	numspaces = 0 ;
      ++(*cp) ;
    }

  /* the length of everything between the 
     end of <IMG and the end of the args or the next > */
  len = (*cp-start) - numspaces ;

  if (**cp)
    *cp += 1 ;			/* skip '>' */

  /* now find the SRC= argument */

  s = start ;
  while (*s)
    {
      if (strncasecmp (s, "src=", 4) == 0)
	{
	  HAVE_SRC = TRUE ;
	  break ;
	}
      ++s ;
    }
  if (HAVE_SRC)
    {
      s += 4 ;			/* skip 'src=' */
      len -= 4;

acelib/helpsubs.c  view on Meta::CPAN

{
  HtmlNode *node, *leftnode, *rightnode ;
  int lstyle = style ;

  skipSpaces (cp) ;

  /* check, whether the next tag is a valid listitem tag */
  
  /* with <DL> list <LI> and <DD> items are allowed */
  if (lstyle == HTML_LIST_NOINDENT &&
      !(strncasecmp (*cp, "<dd>", 4) == 0 ||
	strncasecmp (*cp, "<li>", 4) == 0 ||
	strncasecmp (*cp, "<dt>", 4) == 0))
    {
      *resultnode = 0 ;
      return FALSE ;
    }
  /* only <LI> items in <UL> or <OL> lists */
  else if ((lstyle == HTML_LIST_BULLET || lstyle == HTML_LIST_NUMBER) &&
	   !(strncasecmp (*cp, "<li>", 4) == 0))
    {
      *resultnode = 0 ;
      return FALSE ;
    }

  if (lstyle == HTML_LIST_NOINDENT)
    {
      /* in <DL> list a <DD> item becomes indented but no bullet */
      if (strncasecmp (*cp, "<dd>", 4) == 0)
	lstyle = HTML_LIST_NOBULLET ;
      else if (strncasecmp (*cp, "<dt>", 4) == 0)
	lstyle = HTML_LIST_NOINDENT_NOBULLET ;
    }
  *cp += 4 ;
  /* now cp stands right after an <LI> and parses the following
     as a normal section */
  
  parseSection (cp, &leftnode, handle) ;
  
  node = makeNode (HTML_LISTITEM, handle) ;
  
  node->left = leftnode ;
  node->lstyle = lstyle ;

  if (parseListItem (style, cp, &rightnode, handle))
    {

acelib/helpsubs.c  view on Meta::CPAN

} /* parseListItem */
/************************************************************/

static BOOL parseList (int style, char **cp, HtmlNode **resultnode, STORE_HANDLE handle)
{
  HtmlNode *node, *leftnode ;

  *cp += 4 ;			/* skip <UL> */

#ifdef ALLOW_SECONDLEVEL_LIST_LIST_DOESN_T_YET_WORK
  if (strncasecmp (*cp, "<ul>", 4) == 0 ||
      strncasecmp (*cp, "<ol>", 4) == 0 ||
      strncasecmp (*cp, "<dl>", 4) == 0)
    {
      /* create list item for this list-in-list */
      node = makeNode (HTML_LISTITEM, handle) ;
      
      node->left = leftnode ;
      node->lstyle = lstyle ;

    }
#endif

  parseListItem (style, cp, &leftnode, handle);
  
  skipSpaces (cp) ;
  
  if ((style == HTML_LIST_BULLET && strncasecmp (*cp, "</ul>", 5) == 0) ||
      (style == HTML_LIST_NOINDENT && strncasecmp (*cp, "</dl>", 5) == 0) ||
      (style == HTML_LIST_NUMBER && strncasecmp (*cp, "</ol>", 5) == 0))
    {
      *cp += 5 ;		/* skip </ul> */
    }
  else
    {
      if (style == HTML_LIST_BULLET)
	printf ("Warning : found <UL> without closing </UL> tag !!\n") ;
      else if (style == HTML_LIST_NOINDENT)
	printf ("Warning : found <DL> without closing </DL> tag !!\n") ;
      else if (style == HTML_LIST_NUMBER)

acelib/helpsubs.c  view on Meta::CPAN

	printf ("Warning : found <PRE> tag "
		"without closing </PRE> tag !!\n") ;
      if (MODE_BLOCKQUOTE)
	printf ("Warning : found <BLOCKQUOTE> tag "
		"without closing </BLOCKQUOTE> tag !!\n") ;

      *resultnode = 0 ;
      return TRUE ;
    }

  if (strncasecmp (*cp, "<!--", 4) == 0)
    {
      if (!parseComment (cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "<html>", 6) == 0)
    {
      if (!(parseHtml (cp, &leftnode, handle)))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</html>", 7) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<head>", 6) == 0)
    {
      if (!(parseHead (cp, &leftnode, handle)))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</head>", 7) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<body>", 6) == 0)
    {
      if (!(parseBody (cp, &leftnode, handle)))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</body>", 7) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<title>", 7) == 0)
    {
      if (!parseTitle (cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if ((strncasecmp (*cp, "<H", 2) == 0) &&
	   (*cp)[2]-'0' >= 1 && (*cp)[2]-'0' <= 7 && (*cp)[3] == '>')
    {
      if (!parseHeader (cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if ((strncasecmp (*cp, "</H", 3) == 0) &&
	   (*cp)[3]-'0' >= 1 && (*cp)[3]-'0' <= 7 && (*cp)[4] == '>')
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<a", 2) == 0 &&
	   (isspace((int)(*cp)[2]) || (*cp)[2] == '\n'))
    {
      if (!parseHref (cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</a>", 4) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<img", 4) == 0)
    {
      if (!parseImage (cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "<ul>", 4) == 0)
    {
      if (!parseList (HTML_LIST_BULLET, cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "<ol>", 4) == 0)
    {
      if (!parseList (HTML_LIST_NUMBER, cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "<dl>", 4) == 0)
    {
      if (!parseList (HTML_LIST_NOINDENT, cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "<li>", 4) == 0)
    {
      /* LI isn't a section, so we've hit the end of a section */
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<dd>", 4) == 0)
    {
      /* DD isn't a section, so we've hit the end of a section */
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<dt>", 4) == 0)
    {
      /* DT isn't a section, so we've hit the end of a section */
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "</ul>", 5) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "</ol>", 5) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "</dl>", 5) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<hr>", 4) == 0)
    {
      leftnode = makeNode (HTML_RULER, handle) ;
      *cp += 4 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "<p>", 3) == 0)
    {
      leftnode = makeNode (HTML_PARAGRAPH, handle) ;
      *cp += 3 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "</p>", 4) == 0)
    {
      leftnode = makeNode (HTML_PARAGRAPH, handle) ;
      *cp += 4 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "<br>", 4) == 0)
    {
      leftnode = makeNode (HTML_LINEBREAK, handle) ;
      *cp += 4 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "<pre>", 5) == 0)
    {
      if (MODE_PREFORMAT)
	printf ("Warning : nesting of <PRE> tags without effect !!\n") ;
      MODE_PREFORMAT = TRUE ;

      leftnode = makeNode (HTML_STARTPREFORMAT, handle) ;
      *cp += 5 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "</pre>", 6) == 0)
    {
      if (!MODE_PREFORMAT)
	printf ("Warning : found </PRE> without preceeding <PRE>\n") ;
      MODE_PREFORMAT = FALSE ;

      leftnode = makeNode (HTML_ENDPREFORMAT, handle) ;
      *cp += 6 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "<blockquote>", 12) == 0)
    {
      if (!MODE_BLOCKQUOTE)
	{
	  leftnode = makeNode (HTML_STARTBLOCKQUOTE, handle) ;
	  MODE_BLOCKQUOTE = TRUE ;
	}
      else
	printf ("Warning : nesting of <BLOCKQUOTE> tags "
		"without effect !!\n") ;

      *cp += 12 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "</blockquote>", 13) == 0)
    {
      if (MODE_BLOCKQUOTE)
	{
	  leftnode = makeNode (HTML_ENDBLOCKQUOTE, handle) ;
	  MODE_BLOCKQUOTE = FALSE ;
	}
      else
	printf ("Warning : found </BLOCKQUOTE> "
		"without preceeding <BLOCKQUOTE>\n") ;

      *cp += 13 ;
      skipSpaces (cp) ;
    }
  else if (strncasecmp (*cp, "<code>", 6) == 0)
    {
      if (!(parseCode (cp, &leftnode, handle)))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</code>", 7) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<b>", 3) == 0)
    {
      if (!(parseBold (cp, &leftnode, handle)))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</b>", 4) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<strong>", 8) == 0)
    {
      if (!(parseStrong (cp, &leftnode, handle)))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</strong>", 9) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else if (strncasecmp (*cp, "<i>", 3) == 0)
    {
      if (!(parseItalic (cp, &leftnode, handle)))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  else if (strncasecmp (*cp, "</i>", 4) == 0)
    {
      *resultnode = 0 ;
      return TRUE ;
    }
  else
    {
      if (!parseText (cp, &leftnode, handle))
	{
	  *resultnode = 0 ;
	  return FALSE ;
	}
    }
  
  node = makeNode (HTML_SECTION, handle) ;
  node->left = leftnode ;
  if (leftnode->type == 0)
    {
      printf ("section on section \n") ;
    }
  if (parseSection (cp, &rightnode, handle))
    {
      node->right = rightnode ;
      *resultnode = node ;
      return TRUE ;
    }
  else
    {
      node->right = 0 ;

acelib/messubs.c  view on Meta::CPAN

  return(buf_ptr) ;
  }


/********************** crash file/line info routines ************************/
/* When the acedb needs to crash because there has been an unrecoverable     */
/* error we want to output the file and line number of the code that         */
/* detected the error. Here are the functions to do it.                      */
/*                                                                           */

/* Applications can optionally initialise the error handling section of the  */
/* message package, currently the program name can be set (argv[0] in the    */
/* main routine) as there is no easy way to get at this at run time except   */
/* from the main.                                                            */
/*                                                                           */
UTIL_FUNC_DEF void messErrorInit(char *progname)
  {

  if (progname != NULL) messageG.progname = strnew(filGetFilename(progname), 0) ;

  return ;

acelib/texthelp.c  view on Meta::CPAN

      return FALSE ;
    }
  
  for (i = 0, x = 0 ; i < arrayMax(dirList) ; i++)
    {
      cp = arr(dirList,i,char*) ;
      if (!cp || !*cp || !strlen(cp))
	continue ;
      if (helpFilename)
	{
	  if (strncasecmp(filGetFilename(helpFilename),cp,
			  strlen(filGetFilename(helpFilename))) != 0)
	    continue;
	}

      n = strlen(cp) ;
      if (n > 5 && !strcmp("."HELP_FILE_EXTENSION,cp + n - 5))
	*(cp + n - 5) = 0 ; 

      x += n + 1 ;
      if (x > 50) { x = n + 1 ; freeOut("\n") ;}

acelib/timesubs.c  view on Meta::CPAN

    { 
      t |= tm->tm_year << 9;
      if (wantMonth)
	t |= (tm->tm_mon + 1) << 5;
      if (wantDay)
	t |= tm->tm_mday;
    }
  else
    {
      if (wantSecs)
	t |= 1 + tm->tm_sec;

      if (wantMins)
	t |= (tm->tm_min + 1) << 6;

      if (wantHours)
	t |= (tm->tm_hour + 1) << 12;
      
      if (wantDay)
	t |= tm->tm_mday << 17;
      

acelib/timesubs.c  view on Meta::CPAN

      
      t |= (tm->tm_year - 90) << 26; 
    }
  return t;
}
  
static void timeStruct(struct tm *tm, mytime_t t,
		BOOL *wantMonth, BOOL *wantDay, BOOL *wantHours,
		BOOL *wantMins, BOOL *wantSecs)
{
  unsigned int secs;
  unsigned int mins;
  unsigned int hours;
  unsigned int day;
  unsigned int month;
  unsigned int year;

  if (!t)
    {
      /* fprintf (stderr, "timeStruct() warning: received null t\n"); */
      tm->tm_year = 0;
      tm->tm_mon = 0;
      tm->tm_mday = 0;
      tm->tm_hour = 0;
      tm->tm_min = 0;
      tm->tm_sec = 0;
      tm->tm_wday = 0;
      tm->tm_yday = 0;
      tm->tm_isdst = -1;
      return;
    }

  secs = t & 0x3f;
  mins = (t >> 6) & 0x3f;
  hours = (t >> 12) & 0x1f;
  day = (t >> 17) & 0x1f;
  month = ( t >> 22) & 0xf;
  year = ( t >> 26) &0x3f;
  
  if (year == 0) /* before 1990, use time-less format. */
    { 
      secs = mins = hours = 0;
      day = t & 0x1f;
      month = (t >> 5) & 0x0f;
      year = (t >> 9) & 0x7f;
    }
  else 
    year += 90; 
  
  tm->tm_year = year;
  
  if (month == 0)

acelib/timesubs.c  view on Meta::CPAN


  if (mins == 0)
    { *wantMins = FALSE;
      tm->tm_min = 0;
    }
  else
    { *wantMins = TRUE;
      tm->tm_min = mins - 1;
    } 
  
  if (secs == 0)
    { *wantSecs = FALSE;
      tm->tm_sec = 0;
    }
  else
    { *wantSecs = TRUE;
      tm->tm_sec = secs -1;
    }
  tm->tm_isdst = -1;

  /* 
   * strftime() was crashing under various circumstances.  These
   * lines force tm to be internally consistent - LS 2/17/98 
   */
  tm->tm_wday = tm->tm_yday = 0;
  mktime(tm); /* mhmp 21.10.98 */
}

acelib/timesubs.c  view on Meta::CPAN

    goto done ;
  if (*cp != '_' && *cp != ' ') /* separator */
    return 0;
  ++cp ;
  if ((v = sscanf (cp, "%d%n", &ts.tm_hour, &n)) != 1)
    goto done ;
  if (ts.tm_hour > 23)
    return 0;
  wantHours = TRUE;
  ts.tm_min = 0;
  ts.tm_sec = 0;
  cp += n ;
  if ((v = sscanf (cp, ":%d%n", &ts.tm_min, &n)) != 1)
    goto done ;
  if (ts.tm_min > 59)
    return 0;
  wantMins = TRUE;
  cp += n ;
  if ((v = sscanf (cp, ":%d%n", &ts.tm_sec, &n)) != 1)
    goto done ;
  if (ts.tm_sec > 59)
    return 0;
  wantSecs = TRUE;
  cp += n ;

 done:
  if (*cp) return 0;	/* incomplete */
   
  if (ts.tm_year < 1900)	/* convert into 4 digit-year */
    { if (ts.tm_year > 50) 
	ts.tm_year += 1900 ;

acelib/timesubs.c  view on Meta::CPAN

  BOOL wantMonth1, wantDay1, wantHours1, wantMins1, wantSecs1;
  BOOL wantMonth2, wantDay2, wantHours2, wantMins2, wantSecs2;
  double d;

  timeStruct (&ts1, t1, &wantMonth1, &wantDay1, &wantHours1, &wantMins1, &wantSecs1) ;
  timeStruct (&ts2, t2, &wantMonth2, &wantDay2, &wantHours2, &wantMins2, &wantSecs2) ;

  if (!wantMins1 || !wantMins2)
    return FALSE ;

  ts1.tm_sec = ts2.tm_sec = 0 ;

  d = difftime (mktime (&ts2), mktime (&ts1)) ;
  d /= 60;
  *diff = (int)d ;

  return TRUE ;
}

/**********************************************/

acelib/timesubs.c  view on Meta::CPAN

  BOOL wantMonth1, wantDay1, wantHours1, wantMins1, wantSecs1;
  BOOL wantMonth2, wantDay2, wantHours2, wantMins2, wantSecs2;
  double d;

  timeStruct (&ts1, t1, &wantMonth1, &wantDay1, &wantHours1, &wantMins1, &wantSecs1) ;
  timeStruct (&ts2, t2, &wantMonth2, &wantDay2, &wantHours2, &wantMins2, &wantSecs2) ;

  if (!wantHours1 || !wantHours2)
    return FALSE ;

  ts1.tm_sec = ts2.tm_sec = 0 ;
  ts1.tm_min = ts2.tm_min = 0 ;

  d = difftime (mktime (&ts2), mktime (&ts1)) ;
  d /= (60 * 60);
  *diff = (int)d ;

  return TRUE ;
}

/**********************************************/

acelib/timesubs.c  view on Meta::CPAN

  BOOL wantMonth1, wantDay1, wantHours1, wantMins1, wantSecs1;
  BOOL wantMonth2, wantDay2, wantHours2, wantMins2, wantSecs2;
  double d ;

  timeStruct (&ts1, t1, &wantMonth1, &wantDay1, &wantHours1, &wantMins1, &wantSecs1) ;
  timeStruct (&ts2, t2, &wantMonth2, &wantDay2, &wantHours2, &wantMins2, &wantSecs2) ;

  if (!wantDay1 || !wantDay2)
    return FALSE ;

  ts1.tm_sec = ts2.tm_sec = 0 ;	/* zero hours:mins:secs so get calendar days */
  ts1.tm_min = ts2.tm_min = 0 ;
  ts1.tm_hour = ts2.tm_hour = 0 ;

  d = difftime (mktime (&ts2), mktime (&ts1)) ;

  d /= (24 * 3600) ;
  *diff = (int)d ;

  return TRUE ;
}

acelib/timesubs.c  view on Meta::CPAN

Ici, chaque date,  quel que soit son niveau de detail, est consideree
comme un intervalle.
1996-05  = [1996-05-01_00:00:00 , 1996-05-31_23:59:59] = INTER
date == 1996-05 <==> date appartient a INTER
date < 1996-05  <==> date < inf(INTER)

Appliquer cette regle aux dates "completees" (avec hms) est discutable.
Pour beaucoup,  1998-10-22_11:07 > 1998-10-22_11
surtout quand on vient de louper le train de 11h.
Cela sous-entend qu'il faudrait completer les dates
hms jusqu'a la seconde avec des zeros.
1998-10-22_11 -> 1998-10-22_11:00:00
*/
{
  int yearDiff, monthDiff, dayDiff, hourDiff, minDiff, secDiff;

  /*******************/
  /* year difference */
  timeDiffYears (timeLeft, timeRight, &yearDiff);
  
  if (yearDiff > 0)
    return (op < 0) ;

  if (yearDiff < 0)
    return (op > 0) ;

acelib/timesubs.c  view on Meta::CPAN

    return (op == 0) ;

  if (minDiff > 0)
    return (op < 0) ; 

  if (minDiff < 0)
    return  (op > 0) ;
	  
  /* minDiff == 0 */
  /*********************/
  /* second difference */
  if (!timeDiffSecs (timeLeft, timeRight, &secDiff))
    /* can't decide on seconds */
    return (op == 0) ;

  if (secDiff > 0)
    return (op < 0) ; 

  if (secDiff < 0)
    return  (op > 0) ;
	  
  /* secDiff == 0 */
  /*********************/
    /* can't decide on 1/10 of second */
  return (op == 0) ;
} /* timeComparison */

/*************************************************************/

char *timeDiffShow (mytime_t t1, mytime_t t2) 
{
  static char buf[25] ;
  struct tm ts1, ts2;
  BOOL wantMonth1, wantDay1, wantHours1, wantMins1, wantSecs1;

acelib/timesubs.c  view on Meta::CPAN

  else
    *buf = 0 ;

  timeStruct(&ts1, t1, &wantMonth1, &wantDay1, &wantHours1, &wantMins1, &wantSecs1);
  timeStruct(&ts2, t2, &wantMonth2, &wantDay2, &wantHours2, &wantMins2, &wantSecs2);

  ydiff = ts2.tm_year - ts1.tm_year ;
  mdiff = ts2.tm_mon - ts1.tm_mon ;
  hdiff = ts2.tm_hour - ts1.tm_hour ;
  mindiff = ts2.tm_min - ts1.tm_min ;
  sdiff = ts2.tm_sec - ts1.tm_sec ;
     
  if (wantSecs1 && wantSecs2)
    { if (sdiff < 0) { sdiff += 60 ; --mindiff ; } }
  else
    ts1.tm_sec = ts2.tm_sec = 0 ;
  if (wantMins1 && wantMins2)
    { if (mindiff < 0) { mindiff += 60 ; --hdiff ; } }
  else
    ts1.tm_min = ts2.tm_min = 0 ;
  if (wantHours1 && wantHours2)
    { if (hdiff < 0) { hdiff += 24 ; } }
  else
    ts1.tm_hour = ts2.tm_hour = 0 ;
  if (wantDay1 && wantDay2)
    {				/* convert months/years to days */

acelib/wh/mystdlib.h  view on Meta::CPAN

    stdlibs do not always agree, I found easier to look by hand 
    and copy here my human interpretation of what I need.
    Examples of problems are: reservations for multi processor
    architectures on some Silicon machines, necessity to define myFile_t on
    some machines and not on others etc.
 * Exported functions:
 * HISTORY:
 * Last edited: Dec  4 16:03 1998 (fw)
 * * Feb  6 14:04 1997 (srk)
 * * Jun 11 16:46 1996 (rbrusk): WIN32 tace fixes
 * * Jun 10 17:46 1996 (rbrusk): strcasecmp etc. back to simple defines...
 * * Jun  9 19:29 1996 (rd)
 * * Jun 5 15:36 1996 (rbrusk): WIN32 port details
 *	-	Added O/S specific pathname syntax token conventions as #defined symbols
 * * Jun 5 10:06 1996 (rbrusk): moved X_OK etc. from filsubs.c for IBM
 * Jun  4 23:33 1996 (rd)
 * * Jun  4 21:19 1996 (rd): WIN32 changes
 * Created: Fri Jun  5 18:29:09 1992 (mieg)
 *-------------------------------------------------------------------
 */

acelib/wh/mystdlib.h  view on Meta::CPAN

#define pclose _pclose

/* rename to actual WIN32 built-in functions
* (rbrusk): this little code generated a "trigraph" error message
* when built in unix with the gcc compiler; however, I don't understand
* why gcc even sees this code, which is #if defined(WIN32)..#endif protected.
* Changing these to macros is problematic in lex4subs.c et al, which expects
* the names as function names (without parentheses.  So, I change them back..
* If the trigraph error message returns, look for another explanation,
* like MSDOS carriage returns, or something? */
#define strcasecmp  _stricmp 
#define strncasecmp  _strnicmp 
#endif /* WIN32 */

#else  /* not POSIX etc. e.g. SUNOS */

/* local versions of general types */

#if defined(ALLIANT) || defined (DEC) || defined(MAC_AUX) || defined(MACINTOSH)
  typedef unsigned int mysize_t ;
#elif defined(SGI)
  typedef unsigned mysize_t ;

acelib/wh/mystdlib.h  view on Meta::CPAN


/* string and memory stuff */

#include <memory.h>
#include <string.h>


/* missing */
#if defined(DEC) || defined(MACINTOSH) || defined (SUN) || defined (NEC)|| defined(HP) || defined(IBM)
/* case-insensitive string comparison */
int     strcasecmp (const char *a, const char *b) ;
int     strncasecmp(const char *s1, const char *s2, mysize_t n);
#endif

#ifndef	__malloc_h
void free (void *block) ;  /* int on SUN, void on SGI etc */
#endif

/* system functions and sorts - simplest to give full prototypes for all */
int      system    (const char *command);
#ifndef IBM
void     exit      (int status); 

docs/ACEDB.HOWTO  view on Meta::CPAN


		admin e5cc20aa1a8f3e7e5b29728bbd1355d8

        c. Find the file named serverpasswd.wrm located in the wspec/ subdirectory
	   of the acedb database directory.  Add these two lines to the end of the file:

                admin: admin
	        admin e5cc20aa1a8f3e7e5b29728bbd1355d8

            The first line tells the server that the "admin" user has administrative
            access, and can start and stop the server.  The second line says that
	    "admin" has the password encoded in the numbers.

        d. If you want to create additional users with read-only or read/write,
           permissions, you can do so by generating more user names and password
	   hashes with makeUserPasswd, and entering them into the serverpasswd.wrm
	   file as described before.  Here is an example that grants "fred" and "ethel"
           read/write access, and grants "ricky" read-only access:

           admin: admin
           write: fred ethel

docs/ACE_SERVER_TRAPS.HOWTO  view on Meta::CPAN

   The moviedb database is the best simple example of a database.
   
  Editors
  
   ACEDB is picky about its ascii. vi works great. Can't vouch for emacs
   ;-). Don't use anything nasty like a word processor.
   
  White Space
  
   It really likes alignment, and it likes tabs. Combining tabs and
   spaces kills otherwise perfectly good models every five seconds.
   
    To Do
    
   Solve the mysteries of the failure of AceBrowser. Every other means of
   access works now.

References

   1. file://localhost/home/lstein/projects/Ace-perl/docs/SERVER_INSTALLATION.HOWTO
   2. http://www.spatialfocus.com/

docs/ACE_SERVER_TRAPS.HOWTO.html  view on Meta::CPAN

<p><h4>server.log</h4></p>
<p>The server really wants a <em>server.log</em> file, writable by the user to whom the <em>gifaceserver</em> is assigned in the <em>inetd.conf</em> file.  We created one by opening the <em>gifaceserver</em> on a fake port number (12345):</p>
<p><em> /usr/local/bin/gifaceserver /home/httpd/database/contacts 12345 1200:1200:10</em></p> 
<p><h2>Models</h2></p>
<p><h3>Documentation</h3></p>
The <strong>best</strong> documentation for models is in <em>/acedocs/exploring/*.</em>  The table of contents is in <em>/acedocs/exploring/toc_models.html</em>.  Unfortunately, like all the ACEDB documentation, it uses absolute pathnames.  We have c...
<p>The moviedb database is the best simple example of a database.</p>
<p><h3>Editors</h3></p>
<p>ACEDB is picky about its ascii.  <em>vi</em> works great.  Can't vouch for <em>emacs</em> ;-).  <strong>Don't</strong> use anything nasty like a word processor.</p>
<p><h3>White Space</h3></p>
<p>It really likes alignment, and it likes tabs.  Combining tabs and spaces kills otherwise perfectly good models every five seconds.</p>
<p><h4>To Do</h4></p>
Solve the mysteries of the failure of AceBrowser.  Every other means of access works now.</p>
</body>
</html>

docs/GFF_Spec.html  view on Meta::CPAN

version 1 of GFF you had to write 0 in such circumstances.)<P>

 <dt>&#060;strand&#062; 
 <dd> One of '+', '-' or '.'.  '.' should be used when
strand is not relevant, e.g. for dinucleotide repeats.<P>

 <dt>&#060;frame&#062;
 <dd> One of '0', '1', '2' or '.'.  '0' indicates that the specified
region is in frame, i.e. that its first base corresponds to the first
base of a codon.  '1' indicates that there is one extra base,
i.e. that the second base of the region corresponds to the first base
of a codon, and '2' means that the third base of the region is the
first base of a codon.  If the strand is '-', then the first base of
the region is value of &#060;end&#062;, because the corresponding
coding region will run from &#060;end&#062; to &#060;start&#062; on
the reverse strand.  As with &#060;strand&#062;, if the frame is not
relevant then set &#060;frame&#062; to '.'.  
It has been pointed out that "phase" might be a better descriptor than
"frame" for this field.<P>

 <dt><A NAME="group_field">[group] </A>

docs/GFF_Spec.html  view on Meta::CPAN

change it.  The current version is 2. (<b>Version 2 change</b>!)

  <dt><pre> ##source-version {source} {version text} </pre>
  <dd> So that people can record what version of a program or package was
used to make the data in this file. I suggest the version is text
 without whitespace.  That allows things like 1.3, 4a etc.

  <dt> <pre> ##date {date} </pre>
  <dd> The date the file was made, or perhaps that the prediction
programs were run.  We suggest to use astronomical format: 1997-11-08
for 8th November 1997, first because these sort properly, and second
to avoid any US/European bias.

<dt> <pre> 
 ##DNA {seqname}
 ##acggctcggattggcgctggatgatagatcagacgac
 ##...
 ##end-DNA
</pre>

<dd> To give a DNA sequence.  Several people have pointed out that it may

docs/GFF_Spec.html  view on Meta::CPAN

971028 rd: I changed the comment initiator to '#' from '//' because a 
single symbol is easier for simple parsers.<P>

971028 rd: We also now allow extra text after &#060;group&#062;
without a comment character, because this immediately proved useful.<P>

971028 rd: I considered switching from start-end notation to
start-length notation, on the suggestion of Anders Krogh.  This seems
nicer in many cases, but is a debatable point.  I then switched back!<P>

971028 rd: I added the section about name space.<P>

971108 rd: added ## line proposals - moved them into main text 971113.<P>

971113 rd: added extra "source" field as discussed at Newton Institute
meeting 971029.  There are two main reasons.  First, to help prevent
name space clashes -- each program would have their own source
designation.  Second, to help reuse feature names, so one could have
"exon" for exon predictions from each prediction program.<P>

971113 rd: added section on mailing list.<P>

980909 ihh: fixed some small things and put this page on the Sanger
GFF site.<P>

981216 rd: introduced version 2 changes.<P>

990226 rbsk: incorporated amendments to the version 2 specification as follows:<P>
<UL>
     <LI>Non-printing characters (e.g. newlines, tabs) in Version 2 double quoted
"free text values" must be explicitly represented by their C (UNIX) style 

examples/ace.pl  view on Meta::CPAN

       -login <user>     Username
       -pass <pass>      Password
       -tcsh             Use T-shell completion mode
       -save             Save database updates automatically
       -exec <command>   Run a command and quit

Respects the environment variables \$ACEDB_HOST and \$ACEDB_PORT, if present.
You can edit the command line using the cursor keys and emacs style
key bindings.  Use up and down arrows (or ^P, ^N) to access the history.
The tab key completes partial commands.  In tcsh mode, the tab key cycles 
among the completions, otherwise pressing the tab key a second time lists 
all the possibilities.

You may use multiple -exec switches to run a sequence of commands, or
separate multiple commands in a single string by semicolons:

    ace.pl -e 'find Author Thierry-Mieg*' -e 'show'
    ace.pl -e 'find Author Thierry-Mieg*; show'

Server URLs:
  rpcace://hostname:port   RPC server

util/ace.PLS  view on Meta::CPAN

       -login <user>     Username
       -pass <pass>      Password
       -tcsh             Use T-shell completion mode
       -save             Save database updates automatically
       -exec <command>   Run a command and quit

Respects the environment variables \$ACEDB_HOST and \$ACEDB_PORT, if present.
You can edit the command line using the cursor keys and emacs style
key bindings.  Use up and down arrows (or ^P, ^N) to access the history.
The tab key completes partial commands.  In tcsh mode, the tab key cycles 
among the completions, otherwise pressing the tab key a second time lists 
all the possibilities.

You may use multiple -exec switches to run a sequence of commands, or
separate multiple commands in a single string by semicolons:

    ace.pl -e 'find Author Thierry-Mieg*' -e 'show'
    ace.pl -e 'find Author Thierry-Mieg*; show'

Server URLs:
  rpcace://hostname:port   RPC server



( run in 1.583 second using v1.01-cache-2.11-cpan-39bf76dae61 )