mirror of
https://github.com/fhgwright/SCSI2SD.git
synced 2025-04-11 22:37:06 +00:00
Emulation of multiple SCSI targets now working.
The CDROM device support has a few bugs, as does scsi2sd-util
This commit is contained in:
parent
2354021f55
commit
b19a0a4c7c
10
CHANGELOG
10
CHANGELOG
@ -1,10 +1,18 @@
|
||||
201408XX 3.6
|
||||
201412XX 3.6
|
||||
- Fix handling requests for LUNs other than 0 from SCSI-2 hosts.
|
||||
- Handle glitches of the scsi signals to improve stability and operate with
|
||||
multiple devices on the SCSI bus.
|
||||
- Re-add parity checking. This can be disabled using scsi2sd-config if
|
||||
required.
|
||||
- Added disconnect/reconnect support during SD card writes.
|
||||
- Preliminary CDROM device support (incomplete)
|
||||
- New configuration method. Data is now stored in flash to allow room for
|
||||
custom VPD tables. The old eeprom configuration is ignored.
|
||||
- Support for up to 4 SCSI targets.
|
||||
- scsi2sd-config and bootloader hosts utilities are replaced by the
|
||||
new scsi2sd-util GUI.
|
||||
- Fix for SD cards with Samsung controllers which expect a "stop" bit
|
||||
in each SD command over SPI.
|
||||
|
||||
20140718 3.5.2
|
||||
- Fix blank SCSI ID in scsi2sd-config output.
|
||||
|
142
software/SCSI2SD/src/cdrom.c
Executable file
142
software/SCSI2SD/src/cdrom.c
Executable file
@ -0,0 +1,142 @@
|
||||
// Copyright (C) 2014 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of SCSI2SD.
|
||||
//
|
||||
// SCSI2SD 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// SCSI2SD 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 SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "device.h"
|
||||
#include "scsi.h"
|
||||
#include "config.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
uint8_t SimpleTOC[] =
|
||||
{
|
||||
0x00, // toc length, MSB
|
||||
0x0A, // toc length, LSB
|
||||
0x01, // First track number
|
||||
0x01, // Last track number,
|
||||
// TRACK 1 Descriptor
|
||||
0x00, // reservied
|
||||
0x06, // Q sub-channel not supplied, Digital track
|
||||
0x01, // Track 1,
|
||||
0x00, // Reserved
|
||||
0x00,0x00,0x00,0x00 // Track start sector (LBA)
|
||||
};
|
||||
|
||||
void doReadTOC(int MSF, uint8_t track, uint16_t allocationLength)
|
||||
{
|
||||
// We only support track 1.
|
||||
// track 0 means "return all tracks"
|
||||
if (track > 1)
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else if (MSF)
|
||||
{
|
||||
// MSF addressing not currently supported.
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t len = sizeof(SimpleTOC);
|
||||
memcpy(scsiDev.data, SimpleTOC, len);
|
||||
if (len > allocationLength)
|
||||
{
|
||||
len = allocationLength;
|
||||
}
|
||||
scsiDev.dataLen = len;
|
||||
scsiDev.phase = DATA_IN;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t SimpleHeader[] =
|
||||
{
|
||||
0x01, // 2048byte user data, L-EC in 288 byte aux field.
|
||||
0x00, // reserved
|
||||
0x00, // reserved
|
||||
0x00, // reserved
|
||||
0x00,0x00,0x00,0x00 // Track start sector (LBA)
|
||||
};
|
||||
|
||||
void doReadHeader(int MSF, uint32_t lba, uint16_t allocationLength)
|
||||
{
|
||||
if (MSF)
|
||||
{
|
||||
// MSF addressing not currently supported.
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t len = sizeof(SimpleHeader);
|
||||
memcpy(scsiDev.data, SimpleHeader, len);
|
||||
if (len > allocationLength)
|
||||
{
|
||||
len = allocationLength;
|
||||
}
|
||||
scsiDev.dataLen = len;
|
||||
scsiDev.phase = DATA_IN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle direct-access scsi device commands
|
||||
int scsiCDRomCommand()
|
||||
{
|
||||
int commandHandled = 1;
|
||||
|
||||
uint8 command = scsiDev.cdb[0];
|
||||
if (scsiDev.target->cfg->deviceType == CONFIG_OPTICAL)
|
||||
{
|
||||
if (command == 0x43)
|
||||
{
|
||||
// CD-ROM Read TOC
|
||||
int MSF = scsiDev.cdb[1] & 0x02 ? 1 : 0;
|
||||
uint8_t track = scsiDev.cdb[6];
|
||||
uint16_t allocationLength =
|
||||
(((uint32_t) scsiDev.cdb[7]) << 8) +
|
||||
scsiDev.cdb[8];
|
||||
|
||||
doReadTOC(MSF, track, allocationLength);
|
||||
}
|
||||
else if (command == 0x44)
|
||||
{
|
||||
// CD-ROM Read Header
|
||||
int MSF = scsiDev.cdb[1] & 0x02 ? 1 : 0;
|
||||
uint32_t lba = 0; // IGNORED for now
|
||||
uint16_t allocationLength =
|
||||
(((uint32_t) scsiDev.cdb[7]) << 8) +
|
||||
scsiDev.cdb[8];
|
||||
doReadHeader(MSF, lba, allocationLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
commandHandled = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
commandHandled = 0;
|
||||
}
|
||||
|
||||
return commandHandled;
|
||||
}
|
22
software/SCSI2SD/src/cdrom.h
Executable file
22
software/SCSI2SD/src/cdrom.h
Executable file
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2014 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of SCSI2SD.
|
||||
//
|
||||
// SCSI2SD 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// SCSI2SD 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 SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
|
||||
#ifndef CDROM_H
|
||||
#define CDROM_H
|
||||
|
||||
int scsiCDRomCommand(void);
|
||||
|
||||
#endif
|
@ -29,25 +29,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// CYDEV_EEPROM_ROW_SIZE == 16.
|
||||
static const char magic[CYDEV_EEPROM_ROW_SIZE] = "codesrc_00000002";
|
||||
static const uint16_t FIRMWARE_VERSION = 0x0360;
|
||||
|
||||
// Config shadow RAM (copy of EEPROM)
|
||||
static Config shadow =
|
||||
{
|
||||
0, // SCSI ID
|
||||
" codesrc", // vendor (68k Apple Drive Setup: Set to " SEAGATE")
|
||||
" SCSI2SD", //prodId (68k Apple Drive Setup: Set to " ST225N")
|
||||
" 3.6", // revision (68k Apple Drive Setup: Set to "1.0 ")
|
||||
1, // enable parity
|
||||
1, // enable unit attention,
|
||||
0, // RESERVED
|
||||
0, // Max sectors (0 == disabled)
|
||||
512 // Sector size
|
||||
// reserved bytes will be initialised to 0.
|
||||
};
|
||||
|
||||
enum USB_ENDPOINTS
|
||||
{
|
||||
USB_EP_OUT = 1,
|
||||
@ -67,92 +50,8 @@ static int usbInEpState;
|
||||
static int usbDebugEpState;
|
||||
static int usbReady;
|
||||
|
||||
// Global
|
||||
Config* config = NULL;
|
||||
|
||||
// The PSoC 5LP compile to little-endian format.
|
||||
static uint32_t ntohl(uint32_t val)
|
||||
{
|
||||
return
|
||||
((val & 0xFF) << 24) |
|
||||
((val & 0xFF00) << 8) |
|
||||
((val >> 8) & 0xFF00) |
|
||||
((val >> 24) & 0xFF);
|
||||
}
|
||||
static uint16_t ntohs(uint16_t val)
|
||||
{
|
||||
return
|
||||
((val & 0xFF) << 8) |
|
||||
((val >> 8) & 0xFF);
|
||||
}
|
||||
static uint32_t htonl(uint32_t val)
|
||||
{
|
||||
return
|
||||
((val & 0xFF) << 24) |
|
||||
((val & 0xFF00) << 8) |
|
||||
((val >> 8) & 0xFF00) |
|
||||
((val >> 24) & 0xFF);
|
||||
}
|
||||
static uint16_t htons(uint16_t val)
|
||||
{
|
||||
return
|
||||
((val & 0xFF) << 8) |
|
||||
((val >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
static void saveConfig()
|
||||
{
|
||||
int shadowRows = (sizeof(shadow) / CYDEV_EEPROM_ROW_SIZE) + 1;
|
||||
int row;
|
||||
int status = CYRET_SUCCESS;
|
||||
|
||||
CySetTemp();
|
||||
for (row = 0; (row < shadowRows) && (status == CYRET_SUCCESS); ++row)
|
||||
{
|
||||
CFG_EEPROM_Write(((uint8*)&shadow) + (row * CYDEV_EEPROM_ROW_SIZE), row);
|
||||
}
|
||||
if (status == CYRET_SUCCESS)
|
||||
{
|
||||
CFG_EEPROM_Write((uint8*)magic, row);
|
||||
}
|
||||
}
|
||||
|
||||
void configInit()
|
||||
{
|
||||
int shadowRows, shadowBytes;
|
||||
uint8* eeprom = (uint8*)CYDEV_EE_BASE;
|
||||
|
||||
// We could map cfgPtr directly into the EEPROM memory,
|
||||
// but that would waste power. Copy it to RAM then turn off
|
||||
// the EEPROM.
|
||||
CFG_EEPROM_Start();
|
||||
CyDelayUs(5); // 5us to start per datasheet.
|
||||
|
||||
// Check magic
|
||||
shadowRows = (sizeof(shadow) / CYDEV_EEPROM_ROW_SIZE) + 1;
|
||||
shadowBytes = CYDEV_EEPROM_ROW_SIZE * shadowRows;
|
||||
|
||||
if (memcmp(eeprom + shadowBytes, magic, sizeof(magic)))
|
||||
{
|
||||
// Initial state, invalid, or upgrade required.
|
||||
if (!memcmp(eeprom + shadowBytes, magic, sizeof(magic) - 1) &&
|
||||
((eeprom + shadowBytes)[sizeof(magic) - 2] == '1'))
|
||||
{
|
||||
// Upgrade from version 1.
|
||||
memcpy(&shadow, eeprom, sizeof(shadow));
|
||||
shadow.bytesPerSector = 512;
|
||||
}
|
||||
|
||||
saveConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&shadow, eeprom, sizeof(shadow));
|
||||
}
|
||||
|
||||
config = &shadow;
|
||||
CFG_EEPROM_Stop();
|
||||
|
||||
// The USB block will be powered by an internal 3.3V regulator.
|
||||
// The PSoC must be operating between 4.6V and 5V for the regulator
|
||||
// to work.
|
||||
@ -353,10 +252,10 @@ void debugPoll()
|
||||
hidBuffer[14] = scsiDev.lastStatus;
|
||||
hidBuffer[15] = scsiDev.lastSense;
|
||||
hidBuffer[16] = scsiDev.phase;
|
||||
hidBuffer[17] = SCSI_ReadPin(SCSI_In_BSY);
|
||||
hidBuffer[18] = SCSI_ReadPin(SCSI_In_SEL);
|
||||
hidBuffer[19] = SCSI_ReadPin(SCSI_ATN_INT);
|
||||
hidBuffer[20] = SCSI_ReadPin(SCSI_RST_INT);
|
||||
hidBuffer[17] = SCSI_ReadFilt(SCSI_Filt_BSY);
|
||||
hidBuffer[18] = SCSI_ReadFilt(SCSI_Filt_SEL);
|
||||
hidBuffer[19] = SCSI_ReadFilt(SCSI_Filt_ATN);
|
||||
hidBuffer[20] = SCSI_ReadFilt(SCSI_Filt_RST);
|
||||
hidBuffer[21] = scsiDev.rstCount;
|
||||
hidBuffer[22] = scsiDev.selCount;
|
||||
hidBuffer[23] = scsiDev.msgCount;
|
||||
@ -403,8 +302,37 @@ void debugInit()
|
||||
// Public method for storing MODE SELECT results.
|
||||
void configSave()
|
||||
{
|
||||
CFG_EEPROM_Start();
|
||||
saveConfig(); // write to eeprom
|
||||
CFG_EEPROM_Stop();
|
||||
// TODO REIMPLEMENT
|
||||
// CFG_EEPROM_Start();
|
||||
// saveConfig(); // write to eeprom
|
||||
// CFG_EEPROM_Stop();
|
||||
}
|
||||
|
||||
|
||||
const TargetConfig* getConfigByIndex(int i)
|
||||
{
|
||||
size_t row = SCSI_CONFIG_0_ROW + (i * SCSI_CONFIG_ROWS);
|
||||
return (const TargetConfig*)
|
||||
(
|
||||
CY_FLASH_BASE +
|
||||
(CY_FLASH_SIZEOF_ARRAY * (size_t) SCSI_CONFIG_ARRAY) +
|
||||
(CY_FLASH_SIZEOF_ROW * row)
|
||||
);
|
||||
}
|
||||
|
||||
const TargetConfig* getConfigById(int scsiId)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_SCSI_TARGETS; ++i)
|
||||
{
|
||||
const TargetConfig* tgt = getConfigByIndex(i);
|
||||
if ((tgt->scsiId & CONFIG_TARGET_ID_BITS) == scsiId)
|
||||
{
|
||||
return tgt;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,28 +18,14 @@
|
||||
#define Config_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 scsiId;
|
||||
char vendor[8];
|
||||
char prodId[16];
|
||||
char revision[4];
|
||||
uint8 enableParity;
|
||||
uint8 enableUnitAttention;
|
||||
uint8 reserved1; // Unused. Ensures maxBlocks is aligned.
|
||||
uint32 maxSectors;
|
||||
uint16 bytesPerSector;
|
||||
|
||||
// Pad to 64 bytes, which is what we can fit into a USB HID packet.
|
||||
char reserved[26];
|
||||
} Config;
|
||||
|
||||
extern Config* config;
|
||||
#include "scsi2sd.h"
|
||||
|
||||
void configInit(void);
|
||||
void debugInit(void);
|
||||
void configPoll(void);
|
||||
void configSave(void);
|
||||
|
||||
const TargetConfig* getConfigByIndex(int index);
|
||||
const TargetConfig* getConfigById(int scsiId);
|
||||
|
||||
#endif
|
||||
|
@ -51,8 +51,8 @@ void scsiSendDiagnostic()
|
||||
// Nowhere to store this data!
|
||||
// Shouldn't happen - our buffer should be many magnitudes larger
|
||||
// than the required size for diagnostic parameters.
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
@ -95,9 +95,10 @@ void scsiReceiveDiagnostic()
|
||||
// Convert each supplied address back to a simple
|
||||
// 64bit linear address, then convert back again.
|
||||
uint64 fromByteAddr =
|
||||
scsiByteAddress(suppliedFmt, &scsiDev.data[6]);
|
||||
scsiByteAddress(scsiDev.target->cfg, suppliedFmt, &scsiDev.data[6]);
|
||||
|
||||
scsiSaveByteAddress(translateFmt, fromByteAddr, &scsiDev.data[6]);
|
||||
scsiSaveByteAddress(
|
||||
scsiDev.target->cfg, translateFmt, fromByteAddr, &scsiDev.data[6]);
|
||||
|
||||
// Fill out the rest of the response.
|
||||
// (Clear out any optional bits).
|
||||
@ -111,8 +112,8 @@ void scsiReceiveDiagnostic()
|
||||
{
|
||||
// error.
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ static void doReadCapacity()
|
||||
scsiDev.cdb[5];
|
||||
int pmi = scsiDev.cdb[8] & 1;
|
||||
|
||||
uint32_t capacity = getScsiCapacity();
|
||||
uint32_t capacity = getScsiCapacity(scsiDev.target->cfg);
|
||||
|
||||
if (!pmi && lba)
|
||||
{
|
||||
@ -122,8 +122,8 @@ static void doReadCapacity()
|
||||
// assume that delays are constant across each block. But the spec
|
||||
// says we must return this error if pmi is specified incorrectly.
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else if (capacity > 0)
|
||||
@ -135,18 +135,19 @@ static void doReadCapacity()
|
||||
scsiDev.data[2] = highestBlock >> 8;
|
||||
scsiDev.data[3] = highestBlock;
|
||||
|
||||
scsiDev.data[4] = config->bytesPerSector >> 24;
|
||||
scsiDev.data[5] = config->bytesPerSector >> 16;
|
||||
scsiDev.data[6] = config->bytesPerSector >> 8;
|
||||
scsiDev.data[7] = config->bytesPerSector;
|
||||
uint32_t bytesPerSector = scsiDev.target->cfg->bytesPerSector;
|
||||
scsiDev.data[4] = bytesPerSector >> 24;
|
||||
scsiDev.data[5] = bytesPerSector >> 16;
|
||||
scsiDev.data[6] = bytesPerSector >> 8;
|
||||
scsiDev.data[7] = bytesPerSector;
|
||||
scsiDev.dataLen = 8;
|
||||
scsiDev.phase = DATA_IN;
|
||||
}
|
||||
else
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = NOT_READY;
|
||||
scsiDev.sense.asc = MEDIUM_NOT_PRESENT;
|
||||
scsiDev.target->sense.code = NOT_READY;
|
||||
scsiDev.target->sense.asc = MEDIUM_NOT_PRESENT;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
}
|
||||
@ -156,15 +157,15 @@ static void doWrite(uint32 lba, uint32 blocks)
|
||||
if (blockDev.state & DISK_WP)
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = WRITE_PROTECTED;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = WRITE_PROTECTED;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else if (((uint64) lba) + blocks > getScsiCapacity())
|
||||
else if (((uint64) lba) + blocks > getScsiCapacity(scsiDev.target->cfg))
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
@ -174,8 +175,8 @@ static void doWrite(uint32 lba, uint32 blocks)
|
||||
transfer.blocks = blocks;
|
||||
transfer.currentBlock = 0;
|
||||
scsiDev.phase = DATA_OUT;
|
||||
scsiDev.dataLen = config->bytesPerSector;
|
||||
scsiDev.dataPtr = config->bytesPerSector; // TODO FIX scsiDiskPoll()
|
||||
scsiDev.dataLen = scsiDev.target->cfg->bytesPerSector;
|
||||
scsiDev.dataPtr = scsiDev.target->cfg->bytesPerSector;
|
||||
|
||||
// No need for single-block writes atm. Overhead of the
|
||||
// multi-block write is minimal.
|
||||
@ -188,12 +189,12 @@ static void doWrite(uint32 lba, uint32 blocks)
|
||||
|
||||
static void doRead(uint32 lba, uint32 blocks)
|
||||
{
|
||||
uint32_t capacity = getScsiCapacity();
|
||||
uint32_t capacity = getScsiCapacity(scsiDev.target->cfg);
|
||||
if (((uint64) lba) + blocks > capacity)
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
@ -223,11 +224,11 @@ static void doRead(uint32 lba, uint32 blocks)
|
||||
|
||||
static void doSeek(uint32 lba)
|
||||
{
|
||||
if (lba >= getScsiCapacity())
|
||||
if (lba >= getScsiCapacity(scsiDev.target->cfg))
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
}
|
||||
@ -239,24 +240,24 @@ static int doTestUnitReady()
|
||||
{
|
||||
ready = 0;
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = NOT_READY;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_NOT_READY_INITIALIZING_COMMAND_REQUIRED;
|
||||
scsiDev.target->sense.code = NOT_READY;
|
||||
scsiDev.target->sense.asc = LOGICAL_UNIT_NOT_READY_INITIALIZING_COMMAND_REQUIRED;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else if (!(blockDev.state & DISK_PRESENT))
|
||||
{
|
||||
ready = 0;
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = NOT_READY;
|
||||
scsiDev.sense.asc = MEDIUM_NOT_PRESENT;
|
||||
scsiDev.target->sense.code = NOT_READY;
|
||||
scsiDev.target->sense.asc = MEDIUM_NOT_PRESENT;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else if (!(blockDev.state & DISK_INITIALISED))
|
||||
{
|
||||
ready = 0;
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = NOT_READY;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_NOT_READY_CAUSE_NOT_REPORTABLE;
|
||||
scsiDev.target->sense.code = NOT_READY;
|
||||
scsiDev.target->sense.asc = LOGICAL_UNIT_NOT_READY_CAUSE_NOT_REPORTABLE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
return ready;
|
||||
@ -444,8 +445,8 @@ int scsiDiskCommand()
|
||||
// TODO. This means they are supplying data to verify against.
|
||||
// Technically we should probably grab the data and compare it.
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
}
|
||||
@ -464,8 +465,9 @@ void scsiDiskPoll()
|
||||
{
|
||||
scsiEnterPhase(DATA_IN);
|
||||
|
||||
int totalSDSectors = transfer.blocks * SDSectorsPerSCSISector();
|
||||
uint32_t sdLBA = SCSISector2SD(transfer.lba);
|
||||
int totalSDSectors =
|
||||
transfer.blocks * SDSectorsPerSCSISector(scsiDev.target->cfg);
|
||||
uint32_t sdLBA = SCSISector2SD(scsiDev.target->cfg, transfer.lba);
|
||||
int buffers = sizeof(scsiDev.data) / SD_SECTOR_SIZE;
|
||||
int prep = 0;
|
||||
int i = 0;
|
||||
@ -502,9 +504,10 @@ void scsiDiskPoll()
|
||||
else if ((scsiActive == 0) && ((prep - i) > 0))
|
||||
{
|
||||
int dmaBytes = SD_SECTOR_SIZE;
|
||||
if (i % SDSectorsPerSCSISector() == SDSectorsPerSCSISector() - 1)
|
||||
if ((i % SDSectorsPerSCSISector(scsiDev.target->cfg)) ==
|
||||
(SDSectorsPerSCSISector(scsiDev.target->cfg) - 1))
|
||||
{
|
||||
dmaBytes = config->bytesPerSector % SD_SECTOR_SIZE;
|
||||
dmaBytes = scsiDev.target->cfg->bytesPerSector % SD_SECTOR_SIZE;
|
||||
if (dmaBytes == 0) dmaBytes = SD_SECTOR_SIZE;
|
||||
}
|
||||
scsiWriteDMA(&scsiDev.data[SD_SECTOR_SIZE * (i % buffers)], dmaBytes);
|
||||
@ -522,7 +525,8 @@ void scsiDiskPoll()
|
||||
{
|
||||
scsiEnterPhase(DATA_OUT);
|
||||
|
||||
int totalSDSectors = transfer.blocks * SDSectorsPerSCSISector();
|
||||
int totalSDSectors =
|
||||
transfer.blocks * SDSectorsPerSCSISector(scsiDev.target->cfg);
|
||||
int buffers = sizeof(scsiDev.data) / SD_SECTOR_SIZE;
|
||||
int prep = 0;
|
||||
int i = 0;
|
||||
@ -559,9 +563,10 @@ void scsiDiskPoll()
|
||||
!scsiDisconnected)
|
||||
{
|
||||
int dmaBytes = SD_SECTOR_SIZE;
|
||||
if (prep % SDSectorsPerSCSISector() == SDSectorsPerSCSISector() - 1)
|
||||
if ((prep % SDSectorsPerSCSISector(scsiDev.target->cfg)) ==
|
||||
(SDSectorsPerSCSISector(scsiDev.target->cfg) - 1))
|
||||
{
|
||||
dmaBytes = config->bytesPerSector % SD_SECTOR_SIZE;
|
||||
dmaBytes = scsiDev.target->cfg->bytesPerSector % SD_SECTOR_SIZE;
|
||||
if (dmaBytes == 0) dmaBytes = SD_SECTOR_SIZE;
|
||||
}
|
||||
scsiReadDMA(&scsiDev.data[SD_SECTOR_SIZE * (prep % buffers)], dmaBytes);
|
||||
@ -622,10 +627,12 @@ void scsiDiskPoll()
|
||||
|
||||
if (scsiDev.phase == DATA_OUT)
|
||||
{
|
||||
if (scsiDev.parityError && config->enableParity && !scsiDev.compatMode)
|
||||
if (scsiDev.parityError &&
|
||||
(scsiDev.target->cfg->flags & CONFIG_ENABLE_PARITY) &&
|
||||
!scsiDev.compatMode)
|
||||
{
|
||||
scsiDev.sense.code = ABORTED_COMMAND;
|
||||
scsiDev.sense.asc = SCSI_PARITY_ERROR;
|
||||
scsiDev.target->sense.code = ABORTED_COMMAND;
|
||||
scsiDev.target->sense.asc = SCSI_PARITY_ERROR;
|
||||
scsiDev.status = CHECK_CONDITION;;
|
||||
}
|
||||
scsiDev.phase = STATUS;
|
||||
|
@ -20,20 +20,22 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
uint32_t getScsiCapacity()
|
||||
uint32_t getScsiCapacity(const TargetConfig* config)
|
||||
{
|
||||
uint32_t capacity = sdDev.capacity / SDSectorsPerSCSISector();
|
||||
if (config->maxSectors && (capacity > config->maxSectors))
|
||||
uint32_t capacity =
|
||||
(sdDev.capacity - config->sdSectorStart) /
|
||||
SDSectorsPerSCSISector(config);
|
||||
if (config->scsiSectors && (capacity > config->scsiSectors))
|
||||
{
|
||||
capacity = config->maxSectors;
|
||||
capacity = config->scsiSectors;
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
|
||||
|
||||
uint32_t SCSISector2SD(uint32_t scsiSector)
|
||||
uint32_t SCSISector2SD(const TargetConfig* config, uint32_t scsiSector)
|
||||
{
|
||||
return scsiSector * SDSectorsPerSCSISector();
|
||||
return scsiSector * SDSectorsPerSCSISector(config) + config->sdSectorStart;
|
||||
}
|
||||
|
||||
// Standard mapping according to ECMA-107 and ISO/IEC 9293:1994
|
||||
@ -54,7 +56,7 @@ void LBA2CHS(uint32 lba, uint32* c, uint8* h, uint32* s)
|
||||
*s = (lba % SCSI_SECTORS_PER_TRACK) + 1;
|
||||
}
|
||||
|
||||
uint64 scsiByteAddress(int format, const uint8* addr)
|
||||
uint64 scsiByteAddress(const TargetConfig* config, int format, const uint8* addr)
|
||||
{
|
||||
uint64 result;
|
||||
switch (format)
|
||||
@ -114,7 +116,7 @@ uint64 scsiByteAddress(int format, const uint8* addr)
|
||||
}
|
||||
|
||||
|
||||
void scsiSaveByteAddress(int format, uint64 byteAddr, uint8* buf)
|
||||
void scsiSaveByteAddress(const TargetConfig* config, int format, uint64 byteAddr, uint8* buf)
|
||||
{
|
||||
uint32 lba = byteAddr / config->bytesPerSector;
|
||||
uint32 byteOffset = byteAddr % config->bytesPerSector;
|
||||
|
@ -35,14 +35,14 @@ typedef enum
|
||||
ADDRESS_PHYSICAL_SECTOR = 5
|
||||
} SCSI_ADDRESS_FORMAT;
|
||||
|
||||
static inline int SDSectorsPerSCSISector()
|
||||
static inline int SDSectorsPerSCSISector(const TargetConfig* config)
|
||||
{
|
||||
return (config->bytesPerSector + SD_SECTOR_SIZE - 1) / SD_SECTOR_SIZE;
|
||||
}
|
||||
|
||||
uint32_t getScsiCapacity();
|
||||
uint32_t getScsiCapacity(const TargetConfig* config);
|
||||
|
||||
uint32_t SCSISector2SD(uint32_t scsiSector);
|
||||
uint32_t SCSISector2SD(const TargetConfig* config, uint32_t scsiSector);
|
||||
|
||||
uint64 CHS2LBA(uint32 c, uint8 h, uint32 s);
|
||||
void LBA2CHS(uint32 lba, uint32* c, uint8* h, uint32* s);
|
||||
@ -50,8 +50,10 @@ void LBA2CHS(uint32 lba, uint32* c, uint8* h, uint32* s);
|
||||
// Convert an address in the given SCSI_ADDRESS_FORMAT to
|
||||
// a linear byte address.
|
||||
// addr must be >= 8 bytes.
|
||||
uint64 scsiByteAddress(int format, const uint8* addr);
|
||||
void scsiSaveByteAddress(int format, uint64 byteAddr, uint8* buf);
|
||||
uint64 scsiByteAddress(
|
||||
const TargetConfig* config, int format, const uint8* addr);
|
||||
void scsiSaveByteAddress(
|
||||
const TargetConfig* config, int format, uint64 byteAddr, uint8* buf);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -104,12 +104,13 @@ void scsiInquiry()
|
||||
{
|
||||
// error.
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
{
|
||||
const TargetConfig* config = scsiDev.target->cfg;
|
||||
memcpy(scsiDev.data, StandardResponse, sizeof(StandardResponse));
|
||||
memcpy(&scsiDev.data[8], config->vendor, sizeof(config->vendor));
|
||||
memcpy(&scsiDev.data[16], config->prodId, sizeof(config->prodId));
|
||||
@ -155,8 +156,8 @@ void scsiInquiry()
|
||||
{
|
||||
// error.
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
|
||||
@ -176,6 +177,21 @@ void scsiInquiry()
|
||||
}
|
||||
// Spec 8.2.5 requires us to simply truncate the response if it's too big.
|
||||
scsiDev.dataLen = allocationLength;
|
||||
|
||||
// Set the device type as needed.
|
||||
switch (scsiDev.target->cfg->deviceType)
|
||||
{
|
||||
case CONFIG_OPTICAL:
|
||||
scsiDev.data[0] = 0x05; // device type
|
||||
scsiDev.data[1] |= 0x80; // Removable bit.
|
||||
break;
|
||||
case CONFIG_REMOVEABLE:
|
||||
scsiDev.data[1] |= 0x80; // Removable bit.
|
||||
break;
|
||||
default:
|
||||
// Accept defaults for a fixed disk.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the first byte to indicate LUN presence.
|
||||
|
@ -135,8 +135,8 @@ static void doModeSense(
|
||||
if (pc == 0x03) // Saved Values not supported.
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = SAVING_PARAMETERS_NOT_SUPPORTED;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = SAVING_PARAMETERS_NOT_SUPPORTED;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
@ -200,9 +200,10 @@ static void doModeSense(
|
||||
scsiDev.data[idx++] = 0; // reserved
|
||||
|
||||
// Block length
|
||||
scsiDev.data[idx++] = config->bytesPerSector >> 16;
|
||||
scsiDev.data[idx++] = config->bytesPerSector >> 8;
|
||||
scsiDev.data[idx++] = config->bytesPerSector & 0xFF;
|
||||
uint32_t bytesPerSector = scsiDev.target->cfg->bytesPerSector;
|
||||
scsiDev.data[idx++] = bytesPerSector >> 16;
|
||||
scsiDev.data[idx++] = bytesPerSector >> 8;
|
||||
scsiDev.data[idx++] = bytesPerSector & 0xFF;
|
||||
}
|
||||
|
||||
switch (pageCode)
|
||||
@ -225,8 +226,9 @@ static void doModeSense(
|
||||
if (pc != 0x01)
|
||||
{
|
||||
// Fill out the configured bytes-per-sector
|
||||
scsiDev.data[idx+12] = config->bytesPerSector >> 8;
|
||||
scsiDev.data[idx+13] = config->bytesPerSector & 0xFF;
|
||||
uint32_t bytesPerSector = scsiDev.target->cfg->bytesPerSector;
|
||||
scsiDev.data[idx+12] = bytesPerSector >> 8;
|
||||
scsiDev.data[idx+13] = bytesPerSector & 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -248,7 +250,7 @@ static void doModeSense(
|
||||
uint32 cyl;
|
||||
uint8 head;
|
||||
uint32 sector;
|
||||
LBA2CHS(getScsiCapacity(), &cyl, &head, §or);
|
||||
LBA2CHS(getScsiCapacity(scsiDev.target->cfg), &cyl, &head, §or);
|
||||
|
||||
scsiDev.data[idx+2] = cyl >> 16;
|
||||
scsiDev.data[idx+3] = cyl >> 8;
|
||||
@ -281,8 +283,8 @@ static void doModeSense(
|
||||
// Unknown Page Code
|
||||
pageFound = 0;
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
|
||||
@ -314,8 +316,8 @@ static void doModeSense(
|
||||
{
|
||||
// Page not found
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
}
|
||||
@ -355,9 +357,9 @@ static void doModeSelect(void)
|
||||
{
|
||||
goto bad;
|
||||
}
|
||||
else if (bytesPerSector != config->bytesPerSector)
|
||||
else if (bytesPerSector != scsiDev.target->cfg->bytesPerSector)
|
||||
{
|
||||
config->bytesPerSector = bytesPerSector;
|
||||
// TODO REIMPLEMENT CONFIG SAVEconfig->bytesPerSector = bytesPerSector;
|
||||
configSave();
|
||||
}
|
||||
}
|
||||
@ -387,7 +389,7 @@ static void doModeSelect(void)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
config->bytesPerSector = bytesPerSector;
|
||||
// TODO CONFIGFAVE REIMPLEMENT config->bytesPerSector = bytesPerSector;
|
||||
if (scsiDev.cdb[1] & 1) // SP Save Pages flag
|
||||
{
|
||||
configSave();
|
||||
@ -406,8 +408,8 @@ static void doModeSelect(void)
|
||||
goto out;
|
||||
bad:
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_PARAMETER_LIST;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_PARAMETER_LIST;
|
||||
|
||||
out:
|
||||
scsiDev.phase = STATUS;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "mode.h"
|
||||
#include "disk.h"
|
||||
#include "time.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -113,7 +114,7 @@ static void enter_Status(uint8 status)
|
||||
scsiDev.phase = STATUS;
|
||||
|
||||
scsiDev.lastStatus = scsiDev.status;
|
||||
scsiDev.lastSense = scsiDev.sense.code;
|
||||
scsiDev.lastSense = scsiDev.target->sense.code;
|
||||
}
|
||||
|
||||
static void process_Status()
|
||||
@ -143,7 +144,7 @@ static void process_Status()
|
||||
scsiWriteByte(scsiDev.status);
|
||||
|
||||
scsiDev.lastStatus = scsiDev.status;
|
||||
scsiDev.lastSense = scsiDev.sense.code;
|
||||
scsiDev.lastSense = scsiDev.target->sense.code;
|
||||
|
||||
// Command Complete occurs AFTER a valid status has been
|
||||
// sent. then we go bus-free.
|
||||
@ -198,10 +199,12 @@ static void process_DataOut()
|
||||
scsiRead(scsiDev.data + scsiDev.dataPtr, len);
|
||||
scsiDev.dataPtr += len;
|
||||
|
||||
if (scsiDev.parityError && config->enableParity && !scsiDev.compatMode)
|
||||
if (scsiDev.parityError &&
|
||||
(scsiDev.target->cfg->flags & CONFIG_ENABLE_PARITY) &&
|
||||
!scsiDev.compatMode)
|
||||
{
|
||||
scsiDev.sense.code = ABORTED_COMMAND;
|
||||
scsiDev.sense.asc = SCSI_PARITY_ERROR;
|
||||
scsiDev.target->sense.code = ABORTED_COMMAND;
|
||||
scsiDev.target->sense.asc = SCSI_PARITY_ERROR;
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
}
|
||||
@ -256,17 +259,19 @@ static void process_Command()
|
||||
memset(scsiDev.cdb, 0xff, sizeof(scsiDev.cdb));
|
||||
return;
|
||||
}
|
||||
else if (scsiDev.parityError && config->enableParity && !scsiDev.compatMode)
|
||||
else if (scsiDev.parityError &&
|
||||
(scsiDev.target->cfg->flags & CONFIG_ENABLE_PARITY) &&
|
||||
!scsiDev.compatMode)
|
||||
{
|
||||
scsiDev.sense.code = ABORTED_COMMAND;
|
||||
scsiDev.sense.asc = SCSI_PARITY_ERROR;
|
||||
scsiDev.target->sense.code = ABORTED_COMMAND;
|
||||
scsiDev.target->sense.asc = SCSI_PARITY_ERROR;
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
else if ((control & 0x02) && ((control & 0x01) == 0))
|
||||
{
|
||||
// FLAG set without LINK flag.
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
else if (command == 0x12)
|
||||
@ -284,7 +289,7 @@ static void process_Command()
|
||||
|
||||
memset(scsiDev.data, 0, 256); // Max possible alloc length
|
||||
scsiDev.data[0] = 0xF0;
|
||||
scsiDev.data[2] = scsiDev.sense.code & 0x0F;
|
||||
scsiDev.data[2] = scsiDev.target->sense.code & 0x0F;
|
||||
|
||||
scsiDev.data[3] = transfer.lba >> 24;
|
||||
scsiDev.data[4] = transfer.lba >> 16;
|
||||
@ -293,43 +298,44 @@ static void process_Command()
|
||||
|
||||
// Additional bytes if there are errors to report
|
||||
scsiDev.data[7] = 10; // additional length
|
||||
scsiDev.data[12] = scsiDev.sense.asc >> 8;
|
||||
scsiDev.data[13] = scsiDev.sense.asc;
|
||||
scsiDev.data[12] = scsiDev.target->sense.asc >> 8;
|
||||
scsiDev.data[13] = scsiDev.target->sense.asc;
|
||||
|
||||
// Silently truncate results. SCSI-2 spec 8.2.14.
|
||||
enter_DataIn(allocLength);
|
||||
|
||||
// This is a good time to clear out old sense information.
|
||||
scsiDev.sense.code = NO_SENSE;
|
||||
scsiDev.sense.asc = NO_ADDITIONAL_SENSE_INFORMATION;
|
||||
scsiDev.target->sense.code = NO_SENSE;
|
||||
scsiDev.target->sense.asc = NO_ADDITIONAL_SENSE_INFORMATION;
|
||||
}
|
||||
// Some old SCSI drivers do NOT properly support
|
||||
// unitAttention. eg. the Mac Plus would trigger a SCSI reset
|
||||
// on receiving the unit attention response on boot, thus
|
||||
// triggering another unit attention condition.
|
||||
else if (scsiDev.unitAttention && config->enableUnitAttention)
|
||||
else if (scsiDev.target->unitAttention &&
|
||||
(scsiDev.target->cfg->flags & CONFIG_ENABLE_UNIT_ATTENTION))
|
||||
{
|
||||
scsiDev.sense.code = UNIT_ATTENTION;
|
||||
scsiDev.sense.asc = scsiDev.unitAttention;
|
||||
scsiDev.target->sense.code = UNIT_ATTENTION;
|
||||
scsiDev.target->sense.asc = scsiDev.target->unitAttention;
|
||||
|
||||
// If initiator doesn't do REQUEST SENSE for the next command, then
|
||||
// data is lost.
|
||||
scsiDev.unitAttention = 0;
|
||||
scsiDev.target->unitAttention = 0;
|
||||
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
else if (scsiDev.lun)
|
||||
{
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_NOT_SUPPORTED;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = LOGICAL_UNIT_NOT_SUPPORTED;
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
else if (command == 0x17 || command == 0x16)
|
||||
{
|
||||
doReserveRelease();
|
||||
}
|
||||
else if ((scsiDev.reservedId >= 0) &&
|
||||
(scsiDev.reservedId != scsiDev.initiatorId))
|
||||
else if ((scsiDev.target->reservedId >= 0) &&
|
||||
(scsiDev.target->reservedId != scsiDev.initiatorId))
|
||||
{
|
||||
enter_Status(CONFLICT);
|
||||
}
|
||||
@ -347,10 +353,11 @@ static void process_Command()
|
||||
}
|
||||
else if (
|
||||
!scsiModeCommand() &&
|
||||
!scsiDiskCommand())
|
||||
!scsiDiskCommand() &&
|
||||
!scsiCDRomCommand())
|
||||
{
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_COMMAND_OPERATION_CODE;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_COMMAND_OPERATION_CODE;
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
|
||||
@ -370,25 +377,25 @@ static void doReserveRelease()
|
||||
uint8 command = scsiDev.cdb[0];
|
||||
|
||||
int canRelease =
|
||||
(!thirdPty && (scsiDev.initiatorId == scsiDev.reservedId)) ||
|
||||
(!thirdPty && (scsiDev.initiatorId == scsiDev.target->reservedId)) ||
|
||||
(thirdPty &&
|
||||
(scsiDev.reserverId == scsiDev.initiatorId) &&
|
||||
(scsiDev.reservedId == thirdPtyId)
|
||||
(scsiDev.target->reserverId == scsiDev.initiatorId) &&
|
||||
(scsiDev.target->reservedId == thirdPtyId)
|
||||
);
|
||||
|
||||
if (extentReservation)
|
||||
{
|
||||
// Not supported.
|
||||
scsiDev.sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.sense.asc = INVALID_FIELD_IN_CDB;
|
||||
scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
||||
scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB;
|
||||
enter_Status(CHECK_CONDITION);
|
||||
}
|
||||
else if (command == 0x17) // release
|
||||
{
|
||||
if ((scsiDev.reservedId < 0) || canRelease)
|
||||
if ((scsiDev.target->reservedId < 0) || canRelease)
|
||||
{
|
||||
scsiDev.reservedId = -1;
|
||||
scsiDev.reserverId = -1;
|
||||
scsiDev.target->reservedId = -1;
|
||||
scsiDev.target->reserverId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -397,16 +404,16 @@ static void doReserveRelease()
|
||||
}
|
||||
else // assume reserve.
|
||||
{
|
||||
if ((scsiDev.reservedId < 0) || canRelease)
|
||||
if ((scsiDev.target->reservedId < 0) || canRelease)
|
||||
{
|
||||
scsiDev.reserverId = scsiDev.initiatorId;
|
||||
scsiDev.target->reserverId = scsiDev.initiatorId;
|
||||
if (thirdPty)
|
||||
{
|
||||
scsiDev.reservedId = thirdPtyId;
|
||||
scsiDev.target->reservedId = thirdPtyId;
|
||||
}
|
||||
else
|
||||
{
|
||||
scsiDev.reservedId = scsiDev.initiatorId;
|
||||
scsiDev.target->reservedId = scsiDev.initiatorId;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -431,14 +438,18 @@ static void scsiReset()
|
||||
scsiDev.resetFlag = 0;
|
||||
scsiDev.lun = -1;
|
||||
|
||||
if (scsiDev.unitAttention != POWER_ON_RESET)
|
||||
if (scsiDev.target)
|
||||
{
|
||||
scsiDev.unitAttention = SCSI_BUS_RESET;
|
||||
if (scsiDev.target->unitAttention != POWER_ON_RESET)
|
||||
{
|
||||
scsiDev.target->unitAttention = SCSI_BUS_RESET;
|
||||
}
|
||||
scsiDev.target->reservedId = -1;
|
||||
scsiDev.target->reserverId = -1;
|
||||
scsiDev.target->sense.code = NO_SENSE;
|
||||
scsiDev.target->sense.asc = NO_ADDITIONAL_SENSE_INFORMATION;
|
||||
}
|
||||
scsiDev.reservedId = -1;
|
||||
scsiDev.reserverId = -1;
|
||||
scsiDev.sense.code = NO_SENSE;
|
||||
scsiDev.sense.asc = NO_ADDITIONAL_SENSE_INFORMATION;
|
||||
scsiDev.target = NULL;
|
||||
scsiDiskReset();
|
||||
|
||||
scsiDev.postDataOutHook = NULL;
|
||||
@ -468,6 +479,9 @@ static void enter_SelectionPhase()
|
||||
scsiDev.discPriv = 0;
|
||||
scsiDev.compatMode = 0;
|
||||
|
||||
scsiDev.initiatorId = -1;
|
||||
scsiDev.target = NULL;
|
||||
|
||||
transfer.blocks = 0;
|
||||
transfer.currentBlock = 0;
|
||||
|
||||
@ -486,11 +500,23 @@ static void process_SelectionPhase()
|
||||
int goodParity = (Lookup_OddParity[mask] == SCSI_ReadPin(SCSI_In_DBP));
|
||||
int atnFlag = SCSI_ReadFilt(SCSI_Filt_ATN);
|
||||
|
||||
int tgtIndex;
|
||||
TargetState* target = NULL;
|
||||
for (tgtIndex = 0; tgtIndex < MAX_SCSI_TARGETS; ++tgtIndex)
|
||||
{
|
||||
if (mask & (1 << scsiDev.targets[tgtIndex].targetId))
|
||||
{
|
||||
target = &scsiDev.targets[tgtIndex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bsy && sel &&
|
||||
(mask & scsiDev.scsiIdMask) &&
|
||||
(goodParity || !config->enableParity || !atnFlag) &&
|
||||
target &&
|
||||
(goodParity || !(target->cfg->flags & CONFIG_ENABLE_PARITY) || !atnFlag) &&
|
||||
(maskBitCount <= 2))
|
||||
{
|
||||
scsiDev.target = target;
|
||||
|
||||
// Do we enter MESSAGE OUT immediately ? SCSI 1 and 2 standards says
|
||||
// move to MESSAGE OUT if ATN is true before we assert BSY.
|
||||
// The initiator should assert ATN with SEL.
|
||||
@ -502,7 +528,7 @@ static void process_SelectionPhase()
|
||||
// controllers don't generate parity bits.
|
||||
if (!scsiDev.atnFlag)
|
||||
{
|
||||
scsiDev.unitAttention = 0;
|
||||
target->unitAttention = 0;
|
||||
scsiDev.compatMode = 1;
|
||||
}
|
||||
|
||||
@ -529,11 +555,10 @@ static void process_SelectionPhase()
|
||||
// Save our initiator now that we're no longer in a time-critical
|
||||
// section.
|
||||
// SCSI1/SASI initiators may not set their own ID.
|
||||
if (maskBitCount == 2)
|
||||
{
|
||||
int i;
|
||||
uint8 initiatorMask = mask ^ scsiDev.scsiIdMask;
|
||||
scsiDev.initiatorId = 0;
|
||||
uint8_t initiatorMask = mask ^ (1 << target->targetId);
|
||||
scsiDev.initiatorId = -1;
|
||||
for (i = 0; i < 8; ++i)
|
||||
{
|
||||
if (initiatorMask & (1 << i))
|
||||
@ -543,10 +568,6 @@ static void process_SelectionPhase()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scsiDev.initiatorId = -1;
|
||||
}
|
||||
|
||||
scsiDev.phase = COMMAND;
|
||||
}
|
||||
@ -565,7 +586,9 @@ static void process_MessageOut()
|
||||
scsiDev.msgOut = scsiReadByte();
|
||||
scsiDev.msgCount++;
|
||||
|
||||
if (scsiDev.parityError && config->enableParity && !scsiDev.compatMode)
|
||||
if (scsiDev.parityError &&
|
||||
(scsiDev.target->cfg->flags & CONFIG_ENABLE_PARITY) &&
|
||||
!scsiDev.compatMode)
|
||||
{
|
||||
// Skip the remaining message bytes, and then start the MESSAGE_OUT
|
||||
// phase again from the start. The initiator will re-send the
|
||||
@ -596,11 +619,11 @@ static void process_MessageOut()
|
||||
|
||||
scsiDiskReset();
|
||||
|
||||
scsiDev.unitAttention = SCSI_BUS_RESET;
|
||||
scsiDev.target->unitAttention = SCSI_BUS_RESET;
|
||||
|
||||
// ANY initiator can reset the reservation state via this message.
|
||||
scsiDev.reservedId = -1;
|
||||
scsiDev.reserverId = -1;
|
||||
scsiDev.target->reservedId = -1;
|
||||
scsiDev.target->reserverId = -1;
|
||||
enter_BusFree();
|
||||
}
|
||||
else if (scsiDev.msgOut == 0x05)
|
||||
@ -810,14 +833,31 @@ void scsiPoll(void)
|
||||
|
||||
void scsiInit()
|
||||
{
|
||||
scsiDev.scsiIdMask = 1 << (config->scsiId);
|
||||
|
||||
scsiDev.atnFlag = 0;
|
||||
scsiDev.resetFlag = 1;
|
||||
scsiDev.phase = BUS_FREE;
|
||||
scsiDev.reservedId = -1;
|
||||
scsiDev.reserverId = -1;
|
||||
scsiDev.unitAttention = POWER_ON_RESET;
|
||||
scsiDev.target = NULL;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < MAX_SCSI_TARGETS; ++i)
|
||||
{
|
||||
const TargetConfig* cfg = getConfigByIndex(i);
|
||||
if (cfg && (cfg->scsiId & CONFIG_TARGET_ENABLED))
|
||||
{
|
||||
scsiDev.targets[i].targetId = cfg->scsiId & CONFIG_TARGET_ID_BITS;
|
||||
scsiDev.targets[i].cfg = cfg;
|
||||
}
|
||||
else
|
||||
{
|
||||
scsiDev.targets[i].targetId = 0xff;
|
||||
scsiDev.targets[i].cfg = NULL;
|
||||
}
|
||||
scsiDev.targets[i].reservedId = -1;
|
||||
scsiDev.targets[i].reserverId = -1;
|
||||
scsiDev.targets[i].unitAttention = POWER_ON_RESET;
|
||||
scsiDev.targets[i].sense.code = NO_SENSE;
|
||||
scsiDev.targets[i].sense.asc = NO_ADDITIONAL_SENSE_INFORMATION;
|
||||
}
|
||||
}
|
||||
|
||||
void scsiDisconnect()
|
||||
@ -852,7 +892,8 @@ int scsiReconnect()
|
||||
{
|
||||
// Arbitrate.
|
||||
ledOn();
|
||||
SCSI_Out_Bits_Write(scsiDev.scsiIdMask);
|
||||
uint8_t scsiIdMask = 1 << scsiDev.target->targetId;
|
||||
SCSI_Out_Bits_Write(scsiIdMask);
|
||||
SCSI_Out_Ctl_Write(1); // Write bits manually.
|
||||
SCSI_SetPin(SCSI_Out_BSY);
|
||||
|
||||
@ -860,7 +901,7 @@ int scsiReconnect()
|
||||
|
||||
uint8_t dbx = scsiReadDBxPins();
|
||||
sel = SCSI_ReadFilt(SCSI_Filt_SEL);
|
||||
if (sel || ((dbx ^ scsiDev.scsiIdMask) > scsiDev.scsiIdMask))
|
||||
if (sel || ((dbx ^ scsiIdMask) > scsiIdMask))
|
||||
{
|
||||
// Lost arbitration.
|
||||
SCSI_Out_Ctl_Write(0);
|
||||
@ -875,7 +916,7 @@ int scsiReconnect()
|
||||
|
||||
// Reselection phase
|
||||
SCSI_CTL_PHASE_Write(__scsiphase_io);
|
||||
SCSI_Out_Bits_Write(scsiDev.scsiIdMask | (1 << scsiDev.initiatorId));
|
||||
SCSI_Out_Bits_Write(scsiIdMask | (1 << scsiDev.initiatorId));
|
||||
scsiDeskewDelay(); // 2 deskew delays
|
||||
scsiDeskewDelay(); // 2 deskew delays
|
||||
SCSI_ClearPin(SCSI_Out_BSY);
|
||||
|
@ -63,7 +63,23 @@ typedef enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t scsiIdMask;
|
||||
uint8_t targetId;
|
||||
const TargetConfig* cfg;
|
||||
|
||||
ScsiSense sense;
|
||||
|
||||
uint16 unitAttention; // Set to the sense qualifier key to be returned.
|
||||
|
||||
// Only let the reserved initiator talk to us.
|
||||
// A 3rd party may be sending the RESERVE/RELEASE commands
|
||||
int reservedId; // 0 -> 7 if reserved. -1 if not reserved.
|
||||
int reserverId; // 0 -> 7 if reserved. -1 if not reserved.
|
||||
} TargetState;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TargetState targets[MAX_SCSI_TARGETS];
|
||||
TargetState* target;
|
||||
|
||||
// Set to true (1) if the ATN flag was set, and we need to
|
||||
// enter the MESSAGE_OUT phase.
|
||||
@ -91,17 +107,11 @@ typedef struct
|
||||
// Only let the reserved initiator talk to us.
|
||||
// A 3rd party may be sending the RESERVE/RELEASE commands
|
||||
int initiatorId; // 0 -> 7. Set during the selection phase.
|
||||
int reservedId; // 0 -> 7 if reserved. -1 if not reserved.
|
||||
int reserverId; // 0 -> 7 if reserved. -1 if not reserved.
|
||||
|
||||
// SCSI_STATUS value.
|
||||
// Change to CHECK_CONDITION when setting a SENSE value
|
||||
uint8 status;
|
||||
|
||||
ScsiSense sense;
|
||||
|
||||
uint16 unitAttention; // Set to the sense qualifier key to be returned.
|
||||
|
||||
uint8 msgIn;
|
||||
uint8 msgOut;
|
||||
|
||||
|
@ -161,7 +161,7 @@ sdReadMultiSectorPrep()
|
||||
{
|
||||
uint8 v;
|
||||
uint32 scsiLBA = (transfer.lba + transfer.currentBlock);
|
||||
uint32 sdLBA = SCSISector2SD(scsiLBA);
|
||||
uint32 sdLBA = SCSISector2SD(scsiDev.target->cfg, scsiLBA);
|
||||
|
||||
if (!sdDev.ccs)
|
||||
{
|
||||
@ -174,8 +174,8 @@ sdReadMultiSectorPrep()
|
||||
sdClearStatus();
|
||||
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = HARDWARE_ERROR;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.target->sense.code = HARDWARE_ERROR;
|
||||
scsiDev.target->sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
@ -205,8 +205,8 @@ dmaReadSector(uint8_t* outputBuffer)
|
||||
if (scsiDev.status != CHECK_CONDITION)
|
||||
{
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = HARDWARE_ERROR;
|
||||
scsiDev.sense.asc = UNRECOVERED_READ_ERROR;
|
||||
scsiDev.target->sense.code = HARDWARE_ERROR;
|
||||
scsiDev.target->sense.asc = UNRECOVERED_READ_ERROR;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
return;
|
||||
@ -272,8 +272,8 @@ void sdReadSingleSectorDMA(uint32_t lba, uint8_t* outputBuffer)
|
||||
sdClearStatus();
|
||||
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = HARDWARE_ERROR;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.target->sense.code = HARDWARE_ERROR;
|
||||
scsiDev.target->sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
@ -323,8 +323,8 @@ void sdCompleteRead()
|
||||
}
|
||||
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = HARDWARE_ERROR;
|
||||
scsiDev.sense.asc = UNRECOVERED_READ_ERROR;
|
||||
scsiDev.target->sense.code = HARDWARE_ERROR;
|
||||
scsiDev.target->sense.asc = UNRECOVERED_READ_ERROR;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
|
||||
@ -418,8 +418,8 @@ sdWriteSectorDMAPoll()
|
||||
sdClearStatus();
|
||||
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = HARDWARE_ERROR;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.target->sense.code = HARDWARE_ERROR;
|
||||
scsiDev.target->sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
@ -461,8 +461,8 @@ void sdCompleteWrite()
|
||||
{
|
||||
sdClearStatus();
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = HARDWARE_ERROR;
|
||||
scsiDev.sense.asc = WRITE_ERROR_AUTO_REALLOCATION_FAILED;
|
||||
scsiDev.target->sense.code = HARDWARE_ERROR;
|
||||
scsiDev.target->sense.asc = WRITE_ERROR_AUTO_REALLOCATION_FAILED;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
}
|
||||
@ -730,13 +730,14 @@ void sdWriteMultiSectorPrep()
|
||||
// We don't care about the response - if the command is not accepted, writes
|
||||
// will just be a bit slower.
|
||||
// Max 22bit parameter.
|
||||
uint32_t sdBlocks = transfer.blocks * SDSectorsPerSCSISector();
|
||||
uint32_t sdBlocks =
|
||||
transfer.blocks * SDSectorsPerSCSISector(scsiDev.target->cfg);
|
||||
uint32 blocks = sdBlocks > 0x7FFFFF ? 0x7FFFFF : sdBlocks;
|
||||
sdCommandAndResponse(SD_APP_CMD, 0);
|
||||
sdCommandAndResponse(SD_APP_SET_WR_BLK_ERASE_COUNT, blocks);
|
||||
|
||||
uint32 scsiLBA = (transfer.lba + transfer.currentBlock);
|
||||
uint32 sdLBA = SCSISector2SD(scsiLBA);
|
||||
uint32 sdLBA = SCSISector2SD(scsiDev.target->cfg, scsiLBA);
|
||||
if (!sdDev.ccs)
|
||||
{
|
||||
sdLBA = sdLBA * SD_SECTOR_SIZE;
|
||||
@ -747,8 +748,8 @@ void sdWriteMultiSectorPrep()
|
||||
scsiDiskReset();
|
||||
sdClearStatus();
|
||||
scsiDev.status = CHECK_CONDITION;
|
||||
scsiDev.sense.code = HARDWARE_ERROR;
|
||||
scsiDev.sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.target->sense.code = HARDWARE_ERROR;
|
||||
scsiDev.target->sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
scsiDev.phase = STATUS;
|
||||
}
|
||||
else
|
||||
|
@ -6,7 +6,7 @@
|
||||
<Toolchain Name="ARM GCC" Selected="True">
|
||||
<Tool Name="prebuild" Command="" Options="" />
|
||||
<Tool Name="assembler" Command="arm-none-eabi-as.exe" Options="-I. -I./Generated_Source/PSoC5 -mcpu=cortex-m3 -mthumb -g -alh=${OutputDir}/${CompileFile}.lst " />
|
||||
<Tool Name="compiler" Command="arm-none-eabi-gcc.exe" Options="-I. -I./Generated_Source/PSoC5 -Wno-main -mcpu=cortex-m3 -mthumb -Wall -g -D NDEBUG -Wa,-alh=${OutputDir}\${CompileFile}.lst -Os -ffunction-sections " />
|
||||
<Tool Name="compiler" Command="arm-none-eabi-gcc.exe" Options="-I. -I./Generated_Source/PSoC5 -Wno-main -mcpu=cortex-m3 -mthumb -I ../../../include -Wall -g -D NDEBUG -Wa,-alh=${OutputDir}\${CompileFile}.lst -Os -ffunction-sections " />
|
||||
<Tool Name="linker" Command="arm-none-eabi-gcc.exe" Options="-mthumb -march=armv7-m -mfix-cortex-m3-ldrd -T .\Generated_Source\PSoC5\cm3gcc.ld -g -Wl,-Map,${OutputDir}\${ProjectShortName}.map -specs=nano.specs -Wl,--gc-sections " />
|
||||
<Tool Name="postbuild" Command="" Options="" />
|
||||
</Toolchain>
|
||||
@ -18,7 +18,7 @@
|
||||
<Tool Name="postbuild" Command="" Options="" />
|
||||
</Toolchain>
|
||||
</Toolchains>
|
||||
<Project Name="SCSI2SD" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" Version="4.0" Type="Bootloadable">
|
||||
<Project Name="SCSI2SD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" Version="4.0" Type="Bootloadable">
|
||||
<CMSIS_SVD_File>SCSI2SD.svd</CMSIS_SVD_File>
|
||||
<Datasheet />
|
||||
<LinkerFiles>
|
||||
@ -27,8 +27,8 @@
|
||||
<LinkerFile Toolchain="IAR EWARM">.\Generated_Source\PSoC5\Cm3Iar.icf</LinkerFile>
|
||||
</LinkerFiles>
|
||||
<Folders>
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\src">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\src">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\main.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\diagnostic.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\disk.c</File>
|
||||
@ -42,6 +42,8 @@
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\config.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\led.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\time.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\hidpacket.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\cdrom.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\diagnostic.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\disk.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\geometry.h</File>
|
||||
@ -55,15 +57,22 @@
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\sd.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\config.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\time.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\cdrom.h</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">.\device.h</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\include">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">..\..\..\include\hidpacket.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\..\include\scsi2sd.h</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cyfitter_cfg.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cyfitter_cfg.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cydevice.h</File>
|
||||
@ -211,41 +220,41 @@
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\libelf.dll</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_GCC">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_GCC">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="ARM GCC">.\Generated_Source\PSoC5\ARM_GCC\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_Keil_MDK">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_Keil_MDK">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="ARM Keil MDK">.\Generated_Source\PSoC5\ARM_Keil_MDK\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5\IAR">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn\Generated_Source\PSoC5\IAR">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="IAR">.\Generated_Source\PSoC5\IAR\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\codegentemp">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\ARM_GCC_441">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\ARM_GCC_473">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\DP8051_Keil_951">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\DP8051">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\CortexM0">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\CortexM3">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
</Folders>
|
||||
</Project>
|
||||
|
Binary file not shown.
@ -109,6 +109,20 @@
|
||||
<build_action v="C_FILE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="hidpacket.c" persistent="..\..\src\hidpacket.c">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="C_FILE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="cdrom.c" persistent="..\..\src\cdrom.c">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="C_FILE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
</dependencies>
|
||||
</CyGuid_0820c2e7-528d-4137-9a08-97257b946089>
|
||||
</CyGuid_2f73275c-45bf-46ba-b3b1-00a2fe0c8dd8>
|
||||
@ -224,6 +238,27 @@
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="hidpacket.h" persistent="..\..\..\include\hidpacket.h">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="scsi2sd.h" persistent="..\..\..\include\scsi2sd.h">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="cdrom.h" persistent="..\..\src\cdrom.h">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
</dependencies>
|
||||
</CyGuid_0820c2e7-528d-4137-9a08-97257b946089>
|
||||
</CyGuid_2f73275c-45bf-46ba-b3b1-00a2fe0c8dd8>
|
||||
@ -3373,7 +3408,7 @@
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Library Generation@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Additional Include Directories" v="" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Additional Include Directories" v="../../../include" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Warnings as Errors" v="False" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Warning Level" v="High" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Pedantic Compilation" v="False" />
|
||||
@ -3405,7 +3440,7 @@
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Library Generation@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Additional Include Directories" v="" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Additional Include Directories" v="../../../include" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Warnings as Errors" v="False" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Warning Level" v="High" />
|
||||
<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Pedantic Compilation" v="False" />
|
||||
|
@ -18,7 +18,7 @@
|
||||
<Tool Name="postbuild" Command="" Options="" />
|
||||
</Toolchain>
|
||||
</Toolchains>
|
||||
<Project Name="USB_Bootloader" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" Version="4.0" Type="Bootloader">
|
||||
<Project Name="USB_Bootloader" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" Version="4.0" Type="Bootloader">
|
||||
<CMSIS_SVD_File>USB_Bootloader.svd</CMSIS_SVD_File>
|
||||
<Datasheet />
|
||||
<LinkerFiles>
|
||||
@ -27,13 +27,13 @@
|
||||
<LinkerFile Toolchain="IAR EWARM">.\Generated_Source\PSoC5\Cm3Iar.icf</LinkerFile>
|
||||
</LinkerFiles>
|
||||
<Folders>
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">.\main.c</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cyfitter_cfg.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cyfitter_cfg.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cymetadata.c</File>
|
||||
@ -111,41 +111,41 @@
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\libelf.dll</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5\ARM_GCC">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5\ARM_GCC">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="ARM GCC">.\Generated_Source\PSoC5\ARM_GCC\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5\ARM_Keil_MDK">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5\ARM_Keil_MDK">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="ARM Keil MDK">.\Generated_Source\PSoC5\ARM_Keil_MDK\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5\IAR">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5\IAR">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="IAR">.\Generated_Source\PSoC5\IAR\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\codegentemp">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\ARM_GCC_441">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\ARM_GCC_473">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\DP8051_Keil_951">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\DP8051">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\CortexM0">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\CortexM3">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn" />
|
||||
</Folder>
|
||||
</Folders>
|
||||
</Project>
|
||||
|
Binary file not shown.
@ -1116,7 +1116,7 @@
|
||||
<name_val_pair name="W:\SCSI2SD\software\SCSI2SD\USB_Bootloader.cydsn\CortexM3\ARM_GCC_473\Debug\USB_Bootloader.hex" v=""-mthumb ""-march=armv7-m ""-mfix-cortex-m3-ldrd ""-T "".\Generated_Source\PSoC5\cm3gcc.ld ""-g ""-Wl,-Map,${OutputDir}\${ProjectShortName}.map ""-specs=nano.specs ""-Wl,--gc-sections "" />
|
||||
</name>
|
||||
</genericCmdLineData>
|
||||
<codeGenCmdLineTag v=""-.appdatapath" "C:\Users\Micha_000\AppData\Local\Cypress Semiconductor\PSoC Creator\3.0" "-.fdsnotice" "-.fdswarpdepfile=warp_dependencies.txt" "-.fdselabdepfile=elab_dependencies.txt" "-.fdsbldfile=generated_files.txt" "-p" "Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\USB_Bootloader.cyprj" "-d" "CY8C5267AXI-LP051" "-s" "Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5" "--" "-yv2" "-v3" "-ygs" "-q10" "-o2" "-.fftcfgtype=LE" " />
|
||||
<codeGenCmdLineTag v=""-.appdatapath" "C:\Users\Micha_000\AppData\Local\Cypress Semiconductor\PSoC Creator\3.0" "-.fdsnotice" "-.fdswarpdepfile=warp_dependencies.txt" "-.fdselabdepfile=elab_dependencies.txt" "-.fdsbldfile=generated_files.txt" "-p" "Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\USB_Bootloader.cyprj" "-d" "CY8C5267AXI-LP051" "-s" "Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v3\USB_Bootloader.cydsn\Generated_Source\PSoC5" "--" "-yv2" "-v3" "-ygs" "-q10" "-o2" "-.fftcfgtype=LE" " />
|
||||
</CyGuid_b0374e30-ce3a-47f2-ad85-821643292c68>
|
||||
</dataGuid>
|
||||
<dataGuid v="597c5b74-0c46-4204-8b7f-96f3570671dc">
|
||||
@ -1669,14 +1669,14 @@
|
||||
<v>C:\Program Files (x86)\Cypress\PSoC Creator\3.0\PSoC Creator\warp\lib\common\stdlogic\mod_genv.vif</v>
|
||||
<v>C:\Program Files (x86)\Cypress\PSoC Creator\3.0\PSoC Creator\warp\lib\common\stdlogic\rtlpkg.vif</v>
|
||||
</warp_dep>
|
||||
<deps_time v="130571566842994698" />
|
||||
<deps_time v="130621702845187692" />
|
||||
<top_block v="TopDesign" />
|
||||
<last_generation v="0" />
|
||||
</CyGuid_925cc1e1-309e-4e08-b0a1-09a83c35b157>
|
||||
</dataGuid>
|
||||
<dataGuid v="769d31ea-68b1-4f0c-b90a-7c10a43ee563">
|
||||
<CyGuid_769d31ea-68b1-4f0c-b90a-7c10a43ee563 type_name="CyDesigner.Common.ProjMgmt.Model.CyLinkCustomData" version="1">
|
||||
<deps_time v="130571567839248780" />
|
||||
<deps_time v="130621704041554601" />
|
||||
</CyGuid_769d31ea-68b1-4f0c-b90a-7c10a43ee563>
|
||||
</dataGuid>
|
||||
<dataGuid v="bf610382-39c6-441f-80b8-b04622ea7845">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<Toolchain Name="ARM GCC" Selected="True">
|
||||
<Tool Name="prebuild" Command="" Options="" />
|
||||
<Tool Name="assembler" Command="arm-none-eabi-as.exe" Options="-I. -I./Generated_Source/PSoC5 -mcpu=cortex-m3 -mthumb -g -alh=${OutputDir}/${CompileFile}.lst " />
|
||||
<Tool Name="compiler" Command="arm-none-eabi-gcc.exe" Options="-I. -I./Generated_Source/PSoC5 -Wno-main -mcpu=cortex-m3 -mthumb -Wall -g -D NDEBUG -Wa,-alh=${OutputDir}\${CompileFile}.lst -Os -ffunction-sections " />
|
||||
<Tool Name="compiler" Command="arm-none-eabi-gcc.exe" Options="-I. -I./Generated_Source/PSoC5 -Wno-main -mcpu=cortex-m3 -mthumb -I ../../../include -Wall -g -D NDEBUG -Wa,-alh=${OutputDir}\${CompileFile}.lst -Os -ffunction-sections " />
|
||||
<Tool Name="linker" Command="arm-none-eabi-gcc.exe" Options="-mthumb -march=armv7-m -mfix-cortex-m3-ldrd -T .\Generated_Source\PSoC5\cm3gcc.ld -g -Wl,-Map,${OutputDir}\${ProjectShortName}.map -specs=nano.specs -Wl,--gc-sections " />
|
||||
<Tool Name="postbuild" Command="" Options="" />
|
||||
</Toolchain>
|
||||
@ -18,7 +18,7 @@
|
||||
<Tool Name="postbuild" Command="" Options="" />
|
||||
</Toolchain>
|
||||
</Toolchains>
|
||||
<Project Name="SCSI2SD" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" Version="4.0" Type="Bootloadable">
|
||||
<Project Name="SCSI2SD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" Version="4.0" Type="Bootloadable">
|
||||
<CMSIS_SVD_File>SCSI2SD.svd</CMSIS_SVD_File>
|
||||
<Datasheet />
|
||||
<LinkerFiles>
|
||||
@ -27,8 +27,8 @@
|
||||
<LinkerFile Toolchain="IAR EWARM">.\Generated_Source\PSoC5\Cm3Iar.icf</LinkerFile>
|
||||
</LinkerFiles>
|
||||
<Folders>
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\src">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\src">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\main.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\diagnostic.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\disk.c</File>
|
||||
@ -42,6 +42,8 @@
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\config.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\led.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\time.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\hidpacket.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\cdrom.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\diagnostic.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\disk.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\geometry.h</File>
|
||||
@ -55,15 +57,22 @@
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\sd.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\config.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\time.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\src\cdrom.h</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">.\device.h</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Folder BuildType="BUILD" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\include">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">..\..\..\include\scsi2sd.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">..\..\..\include\hidpacket.h</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cyfitter_cfg.h</File>
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cyfitter_cfg.c</File>
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\cybootloader.c</File>
|
||||
@ -208,41 +217,41 @@
|
||||
<File BuildType="BUILD" Toolchain="">.\Generated_Source\PSoC5\libelf.dll</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_GCC">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_GCC">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="ARM GCC">.\Generated_Source\PSoC5\ARM_GCC\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_Keil_MDK">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5\ARM_Keil_MDK">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="ARM Keil MDK">.\Generated_Source\PSoC5\ARM_Keil_MDK\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5\IAR">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<Folder BuildType="STRICT" Path="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn\Generated_Source\PSoC5\IAR">
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn">
|
||||
<File BuildType="BUILD" Toolchain="IAR">.\Generated_Source\PSoC5\IAR\CyComponentLibrary.a</File>
|
||||
</Files>
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\codegentemp">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\ARM_GCC_441">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\ARM_GCC_473">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\DP8051_Keil_951">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\DP8051">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\CortexM0">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
<Folder BuildType="EXCLUDE" Path=".\CortexM3">
|
||||
<Files Root="Z:\projects\SCSI2SD\git-timeout\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
<Files Root="Z:\projects\SCSI2SD\git\SCSI2SD\software\SCSI2SD\v4\SCSI2SD.cydsn" />
|
||||
</Folder>
|
||||
</Folders>
|
||||
</Project>
|
||||
|
Binary file not shown.
@ -109,6 +109,20 @@
|
||||
<build_action v="C_FILE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="hidpacket.c" persistent="..\..\src\hidpacket.c">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="C_FILE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="cdrom.c" persistent="..\..\src\cdrom.c">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="C_FILE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
</dependencies>
|
||||
</CyGuid_0820c2e7-528d-4137-9a08-97257b946089>
|
||||
</CyGuid_2f73275c-45bf-46ba-b3b1-00a2fe0c8dd8>
|
||||
@ -224,6 +238,27 @@
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="scsi2sd.h" persistent="..\..\..\include\scsi2sd.h">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="hidpacket.h" persistent="..\..\..\include\hidpacket.h">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="cdrom.h" persistent="..\..\src\cdrom.h">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="NONE" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
</dependencies>
|
||||
</CyGuid_0820c2e7-528d-4137-9a08-97257b946089>
|
||||
</CyGuid_2f73275c-45bf-46ba-b3b1-00a2fe0c8dd8>
|
||||
@ -2383,7 +2418,7 @@
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM0@Linker@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM0@Library Generation@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@C/C++@General@Additional Include Directories" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@C/C++@General@Additional Include Directories" v="../../../include" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@C/C++@General@Warnings as Errors" v="False" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@C/C++@General@Warning Level" v="High" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@C/C++@General@Pedantic Compilation" v="False" />
|
||||
@ -2415,7 +2450,7 @@
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@Linker@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Debug@CortexM3@Library Generation@Command Line@Command Line" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@C/C++@General@Additional Include Directories" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@C/C++@General@Additional Include Directories" v="../../../include" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@C/C++@General@Warnings as Errors" v="False" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@C/C++@General@Warning Level" v="High" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@C/C++@General@Pedantic Compilation" v="False" />
|
||||
@ -2813,4 +2848,4 @@
|
||||
<BootloaderTag hexFile="" elfFile="" />
|
||||
<current_generation v="2" />
|
||||
</CyGuid_fec8f9e8-2365-4bdb-96d3-a4380222e01b>
|
||||
</CyXmlSerializer>
|
||||
</CyXmlSerializer>
|
||||
|
Binary file not shown.
@ -5,8 +5,7 @@ Linux)
|
||||
# Builds all of the utilities (not firmware) under Linux.
|
||||
# Requires mingw installed to cross-compile Windows targets.
|
||||
|
||||
(cd bootloaderhost && ./build.sh) &&
|
||||
(cd scsi2sd-config && ./build.sh) &&
|
||||
(cd scsi2sd-util && ./build.sh) &&
|
||||
(cd scsi2sd-debug && ./build.sh)
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
@ -14,30 +13,25 @@ Linux)
|
||||
mkdir -p build/windows/64bit
|
||||
mkdir -p build/windows/32bit
|
||||
|
||||
cp bootloaderhost/build/linux/bootloaderhost build/linux
|
||||
cp scsi2sd-config/build/linux/scsi2sd-config build/linux
|
||||
cp scsi2sd-util/build/linux/scsi2sd-util build/linux
|
||||
cp scsi2sd-debug/build/linux/scsi2sd-debug build/linux
|
||||
|
||||
cp bootloaderhost/build/windows/32bit/bootloaderhost.exe build/windows/32bit
|
||||
cp scsi2sd-config/build/windows/32bit/scsi2sd-config.exe build/windows/32bit
|
||||
cp scsi2sd-util/build/windows/32bit/scsi2sd-util.exe build/windows/32bit
|
||||
cp scsi2sd-debug/build/windows/32bit/scsi2sd-debug.exe build/windows/32bit
|
||||
|
||||
cp bootloaderhost/build/windows/64bit/bootloaderhost.exe build/windows/64bit
|
||||
cp scsi2sd-config/build/windows/64bit/scsi2sd-config.exe build/windows/64bit
|
||||
cp scsi2sd-util/build/windows/64bit/scsi2sd-util.exe build/windows/64bit
|
||||
cp scsi2sd-debug/build/windows/64bit/scsi2sd-debug.exe build/windows/64bit
|
||||
fi
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
make -C bootloaderhost &&
|
||||
make -C scsi2sd-config &&
|
||||
make -C scsi2sd-util &&
|
||||
make -C scsi2sd-debug
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
mkdir -p build/mac
|
||||
|
||||
cp bootloaderhost/build/mac/bootloaderhost build/mac
|
||||
cp scsi2sd-config/build/mac/scsi2sd-config build/mac
|
||||
cp scsi2sd-util/build/mac/scsi2sd-util build/mac
|
||||
cp scsi2sd-debug/build/mac/scsi2sd-debug build/mac
|
||||
fi
|
||||
|
||||
|
@ -20,11 +20,64 @@
|
||||
#include <limits>
|
||||
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
using namespace SCSI2SD;
|
||||
|
||||
namespace
|
||||
{
|
||||
// Endian conversion routines.
|
||||
// The Cortex-M3 inside the Cypress PSoC 5LP is a
|
||||
// little-endian device.
|
||||
|
||||
bool isHostLE()
|
||||
{
|
||||
union
|
||||
{
|
||||
int i;
|
||||
char c[sizeof(int)];
|
||||
} x;
|
||||
x.i = 1;
|
||||
return (x.c[0] == 1);
|
||||
}
|
||||
|
||||
uint16_t toLE16(uint16_t in)
|
||||
{
|
||||
if (isHostLE())
|
||||
{
|
||||
return in;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (in >> 8) | (in << 8);
|
||||
}
|
||||
}
|
||||
uint16_t fromLE16(uint16_t in)
|
||||
{
|
||||
return toLE16(in);
|
||||
}
|
||||
|
||||
uint32_t toLE32(uint32_t in)
|
||||
{
|
||||
if (isHostLE())
|
||||
{
|
||||
return in;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (in >> 24) |
|
||||
((in >> 8) & 0xff00) |
|
||||
((in << 8) & 0xff0000) |
|
||||
(in << 24);
|
||||
}
|
||||
}
|
||||
uint32_t fromLE32(uint32_t in)
|
||||
{
|
||||
return toLE32(in);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TargetConfig
|
||||
ConfigUtil::Default(size_t targetIdx)
|
||||
{
|
||||
@ -64,11 +117,11 @@ ConfigUtil::fromBytes(const uint8_t* data)
|
||||
{
|
||||
TargetConfig result;
|
||||
memcpy(&result, data, sizeof(TargetConfig));
|
||||
result.sdSectorStart = ntohl(result.sdSectorStart);
|
||||
result.scsiSectors = ntohl(result.scsiSectors);
|
||||
result.bytesPerSector = ntohs(result.bytesPerSector);
|
||||
result.sectorsPerTrack = ntohs(result.sectorsPerTrack);
|
||||
result.headsPerCylinder = ntohs(result.headsPerCylinder);
|
||||
result.sdSectorStart = toLE32(result.sdSectorStart);
|
||||
result.scsiSectors = toLE32(result.scsiSectors);
|
||||
result.bytesPerSector = toLE16(result.bytesPerSector);
|
||||
result.sectorsPerTrack = toLE16(result.sectorsPerTrack);
|
||||
result.headsPerCylinder = toLE16(result.headsPerCylinder);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -77,11 +130,11 @@ std::vector<uint8_t>
|
||||
ConfigUtil::toBytes(const TargetConfig& _config)
|
||||
{
|
||||
TargetConfig config(_config);
|
||||
config.sdSectorStart = htonl(config.sdSectorStart);
|
||||
config.scsiSectors = htonl(config.scsiSectors);
|
||||
config.bytesPerSector = htons(config.bytesPerSector);
|
||||
config.sectorsPerTrack = htons(config.sectorsPerTrack);
|
||||
config.headsPerCylinder = htons(config.headsPerCylinder);
|
||||
config.sdSectorStart = fromLE32(config.sdSectorStart);
|
||||
config.scsiSectors = fromLE32(config.scsiSectors);
|
||||
config.bytesPerSector = fromLE16(config.bytesPerSector);
|
||||
config.sectorsPerTrack = fromLE16(config.sectorsPerTrack);
|
||||
config.headsPerCylinder = fromLE16(config.headsPerCylinder);
|
||||
|
||||
const uint8_t* begin = reinterpret_cast<const uint8_t*>(&config);
|
||||
return std::vector<uint8_t>(begin, begin + sizeof(config));
|
||||
|
@ -1,8 +1,9 @@
|
||||
VPATH=cybootloaderutils ../SCSI2SD/src
|
||||
|
||||
CPPFLAGS = -I cybootloaderutils -I hidapi/hidapi -I wxWidgets/include -I ../include
|
||||
CPPFLAGS = -I cybootloaderutils -I hidapi/hidapi -I wxWidgets/include -I ../include -Ilibzipper-1.0.3 -I$(BUILD)/zlib
|
||||
CFLAGS += -Wall -Wno-pointer-sign -O2 -g
|
||||
CXXFLAGS += -Wall -O2 -g -std=c++0x
|
||||
LDFLAGS += -L$(BUILD)/libzipper/.libs -lzipper -L$(BUILD)/zlib -lz
|
||||
|
||||
TARGET ?= $(shell uname -s)
|
||||
ifeq ($(TARGET),Win32)
|
||||
@ -65,12 +66,33 @@ OBJ = \
|
||||
$(BUILD)/hidpacket.o \
|
||||
|
||||
|
||||
$(OBJ): $(BUILD)/zlib/buildstamp
|
||||
$(BUILD)/zlib/buildstamp:
|
||||
mkdir -p $(dir $@)
|
||||
( \
|
||||
cd $(dir $@) && \
|
||||
cp -a $(CURDIR)/zlib-1.2.8/* . && \
|
||||
./configure --static && \
|
||||
$(MAKE) \
|
||||
) && \
|
||||
touch $@
|
||||
|
||||
$(OBJ): $(BUILD)/wx.buildstamp
|
||||
$(BUILD)/wx.buildstamp:
|
||||
$(BUILD)/wx.buildstamp: $(BUILD)/zlib/buildstamp
|
||||
mkdir -p $(dir $@)
|
||||
( \
|
||||
cd $(BUILD) && \
|
||||
$(CURDIR)/wxWidgets/configure $(WX_CONFIG) && \
|
||||
$(CURDIR)/wxWidgets/configure $(WX_CONFIG) CPPFLAGS=-I$(BUILD)/zlib LDFLAGS=-I$(BUILD)/zlib && \
|
||||
$(MAKE) \
|
||||
) && \
|
||||
touch $@
|
||||
|
||||
$(OBJ): $(BUILD)/libzipper/buildstamp
|
||||
$(BUILD)/libzipper/buildstamp:
|
||||
mkdir -p $(dir $@)
|
||||
( \
|
||||
cd $(dir $@) && \
|
||||
$(CURDIR)/libzipper-1.0.3/configure --disable-shared --enable-static && \
|
||||
$(MAKE) \
|
||||
) && \
|
||||
touch $@
|
||||
@ -88,5 +110,5 @@ $(BUILD)/scsi2sd-util$(EXE): $(OBJ)
|
||||
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `$(BUILD)/wx-config --libs` -o $@
|
||||
|
||||
clean:
|
||||
rm $(BUILD)/scsi2sd-util$(EXE) $(OBJ)
|
||||
rm $(BUILD)/scsi2sd-util$(EXE) $(OBJ) $(BUILD)/libzipper/buildstamp
|
||||
|
||||
|
@ -69,7 +69,7 @@ TargetPanel::TargetPanel(wxWindow* parent, const TargetConfig& initialConfig) :
|
||||
myNumSectorValidator(new wxIntegerValidator<uint32_t>),
|
||||
mySizeValidator(new wxFloatingPointValidator<float>(2))
|
||||
{
|
||||
wxFlexGridSizer *fgs = new wxFlexGridSizer(12, 3, 9, 25);
|
||||
wxFlexGridSizer *fgs = new wxFlexGridSizer(13, 3, 9, 25);
|
||||
|
||||
fgs->Add(new wxStaticText(this, wxID_ANY, wxT("")));
|
||||
myEnableCtrl =
|
||||
@ -100,6 +100,22 @@ TargetPanel::TargetPanel(wxWindow* parent, const TargetConfig& initialConfig) :
|
||||
fgs->Add(myScsiIdMsg);
|
||||
Bind(wxEVT_SPINCTRL, &TargetPanel::onInput<wxSpinEvent>, this, ID_scsiIdCtrl);
|
||||
|
||||
fgs->Add(new wxStaticText(this, wxID_ANY, wxT("Device Type")));
|
||||
wxString deviceTypes[] = {wxT("Hard Drive"), wxT("Removable"), wxT("CDROM")};
|
||||
myDeviceTypeCtrl =
|
||||
new wxChoice(
|
||||
this,
|
||||
ID_deviceTypeCtrl,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
sizeof(deviceTypes) / sizeof(wxString),
|
||||
deviceTypes
|
||||
);
|
||||
myDeviceTypeCtrl->SetSelection(0);
|
||||
fgs->Add(myDeviceTypeCtrl);
|
||||
fgs->Add(new wxStaticText(this, wxID_ANY, wxT("")));
|
||||
Bind(wxEVT_CHOICE, &TargetPanel::onInput<wxCommandEvent>, this, ID_deviceTypeCtrl);
|
||||
|
||||
fgs->Add(new wxStaticText(this, wxID_ANY, wxT("")));
|
||||
myParityCtrl =
|
||||
new wxCheckBox(
|
||||
@ -186,7 +202,7 @@ TargetPanel::TargetPanel(wxWindow* parent, const TargetConfig& initialConfig) :
|
||||
mySizeCtrl->SetToolTip(wxT("Device size"));
|
||||
sizeContainer->Add(mySizeCtrl);
|
||||
wxString units[] = {wxT("KB"), wxT("MB"), wxT("GB")};
|
||||
mySizeUnitCtrl =
|
||||
mySizeUnitCtrl =
|
||||
new wxChoice(
|
||||
this,
|
||||
ID_sizeUnitCtrl,
|
||||
@ -351,6 +367,7 @@ TargetPanel::evaluate()
|
||||
bool enabled = myEnableCtrl->IsChecked();
|
||||
{
|
||||
myScsiIdCtrl->Enable(enabled);
|
||||
myDeviceTypeCtrl->Enable(enabled);
|
||||
myParityCtrl->Enable(enabled);
|
||||
myUnitAttCtrl->Enable(enabled);
|
||||
myStartSDSectorCtrl->Enable(enabled);
|
||||
@ -471,6 +488,8 @@ TargetPanel::getConfig() const
|
||||
config.scsiId = config.scsiId | CONFIG_TARGET_ENABLED;
|
||||
}
|
||||
|
||||
config.deviceType = myDeviceTypeCtrl->GetSelection();
|
||||
|
||||
config.flags =
|
||||
(myParityCtrl->IsChecked() ? CONFIG_ENABLE_PARITY : 0) |
|
||||
(myUnitAttCtrl->IsChecked() ? CONFIG_ENABLE_UNIT_ATTENTION : 0);
|
||||
@ -503,6 +522,8 @@ TargetPanel::setConfig(const TargetConfig& config)
|
||||
myScsiIdCtrl->SetValue(config.scsiId & CONFIG_TARGET_ID_BITS);
|
||||
myEnableCtrl->SetValue(config.scsiId & CONFIG_TARGET_ENABLED);
|
||||
|
||||
myDeviceTypeCtrl->SetSelection(config.deviceType);
|
||||
|
||||
myParityCtrl->SetValue(config.flags & CONFIG_ENABLE_PARITY);
|
||||
myUnitAttCtrl->SetValue(config.flags & CONFIG_ENABLE_UNIT_ATTENTION);
|
||||
|
||||
|
@ -74,6 +74,7 @@ private:
|
||||
{
|
||||
ID_enableCtrl = wxID_HIGHEST + 1,
|
||||
ID_scsiIdCtrl,
|
||||
ID_deviceTypeCtrl,
|
||||
ID_parityCtrl,
|
||||
ID_unitAttCtrl,
|
||||
ID_startSDSectorCtrl,
|
||||
@ -103,6 +104,8 @@ private:
|
||||
wxSpinCtrl* myScsiIdCtrl;
|
||||
wxStaticText* myScsiIdMsg;
|
||||
|
||||
wxChoice* myDeviceTypeCtrl;
|
||||
|
||||
wxCheckBox* myParityCtrl;
|
||||
wxCheckBox* myUnitAttCtrl;
|
||||
|
||||
|
7
software/scsi2sd-util/build.sh
Executable file
7
software/scsi2sd-util/build.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -rf build/
|
||||
make && \
|
||||
make TARGET=Win32 &&
|
||||
make TARGET=Win64
|
||||
|
674
software/scsi2sd-util/libzipper-1.0.3/COPYING
Normal file
674
software/scsi2sd-util/libzipper-1.0.3/COPYING
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
26
software/scsi2sd-util/libzipper-1.0.3/CompressedFile.cc
Normal file
26
software/scsi2sd-util/libzipper-1.0.3/CompressedFile.cc
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
CompressedFile::~CompressedFile()
|
||||
{
|
||||
}
|
||||
|
||||
|
152
software/scsi2sd-util/libzipper-1.0.3/Compressor.cc
Normal file
152
software/scsi2sd-util/libzipper-1.0.3/Compressor.cc
Normal file
@ -0,0 +1,152 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "gzip.hh"
|
||||
#include "zip.hh"
|
||||
#include "util.hh"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
class Compressor::CompressorImpl
|
||||
{
|
||||
public:
|
||||
virtual ~CompressorImpl() {}
|
||||
|
||||
virtual void
|
||||
addFile(const std::string& filename, const Reader& reader) = 0;
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
class PlainCompressor : public Compressor::CompressorImpl
|
||||
{
|
||||
public:
|
||||
PlainCompressor(const WriterPtr& writer) : m_writer(writer) {}
|
||||
|
||||
virtual void
|
||||
addFile(const std::string&, const Reader& reader)
|
||||
{
|
||||
enum Constants
|
||||
{
|
||||
ChunkSize = 64*1024
|
||||
};
|
||||
|
||||
uint8_t buffer[ChunkSize];
|
||||
zsize_t offset(0);
|
||||
while (offset < reader.getSize())
|
||||
{
|
||||
zsize_t bytes(
|
||||
std::min(zsize_t(ChunkSize), reader.getSize() - offset));
|
||||
reader.readData(offset, bytes, &buffer[0]);
|
||||
m_writer->writeData(offset, bytes, &buffer[0]);
|
||||
offset += bytes;
|
||||
}
|
||||
}
|
||||
private:
|
||||
WriterPtr m_writer;
|
||||
};
|
||||
|
||||
class ZipCompressor : public Compressor::CompressorImpl
|
||||
{
|
||||
public:
|
||||
ZipCompressor(const WriterPtr& writer) : m_writer(writer) {}
|
||||
|
||||
virtual ~ZipCompressor()
|
||||
{
|
||||
zipFinalise(m_records, m_writer);
|
||||
}
|
||||
|
||||
virtual void
|
||||
addFile(const std::string& filename, const Reader& reader)
|
||||
{
|
||||
ZipFileRecord record;
|
||||
zip(filename, reader, m_writer, record);
|
||||
m_records.push_back(record);
|
||||
}
|
||||
private:
|
||||
WriterPtr m_writer;
|
||||
std::vector<ZipFileRecord> m_records;
|
||||
};
|
||||
|
||||
class GzipCompressor : public Compressor::CompressorImpl
|
||||
{
|
||||
public:
|
||||
GzipCompressor(const WriterPtr& writer) : m_writer(writer) {}
|
||||
|
||||
virtual void
|
||||
addFile(const std::string& filename, const Reader& reader)
|
||||
{
|
||||
gzip(filename, reader, m_writer);
|
||||
}
|
||||
private:
|
||||
WriterPtr m_writer;
|
||||
};
|
||||
}
|
||||
|
||||
Compressor::Compressor(ContainerFormat format, const WriterPtr& writer)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case Container_none:
|
||||
m_compressor = new PlainCompressor(writer); break;
|
||||
|
||||
case Container_zip:
|
||||
m_compressor = new ZipCompressor(writer); break;
|
||||
|
||||
case Container_gzip:
|
||||
m_compressor = new GzipCompressor(writer); break;
|
||||
|
||||
default:
|
||||
throw UnsupportedException("Unknown format");
|
||||
}
|
||||
}
|
||||
|
||||
Compressor::Compressor(ContainerFormat format, Writer& writer) :
|
||||
m_compressor(NULL)
|
||||
{
|
||||
WriterPtr ptr(&writer, dummy_delete<Writer>());
|
||||
switch (format)
|
||||
{
|
||||
case Container_none:
|
||||
m_compressor = new PlainCompressor(ptr); break;
|
||||
|
||||
case Container_zip:
|
||||
m_compressor = new ZipCompressor(ptr); break;
|
||||
|
||||
case Container_gzip:
|
||||
m_compressor = new GzipCompressor(ptr); break;
|
||||
|
||||
default:
|
||||
throw UnsupportedException("Unknown format");
|
||||
}
|
||||
}
|
||||
|
||||
Compressor::~Compressor()
|
||||
{
|
||||
delete m_compressor;
|
||||
}
|
||||
|
||||
void
|
||||
Compressor::addFile(const Reader& reader)
|
||||
{
|
||||
m_compressor->addFile(reader.getSourceName(), reader);
|
||||
}
|
||||
|
||||
|
47
software/scsi2sd-util/libzipper-1.0.3/Container.cc
Normal file
47
software/scsi2sd-util/libzipper-1.0.3/Container.cc
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct Container info_none =
|
||||
{ Container_none, "application/octet-stream", 13 };
|
||||
struct Container info_zip =
|
||||
{ Container_zip, "application/zip", 0x1f };
|
||||
struct Container info_gzip =
|
||||
{ Container_gzip, "zpplication/x-gzip", 7 };
|
||||
}
|
||||
|
||||
namespace zipper
|
||||
{
|
||||
const Container&
|
||||
getContainer(ContainerFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case Container_none: return info_none;
|
||||
case Container_zip: return info_zip;
|
||||
case Container_gzip: return info_gzip;
|
||||
default: throw Exception("Unknown format type requested");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
142
software/scsi2sd-util/libzipper-1.0.3/Decompressor.cc
Normal file
142
software/scsi2sd-util/libzipper-1.0.3/Decompressor.cc
Normal file
@ -0,0 +1,142 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "util.hh"
|
||||
|
||||
#include "gzip.hh"
|
||||
#include "zip.hh"
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
namespace
|
||||
{
|
||||
class PlainFile : public CompressedFile
|
||||
{
|
||||
public:
|
||||
PlainFile(const ReaderPtr& reader) :
|
||||
m_reader(reader)
|
||||
{}
|
||||
|
||||
virtual bool isDecompressSupported() const { return true; }
|
||||
virtual const std::string& getPath() const
|
||||
{
|
||||
return m_reader->getSourceName();
|
||||
}
|
||||
virtual zsize_t getCompressedSize() const
|
||||
{
|
||||
return m_reader->getSize();
|
||||
}
|
||||
virtual zsize_t getUncompressedSize() const
|
||||
{
|
||||
return m_reader->getSize();
|
||||
}
|
||||
|
||||
virtual void decompress(Writer& writer)
|
||||
{
|
||||
enum Constants
|
||||
{
|
||||
ChunkSize = 64*1024
|
||||
};
|
||||
zsize_t end(m_reader->getSize());
|
||||
|
||||
for (zsize_t pos(0); pos < end; pos += ChunkSize)
|
||||
{
|
||||
uint8_t buf[ChunkSize];
|
||||
size_t bytes(
|
||||
std::min(zsize_t(ChunkSize), end - pos)
|
||||
);
|
||||
m_reader->readData(pos, bytes, &buf[0]);
|
||||
writer.writeData(pos, bytes, &buf[0]);
|
||||
}
|
||||
}
|
||||
|
||||
virtual const timeval& getModificationTime() const
|
||||
{
|
||||
return m_reader->getModTime();
|
||||
}
|
||||
|
||||
private:
|
||||
ReaderPtr m_reader;
|
||||
};
|
||||
}
|
||||
|
||||
class Decompressor::DecompressorImpl
|
||||
{
|
||||
public:
|
||||
DecompressorImpl(const ReaderPtr& reader) :
|
||||
m_reader(reader),
|
||||
m_format(Container_none)
|
||||
{
|
||||
if (isZip(reader))
|
||||
{
|
||||
m_format = Container_zip;
|
||||
m_entries = unzip(reader);
|
||||
}
|
||||
else if (isGzip(reader))
|
||||
{
|
||||
m_format = Container_gzip;
|
||||
m_entries = ungzip(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_format = Container_none;
|
||||
m_entries.push_back(
|
||||
CompressedFilePtr(new PlainFile(reader))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ContainerFormat getContainerFormat() const { return m_format; }
|
||||
|
||||
std::vector<CompressedFilePtr> getEntries() const { return m_entries; }
|
||||
|
||||
private:
|
||||
ReaderPtr m_reader;
|
||||
ContainerFormat m_format;
|
||||
std::vector<CompressedFilePtr> m_entries;
|
||||
};
|
||||
|
||||
Decompressor::Decompressor(const ReaderPtr& reader) :
|
||||
m_decompressor(new DecompressorImpl(reader))
|
||||
{
|
||||
}
|
||||
|
||||
Decompressor::Decompressor(Reader& reader) :
|
||||
m_decompressor(
|
||||
new DecompressorImpl(ReaderPtr(&reader, dummy_delete<Reader>()))
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
Decompressor::~Decompressor()
|
||||
{
|
||||
delete m_decompressor;
|
||||
}
|
||||
|
||||
ContainerFormat
|
||||
Decompressor::getContainerFormat() const
|
||||
{
|
||||
return m_decompressor->getContainerFormat();
|
||||
}
|
||||
|
||||
std::vector<CompressedFilePtr>
|
||||
Decompressor::getEntries() const
|
||||
{
|
||||
return m_decompressor->getEntries();
|
||||
}
|
||||
|
1661
software/scsi2sd-util/libzipper-1.0.3/Doxyfile.in
Normal file
1661
software/scsi2sd-util/libzipper-1.0.3/Doxyfile.in
Normal file
File diff suppressed because it is too large
Load Diff
41
software/scsi2sd-util/libzipper-1.0.3/Exception.cc
Normal file
41
software/scsi2sd-util/libzipper-1.0.3/Exception.cc
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
Exception::Exception(const std::string& what) :
|
||||
std::runtime_error(what)
|
||||
{
|
||||
}
|
||||
|
||||
FormatException::FormatException(const std::string& what) :
|
||||
Exception(what)
|
||||
{
|
||||
}
|
||||
|
||||
UnsupportedException::UnsupportedException(const std::string& what) :
|
||||
Exception(what)
|
||||
{
|
||||
}
|
||||
|
||||
IOException::IOException(const std::string& what) :
|
||||
Exception(what)
|
||||
{
|
||||
}
|
||||
|
192
software/scsi2sd-util/libzipper-1.0.3/FileReader.cc
Normal file
192
software/scsi2sd-util/libzipper-1.0.3/FileReader.cc
Normal file
@ -0,0 +1,192 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "strerror.hh"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
const timeval zipper::s_now = {0,0};
|
||||
|
||||
|
||||
class FileReader::FileReaderImpl
|
||||
{
|
||||
public:
|
||||
FileReaderImpl(const std::string& filename) :
|
||||
m_filename(filename),
|
||||
m_fd(-1),
|
||||
m_closeOnExit(true)
|
||||
{
|
||||
m_fd = ::open(filename.c_str(), O_RDONLY);
|
||||
|
||||
if (m_fd < 0)
|
||||
{
|
||||
std::string errMsg(zipper::strerror(errno));
|
||||
|
||||
std::stringstream message;
|
||||
message << "Could not open file \"" << filename << "\": " <<
|
||||
errMsg;
|
||||
throw IOException(message.str());
|
||||
}
|
||||
initStats();
|
||||
}
|
||||
|
||||
FileReaderImpl(const std::string& filename, int fd, bool closeFd) :
|
||||
m_filename(filename),
|
||||
m_fd(fd),
|
||||
m_closeOnExit(closeFd)
|
||||
{
|
||||
initStats();
|
||||
}
|
||||
|
||||
~FileReaderImpl()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
const std::string& getSourceName() const { return m_filename; }
|
||||
const timeval& getModTime() const { return m_modTime; }
|
||||
|
||||
zsize_t getSize() const { return m_size; }
|
||||
|
||||
virtual void readData(
|
||||
zsize_t offset, zsize_t bytes, uint8_t* dest
|
||||
) const
|
||||
{
|
||||
assert(m_fd >= 0);
|
||||
|
||||
zsize_t bytesRead(0);
|
||||
while(bytesRead < bytes)
|
||||
{
|
||||
ssize_t currentBytes(
|
||||
pread(
|
||||
m_fd,
|
||||
dest + bytesRead,
|
||||
bytes - bytesRead,
|
||||
offset + bytesRead)
|
||||
);
|
||||
|
||||
if (currentBytes > 0)
|
||||
{
|
||||
bytesRead += static_cast<zsize_t>(currentBytes);
|
||||
}
|
||||
else if (currentBytes == 0)
|
||||
{
|
||||
throw FormatException("Unexpected end-of-file");
|
||||
}
|
||||
else if ((currentBytes < 0) && (errno != EINTR))
|
||||
{
|
||||
std::string errMsg(zipper::strerror(errno));
|
||||
throw IOException(errMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void initStats()
|
||||
{
|
||||
// If we fail here, we need to essentially run the dtor manually.
|
||||
// initStats is called from the constructors, and so the dtor will
|
||||
// NOT run if an exception is thrown.
|
||||
|
||||
struct stat buf;
|
||||
int result(fstat(m_fd, &buf));
|
||||
if (result != 0)
|
||||
{
|
||||
int errnoLocal = errno;
|
||||
close();
|
||||
|
||||
std::string errMsg(zipper::strerror(errnoLocal));
|
||||
|
||||
std::stringstream message;
|
||||
message << "Could not get filesize for file " <<
|
||||
"\"" << m_filename << "\": " << errMsg;
|
||||
throw IOException(message.str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_size = buf.st_size;
|
||||
m_modTime.tv_sec = buf.st_mtime;
|
||||
m_modTime.tv_usec = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
if ((m_fd >= 0) && m_closeOnExit)
|
||||
{
|
||||
::close(m_fd);
|
||||
m_fd = -1;
|
||||
}
|
||||
}
|
||||
std::string m_filename;
|
||||
int m_fd;
|
||||
bool m_closeOnExit;
|
||||
zsize_t m_size;
|
||||
timeval m_modTime;
|
||||
};
|
||||
|
||||
FileReader::FileReader(const std::string& filename) :
|
||||
m_impl(new FileReaderImpl(filename))
|
||||
{
|
||||
}
|
||||
|
||||
FileReader::FileReader(const std::string& filename, int fd, bool closeFd) :
|
||||
m_impl(new FileReaderImpl(filename, fd, closeFd))
|
||||
{
|
||||
}
|
||||
|
||||
FileReader::~FileReader()
|
||||
{
|
||||
delete m_impl;
|
||||
}
|
||||
|
||||
const std::string&
|
||||
FileReader::getSourceName() const
|
||||
{
|
||||
return m_impl->getSourceName();
|
||||
}
|
||||
|
||||
const timeval&
|
||||
FileReader::getModTime() const
|
||||
{
|
||||
return m_impl->getModTime();
|
||||
}
|
||||
|
||||
zsize_t
|
||||
FileReader::getSize() const
|
||||
{
|
||||
return m_impl->getSize();
|
||||
}
|
||||
|
||||
void
|
||||
FileReader::readData(
|
||||
zsize_t offset, zsize_t bytes, uint8_t* dest
|
||||
) const
|
||||
{
|
||||
return m_impl->readData(offset, bytes, dest);
|
||||
}
|
||||
|
176
software/scsi2sd-util/libzipper-1.0.3/FileWriter.cc
Normal file
176
software/scsi2sd-util/libzipper-1.0.3/FileWriter.cc
Normal file
@ -0,0 +1,176 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "strerror.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <errno.h>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
class FileWriter::FileWriterImpl
|
||||
{
|
||||
public:
|
||||
FileWriterImpl(
|
||||
const std::string& filename,
|
||||
mode_t createPermissions,
|
||||
const timeval& modTime
|
||||
) :
|
||||
m_filename(filename),
|
||||
m_modTime(modTime),
|
||||
m_fd(-1),
|
||||
m_closeOnExit(true),
|
||||
m_setModTimeOnExit(true)
|
||||
{
|
||||
m_fd =
|
||||
::open(
|
||||
filename.c_str(),
|
||||
O_WRONLY | O_TRUNC | O_CREAT,
|
||||
createPermissions);
|
||||
|
||||
if (m_fd < 0)
|
||||
{
|
||||
std::string errMsg(zipper::strerror(errno));
|
||||
|
||||
std::stringstream message;
|
||||
message << "Could not open file \"" << filename << "\": " <<
|
||||
errMsg;
|
||||
throw IOException(message.str());
|
||||
}
|
||||
}
|
||||
|
||||
FileWriterImpl(const std::string& filename, int fd, bool closeFd) :
|
||||
m_filename(filename),
|
||||
m_fd(fd),
|
||||
m_closeOnExit(closeFd),
|
||||
m_setModTimeOnExit(false)
|
||||
{
|
||||
}
|
||||
|
||||
~FileWriterImpl()
|
||||
{
|
||||
close();
|
||||
|
||||
if (m_setModTimeOnExit)
|
||||
{
|
||||
struct timeval times[2];
|
||||
if (s_now.tv_sec == m_modTime.tv_sec)
|
||||
{
|
||||
gettimeofday(×[0], NULL);
|
||||
times[1] = times[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
times[0] = m_modTime;
|
||||
times[1] = m_modTime;
|
||||
}
|
||||
utimes(m_filename.c_str(), times);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void writeData(
|
||||
zsize_t offset, zsize_t bytes, const uint8_t* data
|
||||
) const
|
||||
{
|
||||
assert(m_fd >= 0);
|
||||
|
||||
zsize_t bytesWritten(0);
|
||||
while(bytesWritten < bytes)
|
||||
{
|
||||
ssize_t currentBytes(
|
||||
pwrite(
|
||||
m_fd,
|
||||
data + bytesWritten,
|
||||
bytes - bytesWritten,
|
||||
offset + bytesWritten)
|
||||
);
|
||||
|
||||
if (currentBytes >= 0)
|
||||
{
|
||||
bytesWritten += static_cast<zsize_t>(currentBytes);
|
||||
}
|
||||
else if ((currentBytes < 0) && (errno != EINTR))
|
||||
{
|
||||
std::string errMsg(zipper::strerror(errno));
|
||||
throw IOException(errMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zsize_t getSize() const
|
||||
{
|
||||
assert(m_fd >= 0);
|
||||
zsize_t result(lseek(m_fd, 0, SEEK_END));
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
void close()
|
||||
{
|
||||
if ((m_fd >= 0) && m_closeOnExit)
|
||||
{
|
||||
::close(m_fd);
|
||||
m_fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
std::string m_filename;
|
||||
timeval m_modTime;
|
||||
int m_fd;
|
||||
bool m_closeOnExit;
|
||||
bool m_setModTimeOnExit;
|
||||
};
|
||||
|
||||
FileWriter::FileWriter(
|
||||
const std::string& filename,
|
||||
mode_t createPermissions,
|
||||
const timeval& modTime) :
|
||||
m_impl(new FileWriterImpl(filename, createPermissions, modTime))
|
||||
{
|
||||
}
|
||||
|
||||
FileWriter::FileWriter(const std::string& filename, int fd, bool closeFd) :
|
||||
m_impl(new FileWriterImpl(filename, fd, closeFd))
|
||||
{
|
||||
}
|
||||
|
||||
FileWriter::~FileWriter()
|
||||
{
|
||||
delete m_impl;
|
||||
}
|
||||
|
||||
void
|
||||
FileWriter::writeData(zsize_t offset, zsize_t bytes, const uint8_t* data)
|
||||
{
|
||||
m_impl->writeData(offset, bytes, data);
|
||||
}
|
||||
|
||||
zsize_t
|
||||
FileWriter::getSize() const
|
||||
{
|
||||
return m_impl->getSize();
|
||||
}
|
||||
|
49
software/scsi2sd-util/libzipper-1.0.3/INSTALL
Normal file
49
software/scsi2sd-util/libzipper-1.0.3/INSTALL
Normal file
@ -0,0 +1,49 @@
|
||||
libzipper
|
||||
Michael McMaster <michael@codesrc.com>
|
||||
|
||||
* Refer to INSTALL.Android for Google Android NDK compilation information.
|
||||
|
||||
Pre-Requisites
|
||||
g++ (4.5.3)
|
||||
make (GNU make 3.81)
|
||||
zlib (1.2.3)
|
||||
doxygen (1.7.4)
|
||||
|
||||
Optional
|
||||
automake (1.11), autoconf (2.68), libtool (2.4)
|
||||
(Required if building from git)
|
||||
|
||||
graphviz (2.26.3) (for dependency diagrams in the generated docs)
|
||||
|
||||
When building from sources obtained from the git repository, the configure
|
||||
script must be created first using the autoconf/automake/libtool packages.
|
||||
The supplied autogen.sh script automates this process.
|
||||
|
||||
*NOTE: it is not necessary to run the autogen.sh script when using a
|
||||
source distribution release. ie. If you obtained the sources via
|
||||
libzipper-major.minor.patch.tar.gz, do not run autogen.sh
|
||||
|
||||
./autogen.sh
|
||||
|
||||
The configure script creates the makefiles specific to your host. eg. It
|
||||
allows the paths to dependant packages to be specified.
|
||||
|
||||
./configure --prefix=/usr
|
||||
|
||||
The --prefix option specifies the base installation directory, and defaults
|
||||
to /usr/local (in which case, the library would be installed in /usr/local/lib,
|
||||
and the zipper binary would be installed in /usr/local/bin).
|
||||
|
||||
To obtain a complete listing of configure options, use the --help option.
|
||||
|
||||
./configure --help
|
||||
|
||||
Once the configure script is run, the software can be compiled.
|
||||
|
||||
make
|
||||
|
||||
Now it's time to install the software. This step must be run by a user with
|
||||
write access to the installation directory (/usr/local by default).
|
||||
|
||||
make install
|
||||
|
40
software/scsi2sd-util/libzipper-1.0.3/INSTALL.Android
Normal file
40
software/scsi2sd-util/libzipper-1.0.3/INSTALL.Android
Normal file
@ -0,0 +1,40 @@
|
||||
libzipper
|
||||
Michael McMaster <michael@codesrc.com>
|
||||
|
||||
Pre-Requisites
|
||||
Android NDK (tested with android-ndk-r6)
|
||||
Existing Android project
|
||||
|
||||
NDK Limitations
|
||||
* Your Application.mk file must enable C++ exceptions with:
|
||||
APP_CPPFLAGS := -fexceptions -frtti
|
||||
Although the NDK supports exceptions as of r5, they are disabled by
|
||||
default for backwards compatibility.
|
||||
|
||||
* Your Application.mk file must specify a C++ STL implementation with
|
||||
exception support. As of r6, only gnustl_static provides exception support.
|
||||
APP_STL := gnustl_static
|
||||
|
||||
Note that this port doesn't include any JNI interface code. It is expected that
|
||||
libzipper will be called from other native code libraries, and not directly
|
||||
from Java.
|
||||
|
||||
Including libzipper in your NDK project:
|
||||
1) Modify your Application.mk file to include the module, and
|
||||
set APP_CPPFLAGS and APP_STL as stated under "NDK Limitations" above.
|
||||
|
||||
APP_CPPFLAGS += -fexceptions -frtti
|
||||
APP_STL := gnustl_static
|
||||
APP_MODULES += zipper
|
||||
|
||||
2) Modify your applications Android.mk file to import the libzipper module:
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += libzipper
|
||||
$(call import-module,zipper)
|
||||
|
||||
3) Set the NDK_MODULE_PATH variable to include the libzipper source directory
|
||||
when calling ndk-build.
|
||||
eg. If libzipper was extracted to /tmp/libzipper-1.0.3:
|
||||
|
||||
cd /path/to/your/ndk/application
|
||||
ndk-build NDK_MODULE_PATH="/tmp/libzipper-1.0.3/android"
|
85
software/scsi2sd-util/libzipper-1.0.3/Makefile.am
Normal file
85
software/scsi2sd-util/libzipper-1.0.3/Makefile.am
Normal file
@ -0,0 +1,85 @@
|
||||
# Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
#
|
||||
# This file is part of libzipper.
|
||||
#
|
||||
# libzipper 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
include doxygen.am
|
||||
|
||||
dist_noinst_SCRIPTS = \
|
||||
autogen.sh
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libzipper1.pc
|
||||
|
||||
EXTRA_DIST = \
|
||||
COPYING \
|
||||
INSTALL \
|
||||
INSTALL.Android \
|
||||
NEWS \
|
||||
README \
|
||||
VERSION \
|
||||
android/zipper/Android.mk
|
||||
|
||||
|
||||
lib_LTLIBRARIES = libzipper.la
|
||||
libzipper_la_SOURCES = \
|
||||
Compressor.cc \
|
||||
CompressedFile.cc \
|
||||
Container.cc \
|
||||
Decompressor.cc \
|
||||
deflate.cc \
|
||||
deflate.hh \
|
||||
Exception.cc \
|
||||
FileReader.cc \
|
||||
FileWriter.cc \
|
||||
gzip.cc \
|
||||
gzip.hh \
|
||||
Reader.cc \
|
||||
split.hh \
|
||||
strerror.hh \
|
||||
util.hh \
|
||||
Writer.cc \
|
||||
zip.hh \
|
||||
zip.cc
|
||||
|
||||
if HAVE_GNU_STRERROR
|
||||
libzipper_la_SOURCES += \
|
||||
port/strerror_gnu.cc
|
||||
else
|
||||
libzipper_la_SOURCES += \
|
||||
port/strerror_posix.cc
|
||||
endif
|
||||
|
||||
# Public API headers go here, for installation to /usr/include
|
||||
include_HEADERS = zipper.hh
|
||||
|
||||
libzipper_la_LDFLAGS = ${ZLIB_LIBS} -version-info 1:0
|
||||
libzipper_la_CFLAGS = ${ZLIB_CFLAGS}
|
||||
|
||||
bin_PROGRAMS = zipper
|
||||
man_MANS = zipper.1
|
||||
|
||||
zipper_SOURCES = \
|
||||
zipper.cc
|
||||
|
||||
zipper_LDADD = libzipper.la
|
||||
|
||||
CXXFLAGS=-g -O2 -W -Wall -std=c++0x
|
||||
|
||||
MOSTLYCLEANFILES=$(DX_CLEANFILES)
|
||||
|
||||
install-data-local: doxygen-install
|
||||
all-local: doxygen-doc
|
||||
|
1110
software/scsi2sd-util/libzipper-1.0.3/Makefile.in
Normal file
1110
software/scsi2sd-util/libzipper-1.0.3/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
15
software/scsi2sd-util/libzipper-1.0.3/NEWS
Normal file
15
software/scsi2sd-util/libzipper-1.0.3/NEWS
Normal file
@ -0,0 +1,15 @@
|
||||
2011-10-05 Version 1.0.3
|
||||
- Added Android NDK support
|
||||
|
||||
2011-09-07 Version 1.0.2
|
||||
- Fixed a bug in deflate, which caused it to exit prematurely and
|
||||
report valid files as corrupt.
|
||||
|
||||
2011-05-27 Version 1.0.1
|
||||
- Removed private classes from doxygen output
|
||||
- Added the zipper utility executable
|
||||
- Added timestamp support
|
||||
|
||||
2011-05-21 Version 1.0.0
|
||||
- Initial release
|
||||
|
17
software/scsi2sd-util/libzipper-1.0.3/README
Normal file
17
software/scsi2sd-util/libzipper-1.0.3/README
Normal file
@ -0,0 +1,17 @@
|
||||
libzipper
|
||||
Michael McMaster <michael@codesrc.com>
|
||||
|
||||
libzipper offers a flexible C++ interface for reading and writing compressed
|
||||
files in multiple formats. It is intended for use in reading small compressed
|
||||
data files, such as configuration files and saved games.
|
||||
|
||||
libzipper currently supports plain, zip, and gzip formats.
|
||||
|
||||
libzipper is not a general-purpose archive management library, as it
|
||||
does not provide access to the filesystem attributes of each file.
|
||||
(ie. libzipper does not support the concepts of file owner, group or
|
||||
permissions.
|
||||
|
||||
Missing Features
|
||||
- zip64 support (for >4Gb zip files)
|
||||
|
25
software/scsi2sd-util/libzipper-1.0.3/Reader.cc
Normal file
25
software/scsi2sd-util/libzipper-1.0.3/Reader.cc
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
Reader::~Reader()
|
||||
{
|
||||
}
|
||||
|
1
software/scsi2sd-util/libzipper-1.0.3/VERSION
Normal file
1
software/scsi2sd-util/libzipper-1.0.3/VERSION
Normal file
@ -0,0 +1 @@
|
||||
1.0.3
|
25
software/scsi2sd-util/libzipper-1.0.3/Writer.cc
Normal file
25
software/scsi2sd-util/libzipper-1.0.3/Writer.cc
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
Writer::~Writer()
|
||||
{
|
||||
}
|
||||
|
10124
software/scsi2sd-util/libzipper-1.0.3/aclocal.m4
vendored
Normal file
10124
software/scsi2sd-util/libzipper-1.0.3/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_CFLAGS := -W -Wall -Werror -D_POSIX_C_SOURCE=200112
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../
|
||||
|
||||
# bionic /sys/types.h fails with -std=c++0x, as it doesn't include
|
||||
# stdint.h, but tries to use uint64_t.
|
||||
LOCAL_CPPFLAGS := -std=gnu++0x
|
||||
LOCAL_EXPORT_CPPFLAGS := -std=gnu++0x
|
||||
|
||||
# libzipper throws exceptions
|
||||
LOCAL_CPPFLAGS += -fexceptions -frtti
|
||||
LOCAL_EXPORT_CPPFLAGS += -fexceptions -frtti
|
||||
|
||||
LOCAL_CPP_EXTENSION := .cc
|
||||
|
||||
LOCAL_LDLIBS := -lz
|
||||
LOCAL_EXPORT_LDLIBS := -lz
|
||||
|
||||
LOCAL_MODULE := zipper
|
||||
LOCAL_MODULE_FILENAME := libzipper
|
||||
|
||||
LOCAL_SRC_FILES :=\
|
||||
../../CompressedFile.cc \
|
||||
../../deflate.cc \
|
||||
../../gzip.cc \
|
||||
../../zip.cc \
|
||||
../../Compressor.cc \
|
||||
../../Exception.cc \
|
||||
../../Reader.cc \
|
||||
../../zipper.cc \
|
||||
../../Container.cc \
|
||||
../../FileReader.cc \
|
||||
../../Decompressor.cc \
|
||||
../../FileWriter.cc \
|
||||
../../Writer.cc \
|
||||
../../port/strerror_posix.cc \
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
72
software/scsi2sd-util/libzipper-1.0.3/autoconfig.h.in
Normal file
72
software/scsi2sd-util/libzipper-1.0.3/autoconfig.h.in
Normal file
@ -0,0 +1,72 @@
|
||||
/* autoconfig.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRERROR_R
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strerror_r' function. */
|
||||
#undef HAVE_STRERROR_R
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if strerror_r returns char *. */
|
||||
#undef STRERROR_R_CHAR_P
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
2
software/scsi2sd-util/libzipper-1.0.3/autogen.sh
Executable file
2
software/scsi2sd-util/libzipper-1.0.3/autogen.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
autoreconf --force --install
|
1517
software/scsi2sd-util/libzipper-1.0.3/config.guess
vendored
Executable file
1517
software/scsi2sd-util/libzipper-1.0.3/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1760
software/scsi2sd-util/libzipper-1.0.3/config.sub
vendored
Executable file
1760
software/scsi2sd-util/libzipper-1.0.3/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
20148
software/scsi2sd-util/libzipper-1.0.3/configure
vendored
Executable file
20148
software/scsi2sd-util/libzipper-1.0.3/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
53
software/scsi2sd-util/libzipper-1.0.3/configure.ac
Normal file
53
software/scsi2sd-util/libzipper-1.0.3/configure.ac
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
#
|
||||
# This file is part of libzipper.
|
||||
#
|
||||
# libzipper 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_INIT([libzipper], m4_esyscmd_s([cat VERSION]), [michael@codesrc.com])
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
AC_CONFIG_HEADERS([autoconfig.h])
|
||||
AC_CONFIG_FILES([Makefile Doxyfile libzipper1.pc zipper.1])
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_SUBST([libzipper_version], m4_esyscmd_s([cat VERSION]))
|
||||
|
||||
AC_PROG_CXX
|
||||
AC_LANG([C++])
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_FUNC_STRERROR_R
|
||||
AM_CONDITIONAL(HAVE_GNU_STRERROR,[test x$ac_cv_func_strerror_r_char_p = xyes])
|
||||
|
||||
DX_DOXYGEN_FEATURE([ON])
|
||||
DX_HTML_FEATURE([ON])
|
||||
DX_CHM_FEATURE(OFF)
|
||||
DX_CHI_FEATURE(OFF)
|
||||
DX_MAN_FEATURE(OFF)
|
||||
DX_RTF_FEATURE(OFF)
|
||||
DX_XML_FEATURE(OFF)
|
||||
DX_PDF_FEATURE(OFF)
|
||||
DX_PS_FEATURE(OFF)
|
||||
|
||||
DX_INIT_DOXYGEN([libzipper], [Doxyfile], [doc])
|
||||
|
||||
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3],,
|
||||
AC_MSG_ERROR([zlib 1.2.3 or newer not found.])
|
||||
)
|
||||
|
||||
AC_OUTPUT
|
||||
|
213
software/scsi2sd-util/libzipper-1.0.3/deflate.cc
Normal file
213
software/scsi2sd-util/libzipper-1.0.3/deflate.cc
Normal file
@ -0,0 +1,213 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "deflate.hh"
|
||||
#include "util.hh"
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct DeflateDeleter
|
||||
{
|
||||
public:
|
||||
DeflateDeleter(z_stream* stream) : m_stream(stream) {}
|
||||
~DeflateDeleter()
|
||||
{
|
||||
deflateEnd(m_stream);
|
||||
|
||||
}
|
||||
private:
|
||||
z_stream* m_stream;
|
||||
};
|
||||
|
||||
struct InflateDeleter
|
||||
{
|
||||
public:
|
||||
InflateDeleter(z_stream* stream) : m_stream(stream) {}
|
||||
~InflateDeleter()
|
||||
{
|
||||
inflateEnd(m_stream);
|
||||
|
||||
}
|
||||
private:
|
||||
z_stream* m_stream;
|
||||
};
|
||||
|
||||
enum Constants
|
||||
{
|
||||
ChunkSize = 64*1024,
|
||||
WindowBits = 15
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
zipper::deflate(
|
||||
const Reader& reader,
|
||||
const WriterPtr& writer,
|
||||
zsize_t& writeOffset,
|
||||
zsize_t& uncompressedSize,
|
||||
zsize_t& compressedSize,
|
||||
uint32_t& crc)
|
||||
{
|
||||
uint8_t inChunk[ChunkSize];
|
||||
uint8_t outChunk[ChunkSize];
|
||||
|
||||
uncompressedSize = 0;
|
||||
compressedSize = 0;
|
||||
|
||||
z_stream stream;
|
||||
stream.zalloc = NULL;
|
||||
stream.zfree = NULL;
|
||||
stream.opaque = NULL;
|
||||
int zlibErr(
|
||||
deflateInit2(
|
||||
&stream,
|
||||
Z_DEFAULT_COMPRESSION,
|
||||
Z_DEFLATED,
|
||||
-WindowBits,
|
||||
MAX_MEM_LEVEL,
|
||||
Z_DEFAULT_STRATEGY)
|
||||
);
|
||||
|
||||
assert(zlibErr == Z_OK);
|
||||
DeflateDeleter deleter(&stream);
|
||||
stream.next_in = NULL;
|
||||
stream.avail_in = 0;
|
||||
bool finished(false);
|
||||
|
||||
zsize_t pos(0);
|
||||
zsize_t end(reader.getSize());
|
||||
crc = crc32(0, NULL, 0);
|
||||
|
||||
while (!finished)
|
||||
{
|
||||
if ((stream.avail_in == 0) && (pos < end))
|
||||
{
|
||||
stream.avail_in =
|
||||
std::min(zsize_t(ChunkSize), end - pos);
|
||||
reader.readData(
|
||||
pos, stream.avail_in, &inChunk[0]);
|
||||
stream.next_in = reinterpret_cast<Bytef*>(&inChunk);
|
||||
pos += stream.avail_in;
|
||||
uncompressedSize += stream.avail_in;
|
||||
crc = crc32(crc, stream.next_in, stream.avail_in);
|
||||
}
|
||||
|
||||
stream.next_out = reinterpret_cast<Bytef*>(&outChunk);
|
||||
stream.avail_out = sizeof(outChunk);
|
||||
|
||||
finished = false;
|
||||
zlibErr = deflate(&stream, (pos < end) ? Z_NO_FLUSH : Z_FINISH);
|
||||
|
||||
if (zlibErr == Z_STREAM_END)
|
||||
{
|
||||
if (pos < end)
|
||||
{
|
||||
assert(!"zlib buffer unexpectedly empty");
|
||||
std::terminate();
|
||||
}
|
||||
finished = true;
|
||||
}
|
||||
else if (zlibErr != Z_OK)
|
||||
{
|
||||
throw FormatException("Corrupt Data");
|
||||
}
|
||||
|
||||
zsize_t bytesToWrite(sizeof(outChunk) - stream.avail_out);
|
||||
writer->writeData(writeOffset, bytesToWrite, &outChunk[0]);
|
||||
writeOffset += bytesToWrite;
|
||||
compressedSize += bytesToWrite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
zipper::inflate(
|
||||
const ReaderPtr& reader,
|
||||
Writer& writer,
|
||||
zsize_t& readOffset,
|
||||
zsize_t readEnd,
|
||||
zsize_t& writeOffset,
|
||||
uint32_t& crc)
|
||||
{
|
||||
uint8_t inChunk[ChunkSize];
|
||||
uint8_t outChunk[ChunkSize];
|
||||
|
||||
z_stream stream;
|
||||
stream.zalloc = NULL;
|
||||
stream.zfree = NULL;
|
||||
stream.opaque = NULL;
|
||||
int zlibErr(inflateInit2(&stream, -WindowBits));
|
||||
assert(zlibErr == Z_OK);
|
||||
InflateDeleter deleter(&stream);
|
||||
stream.next_in = NULL;
|
||||
stream.avail_in = 0;
|
||||
bool finished(false);
|
||||
|
||||
zsize_t pos(readOffset);
|
||||
crc = crc32(0, NULL, 0);
|
||||
while (!finished)
|
||||
{
|
||||
if (stream.avail_in == 0)
|
||||
{
|
||||
stream.avail_in = std::min(zsize_t(ChunkSize), readEnd - pos);
|
||||
if (stream.avail_in == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
reader->readData(pos, stream.avail_in, &inChunk[0]);
|
||||
stream.next_in = reinterpret_cast<Bytef*>(&inChunk);
|
||||
pos += stream.avail_in;
|
||||
}
|
||||
|
||||
stream.next_out = reinterpret_cast<Bytef*>(&outChunk);
|
||||
stream.avail_out = sizeof(outChunk);
|
||||
|
||||
zlibErr = inflate(&stream, Z_SYNC_FLUSH);
|
||||
|
||||
finished = false;
|
||||
if (zlibErr == Z_STREAM_END)
|
||||
{
|
||||
finished = true;
|
||||
}
|
||||
else if (zlibErr != Z_OK)
|
||||
{
|
||||
throw FormatException("Corrupt Data");
|
||||
}
|
||||
|
||||
zsize_t bytesToWrite(sizeof(outChunk) - stream.avail_out);
|
||||
writer.writeData(writeOffset, bytesToWrite, &outChunk[0]);
|
||||
writeOffset += bytesToWrite;
|
||||
crc = crc32(crc, &outChunk[0], bytesToWrite);
|
||||
}
|
||||
if (!finished)
|
||||
{
|
||||
// Ran out of data to process
|
||||
throw FormatException("Corrupt Data");
|
||||
}
|
||||
|
||||
// We've read data that wasn't consumed!
|
||||
readOffset = pos - stream.avail_in;
|
||||
}
|
||||
|
40
software/scsi2sd-util/libzipper-1.0.3/deflate.hh
Normal file
40
software/scsi2sd-util/libzipper-1.0.3/deflate.hh
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace zipper
|
||||
{
|
||||
void deflate(
|
||||
const Reader& reader,
|
||||
const WriterPtr& writer,
|
||||
zsize_t& writeOffset,
|
||||
zsize_t& uncompressedSize,
|
||||
zsize_t& compressedSize,
|
||||
uint32_t& crc);
|
||||
|
||||
void inflate(
|
||||
const ReaderPtr& reader,
|
||||
Writer& writer,
|
||||
zsize_t& readOffset,
|
||||
zsize_t readEnd,
|
||||
zsize_t& writeOffset,
|
||||
uint32_t& crc);
|
||||
}
|
||||
|
630
software/scsi2sd-util/libzipper-1.0.3/depcomp
Executable file
630
software/scsi2sd-util/libzipper-1.0.3/depcomp
Executable file
@ -0,0 +1,630 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program 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, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
202
software/scsi2sd-util/libzipper-1.0.3/doxygen.am
Normal file
202
software/scsi2sd-util/libzipper-1.0.3/doxygen.am
Normal file
@ -0,0 +1,202 @@
|
||||
## --------------------------------- ##
|
||||
## Format-independent Doxygen rules. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
DOXYGEN_INSTALL=
|
||||
|
||||
if DX_COND_doc
|
||||
|
||||
## ------------------------------- ##
|
||||
## Rules specific for HTML output. ##
|
||||
## ------------------------------- ##
|
||||
|
||||
if DX_COND_html
|
||||
|
||||
DX_CLEAN_HTML = @DX_DOCDIR@/html
|
||||
|
||||
doxygen-install-html:
|
||||
$(INSTALL) -d $(DESTDIR)$(docdir)/html; \
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/html/* $(DESTDIR)$(docdir)/html;
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-html
|
||||
|
||||
endif DX_COND_html
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for CHM output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_chm
|
||||
|
||||
DX_CLEAN_CHM = @DX_DOCDIR@/chm
|
||||
|
||||
if DX_COND_chi
|
||||
|
||||
DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
|
||||
|
||||
endif DX_COND_chi
|
||||
|
||||
doxygen-install-chm:
|
||||
$(INSTALL) -d $(DESTDIR)$(docdir)/chm; \
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/chm/* $(DESTDIR)$(docdir)/chm;
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-chm
|
||||
|
||||
endif DX_COND_chm
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for MAN output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_man
|
||||
|
||||
DX_CLEAN_MAN = @DX_DOCDIR@/man
|
||||
|
||||
doxygen-install-man:
|
||||
$(INSTALL) -d $(DESTDIR)$(docdir)/man; \
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/man/* $(DESTDIR)$(docdir)/man;
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-man
|
||||
endif DX_COND_man
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for RTF output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_rtf
|
||||
|
||||
DX_CLEAN_RTF = @DX_DOCDIR@/rtf
|
||||
|
||||
doxygen-install-rtf:
|
||||
$(INSTALL) -d $(DESTDIR)$(docdir)/rtf; \
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/rtf/* $(DESTDIR)$(docdir)/rtf;
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-rtf
|
||||
endif DX_COND_rtf
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for XML output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_xml
|
||||
|
||||
DX_CLEAN_XML = @DX_DOCDIR@/xml
|
||||
|
||||
doxygen-install-xml:
|
||||
$(INSTALL) -d $(DESTDIR)$(docdir)/xml; \
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/xml/* $(DESTDIR)$(docdir)/xml;
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-xml
|
||||
|
||||
endif DX_COND_xml
|
||||
|
||||
## ----------------------------- ##
|
||||
## Rules specific for PS output. ##
|
||||
## ----------------------------- ##
|
||||
|
||||
if DX_COND_ps
|
||||
|
||||
DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
|
||||
|
||||
DX_PS_GOAL = doxygen-ps
|
||||
|
||||
doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
|
||||
|
||||
@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
|
||||
cd @DX_DOCDIR@/latex; \
|
||||
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
|
||||
$(DX_LATEX) refman.tex; \
|
||||
$(MAKEINDEX_PATH) refman.idx; \
|
||||
$(DX_LATEX) refman.tex; \
|
||||
countdown=5; \
|
||||
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
|
||||
refman.log > /dev/null 2>&1 \
|
||||
&& test $$countdown -gt 0; do \
|
||||
$(DX_LATEX) refman.tex; \
|
||||
countdown=`expr $$countdown - 1`; \
|
||||
done; \
|
||||
$(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
|
||||
|
||||
doxygen-install-ps:
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/@PACKAGE@.ps $(DESTDIR)$(docdir);
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-ps
|
||||
endif DX_COND_ps
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for PDF output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_pdf
|
||||
|
||||
DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
|
||||
|
||||
DX_PDF_GOAL = doxygen-pdf
|
||||
|
||||
doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
|
||||
|
||||
@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
|
||||
cd @DX_DOCDIR@/latex; \
|
||||
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
|
||||
$(DX_PDFLATEX) refman.tex; \
|
||||
$(DX_MAKEINDEX) refman.idx; \
|
||||
$(DX_PDFLATEX) refman.tex; \
|
||||
countdown=5; \
|
||||
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
|
||||
refman.log > /dev/null 2>&1 \
|
||||
&& test $$countdown -gt 0; do \
|
||||
$(DX_PDFLATEX) refman.tex; \
|
||||
countdown=`expr $$countdown - 1`; \
|
||||
done; \
|
||||
mv refman.pdf ../@PACKAGE@.pdf
|
||||
|
||||
doxygen-install-pdf:
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/@PACKAGE@.pdf $(DESTDIR)$(docdir);
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-pdf
|
||||
endif DX_COND_pdf
|
||||
|
||||
## ------------------------------------------------- ##
|
||||
## Rules specific for LaTeX (shared for PS and PDF). ##
|
||||
## ------------------------------------------------- ##
|
||||
|
||||
if DX_COND_latex
|
||||
|
||||
DX_CLEAN_LATEX = @DX_DOCDIR@/latex
|
||||
|
||||
doxygen-install-latex:
|
||||
$(INSTALL) -d $(DESTDIR)$(docdir)/latex; \
|
||||
$(INSTALL_DATA) @DX_DOCDIR@/latex/* $(DESTDIR)$(docdir)/latex;
|
||||
|
||||
DOXYGEN_INSTALL+= doxygen-install-latex
|
||||
endif DX_COND_latex
|
||||
|
||||
.PHONY: doxygen-run doxygen-doc doxygen-install $(DX_PS_GOAL) $(DX_PDF_GOAL)
|
||||
|
||||
.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
|
||||
|
||||
doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
|
||||
|
||||
doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
|
||||
|
||||
doxygen-install: $(DOXYGEN_INSTALL)
|
||||
|
||||
@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
|
||||
rm -rf @DX_DOCDIR@
|
||||
$(DX_ENV) $(DX_DOXYGEN) $(DX_CONFIG)
|
||||
|
||||
DX_CLEANFILES = \
|
||||
@DX_DOCDIR@/@PACKAGE@.tag \
|
||||
-r \
|
||||
$(DX_CLEAN_HTML) \
|
||||
$(DX_CLEAN_CHM) \
|
||||
$(DX_CLEAN_CHI) \
|
||||
$(DX_CLEAN_MAN) \
|
||||
$(DX_CLEAN_RTF) \
|
||||
$(DX_CLEAN_XML) \
|
||||
$(DX_CLEAN_PS) \
|
||||
$(DX_CLEAN_PDF) \
|
||||
$(DX_CLEAN_LATEX)
|
||||
|
||||
endif DX_COND_doc
|
||||
|
270
software/scsi2sd-util/libzipper-1.0.3/gzip.cc
Normal file
270
software/scsi2sd-util/libzipper-1.0.3/gzip.cc
Normal file
@ -0,0 +1,270 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "gzip.hh"
|
||||
#include "util.hh"
|
||||
#include "deflate.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
namespace
|
||||
{
|
||||
size_t
|
||||
findNull(const std::vector<uint8_t>& zipData, size_t start)
|
||||
{
|
||||
if (start >= zipData.size())
|
||||
{
|
||||
throw FormatException("Unexpected end-of-file");
|
||||
}
|
||||
|
||||
while (zipData[start] != 0)
|
||||
{
|
||||
++start;
|
||||
if (start >= zipData.size())
|
||||
{
|
||||
throw FormatException("Unexpected end-of-file");
|
||||
}
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
class FileEntry : public CompressedFile
|
||||
{
|
||||
public:
|
||||
FileEntry(
|
||||
const ReaderPtr& reader,
|
||||
zsize_t dataOffset,
|
||||
const std::string& filename,
|
||||
time_t modTime
|
||||
) :
|
||||
m_reader(reader),
|
||||
m_dataOffset(dataOffset),
|
||||
m_fileName(filename)
|
||||
{
|
||||
m_modTime.tv_sec = modTime;
|
||||
m_modTime.tv_usec = 0;
|
||||
}
|
||||
|
||||
virtual bool isDecompressSupported() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual const std::string& getPath() const
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
virtual zsize_t getCompressedSize() const { return -1; }
|
||||
virtual zsize_t getUncompressedSize() const { return -1; }
|
||||
virtual const timeval& getModificationTime() const { return m_modTime; }
|
||||
|
||||
virtual void decompress(Writer& writer)
|
||||
{
|
||||
zsize_t endCompressedBytes = m_reader->getSize() - 8; // CRC+ISIZE
|
||||
zsize_t inPos(m_dataOffset);
|
||||
zsize_t outPos(0);
|
||||
uint32_t crc(0);
|
||||
inflate(
|
||||
m_reader,
|
||||
writer,
|
||||
inPos,
|
||||
endCompressedBytes,
|
||||
outPos,
|
||||
crc);
|
||||
|
||||
uint8_t crcBuffer[4];
|
||||
m_reader->readData(inPos, sizeof(crcBuffer), &crcBuffer[0]);
|
||||
uint32_t savedCRC = read32_le(&crcBuffer[0]);
|
||||
if (savedCRC != crc)
|
||||
{
|
||||
throw FormatException("Corrupt Data (CRC Failure)");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ReaderPtr m_reader;
|
||||
zsize_t m_dataOffset;
|
||||
std::string m_fileName;
|
||||
timeval m_modTime;
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<zipper::CompressedFilePtr>
|
||||
zipper::ungzip(const ReaderPtr& reader)
|
||||
{
|
||||
enum
|
||||
{
|
||||
MaxHeader = 64*1024 // Artifical limit to simplify code
|
||||
};
|
||||
|
||||
if (!isGzip(reader))
|
||||
{
|
||||
throw FormatException("Invalid gzip file");
|
||||
}
|
||||
|
||||
std::vector<uint8_t> header(
|
||||
std::min(reader->getSize(), zsize_t(MaxHeader)));
|
||||
reader->readData(0, header.size(), &header[0]);
|
||||
|
||||
if (header[2] != 8) // "deflate" method
|
||||
{
|
||||
throw UnsupportedException("Unknown gzip compression method");
|
||||
}
|
||||
|
||||
bool fextra = (header[3] & 4) != 0;
|
||||
bool fname = (header[3] & 8) != 0;
|
||||
bool fcomment = (header[3] & 0x10) != 0;
|
||||
bool fhcrc = (header[3] & 2) != 0;
|
||||
|
||||
time_t modTime = read32_le(&header[4]);
|
||||
|
||||
size_t offset(10);
|
||||
|
||||
if (fextra)
|
||||
{
|
||||
if (offset + 2 > header.size())
|
||||
{
|
||||
throw FormatException("Unexpected end-of-file");
|
||||
}
|
||||
uint16_t fextraBytes(read16_le(header, offset));
|
||||
offset += 2;
|
||||
|
||||
offset += fextraBytes;
|
||||
}
|
||||
|
||||
std::string embeddedName(reader->getSourceName());
|
||||
if (fname)
|
||||
{
|
||||
size_t nullOffset(findNull(header, offset));
|
||||
embeddedName =
|
||||
std::string(
|
||||
reinterpret_cast<char*>(&header[offset]), nullOffset - offset);
|
||||
offset = nullOffset + 1;
|
||||
}
|
||||
|
||||
if (fcomment)
|
||||
{
|
||||
size_t nullOffset(findNull(header, offset));
|
||||
offset = nullOffset + 1;
|
||||
}
|
||||
|
||||
if (fhcrc)
|
||||
{
|
||||
offset += 2;
|
||||
}
|
||||
|
||||
if (offset >= header.size())
|
||||
{
|
||||
throw FormatException("Unexpected end-of-file");
|
||||
}
|
||||
|
||||
std::vector<CompressedFilePtr> result;
|
||||
result.push_back(
|
||||
CompressedFilePtr(
|
||||
new FileEntry(reader, offset, embeddedName, modTime)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
zipper::isGzip(const ReaderPtr& reader)
|
||||
{
|
||||
enum Constants
|
||||
{
|
||||
MinFileBytes = 18, // Header + CRC + size
|
||||
ID1 = 0x1f,
|
||||
ID2 = 0x8b
|
||||
};
|
||||
|
||||
bool isGzip(false);
|
||||
if (reader->getSize() >= MinFileBytes)
|
||||
{
|
||||
uint8_t magic[2];
|
||||
reader->readData(0, sizeof(magic), &magic[0]);
|
||||
isGzip = (magic[0] == ID1) && (magic[1] == ID2);
|
||||
}
|
||||
return isGzip;
|
||||
}
|
||||
|
||||
void
|
||||
zipper::gzip(
|
||||
const std::string& filename,
|
||||
const Reader& reader,
|
||||
const WriterPtr& writer)
|
||||
{
|
||||
enum Constants
|
||||
{
|
||||
ChunkSize = 64*1024,
|
||||
WindowBits = 15
|
||||
};
|
||||
|
||||
static uint8_t Header[] =
|
||||
{
|
||||
0x1f, 0x8b, // ID
|
||||
0x08, // deflate
|
||||
0x8, // Flags (filename set)
|
||||
0x0, 0x0, 0x0, 0x0, // mtime
|
||||
0x0, // Extra flags
|
||||
0xff // OS
|
||||
};
|
||||
|
||||
zsize_t outPos(writer->getSize());
|
||||
|
||||
// Write header
|
||||
{
|
||||
uint8_t buffer[ChunkSize];
|
||||
memcpy(buffer, Header, sizeof(Header));
|
||||
|
||||
write32_le(reader.getModTime().tv_sec, &buffer[4]); // modtime
|
||||
|
||||
zsize_t pos(sizeof(Header));
|
||||
|
||||
zsize_t filenameSize(filename.size());
|
||||
if (filenameSize > (ChunkSize - pos - 1))
|
||||
{
|
||||
filenameSize = ChunkSize - pos - 1;
|
||||
}
|
||||
std::copy(&filename[0], &filename[filenameSize], &buffer[pos]);
|
||||
pos += filenameSize;
|
||||
buffer[pos++] = '\0';
|
||||
|
||||
writer->writeData(outPos, pos, &buffer[0]);
|
||||
outPos += pos;
|
||||
}
|
||||
|
||||
// Compress data
|
||||
zsize_t uncompressedSize(0);
|
||||
zsize_t compressedSize(0);
|
||||
uint32_t crc(0);
|
||||
deflate(reader, writer, outPos, uncompressedSize, compressedSize, crc);
|
||||
|
||||
// Write trailer.
|
||||
uint8_t trailer[8];
|
||||
write32_le(crc, &trailer[0]);
|
||||
write32_le(reader.getSize(), &trailer[4]);
|
||||
writer->writeData(outPos, sizeof(trailer), &trailer[0]);
|
||||
}
|
||||
|
33
software/scsi2sd-util/libzipper-1.0.3/gzip.hh
Normal file
33
software/scsi2sd-util/libzipper-1.0.3/gzip.hh
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace zipper
|
||||
{
|
||||
bool isGzip(const ReaderPtr& reader);
|
||||
|
||||
void gzip(
|
||||
const std::string& filename,
|
||||
const Reader& reader,
|
||||
const WriterPtr& writer);
|
||||
|
||||
std::vector<CompressedFilePtr> ungzip(const ReaderPtr& reader);
|
||||
}
|
||||
|
520
software/scsi2sd-util/libzipper-1.0.3/install-sh
Executable file
520
software/scsi2sd-util/libzipper-1.0.3/install-sh
Executable file
@ -0,0 +1,520 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
11
software/scsi2sd-util/libzipper-1.0.3/libzipper1.pc.in
Normal file
11
software/scsi2sd-util/libzipper-1.0.3/libzipper1.pc.in
Normal file
@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libzipper
|
||||
Description: libzipper offers a flexible C++ interface for reading compressed files in multiple formats.
|
||||
Requires: zlib
|
||||
Version: @libzipper_version@
|
||||
Libs: -L${libdir} -lzipper
|
||||
Cflags: -I${includedir}
|
9642
software/scsi2sd-util/libzipper-1.0.3/ltmain.sh
Executable file
9642
software/scsi2sd-util/libzipper-1.0.3/ltmain.sh
Executable file
File diff suppressed because it is too large
Load Diff
376
software/scsi2sd-util/libzipper-1.0.3/missing
Executable file
376
software/scsi2sd-util/libzipper-1.0.3/missing
Executable file
@ -0,0 +1,376 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
||||
# 2008, 2009 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program 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, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
||||
\`g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# normalize program name to check for.
|
||||
program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program). This is about non-GNU programs, so use $1 not
|
||||
# $program.
|
||||
case $1 in
|
||||
lex*|yacc*)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar*)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $program in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison*|yacc*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex*|flex*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar*)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case $firstarg in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case $firstarg in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
38
software/scsi2sd-util/libzipper-1.0.3/port/strerror_gnu.cc
Normal file
38
software/scsi2sd-util/libzipper-1.0.3/port/strerror_gnu.cc
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "../strerror.hh"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
std::string
|
||||
zipper::strerror(int errnum)
|
||||
{
|
||||
char buf[1024];
|
||||
const char* message(NULL);
|
||||
|
||||
// The GNU-specific strerror_r may use the provided buffer, OR a static
|
||||
// buffer.
|
||||
message = strerror_r(errnum, buf, sizeof(buf));
|
||||
|
||||
return std::string(message);
|
||||
}
|
||||
|
43
software/scsi2sd-util/libzipper-1.0.3/port/strerror_posix.cc
Normal file
43
software/scsi2sd-util/libzipper-1.0.3/port/strerror_posix.cc
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "../strerror.hh"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
std::string
|
||||
zipper::strerror(int errnum)
|
||||
{
|
||||
char buf[1024];
|
||||
const char* message(NULL);
|
||||
|
||||
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
|
||||
int error(strerror_r(errnum, buf, sizeof(buf)));
|
||||
if (error != 0)
|
||||
{
|
||||
message = "Unknown error";
|
||||
}
|
||||
#else
|
||||
// Thread-unsafe fallback
|
||||
message = ::strerror(errnum);
|
||||
#endif
|
||||
|
||||
return std::string(message);
|
||||
}
|
||||
|
58
software/scsi2sd-util/libzipper-1.0.3/split.hh
Normal file
58
software/scsi2sd-util/libzipper-1.0.3/split.hh
Normal file
@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef zipper_split_hh
|
||||
#define zipper_split_hh
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace zipper
|
||||
{
|
||||
|
||||
template<typename OutputIterator>
|
||||
void
|
||||
split(const std::string& in, char delim, OutputIterator out)
|
||||
{
|
||||
std::string::size_type start(0);
|
||||
std::string::size_type pos(0);
|
||||
while (pos < in.size())
|
||||
{
|
||||
if (in[pos] == delim)
|
||||
{
|
||||
if (pos != start)
|
||||
{
|
||||
*out = in.substr(start, pos - start);
|
||||
++out;
|
||||
}
|
||||
++pos;
|
||||
start = pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos != start)
|
||||
{
|
||||
*out = in.substr(start, pos - start);
|
||||
++out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
29
software/scsi2sd-util/libzipper-1.0.3/strerror.hh
Normal file
29
software/scsi2sd-util/libzipper-1.0.3/strerror.hh
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef zipper_strerror_hh
|
||||
#define zipper_strerror_hh
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace zipper
|
||||
{
|
||||
|
||||
std::string strerror(int errnum);
|
||||
}
|
||||
|
||||
#endif
|
98
software/scsi2sd-util/libzipper-1.0.3/util.hh
Normal file
98
software/scsi2sd-util/libzipper-1.0.3/util.hh
Normal file
@ -0,0 +1,98 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef zipper_util_hh
|
||||
#define zipper_util_hh
|
||||
|
||||
namespace zipper
|
||||
{
|
||||
template <typename T>
|
||||
struct
|
||||
dummy_delete
|
||||
{
|
||||
void operator()(T*) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
uint32_t
|
||||
read32_le(const T& inArray, size_t pos = 0)
|
||||
{
|
||||
// Read 4 bytes in little-endian order.
|
||||
// Return results in host-endian.
|
||||
return uint32_t(
|
||||
inArray[pos] |
|
||||
(uint32_t(inArray[pos+1]) << 8) |
|
||||
(uint32_t(inArray[pos+2]) << 16) |
|
||||
(uint32_t(inArray[pos+3]) << 24)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
uint16_t
|
||||
read16_le(const T& inArray, size_t pos = 0)
|
||||
{
|
||||
// Read 2 bytes in little-endian order.
|
||||
// Return results in host-endian.
|
||||
return uint16_t(
|
||||
inArray[pos] |
|
||||
(uint16_t(inArray[pos+1]) << 8)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
write32_le(uint32_t value, T& outArray, size_t pos = 0)
|
||||
{
|
||||
// Write 4 bytes in little-endian order.
|
||||
outArray[pos] = value & 0xff;
|
||||
outArray[pos + 1] = (value >> 8) & 0xff;
|
||||
outArray[pos + 2] = (value >> 16) & 0xff;
|
||||
outArray[pos + 3] = (value >> 24) & 0xff;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
write32_le(uint32_t value, T* outArray, size_t pos = 0)
|
||||
{
|
||||
// Write 4 bytes in little-endian order.
|
||||
outArray[pos] = value & 0xff;
|
||||
outArray[pos + 1] = (value >> 8) & 0xff;
|
||||
outArray[pos + 2] = (value >> 16) & 0xff;
|
||||
outArray[pos + 3] = (value >> 24) & 0xff;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
write16_le(uint16_t value, T& outArray, size_t pos = 0)
|
||||
{
|
||||
// Write 4 bytes in little-endian order.
|
||||
outArray[pos] = value & 0xff;
|
||||
outArray[pos + 1] = (value >> 8);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
write16_le(uint16_t value, T* outArray, size_t pos = 0)
|
||||
{
|
||||
// Write 4 bytes in little-endian order.
|
||||
outArray[pos] = value & 0xff;
|
||||
outArray[pos + 1] = (value >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
572
software/scsi2sd-util/libzipper-1.0.3/zip.cc
Normal file
572
software/scsi2sd-util/libzipper-1.0.3/zip.cc
Normal file
@ -0,0 +1,572 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "zip.hh"
|
||||
#include "util.hh"
|
||||
#include "deflate.hh"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
namespace
|
||||
{
|
||||
time_t convertDosDateTime(uint16_t date, uint16_t time)
|
||||
{
|
||||
struct tm parts;
|
||||
memset(&parts, 0, sizeof(parts));
|
||||
parts.tm_sec = time & 0x1F;
|
||||
parts.tm_min = (time & 0x7E0) >> 5;
|
||||
parts.tm_hour = (time >> 11);
|
||||
parts.tm_mday = date & 0x1F;
|
||||
parts.tm_mon = ((date & 0x1E0) >> 5) - 1;
|
||||
parts.tm_year = (date >> 9) + 80;
|
||||
return mktime(&parts);
|
||||
}
|
||||
|
||||
void convertDosDateTime(time_t in, uint16_t& date, uint16_t& time)
|
||||
{
|
||||
struct tm buf;
|
||||
struct tm* parts(localtime_r(&in, &buf));
|
||||
|
||||
time =
|
||||
parts->tm_sec +
|
||||
(parts->tm_min << 5) +
|
||||
(parts->tm_hour << 11);
|
||||
|
||||
date =
|
||||
parts->tm_mday +
|
||||
((parts->tm_mon + 1) << 5) +
|
||||
((parts->tm_year - 80) << 9);
|
||||
}
|
||||
|
||||
class FileEntry : public CompressedFile
|
||||
{
|
||||
public:
|
||||
FileEntry(
|
||||
const ReaderPtr& reader,
|
||||
uint16_t versionNeeded,
|
||||
uint16_t gpFlag,
|
||||
uint16_t compressionMethod,
|
||||
uint32_t crc,
|
||||
zsize_t compressedSize,
|
||||
zsize_t uncompressedSize,
|
||||
time_t modTime,
|
||||
zsize_t localHeaderOffset,
|
||||
std::string fileName
|
||||
) :
|
||||
m_reader(reader),
|
||||
m_versionNeeded(versionNeeded),
|
||||
m_gpFlag(gpFlag),
|
||||
m_compressionMethod(compressionMethod),
|
||||
m_crc(crc),
|
||||
m_compressedSize(compressedSize),
|
||||
m_uncompressedSize(uncompressedSize),
|
||||
m_localHeaderOffset(localHeaderOffset),
|
||||
m_fileName(fileName)
|
||||
{
|
||||
m_modTime.tv_sec = modTime;
|
||||
m_modTime.tv_usec = 0;
|
||||
}
|
||||
|
||||
virtual bool isDecompressSupported() const
|
||||
{
|
||||
return ((m_versionNeeded & 0xf) <= 20) &&
|
||||
((m_gpFlag & 0x1) == 0) && // Not encrypted
|
||||
((m_compressionMethod == 0) || (m_compressionMethod == 8));
|
||||
}
|
||||
|
||||
virtual const std::string& getPath() const
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
virtual zsize_t getCompressedSize() const { return m_compressedSize; }
|
||||
virtual zsize_t getUncompressedSize() const
|
||||
{
|
||||
return m_uncompressedSize;
|
||||
}
|
||||
|
||||
virtual const timeval& getModificationTime() const { return m_modTime; }
|
||||
|
||||
virtual void decompress(Writer& writer)
|
||||
{
|
||||
enum
|
||||
{
|
||||
Signature = 0x04034b50,
|
||||
MinRecordBytes = 30,
|
||||
ChunkSize = 64*1024
|
||||
};
|
||||
|
||||
std::vector<uint8_t> localRecord(MinRecordBytes);
|
||||
m_reader->readData(
|
||||
m_localHeaderOffset, MinRecordBytes, &localRecord[0]
|
||||
);
|
||||
if (read32_le(localRecord, 0) != Signature)
|
||||
{
|
||||
throw FormatException("Invalid local ZIP record");
|
||||
}
|
||||
|
||||
// Don't trust the lengths for filename and extra content read from
|
||||
// the central records. At least for extra, these DO differ for
|
||||
// unknown reasons
|
||||
zsize_t filenameLength(read16_le(localRecord, 26));
|
||||
zsize_t extraLength(read16_le(localRecord, 28));
|
||||
|
||||
zsize_t startCompressedBytes(
|
||||
m_localHeaderOffset +
|
||||
MinRecordBytes +
|
||||
filenameLength +
|
||||
extraLength
|
||||
);
|
||||
|
||||
zsize_t endCompressedBytes(
|
||||
startCompressedBytes + m_compressedSize
|
||||
);
|
||||
|
||||
if (endCompressedBytes > m_reader->getSize())
|
||||
{
|
||||
throw FormatException("Compressed file size is too long");
|
||||
}
|
||||
|
||||
switch (m_compressionMethod)
|
||||
{
|
||||
case 0: // No compression
|
||||
{
|
||||
for (zsize_t pos(startCompressedBytes);
|
||||
pos < endCompressedBytes;
|
||||
pos += ChunkSize
|
||||
)
|
||||
{
|
||||
uint8_t buf[ChunkSize];
|
||||
zsize_t bytes(
|
||||
std::min(zsize_t(ChunkSize), endCompressedBytes - pos)
|
||||
);
|
||||
m_reader->readData(pos, bytes, &buf[0]);
|
||||
writer.writeData(pos, bytes, &buf[0]);
|
||||
}
|
||||
}; break;
|
||||
|
||||
case 8: // Deflate
|
||||
{
|
||||
uint32_t crc(0);
|
||||
zsize_t inPos(startCompressedBytes);
|
||||
zsize_t outPos(0);
|
||||
inflate(
|
||||
m_reader,
|
||||
writer,
|
||||
inPos,
|
||||
endCompressedBytes,
|
||||
outPos,
|
||||
crc);
|
||||
|
||||
if (m_gpFlag & 0x4) // CRC is after compressed data
|
||||
{
|
||||
uint8_t dataDescriptor[12];
|
||||
m_reader->readData(
|
||||
inPos, sizeof(dataDescriptor), &dataDescriptor[0]);
|
||||
m_crc = read32_le(dataDescriptor, 0);
|
||||
m_compressedSize = read32_le(dataDescriptor, 4);
|
||||
m_uncompressedSize = read32_le(dataDescriptor, 8);
|
||||
}
|
||||
|
||||
if (crc != m_crc)
|
||||
{
|
||||
throw FormatException("Corrupt Data (CRC failure)");
|
||||
}
|
||||
|
||||
}; break;
|
||||
default:
|
||||
throw UnsupportedException("Unsupported compression scheme");
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
ReaderPtr m_reader;
|
||||
uint16_t m_versionNeeded;
|
||||
uint16_t m_gpFlag;
|
||||
uint16_t m_compressionMethod;
|
||||
uint32_t m_crc;
|
||||
zsize_t m_compressedSize;
|
||||
zsize_t m_uncompressedSize;
|
||||
timeval m_modTime;
|
||||
zsize_t m_localHeaderOffset;
|
||||
std::string m_fileName;
|
||||
};
|
||||
|
||||
bool readEndCentralDirectory(
|
||||
const ReaderPtr& reader,
|
||||
zsize_t& centralDirectoryBytes,
|
||||
zsize_t& centralDirectoryOffset,
|
||||
zsize_t& centralDirectoryEntries
|
||||
)
|
||||
{
|
||||
// Read the end of central directory record. This
|
||||
// record enables us to find the remainding
|
||||
// records without searching for record signatures.
|
||||
|
||||
// TODO does not consider the Zip64 entries.
|
||||
|
||||
enum
|
||||
{
|
||||
MinRecordBytes = 22, // Minimum size with no comment
|
||||
MaxCommentBytes = 65535, // 2 bytes to store comment length
|
||||
Signature = 0x06054b50
|
||||
};
|
||||
|
||||
zsize_t providerSize(reader->getSize());
|
||||
if (providerSize < MinRecordBytes)
|
||||
{
|
||||
throw FormatException("Too small");
|
||||
}
|
||||
|
||||
size_t bufSize(
|
||||
std::min(zsize_t(MinRecordBytes + MaxCommentBytes), providerSize)
|
||||
);
|
||||
std::vector<uint8_t> buffer(bufSize);
|
||||
reader->readData(providerSize - bufSize, bufSize, &buffer[0]);
|
||||
|
||||
// Need to search for this record, as it ends in a variable-length
|
||||
// comment field. Search backwards, with the assumption that the
|
||||
// comment doesn't exist, or is much smaller than the maximum
|
||||
// length
|
||||
|
||||
bool recordFound(false);
|
||||
ssize_t pos(bufSize - MinRecordBytes);
|
||||
for (; pos >= 0; --pos)
|
||||
{
|
||||
recordFound = (read32_le(buffer, pos) == Signature);
|
||||
break;
|
||||
}
|
||||
|
||||
if (recordFound)
|
||||
{
|
||||
if (read16_le(buffer, pos + 4) != 0)
|
||||
{
|
||||
throw UnsupportedException("Spanned disks not supported");
|
||||
}
|
||||
|
||||
centralDirectoryBytes = read32_le(buffer, pos + 12);
|
||||
centralDirectoryOffset = read32_le(buffer, pos + 16);
|
||||
centralDirectoryEntries = read16_le(buffer, pos + 10);
|
||||
}
|
||||
return recordFound;
|
||||
}
|
||||
|
||||
std::vector<CompressedFilePtr>
|
||||
readCentralDirectory(const ReaderPtr& reader)
|
||||
{
|
||||
enum Constants
|
||||
{
|
||||
MinRecordBytes = 46,
|
||||
Signature = 0x02014b50
|
||||
};
|
||||
|
||||
zsize_t centralDirectoryBytes(0);
|
||||
zsize_t centralDirectoryOffset(0);
|
||||
zsize_t centralDirectoryEntries(0);
|
||||
bool isZip(
|
||||
readEndCentralDirectory(
|
||||
reader,
|
||||
centralDirectoryBytes,
|
||||
centralDirectoryOffset,
|
||||
centralDirectoryEntries
|
||||
)
|
||||
);
|
||||
(void) isZip; // Avoid unused warning.
|
||||
assert(isZip);
|
||||
|
||||
std::vector<uint8_t> buffer(centralDirectoryBytes);
|
||||
reader->readData(
|
||||
centralDirectoryOffset,
|
||||
centralDirectoryBytes,
|
||||
&buffer[0]
|
||||
);
|
||||
|
||||
zsize_t pos(0);
|
||||
std::vector<CompressedFilePtr> entries;
|
||||
while ((pos + MinRecordBytes) < buffer.size())
|
||||
{
|
||||
if (read32_le(buffer, pos) != Signature)
|
||||
{
|
||||
// Unknown record type.
|
||||
pos += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint16_t versionNeeded(read16_le(buffer, pos + 6));
|
||||
uint16_t gpFlag(read16_le(buffer, pos + 8));
|
||||
uint16_t compressionMethod(read16_le(buffer, pos + 10));
|
||||
uint16_t modTime(read16_le(buffer, pos + 12));
|
||||
uint16_t modDate(read16_le(buffer, pos + 14));
|
||||
uint32_t crc(read32_le(buffer, pos + 16));
|
||||
uint32_t compressedSize(read32_le(buffer, pos + 20));
|
||||
uint32_t uncompressedSize(read32_le(buffer, pos + 24));
|
||||
size_t fileNameLen(read16_le(buffer, pos + 28));
|
||||
size_t extraLen(read16_le(buffer, pos + 30));
|
||||
size_t commentLen(read16_le(buffer, pos + 32));
|
||||
uint32_t localHeaderOffset(read32_le(buffer, pos + 42));
|
||||
|
||||
if ((fileNameLen + extraLen + commentLen + MinRecordBytes + pos) >
|
||||
buffer.size()
|
||||
)
|
||||
{
|
||||
throw FormatException("File comments are too long");
|
||||
}
|
||||
|
||||
std::string fileName(
|
||||
&buffer[pos + MinRecordBytes],
|
||||
&buffer[pos + MinRecordBytes + fileNameLen]
|
||||
);
|
||||
|
||||
entries.push_back(
|
||||
CompressedFilePtr(
|
||||
new FileEntry(
|
||||
reader,
|
||||
versionNeeded,
|
||||
gpFlag,
|
||||
compressionMethod,
|
||||
crc,
|
||||
compressedSize,
|
||||
uncompressedSize,
|
||||
convertDosDateTime(modDate, modTime),
|
||||
localHeaderOffset,
|
||||
fileName
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
pos += MinRecordBytes + fileNameLen + extraLen + commentLen;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
zipper::zip(
|
||||
const std::string& filename,
|
||||
const Reader& reader,
|
||||
const WriterPtr& writer,
|
||||
ZipFileRecord& outRecord)
|
||||
{
|
||||
enum Constants
|
||||
{
|
||||
ChunkSize = 64*1024,
|
||||
WindowBits = 15,
|
||||
TimePos = 10
|
||||
};
|
||||
|
||||
static uint8_t Header[] =
|
||||
{
|
||||
0x50, 0x4b, 0x03, 0x04, // Header
|
||||
20, // Version (2.0)
|
||||
0, // File attributes
|
||||
0,0, // gp flag.
|
||||
8,0, // deflate method
|
||||
0,0, // file time
|
||||
0,0, // file date
|
||||
0,0,0,0, // CRC32
|
||||
0,0,0,0, // Compressed size
|
||||
0,0,0,0 // Uncompressed size
|
||||
};
|
||||
|
||||
zsize_t outPos(writer->getSize());
|
||||
outRecord.localHeaderOffset = outPos;
|
||||
outRecord.filename = filename;
|
||||
|
||||
// Write header
|
||||
{
|
||||
uint8_t buffer[ChunkSize];
|
||||
memcpy(buffer, Header, sizeof(Header));
|
||||
zsize_t pos(sizeof(Header));
|
||||
|
||||
std::string::size_type filenameSize(filename.size());
|
||||
if (filenameSize > (ChunkSize - pos))
|
||||
{
|
||||
filenameSize = ChunkSize - pos;
|
||||
}
|
||||
buffer[pos++] = filenameSize & 0xff;
|
||||
buffer[pos++] = (filenameSize >> 8);
|
||||
buffer[pos++] = 0; // extra field len
|
||||
buffer[pos++] = 0; // extra field len
|
||||
memcpy(buffer + pos, filename.data(), filenameSize);
|
||||
pos += filenameSize;
|
||||
writer->writeData(outPos, pos, &buffer[0]);
|
||||
outPos += pos;
|
||||
}
|
||||
|
||||
// Write compressed data
|
||||
deflate(
|
||||
reader,
|
||||
writer,
|
||||
outPos,
|
||||
outRecord.uncompressedSize,
|
||||
outRecord.compressedSize,
|
||||
outRecord.crc32);
|
||||
|
||||
// Go back and complete the header.
|
||||
convertDosDateTime(
|
||||
reader.getModTime().tv_sec, outRecord.dosDate, outRecord.dosTime);
|
||||
uint8_t trailer[16];
|
||||
write16_le(outRecord.dosTime, &trailer[0]);
|
||||
write16_le(outRecord.dosDate, &trailer[2]);
|
||||
write32_le(outRecord.crc32, &trailer[4]);
|
||||
write32_le(outRecord.compressedSize, &trailer[8]);
|
||||
write32_le(outRecord.uncompressedSize, &trailer[12]);
|
||||
writer->writeData(
|
||||
outRecord.localHeaderOffset + TimePos, sizeof(trailer), &trailer[0]);
|
||||
}
|
||||
|
||||
void
|
||||
zipper::zipFinalise(
|
||||
const std::vector<ZipFileRecord>& records,
|
||||
const WriterPtr& writer)
|
||||
{
|
||||
enum Constants
|
||||
{
|
||||
ChunkSize = 64*1024
|
||||
};
|
||||
|
||||
static uint8_t FileHeader[] =
|
||||
{
|
||||
0x50, 0x4b, 0x01, 0x02, // Header
|
||||
20, 0x00, // Version (2.0)
|
||||
20, 0x00, // Version Needed to extract (2.0)
|
||||
0,0, // gp flag.
|
||||
8,0 // deflate method
|
||||
};
|
||||
|
||||
zsize_t outPos(writer->getSize());
|
||||
uint32_t centralDirOffset(outPos);
|
||||
|
||||
for (size_t i = 0; i < records.size(); ++i)
|
||||
{
|
||||
uint8_t buffer[ChunkSize];
|
||||
memcpy(buffer, FileHeader, sizeof(FileHeader));
|
||||
zsize_t pos(sizeof(FileHeader));
|
||||
|
||||
write16_le(records[i].dosTime, &buffer[pos]);
|
||||
pos += 2;
|
||||
write16_le(records[i].dosDate, &buffer[pos]);
|
||||
pos += 2;
|
||||
|
||||
write32_le(records[i].crc32, &buffer[pos]);
|
||||
pos += 4;
|
||||
|
||||
write32_le(records[i].compressedSize, &buffer[pos]);
|
||||
pos += 4;
|
||||
|
||||
write32_le(records[i].uncompressedSize, &buffer[pos]);
|
||||
pos += 4;
|
||||
|
||||
std::string::size_type filenameSize(records[i].filename.size());
|
||||
if (filenameSize > (ChunkSize - pos))
|
||||
{
|
||||
filenameSize = ChunkSize - pos;
|
||||
}
|
||||
write16_le(filenameSize, &buffer[pos]);
|
||||
pos += 2;
|
||||
|
||||
write16_le(0, &buffer[pos]); // extra field len
|
||||
pos += 2;
|
||||
|
||||
write16_le(0, &buffer[pos]); // file comment len
|
||||
pos += 2;
|
||||
|
||||
write16_le(0, &buffer[pos]); // disk number
|
||||
pos += 2;
|
||||
|
||||
write16_le(0, &buffer[pos]); // internal file attributes
|
||||
pos += 2;
|
||||
|
||||
write32_le(0, &buffer[pos]); // external file attributes
|
||||
pos += 4;
|
||||
|
||||
write32_le(records[i].localHeaderOffset, &buffer[pos]);
|
||||
pos += 4;
|
||||
|
||||
memcpy(buffer + pos, records[i].filename.data(), filenameSize);
|
||||
pos += filenameSize;
|
||||
|
||||
writer->writeData(outPos, pos, &buffer[0]);
|
||||
outPos += pos;
|
||||
}
|
||||
|
||||
uint32_t centralDirSize(writer->getSize() - centralDirOffset);
|
||||
|
||||
{
|
||||
// End-of-directory record.
|
||||
static uint8_t EndDirectory[] =
|
||||
{
|
||||
0x50, 0x4b, 0x05, 0x06, // Header
|
||||
0x00, 0x00, // Disk num
|
||||
0x00, 0x00 // Disk with central dir
|
||||
};
|
||||
uint8_t buffer[ChunkSize];
|
||||
memcpy(buffer, EndDirectory, sizeof(EndDirectory));
|
||||
zsize_t pos(sizeof(EndDirectory));
|
||||
|
||||
write16_le(records.size(), &buffer[pos]); // Entries on this disk
|
||||
pos += 2;
|
||||
write16_le(records.size(), &buffer[pos]); // Total entries
|
||||
pos += 2;
|
||||
|
||||
write32_le(centralDirSize, &buffer[pos]);
|
||||
pos += 4;
|
||||
write32_le(centralDirOffset, &buffer[pos]);
|
||||
pos += 4;
|
||||
|
||||
write16_le(0, &buffer[pos]); // Zip comment length
|
||||
pos += 2;
|
||||
|
||||
writer->writeData(outPos, pos, &buffer[0]);
|
||||
outPos += pos;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<CompressedFilePtr>
|
||||
zipper::unzip(const ReaderPtr& reader)
|
||||
{
|
||||
return readCentralDirectory(reader);
|
||||
}
|
||||
|
||||
bool
|
||||
zipper::isZip(const ReaderPtr& reader)
|
||||
{
|
||||
zsize_t centralDirectoryBytes(0);
|
||||
zsize_t centralDirectoryOffset(0);
|
||||
zsize_t centralDirectoryEntries(0);
|
||||
bool result(
|
||||
readEndCentralDirectory(
|
||||
reader,
|
||||
centralDirectoryBytes,
|
||||
centralDirectoryOffset,
|
||||
centralDirectoryEntries
|
||||
)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
50
software/scsi2sd-util/libzipper-1.0.3/zip.hh
Normal file
50
software/scsi2sd-util/libzipper-1.0.3/zip.hh
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace zipper
|
||||
{
|
||||
struct ZipFileRecord
|
||||
{
|
||||
zsize_t localHeaderOffset;
|
||||
uint32_t crc32;
|
||||
zsize_t compressedSize;
|
||||
zsize_t uncompressedSize;
|
||||
uint16_t dosDate;
|
||||
uint16_t dosTime;
|
||||
std::string filename;
|
||||
};
|
||||
|
||||
void zip(
|
||||
const std::string& filename,
|
||||
const Reader& reader,
|
||||
const WriterPtr& writer,
|
||||
ZipFileRecord& outRecord);
|
||||
|
||||
void zipFinalise(
|
||||
const std::vector<ZipFileRecord>& records,
|
||||
const WriterPtr& writer);
|
||||
|
||||
bool isZip(const ReaderPtr& reader);
|
||||
|
||||
std::vector<CompressedFilePtr> unzip(const ReaderPtr& reader);
|
||||
}
|
||||
|
70
software/scsi2sd-util/libzipper-1.0.3/zipper.1.in
Normal file
70
software/scsi2sd-util/libzipper-1.0.3/zipper.1.in
Normal file
@ -0,0 +1,70 @@
|
||||
.TH ZIPPER 1 "2011-05-26" "libzipper @libzipper_version@" "User Commands"
|
||||
.SH NAME
|
||||
zipper \- compress and extract files from archives
|
||||
.SH SYNOPSIS
|
||||
.B zipper
|
||||
{zip|gzip}
|
||||
.I archive file [files...]
|
||||
.PP
|
||||
.B zipper
|
||||
{unzip|gunzip}
|
||||
.I archive
|
||||
.SH DESCRIPTION
|
||||
.I zipper
|
||||
provides tools to manage compressed zip and gzip files.
|
||||
.PP
|
||||
.I zipper
|
||||
stores the full path of the specified files when creating an archive, but
|
||||
does not store any timestamp or permission information.
|
||||
.PP
|
||||
.I zipper
|
||||
extracts files to the full path specified within the archive; the original
|
||||
archive file is unchanged.
|
||||
.I zipper
|
||||
does not support restoring the original
|
||||
file timestamps or permissions, even if such information is recorded in the
|
||||
archive.
|
||||
.SH COMMANDS
|
||||
.TP
|
||||
.B zip
|
||||
Create a new zip archive
|
||||
.TP
|
||||
.B unzip
|
||||
Extract all files from a zip archive.
|
||||
.TP
|
||||
.B gzip
|
||||
Create a new gzip archive
|
||||
.TP
|
||||
.B gunzip
|
||||
Extract the first file from the gzip archive.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B archive
|
||||
Filename of the compressed zip/gzip file. The special '-' filename is treated
|
||||
as standard input/output. When creating a new archive, this file will
|
||||
be overwritten indiscriminately.
|
||||
.TP
|
||||
.B files
|
||||
A list of files to add into the archive. The special '-' filename is treated
|
||||
as standard input/output.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Create a zip file
|
||||
zipper zip /tmp/foo.zip bar.txt baz.txt
|
||||
.TP
|
||||
Extract a gzip file
|
||||
zipper gunzip /tmp/foo.gz
|
||||
.SH CONFORMING TO
|
||||
.I zipper
|
||||
supports the DEFLATE algorithm described by RFC1951, and the gzip file format
|
||||
described by RFC1952.
|
||||
.SH BUGS
|
||||
For gzip files,
|
||||
.I zipper
|
||||
is able to create an archive containing
|
||||
multiple files, but can only extract the first file.
|
||||
.SH SEE ALSO
|
||||
.BR gunzip (1),
|
||||
.BR gzip (1),
|
||||
.BR unzip (1),
|
||||
.BR zip (1)
|
195
software/scsi2sd-util/libzipper-1.0.3/zipper.cc
Normal file
195
software/scsi2sd-util/libzipper-1.0.3/zipper.cc
Normal file
@ -0,0 +1,195 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "zipper.hh"
|
||||
#include "split.hh"
|
||||
#include <errno.h>
|
||||
#include "strerror.hh"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
using namespace zipper;
|
||||
|
||||
static std::string argv0;
|
||||
|
||||
static void usage()
|
||||
{
|
||||
std::cerr <<
|
||||
"libzipper Copyright (C) 2011 Michael McMaster <michael@codesrc.com>\n"
|
||||
"This program comes with ABSOLUTELY NO WARRANTY.\n"
|
||||
"This is free software, and you are welcome to redistribute it\n"
|
||||
"under certain conditions.\n\n" <<
|
||||
|
||||
"Usage: \n" <<
|
||||
argv0 << " {zip|gzip} archive file [files...]\n" <<
|
||||
argv0 << " {unzip|gunzip} archive" << std::endl;
|
||||
}
|
||||
|
||||
static WriterPtr
|
||||
getWriter(const std::string& optionName)
|
||||
{
|
||||
std::shared_ptr<FileWriter> writer;
|
||||
if (optionName == "-")
|
||||
{
|
||||
writer.reset(new FileWriter("stdout", 1, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.reset(new FileWriter(optionName, 0660));
|
||||
}
|
||||
return writer;
|
||||
}
|
||||
|
||||
static ReaderPtr
|
||||
getReader(const std::string& optionName)
|
||||
{
|
||||
std::shared_ptr<FileReader> reader;
|
||||
if (optionName == "-")
|
||||
{
|
||||
reader.reset(new FileReader("stdin", 0, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.reset(new FileReader(optionName));
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
||||
static void
|
||||
command_zip(const std::deque<std::string>& options)
|
||||
{
|
||||
if (options.size() < 2)
|
||||
{
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
WriterPtr writer(getWriter(options[0]));
|
||||
Compressor comp(Container_zip, writer);
|
||||
for (size_t i = 1; i < options.size(); ++i)
|
||||
{
|
||||
ReaderPtr reader(getReader(options[i]));
|
||||
comp.addFile(*reader);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
command_gzip(const std::deque<std::string>& options)
|
||||
{
|
||||
if (options.size() != 2)
|
||||
{
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
WriterPtr writer(getWriter(options[0]));
|
||||
Compressor comp(Container_gzip, writer);
|
||||
for (size_t i = 1; i < options.size(); ++i)
|
||||
{
|
||||
ReaderPtr reader(getReader(options[i]));
|
||||
comp.addFile(*reader);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
command_extract(const std::deque<std::string>& options)
|
||||
{
|
||||
if (options.size() != 1)
|
||||
{
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ReaderPtr reader(getReader(options[0]));
|
||||
Decompressor decomp(reader);
|
||||
std::vector<CompressedFilePtr> entries(decomp.getEntries());
|
||||
for (size_t f = 0; f < entries.size(); ++f)
|
||||
{
|
||||
std::deque<std::string> path;
|
||||
split(
|
||||
entries[f]->getPath(),
|
||||
'/',
|
||||
std::back_insert_iterator<std::deque<std::string> >(path));
|
||||
path.pop_back(); // Remove extracted file.
|
||||
std::stringstream builtPath;
|
||||
for (std::deque<std::string>::iterator it(path.begin());
|
||||
it != path.end();
|
||||
++it)
|
||||
{
|
||||
builtPath << *it;
|
||||
int result(mkdir(builtPath.str().c_str(), 0775));
|
||||
if (result != 0 && errno != EEXIST)
|
||||
{
|
||||
std::string errMsg(zipper::strerror(errno));
|
||||
|
||||
std::stringstream message;
|
||||
message << "Could not create directory " <<
|
||||
"\"" <<builtPath.str() << "\": " << errMsg;
|
||||
throw IOException(message.str());
|
||||
}
|
||||
|
||||
builtPath << '/';
|
||||
}
|
||||
FileWriter writer(
|
||||
entries[f]->getPath(), 0660, entries[f]->getModificationTime());
|
||||
entries[f]->decompress(writer);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
argv0 = argv[0];
|
||||
if (argc < 3)
|
||||
{
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::deque<std::string> options;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
options.push_back(argv[i]);
|
||||
}
|
||||
|
||||
std::string command(options[0]);
|
||||
options.pop_front();
|
||||
if (command == "zip")
|
||||
{
|
||||
command_zip(options);
|
||||
}
|
||||
else if (command == "gzip")
|
||||
{
|
||||
command_gzip(options);
|
||||
}
|
||||
else if (command == "gunzip" || command == "unzip")
|
||||
{
|
||||
command_extract(options);
|
||||
}
|
||||
else
|
||||
{
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
591
software/scsi2sd-util/libzipper-1.0.3/zipper.hh
Normal file
591
software/scsi2sd-util/libzipper-1.0.3/zipper.hh
Normal file
@ -0,0 +1,591 @@
|
||||
// Copyright (C) 2011 Michael McMaster <michael@codesrc.com>
|
||||
//
|
||||
// This file is part of libzipper.
|
||||
//
|
||||
// libzipper 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libzipper 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 libzipper. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef zipper_hh
|
||||
#define zipper_hh
|
||||
|
||||
#include <stdexcept>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <sys/stat.h> // For mode_t
|
||||
#include <sys/time.h> // For timeval
|
||||
|
||||
/**
|
||||
\mainpage libzipper C++ (de)compression library
|
||||
|
||||
\section intro Introduction
|
||||
libzipper offers a flexible C++ interface for reading compressed files
|
||||
in multiple formats.
|
||||
|
||||
<a href="http://www.codesrc.com/src/libzipper">Homepage</a>
|
||||
|
||||
libzipper aims to provide applications a transparent method of accessing
|
||||
compressed data. eg. libzipper is suited to reading XML config files that
|
||||
are compressed to save space.
|
||||
|
||||
libzipper is not a general-purpose archive management library, as it
|
||||
does not provide access to the filesystem attributes of each file.
|
||||
(ie. libzipper does not support the concepts of file owner, group or
|
||||
permissions.
|
||||
|
||||
\section formats Supported Formats
|
||||
<ul>
|
||||
<li>gzip</li>
|
||||
<li>zip</li>
|
||||
</ul>
|
||||
|
||||
\section example_read Reading a compressed file into memory
|
||||
\code
|
||||
#include <zipper.hh>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
class MemWriter : public zipper::Writer
|
||||
{
|
||||
public:
|
||||
std::vector<uint8_t> data;
|
||||
|
||||
virtual void writeData(
|
||||
zsize_t offset, zsize_t bytes, const uint8_t* inData)
|
||||
{
|
||||
data.resize(std::max(offset + bytes, data.size()));
|
||||
std::copy(inData, inData + bytes, &data[offset]);
|
||||
}
|
||||
virtual zsize_t getSize() const { return data.size(); }
|
||||
};
|
||||
|
||||
std::vector<uint8_t> readSavedGame(const std::string& filename)
|
||||
{
|
||||
// open the compressed input file. FileReader will throw an
|
||||
// exception if an IO error occurs.
|
||||
zipper::FileReader reader(filename);
|
||||
|
||||
MemWriter writer;
|
||||
|
||||
zipper::Decompressor decomp(reader);
|
||||
|
||||
std::vector<zipper::CompressedFilePtr> entries(decomp.getEntries());
|
||||
|
||||
if (!entries.empty())
|
||||
{
|
||||
// Uncompress the first file. Will pass-though data as-is if the
|
||||
// file is not compressed.
|
||||
entries.front()->decompress(writer);
|
||||
}
|
||||
return writer.data;
|
||||
}
|
||||
|
||||
\endcode
|
||||
|
||||
\section example_write Writing compressed files.
|
||||
\code
|
||||
#include <zipper.hh>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
class MemReader : public zipper::Reader
|
||||
{
|
||||
public:
|
||||
MemReader(const vector<uint8_t>& data) : m_data(data) {}
|
||||
|
||||
virtual const std::string& getSourceName() const
|
||||
{
|
||||
static std::string Name("savedGame.dat");
|
||||
return Name;
|
||||
}
|
||||
|
||||
virtual const timeval& getModTime() const
|
||||
{
|
||||
return zipper::s_now;
|
||||
}
|
||||
|
||||
virtual zsize_t getSize() const { return m_data.size(); }
|
||||
|
||||
virtual void readData(zsize_t offset, zsize_t bytes, uint8_t* dest) const
|
||||
{
|
||||
std::copy(&m_data[offset], &m_data[offset + bytes], dest);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uint8_t> m_data;
|
||||
};
|
||||
|
||||
void writeSavedGame(
|
||||
const std::string& filename, const std::vector<uint8_t>& gameData)
|
||||
{
|
||||
zipper::FileWriter writer(filename);
|
||||
zipper::Compressor comp(zipper::Container_zip, writer);
|
||||
comp.addFile(MemReader(gameData));
|
||||
}
|
||||
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/// \namespace zipper
|
||||
/// \brief The zipper namespace contains the libzipper public API.
|
||||
namespace zipper
|
||||
{
|
||||
/// \typedef zsize_t
|
||||
/// zsize_t should be used exclusively when dealing with file offsets
|
||||
/// and sizes to support large files (>4Gb).
|
||||
///
|
||||
/// Unlike size_t on some systems, zsize_t will be 64bit when compiling for
|
||||
/// a 32bit target.
|
||||
typedef uint64_t zsize_t;
|
||||
|
||||
/// \enum ContainerFormat
|
||||
/// ContainerFormat enumerates the compressed archive formats supported
|
||||
/// by libzipper.
|
||||
///
|
||||
/// An application can determine the supported formats by iterating
|
||||
/// over the Container_begin to Container_end range. eg.
|
||||
/// \code
|
||||
/// for (int i = Container_begin; i < Container_end; ++i)
|
||||
/// {
|
||||
/// const Container& container(getContainer(ContainerFormat(i)));
|
||||
/// }
|
||||
/// \endcode
|
||||
enum ContainerFormat
|
||||
{
|
||||
/// Iteration marker
|
||||
Container_begin = 0,
|
||||
|
||||
/// No container (eg. plain text)
|
||||
Container_none = 0,
|
||||
|
||||
/// ZIP
|
||||
Container_zip,
|
||||
|
||||
/// gzip.
|
||||
Container_gzip,
|
||||
|
||||
/// Iteration marker
|
||||
Container_end
|
||||
};
|
||||
|
||||
/// \struct Container
|
||||
/// Provides libzipper capability details for a compressed archive
|
||||
/// format.
|
||||
/// \see getContainer
|
||||
struct Container
|
||||
{
|
||||
/// \enum CapabilityBits allows a bitmask to be specified with a
|
||||
/// combination of boolean flags.
|
||||
enum CapabilityBits
|
||||
{
|
||||
/// Compression bit is set if the format is usable with Compressor
|
||||
Compression = 1,
|
||||
|
||||
/// Decompression bit is set if the format is usable with
|
||||
/// Decompressor
|
||||
Decompression = 2,
|
||||
|
||||
/// EmbeddedFilenames bit is set if CompressedFile::getPath() is
|
||||
/// supported
|
||||
EmbeddedFilenames = 4,
|
||||
|
||||
/// Archive bit is set if multiple compressed files may exist in
|
||||
/// a single container.
|
||||
Archive = 8,
|
||||
|
||||
/// FileSize bit is set if the uncompressed size for each
|
||||
/// compressed file is recorded in the container.
|
||||
FileSize = 16
|
||||
};
|
||||
|
||||
/// %Container Type
|
||||
ContainerFormat format;
|
||||
|
||||
/// %Container Internet Media Type (aka MIME type).
|
||||
/// eg. "application/zip"
|
||||
std::string mediaType;
|
||||
|
||||
/// Bitmask comprised of CapabilityBits enum values.
|
||||
uint32_t capabilities;
|
||||
};
|
||||
|
||||
/// \brief When passed as a method parameter, it requests that the
|
||||
/// current time be used instead.
|
||||
extern const timeval s_now;
|
||||
|
||||
/// \brief Returns the capability details of the given format.
|
||||
const Container& getContainer(ContainerFormat format);
|
||||
|
||||
/// \brief Base class for all exceptions thrown by libzipper
|
||||
class Exception : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
/// Exception ctor
|
||||
/// \param what A description of the error encountered.
|
||||
Exception(const std::string& what);
|
||||
};
|
||||
|
||||
/// \brief Exception thrown when the input data does not match
|
||||
/// the expected Container format.
|
||||
class FormatException : public Exception
|
||||
{
|
||||
public:
|
||||
/// FormatException ctor
|
||||
/// \param what A description of the error encountered.
|
||||
FormatException(const std::string& what);
|
||||
};
|
||||
|
||||
/// \brief Exception thrown when a Reader or Writer instance is unable
|
||||
/// to satisfy an IO request due to an external error.
|
||||
class IOException : public Exception
|
||||
{
|
||||
public:
|
||||
/// IOException ctor
|
||||
/// \param what A description of the error encountered.
|
||||
IOException(const std::string& what);
|
||||
};
|
||||
|
||||
/// \brief Exception thrown when an operation is requested on a compressed
|
||||
/// archive that libzipper does not implement.
|
||||
///
|
||||
/// This exception may be thrown even if libzipper advertises general
|
||||
/// support for the Container format. eg. libzipper supports most
|
||||
/// ZIP files, but an UnsupportedException will be thrown if given an
|
||||
/// encrypted ZIP file.
|
||||
class UnsupportedException : public Exception
|
||||
{
|
||||
public:
|
||||
/// UnsupportedException ctor
|
||||
/// \param what A description of the error encountered.
|
||||
UnsupportedException(const std::string& what);
|
||||
};
|
||||
|
||||
/// \brief Reader supplies input data to the compression/decompression
|
||||
/// functions.
|
||||
///
|
||||
/// Normally, an application using libzipper provides the Reader
|
||||
/// implementation. The implementation could supply data from files,
|
||||
/// in-memory buffers, or it could be generated on-the-fly.
|
||||
///
|
||||
/// The Reader implementation must support random access, and must
|
||||
/// determine at creation time the number of bytes available. The
|
||||
/// Reader interface is not suitable for use with streaming data.
|
||||
class Reader
|
||||
{
|
||||
public:
|
||||
/// Reader dtor
|
||||
virtual ~Reader();
|
||||
|
||||
/// Returns a name for this source of the data.
|
||||
///
|
||||
/// For file-based Reader implementations, this would normally be
|
||||
/// the input filename.
|
||||
virtual const std::string& getSourceName() const = 0;
|
||||
|
||||
/// Return the last-modified timestamp of the data.
|
||||
/// If the special s_now value is returned, the current time should be
|
||||
/// used instead.
|
||||
virtual const timeval& getModTime() const = 0;
|
||||
|
||||
/// Returns the number of bytes available via readData()
|
||||
///
|
||||
/// \invariant getSize() is stable throughout the lifetime
|
||||
/// of the Reader instance.
|
||||
virtual zsize_t getSize() const = 0;
|
||||
|
||||
/// Copies data into the dest buffer
|
||||
///
|
||||
/// An exception must be thrown if it is not possible to copy the
|
||||
/// requested data into the supplied buffer (eg. file IO error).
|
||||
///
|
||||
/// \pre offset + bytes <= getSize()
|
||||
///
|
||||
/// \param offset Number of bytes to skip at the front of the data
|
||||
/// source.
|
||||
/// \param bytes Number of bytes to copy
|
||||
/// \param dest Destination buffer.
|
||||
///
|
||||
virtual void readData(
|
||||
zsize_t offset, zsize_t bytes, uint8_t* dest
|
||||
) const = 0;
|
||||
|
||||
};
|
||||
|
||||
/// \brief FileReader is a file-based implementation of the Reader
|
||||
/// interface.
|
||||
class FileReader : public Reader
|
||||
{
|
||||
public:
|
||||
/// Read data from the supplied file.
|
||||
FileReader(const std::string& filename);
|
||||
|
||||
/// Read data from the supplied file.
|
||||
///
|
||||
/// \param filename The value used by getSourceName(). This name
|
||||
/// is arbitary, and does not need to be related to fd.
|
||||
///
|
||||
/// \param fd The descriptor to source data from. The descriptor
|
||||
/// must be open for reading, blocking, and seekable (ie. lseek(2)).
|
||||
///
|
||||
/// \param closeFd If true, fd will be closed by this object
|
||||
/// when it is no longer needed.
|
||||
FileReader(const std::string& filename, int fd, bool closeFd);
|
||||
|
||||
/// FileReader dtor
|
||||
virtual ~FileReader();
|
||||
|
||||
/// Inherited from Reader
|
||||
virtual const std::string& getSourceName() const;
|
||||
|
||||
/// Inherited from Reader
|
||||
virtual const timeval& getModTime() const;
|
||||
|
||||
/// Inherited from Reader
|
||||
virtual zsize_t getSize() const;
|
||||
|
||||
/// Inherited from Reader
|
||||
virtual void readData(
|
||||
zsize_t offset, zsize_t bytes, uint8_t* dest
|
||||
) const;
|
||||
private:
|
||||
FileReader(const FileReader&);
|
||||
FileReader& operator=(const FileReader&);
|
||||
|
||||
class FileReaderImpl;
|
||||
FileReaderImpl* m_impl;
|
||||
};
|
||||
|
||||
/// \typedef ReaderPtr
|
||||
/// A shared pointer to a Reader
|
||||
typedef std::shared_ptr<Reader> ReaderPtr;
|
||||
|
||||
/// \brief Writer accepts output data from the compression/decompression
|
||||
/// functions.
|
||||
///
|
||||
/// Normally, an application using libzipper provides the Writer
|
||||
/// implementation. The implementation could write data to files,
|
||||
/// in-memory buffers, or it could be simply discarded.
|
||||
///
|
||||
/// The Writer implementation needs only to support sequential access.
|
||||
class Writer
|
||||
{
|
||||
public:
|
||||
/// Writer dtor
|
||||
virtual ~Writer();
|
||||
|
||||
/// Returns the size of the written data.
|
||||
virtual zsize_t getSize() const = 0;
|
||||
|
||||
/// Accepts output from libzipper
|
||||
///
|
||||
/// An exception must be thrown if it is not possible to accept
|
||||
/// given data. (eg. file IO error).
|
||||
///
|
||||
/// \param offset Number of bytes to skip at the front of the data
|
||||
/// source. Skipped bytes will contain null characters if not already
|
||||
/// assigned a value.
|
||||
/// \param bytes Number of bytes in data
|
||||
/// \param data Output from libzipper.
|
||||
///
|
||||
virtual void writeData(
|
||||
zsize_t offset, zsize_t bytes, const uint8_t* data
|
||||
) = 0;
|
||||
};
|
||||
|
||||
/// \typedef WriterPtr
|
||||
/// A shared pointer to a Writer
|
||||
typedef std::shared_ptr<Writer> WriterPtr;
|
||||
|
||||
/// \brief FileWrter is a file-based implementation of the Writer
|
||||
/// interface.
|
||||
class FileWriter : public Writer
|
||||
{
|
||||
public:
|
||||
/// Write data to the supplied file.
|
||||
/// If the file already exists, it will be truncated.
|
||||
/// If the file does not exist, it will be created with the
|
||||
/// given permissions.
|
||||
///
|
||||
/// \param filename The file to open for writing.
|
||||
///
|
||||
/// \param createPermissions The permissions set on the file if it is to
|
||||
/// be created.
|
||||
///
|
||||
/// \param modTime Set a specific modification time on the created file.
|
||||
/// If the special s_now value is provided, the current time will be
|
||||
/// used.
|
||||
///
|
||||
FileWriter(
|
||||
const std::string& filename,
|
||||
mode_t createPermissions = 0664,
|
||||
const timeval& modTime = s_now);
|
||||
|
||||
/// Write data to the supplied file.
|
||||
///
|
||||
/// \param filename The filename reported in any exception error
|
||||
/// messages. This name is arbitary, and does not need to be
|
||||
/// related to fd.
|
||||
///
|
||||
/// \param fd The descriptor to write data to. The descriptor
|
||||
/// must be open for writing in blocking mode.
|
||||
///
|
||||
/// \param closeFd If true, fd will be closed by this object
|
||||
/// when it is no longer needed.
|
||||
FileWriter(const std::string& filename, int fd, bool closeFd);
|
||||
|
||||
/// FileWriter dtor
|
||||
virtual ~FileWriter();
|
||||
|
||||
/// Inherited from Writer
|
||||
virtual zsize_t getSize() const;
|
||||
|
||||
/// Inherited from Writer
|
||||
virtual void writeData(
|
||||
zsize_t offset, zsize_t bytes, const uint8_t* data
|
||||
);
|
||||
private:
|
||||
FileWriter(const FileWriter&);
|
||||
FileWriter& operator=(const FileWriter&);
|
||||
|
||||
class FileWriterImpl;
|
||||
FileWriterImpl* m_impl;
|
||||
};
|
||||
|
||||
/// \brief CompressedFile represents an entry within a compressed archive.
|
||||
///
|
||||
/// CompressedFile instances are created by Decompressor, and allow
|
||||
/// selectively extracting the contents of an archive.
|
||||
class CompressedFile
|
||||
{
|
||||
public:
|
||||
/// CompressedFile dtor
|
||||
virtual ~CompressedFile();
|
||||
|
||||
/// Return true if decompress is likely to succeed.
|
||||
///
|
||||
/// isDecompressSupported may return false if libzipper doesn't know
|
||||
/// how to deal with the compressed data. eg. encrypted files,
|
||||
/// or ZIP files compressed with non-standard schemes.
|
||||
virtual bool isDecompressSupported() const = 0;
|
||||
|
||||
/// Decompress the file, and store the results via the given
|
||||
/// writer object.
|
||||
virtual void decompress(Writer& writer) = 0;
|
||||
|
||||
/// Return the file path of the compressed file.
|
||||
///
|
||||
/// Unix-style path separaters ('/') are returned, even if the
|
||||
/// archive was created under an alternative OS.
|
||||
virtual const std::string& getPath() const = 0;
|
||||
|
||||
/// Return the compressed size of the file
|
||||
///
|
||||
/// getCompressedSize() will return -1 of the FileSize capability
|
||||
/// bit of the container is false.
|
||||
virtual zsize_t getCompressedSize() const = 0;
|
||||
|
||||
/// Return the uncompressed size of the file
|
||||
///
|
||||
/// The decompress method will pass exactly this number of bytes
|
||||
/// to the Writer.
|
||||
///
|
||||
/// getUncompressedSize() will return -1 of the FileSize capability
|
||||
/// bit of the container is false.
|
||||
virtual zsize_t getUncompressedSize() const = 0;
|
||||
|
||||
/// Return the modification time of the original file
|
||||
virtual const timeval& getModificationTime() const = 0;
|
||||
};
|
||||
/// \typedef CompressedFilePtr
|
||||
/// A shared pointer to a CompressedFile
|
||||
typedef std::shared_ptr<CompressedFile> CompressedFilePtr;
|
||||
|
||||
/// \brief Decompressor detects the compressed archive type of the data,
|
||||
/// and creates suitable CompressedFile instances to access the compressed
|
||||
/// data.
|
||||
class Decompressor
|
||||
{
|
||||
public:
|
||||
/// Create a decompressor from the data made available by reader.
|
||||
Decompressor(const ReaderPtr& reader);
|
||||
|
||||
/// Create a decompressor from the data made available by reader.
|
||||
///
|
||||
/// \param reader must remain in scope for the lifetime of the
|
||||
/// Decompressor, and lifetime of any CompressedFile objects returned
|
||||
/// from getEntries()
|
||||
Decompressor(Reader& reader);
|
||||
|
||||
/// Decompressor dtor
|
||||
~Decompressor();
|
||||
|
||||
/// Return the detected Container type of the compressed archive.
|
||||
ContainerFormat getContainerFormat() const;
|
||||
|
||||
/// Return CompressedFile entries to represent the file entries within
|
||||
/// a compressed archive.
|
||||
std::vector<CompressedFilePtr> getEntries() const;
|
||||
private:
|
||||
Decompressor(const Decompressor&);
|
||||
Decompressor& operator=(const Decompressor&);
|
||||
|
||||
class DecompressorImpl;
|
||||
DecompressorImpl* m_decompressor;
|
||||
};
|
||||
|
||||
/// \brief Compressor creates a compressed archive from the supplied
|
||||
/// Reader objects.
|
||||
/// data.
|
||||
class Compressor
|
||||
{
|
||||
public:
|
||||
/// Create a Compressor to output the given compressed archived format
|
||||
/// to writer.
|
||||
/// \param writer destination of the compressed data
|
||||
/// \param format determines the output archive file type to
|
||||
/// create.
|
||||
Compressor(ContainerFormat format, const WriterPtr& writer);
|
||||
|
||||
/// Create a Compressor to output the given compressed archived format
|
||||
/// to writer.
|
||||
///
|
||||
/// \param writer is the destination of the compressed data. writer
|
||||
/// must remain in scope for the lifetime of the Compressor.
|
||||
/// \param format determines the output archive file type to
|
||||
/// create.
|
||||
Compressor(ContainerFormat format, Writer& writer);
|
||||
|
||||
/// \brief Compressor dtor
|
||||
///
|
||||
/// Additional data may be passed to writer (given in ctor) to close
|
||||
/// the compressed archive.
|
||||
~Compressor();
|
||||
|
||||
/// Compress the data given by reader, and add it to the compressed
|
||||
/// archive.
|
||||
void addFile(const Reader& reader);
|
||||
|
||||
class CompressorImpl;
|
||||
private:
|
||||
Compressor(const Compressor&);
|
||||
Compressor& operator=(const Compressor&);
|
||||
|
||||
CompressorImpl* m_compressor;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <wx/windowptr.h>
|
||||
#include <wx/thread.h>
|
||||
|
||||
#include <zipper.hh>
|
||||
|
||||
#include "ConfigUtil.hh"
|
||||
#include "TargetPanel.hh"
|
||||
#include "SCSI2SD_Bootloader.hh"
|
||||
|
249
software/scsi2sd-util/zlib-1.2.8/CMakeLists.txt
Normal file
249
software/scsi2sd-util/zlib-1.2.8/CMakeLists.txt
Normal file
@ -0,0 +1,249 @@
|
||||
cmake_minimum_required(VERSION 2.4.4)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
||||
|
||||
project(zlib C)
|
||||
|
||||
set(VERSION "1.2.8")
|
||||
|
||||
option(ASM686 "Enable building i686 assembly implementation")
|
||||
option(AMD64 "Enable building amd64 assembly implementation")
|
||||
|
||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
||||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
||||
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
|
||||
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
||||
|
||||
include(CheckTypeSize)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckCSourceCompiles)
|
||||
enable_testing()
|
||||
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
||||
|
||||
#
|
||||
# Check to see if we have large file support
|
||||
#
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
|
||||
# We add these other definitions here because CheckTypeSize.cmake
|
||||
# in CMake 2.4.x does not automatically do so and we want
|
||||
# compatibility with CMake 2.4.x.
|
||||
if(HAVE_SYS_TYPES_H)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
|
||||
endif()
|
||||
if(HAVE_STDINT_H)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
|
||||
endif()
|
||||
if(HAVE_STDDEF_H)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
|
||||
endif()
|
||||
check_type_size(off64_t OFF64_T)
|
||||
if(HAVE_OFF64_T)
|
||||
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
|
||||
|
||||
#
|
||||
# Check for fseeko
|
||||
#
|
||||
check_function_exists(fseeko HAVE_FSEEKO)
|
||||
if(NOT HAVE_FSEEKO)
|
||||
add_definitions(-DNO_FSEEKO)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Check for unistd.h
|
||||
#
|
||||
check_include_file(unistd.h Z_HAVE_UNISTD_H)
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||
# If we're doing an out of source build and the user has a zconf.h
|
||||
# in their source tree...
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
|
||||
message(STATUS "Renaming")
|
||||
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h")
|
||||
message(STATUS "to 'zconf.h.included' because this file is included with zlib")
|
||||
message(STATUS "but CMake generates it automatically in the build directory.")
|
||||
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
|
||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
|
||||
${ZLIB_PC} @ONLY)
|
||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
||||
|
||||
|
||||
#============================================================================
|
||||
# zlib
|
||||
#============================================================================
|
||||
|
||||
set(ZLIB_PUBLIC_HDRS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
|
||||
zlib.h
|
||||
)
|
||||
set(ZLIB_PRIVATE_HDRS
|
||||
crc32.h
|
||||
deflate.h
|
||||
gzguts.h
|
||||
inffast.h
|
||||
inffixed.h
|
||||
inflate.h
|
||||
inftrees.h
|
||||
trees.h
|
||||
zutil.h
|
||||
)
|
||||
set(ZLIB_SRCS
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
deflate.c
|
||||
gzclose.c
|
||||
gzlib.c
|
||||
gzread.c
|
||||
gzwrite.c
|
||||
inflate.c
|
||||
infback.c
|
||||
inftrees.c
|
||||
inffast.c
|
||||
trees.c
|
||||
uncompr.c
|
||||
zutil.c
|
||||
)
|
||||
|
||||
if(NOT MINGW)
|
||||
set(ZLIB_DLL_SRCS
|
||||
win32/zlib1.rc # If present will override custom build rule below.
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(ASM686)
|
||||
set(ZLIB_ASMS contrib/asm686/match.S)
|
||||
elseif (AMD64)
|
||||
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
|
||||
endif ()
|
||||
|
||||
if(ZLIB_ASMS)
|
||||
add_definitions(-DASMV)
|
||||
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(ASM686)
|
||||
ENABLE_LANGUAGE(ASM_MASM)
|
||||
set(ZLIB_ASMS
|
||||
contrib/masmx86/inffas32.asm
|
||||
contrib/masmx86/match686.asm
|
||||
)
|
||||
elseif (AMD64)
|
||||
ENABLE_LANGUAGE(ASM_MASM)
|
||||
set(ZLIB_ASMS
|
||||
contrib/masmx64/gvmat64.asm
|
||||
contrib/masmx64/inffasx64.asm
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZLIB_ASMS)
|
||||
add_definitions(-DASMV -DASMINF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
|
||||
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
|
||||
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
|
||||
|
||||
if(MINGW)
|
||||
# This gets us DLL resource information when compiling on MinGW.
|
||||
if(NOT CMAKE_RC_COMPILER)
|
||||
set(CMAKE_RC_COMPILER windres.exe)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
||||
COMMAND ${CMAKE_RC_COMPILER}
|
||||
-D GCC_WINDRES
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-I ${CMAKE_CURRENT_BINARY_DIR}
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
||||
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
|
||||
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
||||
endif(MINGW)
|
||||
|
||||
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||
|
||||
if(NOT CYGWIN)
|
||||
# This property causes shared libraries on Linux to have the full version
|
||||
# encoded into their final filename. We disable this on Cygwin because
|
||||
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
|
||||
# seems to be the default.
|
||||
#
|
||||
# This has no effect with MSVC, on that platform the version info for
|
||||
# the DLL comes from the resource file win32/zlib1.rc
|
||||
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
# On unix-like platforms the library is almost always called libz
|
||||
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
||||
if(NOT APPLE)
|
||||
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
||||
endif()
|
||||
elseif(BUILD_SHARED_LIBS AND WIN32)
|
||||
# Creates zlib1.dll when building shared library version
|
||||
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
install(TARGETS zlib zlibstatic
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
|
||||
endif()
|
||||
|
||||
#============================================================================
|
||||
# Example binaries
|
||||
#============================================================================
|
||||
|
||||
add_executable(example test/example.c)
|
||||
target_link_libraries(example zlib)
|
||||
add_test(example example)
|
||||
|
||||
add_executable(minigzip test/minigzip.c)
|
||||
target_link_libraries(minigzip zlib)
|
||||
|
||||
if(HAVE_OFF64_T)
|
||||
add_executable(example64 test/example.c)
|
||||
target_link_libraries(example64 zlib)
|
||||
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||
add_test(example64 example64)
|
||||
|
||||
add_executable(minigzip64 test/minigzip.c)
|
||||
target_link_libraries(minigzip64 zlib)
|
||||
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||
endif()
|
1472
software/scsi2sd-util/zlib-1.2.8/ChangeLog
Normal file
1472
software/scsi2sd-util/zlib-1.2.8/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
368
software/scsi2sd-util/zlib-1.2.8/FAQ
Normal file
368
software/scsi2sd-util/zlib-1.2.8/FAQ
Normal file
@ -0,0 +1,368 @@
|
||||
|
||||
Frequently Asked Questions about zlib
|
||||
|
||||
|
||||
If your question is not there, please check the zlib home page
|
||||
http://zlib.net/ which may have more recent information.
|
||||
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
|
||||
|
||||
|
||||
1. Is zlib Y2K-compliant?
|
||||
|
||||
Yes. zlib doesn't handle dates.
|
||||
|
||||
2. Where can I get a Windows DLL version?
|
||||
|
||||
The zlib sources can be compiled without change to produce a DLL. See the
|
||||
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
|
||||
precompiled DLL are found in the zlib web site at http://zlib.net/ .
|
||||
|
||||
3. Where can I get a Visual Basic interface to zlib?
|
||||
|
||||
See
|
||||
* http://marknelson.us/1997/01/01/zlib-engine/
|
||||
* win32/DLL_FAQ.txt in the zlib distribution
|
||||
|
||||
4. compress() returns Z_BUF_ERROR.
|
||||
|
||||
Make sure that before the call of compress(), the length of the compressed
|
||||
buffer is equal to the available size of the compressed buffer and not
|
||||
zero. For Visual Basic, check that this parameter is passed by reference
|
||||
("as any"), not by value ("as long").
|
||||
|
||||
5. deflate() or inflate() returns Z_BUF_ERROR.
|
||||
|
||||
Before making the call, make sure that avail_in and avail_out are not zero.
|
||||
When setting the parameter flush equal to Z_FINISH, also make sure that
|
||||
avail_out is big enough to allow processing all pending input. Note that a
|
||||
Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
|
||||
made with more input or output space. A Z_BUF_ERROR may in fact be
|
||||
unavoidable depending on how the functions are used, since it is not
|
||||
possible to tell whether or not there is more output pending when
|
||||
strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a
|
||||
heavily annotated example.
|
||||
|
||||
6. Where's the zlib documentation (man pages, etc.)?
|
||||
|
||||
It's in zlib.h . Examples of zlib usage are in the files test/example.c
|
||||
and test/minigzip.c, with more in examples/ .
|
||||
|
||||
7. Why don't you use GNU autoconf or libtool or ...?
|
||||
|
||||
Because we would like to keep zlib as a very small and simple package.
|
||||
zlib is rather portable and doesn't need much configuration.
|
||||
|
||||
8. I found a bug in zlib.
|
||||
|
||||
Most of the time, such problems are due to an incorrect usage of zlib.
|
||||
Please try to reproduce the problem with a small program and send the
|
||||
corresponding source to us at zlib@gzip.org . Do not send multi-megabyte
|
||||
data files without prior agreement.
|
||||
|
||||
9. Why do I get "undefined reference to gzputc"?
|
||||
|
||||
If "make test" produces something like
|
||||
|
||||
example.o(.text+0x154): undefined reference to `gzputc'
|
||||
|
||||
check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
|
||||
/usr/X11R6/lib. Remove any old versions, then do "make install".
|
||||
|
||||
10. I need a Delphi interface to zlib.
|
||||
|
||||
See the contrib/delphi directory in the zlib distribution.
|
||||
|
||||
11. Can zlib handle .zip archives?
|
||||
|
||||
Not by itself, no. See the directory contrib/minizip in the zlib
|
||||
distribution.
|
||||
|
||||
12. Can zlib handle .Z files?
|
||||
|
||||
No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
|
||||
the code of uncompress on your own.
|
||||
|
||||
13. How can I make a Unix shared library?
|
||||
|
||||
By default a shared (and a static) library is built for Unix. So:
|
||||
|
||||
make distclean
|
||||
./configure
|
||||
make
|
||||
|
||||
14. How do I install a shared zlib library on Unix?
|
||||
|
||||
After the above, then:
|
||||
|
||||
make install
|
||||
|
||||
However, many flavors of Unix come with a shared zlib already installed.
|
||||
Before going to the trouble of compiling a shared version of zlib and
|
||||
trying to install it, you may want to check if it's already there! If you
|
||||
can #include <zlib.h>, it's there. The -lz option will probably link to
|
||||
it. You can check the version at the top of zlib.h or with the
|
||||
ZLIB_VERSION symbol defined in zlib.h .
|
||||
|
||||
15. I have a question about OttoPDF.
|
||||
|
||||
We are not the authors of OttoPDF. The real author is on the OttoPDF web
|
||||
site: Joel Hainley, jhainley@myndkryme.com.
|
||||
|
||||
16. Can zlib decode Flate data in an Adobe PDF file?
|
||||
|
||||
Yes. See http://www.pdflib.com/ . To modify PDF forms, see
|
||||
http://sourceforge.net/projects/acroformtool/ .
|
||||
|
||||
17. Why am I getting this "register_frame_info not found" error on Solaris?
|
||||
|
||||
After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
|
||||
generates an error such as:
|
||||
|
||||
ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
|
||||
symbol __register_frame_info: referenced symbol not found
|
||||
|
||||
The symbol __register_frame_info is not part of zlib, it is generated by
|
||||
the C compiler (cc or gcc). You must recompile applications using zlib
|
||||
which have this problem. This problem is specific to Solaris. See
|
||||
http://www.sunfreeware.com for Solaris versions of zlib and applications
|
||||
using zlib.
|
||||
|
||||
18. Why does gzip give an error on a file I make with compress/deflate?
|
||||
|
||||
The compress and deflate functions produce data in the zlib format, which
|
||||
is different and incompatible with the gzip format. The gz* functions in
|
||||
zlib on the other hand use the gzip format. Both the zlib and gzip formats
|
||||
use the same compressed data format internally, but have different headers
|
||||
and trailers around the compressed data.
|
||||
|
||||
19. Ok, so why are there two different formats?
|
||||
|
||||
The gzip format was designed to retain the directory information about a
|
||||
single file, such as the name and last modification date. The zlib format
|
||||
on the other hand was designed for in-memory and communication channel
|
||||
applications, and has a much more compact header and trailer and uses a
|
||||
faster integrity check than gzip.
|
||||
|
||||
20. Well that's nice, but how do I make a gzip file in memory?
|
||||
|
||||
You can request that deflate write the gzip format instead of the zlib
|
||||
format using deflateInit2(). You can also request that inflate decode the
|
||||
gzip format using inflateInit2(). Read zlib.h for more details.
|
||||
|
||||
21. Is zlib thread-safe?
|
||||
|
||||
Yes. However any library routines that zlib uses and any application-
|
||||
provided memory allocation routines must also be thread-safe. zlib's gz*
|
||||
functions use stdio library routines, and most of zlib's functions use the
|
||||
library memory allocation routines by default. zlib's *Init* functions
|
||||
allow for the application to provide custom memory allocation routines.
|
||||
|
||||
Of course, you should only operate on any given zlib or gzip stream from a
|
||||
single thread at a time.
|
||||
|
||||
22. Can I use zlib in my commercial application?
|
||||
|
||||
Yes. Please read the license in zlib.h.
|
||||
|
||||
23. Is zlib under the GNU license?
|
||||
|
||||
No. Please read the license in zlib.h.
|
||||
|
||||
24. The license says that altered source versions must be "plainly marked". So
|
||||
what exactly do I need to do to meet that requirement?
|
||||
|
||||
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
|
||||
particular, the final version number needs to be changed to "f", and an
|
||||
identification string should be appended to ZLIB_VERSION. Version numbers
|
||||
x.x.x.f are reserved for modifications to zlib by others than the zlib
|
||||
maintainers. For example, if the version of the base zlib you are altering
|
||||
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
|
||||
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
|
||||
update the version strings in deflate.c and inftrees.c.
|
||||
|
||||
For altered source distributions, you should also note the origin and
|
||||
nature of the changes in zlib.h, as well as in ChangeLog and README, along
|
||||
with the dates of the alterations. The origin should include at least your
|
||||
name (or your company's name), and an email address to contact for help or
|
||||
issues with the library.
|
||||
|
||||
Note that distributing a compiled zlib library along with zlib.h and
|
||||
zconf.h is also a source distribution, and so you should change
|
||||
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
|
||||
in zlib.h as you would for a full source distribution.
|
||||
|
||||
25. Will zlib work on a big-endian or little-endian architecture, and can I
|
||||
exchange compressed data between them?
|
||||
|
||||
Yes and yes.
|
||||
|
||||
26. Will zlib work on a 64-bit machine?
|
||||
|
||||
Yes. It has been tested on 64-bit machines, and has no dependence on any
|
||||
data types being limited to 32-bits in length. If you have any
|
||||
difficulties, please provide a complete problem report to zlib@gzip.org
|
||||
|
||||
27. Will zlib decompress data from the PKWare Data Compression Library?
|
||||
|
||||
No. The PKWare DCL uses a completely different compressed data format than
|
||||
does PKZIP and zlib. However, you can look in zlib's contrib/blast
|
||||
directory for a possible solution to your problem.
|
||||
|
||||
28. Can I access data randomly in a compressed stream?
|
||||
|
||||
No, not without some preparation. If when compressing you periodically use
|
||||
Z_FULL_FLUSH, carefully write all the pending data at those points, and
|
||||
keep an index of those locations, then you can start decompression at those
|
||||
points. You have to be careful to not use Z_FULL_FLUSH too often, since it
|
||||
can significantly degrade compression. Alternatively, you can scan a
|
||||
deflate stream once to generate an index, and then use that index for
|
||||
random access. See examples/zran.c .
|
||||
|
||||
29. Does zlib work on MVS, OS/390, CICS, etc.?
|
||||
|
||||
It has in the past, but we have not heard of any recent evidence. There
|
||||
were working ports of zlib 1.1.4 to MVS, but those links no longer work.
|
||||
If you know of recent, successful applications of zlib on these operating
|
||||
systems, please let us know. Thanks.
|
||||
|
||||
30. Is there some simpler, easier to read version of inflate I can look at to
|
||||
understand the deflate format?
|
||||
|
||||
First off, you should read RFC 1951. Second, yes. Look in zlib's
|
||||
contrib/puff directory.
|
||||
|
||||
31. Does zlib infringe on any patents?
|
||||
|
||||
As far as we know, no. In fact, that was originally the whole point behind
|
||||
zlib. Look here for some more information:
|
||||
|
||||
http://www.gzip.org/#faq11
|
||||
|
||||
32. Can zlib work with greater than 4 GB of data?
|
||||
|
||||
Yes. inflate() and deflate() will process any amount of data correctly.
|
||||
Each call of inflate() or deflate() is limited to input and output chunks
|
||||
of the maximum value that can be stored in the compiler's "unsigned int"
|
||||
type, but there is no limit to the number of chunks. Note however that the
|
||||
strm.total_in and strm_total_out counters may be limited to 4 GB. These
|
||||
counters are provided as a convenience and are not used internally by
|
||||
inflate() or deflate(). The application can easily set up its own counters
|
||||
updated after each call of inflate() or deflate() to count beyond 4 GB.
|
||||
compress() and uncompress() may be limited to 4 GB, since they operate in a
|
||||
single call. gzseek() and gztell() may be limited to 4 GB depending on how
|
||||
zlib is compiled. See the zlibCompileFlags() function in zlib.h.
|
||||
|
||||
The word "may" appears several times above since there is a 4 GB limit only
|
||||
if the compiler's "long" type is 32 bits. If the compiler's "long" type is
|
||||
64 bits, then the limit is 16 exabytes.
|
||||
|
||||
33. Does zlib have any security vulnerabilities?
|
||||
|
||||
The only one that we are aware of is potentially in gzprintf(). If zlib is
|
||||
compiled to use sprintf() or vsprintf(), then there is no protection
|
||||
against a buffer overflow of an 8K string space (or other value as set by
|
||||
gzbuffer()), other than the caller of gzprintf() assuring that the output
|
||||
will not exceed 8K. On the other hand, if zlib is compiled to use
|
||||
snprintf() or vsnprintf(), which should normally be the case, then there is
|
||||
no vulnerability. The ./configure script will display warnings if an
|
||||
insecure variation of sprintf() will be used by gzprintf(). Also the
|
||||
zlibCompileFlags() function will return information on what variant of
|
||||
sprintf() is used by gzprintf().
|
||||
|
||||
If you don't have snprintf() or vsnprintf() and would like one, you can
|
||||
find a portable implementation here:
|
||||
|
||||
http://www.ijs.si/software/snprintf/
|
||||
|
||||
Note that you should be using the most recent version of zlib. Versions
|
||||
1.1.3 and before were subject to a double-free vulnerability, and versions
|
||||
1.2.1 and 1.2.2 were subject to an access exception when decompressing
|
||||
invalid compressed data.
|
||||
|
||||
34. Is there a Java version of zlib?
|
||||
|
||||
Probably what you want is to use zlib in Java. zlib is already included
|
||||
as part of the Java SDK in the java.util.zip package. If you really want
|
||||
a version of zlib written in the Java language, look on the zlib home
|
||||
page for links: http://zlib.net/ .
|
||||
|
||||
35. I get this or that compiler or source-code scanner warning when I crank it
|
||||
up to maximally-pedantic. Can't you guys write proper code?
|
||||
|
||||
Many years ago, we gave up attempting to avoid warnings on every compiler
|
||||
in the universe. It just got to be a waste of time, and some compilers
|
||||
were downright silly as well as contradicted each other. So now, we simply
|
||||
make sure that the code always works.
|
||||
|
||||
36. Valgrind (or some similar memory access checker) says that deflate is
|
||||
performing a conditional jump that depends on an uninitialized value.
|
||||
Isn't that a bug?
|
||||
|
||||
No. That is intentional for performance reasons, and the output of deflate
|
||||
is not affected. This only started showing up recently since zlib 1.2.x
|
||||
uses malloc() by default for allocations, whereas earlier versions used
|
||||
calloc(), which zeros out the allocated memory. Even though the code was
|
||||
correct, versions 1.2.4 and later was changed to not stimulate these
|
||||
checkers.
|
||||
|
||||
37. Will zlib read the (insert any ancient or arcane format here) compressed
|
||||
data format?
|
||||
|
||||
Probably not. Look in the comp.compression FAQ for pointers to various
|
||||
formats and associated software.
|
||||
|
||||
38. How can I encrypt/decrypt zip files with zlib?
|
||||
|
||||
zlib doesn't support encryption. The original PKZIP encryption is very
|
||||
weak and can be broken with freely available programs. To get strong
|
||||
encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
|
||||
compression. For PKZIP compatible "encryption", look at
|
||||
http://www.info-zip.org/
|
||||
|
||||
39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
|
||||
|
||||
"gzip" is the gzip format, and "deflate" is the zlib format. They should
|
||||
probably have called the second one "zlib" instead to avoid confusion with
|
||||
the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
|
||||
correctly points to the zlib specification in RFC 1950 for the "deflate"
|
||||
transfer encoding, there have been reports of servers and browsers that
|
||||
incorrectly produce or expect raw deflate data per the deflate
|
||||
specification in RFC 1951, most notably Microsoft. So even though the
|
||||
"deflate" transfer encoding using the zlib format would be the more
|
||||
efficient approach (and in fact exactly what the zlib format was designed
|
||||
for), using the "gzip" transfer encoding is probably more reliable due to
|
||||
an unfortunate choice of name on the part of the HTTP 1.1 authors.
|
||||
|
||||
Bottom line: use the gzip format for HTTP 1.1 encoding.
|
||||
|
||||
40. Does zlib support the new "Deflate64" format introduced by PKWare?
|
||||
|
||||
No. PKWare has apparently decided to keep that format proprietary, since
|
||||
they have not documented it as they have previous compression formats. In
|
||||
any case, the compression improvements are so modest compared to other more
|
||||
modern approaches, that it's not worth the effort to implement.
|
||||
|
||||
41. I'm having a problem with the zip functions in zlib, can you help?
|
||||
|
||||
There are no zip functions in zlib. You are probably using minizip by
|
||||
Giles Vollant, which is found in the contrib directory of zlib. It is not
|
||||
part of zlib. In fact none of the stuff in contrib is part of zlib. The
|
||||
files in there are not supported by the zlib authors. You need to contact
|
||||
the authors of the respective contribution for help.
|
||||
|
||||
42. The match.asm code in contrib is under the GNU General Public License.
|
||||
Since it's part of zlib, doesn't that mean that all of zlib falls under the
|
||||
GNU GPL?
|
||||
|
||||
No. The files in contrib are not part of zlib. They were contributed by
|
||||
other authors and are provided as a convenience to the user within the zlib
|
||||
distribution. Each item in contrib has its own license.
|
||||
|
||||
43. Is zlib subject to export controls? What is its ECCN?
|
||||
|
||||
zlib is not subject to export controls, and so is classified as EAR99.
|
||||
|
||||
44. Can you please sign these lengthy legal documents and fax them back to us
|
||||
so that we can use your software in our product?
|
||||
|
||||
No. Go away. Shoo.
|
68
software/scsi2sd-util/zlib-1.2.8/INDEX
Normal file
68
software/scsi2sd-util/zlib-1.2.8/INDEX
Normal file
@ -0,0 +1,68 @@
|
||||
CMakeLists.txt cmake build file
|
||||
ChangeLog history of changes
|
||||
FAQ Frequently Asked Questions about zlib
|
||||
INDEX this file
|
||||
Makefile dummy Makefile that tells you to ./configure
|
||||
Makefile.in template for Unix Makefile
|
||||
README guess what
|
||||
configure configure script for Unix
|
||||
make_vms.com makefile for VMS
|
||||
test/example.c zlib usages examples for build testing
|
||||
test/minigzip.c minimal gzip-like functionality for build testing
|
||||
test/infcover.c inf*.c code coverage for build coverage testing
|
||||
treebuild.xml XML description of source file dependencies
|
||||
zconf.h.cmakein zconf.h template for cmake
|
||||
zconf.h.in zconf.h template for configure
|
||||
zlib.3 Man page for zlib
|
||||
zlib.3.pdf Man page in PDF format
|
||||
zlib.map Linux symbol information
|
||||
zlib.pc.in Template for pkg-config descriptor
|
||||
zlib.pc.cmakein zlib.pc template for cmake
|
||||
zlib2ansi perl script to convert source files for C++ compilation
|
||||
|
||||
amiga/ makefiles for Amiga SAS C
|
||||
as400/ makefiles for AS/400
|
||||
doc/ documentation for formats and algorithms
|
||||
msdos/ makefiles for MSDOS
|
||||
nintendods/ makefile for Nintendo DS
|
||||
old/ makefiles for various architectures and zlib documentation
|
||||
files that have not yet been updated for zlib 1.2.x
|
||||
qnx/ makefiles for QNX
|
||||
watcom/ makefiles for OpenWatcom
|
||||
win32/ makefiles for Windows
|
||||
|
||||
zlib public header files (required for library use):
|
||||
zconf.h
|
||||
zlib.h
|
||||
|
||||
private source files used to build the zlib library:
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
crc32.h
|
||||
deflate.c
|
||||
deflate.h
|
||||
gzclose.c
|
||||
gzguts.h
|
||||
gzlib.c
|
||||
gzread.c
|
||||
gzwrite.c
|
||||
infback.c
|
||||
inffast.c
|
||||
inffast.h
|
||||
inffixed.h
|
||||
inflate.c
|
||||
inflate.h
|
||||
inftrees.c
|
||||
inftrees.h
|
||||
trees.c
|
||||
trees.h
|
||||
uncompr.c
|
||||
zutil.c
|
||||
zutil.h
|
||||
|
||||
source files for sample programs
|
||||
See examples/README.examples
|
||||
|
||||
unsupported contributions by third parties
|
||||
See contrib/README.contrib
|
5
software/scsi2sd-util/zlib-1.2.8/Makefile
Normal file
5
software/scsi2sd-util/zlib-1.2.8/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
all:
|
||||
-@echo "Please use ./configure first. Thank you."
|
||||
|
||||
distclean:
|
||||
make -f Makefile.in distclean
|
288
software/scsi2sd-util/zlib-1.2.8/Makefile.in
Normal file
288
software/scsi2sd-util/zlib-1.2.8/Makefile.in
Normal file
@ -0,0 +1,288 @@
|
||||
# Makefile for zlib
|
||||
# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler
|
||||
# For conditions of distribution and use, see copyright notice in zlib.h
|
||||
|
||||
# To compile and test, type:
|
||||
# ./configure; make test
|
||||
# Normally configure builds both a static and a shared library.
|
||||
# If you want to build just a static library, use: ./configure --static
|
||||
|
||||
# To use the asm code, type:
|
||||
# cp contrib/asm?86/match.S ./match.S
|
||||
# make LOC=-DASMV OBJA=match.o
|
||||
|
||||
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
|
||||
# make install
|
||||
# To install in $HOME instead of /usr/local, use:
|
||||
# make install prefix=$HOME
|
||||
|
||||
CC=cc
|
||||
|
||||
CFLAGS=-O
|
||||
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
|
||||
#CFLAGS=-g -DDEBUG
|
||||
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
|
||||
# -Wstrict-prototypes -Wmissing-prototypes
|
||||
|
||||
SFLAGS=-O
|
||||
LDFLAGS=
|
||||
TEST_LDFLAGS=-L. libz.a
|
||||
LDSHARED=$(CC)
|
||||
CPP=$(CC) -E
|
||||
|
||||
STATICLIB=libz.a
|
||||
SHAREDLIB=libz.so
|
||||
SHAREDLIBV=libz.so.1.2.8
|
||||
SHAREDLIBM=libz.so.1
|
||||
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
||||
|
||||
AR=ar
|
||||
ARFLAGS=rc
|
||||
RANLIB=ranlib
|
||||
LDCONFIG=ldconfig
|
||||
LDSHAREDLIBC=-lc
|
||||
TAR=tar
|
||||
SHELL=/bin/sh
|
||||
EXE=
|
||||
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
libdir = ${exec_prefix}/lib
|
||||
sharedlibdir = ${libdir}
|
||||
includedir = ${prefix}/include
|
||||
mandir = ${prefix}/share/man
|
||||
man3dir = ${mandir}/man3
|
||||
pkgconfigdir = ${libdir}/pkgconfig
|
||||
|
||||
OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
|
||||
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
|
||||
OBJC = $(OBJZ) $(OBJG)
|
||||
|
||||
PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
|
||||
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
|
||||
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
|
||||
|
||||
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
|
||||
OBJA =
|
||||
PIC_OBJA =
|
||||
|
||||
OBJS = $(OBJC) $(OBJA)
|
||||
|
||||
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
|
||||
|
||||
all: static shared
|
||||
|
||||
static: example$(EXE) minigzip$(EXE)
|
||||
|
||||
shared: examplesh$(EXE) minigzipsh$(EXE)
|
||||
|
||||
all64: example64$(EXE) minigzip64$(EXE)
|
||||
|
||||
check: test
|
||||
|
||||
test: all teststatic testshared
|
||||
|
||||
teststatic: static
|
||||
@TMPST=tmpst_$$; \
|
||||
if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
|
||||
echo ' *** zlib test OK ***'; \
|
||||
else \
|
||||
echo ' *** zlib test FAILED ***'; false; \
|
||||
fi; \
|
||||
rm -f $$TMPST
|
||||
|
||||
testshared: shared
|
||||
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
|
||||
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
|
||||
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
|
||||
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
|
||||
TMPSH=tmpsh_$$; \
|
||||
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
|
||||
echo ' *** zlib shared test OK ***'; \
|
||||
else \
|
||||
echo ' *** zlib shared test FAILED ***'; false; \
|
||||
fi; \
|
||||
rm -f $$TMPSH
|
||||
|
||||
test64: all64
|
||||
@TMP64=tmp64_$$; \
|
||||
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
|
||||
echo ' *** zlib 64-bit test OK ***'; \
|
||||
else \
|
||||
echo ' *** zlib 64-bit test FAILED ***'; false; \
|
||||
fi; \
|
||||
rm -f $$TMP64
|
||||
|
||||
infcover.o: test/infcover.c zlib.h zconf.h
|
||||
$(CC) $(CFLAGS) -I. -c -o $@ test/infcover.c
|
||||
|
||||
infcover: infcover.o libz.a
|
||||
$(CC) $(CFLAGS) -o $@ infcover.o libz.a
|
||||
|
||||
cover: infcover
|
||||
rm -f *.gcda
|
||||
./infcover
|
||||
gcov inf*.c
|
||||
|
||||
libz.a: $(OBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(OBJS)
|
||||
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
|
||||
|
||||
match.o: match.S
|
||||
$(CPP) match.S > _match.s
|
||||
$(CC) -c _match.s
|
||||
mv _match.o match.o
|
||||
rm -f _match.s
|
||||
|
||||
match.lo: match.S
|
||||
$(CPP) match.S > _match.s
|
||||
$(CC) -c -fPIC _match.s
|
||||
mv _match.o match.lo
|
||||
rm -f _match.s
|
||||
|
||||
example.o: test/example.c zlib.h zconf.h
|
||||
$(CC) $(CFLAGS) -I. -c -o $@ test/example.c
|
||||
|
||||
minigzip.o: test/minigzip.c zlib.h zconf.h
|
||||
$(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c
|
||||
|
||||
example64.o: test/example.c zlib.h zconf.h
|
||||
$(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/example.c
|
||||
|
||||
minigzip64.o: test/minigzip.c zlib.h zconf.h
|
||||
$(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/minigzip.c
|
||||
|
||||
.SUFFIXES: .lo
|
||||
|
||||
.c.lo:
|
||||
-@mkdir objs 2>/dev/null || test -d objs
|
||||
$(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
|
||||
-@mv objs/$*.o $@
|
||||
|
||||
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
|
||||
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
|
||||
rm -f $(SHAREDLIB) $(SHAREDLIBM)
|
||||
ln -s $@ $(SHAREDLIB)
|
||||
ln -s $@ $(SHAREDLIBM)
|
||||
-@rmdir objs
|
||||
|
||||
example$(EXE): example.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
|
||||
|
||||
minigzip$(EXE): minigzip.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
|
||||
|
||||
examplesh$(EXE): example.o $(SHAREDLIBV)
|
||||
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
|
||||
|
||||
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
|
||||
|
||||
example64$(EXE): example64.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
|
||||
|
||||
minigzip64$(EXE): minigzip64.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
|
||||
|
||||
install-libs: $(LIBS)
|
||||
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
|
||||
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
|
||||
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
|
||||
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
|
||||
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
|
||||
cp $(STATICLIB) $(DESTDIR)$(libdir)
|
||||
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
|
||||
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
|
||||
-@if test -n "$(SHAREDLIBV)"; then \
|
||||
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
|
||||
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
|
||||
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
|
||||
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
|
||||
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
|
||||
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
|
||||
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
|
||||
($(LDCONFIG) || true) >/dev/null 2>&1; \
|
||||
fi
|
||||
cp zlib.3 $(DESTDIR)$(man3dir)
|
||||
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
|
||||
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
|
||||
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
|
||||
# The ranlib in install is needed on NeXTSTEP which checks file times
|
||||
# ldconfig is for Linux
|
||||
|
||||
install: install-libs
|
||||
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
|
||||
cp zlib.h zconf.h $(DESTDIR)$(includedir)
|
||||
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
|
||||
|
||||
uninstall:
|
||||
cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
|
||||
cd $(DESTDIR)$(libdir) && rm -f libz.a; \
|
||||
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
|
||||
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
|
||||
fi
|
||||
cd $(DESTDIR)$(man3dir) && rm -f zlib.3
|
||||
cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
|
||||
|
||||
docs: zlib.3.pdf
|
||||
|
||||
zlib.3.pdf: zlib.3
|
||||
groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
|
||||
|
||||
zconf.h.cmakein: zconf.h.in
|
||||
-@ TEMPFILE=zconfh_$$; \
|
||||
echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
|
||||
sed -f $$TEMPFILE zconf.h.in > zconf.h.cmakein &&\
|
||||
touch -r zconf.h.in zconf.h.cmakein &&\
|
||||
rm $$TEMPFILE
|
||||
|
||||
zconf: zconf.h.in
|
||||
cp -p zconf.h.in zconf.h
|
||||
|
||||
mostlyclean: clean
|
||||
clean:
|
||||
rm -f *.o *.lo *~ \
|
||||
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
|
||||
example64$(EXE) minigzip64$(EXE) \
|
||||
infcover \
|
||||
libz.* foo.gz so_locations \
|
||||
_match.s maketree contrib/infback9/*.o
|
||||
rm -rf objs
|
||||
rm -f *.gcda *.gcno *.gcov
|
||||
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
|
||||
|
||||
maintainer-clean: distclean
|
||||
distclean: clean zconf zconf.h.cmakein docs
|
||||
rm -f Makefile zlib.pc configure.log
|
||||
-@rm -f .DS_Store
|
||||
-@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile
|
||||
-@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
|
||||
-@touch -r Makefile.in Makefile
|
||||
|
||||
tags:
|
||||
etags *.[ch]
|
||||
|
||||
depend:
|
||||
makedepend -- $(CFLAGS) -- *.[ch]
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
adler32.o zutil.o: zutil.h zlib.h zconf.h
|
||||
gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
|
||||
compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
|
||||
crc32.o: zutil.h zlib.h zconf.h crc32.h
|
||||
deflate.o: deflate.h zutil.h zlib.h zconf.h
|
||||
infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
|
||||
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
|
||||
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
|
||||
|
||||
adler32.lo zutil.lo: zutil.h zlib.h zconf.h
|
||||
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
|
||||
compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
|
||||
crc32.lo: zutil.h zlib.h zconf.h crc32.h
|
||||
deflate.lo: deflate.h zutil.h zlib.h zconf.h
|
||||
infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
|
||||
inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
|
||||
trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h
|
115
software/scsi2sd-util/zlib-1.2.8/README
Normal file
115
software/scsi2sd-util/zlib-1.2.8/README
Normal file
@ -0,0 +1,115 @@
|
||||
ZLIB DATA COMPRESSION LIBRARY
|
||||
|
||||
zlib 1.2.8 is a general purpose data compression library. All the code is
|
||||
thread safe. The data format used by the zlib library is described by RFCs
|
||||
(Request for Comments) 1950 to 1952 in the files
|
||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
||||
rfc1952 (gzip format).
|
||||
|
||||
All functions of the compression library are documented in the file zlib.h
|
||||
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
|
||||
of the library is given in the file test/example.c which also tests that
|
||||
the library is working correctly. Another example is given in the file
|
||||
test/minigzip.c. The compression library itself is composed of all source
|
||||
files in the root directory.
|
||||
|
||||
To compile all files and run the test program, follow the instructions given at
|
||||
the top of Makefile.in. In short "./configure; make test", and if that goes
|
||||
well, "make install" should work for most flavors of Unix. For Windows, use
|
||||
one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
|
||||
make_vms.com.
|
||||
|
||||
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
|
||||
<info@winimage.com> for the Windows DLL version. The zlib home page is
|
||||
http://zlib.net/ . Before reporting a problem, please check this site to
|
||||
verify that you have the latest version of zlib; otherwise get the latest
|
||||
version and check whether the problem still exists or not.
|
||||
|
||||
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
|
||||
|
||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
||||
|
||||
The changes made in version 1.2.8 are documented in the file ChangeLog.
|
||||
|
||||
Unsupported third party contributions are provided in directory contrib/ .
|
||||
|
||||
zlib is available in Java using the java.util.zip package, documented at
|
||||
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
|
||||
|
||||
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
|
||||
at CPAN (Comprehensive Perl Archive Network) sites, including
|
||||
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
|
||||
|
||||
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
||||
available in Python 1.5 and later versions, see
|
||||
http://docs.python.org/library/zlib.html .
|
||||
|
||||
zlib is built into tcl: http://wiki.tcl.tk/4610 .
|
||||
|
||||
An experimental package to read and write files in .zip format, written on top
|
||||
of zlib by Gilles Vollant <info@winimage.com>, is available in the
|
||||
contrib/minizip directory of zlib.
|
||||
|
||||
|
||||
Notes for some targets:
|
||||
|
||||
- For Windows DLL versions, please see win32/DLL_FAQ.txt
|
||||
|
||||
- For 64-bit Irix, deflate.c must be compiled without any optimization. With
|
||||
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
|
||||
compiler flag). The compiler bug has been reported to SGI.
|
||||
|
||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
||||
when compiled with cc.
|
||||
|
||||
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
|
||||
necessary to get gzprintf working correctly. This is done by configure.
|
||||
|
||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
||||
other compilers. Use "make test" to check your compiler.
|
||||
|
||||
- gzdopen is not supported on RISCOS or BEOS.
|
||||
|
||||
- For PalmOs, see http://palmzlib.sourceforge.net/
|
||||
|
||||
|
||||
Acknowledgments:
|
||||
|
||||
The deflate format used by zlib was defined by Phil Katz. The deflate and
|
||||
zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
||||
people who reported problems and suggested various improvements in zlib; they
|
||||
are too numerous to cite here.
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
If you use the zlib library in a product, we would appreciate *not* receiving
|
||||
lengthy legal documents to sign. The sources are provided for free but without
|
||||
warranty of any kind. The library has been entirely written by Jean-loup
|
||||
Gailly and Mark Adler; it does not include third-party code.
|
||||
|
||||
If you redistribute modified sources, we would appreciate that you include in
|
||||
the file ChangeLog history information documenting your changes. Please read
|
||||
the FAQ for more information on the distribution of modified source versions.
|
179
software/scsi2sd-util/zlib-1.2.8/adler32.c
Normal file
179
software/scsi2sd-util/zlib-1.2.8/adler32.c
Normal file
@ -0,0 +1,179 @@
|
||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
||||
* Copyright (C) 1995-2011 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#include "zutil.h"
|
||||
|
||||
#define local static
|
||||
|
||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
||||
|
||||
#define BASE 65521 /* largest prime smaller than 65536 */
|
||||
#define NMAX 5552
|
||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||
|
||||
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
|
||||
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
|
||||
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
|
||||
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
||||
#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
||||
|
||||
/* use NO_DIVIDE if your processor does not do division in hardware --
|
||||
try it both ways to see which is faster */
|
||||
#ifdef NO_DIVIDE
|
||||
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
|
||||
(thank you to John Reiser for pointing this out) */
|
||||
# define CHOP(a) \
|
||||
do { \
|
||||
unsigned long tmp = a >> 16; \
|
||||
a &= 0xffffUL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
} while (0)
|
||||
# define MOD28(a) \
|
||||
do { \
|
||||
CHOP(a); \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
# define MOD(a) \
|
||||
do { \
|
||||
CHOP(a); \
|
||||
MOD28(a); \
|
||||
} while (0)
|
||||
# define MOD63(a) \
|
||||
do { /* this assumes a is not negative */ \
|
||||
z_off64_t tmp = a >> 32; \
|
||||
a &= 0xffffffffL; \
|
||||
a += (tmp << 8) - (tmp << 5) + tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
#else
|
||||
# define MOD(a) a %= BASE
|
||||
# define MOD28(a) a %= BASE
|
||||
# define MOD63(a) a %= BASE
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
uLong ZEXPORT adler32(adler, buf, len)
|
||||
uLong adler;
|
||||
const Bytef *buf;
|
||||
uInt len;
|
||||
{
|
||||
unsigned long sum2;
|
||||
unsigned n;
|
||||
|
||||
/* split Adler-32 into component sums */
|
||||
sum2 = (adler >> 16) & 0xffff;
|
||||
adler &= 0xffff;
|
||||
|
||||
/* in case user likes doing a byte at a time, keep it fast */
|
||||
if (len == 1) {
|
||||
adler += buf[0];
|
||||
if (adler >= BASE)
|
||||
adler -= BASE;
|
||||
sum2 += adler;
|
||||
if (sum2 >= BASE)
|
||||
sum2 -= BASE;
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* initial Adler-32 value (deferred check for len == 1 speed) */
|
||||
if (buf == Z_NULL)
|
||||
return 1L;
|
||||
|
||||
/* in case short lengths are provided, keep it somewhat fast */
|
||||
if (len < 16) {
|
||||
while (len--) {
|
||||
adler += *buf++;
|
||||
sum2 += adler;
|
||||
}
|
||||
if (adler >= BASE)
|
||||
adler -= BASE;
|
||||
MOD28(sum2); /* only added so many BASE's */
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* do length NMAX blocks -- requires just one modulo operation */
|
||||
while (len >= NMAX) {
|
||||
len -= NMAX;
|
||||
n = NMAX / 16; /* NMAX is divisible by 16 */
|
||||
do {
|
||||
DO16(buf); /* 16 sums unrolled */
|
||||
buf += 16;
|
||||
} while (--n);
|
||||
MOD(adler);
|
||||
MOD(sum2);
|
||||
}
|
||||
|
||||
/* do remaining bytes (less than NMAX, still just one modulo) */
|
||||
if (len) { /* avoid modulos if none remaining */
|
||||
while (len >= 16) {
|
||||
len -= 16;
|
||||
DO16(buf);
|
||||
buf += 16;
|
||||
}
|
||||
while (len--) {
|
||||
adler += *buf++;
|
||||
sum2 += adler;
|
||||
}
|
||||
MOD(adler);
|
||||
MOD(sum2);
|
||||
}
|
||||
|
||||
/* return recombined sums */
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
local uLong adler32_combine_(adler1, adler2, len2)
|
||||
uLong adler1;
|
||||
uLong adler2;
|
||||
z_off64_t len2;
|
||||
{
|
||||
unsigned long sum1;
|
||||
unsigned long sum2;
|
||||
unsigned rem;
|
||||
|
||||
/* for negative len, return invalid adler32 as a clue for debugging */
|
||||
if (len2 < 0)
|
||||
return 0xffffffffUL;
|
||||
|
||||
/* the derivation of this formula is left as an exercise for the reader */
|
||||
MOD63(len2); /* assumes len2 >= 0 */
|
||||
rem = (unsigned)len2;
|
||||
sum1 = adler1 & 0xffff;
|
||||
sum2 = rem * sum1;
|
||||
MOD(sum2);
|
||||
sum1 += (adler2 & 0xffff) + BASE - 1;
|
||||
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
||||
if (sum1 >= BASE) sum1 -= BASE;
|
||||
if (sum1 >= BASE) sum1 -= BASE;
|
||||
if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
|
||||
if (sum2 >= BASE) sum2 -= BASE;
|
||||
return sum1 | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
||||
uLong adler1;
|
||||
uLong adler2;
|
||||
z_off_t len2;
|
||||
{
|
||||
return adler32_combine_(adler1, adler2, len2);
|
||||
}
|
||||
|
||||
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
||||
uLong adler1;
|
||||
uLong adler2;
|
||||
z_off64_t len2;
|
||||
{
|
||||
return adler32_combine_(adler1, adler2, len2);
|
||||
}
|
69
software/scsi2sd-util/zlib-1.2.8/amiga/Makefile.pup
Normal file
69
software/scsi2sd-util/zlib-1.2.8/amiga/Makefile.pup
Normal file
@ -0,0 +1,69 @@
|
||||
# Amiga powerUP (TM) Makefile
|
||||
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
|
||||
# Copyright (C) 1998 by Andreas R. Kleinert
|
||||
|
||||
LIBNAME = libzip.a
|
||||
|
||||
CC = scppc
|
||||
CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
|
||||
OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER
|
||||
AR = ppc-amigaos-ar cr
|
||||
RANLIB = ppc-amigaos-ranlib
|
||||
LD = ppc-amigaos-ld -r
|
||||
LDFLAGS = -o
|
||||
LDLIBS = LIB:scppc.a LIB:end.o
|
||||
RM = delete quiet
|
||||
|
||||
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
|
||||
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
|
||||
|
||||
TEST_OBJS = example.o minigzip.o
|
||||
|
||||
all: example minigzip
|
||||
|
||||
check: test
|
||||
test: all
|
||||
example
|
||||
echo hello world | minigzip | minigzip -d
|
||||
|
||||
$(LIBNAME): $(OBJS)
|
||||
$(AR) $@ $(OBJS)
|
||||
-$(RANLIB) $@
|
||||
|
||||
example: example.o $(LIBNAME)
|
||||
$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
|
||||
|
||||
minigzip: minigzip.o $(LIBNAME)
|
||||
$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
|
||||
|
||||
mostlyclean: clean
|
||||
clean:
|
||||
$(RM) *.o example minigzip $(LIBNAME) foo.gz
|
||||
|
||||
zip:
|
||||
zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
|
||||
descrip.mms *.[ch]
|
||||
|
||||
tgz:
|
||||
cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
|
||||
zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
adler32.o: zlib.h zconf.h
|
||||
compress.o: zlib.h zconf.h
|
||||
crc32.o: crc32.h zlib.h zconf.h
|
||||
deflate.o: deflate.h zutil.h zlib.h zconf.h
|
||||
example.o: zlib.h zconf.h
|
||||
gzclose.o: zlib.h zconf.h gzguts.h
|
||||
gzlib.o: zlib.h zconf.h gzguts.h
|
||||
gzread.o: zlib.h zconf.h gzguts.h
|
||||
gzwrite.o: zlib.h zconf.h gzguts.h
|
||||
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
|
||||
minigzip.o: zlib.h zconf.h
|
||||
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
|
||||
uncompr.o: zlib.h zconf.h
|
||||
zutil.o: zutil.h zlib.h zconf.h
|
68
software/scsi2sd-util/zlib-1.2.8/amiga/Makefile.sas
Normal file
68
software/scsi2sd-util/zlib-1.2.8/amiga/Makefile.sas
Normal file
@ -0,0 +1,68 @@
|
||||
# SMakefile for zlib
|
||||
# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly
|
||||
# Osma Ahvenlampi <Osma.Ahvenlampi@hut.fi>
|
||||
# Amiga, SAS/C 6.56 & Smake
|
||||
|
||||
CC=sc
|
||||
CFLAGS=OPT
|
||||
#CFLAGS=OPT CPU=68030
|
||||
#CFLAGS=DEBUG=LINE
|
||||
LDFLAGS=LIB z.lib
|
||||
|
||||
SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
|
||||
NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
|
||||
DEF=POSTINC
|
||||
|
||||
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
|
||||
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
|
||||
|
||||
TEST_OBJS = example.o minigzip.o
|
||||
|
||||
all: SCOPTIONS example minigzip
|
||||
|
||||
check: test
|
||||
test: all
|
||||
example
|
||||
echo hello world | minigzip | minigzip -d
|
||||
|
||||
install: z.lib
|
||||
copy clone zlib.h zconf.h INCLUDE:
|
||||
copy clone z.lib LIB:
|
||||
|
||||
z.lib: $(OBJS)
|
||||
oml z.lib r $(OBJS)
|
||||
|
||||
example: example.o z.lib
|
||||
$(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS)
|
||||
|
||||
minigzip: minigzip.o z.lib
|
||||
$(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
|
||||
|
||||
mostlyclean: clean
|
||||
clean:
|
||||
-delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS
|
||||
|
||||
SCOPTIONS: Makefile.sas
|
||||
copy to $@ <from <
|
||||
$(SCOPTIONS)
|
||||
<
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
adler32.o: zlib.h zconf.h
|
||||
compress.o: zlib.h zconf.h
|
||||
crc32.o: crc32.h zlib.h zconf.h
|
||||
deflate.o: deflate.h zutil.h zlib.h zconf.h
|
||||
example.o: zlib.h zconf.h
|
||||
gzclose.o: zlib.h zconf.h gzguts.h
|
||||
gzlib.o: zlib.h zconf.h gzguts.h
|
||||
gzread.o: zlib.h zconf.h gzguts.h
|
||||
gzwrite.o: zlib.h zconf.h gzguts.h
|
||||
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
|
||||
minigzip.o: zlib.h zconf.h
|
||||
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
|
||||
uncompr.o: zlib.h zconf.h
|
||||
zutil.o: zutil.h zlib.h zconf.h
|
215
software/scsi2sd-util/zlib-1.2.8/as400/bndsrc
Normal file
215
software/scsi2sd-util/zlib-1.2.8/as400/bndsrc
Normal file
@ -0,0 +1,215 @@
|
||||
STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
|
||||
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
/* Version 1.1.3 entry points. */
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE ADLER32 ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("adler32")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("compress")
|
||||
EXPORT SYMBOL("compress2")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE CRC32 ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("crc32")
|
||||
EXPORT SYMBOL("get_crc_table")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("deflate")
|
||||
EXPORT SYMBOL("deflateEnd")
|
||||
EXPORT SYMBOL("deflateSetDictionary")
|
||||
EXPORT SYMBOL("deflateCopy")
|
||||
EXPORT SYMBOL("deflateReset")
|
||||
EXPORT SYMBOL("deflateParams")
|
||||
EXPORT SYMBOL("deflatePrime")
|
||||
EXPORT SYMBOL("deflateInit_")
|
||||
EXPORT SYMBOL("deflateInit2_")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZIO ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzopen")
|
||||
EXPORT SYMBOL("gzdopen")
|
||||
EXPORT SYMBOL("gzsetparams")
|
||||
EXPORT SYMBOL("gzread")
|
||||
EXPORT SYMBOL("gzwrite")
|
||||
EXPORT SYMBOL("gzprintf")
|
||||
EXPORT SYMBOL("gzputs")
|
||||
EXPORT SYMBOL("gzgets")
|
||||
EXPORT SYMBOL("gzputc")
|
||||
EXPORT SYMBOL("gzgetc")
|
||||
EXPORT SYMBOL("gzflush")
|
||||
EXPORT SYMBOL("gzseek")
|
||||
EXPORT SYMBOL("gzrewind")
|
||||
EXPORT SYMBOL("gztell")
|
||||
EXPORT SYMBOL("gzeof")
|
||||
EXPORT SYMBOL("gzclose")
|
||||
EXPORT SYMBOL("gzerror")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("inflate")
|
||||
EXPORT SYMBOL("inflateEnd")
|
||||
EXPORT SYMBOL("inflateSetDictionary")
|
||||
EXPORT SYMBOL("inflateSync")
|
||||
EXPORT SYMBOL("inflateReset")
|
||||
EXPORT SYMBOL("inflateInit_")
|
||||
EXPORT SYMBOL("inflateInit2_")
|
||||
EXPORT SYMBOL("inflateSyncPoint")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE UNCOMPR ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("uncompress")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("zlibVersion")
|
||||
EXPORT SYMBOL("zError")
|
||||
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
/* Version 1.2.1 additional entry points. */
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("compressBound")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("deflateBound")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZIO ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzungetc")
|
||||
EXPORT SYMBOL("gzclearerr")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE INFBACK ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("inflateBack")
|
||||
EXPORT SYMBOL("inflateBackEnd")
|
||||
EXPORT SYMBOL("inflateBackInit_")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("inflateCopy")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("zlibCompileFlags")
|
||||
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
/* Version 1.2.5 additional entry points. */
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE ADLER32 ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("adler32_combine")
|
||||
EXPORT SYMBOL("adler32_combine64")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE CRC32 ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("crc32_combine")
|
||||
EXPORT SYMBOL("crc32_combine64")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZLIB ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzbuffer")
|
||||
EXPORT SYMBOL("gzoffset")
|
||||
EXPORT SYMBOL("gzoffset64")
|
||||
EXPORT SYMBOL("gzopen64")
|
||||
EXPORT SYMBOL("gzseek64")
|
||||
EXPORT SYMBOL("gztell64")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZREAD ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzclose_r")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZWRITE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzclose_w")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("inflateMark")
|
||||
EXPORT SYMBOL("inflatePrime")
|
||||
EXPORT SYMBOL("inflateReset2")
|
||||
EXPORT SYMBOL("inflateUndermine")
|
||||
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
/* Version 1.2.6 additional entry points. */
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("deflateResetKeep")
|
||||
EXPORT SYMBOL("deflatePending")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZWRITE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzgetc_")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("inflateResetKeep")
|
||||
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
/* Version 1.2.8 additional entry points. */
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("inflateGetDictionary")
|
||||
|
||||
ENDPGMEXP
|
110
software/scsi2sd-util/zlib-1.2.8/as400/compile.clp
Normal file
110
software/scsi2sd-util/zlib-1.2.8/as400/compile.clp
Normal file
@ -0,0 +1,110 @@
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* ZLIB */
|
||||
/* */
|
||||
/* Compile sources into modules and link them into a service program. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
PGM
|
||||
|
||||
/* Configuration adjustable parameters. */
|
||||
|
||||
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('ZLIB') /* Source library. */
|
||||
DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('SOURCES') /* Source member file. */
|
||||
DCL VAR(&CTLFILE) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('TOOLS') /* Control member file. */
|
||||
|
||||
DCL VAR(&MODLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('ZLIB') /* Module library. */
|
||||
|
||||
DCL VAR(&SRVLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('LGPL') /* Service program library. */
|
||||
|
||||
DCL VAR(&CFLAGS) TYPE(*CHAR) +
|
||||
VALUE('OPTIMIZE(40)') /* Compile options. */
|
||||
|
||||
DCL VAR(&TGTRLS) TYPE(*CHAR) +
|
||||
VALUE('V5R3M0') /* Target release. */
|
||||
|
||||
|
||||
/* Working storage. */
|
||||
|
||||
DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300) /* Command length. */
|
||||
DCL VAR(&CMD) TYPE(*CHAR) LEN(512)
|
||||
DCL VAR(&FIXDCMD) TYPE(*CHAR) LEN(512)
|
||||
|
||||
|
||||
/* Compile sources into modules. */
|
||||
|
||||
CHGVAR VAR(&FIXDCMD) VALUE('CRTCMOD' *BCAT &CFLAGS *BCAT +
|
||||
'SYSIFCOPT(*IFS64IO)' *BCAT +
|
||||
'DEFINE(''_LARGEFILE64_SOURCE''' *BCAT +
|
||||
'''_LFS64_LARGEFILE=1'') TGTRLS(' *TCAT &TGTRLS *TCAT +
|
||||
') SRCFILE(' *TCAT &SRCLIB *TCAT '/' *TCAT +
|
||||
&SRCFILE *TCAT ') MODULE(' *TCAT &MODLIB *TCAT '/')
|
||||
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ADLER32)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'COMPRESS)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'CRC32)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'DEFLATE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZCLOSE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZLIB)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZREAD)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZWRITE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFBACK)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFFAST)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFLATE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFTREES)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'TREES)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'UNCOMPR)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ZUTIL)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
|
||||
/* Link modules into a service program. */
|
||||
|
||||
CRTSRVPGM SRVPGM(&SRVLIB/ZLIB) +
|
||||
MODULE(&MODLIB/ADLER32 &MODLIB/COMPRESS +
|
||||
&MODLIB/CRC32 &MODLIB/DEFLATE +
|
||||
&MODLIB/GZCLOSE &MODLIB/GZLIB +
|
||||
&MODLIB/GZREAD &MODLIB/GZWRITE +
|
||||
&MODLIB/INFBACK &MODLIB/INFFAST +
|
||||
&MODLIB/INFLATE &MODLIB/INFTREES +
|
||||
&MODLIB/TREES &MODLIB/UNCOMPR +
|
||||
&MODLIB/ZUTIL) +
|
||||
SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
|
||||
TEXT('ZLIB 1.2.8') TGTRLS(&TGTRLS)
|
||||
|
||||
ENDPGM
|
115
software/scsi2sd-util/zlib-1.2.8/as400/readme.txt
Normal file
115
software/scsi2sd-util/zlib-1.2.8/as400/readme.txt
Normal file
@ -0,0 +1,115 @@
|
||||
ZLIB version 1.2.8 for AS400 installation instructions
|
||||
|
||||
I) From an AS400 *SAVF file:
|
||||
|
||||
1) Unpacking archive to an AS400 save file
|
||||
|
||||
On the AS400:
|
||||
|
||||
_ Create the ZLIB AS400 library:
|
||||
|
||||
CRTLIB LIB(ZLIB) TYPE(*PROD) TEXT('ZLIB compression API library')
|
||||
|
||||
_ Create a work save file, for example:
|
||||
|
||||
CRTSAVF FILE(ZLIB/ZLIBSAVF)
|
||||
|
||||
On a PC connected to the target AS400:
|
||||
|
||||
_ Unpack the save file image to a PC file "ZLIBSAVF"
|
||||
_ Upload this file into the save file on the AS400, for example
|
||||
using ftp in BINARY mode.
|
||||
|
||||
|
||||
2) Populating the ZLIB AS400 source library
|
||||
|
||||
On the AS400:
|
||||
|
||||
_ Extract the saved objects into the ZLIB AS400 library using:
|
||||
|
||||
RSTOBJ OBJ(*ALL) SAVLIB(ZLIB) DEV(*SAVF) SAVF(ZLIB/ZLIBSAVF) RSTLIB(ZLIB)
|
||||
|
||||
|
||||
3) Customize installation:
|
||||
|
||||
_ Edit CL member ZLIB/TOOLS(COMPILE) and change parameters if needed,
|
||||
according to the comments.
|
||||
|
||||
_ Compile this member with:
|
||||
|
||||
CRTCLPGM PGM(ZLIB/COMPILE) SRCFILE(ZLIB/TOOLS) SRCMBR(COMPILE)
|
||||
|
||||
|
||||
4) Compile and generate the service program:
|
||||
|
||||
_ This can now be done by executing:
|
||||
|
||||
CALL PGM(ZLIB/COMPILE)
|
||||
|
||||
|
||||
|
||||
II) From the original source distribution:
|
||||
|
||||
1) On the AS400, create the source library:
|
||||
|
||||
CRTLIB LIB(ZLIB) TYPE(*PROD) TEXT('ZLIB compression API library')
|
||||
|
||||
2) Create the source files:
|
||||
|
||||
CRTSRCPF FILE(ZLIB/SOURCES) RCDLEN(112) TEXT('ZLIB library modules')
|
||||
CRTSRCPF FILE(ZLIB/H) RCDLEN(112) TEXT('ZLIB library includes')
|
||||
CRTSRCPF FILE(ZLIB/TOOLS) RCDLEN(112) TEXT('ZLIB library control utilities')
|
||||
|
||||
3) From the machine hosting the distribution files, upload them (with
|
||||
FTP in text mode, for example) according to the following table:
|
||||
|
||||
Original AS400 AS400 AS400 AS400
|
||||
file file member type description
|
||||
SOURCES Original ZLIB C subprogram sources
|
||||
adler32.c ADLER32 C ZLIB - Compute the Adler-32 checksum of a dta strm
|
||||
compress.c COMPRESS C ZLIB - Compress a memory buffer
|
||||
crc32.c CRC32 C ZLIB - Compute the CRC-32 of a data stream
|
||||
deflate.c DEFLATE C ZLIB - Compress data using the deflation algorithm
|
||||
gzclose.c GZCLOSE C ZLIB - Close .gz files
|
||||
gzlib.c GZLIB C ZLIB - Miscellaneous .gz files IO support
|
||||
gzread.c GZREAD C ZLIB - Read .gz files
|
||||
gzwrite.c GZWRITE C ZLIB - Write .gz files
|
||||
infback.c INFBACK C ZLIB - Inflate using a callback interface
|
||||
inffast.c INFFAST C ZLIB - Fast proc. literals & length/distance pairs
|
||||
inflate.c INFLATE C ZLIB - Interface to inflate modules
|
||||
inftrees.c INFTREES C ZLIB - Generate Huffman trees for efficient decode
|
||||
trees.c TREES C ZLIB - Output deflated data using Huffman coding
|
||||
uncompr.c UNCOMPR C ZLIB - Decompress a memory buffer
|
||||
zutil.c ZUTIL C ZLIB - Target dependent utility functions
|
||||
H Original ZLIB C and ILE/RPG include files
|
||||
crc32.h CRC32 C ZLIB - CRC32 tables
|
||||
deflate.h DEFLATE C ZLIB - Internal compression state
|
||||
gzguts.h GZGUTS C ZLIB - Definitions for the gzclose module
|
||||
inffast.h INFFAST C ZLIB - Header to use inffast.c
|
||||
inffixed.h INFFIXED C ZLIB - Table for decoding fixed codes
|
||||
inflate.h INFLATE C ZLIB - Internal inflate state definitions
|
||||
inftrees.h INFTREES C ZLIB - Header to use inftrees.c
|
||||
trees.h TREES C ZLIB - Created automatically with -DGEN_TREES_H
|
||||
zconf.h ZCONF C ZLIB - Compression library configuration
|
||||
zlib.h ZLIB C ZLIB - Compression library C user interface
|
||||
as400/zlib.inc ZLIB.INC RPGLE ZLIB - Compression library ILE RPG user interface
|
||||
zutil.h ZUTIL C ZLIB - Internal interface and configuration
|
||||
TOOLS Building source software & AS/400 README
|
||||
as400/bndsrc BNDSRC Entry point exportation list
|
||||
as400/compile.clp COMPILE CLP Compile sources & generate service program
|
||||
as400/readme.txt README TXT Installation instructions
|
||||
|
||||
4) Continue as in I)3).
|
||||
|
||||
|
||||
|
||||
|
||||
Notes: For AS400 ILE RPG programmers, a /copy member defining the ZLIB
|
||||
API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC).
|
||||
Please read comments in this member for more information.
|
||||
|
||||
Remember that most foreign textual data are ASCII coded: this
|
||||
implementation does not handle conversion from/to ASCII, so
|
||||
text data code conversions must be done explicitely.
|
||||
|
||||
Mainly for the reason above, always open zipped files in binary mode.
|
451
software/scsi2sd-util/zlib-1.2.8/as400/zlib.inc
Normal file
451
software/scsi2sd-util/zlib-1.2.8/as400/zlib.inc
Normal file
@ -0,0 +1,451 @@
|
||||
* ZLIB.INC - Interface to the general purpose compression library
|
||||
*
|
||||
* ILE RPG400 version by Patrick Monnerat, DATASPHERE.
|
||||
* Version 1.2.8
|
||||
*
|
||||
*
|
||||
* WARNING:
|
||||
* Procedures inflateInit(), inflateInit2(), deflateInit(),
|
||||
* deflateInit2() and inflateBackInit() need to be called with
|
||||
* two additional arguments:
|
||||
* the package version string and the stream control structure.
|
||||
* size. This is needed because RPG lacks some macro feature.
|
||||
* Call these procedures as:
|
||||
* inflateInit(...: ZLIB_VERSION: %size(z_stream))
|
||||
*
|
||||
/if not defined(ZLIB_H_)
|
||||
/define ZLIB_H_
|
||||
*
|
||||
**************************************************************************
|
||||
* Constants
|
||||
**************************************************************************
|
||||
*
|
||||
* Versioning information.
|
||||
*
|
||||
D ZLIB_VERSION C '1.2.8'
|
||||
D ZLIB_VERNUM C X'1280'
|
||||
D ZLIB_VER_MAJOR C 1
|
||||
D ZLIB_VER_MINOR C 2
|
||||
D ZLIB_VER_REVISION...
|
||||
D C 8
|
||||
D ZLIB_VER_SUBREVISION...
|
||||
D C 0
|
||||
*
|
||||
* Other equates.
|
||||
*
|
||||
D Z_NO_FLUSH C 0
|
||||
D Z_PARTIAL_FLUSH...
|
||||
D C 1
|
||||
D Z_SYNC_FLUSH C 2
|
||||
D Z_FULL_FLUSH C 3
|
||||
D Z_FINISH C 4
|
||||
D Z_BLOCK C 5
|
||||
D Z_TREES C 6
|
||||
*
|
||||
D Z_OK C 0
|
||||
D Z_STREAM_END C 1
|
||||
D Z_NEED_DICT C 2
|
||||
D Z_ERRNO C -1
|
||||
D Z_STREAM_ERROR C -2
|
||||
D Z_DATA_ERROR C -3
|
||||
D Z_MEM_ERROR C -4
|
||||
D Z_BUF_ERROR C -5
|
||||
DZ_VERSION_ERROR C -6
|
||||
*
|
||||
D Z_NO_COMPRESSION...
|
||||
D C 0
|
||||
D Z_BEST_SPEED C 1
|
||||
D Z_BEST_COMPRESSION...
|
||||
D C 9
|
||||
D Z_DEFAULT_COMPRESSION...
|
||||
D C -1
|
||||
*
|
||||
D Z_FILTERED C 1
|
||||
D Z_HUFFMAN_ONLY C 2
|
||||
D Z_RLE C 3
|
||||
D Z_DEFAULT_STRATEGY...
|
||||
D C 0
|
||||
*
|
||||
D Z_BINARY C 0
|
||||
D Z_ASCII C 1
|
||||
D Z_UNKNOWN C 2
|
||||
*
|
||||
D Z_DEFLATED C 8
|
||||
*
|
||||
D Z_NULL C 0
|
||||
*
|
||||
**************************************************************************
|
||||
* Types
|
||||
**************************************************************************
|
||||
*
|
||||
D z_streamp S * Stream struct ptr
|
||||
D gzFile S * File pointer
|
||||
D z_off_t S 10i 0 Stream offsets
|
||||
D z_off64_t S 20i 0 Stream offsets
|
||||
*
|
||||
**************************************************************************
|
||||
* Structures
|
||||
**************************************************************************
|
||||
*
|
||||
* The GZIP encode/decode stream support structure.
|
||||
*
|
||||
D z_stream DS align based(z_streamp)
|
||||
D zs_next_in * Next input byte
|
||||
D zs_avail_in 10U 0 Byte cnt at next_in
|
||||
D zs_total_in 10U 0 Total bytes read
|
||||
D zs_next_out * Output buffer ptr
|
||||
D zs_avail_out 10U 0 Room left @ next_out
|
||||
D zs_total_out 10U 0 Total bytes written
|
||||
D zs_msg * Last errmsg or null
|
||||
D zs_state * Internal state
|
||||
D zs_zalloc * procptr Int. state allocator
|
||||
D zs_free * procptr Int. state dealloc.
|
||||
D zs_opaque * Private alloc. data
|
||||
D zs_data_type 10i 0 ASC/BIN best guess
|
||||
D zs_adler 10u 0 Uncompr. adler32 val
|
||||
D 10U 0 Reserved
|
||||
D 10U 0 Ptr. alignment
|
||||
*
|
||||
**************************************************************************
|
||||
* Utility function prototypes
|
||||
**************************************************************************
|
||||
*
|
||||
D compress PR 10I 0 extproc('compress')
|
||||
D dest 65535 options(*varsize) Destination buffer
|
||||
D destLen 10U 0 Destination length
|
||||
D source 65535 const options(*varsize) Source buffer
|
||||
D sourceLen 10u 0 value Source length
|
||||
*
|
||||
D compress2 PR 10I 0 extproc('compress2')
|
||||
D dest 65535 options(*varsize) Destination buffer
|
||||
D destLen 10U 0 Destination length
|
||||
D source 65535 const options(*varsize) Source buffer
|
||||
D sourceLen 10U 0 value Source length
|
||||
D level 10I 0 value Compression level
|
||||
*
|
||||
D compressBound PR 10U 0 extproc('compressBound')
|
||||
D sourceLen 10U 0 value
|
||||
*
|
||||
D uncompress PR 10I 0 extproc('uncompress')
|
||||
D dest 65535 options(*varsize) Destination buffer
|
||||
D destLen 10U 0 Destination length
|
||||
D source 65535 const options(*varsize) Source buffer
|
||||
D sourceLen 10U 0 value Source length
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gzopen PR extproc('gzopen')
|
||||
D like(gzFile)
|
||||
D path * value options(*string) File pathname
|
||||
D mode * value options(*string) Open mode
|
||||
/else
|
||||
D gzopen PR extproc('gzopen64')
|
||||
D like(gzFile)
|
||||
D path * value options(*string) File pathname
|
||||
D mode * value options(*string) Open mode
|
||||
*
|
||||
D gzopen64 PR extproc('gzopen64')
|
||||
D like(gzFile)
|
||||
D path * value options(*string) File pathname
|
||||
D mode * value options(*string) Open mode
|
||||
/endif
|
||||
*
|
||||
D gzdopen PR extproc('gzdopen')
|
||||
D like(gzFile)
|
||||
D fd 10I 0 value File descriptor
|
||||
D mode * value options(*string) Open mode
|
||||
*
|
||||
D gzbuffer PR 10I 0 extproc('gzbuffer')
|
||||
D file value like(gzFile) File pointer
|
||||
D size 10U 0 value
|
||||
*
|
||||
D gzsetparams PR 10I 0 extproc('gzsetparams')
|
||||
D file value like(gzFile) File pointer
|
||||
D level 10I 0 value
|
||||
D strategy 10I 0 value
|
||||
*
|
||||
D gzread PR 10I 0 extproc('gzread')
|
||||
D file value like(gzFile) File pointer
|
||||
D buf 65535 options(*varsize) Buffer
|
||||
D len 10u 0 value Buffer length
|
||||
*
|
||||
D gzwrite PR 10I 0 extproc('gzwrite')
|
||||
D file value like(gzFile) File pointer
|
||||
D buf 65535 const options(*varsize) Buffer
|
||||
D len 10u 0 value Buffer length
|
||||
*
|
||||
D gzputs PR 10I 0 extproc('gzputs')
|
||||
D file value like(gzFile) File pointer
|
||||
D s * value options(*string) String to output
|
||||
*
|
||||
D gzgets PR * extproc('gzgets')
|
||||
D file value like(gzFile) File pointer
|
||||
D buf 65535 options(*varsize) Read buffer
|
||||
D len 10i 0 value Buffer length
|
||||
*
|
||||
D gzputc PR 10i 0 extproc('gzputc')
|
||||
D file value like(gzFile) File pointer
|
||||
D c 10I 0 value Character to write
|
||||
*
|
||||
D gzgetc PR 10i 0 extproc('gzgetc')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzgetc_ PR 10i 0 extproc('gzgetc_')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzungetc PR 10i 0 extproc('gzungetc')
|
||||
D c 10I 0 value Character to push
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzflush PR 10i 0 extproc('gzflush')
|
||||
D file value like(gzFile) File pointer
|
||||
D flush 10I 0 value Type of flush
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gzseek PR extproc('gzseek')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
D offset value like(z_off_t) Offset
|
||||
D whence 10i 0 value Origin
|
||||
/else
|
||||
D gzseek PR extproc('gzseek64')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
D offset value like(z_off_t) Offset
|
||||
D whence 10i 0 value Origin
|
||||
*
|
||||
D gzseek64 PR extproc('gzseek64')
|
||||
D like(z_off64_t)
|
||||
D file value like(gzFile) File pointer
|
||||
D offset value like(z_off64_t) Offset
|
||||
D whence 10i 0 value Origin
|
||||
/endif
|
||||
*
|
||||
D gzrewind PR 10i 0 extproc('gzrewind')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gztell PR extproc('gztell')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/else
|
||||
D gztell PR extproc('gztell64')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gztell64 PR extproc('gztell64')
|
||||
D like(z_off64_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/endif
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gzoffset PR extproc('gzoffset')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/else
|
||||
D gzoffset PR extproc('gzoffset64')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzoffset64 PR extproc('gzoffset64')
|
||||
D like(z_off64_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/endif
|
||||
*
|
||||
D gzeof PR 10i 0 extproc('gzeof')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzclose_r PR 10i 0 extproc('gzclose_r')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzclose_w PR 10i 0 extproc('gzclose_w')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzclose PR 10i 0 extproc('gzclose')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzerror PR * extproc('gzerror') Error string
|
||||
D file value like(gzFile) File pointer
|
||||
D errnum 10I 0 Error code
|
||||
*
|
||||
D gzclearerr PR extproc('gzclearerr')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
**************************************************************************
|
||||
* Basic function prototypes
|
||||
**************************************************************************
|
||||
*
|
||||
D zlibVersion PR * extproc('zlibVersion') Version string
|
||||
*
|
||||
D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression
|
||||
D strm like(z_stream) Compression stream
|
||||
D level 10I 0 value Compression level
|
||||
D version * value options(*string) Version string
|
||||
D stream_size 10i 0 value Stream struct. size
|
||||
*
|
||||
D deflate PR 10I 0 extproc('deflate') Compress data
|
||||
D strm like(z_stream) Compression stream
|
||||
D flush 10I 0 value Flush type required
|
||||
*
|
||||
D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression
|
||||
D strm like(z_stream) Compression stream
|
||||
*
|
||||
D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion
|
||||
D strm like(z_stream) Expansion stream
|
||||
D version * value options(*string) Version string
|
||||
D stream_size 10i 0 value Stream struct. size
|
||||
*
|
||||
D inflate PR 10I 0 extproc('inflate') Expand data
|
||||
D strm like(z_stream) Expansion stream
|
||||
D flush 10I 0 value Flush type required
|
||||
*
|
||||
D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
**************************************************************************
|
||||
* Advanced function prototypes
|
||||
**************************************************************************
|
||||
*
|
||||
D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression
|
||||
D strm like(z_stream) Compression stream
|
||||
D level 10I 0 value Compression level
|
||||
D method 10I 0 value Compression method
|
||||
D windowBits 10I 0 value log2(window size)
|
||||
D memLevel 10I 0 value Mem/cmpress tradeoff
|
||||
D strategy 10I 0 value Compression stategy
|
||||
D version * value options(*string) Version string
|
||||
D stream_size 10i 0 value Stream struct. size
|
||||
*
|
||||
D deflateSetDictionary...
|
||||
D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary
|
||||
D strm like(z_stream) Compression stream
|
||||
D dictionary 65535 const options(*varsize) Dictionary bytes
|
||||
D dictLength 10U 0 value Dictionary length
|
||||
*
|
||||
D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm
|
||||
D dest like(z_stream) Destination stream
|
||||
D source like(z_stream) Source stream
|
||||
*
|
||||
D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream
|
||||
D strm like(z_stream) Compression stream
|
||||
*
|
||||
D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat
|
||||
D strm like(z_stream) Compression stream
|
||||
D level 10I 0 value Compression level
|
||||
D strategy 10I 0 value Compression stategy
|
||||
*
|
||||
D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat
|
||||
D strm like(z_stream) Compression stream
|
||||
D sourcelen 10U 0 value Compression level
|
||||
*
|
||||
D deflatePending PR 10I 0 extproc('deflatePending') Change level & strat
|
||||
D strm like(z_stream) Compression stream
|
||||
D pending 10U 0 Pending bytes
|
||||
D bits 10I 0 Pending bits
|
||||
*
|
||||
D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
|
||||
D strm like(z_stream) Compression stream
|
||||
D bits 10I 0 value # of bits to insert
|
||||
D value 10I 0 value Bits to insert
|
||||
*
|
||||
D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion
|
||||
D strm like(z_stream) Expansion stream
|
||||
D windowBits 10I 0 value log2(window size)
|
||||
D version * value options(*string) Version string
|
||||
D stream_size 10i 0 value Stream struct. size
|
||||
*
|
||||
D inflateSetDictionary...
|
||||
D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary
|
||||
D strm like(z_stream) Expansion stream
|
||||
D dictionary 65535 const options(*varsize) Dictionary bytes
|
||||
D dictLength 10U 0 value Dictionary length
|
||||
*
|
||||
D inflateGetDictionary...
|
||||
D PR 10I 0 extproc('inflateGetDictionary') Get dictionary
|
||||
D strm like(z_stream) Expansion stream
|
||||
D dictionary 65535 options(*varsize) Dictionary bytes
|
||||
D dictLength 10U 0 Dictionary length
|
||||
*
|
||||
D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D inflateCopy PR 10I 0 extproc('inflateCopy')
|
||||
D dest like(z_stream) Destination stream
|
||||
D source like(z_stream) Source stream
|
||||
*
|
||||
D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D inflateReset2 PR 10I 0 extproc('inflateReset2') End and init. stream
|
||||
D strm like(z_stream) Expansion stream
|
||||
D windowBits 10I 0 value Log2(buffer size)
|
||||
*
|
||||
D inflatePrime PR 10I 0 extproc('inflatePrime') Insert bits
|
||||
D strm like(z_stream) Expansion stream
|
||||
D bits 10I 0 value Bit count
|
||||
D value 10I 0 value Bits to insert
|
||||
*
|
||||
D inflateMark PR 10I 0 extproc('inflateMark') Get inflate info
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D inflateBackInit...
|
||||
D PR 10I 0 extproc('inflateBackInit_')
|
||||
D strm like(z_stream) Expansion stream
|
||||
D windowBits 10I 0 value Log2(buffer size)
|
||||
D window 65535 options(*varsize) Buffer
|
||||
D version * value options(*string) Version string
|
||||
D stream_size 10i 0 value Stream struct. size
|
||||
*
|
||||
D inflateBack PR 10I 0 extproc('inflateBack')
|
||||
D strm like(z_stream) Expansion stream
|
||||
D in * value procptr Input function
|
||||
D in_desc * value Input descriptor
|
||||
D out * value procptr Output function
|
||||
D out_desc * value Output descriptor
|
||||
*
|
||||
D inflateBackEnd PR 10I 0 extproc('inflateBackEnd')
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D zlibCompileFlags...
|
||||
D PR 10U 0 extproc('zlibCompileFlags')
|
||||
*
|
||||
**************************************************************************
|
||||
* Checksum function prototypes
|
||||
**************************************************************************
|
||||
*
|
||||
D adler32 PR 10U 0 extproc('adler32') New checksum
|
||||
D adler 10U 0 value Old checksum
|
||||
D buf 65535 const options(*varsize) Bytes to accumulate
|
||||
D len 10U 0 value Buffer length
|
||||
*
|
||||
D crc32 PR 10U 0 extproc('crc32') New checksum
|
||||
D crc 10U 0 value Old checksum
|
||||
D buf 65535 const options(*varsize) Bytes to accumulate
|
||||
D len 10U 0 value Buffer length
|
||||
*
|
||||
**************************************************************************
|
||||
* Miscellaneous function prototypes
|
||||
**************************************************************************
|
||||
*
|
||||
D zError PR * extproc('zError') Error string
|
||||
D err 10I 0 value Error code
|
||||
*
|
||||
D inflateSyncPoint...
|
||||
D PR 10I 0 extproc('inflateSyncPoint')
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs
|
||||
*
|
||||
D inflateUndermine...
|
||||
D PR 10I 0 extproc('inflateUndermine')
|
||||
D strm like(z_stream) Expansion stream
|
||||
D arg 10I 0 value Error code
|
||||
*
|
||||
D inflateResetKeep...
|
||||
D PR 10I 0 extproc('inflateResetKeep') End and init. stream
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D deflateResetKeep...
|
||||
D PR 10I 0 extproc('deflateResetKeep') End and init. stream
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
/endif
|
80
software/scsi2sd-util/zlib-1.2.8/compress.c
Normal file
80
software/scsi2sd-util/zlib-1.2.8/compress.c
Normal file
@ -0,0 +1,80 @@
|
||||
/* compress.c -- compress a memory buffer
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#define ZLIB_INTERNAL
|
||||
#include "zlib.h"
|
||||
|
||||
/* ===========================================================================
|
||||
Compresses the source buffer into the destination buffer. The level
|
||||
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
||||
length of the source buffer. Upon entry, destLen is the total size of the
|
||||
destination buffer, which must be at least 0.1% larger than sourceLen plus
|
||||
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
|
||||
|
||||
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
||||
Z_STREAM_ERROR if the level parameter is invalid.
|
||||
*/
|
||||
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
|
||||
Bytef *dest;
|
||||
uLongf *destLen;
|
||||
const Bytef *source;
|
||||
uLong sourceLen;
|
||||
int level;
|
||||
{
|
||||
z_stream stream;
|
||||
int err;
|
||||
|
||||
stream.next_in = (z_const Bytef *)source;
|
||||
stream.avail_in = (uInt)sourceLen;
|
||||
#ifdef MAXSEG_64K
|
||||
/* Check for source > 64K on 16-bit machine: */
|
||||
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
|
||||
#endif
|
||||
stream.next_out = dest;
|
||||
stream.avail_out = (uInt)*destLen;
|
||||
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
|
||||
|
||||
stream.zalloc = (alloc_func)0;
|
||||
stream.zfree = (free_func)0;
|
||||
stream.opaque = (voidpf)0;
|
||||
|
||||
err = deflateInit(&stream, level);
|
||||
if (err != Z_OK) return err;
|
||||
|
||||
err = deflate(&stream, Z_FINISH);
|
||||
if (err != Z_STREAM_END) {
|
||||
deflateEnd(&stream);
|
||||
return err == Z_OK ? Z_BUF_ERROR : err;
|
||||
}
|
||||
*destLen = stream.total_out;
|
||||
|
||||
err = deflateEnd(&stream);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
*/
|
||||
int ZEXPORT compress (dest, destLen, source, sourceLen)
|
||||
Bytef *dest;
|
||||
uLongf *destLen;
|
||||
const Bytef *source;
|
||||
uLong sourceLen;
|
||||
{
|
||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
If the default memLevel or windowBits for deflateInit() is changed, then
|
||||
this function needs to be updated.
|
||||
*/
|
||||
uLong ZEXPORT compressBound (sourceLen)
|
||||
uLong sourceLen;
|
||||
{
|
||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||
(sourceLen >> 25) + 13;
|
||||
}
|
831
software/scsi2sd-util/zlib-1.2.8/configure
vendored
Executable file
831
software/scsi2sd-util/zlib-1.2.8/configure
vendored
Executable file
@ -0,0 +1,831 @@
|
||||
#!/bin/sh
|
||||
# configure script for zlib.
|
||||
#
|
||||
# Normally configure builds both a static and a shared library.
|
||||
# If you want to build just a static library, use: ./configure --static
|
||||
#
|
||||
# To impose specific compiler or flags or install directory, use for example:
|
||||
# prefix=$HOME CC=cc CFLAGS="-O4" ./configure
|
||||
# or for csh/tcsh users:
|
||||
# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
|
||||
|
||||
# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
|
||||
# If you have problems, try without defining CC and CFLAGS before reporting
|
||||
# an error.
|
||||
|
||||
# start off configure.log
|
||||
echo -------------------- >> configure.log
|
||||
echo $0 $* >> configure.log
|
||||
date >> configure.log
|
||||
|
||||
# set command prefix for cross-compilation
|
||||
if [ -n "${CHOST}" ]; then
|
||||
uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
|
||||
CROSS_PREFIX="${CHOST}-"
|
||||
fi
|
||||
|
||||
# destination name for static library
|
||||
STATICLIB=libz.a
|
||||
|
||||
# extract zlib version numbers from zlib.h
|
||||
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
|
||||
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
|
||||
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
|
||||
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
|
||||
|
||||
# establish commands for library building
|
||||
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
||||
AR=${AR-"${CROSS_PREFIX}ar"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
|
||||
else
|
||||
AR=${AR-"ar"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
|
||||
fi
|
||||
ARFLAGS=${ARFLAGS-"rc"}
|
||||
if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
||||
RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
|
||||
else
|
||||
RANLIB=${RANLIB-"ranlib"}
|
||||
fi
|
||||
if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
||||
NM=${NM-"${CROSS_PREFIX}nm"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
|
||||
else
|
||||
NM=${NM-"nm"}
|
||||
fi
|
||||
|
||||
# set defaults before processing command line options
|
||||
LDCONFIG=${LDCONFIG-"ldconfig"}
|
||||
LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
|
||||
ARCHS=
|
||||
prefix=${prefix-/usr/local}
|
||||
exec_prefix=${exec_prefix-'${prefix}'}
|
||||
libdir=${libdir-'${exec_prefix}/lib'}
|
||||
sharedlibdir=${sharedlibdir-'${libdir}'}
|
||||
includedir=${includedir-'${prefix}/include'}
|
||||
mandir=${mandir-'${prefix}/share/man'}
|
||||
shared_ext='.so'
|
||||
shared=1
|
||||
solo=0
|
||||
cover=0
|
||||
zprefix=0
|
||||
zconst=0
|
||||
build64=0
|
||||
gcc=0
|
||||
old_cc="$CC"
|
||||
old_cflags="$CFLAGS"
|
||||
OBJC='$(OBJZ) $(OBJG)'
|
||||
PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
|
||||
|
||||
# leave this script, optionally in a bad way
|
||||
leave()
|
||||
{
|
||||
if test "$*" != "0"; then
|
||||
echo "** $0 aborting." | tee -a configure.log
|
||||
fi
|
||||
rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
|
||||
echo -------------------- >> configure.log
|
||||
echo >> configure.log
|
||||
echo >> configure.log
|
||||
exit $1
|
||||
}
|
||||
|
||||
# process command line options
|
||||
while test $# -ge 1
|
||||
do
|
||||
case "$1" in
|
||||
-h* | --help)
|
||||
echo 'usage:' | tee -a configure.log
|
||||
echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
|
||||
echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
|
||||
echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
|
||||
exit 0 ;;
|
||||
-p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
-l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
--sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
-i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
|
||||
-u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
|
||||
-p* | --prefix) prefix="$2"; shift; shift ;;
|
||||
-e* | --eprefix) exec_prefix="$2"; shift; shift ;;
|
||||
-l* | --libdir) libdir="$2"; shift; shift ;;
|
||||
-i* | --includedir) includedir="$2"; shift; shift ;;
|
||||
-s* | --shared | --enable-shared) shared=1; shift ;;
|
||||
-t | --static) shared=0; shift ;;
|
||||
--solo) solo=1; shift ;;
|
||||
--cover) cover=1; shift ;;
|
||||
-z* | --zprefix) zprefix=1; shift ;;
|
||||
-6* | --64) build64=1; shift ;;
|
||||
-a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
--sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
|
||||
--localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
|
||||
-c* | --const) zconst=1; shift ;;
|
||||
*)
|
||||
echo "unknown option: $1" | tee -a configure.log
|
||||
echo "$0 --help for help" | tee -a configure.log
|
||||
leave 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# temporary file name
|
||||
test=ztest$$
|
||||
|
||||
# put arguments in log, also put test file in log if used in arguments
|
||||
show()
|
||||
{
|
||||
case "$*" in
|
||||
*$test.c*)
|
||||
echo === $test.c === >> configure.log
|
||||
cat $test.c >> configure.log
|
||||
echo === >> configure.log;;
|
||||
esac
|
||||
echo $* >> configure.log
|
||||
}
|
||||
|
||||
# check for gcc vs. cc and set compile and link flags based on the system identified by uname
|
||||
cat > $test.c <<EOF
|
||||
extern int getchar();
|
||||
int hello() {return getchar();}
|
||||
EOF
|
||||
|
||||
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
|
||||
cc=${CC-${CROSS_PREFIX}gcc}
|
||||
cflags=${CFLAGS-"-O3"}
|
||||
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
|
||||
case "$cc" in
|
||||
*gcc*) gcc=1 ;;
|
||||
*clang*) gcc=1 ;;
|
||||
esac
|
||||
case `$cc -v 2>&1` in
|
||||
*gcc*) gcc=1 ;;
|
||||
esac
|
||||
|
||||
show $cc -c $test.c
|
||||
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
|
||||
echo ... using gcc >> configure.log
|
||||
CC="$cc"
|
||||
CFLAGS="${CFLAGS--O3} ${ARCHS}"
|
||||
SFLAGS="${CFLAGS--O3} -fPIC"
|
||||
LDFLAGS="${LDFLAGS} ${ARCHS}"
|
||||
if test $build64 -eq 1; then
|
||||
CFLAGS="${CFLAGS} -m64"
|
||||
SFLAGS="${SFLAGS} -m64"
|
||||
fi
|
||||
if test "${ZLIBGCCWARN}" = "YES"; then
|
||||
if test "$zconst" -eq 1; then
|
||||
CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
|
||||
else
|
||||
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
|
||||
fi
|
||||
fi
|
||||
if test -z "$uname"; then
|
||||
uname=`(uname -s || echo unknown) 2>/dev/null`
|
||||
fi
|
||||
case "$uname" in
|
||||
Linux* | linux* | GNU | GNU/* | solaris*)
|
||||
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
|
||||
*BSD | *bsd* | DragonFly)
|
||||
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}
|
||||
LDCONFIG="ldconfig -m" ;;
|
||||
CYGWIN* | Cygwin* | cygwin* | OS/2*)
|
||||
EXE='.exe' ;;
|
||||
MINGW* | mingw*)
|
||||
# temporary bypass
|
||||
rm -f $test.[co] $test $test$shared_ext
|
||||
echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
|
||||
leave 1
|
||||
LDSHARED=${LDSHARED-"$cc -shared"}
|
||||
LDSHAREDLIBC=""
|
||||
EXE='.exe' ;;
|
||||
QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
|
||||
# (alain.bonnefoy@icbt.com)
|
||||
LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
|
||||
HP-UX*)
|
||||
LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
|
||||
case `(uname -m || echo unknown) 2>/dev/null` in
|
||||
ia64)
|
||||
shared_ext='.so'
|
||||
SHAREDLIB='libz.so' ;;
|
||||
*)
|
||||
shared_ext='.sl'
|
||||
SHAREDLIB='libz.sl' ;;
|
||||
esac ;;
|
||||
Darwin* | darwin*)
|
||||
shared_ext='.dylib'
|
||||
SHAREDLIB=libz$shared_ext
|
||||
SHAREDLIBV=libz.$VER$shared_ext
|
||||
SHAREDLIBM=libz.$VER1$shared_ext
|
||||
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
|
||||
if libtool -V 2>&1 | grep Apple > /dev/null; then
|
||||
AR="libtool"
|
||||
else
|
||||
AR="/usr/bin/libtool"
|
||||
fi
|
||||
ARFLAGS="-o" ;;
|
||||
*) LDSHARED=${LDSHARED-"$cc -shared"} ;;
|
||||
esac
|
||||
else
|
||||
# find system name and corresponding cc options
|
||||
CC=${CC-cc}
|
||||
gcc=0
|
||||
echo ... using $CC >> configure.log
|
||||
if test -z "$uname"; then
|
||||
uname=`(uname -sr || echo unknown) 2>/dev/null`
|
||||
fi
|
||||
case "$uname" in
|
||||
HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
|
||||
CFLAGS=${CFLAGS-"-O"}
|
||||
# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
|
||||
LDSHARED=${LDSHARED-"ld -b"}
|
||||
case `(uname -m || echo unknown) 2>/dev/null` in
|
||||
ia64)
|
||||
shared_ext='.so'
|
||||
SHAREDLIB='libz.so' ;;
|
||||
*)
|
||||
shared_ext='.sl'
|
||||
SHAREDLIB='libz.sl' ;;
|
||||
esac ;;
|
||||
IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
|
||||
CFLAGS=${CFLAGS-"-ansi -O2"}
|
||||
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
|
||||
OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
|
||||
CFLAGS=${CFLAGS-"-O -std1"}
|
||||
LDFLAGS="${LDFLAGS} -Wl,-rpath,."
|
||||
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
|
||||
OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
|
||||
CFLAGS=${CFLAGS-"-O -std1"}
|
||||
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
|
||||
QNX*) SFLAGS=${CFLAGS-"-4 -O"}
|
||||
CFLAGS=${CFLAGS-"-4 -O"}
|
||||
LDSHARED=${LDSHARED-"cc"}
|
||||
RANLIB=${RANLIB-"true"}
|
||||
AR="cc"
|
||||
ARFLAGS="-A" ;;
|
||||
SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
|
||||
CFLAGS=${CFLAGS-"-O3"}
|
||||
LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
|
||||
SunOS\ 5* | solaris*)
|
||||
LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
|
||||
SFLAGS=${CFLAGS-"-fast -KPIC"}
|
||||
CFLAGS=${CFLAGS-"-fast"}
|
||||
if test $build64 -eq 1; then
|
||||
# old versions of SunPRO/Workshop/Studio don't support -m64,
|
||||
# but newer ones do. Check for it.
|
||||
flag64=`$CC -flags | egrep -- '^-m64'`
|
||||
if test x"$flag64" != x"" ; then
|
||||
CFLAGS="${CFLAGS} -m64"
|
||||
SFLAGS="${SFLAGS} -m64"
|
||||
else
|
||||
case `(uname -m || echo unknown) 2>/dev/null` in
|
||||
i86*)
|
||||
SFLAGS="$SFLAGS -xarch=amd64"
|
||||
CFLAGS="$CFLAGS -xarch=amd64" ;;
|
||||
*)
|
||||
SFLAGS="$SFLAGS -xarch=v9"
|
||||
CFLAGS="$CFLAGS -xarch=v9" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
|
||||
CFLAGS=${CFLAGS-"-O2"}
|
||||
LDSHARED=${LDSHARED-"ld"} ;;
|
||||
SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
|
||||
CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
|
||||
LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
|
||||
UNIX_System_V\ 4.2.0)
|
||||
SFLAGS=${CFLAGS-"-KPIC -O"}
|
||||
CFLAGS=${CFLAGS-"-O"}
|
||||
LDSHARED=${LDSHARED-"cc -G"} ;;
|
||||
UNIX_SV\ 4.2MP)
|
||||
SFLAGS=${CFLAGS-"-Kconform_pic -O"}
|
||||
CFLAGS=${CFLAGS-"-O"}
|
||||
LDSHARED=${LDSHARED-"cc -G"} ;;
|
||||
OpenUNIX\ 5)
|
||||
SFLAGS=${CFLAGS-"-KPIC -O"}
|
||||
CFLAGS=${CFLAGS-"-O"}
|
||||
LDSHARED=${LDSHARED-"cc -G"} ;;
|
||||
AIX*) # Courtesy of dbakker@arrayasolutions.com
|
||||
SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
|
||||
CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
|
||||
LDSHARED=${LDSHARED-"xlc -G"} ;;
|
||||
# send working options for other systems to zlib@gzip.org
|
||||
*) SFLAGS=${CFLAGS-"-O"}
|
||||
CFLAGS=${CFLAGS-"-O"}
|
||||
LDSHARED=${LDSHARED-"cc -shared"} ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# destination names for shared library if not defined above
|
||||
SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
|
||||
SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
|
||||
SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
|
||||
|
||||
echo >> configure.log
|
||||
|
||||
# define functions for testing compiler and library characteristics and logging the results
|
||||
|
||||
cat > $test.c <<EOF
|
||||
#error error
|
||||
EOF
|
||||
if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
|
||||
try()
|
||||
{
|
||||
show $*
|
||||
test "`( $* ) 2>&1 | tee -a configure.log`" = ""
|
||||
}
|
||||
echo - using any output from compiler to indicate an error >> configure.log
|
||||
else
|
||||
try()
|
||||
{
|
||||
show $*
|
||||
( $* ) >> configure.log 2>&1
|
||||
ret=$?
|
||||
if test $ret -ne 0; then
|
||||
echo "(exit code "$ret")" >> configure.log
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
fi
|
||||
|
||||
tryboth()
|
||||
{
|
||||
show $*
|
||||
got=`( $* ) 2>&1`
|
||||
ret=$?
|
||||
printf %s "$got" >> configure.log
|
||||
if test $ret -ne 0; then
|
||||
return $ret
|
||||
fi
|
||||
test "$got" = ""
|
||||
}
|
||||
|
||||
cat > $test.c << EOF
|
||||
int foo() { return 0; }
|
||||
EOF
|
||||
echo "Checking for obsessive-compulsive compiler options..." >> configure.log
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
:
|
||||
else
|
||||
echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
|
||||
leave 1
|
||||
fi
|
||||
|
||||
echo >> configure.log
|
||||
|
||||
# see if shared library build supported
|
||||
cat > $test.c <<EOF
|
||||
extern int getchar();
|
||||
int hello() {return getchar();}
|
||||
EOF
|
||||
if test $shared -eq 1; then
|
||||
echo Checking for shared library support... | tee -a configure.log
|
||||
# we must test in two steps (cc then ld), required at least on SunOS 4.x
|
||||
if try $CC -w -c $SFLAGS $test.c &&
|
||||
try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
|
||||
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
|
||||
elif test -z "$old_cc" -a -z "$old_cflags"; then
|
||||
echo No shared library support. | tee -a configure.log
|
||||
shared=0;
|
||||
else
|
||||
echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
|
||||
shared=0;
|
||||
fi
|
||||
fi
|
||||
if test $shared -eq 0; then
|
||||
LDSHARED="$CC"
|
||||
ALL="static"
|
||||
TEST="all teststatic"
|
||||
SHAREDLIB=""
|
||||
SHAREDLIBV=""
|
||||
SHAREDLIBM=""
|
||||
echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
|
||||
else
|
||||
ALL="static shared"
|
||||
TEST="all teststatic testshared"
|
||||
fi
|
||||
|
||||
# check for underscores in external names for use by assembler code
|
||||
CPP=${CPP-"$CC -E"}
|
||||
case $CFLAGS in
|
||||
*ASMV*)
|
||||
echo >> configure.log
|
||||
show "$NM $test.o | grep _hello"
|
||||
if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
|
||||
CPP="$CPP -DNO_UNDERLINE"
|
||||
echo Checking for underline in external names... No. | tee -a configure.log
|
||||
else
|
||||
echo Checking for underline in external names... Yes. | tee -a configure.log
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
echo >> configure.log
|
||||
|
||||
# check for large file support, and if none, check for fseeko()
|
||||
cat > $test.c <<EOF
|
||||
#include <sys/types.h>
|
||||
off64_t dummy = 0;
|
||||
EOF
|
||||
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
|
||||
CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
|
||||
SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
|
||||
ALL="${ALL} all64"
|
||||
TEST="${TEST} test64"
|
||||
echo "Checking for off64_t... Yes." | tee -a configure.log
|
||||
echo "Checking for fseeko... Yes." | tee -a configure.log
|
||||
else
|
||||
echo "Checking for off64_t... No." | tee -a configure.log
|
||||
echo >> configure.log
|
||||
cat > $test.c <<EOF
|
||||
#include <stdio.h>
|
||||
int main(void) {
|
||||
fseeko(NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
if try $CC $CFLAGS -o $test $test.c; then
|
||||
echo "Checking for fseeko... Yes." | tee -a configure.log
|
||||
else
|
||||
CFLAGS="${CFLAGS} -DNO_FSEEKO"
|
||||
SFLAGS="${SFLAGS} -DNO_FSEEKO"
|
||||
echo "Checking for fseeko... No." | tee -a configure.log
|
||||
fi
|
||||
fi
|
||||
|
||||
echo >> configure.log
|
||||
|
||||
# check for strerror() for use by gz* functions
|
||||
cat > $test.c <<EOF
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
int main() { return strlen(strerror(errno)); }
|
||||
EOF
|
||||
if try $CC $CFLAGS -o $test $test.c; then
|
||||
echo "Checking for strerror... Yes." | tee -a configure.log
|
||||
else
|
||||
CFLAGS="${CFLAGS} -DNO_STRERROR"
|
||||
SFLAGS="${SFLAGS} -DNO_STRERROR"
|
||||
echo "Checking for strerror... No." | tee -a configure.log
|
||||
fi
|
||||
|
||||
# copy clean zconf.h for subsequent edits
|
||||
cp -p zconf.h.in zconf.h
|
||||
|
||||
echo >> configure.log
|
||||
|
||||
# check for unistd.h and save result in zconf.h
|
||||
cat > $test.c <<EOF
|
||||
#include <unistd.h>
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
||||
mv zconf.temp.h zconf.h
|
||||
echo "Checking for unistd.h... Yes." | tee -a configure.log
|
||||
else
|
||||
echo "Checking for unistd.h... No." | tee -a configure.log
|
||||
fi
|
||||
|
||||
echo >> configure.log
|
||||
|
||||
# check for stdarg.h and save result in zconf.h
|
||||
cat > $test.c <<EOF
|
||||
#include <stdarg.h>
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
||||
mv zconf.temp.h zconf.h
|
||||
echo "Checking for stdarg.h... Yes." | tee -a configure.log
|
||||
else
|
||||
echo "Checking for stdarg.h... No." | tee -a configure.log
|
||||
fi
|
||||
|
||||
# if the z_ prefix was requested, save that in zconf.h
|
||||
if test $zprefix -eq 1; then
|
||||
sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
||||
mv zconf.temp.h zconf.h
|
||||
echo >> configure.log
|
||||
echo "Using z_ prefix on all symbols." | tee -a configure.log
|
||||
fi
|
||||
|
||||
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
|
||||
if test $solo -eq 1; then
|
||||
sed '/#define ZCONF_H/a\
|
||||
#define Z_SOLO
|
||||
|
||||
' < zconf.h > zconf.temp.h
|
||||
mv zconf.temp.h zconf.h
|
||||
OBJC='$(OBJZ)'
|
||||
PIC_OBJC='$(PIC_OBJZ)'
|
||||
fi
|
||||
|
||||
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
|
||||
if test $cover -eq 1; then
|
||||
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
|
||||
if test -n "$GCC_CLASSIC"; then
|
||||
CC=$GCC_CLASSIC
|
||||
fi
|
||||
fi
|
||||
|
||||
echo >> configure.log
|
||||
|
||||
# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
|
||||
# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
|
||||
# return value. The most secure result is vsnprintf() with a return value. snprintf() with a
|
||||
# return value is secure as well, but then gzprintf() will be limited to 20 arguments.
|
||||
cat > $test.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "zconf.h"
|
||||
int main()
|
||||
{
|
||||
#ifndef STDC
|
||||
choke me
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
|
||||
|
||||
echo >> configure.log
|
||||
cat > $test.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int mytest(const char *fmt, ...)
|
||||
{
|
||||
char buf[20];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
return (mytest("Hello%d\n", 1));
|
||||
}
|
||||
EOF
|
||||
if try $CC $CFLAGS -o $test $test.c; then
|
||||
echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
|
||||
|
||||
echo >> configure.log
|
||||
cat >$test.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int mytest(const char *fmt, ...)
|
||||
{
|
||||
int n;
|
||||
char buf[20];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
return n;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
return (mytest("Hello%d\n", 1));
|
||||
}
|
||||
EOF
|
||||
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
|
||||
else
|
||||
CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
|
||||
SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
|
||||
echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
|
||||
echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
|
||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
||||
echo " vulnerabilities." | tee -a configure.log
|
||||
fi
|
||||
else
|
||||
CFLAGS="$CFLAGS -DNO_vsnprintf"
|
||||
SFLAGS="$SFLAGS -DNO_vsnprintf"
|
||||
echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
|
||||
echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
|
||||
echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
|
||||
echo " vulnerabilities." | tee -a configure.log
|
||||
|
||||
echo >> configure.log
|
||||
cat >$test.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int mytest(const char *fmt, ...)
|
||||
{
|
||||
int n;
|
||||
char buf[20];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsprintf(buf, fmt, ap);
|
||||
va_end(ap);
|
||||
return n;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
return (mytest("Hello%d\n", 1));
|
||||
}
|
||||
EOF
|
||||
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
|
||||
else
|
||||
CFLAGS="$CFLAGS -DHAS_vsprintf_void"
|
||||
SFLAGS="$SFLAGS -DHAS_vsprintf_void"
|
||||
echo "Checking for return value of vsprintf()... No." | tee -a configure.log
|
||||
echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
|
||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
||||
echo " vulnerabilities." | tee -a configure.log
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
|
||||
|
||||
echo >> configure.log
|
||||
cat >$test.c <<EOF
|
||||
#include <stdio.h>
|
||||
int mytest()
|
||||
{
|
||||
char buf[20];
|
||||
snprintf(buf, sizeof(buf), "%s", "foo");
|
||||
return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
return (mytest());
|
||||
}
|
||||
EOF
|
||||
|
||||
if try $CC $CFLAGS -o $test $test.c; then
|
||||
echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
|
||||
|
||||
echo >> configure.log
|
||||
cat >$test.c <<EOF
|
||||
#include <stdio.h>
|
||||
int mytest()
|
||||
{
|
||||
char buf[20];
|
||||
return snprintf(buf, sizeof(buf), "%s", "foo");
|
||||
}
|
||||
int main()
|
||||
{
|
||||
return (mytest());
|
||||
}
|
||||
EOF
|
||||
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
|
||||
else
|
||||
CFLAGS="$CFLAGS -DHAS_snprintf_void"
|
||||
SFLAGS="$SFLAGS -DHAS_snprintf_void"
|
||||
echo "Checking for return value of snprintf()... No." | tee -a configure.log
|
||||
echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
|
||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
||||
echo " vulnerabilities." | tee -a configure.log
|
||||
fi
|
||||
else
|
||||
CFLAGS="$CFLAGS -DNO_snprintf"
|
||||
SFLAGS="$SFLAGS -DNO_snprintf"
|
||||
echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
|
||||
echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
|
||||
echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
|
||||
echo " vulnerabilities." | tee -a configure.log
|
||||
|
||||
echo >> configure.log
|
||||
cat >$test.c <<EOF
|
||||
#include <stdio.h>
|
||||
int mytest()
|
||||
{
|
||||
char buf[20];
|
||||
return sprintf(buf, "%s", "foo");
|
||||
}
|
||||
int main()
|
||||
{
|
||||
return (mytest());
|
||||
}
|
||||
EOF
|
||||
|
||||
if try $CC -c $CFLAGS $test.c; then
|
||||
echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
|
||||
else
|
||||
CFLAGS="$CFLAGS -DHAS_sprintf_void"
|
||||
SFLAGS="$SFLAGS -DHAS_sprintf_void"
|
||||
echo "Checking for return value of sprintf()... No." | tee -a configure.log
|
||||
echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
|
||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
||||
echo " vulnerabilities." | tee -a configure.log
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# see if we can hide zlib internal symbols that are linked between separate source files
|
||||
if test "$gcc" -eq 1; then
|
||||
echo >> configure.log
|
||||
cat > $test.c <<EOF
|
||||
#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||
int ZLIB_INTERNAL foo;
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
if tryboth $CC -c $CFLAGS $test.c; then
|
||||
CFLAGS="$CFLAGS -DHAVE_HIDDEN"
|
||||
SFLAGS="$SFLAGS -DHAVE_HIDDEN"
|
||||
echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
|
||||
else
|
||||
echo "Checking for attribute(visibility) support... No." | tee -a configure.log
|
||||
fi
|
||||
fi
|
||||
|
||||
# show the results in the log
|
||||
echo >> configure.log
|
||||
echo ALL = $ALL >> configure.log
|
||||
echo AR = $AR >> configure.log
|
||||
echo ARFLAGS = $ARFLAGS >> configure.log
|
||||
echo CC = $CC >> configure.log
|
||||
echo CFLAGS = $CFLAGS >> configure.log
|
||||
echo CPP = $CPP >> configure.log
|
||||
echo EXE = $EXE >> configure.log
|
||||
echo LDCONFIG = $LDCONFIG >> configure.log
|
||||
echo LDFLAGS = $LDFLAGS >> configure.log
|
||||
echo LDSHARED = $LDSHARED >> configure.log
|
||||
echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
|
||||
echo OBJC = $OBJC >> configure.log
|
||||
echo PIC_OBJC = $PIC_OBJC >> configure.log
|
||||
echo RANLIB = $RANLIB >> configure.log
|
||||
echo SFLAGS = $SFLAGS >> configure.log
|
||||
echo SHAREDLIB = $SHAREDLIB >> configure.log
|
||||
echo SHAREDLIBM = $SHAREDLIBM >> configure.log
|
||||
echo SHAREDLIBV = $SHAREDLIBV >> configure.log
|
||||
echo STATICLIB = $STATICLIB >> configure.log
|
||||
echo TEST = $TEST >> configure.log
|
||||
echo VER = $VER >> configure.log
|
||||
echo Z_U4 = $Z_U4 >> configure.log
|
||||
echo exec_prefix = $exec_prefix >> configure.log
|
||||
echo includedir = $includedir >> configure.log
|
||||
echo libdir = $libdir >> configure.log
|
||||
echo mandir = $mandir >> configure.log
|
||||
echo prefix = $prefix >> configure.log
|
||||
echo sharedlibdir = $sharedlibdir >> configure.log
|
||||
echo uname = $uname >> configure.log
|
||||
|
||||
# udpate Makefile with the configure results
|
||||
sed < Makefile.in "
|
||||
/^CC *=/s#=.*#=$CC#
|
||||
/^CFLAGS *=/s#=.*#=$CFLAGS#
|
||||
/^SFLAGS *=/s#=.*#=$SFLAGS#
|
||||
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
||||
/^LDSHARED *=/s#=.*#=$LDSHARED#
|
||||
/^CPP *=/s#=.*#=$CPP#
|
||||
/^STATICLIB *=/s#=.*#=$STATICLIB#
|
||||
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
||||
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
||||
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
|
||||
/^AR *=/s#=.*#=$AR#
|
||||
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
|
||||
/^RANLIB *=/s#=.*#=$RANLIB#
|
||||
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
|
||||
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
|
||||
/^EXE *=/s#=.*#=$EXE#
|
||||
/^prefix *=/s#=.*#=$prefix#
|
||||
/^exec_prefix *=/s#=.*#=$exec_prefix#
|
||||
/^libdir *=/s#=.*#=$libdir#
|
||||
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
||||
/^includedir *=/s#=.*#=$includedir#
|
||||
/^mandir *=/s#=.*#=$mandir#
|
||||
/^OBJC *=/s#=.*#= $OBJC#
|
||||
/^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
|
||||
/^all: */s#:.*#: $ALL#
|
||||
/^test: */s#:.*#: $TEST#
|
||||
" > Makefile
|
||||
|
||||
# create zlib.pc with the configure results
|
||||
sed < zlib.pc.in "
|
||||
/^CC *=/s#=.*#=$CC#
|
||||
/^CFLAGS *=/s#=.*#=$CFLAGS#
|
||||
/^CPP *=/s#=.*#=$CPP#
|
||||
/^LDSHARED *=/s#=.*#=$LDSHARED#
|
||||
/^STATICLIB *=/s#=.*#=$STATICLIB#
|
||||
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
||||
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
||||
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
|
||||
/^AR *=/s#=.*#=$AR#
|
||||
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
|
||||
/^RANLIB *=/s#=.*#=$RANLIB#
|
||||
/^EXE *=/s#=.*#=$EXE#
|
||||
/^prefix *=/s#=.*#=$prefix#
|
||||
/^exec_prefix *=/s#=.*#=$exec_prefix#
|
||||
/^libdir *=/s#=.*#=$libdir#
|
||||
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
||||
/^includedir *=/s#=.*#=$includedir#
|
||||
/^mandir *=/s#=.*#=$mandir#
|
||||
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
||||
" | sed -e "
|
||||
s/\@VERSION\@/$VER/g;
|
||||
" > zlib.pc
|
||||
|
||||
# done
|
||||
leave 0
|
78
software/scsi2sd-util/zlib-1.2.8/contrib/README.contrib
Normal file
78
software/scsi2sd-util/zlib-1.2.8/contrib/README.contrib
Normal file
@ -0,0 +1,78 @@
|
||||
All files under this contrib directory are UNSUPPORTED. There were
|
||||
provided by users of zlib and were not tested by the authors of zlib.
|
||||
Use at your own risk. Please contact the authors of the contributions
|
||||
for help about these, not the zlib authors. Thanks.
|
||||
|
||||
|
||||
ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
|
||||
Support for Ada
|
||||
See http://zlib-ada.sourceforge.net/
|
||||
|
||||
amd64/ by Mikhail Teterin <mi@ALDAN.algebra.com>
|
||||
asm code for AMD64
|
||||
See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393
|
||||
|
||||
asm686/ by Brian Raiter <breadbox@muppetlabs.com>
|
||||
asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
|
||||
See http://www.muppetlabs.com/~breadbox/software/assembly.html
|
||||
|
||||
blast/ by Mark Adler <madler@alumni.caltech.edu>
|
||||
Decompressor for output of PKWare Data Compression Library (DCL)
|
||||
|
||||
delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
|
||||
Support for Delphi and C++ Builder
|
||||
|
||||
dotzlib/ by Henrik Ravn <henrik@ravn.com>
|
||||
Support for Microsoft .Net and Visual C++ .Net
|
||||
|
||||
gcc_gvmat64/by Gilles Vollant <info@winimage.com>
|
||||
GCC Version of x86 64-bit (AMD64 and Intel EM64t) code for x64
|
||||
assembler to replace longest_match() and inflate_fast()
|
||||
|
||||
infback9/ by Mark Adler <madler@alumni.caltech.edu>
|
||||
Unsupported diffs to infback to decode the deflate64 format
|
||||
|
||||
inflate86/ by Chris Anderson <christop@charm.net>
|
||||
Tuned x86 gcc asm code to replace inflate_fast()
|
||||
|
||||
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
|
||||
A C++ I/O streams interface to the zlib gz* functions
|
||||
|
||||
iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
|
||||
Another C++ I/O streams interface
|
||||
|
||||
iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
|
||||
and Kevin Ruland <kevin@rodin.wustl.edu>
|
||||
Yet another C++ I/O streams interface
|
||||
|
||||
masmx64/ by Gilles Vollant <info@winimage.com>
|
||||
x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
|
||||
replace longest_match() and inflate_fast(), also masm x86
|
||||
64-bits translation of Chris Anderson inflate_fast()
|
||||
|
||||
masmx86/ by Gilles Vollant <info@winimage.com>
|
||||
x86 asm code to replace longest_match() and inflate_fast(),
|
||||
for Visual C++ and MASM (32 bits).
|
||||
Based on Brian Raiter (asm686) and Chris Anderson (inflate86)
|
||||
|
||||
minizip/ by Gilles Vollant <info@winimage.com>
|
||||
Mini zip and unzip based on zlib
|
||||
Includes Zip64 support by Mathias Svensson <mathias@result42.com>
|
||||
See http://www.winimage.com/zLibDll/unzip.html
|
||||
|
||||
pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al.
|
||||
Support for Pascal
|
||||
|
||||
puff/ by Mark Adler <madler@alumni.caltech.edu>
|
||||
Small, low memory usage inflate. Also serves to provide an
|
||||
unambiguous description of the deflate format.
|
||||
|
||||
testzlib/ by Gilles Vollant <info@winimage.com>
|
||||
Example of the use of zlib
|
||||
|
||||
untgz/ by Pedro A. Aranda Gutierrez <paag@tid.es>
|
||||
A very simple tar.gz file extractor using zlib
|
||||
|
||||
vstudio/ by Gilles Vollant <info@winimage.com>
|
||||
Building a minizip-enhanced zlib with Microsoft Visual Studio
|
||||
Includes vc11 from kreuzerkrieg and vc12 from davispuh
|
106
software/scsi2sd-util/zlib-1.2.8/contrib/ada/buffer_demo.adb
Normal file
106
software/scsi2sd-util/zlib-1.2.8/contrib/ada/buffer_demo.adb
Normal file
@ -0,0 +1,106 @@
|
||||
----------------------------------------------------------------
|
||||
-- ZLib for Ada thick binding. --
|
||||
-- --
|
||||
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
|
||||
-- --
|
||||
-- Open source license information is in the zlib.ads file. --
|
||||
----------------------------------------------------------------
|
||||
--
|
||||
-- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
|
||||
|
||||
-- This demo program provided by Dr Steve Sangwine <sjs@essex.ac.uk>
|
||||
--
|
||||
-- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
|
||||
-- of exactly the correct size is used for decompressed data, and the last
|
||||
-- few bytes passed in to Zlib are checksum bytes.
|
||||
|
||||
-- This program compresses a string of text, and then decompresses the
|
||||
-- compressed text into a buffer of the same size as the original text.
|
||||
|
||||
with Ada.Streams; use Ada.Streams;
|
||||
with Ada.Text_IO;
|
||||
|
||||
with ZLib; use ZLib;
|
||||
|
||||
procedure Buffer_Demo is
|
||||
EOL : Character renames ASCII.LF;
|
||||
Text : constant String
|
||||
:= "Four score and seven years ago our fathers brought forth," & EOL &
|
||||
"upon this continent, a new nation, conceived in liberty," & EOL &
|
||||
"and dedicated to the proposition that `all men are created equal'.";
|
||||
|
||||
Source : Stream_Element_Array (1 .. Text'Length);
|
||||
for Source'Address use Text'Address;
|
||||
|
||||
begin
|
||||
Ada.Text_IO.Put (Text);
|
||||
Ada.Text_IO.New_Line;
|
||||
Ada.Text_IO.Put_Line
|
||||
("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
|
||||
|
||||
declare
|
||||
Compressed_Data : Stream_Element_Array (1 .. Text'Length);
|
||||
L : Stream_Element_Offset;
|
||||
begin
|
||||
Compress : declare
|
||||
Compressor : Filter_Type;
|
||||
I : Stream_Element_Offset;
|
||||
begin
|
||||
Deflate_Init (Compressor);
|
||||
|
||||
-- Compress the whole of T at once.
|
||||
|
||||
Translate (Compressor, Source, I, Compressed_Data, L, Finish);
|
||||
pragma Assert (I = Source'Last);
|
||||
|
||||
Close (Compressor);
|
||||
|
||||
Ada.Text_IO.Put_Line
|
||||
("Compressed size : "
|
||||
& Stream_Element_Offset'Image (L) & " bytes");
|
||||
end Compress;
|
||||
|
||||
-- Now we decompress the data, passing short blocks of data to Zlib
|
||||
-- (because this demonstrates the problem - the last block passed will
|
||||
-- contain checksum information and there will be no output, only a
|
||||
-- check inside Zlib that the checksum is correct).
|
||||
|
||||
Decompress : declare
|
||||
Decompressor : Filter_Type;
|
||||
|
||||
Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
|
||||
|
||||
Block_Size : constant := 4;
|
||||
-- This makes sure that the last block contains
|
||||
-- only Adler checksum data.
|
||||
|
||||
P : Stream_Element_Offset := Compressed_Data'First - 1;
|
||||
O : Stream_Element_Offset;
|
||||
begin
|
||||
Inflate_Init (Decompressor);
|
||||
|
||||
loop
|
||||
Translate
|
||||
(Decompressor,
|
||||
Compressed_Data
|
||||
(P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
|
||||
P,
|
||||
Uncompressed_Data
|
||||
(Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
|
||||
O,
|
||||
No_Flush);
|
||||
|
||||
Ada.Text_IO.Put_Line
|
||||
("Total in : " & Count'Image (Total_In (Decompressor)) &
|
||||
", out : " & Count'Image (Total_Out (Decompressor)));
|
||||
|
||||
exit when P = L;
|
||||
end loop;
|
||||
|
||||
Ada.Text_IO.New_Line;
|
||||
Ada.Text_IO.Put_Line
|
||||
("Decompressed text matches original text : "
|
||||
& Boolean'Image (Uncompressed_Data = Source));
|
||||
end Decompress;
|
||||
end;
|
||||
end Buffer_Demo;
|
156
software/scsi2sd-util/zlib-1.2.8/contrib/ada/mtest.adb
Normal file
156
software/scsi2sd-util/zlib-1.2.8/contrib/ada/mtest.adb
Normal file
@ -0,0 +1,156 @@
|
||||
----------------------------------------------------------------
|
||||
-- ZLib for Ada thick binding. --
|
||||
-- --
|
||||
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
|
||||
-- --
|
||||
-- Open source license information is in the zlib.ads file. --
|
||||
----------------------------------------------------------------
|
||||
-- Continuous test for ZLib multithreading. If the test would fail
|
||||
-- we should provide thread safe allocation routines for the Z_Stream.
|
||||
--
|
||||
-- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
|
||||
|
||||
with ZLib;
|
||||
with Ada.Streams;
|
||||
with Ada.Numerics.Discrete_Random;
|
||||
with Ada.Text_IO;
|
||||
with Ada.Exceptions;
|
||||
with Ada.Task_Identification;
|
||||
|
||||
procedure MTest is
|
||||
use Ada.Streams;
|
||||
use ZLib;
|
||||
|
||||
Stop : Boolean := False;
|
||||
|
||||
pragma Atomic (Stop);
|
||||
|
||||
subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
|
||||
|
||||
package Random_Elements is
|
||||
new Ada.Numerics.Discrete_Random (Visible_Symbols);
|
||||
|
||||
task type Test_Task;
|
||||
|
||||
task body Test_Task is
|
||||
Buffer : Stream_Element_Array (1 .. 100_000);
|
||||
Gen : Random_Elements.Generator;
|
||||
|
||||
Buffer_First : Stream_Element_Offset;
|
||||
Compare_First : Stream_Element_Offset;
|
||||
|
||||
Deflate : Filter_Type;
|
||||
Inflate : Filter_Type;
|
||||
|
||||
procedure Further (Item : in Stream_Element_Array);
|
||||
|
||||
procedure Read_Buffer
|
||||
(Item : out Ada.Streams.Stream_Element_Array;
|
||||
Last : out Ada.Streams.Stream_Element_Offset);
|
||||
|
||||
-------------
|
||||
-- Further --
|
||||
-------------
|
||||
|
||||
procedure Further (Item : in Stream_Element_Array) is
|
||||
|
||||
procedure Compare (Item : in Stream_Element_Array);
|
||||
|
||||
-------------
|
||||
-- Compare --
|
||||
-------------
|
||||
|
||||
procedure Compare (Item : in Stream_Element_Array) is
|
||||
Next_First : Stream_Element_Offset := Compare_First + Item'Length;
|
||||
begin
|
||||
if Buffer (Compare_First .. Next_First - 1) /= Item then
|
||||
raise Program_Error;
|
||||
end if;
|
||||
|
||||
Compare_First := Next_First;
|
||||
end Compare;
|
||||
|
||||
procedure Compare_Write is new ZLib.Write (Write => Compare);
|
||||
begin
|
||||
Compare_Write (Inflate, Item, No_Flush);
|
||||
end Further;
|
||||
|
||||
-----------------
|
||||
-- Read_Buffer --
|
||||
-----------------
|
||||
|
||||
procedure Read_Buffer
|
||||
(Item : out Ada.Streams.Stream_Element_Array;
|
||||
Last : out Ada.Streams.Stream_Element_Offset)
|
||||
is
|
||||
Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First;
|
||||
Next_First : Stream_Element_Offset;
|
||||
begin
|
||||
if Item'Length <= Buff_Diff then
|
||||
Last := Item'Last;
|
||||
|
||||
Next_First := Buffer_First + Item'Length;
|
||||
|
||||
Item := Buffer (Buffer_First .. Next_First - 1);
|
||||
|
||||
Buffer_First := Next_First;
|
||||
else
|
||||
Last := Item'First + Buff_Diff;
|
||||
Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last);
|
||||
Buffer_First := Buffer'Last + 1;
|
||||
end if;
|
||||
end Read_Buffer;
|
||||
|
||||
procedure Translate is new Generic_Translate
|
||||
(Data_In => Read_Buffer,
|
||||
Data_Out => Further);
|
||||
|
||||
begin
|
||||
Random_Elements.Reset (Gen);
|
||||
|
||||
Buffer := (others => 20);
|
||||
|
||||
Main : loop
|
||||
for J in Buffer'Range loop
|
||||
Buffer (J) := Random_Elements.Random (Gen);
|
||||
|
||||
Deflate_Init (Deflate);
|
||||
Inflate_Init (Inflate);
|
||||
|
||||
Buffer_First := Buffer'First;
|
||||
Compare_First := Buffer'First;
|
||||
|
||||
Translate (Deflate);
|
||||
|
||||
if Compare_First /= Buffer'Last + 1 then
|
||||
raise Program_Error;
|
||||
end if;
|
||||
|
||||
Ada.Text_IO.Put_Line
|
||||
(Ada.Task_Identification.Image
|
||||
(Ada.Task_Identification.Current_Task)
|
||||
& Stream_Element_Offset'Image (J)
|
||||
& ZLib.Count'Image (Total_Out (Deflate)));
|
||||
|
||||
Close (Deflate);
|
||||
Close (Inflate);
|
||||
|
||||
exit Main when Stop;
|
||||
end loop;
|
||||
end loop Main;
|
||||
exception
|
||||
when E : others =>
|
||||
Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E));
|
||||
Stop := True;
|
||||
end Test_Task;
|
||||
|
||||
Test : array (1 .. 4) of Test_Task;
|
||||
|
||||
pragma Unreferenced (Test);
|
||||
|
||||
Dummy : Character;
|
||||
|
||||
begin
|
||||
Ada.Text_IO.Get_Immediate (Dummy);
|
||||
Stop := True;
|
||||
end MTest;
|
156
software/scsi2sd-util/zlib-1.2.8/contrib/ada/read.adb
Normal file
156
software/scsi2sd-util/zlib-1.2.8/contrib/ada/read.adb
Normal file
@ -0,0 +1,156 @@
|
||||
----------------------------------------------------------------
|
||||
-- ZLib for Ada thick binding. --
|
||||
-- --
|
||||
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
|
||||
-- --
|
||||
-- Open source license information is in the zlib.ads file. --
|
||||
----------------------------------------------------------------
|
||||
|
||||
-- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $
|
||||
|
||||
-- Test/demo program for the generic read interface.
|
||||
|
||||
with Ada.Numerics.Discrete_Random;
|
||||
with Ada.Streams;
|
||||
with Ada.Text_IO;
|
||||
|
||||
with ZLib;
|
||||
|
||||
procedure Read is
|
||||
|
||||
use Ada.Streams;
|
||||
|
||||
------------------------------------
|
||||
-- Test configuration parameters --
|
||||
------------------------------------
|
||||
|
||||
File_Size : Stream_Element_Offset := 100_000;
|
||||
|
||||
Continuous : constant Boolean := False;
|
||||
-- If this constant is True, the test would be repeated again and again,
|
||||
-- with increment File_Size for every iteration.
|
||||
|
||||
Header : constant ZLib.Header_Type := ZLib.Default;
|
||||
-- Do not use Header other than Default in ZLib versions 1.1.4 and older.
|
||||
|
||||
Init_Random : constant := 8;
|
||||
-- We are using the same random sequence, in case of we catch bug,
|
||||
-- so we would be able to reproduce it.
|
||||
|
||||
-- End --
|
||||
|
||||
Pack_Size : Stream_Element_Offset;
|
||||
Offset : Stream_Element_Offset;
|
||||
|
||||
Filter : ZLib.Filter_Type;
|
||||
|
||||
subtype Visible_Symbols
|
||||
is Stream_Element range 16#20# .. 16#7E#;
|
||||
|
||||
package Random_Elements is new
|
||||
Ada.Numerics.Discrete_Random (Visible_Symbols);
|
||||
|
||||
Gen : Random_Elements.Generator;
|
||||
Period : constant Stream_Element_Offset := 200;
|
||||
-- Period constant variable for random generator not to be very random.
|
||||
-- Bigger period, harder random.
|
||||
|
||||
Read_Buffer : Stream_Element_Array (1 .. 2048);
|
||||
Read_First : Stream_Element_Offset;
|
||||
Read_Last : Stream_Element_Offset;
|
||||
|
||||
procedure Reset;
|
||||
|
||||
procedure Read
|
||||
(Item : out Stream_Element_Array;
|
||||
Last : out Stream_Element_Offset);
|
||||
-- this procedure is for generic instantiation of
|
||||
-- ZLib.Read
|
||||
-- reading data from the File_In.
|
||||
|
||||
procedure Read is new ZLib.Read
|
||||
(Read,
|
||||
Read_Buffer,
|
||||
Rest_First => Read_First,
|
||||
Rest_Last => Read_Last);
|
||||
|
||||
----------
|
||||
-- Read --
|
||||
----------
|
||||
|
||||
procedure Read
|
||||
(Item : out Stream_Element_Array;
|
||||
Last : out Stream_Element_Offset) is
|
||||
begin
|
||||
Last := Stream_Element_Offset'Min
|
||||
(Item'Last,
|
||||
Item'First + File_Size - Offset);
|
||||
|
||||
for J in Item'First .. Last loop
|
||||
if J < Item'First + Period then
|
||||
Item (J) := Random_Elements.Random (Gen);
|
||||
else
|
||||
Item (J) := Item (J - Period);
|
||||
end if;
|
||||
|
||||
Offset := Offset + 1;
|
||||
end loop;
|
||||
end Read;
|
||||
|
||||
-----------
|
||||
-- Reset --
|
||||
-----------
|
||||
|
||||
procedure Reset is
|
||||
begin
|
||||
Random_Elements.Reset (Gen, Init_Random);
|
||||
Pack_Size := 0;
|
||||
Offset := 1;
|
||||
Read_First := Read_Buffer'Last + 1;
|
||||
Read_Last := Read_Buffer'Last;
|
||||
end Reset;
|
||||
|
||||
begin
|
||||
Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
|
||||
|
||||
loop
|
||||
for Level in ZLib.Compression_Level'Range loop
|
||||
|
||||
Ada.Text_IO.Put ("Level ="
|
||||
& ZLib.Compression_Level'Image (Level));
|
||||
|
||||
-- Deflate using generic instantiation.
|
||||
|
||||
ZLib.Deflate_Init
|
||||
(Filter,
|
||||
Level,
|
||||
Header => Header);
|
||||
|
||||
Reset;
|
||||
|
||||
Ada.Text_IO.Put
|
||||
(Stream_Element_Offset'Image (File_Size) & " ->");
|
||||
|
||||
loop
|
||||
declare
|
||||
Buffer : Stream_Element_Array (1 .. 1024);
|
||||
Last : Stream_Element_Offset;
|
||||
begin
|
||||
Read (Filter, Buffer, Last);
|
||||
|
||||
Pack_Size := Pack_Size + Last - Buffer'First + 1;
|
||||
|
||||
exit when Last < Buffer'Last;
|
||||
end;
|
||||
end loop;
|
||||
|
||||
Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size));
|
||||
|
||||
ZLib.Close (Filter);
|
||||
end loop;
|
||||
|
||||
exit when not Continuous;
|
||||
|
||||
File_Size := File_Size + 1;
|
||||
end loop;
|
||||
end Read;
|
65
software/scsi2sd-util/zlib-1.2.8/contrib/ada/readme.txt
Normal file
65
software/scsi2sd-util/zlib-1.2.8/contrib/ada/readme.txt
Normal file
@ -0,0 +1,65 @@
|
||||
ZLib for Ada thick binding (ZLib.Ada)
|
||||
Release 1.3
|
||||
|
||||
ZLib.Ada is a thick binding interface to the popular ZLib data
|
||||
compression library, available at http://www.gzip.org/zlib/.
|
||||
It provides Ada-style access to the ZLib C library.
|
||||
|
||||
|
||||
Here are the main changes since ZLib.Ada 1.2:
|
||||
|
||||
- Attension: ZLib.Read generic routine have a initialization requirement
|
||||
for Read_Last parameter now. It is a bit incompartible with previous version,
|
||||
but extends functionality, we could use new parameters Allow_Read_Some and
|
||||
Flush now.
|
||||
|
||||
- Added Is_Open routines to ZLib and ZLib.Streams packages.
|
||||
|
||||
- Add pragma Assert to check Stream_Element is 8 bit.
|
||||
|
||||
- Fix extraction to buffer with exact known decompressed size. Error reported by
|
||||
Steve Sangwine.
|
||||
|
||||
- Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits
|
||||
computers. Patch provided by Pascal Obry.
|
||||
|
||||
- Add Status_Error exception definition.
|
||||
|
||||
- Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit.
|
||||
|
||||
|
||||
How to build ZLib.Ada under GNAT
|
||||
|
||||
You should have the ZLib library already build on your computer, before
|
||||
building ZLib.Ada. Make the directory of ZLib.Ada sources current and
|
||||
issue the command:
|
||||
|
||||
gnatmake test -largs -L<directory where libz.a is> -lz
|
||||
|
||||
Or use the GNAT project file build for GNAT 3.15 or later:
|
||||
|
||||
gnatmake -Pzlib.gpr -L<directory where libz.a is>
|
||||
|
||||
|
||||
How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2
|
||||
|
||||
1. Make a project with all *.ads and *.adb files from the distribution.
|
||||
2. Build the libz.a library from the ZLib C sources.
|
||||
3. Rename libz.a to z.lib.
|
||||
4. Add the library z.lib to the project.
|
||||
5. Add the libc.lib library from the ObjectAda distribution to the project.
|
||||
6. Build the executable using test.adb as a main procedure.
|
||||
|
||||
|
||||
How to use ZLib.Ada
|
||||
|
||||
The source files test.adb and read.adb are small demo programs that show
|
||||
the main functionality of ZLib.Ada.
|
||||
|
||||
The routines from the package specifications are commented.
|
||||
|
||||
|
||||
Homepage: http://zlib-ada.sourceforge.net/
|
||||
Author: Dmitriy Anisimkov <anisimkov@yahoo.com>
|
||||
|
||||
Contributors: Pascal Obry <pascal@obry.org>, Steve Sangwine <sjs@essex.ac.uk>
|
463
software/scsi2sd-util/zlib-1.2.8/contrib/ada/test.adb
Normal file
463
software/scsi2sd-util/zlib-1.2.8/contrib/ada/test.adb
Normal file
@ -0,0 +1,463 @@
|
||||
----------------------------------------------------------------
|
||||
-- ZLib for Ada thick binding. --
|
||||
-- --
|
||||
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
|
||||
-- --
|
||||
-- Open source license information is in the zlib.ads file. --
|
||||
----------------------------------------------------------------
|
||||
|
||||
-- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $
|
||||
|
||||
-- The program has a few aims.
|
||||
-- 1. Test ZLib.Ada95 thick binding functionality.
|
||||
-- 2. Show the example of use main functionality of the ZLib.Ada95 binding.
|
||||
-- 3. Build this program automatically compile all ZLib.Ada95 packages under
|
||||
-- GNAT Ada95 compiler.
|
||||
|
||||
with ZLib.Streams;
|
||||
with Ada.Streams.Stream_IO;
|
||||
with Ada.Numerics.Discrete_Random;
|
||||
|
||||
with Ada.Text_IO;
|
||||
|
||||
with Ada.Calendar;
|
||||
|
||||
procedure Test is
|
||||
|
||||
use Ada.Streams;
|
||||
use Stream_IO;
|
||||
|
||||
------------------------------------
|
||||
-- Test configuration parameters --
|
||||
------------------------------------
|
||||
|
||||
File_Size : Count := 100_000;
|
||||
Continuous : constant Boolean := False;
|
||||
|
||||
Header : constant ZLib.Header_Type := ZLib.Default;
|
||||
-- ZLib.None;
|
||||
-- ZLib.Auto;
|
||||
-- ZLib.GZip;
|
||||
-- Do not use Header other then Default in ZLib versions 1.1.4
|
||||
-- and older.
|
||||
|
||||
Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy;
|
||||
Init_Random : constant := 10;
|
||||
|
||||
-- End --
|
||||
|
||||
In_File_Name : constant String := "testzlib.in";
|
||||
-- Name of the input file
|
||||
|
||||
Z_File_Name : constant String := "testzlib.zlb";
|
||||
-- Name of the compressed file.
|
||||
|
||||
Out_File_Name : constant String := "testzlib.out";
|
||||
-- Name of the decompressed file.
|
||||
|
||||
File_In : File_Type;
|
||||
File_Out : File_Type;
|
||||
File_Back : File_Type;
|
||||
File_Z : ZLib.Streams.Stream_Type;
|
||||
|
||||
Filter : ZLib.Filter_Type;
|
||||
|
||||
Time_Stamp : Ada.Calendar.Time;
|
||||
|
||||
procedure Generate_File;
|
||||
-- Generate file of spetsified size with some random data.
|
||||
-- The random data is repeatable, for the good compression.
|
||||
|
||||
procedure Compare_Streams
|
||||
(Left, Right : in out Root_Stream_Type'Class);
|
||||
-- The procedure compearing data in 2 streams.
|
||||
-- It is for compare data before and after compression/decompression.
|
||||
|
||||
procedure Compare_Files (Left, Right : String);
|
||||
-- Compare files. Based on the Compare_Streams.
|
||||
|
||||
procedure Copy_Streams
|
||||
(Source, Target : in out Root_Stream_Type'Class;
|
||||
Buffer_Size : in Stream_Element_Offset := 1024);
|
||||
-- Copying data from one stream to another. It is for test stream
|
||||
-- interface of the library.
|
||||
|
||||
procedure Data_In
|
||||
(Item : out Stream_Element_Array;
|
||||
Last : out Stream_Element_Offset);
|
||||
-- this procedure is for generic instantiation of
|
||||
-- ZLib.Generic_Translate.
|
||||
-- reading data from the File_In.
|
||||
|
||||
procedure Data_Out (Item : in Stream_Element_Array);
|
||||
-- this procedure is for generic instantiation of
|
||||
-- ZLib.Generic_Translate.
|
||||
-- writing data to the File_Out.
|
||||
|
||||
procedure Stamp;
|
||||
-- Store the timestamp to the local variable.
|
||||
|
||||
procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count);
|
||||
-- Print the time statistic with the message.
|
||||
|
||||
procedure Translate is new ZLib.Generic_Translate
|
||||
(Data_In => Data_In,
|
||||
Data_Out => Data_Out);
|
||||
-- This procedure is moving data from File_In to File_Out
|
||||
-- with compression or decompression, depend on initialization of
|
||||
-- Filter parameter.
|
||||
|
||||
-------------------
|
||||
-- Compare_Files --
|
||||
-------------------
|
||||
|
||||
procedure Compare_Files (Left, Right : String) is
|
||||
Left_File, Right_File : File_Type;
|
||||
begin
|
||||
Open (Left_File, In_File, Left);
|
||||
Open (Right_File, In_File, Right);
|
||||
Compare_Streams (Stream (Left_File).all, Stream (Right_File).all);
|
||||
Close (Left_File);
|
||||
Close (Right_File);
|
||||
end Compare_Files;
|
||||
|
||||
---------------------
|
||||
-- Compare_Streams --
|
||||
---------------------
|
||||
|
||||
procedure Compare_Streams
|
||||
(Left, Right : in out Ada.Streams.Root_Stream_Type'Class)
|
||||
is
|
||||
Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#);
|
||||
Left_Last, Right_Last : Stream_Element_Offset;
|
||||
begin
|
||||
loop
|
||||
Read (Left, Left_Buffer, Left_Last);
|
||||
Read (Right, Right_Buffer, Right_Last);
|
||||
|
||||
if Left_Last /= Right_Last then
|
||||
Ada.Text_IO.Put_Line ("Compare error :"
|
||||
& Stream_Element_Offset'Image (Left_Last)
|
||||
& " /= "
|
||||
& Stream_Element_Offset'Image (Right_Last));
|
||||
|
||||
raise Constraint_Error;
|
||||
|
||||
elsif Left_Buffer (0 .. Left_Last)
|
||||
/= Right_Buffer (0 .. Right_Last)
|
||||
then
|
||||
Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal.");
|
||||
raise Constraint_Error;
|
||||
|
||||
end if;
|
||||
|
||||
exit when Left_Last < Left_Buffer'Last;
|
||||
end loop;
|
||||
end Compare_Streams;
|
||||
|
||||
------------------
|
||||
-- Copy_Streams --
|
||||
------------------
|
||||
|
||||
procedure Copy_Streams
|
||||
(Source, Target : in out Ada.Streams.Root_Stream_Type'Class;
|
||||
Buffer_Size : in Stream_Element_Offset := 1024)
|
||||
is
|
||||
Buffer : Stream_Element_Array (1 .. Buffer_Size);
|
||||
Last : Stream_Element_Offset;
|
||||
begin
|
||||
loop
|
||||
Read (Source, Buffer, Last);
|
||||
Write (Target, Buffer (1 .. Last));
|
||||
|
||||
exit when Last < Buffer'Last;
|
||||
end loop;
|
||||
end Copy_Streams;
|
||||
|
||||
-------------
|
||||
-- Data_In --
|
||||
-------------
|
||||
|
||||
procedure Data_In
|
||||
(Item : out Stream_Element_Array;
|
||||
Last : out Stream_Element_Offset) is
|
||||
begin
|
||||
Read (File_In, Item, Last);
|
||||
end Data_In;
|
||||
|
||||
--------------
|
||||
-- Data_Out --
|
||||
--------------
|
||||
|
||||
procedure Data_Out (Item : in Stream_Element_Array) is
|
||||
begin
|
||||
Write (File_Out, Item);
|
||||
end Data_Out;
|
||||
|
||||
-------------------
|
||||
-- Generate_File --
|
||||
-------------------
|
||||
|
||||
procedure Generate_File is
|
||||
subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
|
||||
|
||||
package Random_Elements is
|
||||
new Ada.Numerics.Discrete_Random (Visible_Symbols);
|
||||
|
||||
Gen : Random_Elements.Generator;
|
||||
Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10;
|
||||
|
||||
Buffer_Count : constant Count := File_Size / Buffer'Length;
|
||||
-- Number of same buffers in the packet.
|
||||
|
||||
Density : constant Count := 30; -- from 0 to Buffer'Length - 2;
|
||||
|
||||
procedure Fill_Buffer (J, D : in Count);
|
||||
-- Change the part of the buffer.
|
||||
|
||||
-----------------
|
||||
-- Fill_Buffer --
|
||||
-----------------
|
||||
|
||||
procedure Fill_Buffer (J, D : in Count) is
|
||||
begin
|
||||
for K in 0 .. D loop
|
||||
Buffer
|
||||
(Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1))
|
||||
:= Random_Elements.Random (Gen);
|
||||
|
||||
end loop;
|
||||
end Fill_Buffer;
|
||||
|
||||
begin
|
||||
Random_Elements.Reset (Gen, Init_Random);
|
||||
|
||||
Create (File_In, Out_File, In_File_Name);
|
||||
|
||||
Fill_Buffer (1, Buffer'Length - 2);
|
||||
|
||||
for J in 1 .. Buffer_Count loop
|
||||
Write (File_In, Buffer);
|
||||
|
||||
Fill_Buffer (J, Density);
|
||||
end loop;
|
||||
|
||||
-- fill remain size.
|
||||
|
||||
Write
|
||||
(File_In,
|
||||
Buffer
|
||||
(1 .. Stream_Element_Offset
|
||||
(File_Size - Buffer'Length * Buffer_Count)));
|
||||
|
||||
Flush (File_In);
|
||||
Close (File_In);
|
||||
end Generate_File;
|
||||
|
||||
---------------------
|
||||
-- Print_Statistic --
|
||||
---------------------
|
||||
|
||||
procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is
|
||||
use Ada.Calendar;
|
||||
use Ada.Text_IO;
|
||||
|
||||
package Count_IO is new Integer_IO (ZLib.Count);
|
||||
|
||||
Curr_Dur : Duration := Clock - Time_Stamp;
|
||||
begin
|
||||
Put (Msg);
|
||||
|
||||
Set_Col (20);
|
||||
Ada.Text_IO.Put ("size =");
|
||||
|
||||
Count_IO.Put
|
||||
(Data_Size,
|
||||
Width => Stream_IO.Count'Image (File_Size)'Length);
|
||||
|
||||
Put_Line (" duration =" & Duration'Image (Curr_Dur));
|
||||
end Print_Statistic;
|
||||
|
||||
-----------
|
||||
-- Stamp --
|
||||
-----------
|
||||
|
||||
procedure Stamp is
|
||||
begin
|
||||
Time_Stamp := Ada.Calendar.Clock;
|
||||
end Stamp;
|
||||
|
||||
begin
|
||||
Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
|
||||
|
||||
loop
|
||||
Generate_File;
|
||||
|
||||
for Level in ZLib.Compression_Level'Range loop
|
||||
|
||||
Ada.Text_IO.Put_Line ("Level ="
|
||||
& ZLib.Compression_Level'Image (Level));
|
||||
|
||||
-- Test generic interface.
|
||||
Open (File_In, In_File, In_File_Name);
|
||||
Create (File_Out, Out_File, Z_File_Name);
|
||||
|
||||
Stamp;
|
||||
|
||||
-- Deflate using generic instantiation.
|
||||
|
||||
ZLib.Deflate_Init
|
||||
(Filter => Filter,
|
||||
Level => Level,
|
||||
Strategy => Strategy,
|
||||
Header => Header);
|
||||
|
||||
Translate (Filter);
|
||||
Print_Statistic ("Generic compress", ZLib.Total_Out (Filter));
|
||||
ZLib.Close (Filter);
|
||||
|
||||
Close (File_In);
|
||||
Close (File_Out);
|
||||
|
||||
Open (File_In, In_File, Z_File_Name);
|
||||
Create (File_Out, Out_File, Out_File_Name);
|
||||
|
||||
Stamp;
|
||||
|
||||
-- Inflate using generic instantiation.
|
||||
|
||||
ZLib.Inflate_Init (Filter, Header => Header);
|
||||
|
||||
Translate (Filter);
|
||||
Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter));
|
||||
|
||||
ZLib.Close (Filter);
|
||||
|
||||
Close (File_In);
|
||||
Close (File_Out);
|
||||
|
||||
Compare_Files (In_File_Name, Out_File_Name);
|
||||
|
||||
-- Test stream interface.
|
||||
|
||||
-- Compress to the back stream.
|
||||
|
||||
Open (File_In, In_File, In_File_Name);
|
||||
Create (File_Back, Out_File, Z_File_Name);
|
||||
|
||||
Stamp;
|
||||
|
||||
ZLib.Streams.Create
|
||||
(Stream => File_Z,
|
||||
Mode => ZLib.Streams.Out_Stream,
|
||||
Back => ZLib.Streams.Stream_Access
|
||||
(Stream (File_Back)),
|
||||
Back_Compressed => True,
|
||||
Level => Level,
|
||||
Strategy => Strategy,
|
||||
Header => Header);
|
||||
|
||||
Copy_Streams
|
||||
(Source => Stream (File_In).all,
|
||||
Target => File_Z);
|
||||
|
||||
-- Flushing internal buffers to the back stream.
|
||||
|
||||
ZLib.Streams.Flush (File_Z, ZLib.Finish);
|
||||
|
||||
Print_Statistic ("Write compress",
|
||||
ZLib.Streams.Write_Total_Out (File_Z));
|
||||
|
||||
ZLib.Streams.Close (File_Z);
|
||||
|
||||
Close (File_In);
|
||||
Close (File_Back);
|
||||
|
||||
-- Compare reading from original file and from
|
||||
-- decompression stream.
|
||||
|
||||
Open (File_In, In_File, In_File_Name);
|
||||
Open (File_Back, In_File, Z_File_Name);
|
||||
|
||||
ZLib.Streams.Create
|
||||
(Stream => File_Z,
|
||||
Mode => ZLib.Streams.In_Stream,
|
||||
Back => ZLib.Streams.Stream_Access
|
||||
(Stream (File_Back)),
|
||||
Back_Compressed => True,
|
||||
Header => Header);
|
||||
|
||||
Stamp;
|
||||
Compare_Streams (Stream (File_In).all, File_Z);
|
||||
|
||||
Print_Statistic ("Read decompress",
|
||||
ZLib.Streams.Read_Total_Out (File_Z));
|
||||
|
||||
ZLib.Streams.Close (File_Z);
|
||||
Close (File_In);
|
||||
Close (File_Back);
|
||||
|
||||
-- Compress by reading from compression stream.
|
||||
|
||||
Open (File_Back, In_File, In_File_Name);
|
||||
Create (File_Out, Out_File, Z_File_Name);
|
||||
|
||||
ZLib.Streams.Create
|
||||
(Stream => File_Z,
|
||||
Mode => ZLib.Streams.In_Stream,
|
||||
Back => ZLib.Streams.Stream_Access
|
||||
(Stream (File_Back)),
|
||||
Back_Compressed => False,
|
||||
Level => Level,
|
||||
Strategy => Strategy,
|
||||
Header => Header);
|
||||
|
||||
Stamp;
|
||||
Copy_Streams
|
||||
(Source => File_Z,
|
||||
Target => Stream (File_Out).all);
|
||||
|
||||
Print_Statistic ("Read compress",
|
||||
ZLib.Streams.Read_Total_Out (File_Z));
|
||||
|
||||
ZLib.Streams.Close (File_Z);
|
||||
|
||||
Close (File_Out);
|
||||
Close (File_Back);
|
||||
|
||||
-- Decompress to decompression stream.
|
||||
|
||||
Open (File_In, In_File, Z_File_Name);
|
||||
Create (File_Back, Out_File, Out_File_Name);
|
||||
|
||||
ZLib.Streams.Create
|
||||
(Stream => File_Z,
|
||||
Mode => ZLib.Streams.Out_Stream,
|
||||
Back => ZLib.Streams.Stream_Access
|
||||
(Stream (File_Back)),
|
||||
Back_Compressed => False,
|
||||
Header => Header);
|
||||
|
||||
Stamp;
|
||||
|
||||
Copy_Streams
|
||||
(Source => Stream (File_In).all,
|
||||
Target => File_Z);
|
||||
|
||||
Print_Statistic ("Write decompress",
|
||||
ZLib.Streams.Write_Total_Out (File_Z));
|
||||
|
||||
ZLib.Streams.Close (File_Z);
|
||||
Close (File_In);
|
||||
Close (File_Back);
|
||||
|
||||
Compare_Files (In_File_Name, Out_File_Name);
|
||||
end loop;
|
||||
|
||||
Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok.");
|
||||
|
||||
exit when not Continuous;
|
||||
|
||||
File_Size := File_Size + 1;
|
||||
end loop;
|
||||
end Test;
|
225
software/scsi2sd-util/zlib-1.2.8/contrib/ada/zlib-streams.adb
Normal file
225
software/scsi2sd-util/zlib-1.2.8/contrib/ada/zlib-streams.adb
Normal file
@ -0,0 +1,225 @@
|
||||
----------------------------------------------------------------
|
||||
-- ZLib for Ada thick binding. --
|
||||
-- --
|
||||
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
|
||||
-- --
|
||||
-- Open source license information is in the zlib.ads file. --
|
||||
----------------------------------------------------------------
|
||||
|
||||
-- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
|
||||
|
||||
with Ada.Unchecked_Deallocation;
|
||||
|
||||
package body ZLib.Streams is
|
||||
|
||||
-----------
|
||||
-- Close --
|
||||
-----------
|
||||
|
||||
procedure Close (Stream : in out Stream_Type) is
|
||||
procedure Free is new Ada.Unchecked_Deallocation
|
||||
(Stream_Element_Array, Buffer_Access);
|
||||
begin
|
||||
if Stream.Mode = Out_Stream or Stream.Mode = Duplex then
|
||||
-- We should flush the data written by the writer.
|
||||
|
||||
Flush (Stream, Finish);
|
||||
|
||||
Close (Stream.Writer);
|
||||
end if;
|
||||
|
||||
if Stream.Mode = In_Stream or Stream.Mode = Duplex then
|
||||
Close (Stream.Reader);
|
||||
Free (Stream.Buffer);
|
||||
end if;
|
||||
end Close;
|
||||
|
||||
------------
|
||||
-- Create --
|
||||
------------
|
||||
|
||||
procedure Create
|
||||
(Stream : out Stream_Type;
|
||||
Mode : in Stream_Mode;
|
||||
Back : in Stream_Access;
|
||||
Back_Compressed : in Boolean;
|
||||
Level : in Compression_Level := Default_Compression;
|
||||
Strategy : in Strategy_Type := Default_Strategy;
|
||||
Header : in Header_Type := Default;
|
||||
Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
|
||||
:= Default_Buffer_Size;
|
||||
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
|
||||
:= Default_Buffer_Size)
|
||||
is
|
||||
|
||||
subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size);
|
||||
|
||||
procedure Init_Filter
|
||||
(Filter : in out Filter_Type;
|
||||
Compress : in Boolean);
|
||||
|
||||
-----------------
|
||||
-- Init_Filter --
|
||||
-----------------
|
||||
|
||||
procedure Init_Filter
|
||||
(Filter : in out Filter_Type;
|
||||
Compress : in Boolean) is
|
||||
begin
|
||||
if Compress then
|
||||
Deflate_Init
|
||||
(Filter, Level, Strategy, Header => Header);
|
||||
else
|
||||
Inflate_Init (Filter, Header => Header);
|
||||
end if;
|
||||
end Init_Filter;
|
||||
|
||||
begin
|
||||
Stream.Back := Back;
|
||||
Stream.Mode := Mode;
|
||||
|
||||
if Mode = Out_Stream or Mode = Duplex then
|
||||
Init_Filter (Stream.Writer, Back_Compressed);
|
||||
Stream.Buffer_Size := Write_Buffer_Size;
|
||||
else
|
||||
Stream.Buffer_Size := 0;
|
||||
end if;
|
||||
|
||||
if Mode = In_Stream or Mode = Duplex then
|
||||
Init_Filter (Stream.Reader, not Back_Compressed);
|
||||
|
||||
Stream.Buffer := new Buffer_Subtype;
|
||||
Stream.Rest_First := Stream.Buffer'Last + 1;
|
||||
Stream.Rest_Last := Stream.Buffer'Last;
|
||||
end if;
|
||||
end Create;
|
||||
|
||||
-----------
|
||||
-- Flush --
|
||||
-----------
|
||||
|
||||
procedure Flush
|
||||
(Stream : in out Stream_Type;
|
||||
Mode : in Flush_Mode := Sync_Flush)
|
||||
is
|
||||
Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size);
|
||||
Last : Stream_Element_Offset;
|
||||
begin
|
||||
loop
|
||||
Flush (Stream.Writer, Buffer, Last, Mode);
|
||||
|
||||
Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
|
||||
|
||||
exit when Last < Buffer'Last;
|
||||
end loop;
|
||||
end Flush;
|
||||
|
||||
-------------
|
||||
-- Is_Open --
|
||||
-------------
|
||||
|
||||
function Is_Open (Stream : Stream_Type) return Boolean is
|
||||
begin
|
||||
return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer);
|
||||
end Is_Open;
|
||||
|
||||
----------
|
||||
-- Read --
|
||||
----------
|
||||
|
||||
procedure Read
|
||||
(Stream : in out Stream_Type;
|
||||
Item : out Stream_Element_Array;
|
||||
Last : out Stream_Element_Offset)
|
||||
is
|
||||
|
||||
procedure Read
|
||||
(Item : out Stream_Element_Array;
|
||||
Last : out Stream_Element_Offset);
|
||||
|
||||
----------
|
||||
-- Read --
|
||||
----------
|
||||
|
||||
procedure Read
|
||||
(Item : out Stream_Element_Array;
|
||||
Last : out Stream_Element_Offset) is
|
||||
begin
|
||||
Ada.Streams.Read (Stream.Back.all, Item, Last);
|
||||
end Read;
|
||||
|
||||
procedure Read is new ZLib.Read
|
||||
(Read => Read,
|
||||
Buffer => Stream.Buffer.all,
|
||||
Rest_First => Stream.Rest_First,
|
||||
Rest_Last => Stream.Rest_Last);
|
||||
|
||||
begin
|
||||
Read (Stream.Reader, Item, Last);
|
||||
end Read;
|
||||
|
||||
-------------------
|
||||
-- Read_Total_In --
|
||||
-------------------
|
||||
|
||||
function Read_Total_In (Stream : in Stream_Type) return Count is
|
||||
begin
|
||||
return Total_In (Stream.Reader);
|
||||
end Read_Total_In;
|
||||
|
||||
--------------------
|
||||
-- Read_Total_Out --
|
||||
--------------------
|
||||
|
||||
function Read_Total_Out (Stream : in Stream_Type) return Count is
|
||||
begin
|
||||
return Total_Out (Stream.Reader);
|
||||
end Read_Total_Out;
|
||||
|
||||
-----------
|
||||
-- Write --
|
||||
-----------
|
||||
|
||||
procedure Write
|
||||
(Stream : in out Stream_Type;
|
||||
Item : in Stream_Element_Array)
|
||||
is
|
||||
|
||||
procedure Write (Item : in Stream_Element_Array);
|
||||
|
||||
-----------
|
||||
-- Write --
|
||||
-----------
|
||||
|
||||
procedure Write (Item : in Stream_Element_Array) is
|
||||
begin
|
||||
Ada.Streams.Write (Stream.Back.all, Item);
|
||||
end Write;
|
||||
|
||||
procedure Write is new ZLib.Write
|
||||
(Write => Write,
|
||||
Buffer_Size => Stream.Buffer_Size);
|
||||
|
||||
begin
|
||||
Write (Stream.Writer, Item, No_Flush);
|
||||
end Write;
|
||||
|
||||
--------------------
|
||||
-- Write_Total_In --
|
||||
--------------------
|
||||
|
||||
function Write_Total_In (Stream : in Stream_Type) return Count is
|
||||
begin
|
||||
return Total_In (Stream.Writer);
|
||||
end Write_Total_In;
|
||||
|
||||
---------------------
|
||||
-- Write_Total_Out --
|
||||
---------------------
|
||||
|
||||
function Write_Total_Out (Stream : in Stream_Type) return Count is
|
||||
begin
|
||||
return Total_Out (Stream.Writer);
|
||||
end Write_Total_Out;
|
||||
|
||||
end ZLib.Streams;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user