Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80607272
bibformat.in
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Sep 1, 15:39
Size
3 KB
Mime Type
text/x-c
Expires
Tue, Sep 3, 15:39 (2 d)
Engine
blob
Format
Raw Data
Handle
20406023
Attached To
R3600 invenio-infoscience
bibformat.in
View Options
## $Id$
## Script that calls FlexElink on bibliographic data in XML MARC OAI.
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002, 2003, 2004, 2005 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## read config variables:
#include "config.wml"
#include "configbis.wml"
#include "cdswmllib.wml"
## start PHP:
<protect>#!</protect><PHP> -q
#!/soft/bin/php -q
<?
<protect>## $Id$</protect>
<protect>## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.</protect>
$__version__ = "<: print generate_pretty_version_string('$Id$'); :>";
define( GLOBALCONFIG, "<LIBDIR>/php/cdsware/bibformat/common/global.inc.php");
### okay, config read, from now on the script can continue ###
<protect>
//======================================================================
function getTime()
{
list($sec, $usec)=explode(" ", microtime());
return (float)$sec+(float)$usec;
}
//======================================================================
//======================================================================
// Main
//======================================================================
require(GLOBALCONFIG);
include_once(MAIN);
define(DEFAULT_ITYPE, "DEFAULT");
define(DEFAULT_OTYPE, "DEFAULT");
$itype=DEFAULT_ITYPE;
$otype=explode(",", DEFAULT_OTYPE);
if(count($argv)>3)
{
print "Usage:\n\tbibformat [itype=<input type>] [otype=<output type>]\n";
exit;
}
foreach($argv as $value)
{
if ($value == "-V" || $value == "--version") {
print $__version__."\n";
exit();
}
$par=explode("=", strtoupper(trim($value)));
if(count($par)>1)
{
if($par[0]=="ITYPE")
{
if(trim($par[1])!="")
{
$itype=$par[1];
}
}
elseif($par[0]=="OTYPE")
{
if(trim($par[1])!="")
{
$otype=explode(",", $par[1]);
}
}
}
}
$fxk=new FlexElink();
$error=$fxk->initialise("OAIMARC");
$err_fh=fopen("php://stderr", "w");
if($error)
{
fputs($err_fh, "Error initialising: $error");
exit;
}
$stime=getTime();
$code=0;
$count_rec=0;
while(1)
{
list($code, $res)=$fxk->getRecordResult($otype);
if($code<0) break;
if($code==0)
{
fputs($err_fh, "--------------------------------------------------------\n");
fputs($err_fh, "Errors processing record# $count_rec\n");
fputs($err_fh, "$res\n");
fputs($err_fh, "--------------------------------------------------------\n");
continue;
}
print eval("?>$res<?");
$count_rec++;
}
$etime=getTime();
$total_time=$etime-$stime;
fputs($err_fh, "--------------------------------------------------------\n");
fputs($err_fh, "Total processed records: $count_rec\n");
fputs($err_fh, "Total time: $total_time sec\n");
fputs($err_fh, "Avg. time per record: ".$total_time/$count_rec." sec\n");
fputs($err_fh, "--------------------------------------------------------\n");
fclose($err_fh);
?>
</protect>
Event Timeline
Log In to Comment