Import Geant4 6.1.0 source tree
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRep.cc,v 1.20 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepFile.cc,v 1.8 2003/07/12 19:48:15 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// Joseph Perl 1 October 2001
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepFileSceneHandler.cc,v 1.17 2003/12/09 15:39:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4HepRepFileSceneHandler.cc,v 1.18 2004/03/15 08:00:22 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// Joseph Perl 27th January 2002
|
||||
@@ -59,6 +59,7 @@ G4int G4HepRepFileSceneHandler::fSceneIdCount = 0;
|
||||
G4int G4HepRepFileSceneHandler::fSceneCount = 0;
|
||||
// No. of extanct scene handlers.
|
||||
|
||||
|
||||
G4HepRepFileSceneHandler::G4HepRepFileSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4VSceneHandler(system, fSceneIdCount++, name),
|
||||
@@ -72,8 +73,10 @@ G4HepRepFileSceneHandler::G4HepRepFileSceneHandler(G4VGraphicsSystem& system,
|
||||
fileCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
G4HepRepFileSceneHandler::~G4HepRepFileSceneHandler() {}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::EstablishSpecials
|
||||
(G4PhysicalVolumeModel& pvModel) {
|
||||
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
|
||||
@@ -81,14 +84,17 @@ void G4HepRepFileSceneHandler::EstablishSpecials
|
||||
&fpCurrentLV);
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::BeginModeling() {
|
||||
G4VSceneHandler::BeginModeling(); // Required: see G4VSceneHandler.hh.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::EndModeling() {
|
||||
G4VSceneHandler::EndModeling(); // Required: see G4VSceneHandler.hh.
|
||||
}
|
||||
|
||||
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
void G4HepRepFileSceneHandler::PrintThings() {
|
||||
G4cout <<
|
||||
@@ -107,6 +113,7 @@ void G4HepRepFileSceneHandler::PrintThings() {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Box& box) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -118,6 +125,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Box& box) {
|
||||
G4VSceneHandler::AddThis(box); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Cons& cons) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -129,6 +137,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Cons& cons) {
|
||||
G4VSceneHandler::AddThis(cons); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Tubs& tubs) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -140,6 +149,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Tubs& tubs) {
|
||||
G4VSceneHandler::AddThis(tubs); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Trd& trd) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -151,6 +161,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Trd& trd) {
|
||||
G4VSceneHandler::AddThis(trd); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Trap& trap) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -162,6 +173,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Trap& trap) {
|
||||
G4VSceneHandler::AddThis(trap); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Sphere& sphere) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -173,6 +185,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Sphere& sphere) {
|
||||
G4VSceneHandler::AddThis(sphere); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Para& para) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -184,6 +197,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Para& para) {
|
||||
G4VSceneHandler::AddThis(para); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Torus& torus) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -195,6 +209,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Torus& torus) {
|
||||
G4VSceneHandler::AddThis(torus); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Polycone& polycone) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -206,6 +221,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Polycone& polycone) {
|
||||
G4VSceneHandler::AddThis(polycone); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4Polyhedra& polyhedra) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -217,6 +233,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4Polyhedra& polyhedra) {
|
||||
G4VSceneHandler::AddThis(polyhedra); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis(const G4VSolid& solid) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -228,6 +245,7 @@ void G4HepRepFileSceneHandler::AddThis(const G4VSolid& solid) {
|
||||
G4VSceneHandler::AddThis(solid); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis (const G4VTrajectory& traj) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout << "G4HepRepFileSceneHandler::AddThis(G4VTrajectory&) " << G4endl;
|
||||
@@ -243,7 +261,7 @@ void G4HepRepFileSceneHandler::AddThis (const G4VTrajectory& traj) {
|
||||
CheckFileOpen();
|
||||
|
||||
// Add the Event Data Type if it hasn't already been added.
|
||||
// If this is the first trajectory, add the Event Data type and define attributes.
|
||||
// If this is the first trajectory or hit, add the Event Data type and define attributes.
|
||||
if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) {
|
||||
hepRepXMLWriter->addType("Event Data",0);
|
||||
hepRepXMLWriter->addInstance();
|
||||
@@ -412,13 +430,15 @@ void G4HepRepFileSceneHandler::AddThis (const G4VTrajectory& traj) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddThis (const G4VHit& hit) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout << "G4HepRepFileSceneHandler::AddThis(G4VHit&) " << G4endl;
|
||||
#endif
|
||||
G4VSceneHandler::AddThis (hit);
|
||||
G4VSceneHandler::AddThis(hit); // Invoke default action.
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -439,6 +459,7 @@ void G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddPrimitive (const G4Polymarker& line) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -460,6 +481,7 @@ void G4HepRepFileSceneHandler::AddPrimitive (const G4Polymarker& line) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
void G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
#else
|
||||
@@ -475,6 +497,7 @@ void G4HepRepFileSceneHandler::AddPrimitive(const G4Text&) {
|
||||
G4cout << "G4HepRepFileSceneHandler::AddPrimitive G4Text : not yet implemented. " << G4endl;
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -495,6 +518,7 @@ void G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) {
|
||||
hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -515,6 +539,7 @@ void G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) {
|
||||
hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -545,6 +570,7 @@ void G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) {
|
||||
} while (notLastFace);
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddPrimitive(const G4NURBS&) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -555,10 +581,12 @@ void G4HepRepFileSceneHandler::AddPrimitive(const G4NURBS&) {
|
||||
G4cout << "G4HepRepFileSceneHandler::AddPrimitive G4NURBS : not implemented. " << G4endl;
|
||||
}
|
||||
|
||||
|
||||
G4HepRepFileXMLWriter *G4HepRepFileSceneHandler::GetHepRepXMLWriter() {
|
||||
return hepRepXMLWriter;
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
|
||||
const G4Visible visible) {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
@@ -570,7 +598,6 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
|
||||
// Open the HepRep output file if it is not already open.
|
||||
CheckFileOpen();
|
||||
|
||||
// Handle Type declaration for Event Data.
|
||||
// Should be able to just test on fReadyForTransients, but this seems to
|
||||
// be falsely false if no geometry has yet been drawn.
|
||||
// So I test on both !fpCurrentPV (means no geometry has yet been drawn)
|
||||
@@ -581,15 +608,46 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
|
||||
hepRepXMLWriter->addInstance();
|
||||
}
|
||||
|
||||
if (strcmp("Line",primName)==0)
|
||||
// Applications have the option of either calling AddThis(G4VTrajectory&) and
|
||||
// AddThis(G4VHits&), or of just decomposing these into simpler primitives.
|
||||
// In the former case, drawing will be handled above and will include setting of
|
||||
// physics attributes.
|
||||
// In the latter case, which is an older style of working, we end up drawing the
|
||||
// trajectories and hits here, where we have no access to physics attributes.
|
||||
// We receive primitives here. We can figure out that these are transients, but we
|
||||
// have to guess exactly what these transients represent.
|
||||
// We assume the primitives are being used as in G4VTrajectory, hence we assume:
|
||||
// Lines are Trajectories
|
||||
// Squares that come after we've seen trajectories are Auxiliary Points
|
||||
// Circles that come after we've seen trajectories are Step Points
|
||||
// Other primitives are Hits
|
||||
|
||||
int layer;
|
||||
|
||||
if (strcmp("Line",primName)==0) {
|
||||
hepRepXMLWriter->addType("Trajectories",1);
|
||||
else {
|
||||
if (strcmp(hepRepXMLWriter->prevTypeName[1],"Trajectories")==0)
|
||||
hepRepXMLWriter->addType("Trajectory Points",2);
|
||||
else
|
||||
hepRepXMLWriter->addType("Trajectory Points",1);
|
||||
layer = 100;
|
||||
} else {
|
||||
if (strcmp(hepRepXMLWriter->prevTypeName[1],"Trajectories")==0 &&
|
||||
strcmp("Square",primName)==0)
|
||||
{
|
||||
hepRepXMLWriter->addType("AuxiliaryPoints",2);
|
||||
layer = 110;
|
||||
} else {
|
||||
if (strcmp(hepRepXMLWriter->prevTypeName[1],"Trajectories")==0 &&
|
||||
strcmp("Circle",primName)==0)
|
||||
{
|
||||
hepRepXMLWriter->addType("StepPoints",2);
|
||||
layer = 120;
|
||||
} else {
|
||||
hepRepXMLWriter->addType("Hits",1);
|
||||
layer = 130;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hepRepXMLWriter->addAttValue("Layer",layer);
|
||||
|
||||
hepRepXMLWriter->addInstance();
|
||||
|
||||
// Handle Type declaration for Detector Geometry,
|
||||
@@ -614,6 +672,7 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
|
||||
}
|
||||
|
||||
// Additional attributes.
|
||||
hepRepXMLWriter->addAttValue("Layer",hepRepXMLWriter->typeDepth);
|
||||
hepRepXMLWriter->addAttValue("LVol", fpCurrentLV->GetName());
|
||||
hepRepXMLWriter->addAttValue("Solid", fpCurrentLV->GetSolid()->GetName());
|
||||
hepRepXMLWriter->addAttValue("EType", fpCurrentLV->GetSolid()->GetEntityType());
|
||||
@@ -624,7 +683,6 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
|
||||
}
|
||||
|
||||
hepRepXMLWriter->addAttValue("DrawAs",primName);
|
||||
hepRepXMLWriter->addAttValue("Layer",hepRepXMLWriter->typeDepth);
|
||||
|
||||
// Handle color attribute, avoiding drawing anything black on black.
|
||||
G4Colour colour = GetColour(visible);
|
||||
@@ -651,6 +709,7 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
|
||||
hepRepXMLWriter->addAttValue("Visibility",true);
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::CheckFileOpen() {
|
||||
#ifdef G4HEPREPFILEDEBUG
|
||||
G4cout <<
|
||||
@@ -681,6 +740,7 @@ void G4HepRepFileSceneHandler::CheckFileOpen() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4HepRepFileSceneHandler::ClearTransientStore () {
|
||||
G4VSceneHandler::ClearTransientStore ();
|
||||
if (fpViewer) {
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepFileViewer.cc,v 1.11 2003/07/12 19:48:15 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4HepRepFileViewer.cc,v 1.12 2004/03/15 08:00:22 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
|
||||
#include "G4HepRepFileViewer.hh"
|
||||
|
||||
@@ -71,6 +71,7 @@ void G4HepRepFileViewer::ShowView () {
|
||||
G4cout << "G4HepRepFileViewer::ShowView" << G4endl;
|
||||
#endif
|
||||
G4VViewer::ShowView();
|
||||
|
||||
hepRepXMLWriter->close();
|
||||
|
||||
if (hepRepXMLWriter->isOpen)
|
||||
hepRepXMLWriter->close();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepMessenger.cc,v 1.4 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
#include "G4HepRepMessenger.hh"
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepSceneHandler.cc,v 1.70 2004/02/05 18:41:49 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
|
||||
/**
|
||||
* @author Mark Donszelmann, Joseph Perl
|
||||
@@ -430,20 +433,18 @@ void G4HepRepSceneHandler::AddPrimitive (const G4Polymarker& line) {
|
||||
setMarker(instance, line);
|
||||
|
||||
// Default MarkName is set to Circle for this Type.
|
||||
switch (line.GetMarkerType()) {
|
||||
case line.dots:
|
||||
setAttribute(instance, "Fill", true);
|
||||
setColor(instance, GetColor(line), G4String("FillColor"));
|
||||
break;
|
||||
case line.circles:
|
||||
break;
|
||||
case line.squares:
|
||||
setAttribute(instance, "MarkName", G4String("Box"));
|
||||
break;
|
||||
case line.line:
|
||||
default:
|
||||
setAttribute(instance, "MarkName", G4String("Plus"));
|
||||
break;
|
||||
int mtype = line.GetMarkerType();
|
||||
|
||||
// Cannot be case statement since line.xxx is not a constant
|
||||
if (mtype == line.dots) {
|
||||
setAttribute(instance, "Fill", true);
|
||||
setColor(instance, GetColor(line), G4String("FillColor"));
|
||||
} else if (mtype == line.circles) {
|
||||
} else if (line.squares) {
|
||||
setAttribute(instance, "MarkName", G4String("Box"));
|
||||
} else {
|
||||
// line.line + default
|
||||
setAttribute(instance, "MarkName", G4String("Plus"));
|
||||
}
|
||||
|
||||
for (size_t i=0; i < line.size(); i++) {
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepViewer.cc,v 1.22 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,14 +5,21 @@ G4HepRepFileSceneHandler.cc
|
||||
G4HepRepFileViewer.cc
|
||||
HepRepXMLWriter.cc
|
||||
|
||||
and heprep2 files:
|
||||
|
||||
G4HepRep.cc
|
||||
G4HepRepSceneHandler.cc
|
||||
G4HepRepMessenger.cc
|
||||
G4HepRepViewer.cc
|
||||
|
||||
and the zlib sources
|
||||
|
||||
the other sources (heprep2) are copies from the FreeHEP library
|
||||
the other sources are copies from the FreeHEP library
|
||||
(java.freehep.org) and are maintained there.
|
||||
|
||||
The files starting with G4 are geant4 compliant, the others may not be.
|
||||
|
||||
Changes made here may be overwritten.
|
||||
|
||||
11 July 2003
|
||||
11 December 2003
|
||||
Mark Donszelmann
|
||||
|
||||
@@ -56,7 +56,7 @@ bool XMLHepRepWriter::write(HepRep* heprep, string name) {
|
||||
zip->putNextEntry(ZipCDirEntry(name));
|
||||
}
|
||||
xml->openDoc();
|
||||
xml->setAttribute("xmlns", "http://www.freehep.org/HepRep");
|
||||
xml->setAttribute("xmlns", "http://java.freehep.org/schemas/heprep/2.0");
|
||||
xml->setAttribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||
xml->setAttribute("xsi", "schemaLocation", "HepRep.xsd");
|
||||
xml->openTag(nameSpace, "heprep");
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
#include "zipios++/zipios-config.h"
|
||||
|
||||
#include "zipios++/meta-iostreams.h"
|
||||
|
||||
#include "zipios++/ziphead.h"
|
||||
#include "zipios++/zipheadio.h"
|
||||
|
||||
using namespace std ;
|
||||
using namespace zipios ;
|
||||
|
||||
char *_progname ;
|
||||
|
||||
void printUsage() ;
|
||||
void exitUsage( int exit_code ) ;
|
||||
|
||||
int main( int argc, char *argv[] ) {
|
||||
_progname = argv[ 0 ] ;
|
||||
if ( argc != 3 )
|
||||
exitUsage( 1 ) ;
|
||||
|
||||
ofstream exef( argv[ 1 ], ios::app | ios::binary ) ;
|
||||
if( ! exef ) {
|
||||
cout << "Error: Unable to open " << argv[ 1 ] << " for writing" << endl ;
|
||||
exitUsage( 1 ) ;
|
||||
}
|
||||
|
||||
ifstream zipf( argv[ 2 ], ios::in | ios::binary ) ;
|
||||
if( ! zipf ) {
|
||||
cout << "Error: Unable to open " << argv[ 2 ] << " for reading." << endl ;
|
||||
exitUsage( 1 ) ;
|
||||
}
|
||||
|
||||
// get eof pos (to become zip file starting position).
|
||||
uint32 zip_start = exef.tellp() ;
|
||||
cout << "zip start will be at " << zip_start << endl ;
|
||||
|
||||
// Append zip file to exe file
|
||||
|
||||
exef << zipf.rdbuf() ;
|
||||
// write zipfile start offset to file
|
||||
writeUint32( zip_start, exef ) ;
|
||||
|
||||
exef.close() ;
|
||||
zipf.close() ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void printUsage() {
|
||||
cout << "Usage: " << _progname << " exe-file zipfile" << endl ;
|
||||
}
|
||||
|
||||
void exitUsage( int exit_code ) {
|
||||
printUsage() ;
|
||||
exit( exit_code ) ;
|
||||
}
|
||||
|
||||
/** \file
|
||||
\anchor appendzip_anchor
|
||||
Source code to a small program appendzip that appends a zip
|
||||
archive to another file. Run appendzip without arguments to
|
||||
get a helpful usage message.
|
||||
*/
|
||||
|
||||
/*
|
||||
Zipios++ - a small C++ library that provides easy access to .zip files.
|
||||
Copyright (C) 2000 Thomas Søndergaard
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "zipios++/zipios-config.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
|
||||
#include "zipios++/meta-iostreams.h"
|
||||
#include <string>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* compress.c -- compress a memory buffer
|
||||
* Copyright (C) 1995-1998 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: compress.cc,v 1.1 2003/07/11 06:01:44 duns Exp $ */
|
||||
/* @(#) $Id: compress.cc,v 1.2 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
#include "zlib.h"
|
||||
#include "HepRep-zlib.h"
|
||||
|
||||
/* ===========================================================================
|
||||
Compresses the source buffer into the destination buffer. The level
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* deflate.c -- compress data using the deflation algorithm
|
||||
* Copyright (C) 1995-1998 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -47,7 +47,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* @(#) $Id: deflate.cc,v 1.5 2003/07/11 06:33:52 duns Exp $ */
|
||||
/* @(#) $Id: deflate.cc,v 1.6 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
#include "deflate.h"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "zipios++/meta-iostreams.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <HepRep-zlib.h>
|
||||
|
||||
#include "zipios++/fcollexceptions.h"
|
||||
#include "zipios++/deflateoutputstreambuf.h"
|
||||
@@ -52,7 +52,7 @@ bool DeflateOutputStreambuf::init( int comp_level ) {
|
||||
static const int default_mem_level = 8 ;
|
||||
|
||||
// _zs.next_in and avail_in must be set according to
|
||||
// zlib.h (inline doc).
|
||||
// HepRep-zlib.h (inline doc).
|
||||
_zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[ 0 ] ) ) ;
|
||||
_zs.avail_in = 0 ;
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* gzio.c -- IO on .gz files
|
||||
* Copyright (C) 1995-1998 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*
|
||||
* Compile this file with -DNO_DEFLATE to avoid the compression code.
|
||||
*/
|
||||
|
||||
/* @(#) $Id: gzio.cc,v 1.4 2003/07/12 15:19:56 duns Exp $ */
|
||||
/* @(#) $Id: gzio.cc,v 1.5 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
|
||||
struct internal_state {int dummy;}; /* for buggy compilers */
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <algorithm>
|
||||
#include "zipios++/meta-iostreams.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <HepRep-zlib.h>
|
||||
|
||||
#include "zipios++/gzipoutputstreambuf.h"
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* infblock.c -- interpret and process block types to last block
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
#include "infblock.h"
|
||||
#include "inftrees.h"
|
||||
#include "infcodes.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* infcodes.c -- process literals and length/distance pairs
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
#include "inftrees.h"
|
||||
#include "infblock.h"
|
||||
#include "infcodes.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* inffast.c -- process literals and length/distance pairs fast
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
#include "inftrees.h"
|
||||
#include "infblock.h"
|
||||
#include "infcodes.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* inflate.c -- zlib interface to inflate modules
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
#include "infblock.h"
|
||||
|
||||
struct inflate_blocks_state {int dummy;}; /* for buggy compilers */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "zipios++/meta-iostreams.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <HepRep-zlib.h>
|
||||
|
||||
#include "zipios++/fcollexceptions.h"
|
||||
#include "zipios++/inflateinputstreambuf.h"
|
||||
@@ -120,7 +120,7 @@ bool InflateInputStreambuf::reset( int stream_position ) {
|
||||
}
|
||||
|
||||
// _zs.next_in and avail_in must be set according to
|
||||
// zlib.h (inline doc).
|
||||
// HepRep-zlib.h (inline doc).
|
||||
_zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[0] ) ) ;
|
||||
_zs.avail_in = 0 ;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
#include "inftrees.h"
|
||||
|
||||
#if !defined(BUILDFIXED) && !defined(STDC)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* inflate_util.c -- data and routines common to blocks and codes
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
#include "infblock.h"
|
||||
#include "inftrees.h"
|
||||
#include "infcodes.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* trees.c -- output deflated data using Huffman coding
|
||||
* Copyright (C) 1995-1998 Jean-loup Gailly
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -29,7 +29,7 @@
|
||||
* Addison-Wesley, 1983. ISBN 0-201-06672-6.
|
||||
*/
|
||||
|
||||
/* @(#) $Id: trees.cc,v 1.2 2003/07/11 07:45:14 duns Exp $ */
|
||||
/* @(#) $Id: trees.cc,v 1.3 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
/* #define GEN_TREES_H */
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* uncompr.c -- decompress a memory buffer
|
||||
* Copyright (C) 1995-1998 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: uncompr.cc,v 1.1 2003/07/11 06:01:45 duns Exp $ */
|
||||
/* @(#) $Id: uncompr.cc,v 1.2 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
#include "zlib.h"
|
||||
#include "HepRep-zlib.h"
|
||||
|
||||
/* ===========================================================================
|
||||
Decompresses the source buffer into the destination buffer. sourceLen is
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zadler32.cc,v 1.1 2003/07/11 06:01:45 duns Exp $ */
|
||||
/* @(#) $Id: zadler32.cc,v 1.2 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
#include "zlib.h"
|
||||
#include "HepRep-zlib.h"
|
||||
|
||||
#define BASE 65521L /* largest prime smaller than 65536 */
|
||||
#define NMAX 5552
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
/* crc32.c -- compute the CRC-32 of a data stream
|
||||
* Copyright (C) 1995-1998 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zcrc32.cc,v 1.1 2003/07/11 06:01:45 duns Exp $ */
|
||||
/* @(#) $Id: zcrc32.cc,v 1.2 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
#include "zlib.h"
|
||||
#include "HepRep-zlib.h"
|
||||
|
||||
#define local static
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <algorithm>
|
||||
#include "zipios++/meta-iostreams.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <HepRep-zlib.h>
|
||||
|
||||
#include "zipios++/zipinputstreambuf.h"
|
||||
#include "zipios_common.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <algorithm>
|
||||
#include "zipios++/meta-iostreams.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <HepRep-zlib.h>
|
||||
|
||||
#include "zipios++/zipoutputstreambuf.h"
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* zutil.c -- target dependent utility functions for the compression library
|
||||
* Copyright (C) 1995-1998 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zutil.cc,v 1.1 2003/07/11 06:01:46 duns Exp $ */
|
||||
/* @(#) $Id: zutil.cc,v 1.2 2004/02/03 19:34:44 duns Exp $ */
|
||||
|
||||
#include "zutil.h"
|
||||
#include "HepRep-zutil.h"
|
||||
|
||||
struct internal_state {int dummy;}; /* for buggy compilers */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user