some libmednahawk work. it can't possibly be used by anyone else yet, but i gotta do a checkin.
This commit is contained in:
parent
807b86f8b3
commit
b4b2657965
|
@ -75,6 +75,9 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\VersionInfo.cs">
|
||||
<Link>VersionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Buffer.cs" />
|
||||
<Compile Include="Computers\Commodore64\C64.core.cs" />
|
||||
<Compile Include="Computers\Commodore64\C64.cs" />
|
||||
|
@ -366,6 +369,8 @@
|
|||
<Compile Include="Consoles\PC Engine\MemoryMap.Populous.cs" />
|
||||
<Compile Include="Consoles\PC Engine\ScsiCDBus.cs" />
|
||||
<Compile Include="Consoles\PC Engine\TurboCD.cs" />
|
||||
<Compile Include="Consoles\PSX\LibMednahawkDll.cs" />
|
||||
<Compile Include="Consoles\PSX\Octoshock.cs" />
|
||||
<Compile Include="Consoles\Sega\Genesis\Cart\EEPROM.cs" />
|
||||
<Compile Include="Consoles\Sega\Genesis\Cart\RomHeader.cs" />
|
||||
<Compile Include="Consoles\Sega\Genesis\Cart\SaveRAM.cs" />
|
||||
|
@ -526,8 +531,8 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Computers\Commodore64\docs\" />
|
||||
<Folder Include="Consoles\PSX\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="Consoles\Atari\docs\stella.pdf" />
|
||||
<None Include="Consoles\Coleco\docs\colecovision tech1.pdf" />
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public unsafe static class LibMednahawkDll
|
||||
{
|
||||
public enum eProp : int
|
||||
{
|
||||
GetPtr_FramebufferPointer,
|
||||
GetPtr_FramebufferPitchPixels,
|
||||
GetPtr_FramebufferWidth,
|
||||
GetPtr_FramebufferHeight,
|
||||
SetPtr_FopenCallback,
|
||||
SetPtr_FcloseCallback,
|
||||
SetPtr_FopCallback
|
||||
}
|
||||
|
||||
public enum FOP: int
|
||||
{
|
||||
FOP_fread,
|
||||
FOP_fwrite,
|
||||
FOP_fflush,
|
||||
FOP_fseeko,
|
||||
FOP_ftello,
|
||||
FOP_ferror,
|
||||
FOP_clearerr,
|
||||
FOP_size
|
||||
};
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate IntPtr t_FopenCallback(string fname, string mode);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate int t_FcloseCallback(IntPtr fp);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate long t_FopCallback(int op, IntPtr ptr, long a, long b, IntPtr fp);
|
||||
|
||||
[DllImport("libmednahawk.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr dll_GetPropPtr(eProp prop);
|
||||
|
||||
[DllImport("libmednahawk.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void dll_SetPropPtr(eProp prop, IntPtr val);
|
||||
|
||||
[DllImport("libmednahawk.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static extern bool dll_Initialize();
|
||||
|
||||
[DllImport("libmednahawk.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void psx_FrameAdvance();
|
||||
|
||||
[DllImport("libmednahawk.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static extern bool psx_LoadCue(string path);
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.PSX
|
||||
{
|
||||
public unsafe class Octoshock : IEmulator, IVideoProvider, ISoundProvider
|
||||
{
|
||||
public string SystemId { get { return "NULL"; } }
|
||||
public static readonly ControllerDefinition NullController = new ControllerDefinition { Name = "Null Controller" };
|
||||
|
||||
private int[] frameBuffer = new int[0];
|
||||
private Random rand = new Random();
|
||||
public CoreInputComm CoreInputComm { get; set; }
|
||||
public CoreOutputComm CoreOutputComm { get; private set; }
|
||||
public IVideoProvider VideoProvider { get { return this; } }
|
||||
public ISoundProvider SoundProvider { get { return this; } }
|
||||
public ISyncSoundProvider SyncSoundProvider { get { return new FakeSyncSound(this, 735); } }
|
||||
public bool StartAsyncSound() { return true; }
|
||||
public void EndAsyncSound() { }
|
||||
|
||||
//we can only have one active core at a time, due to the lib being so static.
|
||||
//so we'll track the current one here and detach the previous one whenever a new one is booted up.
|
||||
static Octoshock CurrOctoshockCore;
|
||||
|
||||
bool disposed = false;
|
||||
public void Dispose()
|
||||
{
|
||||
if (disposed) return;
|
||||
disposed = true;
|
||||
|
||||
//BizHawk.Emulation.Consoles.Nintendo.SNES.LibsnesDll.snes_set_audio_sample(null);
|
||||
}
|
||||
|
||||
public Octoshock()
|
||||
{
|
||||
var domains = new List<MemoryDomain>();
|
||||
CoreOutputComm = new CoreOutputComm();
|
||||
CoreInputComm = new CoreInputComm();
|
||||
VirtualWidth = BufferWidth = 256;
|
||||
BufferHeight = 192;
|
||||
}
|
||||
|
||||
void Attach()
|
||||
{
|
||||
//attach this core as the current
|
||||
if (CurrOctoshockCore != null)
|
||||
CurrOctoshockCore.Dispose();
|
||||
CurrOctoshockCore = this;
|
||||
}
|
||||
|
||||
//note to self: try to make mednafen have file IO callbacks into here: open, close, read, write.
|
||||
//we'll trick mednafen into using a virtual filesystem and track the fake files internally
|
||||
|
||||
public void LoadCuePath(string path)
|
||||
{
|
||||
Attach();
|
||||
|
||||
//note to self:
|
||||
//consider loading a fake cue, which is generated by our Disc class, and converting all reads to the fake bin to reads into the disc class.
|
||||
//thatd be pretty cool.... (may need to add an absolute byte range read method into the disc class, which can traverse the requisite LBAs)...
|
||||
//...but... are there other ideas?
|
||||
LibMednahawkDll.psx_LoadCue(path);
|
||||
}
|
||||
|
||||
|
||||
static Octoshock()
|
||||
{
|
||||
LibMednahawkDll.dll_Initialize();
|
||||
|
||||
FopenCallback = new LibMednahawkDll.t_FopenCallback(FopenCallbackProc);
|
||||
FcloseCallback = new LibMednahawkDll.t_FcloseCallback(FcloseCallbackProc);
|
||||
FopCallback = new LibMednahawkDll.t_FopCallback(FopCallbackProc);
|
||||
LibMednahawkDll.dll_SetPropPtr(LibMednahawkDll.eProp.SetPtr_FopenCallback, Marshal.GetFunctionPointerForDelegate(FopenCallback));
|
||||
LibMednahawkDll.dll_SetPropPtr(LibMednahawkDll.eProp.SetPtr_FcloseCallback, Marshal.GetFunctionPointerForDelegate(FcloseCallback));
|
||||
LibMednahawkDll.dll_SetPropPtr(LibMednahawkDll.eProp.SetPtr_FopCallback, Marshal.GetFunctionPointerForDelegate(FopCallback));
|
||||
}
|
||||
|
||||
static LibMednahawkDll.t_FopenCallback FopenCallback;
|
||||
static LibMednahawkDll.t_FcloseCallback FcloseCallback;
|
||||
static LibMednahawkDll.t_FopCallback FopCallback;
|
||||
|
||||
class VirtualFile : IDisposable
|
||||
{
|
||||
public Stream stream;
|
||||
public int id;
|
||||
public void Dispose()
|
||||
{
|
||||
if(stream != null) stream.Dispose();
|
||||
stream = null;
|
||||
}
|
||||
}
|
||||
|
||||
static Dictionary<int, VirtualFile> VirtualFiles = new Dictionary<int, VirtualFile>();
|
||||
|
||||
static IntPtr FopenCallbackProc(string fname, string mode)
|
||||
{
|
||||
//TODO - probably this should never really fail. but for now, mednafen tries to create a bunch of junk, so just return failure for files which cant be opened
|
||||
|
||||
if (fname.StartsWith("$psx"))
|
||||
{
|
||||
string[] parts = fname.Split('/');
|
||||
if (parts[0] != "$psx") throw new InvalidOperationException("Octoshock using some weird path we dont handle yet");
|
||||
if (parts[1] == "firmware")
|
||||
{
|
||||
fname = Path.Combine(CurrOctoshockCore.CoreInputComm.PSX_FirmwaresPath, parts[2]);
|
||||
if (!File.Exists(fname))
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("the Octoshock core is referencing a firmware file which could not be found. Please make sure it's in your configured PSX firmwares folder. The referenced filename is: " + parts[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Stream stream = null;
|
||||
if (mode == "rb") { if (File.Exists(fname)) stream = new FileStream(fname, FileMode.Open, FileAccess.Read, FileShare.Read); }
|
||||
else if (mode == "wb") stream = new FileStream(fname, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
else throw new InvalidOperationException("unexpected virtual file mode from libmednahawk");
|
||||
|
||||
if (stream == null) return IntPtr.Zero;
|
||||
|
||||
//find a free id. dont use 0 because it looks like an error
|
||||
int id = 1;
|
||||
for (; ; )
|
||||
{
|
||||
RETRY:
|
||||
foreach (var vfid in VirtualFiles.Keys)
|
||||
if (vfid == id)
|
||||
{
|
||||
id++;
|
||||
goto RETRY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var ret = new VirtualFile();
|
||||
ret.id = id;
|
||||
ret.stream = stream;
|
||||
|
||||
VirtualFiles[ret.id] = ret;
|
||||
return new IntPtr(ret.id);
|
||||
}
|
||||
static int FcloseCallbackProc(IntPtr fp)
|
||||
{
|
||||
int id = fp.ToInt32();
|
||||
VirtualFiles[id].stream.Dispose();
|
||||
VirtualFiles.Remove(id);
|
||||
return 0;
|
||||
}
|
||||
static byte[] fiobuf = new byte[10*1024];
|
||||
static long FopCallbackProc(int op, IntPtr ptr, long a, long b, IntPtr fp)
|
||||
{
|
||||
var vf = VirtualFiles[fp.ToInt32()];
|
||||
int amt = (int)(a*b);
|
||||
switch ((LibMednahawkDll.FOP)op)
|
||||
{
|
||||
case LibMednahawkDll.FOP.FOP_clearerr: return 0;
|
||||
case LibMednahawkDll.FOP.FOP_ferror: return 0;
|
||||
case LibMednahawkDll.FOP.FOP_fflush: vf.stream.Flush(); return 0;
|
||||
case LibMednahawkDll.FOP.FOP_fread:
|
||||
{
|
||||
if(fiobuf.Length < amt)
|
||||
fiobuf = new byte[amt];
|
||||
int read = vf.stream.Read(fiobuf, 0, amt);
|
||||
Marshal.Copy(fiobuf, 0, ptr, amt);
|
||||
return read / a;
|
||||
}
|
||||
case LibMednahawkDll.FOP.FOP_fseeko:
|
||||
vf.stream.Seek(a, (SeekOrigin)b);
|
||||
return vf.stream.Position;
|
||||
case LibMednahawkDll.FOP.FOP_ftello:
|
||||
return vf.stream.Position;
|
||||
case LibMednahawkDll.FOP.FOP_fwrite:
|
||||
{
|
||||
if (fiobuf.Length < amt)
|
||||
fiobuf = new byte[amt];
|
||||
Marshal.Copy(fiobuf, 0, ptr, amt);
|
||||
vf.stream.Write(fiobuf, 0, amt);
|
||||
return (int)b;
|
||||
}
|
||||
case LibMednahawkDll.FOP.FOP_size: return vf.stream.Length;
|
||||
default:
|
||||
throw new InvalidOperationException("INESTIMABLE GOPHER");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ResetFrameCounter()
|
||||
{
|
||||
Frame = 0;
|
||||
}
|
||||
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
LibMednahawkDll.psx_FrameAdvance();
|
||||
|
||||
if (render == false) return;
|
||||
|
||||
int w = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferWidth).ToInt32();
|
||||
int h = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferHeight).ToInt32();
|
||||
int p = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferPitchPixels).ToInt32();
|
||||
IntPtr iptr = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferPointer);
|
||||
void* ptr = iptr.ToPointer();
|
||||
|
||||
|
||||
VirtualWidth = BufferWidth = w;
|
||||
BufferHeight = h;
|
||||
|
||||
int len = w*h;
|
||||
if (frameBuffer.Length != len)
|
||||
frameBuffer = new int[len];
|
||||
|
||||
//todo - we could do the reformatting in the PSX core
|
||||
//better yet, we could send a buffer into the psx core before frame advance to use for outputting video to
|
||||
|
||||
for (int y = 0, i = 0; y < h; y++)
|
||||
for (int x = 0; x < w; x++, i++)
|
||||
{
|
||||
frameBuffer[i] = (int)unchecked(((int*)ptr)[y * p + x] | (int)0xFF000000);
|
||||
}
|
||||
}
|
||||
public ControllerDefinition ControllerDefinition { get { return NullController; } }
|
||||
public IController Controller { get; set; }
|
||||
|
||||
public int Frame { get; set; }
|
||||
public int LagCount { get { return 0; } set { return; } }
|
||||
public bool IsLagFrame { get { return false; } }
|
||||
|
||||
public byte[] ReadSaveRam() { return null; }
|
||||
public void StoreSaveRam(byte[] data) { }
|
||||
public void ClearSaveRam() { }
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
public bool SaveRamModified { get; set; }
|
||||
public void SaveStateText(TextWriter writer) { }
|
||||
public void LoadStateText(TextReader reader) { }
|
||||
public void SaveStateBinary(BinaryWriter writer) { }
|
||||
public void LoadStateBinary(BinaryReader reader) { }
|
||||
public byte[] SaveStateBinary() { return new byte[1]; }
|
||||
public int[] GetVideoBuffer() { return frameBuffer; }
|
||||
public int VirtualWidth { get; private set; }
|
||||
public int BufferWidth { get; private set; }
|
||||
public int BufferHeight { get; private set; }
|
||||
public int BackgroundColor { get { return 0; } }
|
||||
public void GetSamples(short[] samples) { }
|
||||
public void DiscardSamples() { }
|
||||
public int MaxVolume { get; set; }
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
}
|
||||
|
||||
}
|
|
@ -150,37 +150,37 @@ namespace BizHawk.DiscSystem
|
|||
|
||||
// converts LBA to minute:second:frame format.
|
||||
//TODO - somewhat redundant with Timestamp, which is due for refactoring into something not cue-related
|
||||
public static void ConvertLBAtoMSF(int lba, out byte m, out byte s, out byte f)
|
||||
{
|
||||
lba += 150;
|
||||
m = (byte) (lba / 75 / 60);
|
||||
s = (byte) ((lba - (m * 75 * 60)) / 75);
|
||||
f = (byte) (lba - (m * 75 * 60) - (s * 75));
|
||||
}
|
||||
public static void ConvertLBAtoMSF(int lba, out byte m, out byte s, out byte f)
|
||||
{
|
||||
lba += 150;
|
||||
m = (byte)(lba / 75 / 60);
|
||||
s = (byte)((lba - (m * 75 * 60)) / 75);
|
||||
f = (byte)(lba - (m * 75 * 60) - (s * 75));
|
||||
}
|
||||
|
||||
// converts MSF to LBA offset
|
||||
public static int ConvertMSFtoLBA(byte m, byte s, byte f)
|
||||
{
|
||||
return f + (s*75) + (m*75*60) - 150;
|
||||
}
|
||||
// converts MSF to LBA offset
|
||||
public static int ConvertMSFtoLBA(byte m, byte s, byte f)
|
||||
{
|
||||
return f + (s * 75) + (m * 75 * 60) - 150;
|
||||
}
|
||||
|
||||
// gets an identifying hash. hashes the first 512 sectors of
|
||||
// the first data track on the disc.
|
||||
public string GetHash()
|
||||
{
|
||||
byte[] buffer = new byte[512*2352];
|
||||
foreach (var track in TOC.Sessions[0].Tracks)
|
||||
{
|
||||
if (track.TrackType == ETrackType.Audio)
|
||||
continue;
|
||||
// gets an identifying hash. hashes the first 512 sectors of
|
||||
// the first data track on the disc.
|
||||
public string GetHash()
|
||||
{
|
||||
byte[] buffer = new byte[512 * 2352];
|
||||
foreach (var track in TOC.Sessions[0].Tracks)
|
||||
{
|
||||
if (track.TrackType == ETrackType.Audio)
|
||||
continue;
|
||||
|
||||
int lba_len = Math.Min(track.length_aba, 512);
|
||||
for (int s=0; s<512 && s<track.length_aba; s++)
|
||||
ReadABA_2352(track.Indexes[1].aba + s, buffer, s*2352);
|
||||
int lba_len = Math.Min(track.length_aba, 512);
|
||||
for (int s = 0; s < 512 && s < track.length_aba; s++)
|
||||
ReadABA_2352(track.Indexes[1].aba + s, buffer, s * 2352);
|
||||
|
||||
return Util.Hash_MD5(buffer, 0, lba_len*2352);
|
||||
}
|
||||
return "no data track found";
|
||||
}
|
||||
return Util.Hash_MD5(buffer, 0, lba_len * 2352);
|
||||
}
|
||||
return "no data track found";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
namespace BizHawk.DiscSystem
|
||||
//Currently, this is stolen somewhat from blargg's code. probably LGPL. I think? originally it came from mednafen, and then I think mednafen may have changed to use another.
|
||||
//sorry for the confusion! it'd be nice to have some nice MIT licensed CD algorithms codes.. at least, we can keep these bullshit licensed ones here to a/b test when rewriting.
|
||||
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
static class ECM
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace BizHawk
|
|||
public bool GG_ShowClippedRegions;
|
||||
public bool GG_HighlightActiveDisplayRegion;
|
||||
|
||||
public string PSX_FirmwaresPath;
|
||||
public string SNES_FirmwaresPath;
|
||||
public bool SNES_ShowBG1_0, SNES_ShowBG2_0, SNES_ShowBG3_0, SNES_ShowBG4_0;
|
||||
public bool SNES_ShowBG1_1, SNES_ShowBG2_1, SNES_ShowBG3_1, SNES_ShowBG4_1;
|
||||
|
@ -42,6 +43,8 @@ namespace BizHawk
|
|||
}
|
||||
public int VsyncNum = 60;
|
||||
public int VsyncDen = 1;
|
||||
|
||||
//a core should set these if you wish to provide rom status information yourself. otherwise it will be calculated by the frontend in a way you may not like, using RomGame-related concepts.
|
||||
public string RomStatusAnnotation;
|
||||
public string RomStatusDetails;
|
||||
|
||||
|
|
|
@ -29,8 +29,3 @@ using System.Runtime.InteropServices;
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion(VersionInfo.MAINVERSION + "." + SubWCRev.SVN_REV)]
|
||||
[assembly: AssemblyFileVersion(VersionInfo.MAINVERSION + "." + SubWCRev.SVN_REV)]
|
||||
|
||||
public static class VersionInfo
|
||||
{
|
||||
public const string MAINVERSION = "1.2.0";
|
||||
}
|
|
@ -143,6 +143,14 @@ namespace BizHawk.MultiClient
|
|||
public string PathAtariScreenshots = Path.Combine(".", "Screenshots");
|
||||
public string PathAtariCheats = Path.Combine(".", "Cheats");
|
||||
|
||||
public string BasePSX = Path.Combine(".", "PSX");
|
||||
public string PathPSXROMs = ".";
|
||||
public string PathPSXSavestates = Path.Combine(".", "State");
|
||||
public string PathPSXSaveRAM = Path.Combine(".", "SaveRAM");
|
||||
public string PathPSXScreenshots = Path.Combine(".", "Screenshots");
|
||||
public string PathPSXCheats = Path.Combine(".", "Cheats");
|
||||
public string PathPSXFirmwares = Path.Combine(".", "Firmwares");
|
||||
|
||||
public string MoviesPath = Path.Combine(".", "Movies");
|
||||
public string MoviesBackupPath = Path.Combine(".", "Movies", "backup");
|
||||
public string LuaPath = Path.Combine(".", "Lua");
|
||||
|
|
|
@ -361,6 +361,8 @@ namespace BizHawk.MultiClient
|
|||
Global.CoreInputComm.SMS_ShowBG = Global.Config.SMSDispBG;
|
||||
Global.CoreInputComm.SMS_ShowOBJ = Global.Config.SMSDispOBJ;
|
||||
|
||||
Global.CoreInputComm.PSX_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.PathPSXFirmwares, "PSX");
|
||||
|
||||
Global.CoreInputComm.SNES_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.PathSNESFirmwares, "SNES");
|
||||
Global.CoreInputComm.SNES_ShowBG1_0 = Global.Config.SNES_ShowBG1_0;
|
||||
Global.CoreInputComm.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_1;
|
||||
|
@ -1433,14 +1435,34 @@ namespace BizHawk.MultiClient
|
|||
// In the future we need to do something smarter, possibly including simply asking the user
|
||||
// what system the game is for.
|
||||
|
||||
game = new GameInfo();
|
||||
game.System = "PCECD";
|
||||
game.Name = Path.GetFileNameWithoutExtension(file.Name);
|
||||
game.Hash = hash;
|
||||
if (System.Windows.Forms.SystemInformation.ComputerName == "ZERO-XP")
|
||||
{
|
||||
game = new GameInfo();
|
||||
game.System = "PSX";
|
||||
game.Name = Path.GetFileNameWithoutExtension(file.Name);
|
||||
game.Hash = hash;
|
||||
}
|
||||
else
|
||||
{
|
||||
game = new GameInfo();
|
||||
game.System = "PCECD";
|
||||
game.Name = Path.GetFileNameWithoutExtension(file.Name);
|
||||
game.Hash = hash;
|
||||
}
|
||||
}
|
||||
|
||||
switch (game.System)
|
||||
{
|
||||
case "PSX":
|
||||
{
|
||||
var psx = new BizHawk.Emulation.Consoles.PSX.Octoshock();
|
||||
nextEmulator = psx;
|
||||
psx.CoreInputComm = Global.CoreInputComm;
|
||||
psx.LoadCuePath(file.CanonicalFullPath);
|
||||
nextEmulator.CoreOutputComm.RomStatusDetails = "PSX etc.";
|
||||
}
|
||||
break;
|
||||
|
||||
case "PCE":
|
||||
case "PCECD":
|
||||
{
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
switch (system)
|
||||
{
|
||||
case "PSX":
|
||||
return Global.Config.BasePSX;
|
||||
case "INTV":
|
||||
return Global.Config.BaseINTV;
|
||||
case "A26":
|
||||
|
@ -212,8 +214,11 @@ namespace BizHawk.MultiClient
|
|||
|
||||
switch (sysID)
|
||||
{
|
||||
case "PSX":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathPSXROMs, "PSX");
|
||||
break;
|
||||
case "INTV":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathSNESROMs, "INTV");
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathINTVROMs, "INTV");
|
||||
break;
|
||||
case "SNES":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathSNESROMs, "SNES");
|
||||
|
@ -287,7 +292,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
switch (game.System)
|
||||
{
|
||||
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtariSaveRAM, "INTV"), name + ".SaveRAM");
|
||||
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVSaveRAM, "INTV"), name + ".SaveRAM");
|
||||
case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtariSaveRAM, "A26"), name + ".SaveRAM");
|
||||
case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSaveRAM, "SMS"), name + ".SaveRAM");
|
||||
case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSaveRAM, "GG"), name + ".SaveRAM");
|
||||
|
@ -300,6 +305,7 @@ namespace BizHawk.MultiClient
|
|||
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), name + ".SaveRAM");
|
||||
case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), name + ".SaveRAM");
|
||||
case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESSaveRAM, "SNES"), name + ".SaveRAM");
|
||||
case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXSaveRAM, "PSX"), name + ".SaveRAM");
|
||||
default: return Path.Combine(GetBasePathAbsolute(), name + ".SaveRAM");
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +315,7 @@ namespace BizHawk.MultiClient
|
|||
switch (game.System)
|
||||
{
|
||||
default: return GetRomsPath(game.System);
|
||||
case "INTV": return MakeAbsolutePath(Global.Config.PathAtariSavestates, "INTV");
|
||||
case "INTV": return MakeAbsolutePath(Global.Config.PathINTVSavestates, "INTV");
|
||||
case "A26": return MakeAbsolutePath(Global.Config.PathAtariSavestates, "A26");
|
||||
case "SMS": return MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS");
|
||||
case "GG": return MakeAbsolutePath(Global.Config.PathGGSavestates, "GG");
|
||||
|
@ -322,6 +328,7 @@ namespace BizHawk.MultiClient
|
|||
case "NES": return MakeAbsolutePath(Global.Config.PathNESSavestates, "NES");
|
||||
case "TI83": return MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83");
|
||||
case "SNES": return MakeAbsolutePath(Global.Config.PathSNESSavestates, "SNES");
|
||||
case "PSX": return MakeAbsolutePath(Global.Config.PathPSXSavestates, "PSX");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,7 +343,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
switch (game.System)
|
||||
{
|
||||
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtariSavestates, "INTV"), name);
|
||||
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVSavestates, "INTV"), name);
|
||||
case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtariSavestates, "A26"), name);
|
||||
case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), name);
|
||||
case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"), name);
|
||||
|
@ -349,6 +356,7 @@ namespace BizHawk.MultiClient
|
|||
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name);
|
||||
case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), name);
|
||||
case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESSavestates, "SNES"), name);
|
||||
case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXSavestates, "PSX"), name);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -358,7 +366,7 @@ namespace BizHawk.MultiClient
|
|||
string name = FilesystemSafeName(game);
|
||||
switch (game.System)
|
||||
{
|
||||
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtariScreenshots, "INTV"), name);
|
||||
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVScreenshots, "INTV"), name);
|
||||
case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtariScreenshots, "A26"), name);
|
||||
case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS"), name);
|
||||
case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG"), name);
|
||||
|
@ -371,6 +379,7 @@ namespace BizHawk.MultiClient
|
|||
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name);
|
||||
case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83"), name);
|
||||
case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESScreenshots, "SNES"), name);
|
||||
case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXScreenshots, "PSX"), name);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -71,6 +71,9 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\VersionInfo.cs">
|
||||
<Link>VersionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="7z\ArchiveEmulationStreamProxy.cs" />
|
||||
<Compile Include="7z\ArchiveExtractCallback.cs" />
|
||||
<Compile Include="7z\ArchiveOpenCallback.cs" />
|
||||
|
@ -178,12 +181,6 @@
|
|||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BizHawk.Emulation\BizHawk.Emulation.csproj">
|
||||
<Project>{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}</Project>
|
||||
<Name>BizHawk.Emulation</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">"$(SolutionDir)subwcrev.bat" "$(ProjectDir)"</PreBuildEvent>
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Emulation", "BizHawk.Emulation\BizHawk.Emulation.csproj", "{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D} = {B014CA7A-DC5F-404C-8614-3378CD02E17D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Util", "BizHawk.Util\BizHawk.Util.csproj", "{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.MultiClient", "BizHawk.MultiClient\BizHawk.MultiClient.csproj", "{DD448B37-BA3F-4544-9754-5406E8094723}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscoHawk", "DiscoHawk\DiscoHawk.csproj", "{C4366030-6D03-424B-AE53-F4F43BB217C3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmednahawk", "libmednahawk\libmednahawk.vcxproj", "{B014CA7A-DC5F-404C-8614-3378CD02E17D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release FastBuild|Any CPU = Release FastBuild|Any CPU
|
||||
Release FastBuild|Mixed Platforms = Release FastBuild|Mixed Platforms
|
||||
Release FastBuild|Win32 = Release FastBuild|Win32
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release FastBuild|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release FastBuild|Any CPU.Build.0 = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release FastBuild|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release FastBuild|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release FastBuild|Win32.ActiveCfg = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}.Release|Win32.Build.0 = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release FastBuild|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release FastBuild|Any CPU.Build.0 = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release FastBuild|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release FastBuild|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release FastBuild|Win32.ActiveCfg = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{EE135301-08B3-4EFC-A61C-1C53E1C65CB9}.Release|Win32.Build.0 = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release FastBuild|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release FastBuild|Any CPU.Build.0 = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release FastBuild|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release FastBuild|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release FastBuild|Win32.ActiveCfg = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{DD448B37-BA3F-4544-9754-5406E8094723}.Release|Win32.Build.0 = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release FastBuild|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release FastBuild|Any CPU.Build.0 = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release FastBuild|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release FastBuild|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release FastBuild|Win32.ActiveCfg = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{C4366030-6D03-424B-AE53-F4F43BB217C3}.Release|Win32.Build.0 = Release|Any CPU
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release FastBuild|Any CPU.ActiveCfg = Release FastBuild|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release FastBuild|Mixed Platforms.ActiveCfg = Release FastBuild|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release FastBuild|Mixed Platforms.Build.0 = Release FastBuild|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release FastBuild|Win32.ActiveCfg = Release FastBuild|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release FastBuild|Win32.Build.0 = Release FastBuild|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B014CA7A-DC5F-404C-8614-3378CD02E17D}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = BizHawk.MultiClient\BizHawk.MultiClient.csproj
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -74,6 +74,9 @@
|
|||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Compile Include="..\VersionInfo.cs">
|
||||
<Link>VersionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="About.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,341 @@
|
|||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) 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
|
||||
this service 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 make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE 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.
|
||||
|
||||
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
|
||||
convey 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 2 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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision 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, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This 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 Library General
|
||||
Public License instead of this License.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
SUBDIRS = po intl src
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
EXTRA_DIST = m4/ChangeLog
|
|
@ -0,0 +1,834 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(top_srcdir)/configure \
|
||||
$(top_srcdir)/include/config.h.in \
|
||||
$(top_srcdir)/intl/Makefile.in ABOUT-NLS AUTHORS COPYING \
|
||||
ChangeLog INSTALL NEWS TODO compile config.guess config.rpath \
|
||||
config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/fcntl-o.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/threadlib.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/include/config.h
|
||||
CONFIG_CLEAN_FILES = intl/Makefile
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_CXXFLAGS = @AM_CXXFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASDEPMODE = @CCASDEPMODE@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GBA_EXTRA_FLAGS = @GBA_EXTRA_FLAGS@
|
||||
GENCAT = @GENCAT@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GLIBC2 = @GLIBC2@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
HAVE_ASPRINTF = @HAVE_ASPRINTF@
|
||||
HAVE_NEWLOCALE = @HAVE_NEWLOCALE@
|
||||
HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@
|
||||
HAVE_SNPRINTF = @HAVE_SNPRINTF@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
HAVE_WPRINTF = @HAVE_WPRINTF@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLBISON = @INTLBISON@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
INTL_DEFAULT_VERBOSITY = @INTL_DEFAULT_VERBOSITY@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
JACK_CFLAGS = @JACK_CFLAGS@
|
||||
JACK_LIBS = @JACK_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBCDIO_CFLAGS = @LIBCDIO_CFLAGS@
|
||||
LIBCDIO_LIBS = @LIBCDIO_LIBS@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBMULTITHREAD = @LIBMULTITHREAD@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPTH = @LIBPTH@
|
||||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MATH_OPTIMIZER_FLAGS = @MATH_OPTIMIZER_FLAGS@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MMX_CFLAGS = @MMX_CFLAGS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
|
||||
SNDFILE_LIBS = @SNDFILE_LIBS@
|
||||
SNES_EXTRA_CXXFLAGS = @SNES_EXTRA_CXXFLAGS@
|
||||
SNES_EXTRA_FLAGS = @SNES_EXTRA_FLAGS@
|
||||
SSE2_CFLAGS = @SSE2_CFLAGS@
|
||||
SSE3_CFLAGS = @SSE3_CFLAGS@
|
||||
SSE_CFLAGS = @SSE_CFLAGS@
|
||||
STRIP = @STRIP@
|
||||
TRIO_CFLAGS = @TRIO_CFLAGS@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARNING_FLAGS = @WARNING_FLAGS@
|
||||
WINDRES = @WINDRES@
|
||||
WOE32 = @WOE32@
|
||||
WOE32DLL = @WOE32DLL@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMKMF = @XMKMF@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = po intl src
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = m4/ChangeLog
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
include/config.h: include/stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f include/stamp-h1; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) include/stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
include/stamp-h1: $(top_srcdir)/include/config.h.in $(top_builddir)/config.status
|
||||
@rm -f include/stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status include/config.h
|
||||
$(top_srcdir)/include/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f include/stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f include/config.h include/stamp-h1
|
||||
intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
--with-included-gettext \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
|
||||
install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags tags-recursive uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,22 @@
|
|||
Compilation notes:
|
||||
gcc is generally required(Intel's compiler might work), and the compilers specified via CC and CXX must be the same
|
||||
version.
|
||||
|
||||
Using gcc 4.4.x(or newer, though Mednafen doesn't get as much testing with newer versions) is recommended; anything
|
||||
older than gcc 4.2.x may not work, and gcc 4.2.x has a nasty code generation bug that may pop up and trigger a
|
||||
program abort in an internal compiler regression test routine in Mednafen; though there is now some logic in the
|
||||
configure script to try to choose optimization options that won't trigger the bad code generation.
|
||||
|
||||
Reportedly, passing: --build=x86_64-apple-darwin`uname -r`
|
||||
to the configure script is necessary for building on Mac OS X to work properly.
|
||||
|
||||
|
||||
|
||||
Some notes on the source code:
|
||||
|
||||
The following system headers are included by including "mednafen.h", and always will be, so don't include them manually.
|
||||
assert.h (included in "types.h")
|
||||
inttypes.h (included in "types.h")
|
||||
stdlib.h
|
||||
stdio.h
|
||||
string.h
|
|
@ -0,0 +1,345 @@
|
|||
!!! Make sure all legal notices and licenses for DLLs are included in the Win32 binary distribution !!!
|
||||
|
||||
Document the major changes in Mednafen 0.9.0 over Mednafen 0.8.x somewhere(NEWS?). A list to get started:
|
||||
Sega Genesis/Mega Drive emulation, from Genesis Plus, Genesis Plus GX(EEPROM emulator, general information), Yabause(68K emulator), Gens(YM2612 emulator), and
|
||||
of course the Z80 emulator core from FUSE already used in SMS and NGP emulation.
|
||||
|
||||
Virtual Boy emulation(using the V810 emulator forked(and optimized and otherwise improved!) from Reality Boy ages ago for use in PC-FX emulation, along
|
||||
with original code for everything else).
|
||||
|
||||
Multi-threaded CD-ROM reading code.
|
||||
|
||||
Significantly more accurate(though not entirely perfect, and slower) PCE emulation.
|
||||
|
||||
The "pce_fast" emulation module, which is a fork of 0.8.x optimized for speed, at the expense of *generally*-unimportant accuracy.
|
||||
|
||||
Various accuracy improvements to PC-FX emulation, including ADPCM IRQ generation(fixes Sparkling Feather),
|
||||
correcting the ADPCM decoding algorithm, a new slightly more accurate V810 emulation mode to fix glitches in
|
||||
Chip Chan Kick and Kishin Douji Zenki FX, greatly improved accuracy of KING->RAINBOW block transfers, and an
|
||||
interrupt controller fix that allows for the BIOS PhotoCD player to work. The 2 switches on gamepads are also emulated
|
||||
now.
|
||||
|
||||
A new experimental/unstable video driver, "overlay".
|
||||
|
||||
"Slow forwarding" feature. Mednafen is too good for "slow-mo". ;b
|
||||
|
||||
Support for WSR(WonderSwan sound rip format) playback.
|
||||
|
||||
Support for RTC in GBA games(requires a "type" file).
|
||||
|
||||
!!! Initialize statically-allocated Blip_Buffer objects(via clear() method) and reset any corresponding last-value variables
|
||||
on game load for each emulated system.
|
||||
|
||||
Rewrite MDFNFILE in file.cpp to separate classes, ArchiveReader(takes a directory or archive filename) and ArchiveMemberReader(reads a file in a directory or a file
|
||||
in an archive).
|
||||
|
||||
Fix C68K generator to work correctly when cross-compiling to a platform whose binaries can't run(through automatic emulation)
|
||||
on the build platform.
|
||||
|
||||
In drivers/video.cpp, see if replacing "SDL_FillRect(screen, NULL, 0);" in ClearBackBuffer() with custom software-only
|
||||
code to clear it fixes framerate degradation problems on Windows when env var SDL_VIDEODRIVER=directx and setting vdriver=sdl
|
||||
Additionally, optimize ClearBackBuffer() to not clear parts of the screen that will be overwritten by normal non-OSD
|
||||
blitting, and do testing for the vdriver=overlay case.
|
||||
|
||||
In drivers/video.cpp, allocate video scaler pixel buffers separately from the SDL_Surface itself, and realloc() to larger
|
||||
sizes when necessary(but never realloc() to smaller sizes), and free() only on video deinitialization.
|
||||
|
||||
Add a setting to disallow joystick(or keyboard even) input when focus is lost.
|
||||
|
||||
Switch hotkey/command key processing over to be event-based rather than instantaneous-state based. Consider implications for ckdelay, hotkey
|
||||
logical AND mode.
|
||||
|
||||
Systems with RTC emulation: Fix code to NOT use localtime(), which has consistency issues due to relying on external state(IE time zones), at
|
||||
any time other than virtual power toggle/init.
|
||||
|
||||
YM2612:
|
||||
Timer fixes?
|
||||
|
||||
Internationalization issues:
|
||||
Radix(decimal point) character:
|
||||
Remove world_strtod().
|
||||
Use trio functions solely for string<->floating-point conversion(in settings code), and ensure that trio is using the current locale.
|
||||
|
||||
Alter similar translatable strings in various emulation modules to be the same strings.
|
||||
|
||||
Ensure all important translatable strings are marked as such.
|
||||
|
||||
Update Russian and German translations.
|
||||
|
||||
Filesystem character coding vs UTF8 internal encoding vs locale.
|
||||
|
||||
Replace string/ConvertUTF.cpp with iconv() usage.
|
||||
|
||||
Wrap iconv() in C++ classes.
|
||||
|
||||
Documentation:
|
||||
Document systems with a debugger available.
|
||||
|
||||
Netplay:
|
||||
Simplify name resolution and eventually remove hackish-sort-preference for IPv4 addresses over IPv6(in 2014 maybe?), split functionality
|
||||
into different components:
|
||||
NetServer (maybe, to support *potentially* lower-latency P2P-style netplay)
|
||||
NetClient (keep, and rework, select() type functionality in this class)
|
||||
|-NetAddress
|
||||
|-NetConnection
|
||||
|
||||
Consider handling a recv() return value of 0 differently.
|
||||
|
||||
|
||||
Settings:
|
||||
Quote(and escape) string-type settings in the configuration file.
|
||||
|
||||
Protect settings structures and objects with mutexes(for thread safety when using MDFNI_SetSetting() while the emulator is running)
|
||||
|
||||
Optional manually-created per-game setting override files(or one big database file per system?).
|
||||
|
||||
Save some emulation-related settings in save states, and temporarily(until another save state load, or a virtual power toggle via F11) make
|
||||
them active. Consider implications for netplay, state rewinding, and PSX memory card emulation(slots can be disabled via settings).
|
||||
Would require revamping large amounts of code.
|
||||
|
||||
|
||||
Video:
|
||||
Refactor hq2x, scale2x, 2xsai, etc. filtering code into classes based off an abstract base class.
|
||||
|
||||
Add a "tblur.handle_gamma" setting that, when enabled, will cause gamma-correct temporal blurring.
|
||||
|
||||
Sound:
|
||||
Handle sound being disabled.
|
||||
|
||||
Open sound device in the game thread, and close it in the game thread, since the game thread is what writes to it.
|
||||
|
||||
Backup memory:
|
||||
SRAM delta log and/or backing up of previous save game files.
|
||||
|
||||
PCE_FAST:
|
||||
MWR latching!
|
||||
|
||||
|
||||
PCE:
|
||||
<AamirM> <Ki_> one thing about timer inside the HuC6280
|
||||
<AamirM> <Ki_> the 7-bit timer is decremented when MSB of the prescaler changes from 1 to 0.
|
||||
<AamirM> <Ki_> (assuming the prescaler is an up counter)
|
||||
<AamirM> <Ki_> the prescaler seems to be a 10-bit counter
|
||||
<AamirM> <Ki_> which is reset to zero when zero is written to the control bit ($0c01.bit0)
|
||||
<AamirM> <Ki_> if the control bit is written to zero when the prescaler is greater than 512 (i.e. the MSB is 1),
|
||||
<AamirM> <Ki_> prescaler is reset and the MSB changes from 1 --> 0
|
||||
<AamirM> <AamirM> ah..so the timer decrements
|
||||
<AamirM> <Ki_> exactly
|
||||
<AamirM> <Ki_> and if the timer value was zero at that point, /TIRQ will be asserted
|
||||
|
||||
Fix HuC6280 op TMA with multiple bits set.
|
||||
|
||||
Determine startup state of various chips(including PSG).
|
||||
|
||||
Fix sprite 0 IRQ timing.
|
||||
|
||||
Ensure all state is being saved to save states.
|
||||
|
||||
Fix VRAM->VRAM DMA, SAT DMA timing, and CPU-halting handling with new information from tests on a real system.
|
||||
|
||||
Fix broken SuperGrafx window emulation.
|
||||
|
||||
If power/reset is triggered in the debugger, force a return from MDFNI_Emulate(); either that or clear
|
||||
the audio buffer on power/reset. To fix a potential sound buffer overflow issue. (Actually, that won't happen
|
||||
as-is, but
|
||||
|
||||
Emulate disabled button/output when CLR is active on gamepad reads(might need to adjust the multitap code
|
||||
to buffer data in this case?).
|
||||
|
||||
Double-check timer IRQ semantics vs real system(what reads and writes acknowledge IRQs, cli-then-ack behavior,
|
||||
mask register write effective delay, etc.).
|
||||
|
||||
GBA:
|
||||
GSF multiboot support, and make sure it works(and GSF loading in general) on big-endian platforms.
|
||||
|
||||
SMS:
|
||||
Rewrite VDP execution loop so events happen on the correct cycles more or less, and to remove the ugly IRQ-versus-
|
||||
IRQ-bit-status-poll hacks. Use "z80_tstates" to do this.
|
||||
|
||||
Simplify and improve(including TH latching of VDP H-counter) IO emulation, and use Genesis controller/gamepad
|
||||
code(abstract it out of the Genesis code, into hw_input/sega_db9/* or something similar)
|
||||
|
||||
Galactic Protector input when FM sound is enabled.
|
||||
|
||||
Actually save/restore YM2413 data in save states.
|
||||
|
||||
NGP:
|
||||
Implement low-level BIOS and auxillary hardware emulation, with information provided by Judge.
|
||||
|
||||
VB:
|
||||
Check if Red Alarm's sound effects are supposed to be totally wonky when various sound effects "overlap".
|
||||
|
||||
Look into getting VIP SCANRDY status bit emulated correctly.
|
||||
|
||||
Genesis:
|
||||
Fix VDP H-counter read value(write test program if necessary).
|
||||
|
||||
Add Z80 IRQ ack hack which can be controlled by a setting.
|
||||
|
||||
Event system in C68K, fix possible problems with excessively long 68K instructions and the Z80 IRQ
|
||||
not being handled.
|
||||
|
||||
Mouse emulation is borked, fix it.
|
||||
|
||||
Implement "Virtua Racing" SVP emulation via code supplied by notaz.
|
||||
|
||||
PC-FX:
|
||||
cdrom/scsicd.cpp
|
||||
Allow commands that require medium access to complete successfully if there's no disc present and
|
||||
the "alloc size" field is 0.
|
||||
|
||||
Generate SCSI errors when reserved fields are set to something other than 0(especially cdb[1] and the final cdb
|
||||
entry).
|
||||
|
||||
Complete mode page emulation: especially the CD audio control page, tests need to be done on the real
|
||||
system to see if the volume fields have any effect, and if it's possible to have both L and R channels active
|
||||
(0x3) on a single output port, or if only one is allowed per output port.
|
||||
|
||||
Determine what data command 0xDE, mode 0x03, match 0xB0 is returning(the PhotoCD player uses it, it may
|
||||
contain information encoding the LBA of the filesystem).
|
||||
Doing this will require obtaining various CD-i, CD-i Ready, and PhotoCD discs for examination.
|
||||
|
||||
Command 0x42(READ SUB-CHANNEL):
|
||||
Add proper MCN and ISRC support.
|
||||
|
||||
Figure out the weirdness when the ISRC is requested for a data track.
|
||||
|
||||
Implement Q subchannel interpolation(perhaps globally).
|
||||
|
||||
Only return Q subchannel data for audio operations?
|
||||
|
||||
Emulate audio completion(or lack thereof) status correctly(if completed successfully,
|
||||
0x13, and from then on 0x15, I believe).
|
||||
|
||||
Investigate audio status code when scanning.
|
||||
|
||||
mempeekhw
|
||||
|
||||
movbsu, cache load/store breakpoints
|
||||
|
||||
Figure out 1M/4M DRAM mode differences on KING [low priority]
|
||||
|
||||
Set pcfx.rainbow.chromaip default to 0 if the glitch in Deep Blue Fleet when viewing a ship from the side doesn't occur on a real PC-FX.
|
||||
|
||||
Determine correct relative volume levels between ADPCM, CD-DA, and PSG.
|
||||
|
||||
Investigate reported discrepancy between real PC-FX and Mednafen when uploading waveform to PSG by rewriting
|
||||
the channel number/index before each sample write(on a real PC-FX, it doesn't work; IE, likely either the sample
|
||||
writes are being ignored, or the waveform memory index is being reset on channel number/index write).
|
||||
|
||||
V810 MUL or MULU overflow flag logic is likely wrong(can't remember which off hand ATM; confirm, and fix).
|
||||
|
||||
NES:
|
||||
Add some kind of protection against FDS corruption when exiting the emulator in the middle of a disk write.
|
||||
|
||||
Fix apparent sound skew(lost cycles?) messing up blargg's DMC tests.
|
||||
|
||||
Fix weird graphical glitches in Quattro Sports: BMX Simulator
|
||||
|
||||
nes/boards/vrc7.cpp (slot save state saving)
|
||||
|
||||
Safety fopen() replacement for preventing overwriting of files.
|
||||
|
||||
smem_seek() offset signedness fix
|
||||
|
||||
Reexamine the code for choosing which emulation module to use. Highest priority to file extension(as long as the extension is unique to a system,
|
||||
"bin" is no unique for example), and special magic test functions if that fails.
|
||||
|
||||
Investigate reports of undefined symbols(in V810 FPU emulation code, and the WonderSwan x86 disassembler, and possibly other places). There ARE references to
|
||||
undefined symbols, but the symbols that reference them are never referenced themselves. We should probably fix this.
|
||||
|
||||
Add dummy copy constructors to lots of our new classes.
|
||||
|
||||
TODO: Add a "SaveStateMD5" member to the MDFNGI struct, to allow the sharing of battery-backed save files between PCE and PCE_FAST
|
||||
without allowing save states to be shared.
|
||||
|
||||
TODO: Clean up multithreaded CD-ROM reading code. Add fixes for drives that don't support raw subchannel reading and/or raw reading. Add fixes
|
||||
for drives that return borked(from the wrong sectors) subchannel data. Add fixes for drives that refuse to read garbage mode 1 sectors(or fix readahead to not read
|
||||
the pregap between audio and data tracks).
|
||||
|
||||
TODO: Do locking in drivers/remote.cpp
|
||||
|
||||
TODO: Consider locking in MDFNI_printf() due to the indentation global variable.
|
||||
|
||||
Alter MD5 hash of games based on the module's name for save states etc.?
|
||||
|
||||
Emulation "module" namespace encapsulation.
|
||||
|
||||
Save state timestamp-related variables consistency checks to avoid the possibility of buffer overruns and, less importantly, locking up the emulator
|
||||
by use of malicious save states.
|
||||
|
||||
Investigate excessively long pause time after buffer underrun with ALSA and Intel HDA.
|
||||
|
||||
Rewrite the cheat interface, and add support for multiple patches per named cheat.
|
||||
|
||||
Movie recording non-overwriting.
|
||||
|
||||
Clean up intialization/deinitialization code so that more than one game can be loaded per Mednafen run. Including cleaning up the
|
||||
sound file player interface to not trash a system's MDFNGI struct.
|
||||
(This is a lot harder than it sounds! :b)
|
||||
|
||||
Debugger(general):
|
||||
Disassembly address forcible resynchronization has inconsistent results across different emulated systems; make
|
||||
them consistent.
|
||||
|
||||
assert() in cdrom/scsicd.cpp on line 2629 is being triggered; "loading a save state while
|
||||
stopped in the debugger brings up the message"
|
||||
|
||||
Breakpoint logger mode(instead of breaking, output the instruction address that caused the breakpoint,
|
||||
and which breakpoint was triggered(assuming that address+breakpoint pair wasn't outputted to the text file already).
|
||||
|
||||
Add opcode breakpoints to PC-FX and NES debuggers.
|
||||
|
||||
Debugger memory usage map and per-address-space breakpoints.
|
||||
|
||||
Support for multi-line entries in the log viewer.
|
||||
|
||||
fix various debugger problems(first, register updates when in stepping mode, or when new values are inputted in the register editor)
|
||||
|
||||
Up-to-date register updates(for things like timer counter registers) during debugger while in step mode.
|
||||
|
||||
Sprite viewer
|
||||
|
||||
BG map viewer
|
||||
|
||||
Full undefined behavior logging
|
||||
|
||||
Input macro recording.
|
||||
|
||||
Return -1 on game load error in main(), -2(maybe!) for unknown format.
|
||||
|
||||
|
||||
|
||||
************
|
||||
**Old TODO**:
|
||||
************
|
||||
|
||||
The following games are broken to some extent:
|
||||
|
||||
Crystalis: Mostly working, but the screen jumps around during
|
||||
dialogue. It apparently resets the MMC3 IRQ counter
|
||||
mid-scanline. It'll require low-level PPU and MMC3
|
||||
IRQ counter emulation to function properly.
|
||||
|
||||
Kickmaster: IRQ occurs a few CPU cycles too late, interferes with NMI routine,
|
||||
and causes the game to lock up after the second boss. Luckily, there
|
||||
are passwords, at least.
|
||||
*"FIXED" BY HACK*
|
||||
|
||||
Star Wars(PAL Beam Software version):
|
||||
MMC3 IRQ occurs when it shouldn't, similar to the problem in
|
||||
Kickmaster.
|
||||
*"FIXED" BY HACK*
|
||||
|
||||
*** General Features:
|
||||
|
||||
Fix possible UNIF crashes(if no PRGx or CHRx chunks exist, it may crash,
|
||||
due to changes made in 0.92).
|
||||
|
||||
*** Emulation:
|
||||
|
||||
Figure out what mapper 113 really is.
|
||||
|
||||
Sound frame count stuff on PAL games(is it correct?).
|
||||
|
||||
Fix Zapper emulation(one version of Chiller still doesn't always work correctly).
|
|
@ -0,0 +1,594 @@
|
|||
# Configure paths for SDL
|
||||
# Sam Lantinga 9/21/99
|
||||
# stolen from Manish Singh
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_SDL],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
sdl_prefix="$withval", sdl_prefix="")
|
||||
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
|
||||
sdl_exec_prefix="$withval", sdl_exec_prefix="")
|
||||
|
||||
if test x$sdl_exec_prefix != x ; then
|
||||
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
if test x$sdl_prefix != x ; then
|
||||
sdl_args="$sdl_args --prefix=$sdl_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
|
||||
min_sdl_version=ifelse([$1], ,0.11.0,$1)
|
||||
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
|
||||
no_sdl=""
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
no_sdl=yes
|
||||
else
|
||||
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
|
||||
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
|
||||
|
||||
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
fi
|
||||
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
echo "*** The sdl-config script installed by SDL could not be found"
|
||||
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the SDL_CONFIG environment variable to the"
|
||||
echo "*** full path to sdl-config."
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
AC_SUBST(SDL_LIBS)
|
||||
])
|
||||
|
||||
|
||||
dnl Alexandre Duret-Lutz <adl@gnu.org>
|
||||
AC_DEFUN([AC_FUNC_MKDIR],
|
||||
[AC_CHECK_FUNCS([mkdir _mkdir])
|
||||
AC_CACHE_CHECK([whether mkdir takes one argument],
|
||||
[ac_cv_mkdir_takes_one_arg],
|
||||
[AC_TRY_COMPILE([
|
||||
#include <sys/stat.h>
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
], [mkdir (".");],
|
||||
[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
|
||||
if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
|
||||
AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
|
||||
[Define if mkdir takes only one argument.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Note:
|
||||
dnl =====
|
||||
dnl I have not implemented the following suggestion because I don't have
|
||||
dnl access to such a broken environment to test the macro. So I'm just
|
||||
dnl appending the comments here in case you have, and want to fix
|
||||
dnl AC_FUNC_MKDIR that way.
|
||||
dnl
|
||||
dnl |Thomas E. Dickey (dickey@herndon4.his.com) said:
|
||||
dnl | it doesn't cover the problem areas (compilers that mistreat mkdir
|
||||
dnl | may prototype it in dir.h and dirent.h, for instance).
|
||||
dnl |
|
||||
dnl |Alexandre:
|
||||
dnl | Would it be sufficient to check for these headers and #include
|
||||
dnl | them in the AC_TRY_COMPILE block? (and is AC_HEADER_DIRENT
|
||||
dnl | suitable for this?)
|
||||
dnl |
|
||||
dnl |Thomas:
|
||||
dnl | I think that might be a good starting point (with the set of recommended
|
||||
dnl | ifdef's and includes for AC_HEADER_DIRENT, of course).
|
||||
|
||||
dnl Configure Paths for Alsa
|
||||
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
|
||||
dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
|
||||
dnl Jaroslav Kysela <perex@suse.cz>
|
||||
dnl Last modification: alsa.m4,v 1.24 2004/09/15 18:48:07 tiwai Exp
|
||||
dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
|
||||
dnl enables arguments --with-alsa-prefix=
|
||||
dnl --with-alsa-enc-prefix=
|
||||
dnl --disable-alsatest
|
||||
dnl
|
||||
dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
|
||||
dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_ALSA],
|
||||
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
|
||||
alsa_save_CFLAGS="$CFLAGS"
|
||||
alsa_save_LDFLAGS="$LDFLAGS"
|
||||
alsa_save_LIBS="$LIBS"
|
||||
alsa_found=yes
|
||||
|
||||
dnl
|
||||
dnl Get the cflags and libraries for alsa
|
||||
dnl
|
||||
AC_ARG_WITH(alsa-prefix,
|
||||
[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
|
||||
[alsa_prefix="$withval"], [alsa_prefix=""])
|
||||
|
||||
AC_ARG_WITH(alsa-inc-prefix,
|
||||
[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
|
||||
[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
|
||||
|
||||
dnl FIXME: this is not yet implemented
|
||||
AC_ARG_ENABLE(alsatest,
|
||||
[ --disable-alsatest Do not try to compile and run a test Alsa program],
|
||||
[enable_alsatest="$enableval"],
|
||||
[enable_alsatest=yes])
|
||||
|
||||
dnl Add any special include directories
|
||||
AC_MSG_CHECKING(for ALSA CFLAGS)
|
||||
if test "$alsa_inc_prefix" != "" ; then
|
||||
ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
|
||||
CFLAGS="$CFLAGS -I$alsa_inc_prefix"
|
||||
fi
|
||||
AC_MSG_RESULT($ALSA_CFLAGS)
|
||||
CFLAGS="$alsa_save_CFLAGS"
|
||||
|
||||
dnl add any special lib dirs
|
||||
AC_MSG_CHECKING(for ALSA LDFLAGS)
|
||||
if test "$alsa_prefix" != "" ; then
|
||||
ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
|
||||
LDFLAGS="$LDFLAGS $ALSA_LIBS"
|
||||
fi
|
||||
|
||||
dnl add the alsa library
|
||||
ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
|
||||
LIBS="$ALSA_LIBS $LIBS"
|
||||
AC_MSG_RESULT($ALSA_LIBS)
|
||||
|
||||
dnl Check for a working version of libasound that is of the right version.
|
||||
min_alsa_version=ifelse([$1], ,0.1.1,$1)
|
||||
AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
|
||||
no_alsa=""
|
||||
alsa_min_major_version=`echo $min_alsa_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
alsa_min_minor_version=`echo $min_alsa_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
alsa_min_micro_version=`echo $min_alsa_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_TRY_COMPILE([
|
||||
#include <alsa/asoundlib.h>
|
||||
], [
|
||||
/* ensure backward compatibility */
|
||||
#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
|
||||
#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
|
||||
#endif
|
||||
#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
|
||||
#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
|
||||
#endif
|
||||
#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
|
||||
#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
|
||||
#endif
|
||||
|
||||
# if(SND_LIB_MAJOR > $alsa_min_major_version)
|
||||
exit(0);
|
||||
# else
|
||||
# if(SND_LIB_MAJOR < $alsa_min_major_version)
|
||||
# error not present
|
||||
# endif
|
||||
|
||||
# if(SND_LIB_MINOR > $alsa_min_minor_version)
|
||||
exit(0);
|
||||
# else
|
||||
# if(SND_LIB_MINOR < $alsa_min_minor_version)
|
||||
# error not present
|
||||
# endif
|
||||
|
||||
# if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
|
||||
# error not present
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
exit(0);
|
||||
],
|
||||
[AC_MSG_RESULT(found.)],
|
||||
[AC_MSG_RESULT(not present.)
|
||||
ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
|
||||
alsa_found=no]
|
||||
)
|
||||
AC_LANG_RESTORE
|
||||
|
||||
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
|
||||
if test "x$enable_alsatest" = "xyes"; then
|
||||
AC_CHECK_LIB([asound], [snd_ctl_open],,
|
||||
[ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
|
||||
alsa_found=no]
|
||||
)
|
||||
fi
|
||||
|
||||
LDFLAGS="$alsa_save_LDFLAGS"
|
||||
LIBS="$alsa_save_LIBS"
|
||||
|
||||
if test "x$alsa_found" = "xyes" ; then
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
ALSA_CFLAGS=""
|
||||
ALSA_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
|
||||
dnl That should be it. Now just export out symbols:
|
||||
AC_SUBST(ALSA_CFLAGS)
|
||||
AC_SUBST(ALSA_LIBS)
|
||||
])
|
||||
|
||||
# Configure paths for ESD
|
||||
# Manish Singh 98-9-30
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_ESD],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the esd-config script
|
||||
dnl
|
||||
AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)],
|
||||
esd_prefix="$withval", esd_prefix="")
|
||||
AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
|
||||
esd_exec_prefix="$withval", esd_exec_prefix="")
|
||||
AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program],
|
||||
, enable_esdtest=yes)
|
||||
|
||||
if test x$esd_exec_prefix != x ; then
|
||||
esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
|
||||
if test x${ESD_CONFIG+set} != xset ; then
|
||||
ESD_CONFIG=$esd_exec_prefix/bin/esd-config
|
||||
fi
|
||||
fi
|
||||
if test x$esd_prefix != x ; then
|
||||
esd_args="$esd_args --prefix=$esd_prefix"
|
||||
if test x${ESD_CONFIG+set} != xset ; then
|
||||
ESD_CONFIG=$esd_prefix/bin/esd-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(ESD_CONFIG, esd-config, no)
|
||||
min_esd_version=ifelse([$1], ,0.2.7,$1)
|
||||
AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
|
||||
no_esd=""
|
||||
if test "$ESD_CONFIG" = "no" ; then
|
||||
no_esd=yes
|
||||
else
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
|
||||
ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
|
||||
|
||||
esd_major_version=`$ESD_CONFIG $esd_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
esd_minor_version=`$ESD_CONFIG $esd_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_esdtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $ESD_CFLAGS"
|
||||
LIBS="$LIBS $ESD_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed ESD is sufficiently new. (Also sanity
|
||||
dnl checks the results of esd-config to some extent
|
||||
dnl
|
||||
rm -f conf.esdtest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <esd.h>
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.esdtest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_esd_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_esd_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($esd_major_version > major) ||
|
||||
(($esd_major_version == major) && ($esd_minor_version > minor)) ||
|
||||
(($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
|
||||
printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
|
||||
printf("*** to point to the correct copy of esd-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
AC_LANG_RESTORE
|
||||
fi
|
||||
fi
|
||||
if test "x$no_esd" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$ESD_CONFIG" = "no" ; then
|
||||
echo "*** The esd-config script installed by ESD could not be found"
|
||||
echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the ESD_CONFIG environment variable to the"
|
||||
echo "*** full path to esd-config."
|
||||
else
|
||||
if test -f conf.esdtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run ESD test program, checking why..."
|
||||
CFLAGS="$CFLAGS $ESD_CFLAGS"
|
||||
LIBS="$LIBS $ESD_LIBS"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <esd.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding ESD or finding the wrong"
|
||||
echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means ESD was incorrectly installed"
|
||||
echo "*** or that you have moved ESD since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
AC_LANG_RESTORE
|
||||
fi
|
||||
fi
|
||||
ESD_CFLAGS=""
|
||||
ESD_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(ESD_CFLAGS)
|
||||
AC_SUBST(ESD_LIBS)
|
||||
rm -f conf.esdtest
|
||||
])
|
||||
|
||||
dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
|
||||
dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
|
||||
dnl
|
||||
AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD],
|
||||
[dnl
|
||||
AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
|
||||
ac_save_ESD_CFLAGS="$ESD_CFLAGS"
|
||||
ac_save_ESD_LIBS="$ESD_LIBS"
|
||||
AM_PATH_ESD(0.2.21,
|
||||
ifelse([$1], , [
|
||||
AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
|
||||
AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
|
||||
[Define if you have esound with support of multiple recording clients.])],
|
||||
[$1]),
|
||||
ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
|
||||
if test "x$ac_save_ESD_CFLAGS" != x ; then
|
||||
ESD_CFLAGS="$ac_save_ESD_CFLAGS"
|
||||
fi
|
||||
if test "x$ac_save_ESD_LIBS" != x ; then
|
||||
ESD_LIBS="$ac_save_ESD_LIBS"
|
||||
fi
|
||||
)
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AC_DEFUN([AX_NO_STRICT_OVERFLOW],
|
||||
[
|
||||
AC_MSG_CHECKING(for compiler flags to disable strict overflow)
|
||||
|
||||
nsof_test_prog=["#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
typedef int8_t int8;
|
||||
typedef int16_t int16;
|
||||
typedef int32_t int32;
|
||||
typedef int64_t int64;
|
||||
|
||||
typedef uint8_t uint8;
|
||||
typedef uint16_t uint16;
|
||||
typedef uint32_t uint32;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define NO_INLINE __attribute__((noinline))
|
||||
#else
|
||||
#define NO_INLINE
|
||||
#endif
|
||||
|
||||
struct MathTestTSOEntry
|
||||
{
|
||||
int32 a;
|
||||
int32 b;
|
||||
};
|
||||
|
||||
// Don't declare as static(though whopr might mess it up anyway)
|
||||
MathTestTSOEntry MathTestTSOTests[] =
|
||||
{
|
||||
{ 0x7FFFFFFF, 2 },
|
||||
{ 0x7FFFFFFE, 0x7FFFFFFF },
|
||||
{ 0x7FFFFFFF, 0x7FFFFFFF },
|
||||
{ 0x7FFFFFFE, 0x7FFFFFFE },
|
||||
};
|
||||
|
||||
static int TestSignedOverflow(void)
|
||||
{
|
||||
for(unsigned int i = 0; i < sizeof(MathTestTSOTests) / sizeof(MathTestTSOEntry); i++)
|
||||
{
|
||||
int32 a = MathTestTSOTests[i].a;
|
||||
int32 b = MathTestTSOTests[i].b;
|
||||
|
||||
if(!((a + b) < a && (a + b) < b)) { return -1; }
|
||||
|
||||
if(!((a + 0x7FFFFFFE) < a)) { return -2; }
|
||||
if(!((b + 0x7FFFFFFE) < b)) { return -3; }
|
||||
|
||||
if(!((a + 0x7FFFFFFF) < a)) { return -4; }
|
||||
if(!((b + 0x7FFFFFFF) < b)) { return -5; }
|
||||
|
||||
if(!((int32)(a + 0x80000000) < a)) { return -6; }
|
||||
if(!((int32)(b + 0x80000000) < b)) { return -7; }
|
||||
|
||||
if(!((int32)(a ^ 0x80000000) < a)) { return -8; }
|
||||
if(!((int32)(b ^ 0x80000000) < b)) { return -9; }
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void AntiNSOBugTest_Sub1_a(int *array) NO_INLINE;
|
||||
static void AntiNSOBugTest_Sub1_a(int *array)
|
||||
{
|
||||
for(int value = 0; value < 127; value++)
|
||||
array[value] += (int8)value * 15;
|
||||
}
|
||||
|
||||
static void AntiNSOBugTest_Sub1_b(int *array) NO_INLINE;
|
||||
static void AntiNSOBugTest_Sub1_b(int *array)
|
||||
{
|
||||
for(int value = 127; value < 256; value++)
|
||||
array[value] += (int8)value * 15;
|
||||
}
|
||||
|
||||
static void AntiNSOBugTest_Sub2(int *array) NO_INLINE;
|
||||
static void AntiNSOBugTest_Sub2(int *array)
|
||||
{
|
||||
for(int value = 0; value < 256; value++)
|
||||
array[value] += (int8)value * 15;
|
||||
}
|
||||
|
||||
static void AntiNSOBugTest_Sub3(int *array) NO_INLINE;
|
||||
static void AntiNSOBugTest_Sub3(int *array)
|
||||
{
|
||||
for(int value = 0; value < 256; value++)
|
||||
{
|
||||
if(value >= 128)
|
||||
array[value] = (value - 256) * 15;
|
||||
else
|
||||
array[value] = value * 15;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int array1[256], array2[256], array3[256];
|
||||
int i;
|
||||
|
||||
memset(array1, 0, sizeof(array1));
|
||||
memset(array2, 0, sizeof(array2));
|
||||
memset(array3, 0, sizeof(array3));
|
||||
|
||||
AntiNSOBugTest_Sub1_a(array1);
|
||||
AntiNSOBugTest_Sub1_b(array1);
|
||||
AntiNSOBugTest_Sub2(array2);
|
||||
AntiNSOBugTest_Sub3(array3);
|
||||
|
||||
for(i = 0; i < 256; i++)
|
||||
{
|
||||
if((array1[i] != array2[i]) || (array2[i] != array3[i]))
|
||||
{
|
||||
exit(-1 - i);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int tmp = TestSignedOverflow();
|
||||
|
||||
if(tmp)
|
||||
exit(tmp);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
"]
|
||||
|
||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||
NO_STRICT_OVERFLOW_FLAGS=""
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -fno-strict-overflow"
|
||||
AC_TRY_RUN([$nsof_test_prog], [NO_STRICT_OVERFLOW_FLAGS="-fno-strict-overflow"], [
|
||||
CPPFLAGS="$ac_save_CPPFLAGS -fwrapv"
|
||||
AC_TRY_RUN([$nsof_test_prog], [NO_STRICT_OVERFLOW_FLAGS="-fwrapv"], [AC_MSG_ERROR(Could not find working option to disable strict overflow.)])
|
||||
])
|
||||
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
|
||||
if test "x$NO_STRICT_OVERFLOW_FLAGS" != x ; then
|
||||
AC_MSG_RESULT($NO_STRICT_OVERFLOW_FLAGS)
|
||||
else
|
||||
AC_MSG_RESULT(none needed apparently)
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,194 @@
|
|||
#include "mednafen.h"
|
||||
#include "SDL.h"
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include "drivers/input.h"
|
||||
#include "drivers/main.h"
|
||||
#include "mempatcher.h"
|
||||
#include "settings-driver.h"
|
||||
#include "FileWrapper.h"
|
||||
|
||||
extern MDFNGI EmulatedPSX;
|
||||
void BuildPortsInfo(MDFNGI *gi);
|
||||
|
||||
static MDFNSetting MednafenSettings[] =
|
||||
{
|
||||
{ "filesys.untrusted_fip_check", MDFNSF_NOFLAGS, gettext_noop("Enable untrusted file-inclusion path security check."), gettext_noop("When this setting is set to \"1\", the default, paths to files referenced from files like CUE sheets and PSF rips are checked for certain characters that can be used in directory traversal, and if found, loading is aborted. Set it to \"0\" if you want to allow constructs like absolute paths in CUE sheets, but only if you understand the security implications of doing so(see \"Security Issues\" section in the documentation)."), MDFNST_BOOL, "0" },
|
||||
{ "filesys.path_firmware", MDFNSF_NOFLAGS, gettext_noop("Path to directory for firmware."), NULL, MDFNST_STRING, "firmware" },
|
||||
{ "filesys.path_sav", MDFNSF_NOFLAGS, gettext_noop("Path to directory for save games and nonvolatile memory."), gettext_noop("WARNING: Do not set this path to a directory that contains Famicom Disk System disk images, or you will corrupt them when you load an FDS game and exit Mednafen."), MDFNST_STRING, "sav" },
|
||||
{ "filesys.fname_sav", MDFNSF_NOFLAGS, gettext_noop("Format string for save games filename."), gettext_noop("WARNING: %x should always be included, otherwise you run the risk of overwriting save data for games that create multiple save data files.\n\nSee fname_format.txt for more information. Edit at your own risk."), MDFNST_STRING, "%F.%M%x" },
|
||||
|
||||
//"dynamic" settings needed probably for each console
|
||||
{ "psx.tblur", MDFNSF_NOFLAGS, NULL, NULL, MDFNST_BOOL, "0" },
|
||||
{ "psx.forcemono", MDFNSF_NOFLAGS, NULL, NULL, MDFNST_BOOL, "0" },
|
||||
|
||||
// BuildDynamicSetting(&setting, sysname, "tblur.accum", MDFNSF_COMMON_TEMPLATE | MDFNSF_CAT_VIDEO, CSD_tblur_accum, MDFNST_BOOL, "0");
|
||||
// BuildDynamicSetting(&setting, sysname, "tblur.accum.amount", MDFNSF_COMMON_TEMPLATE | MDFNSF_CAT_VIDEO, CSD_tblur_accum_amount, MDFNST_FLOAT, "50", "0", "100");
|
||||
};
|
||||
|
||||
|
||||
static MDFN_Surface *VTBuffer[2] = { NULL, NULL };
|
||||
static MDFN_Rect *VTLineWidths[2] = { NULL, NULL };
|
||||
int16 soundbuf[1024*1024]; //how big? big enough.
|
||||
int VTBackBuffer = 0;
|
||||
static MDFN_Rect VTDisplayRects[2];
|
||||
void FrameAdvance()
|
||||
{
|
||||
EmulateSpecStruct espec;
|
||||
memset(&espec, 0, sizeof(EmulateSpecStruct));
|
||||
|
||||
uint32 pitch32 = CurGame->fb_width;
|
||||
MDFN_PixelFormat nf(MDFN_COLORSPACE_RGB, 16, 8, 0, 24);
|
||||
|
||||
if(VTBuffer[0] == NULL || VTBuffer[0]->w != CurGame->fb_width || VTBuffer[0]->h != CurGame->fb_height)
|
||||
{
|
||||
if(VTBuffer[0]) delete VTBuffer[0];
|
||||
if(VTLineWidths[0]) free(VTLineWidths[0]);
|
||||
VTBuffer[0] = new MDFN_Surface(NULL, CurGame->fb_width, CurGame->fb_height, CurGame->fb_width, nf);
|
||||
VTLineWidths[0] = (MDFN_Rect *)calloc(CurGame->fb_height, sizeof(MDFN_Rect));
|
||||
}
|
||||
|
||||
espec.surface = (MDFN_Surface *)VTBuffer[VTBackBuffer];
|
||||
espec.LineWidths = (MDFN_Rect *)VTLineWidths[VTBackBuffer];
|
||||
espec.skip = false;
|
||||
espec.soundmultiplier = 1.0;
|
||||
espec.NeedRewind = DNeedRewind;
|
||||
|
||||
//espec.SoundRate = GetSoundRate();
|
||||
//espec.SoundBuf = GetEmuModSoundBuffer(&espec.SoundBufMaxSize);
|
||||
//espec.SoundVolume = (double)MDFN_GetSettingUI("sound.volume") / 100;
|
||||
|
||||
espec.SoundBufMaxSize = 1024*1024;
|
||||
espec.SoundRate = 44100;
|
||||
espec.SoundBuf = soundbuf;
|
||||
espec.SoundVolume = 1.0;
|
||||
|
||||
|
||||
MDFNI_Emulate(&espec);
|
||||
|
||||
VTDisplayRects[VTBackBuffer] = espec.DisplayRect;
|
||||
|
||||
//TODO sound
|
||||
//sound = espec.SoundBuf + (espec.SoundBufSizeALMS * CurGame->soundchan);
|
||||
//ssize = espec.SoundBufSize - espec.SoundBufSizeALMS;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void close()
|
||||
{
|
||||
MDFNI_CloseGame();
|
||||
}
|
||||
|
||||
enum eProp
|
||||
{
|
||||
GetPtr_FramebufferPointer,
|
||||
GetPtr_FramebufferPitchPixels,
|
||||
GetPtr_FramebufferWidth,
|
||||
GetPtr_FramebufferHeight,
|
||||
SetPtr_FopenCallback,
|
||||
SetPtr_FcloseCallback,
|
||||
SetPtr_FopCallback
|
||||
};
|
||||
|
||||
typedef void* (*t_FopenCallback)(const char* fname, const char* mode);
|
||||
static t_FopenCallback FopenCallback;
|
||||
|
||||
typedef int (*t_FcloseCallback)(void* fp);
|
||||
static t_FcloseCallback FcloseCallback;
|
||||
|
||||
typedef int64 (*t_FopCallback)(int op, void* ptr, int64 a, int64 b, FILE* fp);
|
||||
static t_FopCallback FopCallback;
|
||||
|
||||
extern "C" __declspec(dllexport) void dll_SetPropPtr(int prop, void* ptr)
|
||||
{
|
||||
switch((eProp)prop)
|
||||
{
|
||||
case SetPtr_FopenCallback: FopenCallback = (t_FopenCallback)ptr; break;
|
||||
case SetPtr_FcloseCallback: FcloseCallback = (t_FcloseCallback)ptr; break;
|
||||
case SetPtr_FopCallback: FopCallback = (t_FopCallback)ptr; break;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void* dll_GetPropPtr(int prop)
|
||||
{
|
||||
switch((eProp)prop)
|
||||
{
|
||||
case GetPtr_FramebufferPointer:
|
||||
return VTBuffer[0]->pixels;
|
||||
case GetPtr_FramebufferPitchPixels:
|
||||
return (void*)VTBuffer[0]->pitchinpix;
|
||||
case GetPtr_FramebufferWidth:
|
||||
return (void*)VTBuffer[0]->w;
|
||||
case GetPtr_FramebufferHeight:
|
||||
return (void*)VTBuffer[0]->h;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) bool psx_LoadCue(const char* path)
|
||||
{
|
||||
MDFNI_CloseGame(); //todo - copy CloseGame into api.. dont like everything i see in there
|
||||
|
||||
//load the psx game
|
||||
MDFNGI *gi = CurGame = MDFNI_LoadCD("psx", path);
|
||||
|
||||
//does some kind of input hooking-up
|
||||
BuildPortsInfo(gi);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void psx_FrameAdvance()
|
||||
{
|
||||
FrameAdvance();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) bool dll_Initialize()
|
||||
{
|
||||
//initialize emulator cores according to a list maintained inside this method
|
||||
std::vector<MDFNGI *> ExternalSystems; //wtf are external systems then? custom ones not known to mednafen's internals?
|
||||
MDFNI_InitializeModules(ExternalSystems);
|
||||
|
||||
MDFNI_SetBaseDirectory("$psx");
|
||||
|
||||
//add settings specific to each core
|
||||
for(unsigned int x = 0; x < MDFNSystems.size(); x++)
|
||||
{
|
||||
if(MDFNSystems[x]->Settings)
|
||||
MDFN_MergeSettings(MDFNSystems[x]->Settings);
|
||||
}
|
||||
|
||||
//prep settings. for now we reuse a lot of mednafen's internal settings building. i would prefer to have supported settings enumerated in here
|
||||
static std::vector <MDFNSetting> NeoDriverSettings; //these better be static or else shit will explode
|
||||
MakeInputSettings(NeoDriverSettings);
|
||||
MDFN_MergeSettings(NeoDriverSettings);
|
||||
MDFN_MergeSettings(MednafenSettings);
|
||||
|
||||
//settings hacks
|
||||
MDFNI_SetSetting("filesys.path_firmware","firmware");
|
||||
MDFNI_SetSetting("filesys.path_sav","sav");
|
||||
|
||||
//cheats.. crashes without it, maybe we'll want to use the cheat system later
|
||||
MDFN_MergeSettings(MDFNMP_Settings);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//---------
|
||||
|
||||
FILE* headless_fopen(const char* path, const char* mode)
|
||||
{
|
||||
return (FILE*)FopenCallback(path,mode);
|
||||
}
|
||||
|
||||
int headless_fclose(FILE* fp)
|
||||
{
|
||||
return FcloseCallback(fp);
|
||||
}
|
||||
|
||||
int64 headless_fop(FOP op, void* ptr, int64 a, int64 b, FILE* fp)
|
||||
{
|
||||
return FopCallback((int)op, ptr, a, b, fp);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
libtoolize --force --copy
|
||||
#gettextize --force --copy --intl
|
||||
autoheader
|
||||
aclocal -I m4
|
||||
autoconf
|
||||
automake -a -c -f
|
||||
|
||||
rm autom4te.cache/*
|
||||
rmdir autom4te.cache
|
|
@ -0,0 +1,143 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2009-10-06.20; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# 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:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,22 @@
|
|||
//win32 msvc config
|
||||
#pragma once
|
||||
#define HAVE__MKDIR 1
|
||||
#define LSB_FIRST
|
||||
#define SIZEOF_DOUBLE 8
|
||||
#define WANT_DEBUGGER 1
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp(x,y) _stricmp(x,y)
|
||||
#define strncasecmp(x, y, l) strnicmp(x, y, l)
|
||||
#define _(x) (x)
|
||||
#define PSS "/"
|
||||
#define round(x) (floorf((x) + 0.5f))
|
||||
#define strdup _strdup
|
||||
#define strtoull _strtoui64
|
||||
#define strtoll _strtoi64
|
||||
#define _USE_MATH_DEFINES
|
||||
#define world_strtod strtod
|
||||
#define WANT_PSX_EMU
|
||||
|
||||
|
||||
#define MEDNAFEN_VERSION "0.999.999-WIP"
|
||||
#define MEDNAFEN_VERSION_NUMERIC 0x999999
|
|
@ -0,0 +1,672 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2010 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# Known limitations:
|
||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||
# known workaround is to choose shorter directory names for the build
|
||||
# directory and/or the installation directory.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except MSVC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shrext=.so
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_CC_BASENAME.
|
||||
|
||||
for cc_temp in $CC""; do
|
||||
case $cc_temp in
|
||||
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
||||
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
||||
\-*) ;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
darwin*)
|
||||
case $cc_basename in
|
||||
xlc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
linux* | k*bsd*-gnu)
|
||||
case $cc_basename in
|
||||
ecc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
icc* | ifort*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
lf95*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
pgcc | pgf77 | pgf90)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
ccc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
como)
|
||||
wl='-lopt='
|
||||
;;
|
||||
*)
|
||||
case `$CC -V 2>&1 | sed 5q` in
|
||||
*Sun\ C*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
unicos*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
interix*)
|
||||
# we just hope/assume this is gcc and not c89 (= MSVC++)
|
||||
with_gnu_ld=yes
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# Set some defaults for GNU ld with shared library support. These
|
||||
# are reset later if shared libraries are not supported. Putting them
|
||||
# here allows them to be overridden if necessary.
|
||||
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
case "$host_os" in
|
||||
aix[3-9]*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we cannot use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
interix[3-9]*)
|
||||
hardcode_direct=no
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
gnu* | linux* | k*bsd*-gnu)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
solaris*)
|
||||
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
|
||||
case `$LD -v 2>&1` in
|
||||
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = no; then
|
||||
hardcode_libdir_flag_spec=
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix[4-9]*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
:
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
fi
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath="/usr/lib:/lib"
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
bsdi[45]*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=no
|
||||
if test "$GCC" = yes ; then
|
||||
:
|
||||
else
|
||||
case $cc_basename in
|
||||
xlc*)
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
hpux10*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
fi
|
||||
;;
|
||||
hpux11*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
case $host_cpu in
|
||||
hppa*64*|ia64*)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
*)
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
if test -f /usr/libexec/ld.so; then
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
case $host_vendor in
|
||||
sni)
|
||||
hardcode_direct=yes # is this really true???
|
||||
;;
|
||||
siemens)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
motorola)
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6*)
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||
hardcode_libdir_separator=':'
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
|
||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||
# only about the one the linker finds when passed -lNAME. This is the last
|
||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||
# linker has special search rules.
|
||||
library_names_spec= # the last element of library_names_spec in libtool.m4
|
||||
libname_spec='lib$name'
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
aix[4-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
amigaos*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
beos*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
bsdi[45]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.dll.a $libname.lib'
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shrext=.dylib
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
dgux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
freebsd1*)
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
case "$host_os" in
|
||||
freebsd[123]*)
|
||||
library_names_spec='$libname$shrext$versuffix' ;;
|
||||
*)
|
||||
library_names_spec='$libname$shrext' ;;
|
||||
esac
|
||||
;;
|
||||
gnu*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_cpu in
|
||||
ia64*)
|
||||
shrext=.so
|
||||
;;
|
||||
hppa*64*)
|
||||
shrext=.sl
|
||||
;;
|
||||
*)
|
||||
shrext=.sl
|
||||
;;
|
||||
esac
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
interix[3-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
case "$host_os" in
|
||||
irix5* | nonstopux*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux* | k*bsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
knetbsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
netbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
newsos6)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
nto-qnx*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
openbsd*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sunos4*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
sysv4 | sysv4.3*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
uts4*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Format of library name prefix.
|
||||
libname_spec="$escaped_libname_spec"
|
||||
|
||||
# Library names that the linker finds when passed -lNAME.
|
||||
library_names_spec="$escaped_library_names_spec"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
EOF
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,547 @@
|
|||
AC_INIT([src/mednafen.cpp])
|
||||
AC_GNU_SOURCE
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
#
|
||||
# Avoid trailing and leading zeroes in the decimal version components to avoid confusing not-so-learned people.
|
||||
#
|
||||
MEDNAFEN_VERSION='0.9.26-WIP'
|
||||
MEDNAFEN_VERSION_NUMERIC=0x000926
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE([mednafen], $MEDNAFEN_VERSION)
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
|
||||
AM_CONFIG_HEADER([include/config.h:include/config.h.in])
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AM_PROG_AS
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CXXCPP
|
||||
AC_LANG_CPLUSPLUS
|
||||
AM_PROG_LIBTOOL
|
||||
AC_PROG_INSTALL
|
||||
|
||||
gl_VISIBILITY
|
||||
|
||||
AC_SYS_LARGEFILE
|
||||
AC_FUNC_FSEEKO
|
||||
|
||||
# sizeof tests need to come after largefile support macros
|
||||
|
||||
AC_CHECK_TYPE(ptrdiff_t,long)
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_SIZEOF(double)
|
||||
AC_CHECK_SIZEOF(__int64)
|
||||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(size_t)
|
||||
AC_CHECK_SIZEOF(ptrdiff_t)
|
||||
AC_CHECK_SIZEOF(off_t)
|
||||
AC_C_CONST
|
||||
AC_CHECK_FUNCS(memcmp memcpy memmove memset mmap munmap madvise signal sigaction fcntl getenv putenv setenv gettimeofday getpwuid getuid nanosleep usleep strerror strerror_r ftello fopen64 fseeko64 ftello64 fstat64)
|
||||
AC_CHECK_HEADERS(fcntl.h)
|
||||
AC_FUNC_MKDIR
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
#
|
||||
# Check for any libraries that need to be linked against for clock_gettime().
|
||||
#
|
||||
# (posix4 is apparently used by much older versions of Solaris according to tar, pre-7, so maybe it's not necessary
|
||||
# for Mednafen?)
|
||||
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
|
||||
AC_CHECK_FUNCS(clock_gettime)
|
||||
|
||||
AC_DEFINE(MINILZO_HAVE_CONFIG_H, [1], [Define if config.h is present])
|
||||
|
||||
AC_CHECK_HEADER([OpenGL/gl.h],HAVE_OPENGL_GL_H=true, HAVE_OPENGL_GL_H=false)
|
||||
if $HAVE_OPENGL_GL_H
|
||||
then
|
||||
AC_DEFINE(HAVE_APPLE_OPENGL_FRAMEWORK, [1], [Define if we should include from OpenGL instead of GL])
|
||||
else
|
||||
AC_PATH_X
|
||||
|
||||
if test "x${x_includes}" != "x"; then
|
||||
CPPFLAGS="-I${x_includes} ${CPPFLAGS}"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER([GL/gl.h],HAVE_GL_GL_H=true, HAVE_GL_GL_H=false)
|
||||
|
||||
if test x$HAVE_GL_GL_H = xfalse; then
|
||||
AC_MSG_ERROR([*** OpenGL header file not found!])
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_ICONV
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
AC_SUBST(LIBICONV)
|
||||
AC_SUBST(LIBINTL)
|
||||
|
||||
dnl Check for zlib
|
||||
AC_CHECK_LIB([z], [zlibVersion],[], AC_MSG_ERROR([*** zlib not found!]))
|
||||
LIBS="$LIBS -lz"
|
||||
|
||||
dnl -fno-unit-at-a-time
|
||||
|
||||
OPTIMIZER_FLAGS=""
|
||||
|
||||
dnl MATH_OPTIMIZER_FLAGS is used in the automake files where it doesn't break code
|
||||
MATH_OPTIMIZER_FLAGS="-ffast-math"
|
||||
AC_SUBST(MATH_OPTIMIZER_FLAGS)
|
||||
|
||||
AX_CFLAGS_GCC_OPTION([-fomit-frame-pointer], OPTIMIZER_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-finline-limit=6000], OPTIMIZER_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([--param large-function-growth=800], OPTIMIZER_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([--param inline-unit-growth=175], OPTIMIZER_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([--param max-inline-insns-single=10000], OPTIMIZER_FLAGS)
|
||||
AX_NO_STRICT_OVERFLOW
|
||||
|
||||
|
||||
WARNING_FLAGS=""
|
||||
AX_CFLAGS_GCC_OPTION([-Wall], WARNING_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Winline], WARNING_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wshadow], WARNING_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wempty-body], WARNING_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wignored-qualifiers], WARNING_FLAGS)
|
||||
AC_SUBST(WARNING_FLAGS)
|
||||
|
||||
SNES_EXTRA_FLAGS=""
|
||||
SNES_EXTRA_CXXFLAGS=""
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-unused], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-inline], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-shadow], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-sign-compare], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-inline], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-ignored-qualifiers], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-inline], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-uninitialized], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-parentheses], SNES_EXTRA_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-Wno-switch], SNES_EXTRA_FLAGS)
|
||||
AC_SUBST(SNES_EXTRA_FLAGS)
|
||||
AC_SUBST(SNES_EXTRA_CXXFLAGS)
|
||||
|
||||
GBA_EXTRA_FLAGS=""
|
||||
AX_CFLAGS_GCC_OPTION([-fno-unit-at-a-time], GBA_EXTRA_FLAGS)
|
||||
AC_SUBST(GBA_EXTRA_FLAGS)
|
||||
|
||||
MDFN_COMPAT_FLAGS=""
|
||||
AX_CFLAGS_GCC_OPTION([-fsigned-char], MDFN_COMPAT_FLAGS)
|
||||
|
||||
AC_SUBST([AM_CFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
|
||||
AC_SUBST([AM_CXXFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
|
||||
|
||||
AM_CONDITIONAL(WANT_DEBUGGER, false)
|
||||
|
||||
AC_ARG_ENABLE(debugger,
|
||||
AC_HELP_STRING([--enable-debugger], [build with internal debugger [[default=yes]]]),
|
||||
, enable_debugger=yes)
|
||||
|
||||
if test x$enable_debugger = xyes; then
|
||||
AC_DEFINE([WANT_DEBUGGER], [1], [Define if we are compiling with debugger.])
|
||||
AM_CONDITIONAL(WANT_DEBUGGER, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(cjk-fonts,
|
||||
AC_HELP_STRING([--enable-cjk-fonts], [build with internal CJK(Chinese, Japanese, Korean) fonts [[default=yes]]]),
|
||||
, enable_cjk_fonts=yes)
|
||||
|
||||
if test x$enable_cjk_fonts = xyes; then
|
||||
AC_DEFINE([WANT_INTERNAL_CJK], [1], [Define if we are compiling with internal CJK fonts.])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl The code that uses $enable_altivec is lower, in the CPU architecture section.
|
||||
dnl
|
||||
AC_ARG_ENABLE(altivec,
|
||||
AC_HELP_STRING([--enable-altivec], [use AltiVec extensions on PowerPC/POWER ISA processors [[default=yes]]]),
|
||||
, enable_altivec=yes)
|
||||
|
||||
|
||||
AM_CONDITIONAL(WANT_GB_EMU, false)
|
||||
AM_CONDITIONAL(WANT_GBA_EMU, false)
|
||||
AM_CONDITIONAL(WANT_LYNX_EMU, false)
|
||||
AM_CONDITIONAL(WANT_MD_EMU, false)
|
||||
AM_CONDITIONAL(WANT_SMS_EMU, false)
|
||||
AM_CONDITIONAL(WANT_NES_EMU, false)
|
||||
AM_CONDITIONAL(WANT_NGP_EMU, false)
|
||||
AM_CONDITIONAL(WANT_PCE_EMU, false)
|
||||
AM_CONDITIONAL(WANT_PCE_FAST_EMU, false)
|
||||
AM_CONDITIONAL(WANT_PCFX_EMU, false)
|
||||
AM_CONDITIONAL(WANT_PSX_EMU, false)
|
||||
AM_CONDITIONAL(WANT_SMS_EMU, false)
|
||||
AM_CONDITIONAL(WANT_SNES_EMU, false)
|
||||
AM_CONDITIONAL(WANT_VB_EMU, false)
|
||||
AM_CONDITIONAL(WANT_WSWAN_EMU, false)
|
||||
|
||||
AC_ARG_ENABLE(gb,
|
||||
AC_HELP_STRING([--enable-gb], [build with GameBoy emulation [[default=yes]]]),
|
||||
, enable_gb=yes)
|
||||
|
||||
if test x$enable_gb = xyes; then
|
||||
AC_DEFINE([WANT_GB_EMU], [1], [Define if we are compiling with GB emulation.])
|
||||
AM_CONDITIONAL(WANT_GB_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(gba,
|
||||
AC_HELP_STRING([--enable-gba], [build with GameBoy Advance emulation [[default=yes]]]),
|
||||
, enable_gba=yes)
|
||||
|
||||
if test x$enable_gba = xyes; then
|
||||
AC_DEFINE([WANT_GBA_EMU], [1], [Define if we are compiling with GBA emulation.])
|
||||
AM_CONDITIONAL(WANT_GBA_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(lynx,
|
||||
AC_HELP_STRING([--enable-lynx], [build with Atari Lynx emulation [[default=yes]]]),
|
||||
, enable_lynx=yes)
|
||||
|
||||
if test x$enable_lynx = xyes; then
|
||||
AC_DEFINE([WANT_LYNX_EMU], [1], [Define if we are compiling with Lynx emulation.])
|
||||
AM_CONDITIONAL(WANT_LYNX_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(md,
|
||||
AC_HELP_STRING([--enable-md], [build with Sega Genesis/MegaDrive emulation [[default=yes]]]),
|
||||
, enable_md=yes)
|
||||
|
||||
if test x$enable_md = xyes; then
|
||||
AC_DEFINE([WANT_MD_EMU], [1], [Define if we are compiling with Sega Genesis/MegaDrive emulation.])
|
||||
AM_CONDITIONAL(WANT_MD_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(nes,
|
||||
AC_HELP_STRING([--enable-nes], [build with Nintendo Entertainment System emulation [[default=yes]]]),
|
||||
, enable_nes=yes)
|
||||
|
||||
if test x$enable_nes = xyes; then
|
||||
AC_DEFINE([WANT_NES_EMU], [1], [Define if we are compiling with NES emulation.])
|
||||
AM_CONDITIONAL(WANT_NES_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(ngp,
|
||||
AC_HELP_STRING([--enable-ngp], [build with Neo Geo Pocket emulation [[default=yes]]]),
|
||||
, enable_ngp=yes)
|
||||
|
||||
if test x$enable_ngp = xyes; then
|
||||
AC_DEFINE([WANT_NGP_EMU], [1], [Define if we are compiling with NGP emulation.])
|
||||
AM_CONDITIONAL(WANT_NGP_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(pce,
|
||||
AC_HELP_STRING([--enable-pce], [build with PC Engine(TurboGrafx 16) emulation [[default=yes]]]),
|
||||
, enable_pce=yes)
|
||||
|
||||
if test x$enable_pce = xyes; then
|
||||
AC_DEFINE([WANT_PCE_EMU], [1], [Define if we are compiling with PCE emulation.])
|
||||
AM_CONDITIONAL(WANT_PCE_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(pce-fast,
|
||||
AC_HELP_STRING([--enable-pce-fast], [build the separate, fast PC Engine(TurboGrafx 16) emulation [[default=yes]]]),
|
||||
, enable_pce_fast=yes)
|
||||
|
||||
if test x$enable_pce_fast = xyes; then
|
||||
AC_DEFINE([WANT_PCE_FAST_EMU], [1], [Define if we are compiling with separate fast PCE emulation.])
|
||||
AM_CONDITIONAL(WANT_PCE_FAST_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(pcfx,
|
||||
AC_HELP_STRING([--enable-pcfx], [build with PC-FX emulation [[default=yes]]]),
|
||||
, enable_pcfx=yes)
|
||||
|
||||
if test x$enable_pcfx = xyes; then
|
||||
AC_DEFINE([WANT_PCFX_EMU], [1], [Define if we are compiling with PC-FX emulation.])
|
||||
AM_CONDITIONAL(WANT_PCFX_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(psx,
|
||||
AC_HELP_STRING([--enable-psx], [build with PlayStation emulation [[default=yes]]]),
|
||||
, enable_psx=yes)
|
||||
|
||||
if test x$enable_psx = xyes; then
|
||||
AC_DEFINE([WANT_PSX_EMU], [1], [Define if we are compiling with PlayStation emulation.])
|
||||
AM_CONDITIONAL(WANT_PSX_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(sms,
|
||||
AC_HELP_STRING([--enable-sms], [build with SMS+GG emulation [[default=yes]]]),
|
||||
, enable_sms=yes)
|
||||
|
||||
if test x$enable_sms = xyes; then
|
||||
AC_DEFINE([WANT_SMS_EMU], [1], [Define if we are compiling with SMS+GG emulation.])
|
||||
AM_CONDITIONAL(WANT_SMS_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(snes,
|
||||
AC_HELP_STRING([--enable-snes], [build with SNES emulation [[default=yes]]]),
|
||||
, enable_snes=yes)
|
||||
|
||||
if test x$enable_snes = xyes; then
|
||||
AC_DEFINE([WANT_SNES_EMU], [1], [Define if we are compiling with SNES emulation.])
|
||||
AM_CONDITIONAL(WANT_SNES_EMU, true)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(vb,
|
||||
AC_HELP_STRING([--enable-vb], [build with Virtual Boy emulation [[default=yes]]]),
|
||||
, enable_vb=yes)
|
||||
|
||||
if test x$enable_vb = xyes; then
|
||||
AC_DEFINE([WANT_VB_EMU], [1], [Define if we are compiling with Virtual Boy emulation.])
|
||||
AM_CONDITIONAL(WANT_VB_EMU, true)
|
||||
fi
|
||||
|
||||
|
||||
AC_ARG_ENABLE(wswan,
|
||||
AC_HELP_STRING([--enable-wswan], [build with WonderSwan emulation [[default=yes]]]),
|
||||
, enable_wswan=yes)
|
||||
|
||||
if test x$enable_wswan = xyes; then
|
||||
AC_DEFINE([WANT_WSWAN_EMU], [1], [Define if we are compiling with WonderSwan emulation.])
|
||||
AM_CONDITIONAL(WANT_WSWAN_EMU, true)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(HAVE_OSSDSP, false)
|
||||
AM_CONDITIONAL(HAVE_ALSA, false)
|
||||
AM_CONDITIONAL(HAVE_DIRECTSOUND, false)
|
||||
AM_CONDITIONAL(HAVE_SDL, false)
|
||||
AM_CONDITIONAL(HAVE_JACK, false)
|
||||
|
||||
dnl Check* functions ripped from SDL's autoconf file, with heavy modifications
|
||||
dnl See if the ALSA audio interface is supported
|
||||
|
||||
CheckALSA()
|
||||
{
|
||||
AC_ARG_ENABLE(alsa,
|
||||
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
|
||||
, enable_alsa=yes)
|
||||
if test x$enable_alsa = xyes; then
|
||||
AM_PATH_ALSA(1.0.0, have_alsa=yes, have_alsa=no)
|
||||
|
||||
# Restore all flags from before the ALSA detection runs
|
||||
CFLAGS="$alsa_save_CFLAGS"
|
||||
LDFLAGS="$alsa_save_LDFLAGS"
|
||||
LIBS="$alsa_save_LIBS"
|
||||
|
||||
if test x$have_alsa = xyes; then
|
||||
AM_CONDITIONAL(HAVE_ALSA, true)
|
||||
AC_DEFINE([HAVE_ALSA], [1], [Define if we are compiling with ALSA support.])
|
||||
LIBS="$LIBS $ALSA_LIBS"
|
||||
CPPFLAGS="$CPPFLAGS $ALSA_CFLAGS"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
CheckJACK()
|
||||
{
|
||||
AC_ARG_ENABLE(jack,
|
||||
AC_HELP_STRING([--enable-jack], [support the JACK audio API [[default=yes]]]),
|
||||
, enable_jack=yes)
|
||||
if test x$enable_jack = xyes; then
|
||||
PKG_CHECK_MODULES(JACK, jack, [have_jack=yes], [have_jack=no])
|
||||
|
||||
if test x$have_jack = xyes; then
|
||||
AM_CONDITIONAL(HAVE_JACK, true)
|
||||
AC_DEFINE([HAVE_JACK], [1], [Define if we are compiling with JACK support.])
|
||||
LIBS="$LIBS $JACK_LIBS"
|
||||
CPPFLAGS="$CPPFLAGS $JACK_CFLAGS"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
CheckALSA
|
||||
CheckJACK
|
||||
|
||||
SDL_VERSION=1.2.0
|
||||
AM_PATH_SDL($SDL_VERSION, HAVE_SDL=true, HAVE_SDL=false)
|
||||
if $HAVE_SDL
|
||||
then
|
||||
AM_CONDITIONAL(HAVE_SDL, true)
|
||||
AC_DEFINE([HAVE_SDL], [1], [Define if we are compiling with SDL sound support.])
|
||||
AC_SUBST(SDL_LIBS)
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
else
|
||||
AC_MSG_ERROR([*** SDL 1.2.x not found!])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([libcdio],
|
||||
[AS_HELP_STRING([--with-libcdio],
|
||||
[support physical CD reading @<:@default=yes@:>@])],
|
||||
[],
|
||||
[with_libcdio=yes])
|
||||
|
||||
AC_ARG_WITH([libsndfile],
|
||||
[AS_HELP_STRING([--with-libsndfile],
|
||||
[support various sound file formats in ripped CD images @<:@default=yes@:>@])],
|
||||
[],
|
||||
[with_libsndfile=yes])
|
||||
|
||||
#AC_ARG_WITH([ogg-vorbis],
|
||||
# [AS_HELP_STRING([--with-ogg-vorbis],
|
||||
# [support Ogg Vorbis playback for ripped CD images @<:@default=yes@:>@])],
|
||||
# [],
|
||||
# [with_oggvorbis=yes])
|
||||
|
||||
|
||||
AM_CONDITIONAL(WIN32, false)
|
||||
AM_CONDITIONAL(UNIX, false)
|
||||
AM_CONDITIONAL(HAVE_LIBCDIO, false)
|
||||
AM_CONDITIONAL(HAVE_LINUX_JOYSTICK, false)
|
||||
|
||||
if expr x"$target" : 'x.*-mingw*' > /dev/null; then
|
||||
CPPFLAGS="-mstackrealign $CPPFLAGS"
|
||||
AC_CHECK_HEADER([dsound.h],HAVE_DIRECTSOUND=true, HAVE_DIRECTSOUND=false)
|
||||
|
||||
if $HAVE_DIRECTSOUND
|
||||
then
|
||||
AM_CONDITIONAL(HAVE_DIRECTSOUND,true)
|
||||
AC_DEFINE([HAVE_DIRECTSOUND], [1], [Define if we are compiling with DirectSound support.])
|
||||
LIBS="-ldxguid -lwinmm -ldsound $LIBS"
|
||||
fi
|
||||
|
||||
AC_DEFINE([PSS_STYLE],[2], [Defines the filesystem path-separator type.])
|
||||
AC_DEFINE([WIN32], [1], [Define if we are compiling for Win32.])
|
||||
AM_CONDITIONAL(WIN32, true)
|
||||
|
||||
LIBS="-mwindows -lws2_32 -ldxguid -lwinmm -ldinput $LIBS -lwinmm"
|
||||
|
||||
if test x$with_libcdio = xyes; then
|
||||
LIBS="$LIBS -lcdio"
|
||||
AC_DEFINE([HAVE_LIBCDIO], [1], [Define if we are compiling with libcdio support.])
|
||||
AM_CONDITIONAL(HAVE_LIBCDIO, true)
|
||||
fi
|
||||
|
||||
if test x$with_libsndfile = xyes; then
|
||||
SNDFILE_LIBS="-lsndfile"
|
||||
SNDFILE_CFLAGS=""
|
||||
AC_DEFINE([HAVE_LIBSNDFILE], [1], [Define if we are compiling with libsndfile support.])
|
||||
fi
|
||||
else
|
||||
if test x$with_libcdio = xyes; then
|
||||
PKG_CHECK_MODULES(LIBCDIO, libcdio, [], AC_MSG_ERROR([*** libcdio not found!]))
|
||||
AC_DEFINE([HAVE_LIBCDIO], [1], [Define if we are compiling with libcdio support.])
|
||||
AM_CONDITIONAL(HAVE_LIBCDIO, true)
|
||||
fi
|
||||
|
||||
if test x$with_libsndfile = xyes; then
|
||||
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, [], AC_MSG_ERROR([*** libsndfile >= 1.0.2 not found!]))
|
||||
AC_DEFINE([HAVE_LIBSNDFILE], [1], [Define if we are compiling with libsndfile support.])
|
||||
fi
|
||||
|
||||
AC_DEFINE([PSS_STYLE],[1], [Defines the filesystem path-separator type.])
|
||||
AC_CHECK_HEADER([sys/soundcard.h],[AM_CONDITIONAL(HAVE_OSSDSP,true) AC_DEFINE([HAVE_OSSDSP], [1], [Define if we are compiling with OSS support.])])
|
||||
AC_CHECK_HEADER([linux/joystick.h],[AM_CONDITIONAL(HAVE_LINUX_JOYSTICK,true) AC_DEFINE([HAVE_LINUX_JOYSTICK], [1], [Define if we are compiling with Linux joystick support.])])
|
||||
if expr x"$target" : 'x.*beos' > /dev/null; then
|
||||
CPPFLAGS="-no-fpic $CPPFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl FIXME: Make sure POSIX/BSD sockets API detection doesn't have any false positives(like when targeting Windows).
|
||||
dnl
|
||||
AM_CONDITIONAL(HAVE_POSIX_SOCKETS, false)
|
||||
dnl
|
||||
dnl
|
||||
HAVE_POSIX_SOCKETS=yes
|
||||
|
||||
dnl
|
||||
dnl Solaris may require "nsl" and "socket" libraries.
|
||||
dnl
|
||||
AC_SEARCH_LIBS([gethostbyname], [nsl])
|
||||
AC_SEARCH_LIBS([socket], [socket])
|
||||
|
||||
AC_CHECK_FUNCS(socket bind listen connect accept send recv close gethostbyname gethostbyaddr getaddrinfo freeaddrinfo gai_strerror select getsockopt setsockopt, [],
|
||||
[HAVE_POSIX_SOCKETS=no])
|
||||
|
||||
if test x$HAVE_POSIX_SOCKETS = xyes; then
|
||||
AM_CONDITIONAL(HAVE_POSIX_SOCKETS, true)
|
||||
AC_DEFINE([HAVE_POSIX_SOCKETS], [1], [Define if we are compiling with POSIX sockets support.])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ARCH_X86, false)
|
||||
AM_CONDITIONAL(ARCH_X86_32, false)
|
||||
AM_CONDITIONAL(ARCH_X86_64, false)
|
||||
AM_CONDITIONAL(ARCH_POWERPC, false)
|
||||
AM_CONDITIONAL(ARCH_POWERPC_ALTIVEC, false)
|
||||
|
||||
TRIO_CFLAGS=""
|
||||
MMX_CFLAGS=""
|
||||
SSE_CFLAGS=""
|
||||
SSE2_CFLAGS=""
|
||||
SSE3_CFLAGS=""
|
||||
case "$target_cpu" in
|
||||
x86_64|amd64)
|
||||
AC_DEFINE([ARCH_X86], [1], [Define if we are compiling for 32-bit or 64-bit x86 architectures.])
|
||||
AM_CONDITIONAL(ARCH_X86, true)
|
||||
AC_DEFINE([ARCH_X86_64], [1], [Define if we are compiling for 64-bit x86 architectures.])
|
||||
AM_CONDITIONAL(ARCH_X86_64, true)
|
||||
dnl
|
||||
dnl MMX, SSE, and SSE2 here should be unnecessary, but put them in just in case.
|
||||
dnl
|
||||
MMX_CFLAGS="-mmmx"
|
||||
SSE_CFLAGS="-msse"
|
||||
SSE2_CFLAGS="-msse2"
|
||||
SSE3_CFLAGS="-msse3"
|
||||
;;
|
||||
|
||||
i*86)
|
||||
AC_DEFINE([ARCH_X86], [1], [Define if we are compiling for 32-bit or 64-bit x86 architectures.])
|
||||
AM_CONDITIONAL(ARCH_X86, true)
|
||||
AC_DEFINE([ARCH_X86_32], [1], [Define if we are compiling for 32-bit x86 architectures.])
|
||||
AM_CONDITIONAL(ARCH_X86_32, true)
|
||||
MMX_CFLAGS="-mmmx"
|
||||
SSE_CFLAGS="-msse"
|
||||
SSE2_CFLAGS="-msse2"
|
||||
SSE3_CFLAGS="-msse3"
|
||||
;;
|
||||
|
||||
powerpc)
|
||||
AC_DEFINE([ARCH_POWERPC], [1], [Define if we are compiling for PPC architectures.])
|
||||
AM_CONDITIONAL(ARCH_POWERPC, true)
|
||||
|
||||
if test x$enable_altivec = xyes; then
|
||||
ALTIVEC_FLAGS=""
|
||||
AX_CFLAGS_GCC_OPTION([-faltivec], ALTIVEC_FLAGS)
|
||||
AX_CFLAGS_GCC_OPTION([-maltivec], ALTIVEC_FLAGS)
|
||||
if test "x$ALTIVEC_FLAGS" != "x"; then
|
||||
CPPFLAGS="$CPPFLAGS $ALTIVEC_FLAGS"
|
||||
AC_DEFINE([ARCH_POWERPC_ALTIVEC], [1], [Define if we are compiling with AltiVec usage.])
|
||||
AM_CONDITIONAL(ARCH_POWERPC_ALTIVEC, true)
|
||||
|
||||
AC_CHECK_HEADER([altivec.h],
|
||||
AC_DEFINE([HAVE_ALTIVEC_H], [1], [Define if altivec.h is present and usable.]),
|
||||
[] )
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
alpha*)
|
||||
AX_CFLAGS_GCC_OPTION([-mieee], TRIO_CFLAGS)
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(MMX_CFLAGS)
|
||||
AC_SUBST(SSE_CFLAGS)
|
||||
AC_SUBST(SSE2_CFLAGS)
|
||||
AC_SUBST(SSE3_CFLAGS)
|
||||
AC_SUBST(TRIO_CFLAGS)
|
||||
|
||||
AC_C_BIGENDIAN([AC_DEFINE([MSB_FIRST],[1],[Define on big-endian platforms.])],
|
||||
[
|
||||
AC_DEFINE([LSB_FIRST],[1],[Define on little-endian platforms.])
|
||||
])
|
||||
AC_DEFINE_UNQUOTED([MEDNAFEN_VERSION],"$MEDNAFEN_VERSION", [Mednafen version definition.])
|
||||
AC_DEFINE_UNQUOTED([MEDNAFEN_VERSION_NUMERIC],$MEDNAFEN_VERSION_NUMERIC, [Mednafen version numeric.])
|
||||
|
||||
AC_DEFINE([MPC_FIXED_POINT], [1], [Define to use fixed-point MPC decoder.])
|
||||
|
||||
LIBS="$SNDFILE_LIBS $LIBCDIO_LIBS $LIBS"
|
||||
CPPFLAGS="$LIBCDIO_CFLAGS $SNDFILE_CFLAGS $CPPFLAGS"
|
||||
|
||||
dnl Output Makefiles
|
||||
AC_OUTPUT([Makefile src/Makefile src/drivers/Makefile src/sexyal/Makefile src/tremor/Makefile src/mpcdec/Makefile src/trio/Makefile src/gb/Makefile src/gba/Makefile src/lynx/Makefile src/pce/Makefile src/pce_fast/Makefile src/pcfx/Makefile src/psx/Makefile src/sms/Makefile src/vb/Makefile src/wswan/Makefile src/nes/Makefile src/snes/Makefile src/ngp/Makefile src/sound/Makefile src/hw_cpu/Makefile src/hw_misc/Makefile src/hw_sound/Makefile src/hw_video/Makefile src/md/Makefile src/demo/Makefile src/desa68/Makefile po/Makefile.in intl/Makefile])
|
|
@ -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:
|
|
@ -0,0 +1,258 @@
|
|||
/***************************************************************************
|
||||
* *
|
||||
* XInput.h -- This module defines XBOX controller APIs *
|
||||
* and constansts for the Windows platform. *
|
||||
* *
|
||||
* Copyright (c) Microsoft Corp. All rights reserved. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef _XINPUT_H_
|
||||
#define _XINPUT_H_
|
||||
|
||||
#include <windef.h>
|
||||
|
||||
// Current name of the DLL shipped in the same SDK as this header.
|
||||
// The name reflects the current version
|
||||
#define XINPUT_DLL_A "xinput1_3.dll"
|
||||
#define XINPUT_DLL_W L"xinput1_3.dll"
|
||||
#ifdef UNICODE
|
||||
#define XINPUT_DLL XINPUT_DLL_W
|
||||
#else
|
||||
#define XINPUT_DLL XINPUT_DLL_A
|
||||
#endif
|
||||
|
||||
//
|
||||
// Device types available in XINPUT_CAPABILITIES
|
||||
//
|
||||
#define XINPUT_DEVTYPE_GAMEPAD 0x01
|
||||
|
||||
//
|
||||
// Device subtypes available in XINPUT_CAPABILITIES
|
||||
//
|
||||
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
|
||||
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
|
||||
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
|
||||
#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
|
||||
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
|
||||
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
|
||||
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
|
||||
|
||||
//
|
||||
// Flags for XINPUT_CAPABILITIES
|
||||
//
|
||||
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
|
||||
|
||||
//
|
||||
// Constants for gamepad buttons
|
||||
//
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||
#define XINPUT_GAMEPAD_START 0x0010
|
||||
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||
#define XINPUT_GAMEPAD_A 0x1000
|
||||
#define XINPUT_GAMEPAD_B 0x2000
|
||||
#define XINPUT_GAMEPAD_X 0x4000
|
||||
#define XINPUT_GAMEPAD_Y 0x8000
|
||||
|
||||
|
||||
//
|
||||
// Gamepad thresholds
|
||||
//
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
|
||||
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
|
||||
|
||||
//
|
||||
// Flags to pass to XInputGetCapabilities
|
||||
//
|
||||
#define XINPUT_FLAG_GAMEPAD 0x00000001
|
||||
|
||||
//
|
||||
// Devices that support batteries
|
||||
//
|
||||
#define BATTERY_DEVTYPE_GAMEPAD 0x00
|
||||
#define BATTERY_DEVTYPE_HEADSET 0x01
|
||||
|
||||
//
|
||||
// Flags for battery status level
|
||||
//
|
||||
#define BATTERY_TYPE_DISCONNECTED 0x00 // This device is not connected
|
||||
#define BATTERY_TYPE_WIRED 0x01 // Wired device, no battery
|
||||
#define BATTERY_TYPE_ALKALINE 0x02 // Alkaline battery source
|
||||
#define BATTERY_TYPE_NIMH 0x03 // Nickel Metal Hydride battery source
|
||||
#define BATTERY_TYPE_UNKNOWN 0xFF // Cannot determine the battery type
|
||||
|
||||
// These are only valid for wireless, connected devices, with known battery types
|
||||
// The amount of use time remaining depends on the type of device.
|
||||
#define BATTERY_LEVEL_EMPTY 0x00
|
||||
#define BATTERY_LEVEL_LOW 0x01
|
||||
#define BATTERY_LEVEL_MEDIUM 0x02
|
||||
#define BATTERY_LEVEL_FULL 0x03
|
||||
|
||||
// User index definitions
|
||||
#define XUSER_MAX_COUNT 4
|
||||
|
||||
#define XUSER_INDEX_ANY 0x000000FF
|
||||
|
||||
|
||||
//
|
||||
// Codes returned for the gamepad keystroke
|
||||
//
|
||||
|
||||
#define VK_PAD_A 0x5800
|
||||
#define VK_PAD_B 0x5801
|
||||
#define VK_PAD_X 0x5802
|
||||
#define VK_PAD_Y 0x5803
|
||||
#define VK_PAD_RSHOULDER 0x5804
|
||||
#define VK_PAD_LSHOULDER 0x5805
|
||||
#define VK_PAD_LTRIGGER 0x5806
|
||||
#define VK_PAD_RTRIGGER 0x5807
|
||||
|
||||
#define VK_PAD_DPAD_UP 0x5810
|
||||
#define VK_PAD_DPAD_DOWN 0x5811
|
||||
#define VK_PAD_DPAD_LEFT 0x5812
|
||||
#define VK_PAD_DPAD_RIGHT 0x5813
|
||||
#define VK_PAD_START 0x5814
|
||||
#define VK_PAD_BACK 0x5815
|
||||
#define VK_PAD_LTHUMB_PRESS 0x5816
|
||||
#define VK_PAD_RTHUMB_PRESS 0x5817
|
||||
|
||||
#define VK_PAD_LTHUMB_UP 0x5820
|
||||
#define VK_PAD_LTHUMB_DOWN 0x5821
|
||||
#define VK_PAD_LTHUMB_RIGHT 0x5822
|
||||
#define VK_PAD_LTHUMB_LEFT 0x5823
|
||||
#define VK_PAD_LTHUMB_UPLEFT 0x5824
|
||||
#define VK_PAD_LTHUMB_UPRIGHT 0x5825
|
||||
#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
|
||||
#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
|
||||
|
||||
#define VK_PAD_RTHUMB_UP 0x5830
|
||||
#define VK_PAD_RTHUMB_DOWN 0x5831
|
||||
#define VK_PAD_RTHUMB_RIGHT 0x5832
|
||||
#define VK_PAD_RTHUMB_LEFT 0x5833
|
||||
#define VK_PAD_RTHUMB_UPLEFT 0x5834
|
||||
#define VK_PAD_RTHUMB_UPRIGHT 0x5835
|
||||
#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
|
||||
#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
|
||||
|
||||
//
|
||||
// Flags used in XINPUT_KEYSTROKE
|
||||
//
|
||||
#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
|
||||
#define XINPUT_KEYSTROKE_KEYUP 0x0002
|
||||
#define XINPUT_KEYSTROKE_REPEAT 0x0004
|
||||
|
||||
//
|
||||
// Structures used by XInput APIs
|
||||
//
|
||||
typedef struct _XINPUT_GAMEPAD
|
||||
{
|
||||
WORD wButtons;
|
||||
BYTE bLeftTrigger;
|
||||
BYTE bRightTrigger;
|
||||
SHORT sThumbLX;
|
||||
SHORT sThumbLY;
|
||||
SHORT sThumbRX;
|
||||
SHORT sThumbRY;
|
||||
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
|
||||
|
||||
typedef struct _XINPUT_STATE
|
||||
{
|
||||
DWORD dwPacketNumber;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
} XINPUT_STATE, *PXINPUT_STATE;
|
||||
|
||||
typedef struct _XINPUT_VIBRATION
|
||||
{
|
||||
WORD wLeftMotorSpeed;
|
||||
WORD wRightMotorSpeed;
|
||||
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||
|
||||
typedef struct _XINPUT_CAPABILITIES
|
||||
{
|
||||
BYTE Type;
|
||||
BYTE SubType;
|
||||
WORD Flags;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
XINPUT_VIBRATION Vibration;
|
||||
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
|
||||
|
||||
typedef struct _XINPUT_BATTERY_INFORMATION
|
||||
{
|
||||
BYTE BatteryType;
|
||||
BYTE BatteryLevel;
|
||||
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
|
||||
|
||||
typedef struct _XINPUT_KEYSTROKE
|
||||
{
|
||||
WORD VirtualKey;
|
||||
WCHAR Unicode;
|
||||
WORD Flags;
|
||||
BYTE UserIndex;
|
||||
BYTE HidCode;
|
||||
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
|
||||
|
||||
//
|
||||
// XInput APIs
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DWORD WINAPI XInputGetState
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
XINPUT_STATE* pState // [out] Receives the current state
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputSetState
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
XINPUT_VIBRATION* pVibration // [in, out] The vibration information to send to the controller
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetCapabilities
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
DWORD dwFlags, // [in] Input flags that identify the device type
|
||||
XINPUT_CAPABILITIES* pCapabilities // [out] Receives the capabilities
|
||||
);
|
||||
|
||||
void WINAPI XInputEnable
|
||||
(
|
||||
BOOL enable // [in] Indicates whether xinput is enabled or disabled.
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetDSoundAudioDeviceGuids
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
GUID* pDSoundRenderGuid, // [out] DSound device ID for render
|
||||
GUID* pDSoundCaptureGuid // [out] DSound device ID for capture
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetBatteryInformation
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
BYTE devType, // [in] Which device on this user index
|
||||
XINPUT_BATTERY_INFORMATION* pBatteryInformation // [out] Contains the level and types of batteries
|
||||
);
|
||||
|
||||
DWORD WINAPI XInputGetKeystroke
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
DWORD dwReserved, // [in] Reserved for future use
|
||||
PXINPUT_KEYSTROKE pKeystroke // [out] Pointer to an XINPUT_KEYSTROKE structure that receives an input event.
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_XINPUT_H_
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,243 @@
|
|||
// Finite impulse response (FIR) resampler with adjustable FIR size
|
||||
|
||||
// Game_Music_Emu 0.5.2
|
||||
#ifndef FIR_RESAMPLER_H
|
||||
#define FIR_RESAMPLER_H
|
||||
|
||||
#include "blargg_common.h"
|
||||
#include <string.h>
|
||||
|
||||
class Fir_Resampler_ {
|
||||
public:
|
||||
|
||||
// Use Fir_Resampler<width> (below)
|
||||
|
||||
// Set input/output resampling ratio and optionally low-pass rolloff and gain.
|
||||
// Returns actual ratio used (rounded to internal precision).
|
||||
double time_ratio( double factor, double rolloff = 0.999, double gain = 1.0 );
|
||||
|
||||
// Current input/output ratio
|
||||
double ratio() const { return ratio_; }
|
||||
|
||||
// Input
|
||||
|
||||
typedef short sample_t;
|
||||
|
||||
// Resize and clear input buffer
|
||||
blargg_err_t buffer_size( int );
|
||||
|
||||
// Clear input buffer. At least two output samples will be available after
|
||||
// two input samples are written.
|
||||
void clear();
|
||||
|
||||
// Number of input samples that can be written
|
||||
int max_write() const { return buf.end() - write_pos; }
|
||||
|
||||
// Pointer to place to write input samples
|
||||
sample_t* buffer() { return write_pos; }
|
||||
|
||||
// Notify resampler that 'count' input samples have been written
|
||||
void write( long count );
|
||||
|
||||
// Number of input samples in buffer
|
||||
int written() const { return write_pos - &buf [write_offset]; }
|
||||
|
||||
// Skip 'count' input samples. Returns number of samples actually skipped.
|
||||
int skip_input( long count );
|
||||
|
||||
// Output
|
||||
|
||||
// Number of extra input samples needed until 'count' output samples are available
|
||||
int input_needed( blargg_long count ) const;
|
||||
|
||||
// Number of output samples available
|
||||
int avail() const { return avail_( write_pos - &buf [width_ * stereo] ); }
|
||||
|
||||
public:
|
||||
~Fir_Resampler_();
|
||||
protected:
|
||||
enum { stereo = 2 };
|
||||
enum { max_res = 32 };
|
||||
blargg_vector<sample_t> buf;
|
||||
sample_t* write_pos;
|
||||
int res;
|
||||
int imp_phase;
|
||||
int const width_;
|
||||
int const write_offset;
|
||||
blargg_ulong skip_bits;
|
||||
int step;
|
||||
int input_per_cycle;
|
||||
double ratio_;
|
||||
sample_t* impulses;
|
||||
|
||||
Fir_Resampler_( int width, sample_t* );
|
||||
int avail_( blargg_long input_count ) const;
|
||||
};
|
||||
|
||||
// Width is number of points in FIR. Must be even and 4 or more. More points give
|
||||
// better quality and rolloff effectiveness, and take longer to calculate.
|
||||
template<int width>
|
||||
class Fir_Resampler : public Fir_Resampler_ {
|
||||
BOOST_STATIC_ASSERT( width >= 4 && width % 2 == 0 );
|
||||
short impulses [max_res] [width];
|
||||
public:
|
||||
Fir_Resampler() : Fir_Resampler_( width, impulses [0] ) { }
|
||||
|
||||
// Read at most 'count' samples. Returns number of samples actually read.
|
||||
typedef short sample_t;
|
||||
int read( sample_t* out, blargg_long count );
|
||||
|
||||
int read_mono_hack( sample_t* out, blargg_long count );
|
||||
};
|
||||
|
||||
// End of public interface
|
||||
|
||||
inline void Fir_Resampler_::write( long count )
|
||||
{
|
||||
write_pos += count;
|
||||
assert( write_pos <= buf.end() );
|
||||
}
|
||||
|
||||
template<int width>
|
||||
int Fir_Resampler<width>::read( sample_t* out_begin, blargg_long count )
|
||||
{
|
||||
sample_t* out = out_begin;
|
||||
const sample_t* in = buf.begin();
|
||||
sample_t* end_pos = write_pos;
|
||||
blargg_ulong skip = skip_bits >> imp_phase;
|
||||
sample_t const* imp = impulses [imp_phase];
|
||||
int remain = res - imp_phase;
|
||||
int const local_step = this->step;
|
||||
|
||||
count >>= 1;
|
||||
|
||||
if ( end_pos - in >= width * stereo )
|
||||
{
|
||||
end_pos -= width * stereo;
|
||||
do
|
||||
{
|
||||
count--;
|
||||
|
||||
// accumulate in extended precision
|
||||
blargg_long l = 0;
|
||||
blargg_long r = 0;
|
||||
|
||||
const sample_t* i = in;
|
||||
if ( count < 0 )
|
||||
break;
|
||||
|
||||
for ( int n = width / 2; n; --n )
|
||||
{
|
||||
int pt0 = imp [0];
|
||||
l += pt0 * i [0];
|
||||
r += pt0 * i [1];
|
||||
int pt1 = imp [1];
|
||||
imp += 2;
|
||||
l += pt1 * i [2];
|
||||
r += pt1 * i [3];
|
||||
i += 4;
|
||||
}
|
||||
|
||||
remain--;
|
||||
|
||||
l >>= 15;
|
||||
r >>= 15;
|
||||
|
||||
in += (skip * stereo) & stereo;
|
||||
skip >>= 1;
|
||||
in += local_step;
|
||||
|
||||
if ( !remain )
|
||||
{
|
||||
imp = impulses [0];
|
||||
skip = skip_bits;
|
||||
remain = res;
|
||||
}
|
||||
|
||||
out [0] = (sample_t) l;
|
||||
out [1] = (sample_t) r;
|
||||
out += 2;
|
||||
}
|
||||
while ( in <= end_pos );
|
||||
}
|
||||
|
||||
imp_phase = res - remain;
|
||||
|
||||
int left = write_pos - in;
|
||||
write_pos = &buf [left];
|
||||
memmove( buf.begin(), in, left * sizeof *in );
|
||||
|
||||
return out - out_begin;
|
||||
}
|
||||
#include <stdio.h>
|
||||
template<int width>
|
||||
int Fir_Resampler<width>::read_mono_hack( sample_t* out_begin, blargg_long count )
|
||||
{
|
||||
sample_t* out = out_begin;
|
||||
const sample_t* in = buf.begin();
|
||||
sample_t* end_pos = write_pos;
|
||||
blargg_ulong skip = skip_bits >> imp_phase;
|
||||
sample_t const* imp = impulses [imp_phase];
|
||||
int remain = res - imp_phase;
|
||||
int const local_step = this->step;
|
||||
|
||||
count >>= 1;
|
||||
|
||||
if ( end_pos - in >= width * stereo )
|
||||
{
|
||||
end_pos -= width * stereo;
|
||||
do
|
||||
{
|
||||
count--;
|
||||
|
||||
// accumulate in extended precision
|
||||
blargg_long l = 0;
|
||||
|
||||
const sample_t* i = in;
|
||||
if ( count < 0 )
|
||||
break;
|
||||
|
||||
for ( int n = width / 2; n; --n )
|
||||
{
|
||||
int pt0 = imp [0];
|
||||
l += pt0 * i [0];
|
||||
|
||||
int pt1 = imp [1];
|
||||
imp += 2;
|
||||
l += pt1 * i [2];
|
||||
|
||||
i += 4;
|
||||
}
|
||||
|
||||
remain--;
|
||||
|
||||
l >>= 15;
|
||||
|
||||
in += (skip * stereo) & stereo;
|
||||
skip >>= 1;
|
||||
in += local_step;
|
||||
|
||||
if ( !remain )
|
||||
{
|
||||
imp = impulses [0];
|
||||
skip = skip_bits;
|
||||
remain = res;
|
||||
}
|
||||
|
||||
*out = (sample_t) l;
|
||||
out ++;
|
||||
}
|
||||
while ( in <= end_pos );
|
||||
}
|
||||
|
||||
imp_phase = res - remain;
|
||||
|
||||
int left = write_pos - in;
|
||||
write_pos = &buf [left];
|
||||
memmove( buf.begin(), in, left * sizeof *in );
|
||||
|
||||
return out - out_begin;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,175 @@
|
|||
// Sets up common environment for Shay Green's libraries.
|
||||
// To change configuration options, modify blargg_config.h, not this file.
|
||||
|
||||
#ifndef BLARGG_COMMON_H
|
||||
#define BLARGG_COMMON_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#undef BLARGG_COMMON_H
|
||||
// allow blargg_config.h to #include blargg_common.h
|
||||
#include "blargg_config.h"
|
||||
#ifndef BLARGG_COMMON_H
|
||||
#define BLARGG_COMMON_H
|
||||
|
||||
// STATIC_CAST(T,expr): Used in place of static_cast<T> (expr)
|
||||
#ifndef STATIC_CAST
|
||||
#define STATIC_CAST(T,expr) ((T) (expr))
|
||||
#endif
|
||||
|
||||
// blargg_err_t (0 on success, otherwise error string)
|
||||
#ifndef blargg_err_t
|
||||
typedef const char* blargg_err_t;
|
||||
#endif
|
||||
|
||||
// blargg_vector - very lightweight vector of POD types (no constructor/destructor)
|
||||
template<class T>
|
||||
class blargg_vector {
|
||||
T* begin_;
|
||||
size_t size_;
|
||||
public:
|
||||
blargg_vector() : begin_( 0 ), size_( 0 ) { }
|
||||
~blargg_vector() { free( begin_ ); }
|
||||
size_t size() const { return size_; }
|
||||
T* begin() const { return begin_; }
|
||||
T* end() const { return begin_ + size_; }
|
||||
blargg_err_t resize( size_t n )
|
||||
{
|
||||
void* p = realloc( begin_, n * sizeof (T) );
|
||||
if ( !p && n )
|
||||
return "Out of memory";
|
||||
begin_ = (T*) p;
|
||||
size_ = n;
|
||||
return 0;
|
||||
}
|
||||
void clear() { void* p = begin_; begin_ = 0; size_ = 0; free( p ); }
|
||||
T& operator [] ( size_t n ) const
|
||||
{
|
||||
assert( n <= size_ ); // <= to allow past-the-end value
|
||||
return begin_ [n];
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef BLARGG_DISABLE_NOTHROW
|
||||
#if __cplusplus < 199711
|
||||
#define BLARGG_THROWS( spec )
|
||||
#else
|
||||
#define BLARGG_THROWS( spec ) throw spec
|
||||
#endif
|
||||
#define BLARGG_DISABLE_NOTHROW \
|
||||
void* operator new ( size_t s ) BLARGG_THROWS(()) { return malloc( s ); }\
|
||||
void operator delete ( void* p ) { free( p ); }
|
||||
#define BLARGG_NEW new
|
||||
#else
|
||||
#include <new>
|
||||
#define BLARGG_NEW new (std::nothrow)
|
||||
#endif
|
||||
|
||||
#define BLARGG_4CHAR( a, b, c, d ) \
|
||||
((a&0xFF)*0x1000000L + (b&0xFF)*0x10000L + (c&0xFF)*0x100L + (d&0xFF))
|
||||
|
||||
// BOOST_STATIC_ASSERT( expr ): Generates compile error if expr is 0.
|
||||
#ifndef BOOST_STATIC_ASSERT
|
||||
#ifdef _MSC_VER
|
||||
// MSVC6 (_MSC_VER < 1300) fails for use of __LINE__ when /Zl is specified
|
||||
#define BOOST_STATIC_ASSERT( expr ) \
|
||||
void blargg_failed_( int (*arg) [2 / (int) !!(expr) - 1] )
|
||||
#else
|
||||
// Some other compilers fail when declaring same function multiple times in class,
|
||||
// so differentiate them by line
|
||||
#define BOOST_STATIC_ASSERT( expr ) \
|
||||
void blargg_failed_( int (*arg) [2 / !!(expr) - 1] [__LINE__] )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// BLARGG_COMPILER_HAS_BOOL: If 0, provides bool support for old compiler. If 1,
|
||||
// compiler is assumed to support bool. If undefined, availability is determined.
|
||||
#ifndef BLARGG_COMPILER_HAS_BOOL
|
||||
#if defined (__MWERKS__)
|
||||
#if !__option(bool)
|
||||
#define BLARGG_COMPILER_HAS_BOOL 0
|
||||
#endif
|
||||
#elif defined (_MSC_VER)
|
||||
#if _MSC_VER < 1100
|
||||
#define BLARGG_COMPILER_HAS_BOOL 0
|
||||
#endif
|
||||
#elif defined (__GNUC__)
|
||||
// supports bool
|
||||
#elif __cplusplus < 199711
|
||||
#define BLARGG_COMPILER_HAS_BOOL 0
|
||||
#endif
|
||||
#endif
|
||||
#if defined (BLARGG_COMPILER_HAS_BOOL) && !BLARGG_COMPILER_HAS_BOOL
|
||||
// If you get errors here, modify your blargg_config.h file
|
||||
typedef int bool;
|
||||
const bool true = 1;
|
||||
const bool false = 0;
|
||||
#endif
|
||||
|
||||
// blargg_long/blargg_ulong = at least 32 bits, int if it's big enough
|
||||
#include <limits.h>
|
||||
|
||||
#if INT_MAX >= 0x7FFFFFFF
|
||||
typedef int blargg_long;
|
||||
#else
|
||||
typedef long blargg_long;
|
||||
#endif
|
||||
|
||||
#if UINT_MAX >= 0xFFFFFFFF
|
||||
typedef unsigned blargg_ulong;
|
||||
#else
|
||||
typedef unsigned long blargg_ulong;
|
||||
#endif
|
||||
|
||||
// BOOST::int8_t etc.
|
||||
|
||||
// HAVE_STDINT_H: If defined, use <stdint.h> for int8_t etc.
|
||||
#if defined (HAVE_STDINT_H)
|
||||
#include <stdint.h>
|
||||
#define BOOST
|
||||
|
||||
// HAVE_INTTYPES_H: If defined, use <stdint.h> for int8_t etc.
|
||||
#elif defined (HAVE_INTTYPES_H)
|
||||
#include <inttypes.h>
|
||||
#define BOOST
|
||||
|
||||
#else
|
||||
struct BOOST
|
||||
{
|
||||
#if UCHAR_MAX == 0xFF && SCHAR_MAX == 0x7F
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
#else
|
||||
// No suitable 8-bit type available
|
||||
typedef struct see_blargg_common_h int8_t;
|
||||
typedef struct see_blargg_common_h uint8_t;
|
||||
#endif
|
||||
|
||||
#if USHRT_MAX == 0xFFFF
|
||||
typedef short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
#else
|
||||
// No suitable 16-bit type available
|
||||
typedef struct see_blargg_common_h int16_t;
|
||||
typedef struct see_blargg_common_h uint16_t;
|
||||
#endif
|
||||
|
||||
#if ULONG_MAX == 0xFFFFFFFF
|
||||
typedef long int32_t;
|
||||
typedef unsigned long uint32_t;
|
||||
#elif UINT_MAX == 0xFFFFFFFF
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
// No suitable 32-bit type available
|
||||
typedef struct see_blargg_common_h int32_t;
|
||||
typedef struct see_blargg_common_h uint32_t;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,30 @@
|
|||
// Library configuration. Modify this file as necessary.
|
||||
|
||||
#ifndef BLARGG_CONFIG_H
|
||||
#define BLARGG_CONFIG_H
|
||||
|
||||
// Uncomment to use zlib for transparent decompression of gzipped files
|
||||
//#define HAVE_ZLIB_H
|
||||
|
||||
// Uncomment to support only the listed game music types. See gme_type_list.cpp
|
||||
// for a list of all types.
|
||||
//#define GME_TYPE_LIST gme_nsf_type, gme_gbs_type
|
||||
|
||||
// Uncomment to enable platform-specific optimizations
|
||||
//#define BLARGG_NONPORTABLE 1
|
||||
|
||||
// Uncomment to use faster, lower quality sound synthesis
|
||||
//#define BLIP_BUFFER_FAST 1
|
||||
|
||||
// Uncomment if automatic byte-order determination doesn't work
|
||||
//#define BLARGG_BIG_ENDIAN 1
|
||||
|
||||
// Uncomment if you get errors in the bool section of blargg_common.h
|
||||
//#define BLARGG_COMPILER_HAS_BOOL 1
|
||||
|
||||
// Use standard config.h if present
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,158 @@
|
|||
// CPU Byte Order Utilities
|
||||
|
||||
// Game_Music_Emu 0.5.2
|
||||
#ifndef BLARGG_ENDIAN
|
||||
#define BLARGG_ENDIAN
|
||||
|
||||
#include "blargg_common.h"
|
||||
|
||||
// BLARGG_CPU_CISC: Defined if CPU has very few general-purpose registers (< 16)
|
||||
#if defined (_M_IX86) || defined (_M_IA64) || defined (__i486__) || \
|
||||
defined (__x86_64__) || defined (__ia64__) || defined (__i386__)
|
||||
#define BLARGG_CPU_X86 1
|
||||
#define BLARGG_CPU_CISC 1
|
||||
#endif
|
||||
|
||||
#if defined (__powerpc__) || defined (__ppc__) || defined (__POWERPC__) || defined (__powerc)
|
||||
#define BLARGG_CPU_POWERPC 1
|
||||
#endif
|
||||
|
||||
// BLARGG_BIG_ENDIAN, BLARGG_LITTLE_ENDIAN: Determined automatically, otherwise only
|
||||
// one may be #defined to 1. Only needed if something actually depends on byte order.
|
||||
#if !defined (BLARGG_BIG_ENDIAN) && !defined (BLARGG_LITTLE_ENDIAN)
|
||||
#ifdef __GLIBC__
|
||||
// GCC handles this for us
|
||||
#include <endian.h>
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define BLARGG_LITTLE_ENDIAN 1
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define BLARGG_BIG_ENDIAN 1
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if defined (LSB_FIRST) || defined (__LITTLE_ENDIAN__) || BLARGG_CPU_X86 || \
|
||||
(defined (LITTLE_ENDIAN) && LITTLE_ENDIAN+0 != 1234)
|
||||
#define BLARGG_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
|
||||
#if defined (MSB_FIRST) || defined (__BIG_ENDIAN__) || defined (WORDS_BIGENDIAN) || \
|
||||
defined (__mips__) || defined (__sparc__) || BLARGG_CPU_POWERPC || \
|
||||
(defined (BIG_ENDIAN) && BIG_ENDIAN+0 != 4321)
|
||||
#define BLARGG_BIG_ENDIAN 1
|
||||
#else
|
||||
// No endian specified; assume little-endian, since it's most common
|
||||
#define BLARGG_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BLARGG_LITTLE_ENDIAN && BLARGG_BIG_ENDIAN
|
||||
#undef BLARGG_LITTLE_ENDIAN
|
||||
#undef BLARGG_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
inline void blargg_verify_byte_order()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
#if BLARGG_BIG_ENDIAN
|
||||
volatile int i = 1;
|
||||
assert( *(volatile char*) &i == 0 );
|
||||
#elif BLARGG_LITTLE_ENDIAN
|
||||
volatile int i = 1;
|
||||
assert( *(volatile char*) &i != 0 );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
inline unsigned get_le16( void const* p ) {
|
||||
return ((unsigned char const*) p) [1] * 0x100u +
|
||||
((unsigned char const*) p) [0];
|
||||
}
|
||||
inline unsigned get_be16( void const* p ) {
|
||||
return ((unsigned char const*) p) [0] * 0x100u +
|
||||
((unsigned char const*) p) [1];
|
||||
}
|
||||
inline blargg_ulong get_le32( void const* p ) {
|
||||
return ((unsigned char const*) p) [3] * 0x01000000u +
|
||||
((unsigned char const*) p) [2] * 0x00010000u +
|
||||
((unsigned char const*) p) [1] * 0x00000100u +
|
||||
((unsigned char const*) p) [0];
|
||||
}
|
||||
inline blargg_ulong get_be32( void const* p ) {
|
||||
return ((unsigned char const*) p) [0] * 0x01000000u +
|
||||
((unsigned char const*) p) [1] * 0x00010000u +
|
||||
((unsigned char const*) p) [2] * 0x00000100u +
|
||||
((unsigned char const*) p) [3];
|
||||
}
|
||||
inline void set_le16( void* p, unsigned n ) {
|
||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [0] = (unsigned char) n;
|
||||
}
|
||||
inline void set_be16( void* p, unsigned n ) {
|
||||
((unsigned char*) p) [0] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [1] = (unsigned char) n;
|
||||
}
|
||||
inline void set_le32( void* p, blargg_ulong n ) {
|
||||
((unsigned char*) p) [3] = (unsigned char) (n >> 24);
|
||||
((unsigned char*) p) [2] = (unsigned char) (n >> 16);
|
||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [0] = (unsigned char) n;
|
||||
}
|
||||
inline void set_be32( void* p, blargg_ulong n ) {
|
||||
((unsigned char*) p) [0] = (unsigned char) (n >> 24);
|
||||
((unsigned char*) p) [1] = (unsigned char) (n >> 16);
|
||||
((unsigned char*) p) [2] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [3] = (unsigned char) n;
|
||||
}
|
||||
|
||||
#if BLARGG_NONPORTABLE
|
||||
// Optimized implementation if byte order is known
|
||||
#if BLARGG_LITTLE_ENDIAN
|
||||
#define GET_LE16( addr ) (*(BOOST::uint16_t*) (addr))
|
||||
#define GET_LE32( addr ) (*(BOOST::uint32_t*) (addr))
|
||||
#define SET_LE16( addr, data ) (void) (*(BOOST::uint16_t*) (addr) = (data))
|
||||
#define SET_LE32( addr, data ) (void) (*(BOOST::uint32_t*) (addr) = (data))
|
||||
#elif BLARGG_BIG_ENDIAN
|
||||
#define GET_BE16( addr ) (*(BOOST::uint16_t*) (addr))
|
||||
#define GET_BE32( addr ) (*(BOOST::uint32_t*) (addr))
|
||||
#define SET_BE16( addr, data ) (void) (*(BOOST::uint16_t*) (addr) = (data))
|
||||
#define SET_BE32( addr, data ) (void) (*(BOOST::uint32_t*) (addr) = (data))
|
||||
#endif
|
||||
|
||||
#if BLARGG_CPU_POWERPC && defined (__MWERKS__)
|
||||
// PowerPC has special byte-reversed instructions
|
||||
// to do: assumes that PowerPC is running in big-endian mode
|
||||
// to do: implement for other compilers which don't support these macros
|
||||
#define GET_LE16( addr ) (__lhbrx( (addr), 0 ))
|
||||
#define GET_LE32( addr ) (__lwbrx( (addr), 0 ))
|
||||
#define SET_LE16( addr, data ) (__sthbrx( (data), (addr), 0 ))
|
||||
#define SET_LE32( addr, data ) (__stwbrx( (data), (addr), 0 ))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GET_LE16
|
||||
#define GET_LE16( addr ) get_le16( addr )
|
||||
#define GET_LE32( addr ) get_le32( addr )
|
||||
#define SET_LE16( addr, data ) set_le16( addr, data )
|
||||
#define SET_LE32( addr, data ) set_le32( addr, data )
|
||||
#endif
|
||||
|
||||
#ifndef GET_BE16
|
||||
#define GET_BE16( addr ) get_be16( addr )
|
||||
#define GET_BE32( addr ) get_be32( addr )
|
||||
#define SET_BE16( addr, data ) set_be16( addr, data )
|
||||
#define SET_BE32( addr, data ) set_be32( addr, data )
|
||||
#endif
|
||||
|
||||
// auto-selecting versions
|
||||
|
||||
inline void set_le( BOOST::uint16_t* p, unsigned n ) { SET_LE16( p, n ); }
|
||||
inline void set_le( BOOST::uint32_t* p, blargg_ulong n ) { SET_LE32( p, n ); }
|
||||
inline void set_be( BOOST::uint16_t* p, unsigned n ) { SET_BE16( p, n ); }
|
||||
inline void set_be( BOOST::uint32_t* p, blargg_ulong n ) { SET_BE32( p, n ); }
|
||||
inline unsigned get_le( BOOST::uint16_t* p ) { return GET_LE16( p ); }
|
||||
inline blargg_ulong get_le( BOOST::uint32_t* p ) { return GET_LE32( p ); }
|
||||
inline unsigned get_be( BOOST::uint16_t* p ) { return GET_BE16( p ); }
|
||||
inline blargg_ulong get_be( BOOST::uint32_t* p ) { return GET_BE32( p ); }
|
||||
|
||||
#endif
|
|
@ -0,0 +1,78 @@
|
|||
// Included at the beginning of library source files, after all other #include lines
|
||||
#ifndef BLARGG_SOURCE_H
|
||||
#define BLARGG_SOURCE_H
|
||||
|
||||
// If debugging is enabled, abort program if expr is false. Meant for checking
|
||||
// internal state and consistency. A failed assertion indicates a bug in the module.
|
||||
// void assert( bool expr );
|
||||
#include <assert.h>
|
||||
|
||||
// If debugging is enabled and expr is false, abort program. Meant for checking
|
||||
// caller-supplied parameters and operations that are outside the control of the
|
||||
// module. A failed requirement indicates a bug outside the module.
|
||||
// void require( bool expr );
|
||||
#undef require
|
||||
#define require( expr ) assert( expr )
|
||||
|
||||
// Like printf() except output goes to debug log file. Might be defined to do
|
||||
// nothing (not even evaluate its arguments).
|
||||
// void dprintf( const char* format, ... );
|
||||
inline void blargg_dprintf_( const char*, ... ) { }
|
||||
#undef dprintf
|
||||
#define dprintf (1) ? (void) 0 : blargg_dprintf_
|
||||
|
||||
// If enabled, evaluate expr and if false, make debug log entry with source file
|
||||
// and line. Meant for finding situations that should be examined further, but that
|
||||
// don't indicate a problem. In all cases, execution continues normally.
|
||||
#undef check
|
||||
#define check( expr ) ((void) 0)
|
||||
|
||||
// If expr yields error string, return it from current function, otherwise continue.
|
||||
#undef RETURN_ERR
|
||||
#define RETURN_ERR( expr ) do { \
|
||||
blargg_err_t blargg_return_err_ = (expr); \
|
||||
if ( blargg_return_err_ ) return blargg_return_err_; \
|
||||
} while ( 0 )
|
||||
|
||||
// If ptr is 0, return out of memory error string.
|
||||
#undef CHECK_ALLOC
|
||||
#define CHECK_ALLOC( ptr ) do { if ( (ptr) == 0 ) return "Out of memory"; } while ( 0 )
|
||||
|
||||
// Avoid any macros which evaluate their arguments multiple times
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
// using const references generates crappy code, and I am currenly only using these
|
||||
// for built-in types, so they take arguments by value
|
||||
|
||||
template<class T>
|
||||
inline T min( T x, T y )
|
||||
{
|
||||
if ( x < y )
|
||||
return x;
|
||||
return y;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T max( T x, T y )
|
||||
{
|
||||
if ( x < y )
|
||||
return y;
|
||||
return x;
|
||||
}
|
||||
|
||||
// TODO: good idea? bad idea?
|
||||
#undef byte
|
||||
#define byte byte_
|
||||
typedef unsigned char byte;
|
||||
|
||||
// deprecated
|
||||
#define BLARGG_CHECK_ALLOC CHECK_ALLOC
|
||||
#define BLARGG_RETURN_ERR RETURN_ERR
|
||||
|
||||
// BLARGG_SOURCE_BEGIN: If defined, #included, allowing redefition of dprintf and check
|
||||
#ifdef BLARGG_SOURCE_BEGIN
|
||||
#include BLARGG_SOURCE_BEGIN
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,498 @@
|
|||
// Band-limited sound synthesis buffer
|
||||
// Various changes and hacks for use in Mednafen.
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define blip_inline inline __attribute__((always_inline))
|
||||
#else
|
||||
#define blip_inline inline
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
// Blip_Buffer 0.4.1
|
||||
#ifndef BLIP_BUFFER_H
|
||||
#define BLIP_BUFFER_H
|
||||
|
||||
// Internal
|
||||
typedef int32_t blip_long;
|
||||
typedef uint32_t blip_ulong;
|
||||
typedef int64_t blip_s64;
|
||||
typedef uint64_t blip_u64;
|
||||
|
||||
// Time unit at source clock rate
|
||||
typedef blip_long blip_time_t;
|
||||
|
||||
// Output samples are 16-bit signed, with a range of -32768 to 32767
|
||||
typedef short blip_sample_t;
|
||||
enum { blip_sample_max = 32767 };
|
||||
|
||||
class Blip_Buffer {
|
||||
public:
|
||||
typedef const char* blargg_err_t;
|
||||
|
||||
// Set output sample rate and buffer length in milliseconds (1/1000 sec, defaults
|
||||
// to 1/4 second), then clear buffer. Returns NULL on success, otherwise if there
|
||||
// isn't enough memory, returns error without affecting current buffer setup.
|
||||
blargg_err_t set_sample_rate( long samples_per_sec, int msec_length = 1000 / 4 );
|
||||
|
||||
// Set number of source time units per second
|
||||
void clock_rate( long );
|
||||
|
||||
// End current time frame of specified duration and make its samples available
|
||||
// (along with any still-unread samples) for reading with read_samples(). Begins
|
||||
// a new time frame at the end of the current frame.
|
||||
void end_frame( blip_time_t time );
|
||||
|
||||
// Read at most 'max_samples' out of buffer into 'dest', removing them from from
|
||||
// the buffer. Returns number of samples actually read and removed. If stereo is
|
||||
// true, increments 'dest' one extra time after writing each sample, to allow
|
||||
// easy interleving of two channels into a stereo output buffer.
|
||||
long read_samples( blip_sample_t* dest, long max_samples, int stereo = 0 );
|
||||
|
||||
// Additional optional features
|
||||
|
||||
// Current output sample rate
|
||||
long sample_rate() const;
|
||||
|
||||
// Length of buffer, in milliseconds
|
||||
int length() const;
|
||||
|
||||
// Number of source time units per second
|
||||
long clock_rate() const;
|
||||
|
||||
// Set frequency high-pass filter frequency, where higher values reduce bass more
|
||||
void bass_freq( int frequency );
|
||||
|
||||
// Number of samples delay from synthesis to samples read out
|
||||
int output_latency() const;
|
||||
|
||||
// Remove all available samples and clear buffer to silence. If 'entire_buffer' is
|
||||
// false, just clears out any samples waiting rather than the entire buffer.
|
||||
void clear( int entire_buffer = 1 );
|
||||
|
||||
// Number of samples available for reading with read_samples()
|
||||
long samples_avail() const;
|
||||
|
||||
// Remove 'count' samples from those waiting to be read
|
||||
void remove_samples( long count );
|
||||
|
||||
// Experimental features
|
||||
|
||||
// Count number of clocks needed until 'count' samples will be available.
|
||||
// If buffer can't even hold 'count' samples, returns number of clocks until
|
||||
// buffer becomes full.
|
||||
blip_time_t count_clocks( long count ) const;
|
||||
|
||||
// Number of raw samples that can be mixed within frame of specified duration.
|
||||
long count_samples( blip_time_t duration ) const;
|
||||
|
||||
// Mix 'count' samples from 'buf' into buffer.
|
||||
void mix_samples( blip_sample_t const* buf, long count );
|
||||
|
||||
// not documented yet
|
||||
void set_modified() { modified_ = 1; }
|
||||
int clear_modified() { int b = modified_; modified_ = 0; return b; }
|
||||
typedef blip_u64 blip_resampled_time_t;
|
||||
void remove_silence( long count );
|
||||
blip_resampled_time_t resampled_duration( int t ) const { return t * factor_; }
|
||||
blip_resampled_time_t resampled_time( blip_time_t t ) const { return t * factor_ + offset_; }
|
||||
blip_resampled_time_t clock_rate_factor( long clock_rate ) const;
|
||||
public:
|
||||
Blip_Buffer();
|
||||
~Blip_Buffer();
|
||||
|
||||
// Deprecated
|
||||
typedef blip_resampled_time_t resampled_time_t;
|
||||
blargg_err_t sample_rate( long r ) { return set_sample_rate( r ); }
|
||||
blargg_err_t sample_rate( long r, int msec ) { return set_sample_rate( r, msec ); }
|
||||
private:
|
||||
// noncopyable
|
||||
Blip_Buffer( const Blip_Buffer& );
|
||||
Blip_Buffer& operator = ( const Blip_Buffer& );
|
||||
public:
|
||||
typedef blip_time_t buf_t_;
|
||||
blip_u64 factor_;
|
||||
blip_resampled_time_t offset_;
|
||||
buf_t_* buffer_;
|
||||
blip_long buffer_size_;
|
||||
blip_long reader_accum_;
|
||||
int bass_shift_;
|
||||
private:
|
||||
long sample_rate_;
|
||||
long clock_rate_;
|
||||
int bass_freq_;
|
||||
int length_;
|
||||
int modified_;
|
||||
friend class Blip_Reader;
|
||||
};
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define BLIP_BUFFER_ACCURACY 32
|
||||
#define BLIP_PHASE_BITS 8
|
||||
|
||||
// Number of bits in resample ratio fraction. Higher values give a more accurate ratio
|
||||
// but reduce maximum buffer size.
|
||||
//#ifndef BLIP_BUFFER_ACCURACY
|
||||
// #define BLIP_BUFFER_ACCURACY 16
|
||||
//#endif
|
||||
|
||||
// Number bits in phase offset. Fewer than 6 bits (64 phase offsets) results in
|
||||
// noticeable broadband noise when synthesizing high frequency square waves.
|
||||
// Affects size of Blip_Synth objects since they store the waveform directly.
|
||||
//#ifndef BLIP_PHASE_BITS
|
||||
// #if BLIP_BUFFER_FAST
|
||||
// #define BLIP_PHASE_BITS 8
|
||||
// #else
|
||||
// #define BLIP_PHASE_BITS 6
|
||||
// #endif
|
||||
//#endif
|
||||
|
||||
// Internal
|
||||
typedef blip_u64 blip_resampled_time_t;
|
||||
int const blip_widest_impulse_ = 16;
|
||||
int const blip_buffer_extra_ = blip_widest_impulse_ + 2;
|
||||
int const blip_res = 1 << BLIP_PHASE_BITS;
|
||||
class blip_eq_t;
|
||||
|
||||
class Blip_Synth_Fast_ {
|
||||
public:
|
||||
Blip_Buffer* buf;
|
||||
int last_amp;
|
||||
int delta_factor;
|
||||
|
||||
void volume_unit( double );
|
||||
Blip_Synth_Fast_();
|
||||
void treble_eq( blip_eq_t const& ) { }
|
||||
};
|
||||
|
||||
class Blip_Synth_ {
|
||||
public:
|
||||
Blip_Buffer* buf;
|
||||
int last_amp;
|
||||
int delta_factor;
|
||||
|
||||
void volume_unit( double );
|
||||
Blip_Synth_( short* impulses, int width );
|
||||
void treble_eq( blip_eq_t const& );
|
||||
private:
|
||||
double volume_unit_;
|
||||
short* const impulses;
|
||||
int const width;
|
||||
blip_long kernel_unit;
|
||||
int impulses_size() const { return blip_res / 2 * width + 1; }
|
||||
void adjust_impulse();
|
||||
};
|
||||
|
||||
// Quality level. Start with blip_good_quality.
|
||||
const int blip_med_quality = 8;
|
||||
const int blip_good_quality = 12;
|
||||
const int blip_high_quality = 16;
|
||||
|
||||
// Range specifies the greatest expected change in amplitude. Calculate it
|
||||
// by finding the difference between the maximum and minimum expected
|
||||
// amplitudes (max - min).
|
||||
template<int quality,int range>
|
||||
class Blip_Synth {
|
||||
public:
|
||||
// Set overall volume of waveform
|
||||
void volume( double v ) { impl.volume_unit( v * (1.0 / (range < 0 ? -range : range)) ); }
|
||||
|
||||
// Configure low-pass filter (see blip_buffer.txt)
|
||||
void treble_eq( blip_eq_t const& eq ) { impl.treble_eq( eq ); }
|
||||
|
||||
// Get/set Blip_Buffer used for output
|
||||
Blip_Buffer* output() const { return impl.buf; }
|
||||
void output( Blip_Buffer* b ) { impl.buf = b; impl.last_amp = 0; }
|
||||
|
||||
// Update amplitude of waveform at given time. Using this requires a separate
|
||||
// Blip_Synth for each waveform.
|
||||
void update( blip_time_t time, int amplitude );
|
||||
|
||||
// Low-level interface
|
||||
|
||||
// Add an amplitude transition of specified delta, optionally into specified buffer
|
||||
// rather than the one set with output(). Delta can be positive or negative.
|
||||
// The actual change in amplitude is delta * (volume / range)
|
||||
void offset( blip_time_t, int delta, Blip_Buffer* ) const;
|
||||
void offset( blip_time_t t, int delta ) const { offset( t, delta, impl.buf ); }
|
||||
|
||||
// Works directly in terms of fractional output samples. Contact author for more info.
|
||||
void offset_resampled( blip_resampled_time_t, int delta, Blip_Buffer* ) const;
|
||||
|
||||
// Same as offset(), except code is inlined for higher performance
|
||||
void offset_inline( blip_time_t t, int delta, Blip_Buffer* buf ) const {
|
||||
offset_resampled( t * buf->factor_ + buf->offset_, delta, buf );
|
||||
}
|
||||
void offset_inline( blip_time_t t, int delta ) const {
|
||||
offset_resampled( t * impl.buf->factor_ + impl.buf->offset_, delta, impl.buf );
|
||||
}
|
||||
|
||||
private:
|
||||
#if BLIP_BUFFER_FAST
|
||||
Blip_Synth_Fast_ impl;
|
||||
#else
|
||||
Blip_Synth_ impl;
|
||||
typedef short imp_t;
|
||||
imp_t impulses [blip_res * (quality / 2) + 1];
|
||||
public:
|
||||
Blip_Synth() : impl( impulses, quality ) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
// Low-pass equalization parameters
|
||||
class blip_eq_t {
|
||||
public:
|
||||
// Logarithmic rolloff to treble dB at half sampling rate. Negative values reduce
|
||||
// treble, small positive values (0 to 5.0) increase treble.
|
||||
blip_eq_t( double treble_db = 0 );
|
||||
|
||||
// See blip_buffer.txt
|
||||
blip_eq_t( double treble, long rolloff_freq, long sample_rate, long cutoff_freq = 0 );
|
||||
|
||||
private:
|
||||
double treble;
|
||||
long rolloff_freq;
|
||||
long sample_rate;
|
||||
long cutoff_freq;
|
||||
void generate( float* out, int count ) const;
|
||||
friend class Blip_Synth_;
|
||||
};
|
||||
|
||||
int const blip_sample_bits = 30;
|
||||
|
||||
// Dummy Blip_Buffer to direct sound output to, for easy muting without
|
||||
// having to stop sound code.
|
||||
class Silent_Blip_Buffer : public Blip_Buffer {
|
||||
buf_t_ buf [blip_buffer_extra_ + 1];
|
||||
public:
|
||||
// The following cannot be used (an assertion will fail if attempted):
|
||||
blargg_err_t set_sample_rate( long samples_per_sec, int msec_length );
|
||||
blip_time_t count_clocks( long count ) const;
|
||||
void mix_samples( blip_sample_t const* buf, long count );
|
||||
|
||||
Silent_Blip_Buffer();
|
||||
};
|
||||
|
||||
#if defined (__GNUC__) || _MSC_VER >= 1100
|
||||
#define BLIP_RESTRICT __restrict
|
||||
#else
|
||||
#define BLIP_RESTRICT
|
||||
#endif
|
||||
|
||||
// Optimized reading from Blip_Buffer, for use in custom sample output
|
||||
|
||||
// Begin reading from buffer. Name should be unique to the current block.
|
||||
#define BLIP_READER_BEGIN( name, blip_buffer ) \
|
||||
const Blip_Buffer::buf_t_* BLIP_RESTRICT name##_reader_buf = (blip_buffer).buffer_;\
|
||||
blip_long name##_reader_accum = (blip_buffer).reader_accum_
|
||||
|
||||
// Get value to pass to BLIP_READER_NEXT()
|
||||
#define BLIP_READER_BASS( blip_buffer ) ((blip_buffer).bass_shift_)
|
||||
|
||||
// Constant value to use instead of BLIP_READER_BASS(), for slightly more optimal
|
||||
// code at the cost of having no bass control
|
||||
int const blip_reader_default_bass = 9;
|
||||
|
||||
// Current sample
|
||||
#define BLIP_READER_READ( name ) (name##_reader_accum >> (blip_sample_bits - 16))
|
||||
|
||||
// Current raw sample in full internal resolution
|
||||
#define BLIP_READER_READ_RAW( name ) (name##_reader_accum)
|
||||
|
||||
// Advance to next sample
|
||||
#define BLIP_READER_NEXT( name, bass ) \
|
||||
(void) (name##_reader_accum += *name##_reader_buf++ - (name##_reader_accum >> (bass)))
|
||||
|
||||
// End reading samples from buffer. The number of samples read must now be removed
|
||||
// using Blip_Buffer::remove_samples().
|
||||
#define BLIP_READER_END( name, blip_buffer ) \
|
||||
(void) ((blip_buffer).reader_accum_ = name##_reader_accum)
|
||||
|
||||
|
||||
// Compatibility with older version
|
||||
const long blip_unscaled = 65535;
|
||||
const int blip_low_quality = blip_med_quality;
|
||||
const int blip_best_quality = blip_high_quality;
|
||||
|
||||
// Deprecated; use BLIP_READER macros as follows:
|
||||
// Blip_Reader r; r.begin( buf ); -> BLIP_READER_BEGIN( r, buf );
|
||||
// int bass = r.begin( buf ) -> BLIP_READER_BEGIN( r, buf ); int bass = BLIP_READER_BASS( buf );
|
||||
// r.read() -> BLIP_READER_READ( r )
|
||||
// r.read_raw() -> BLIP_READER_READ_RAW( r )
|
||||
// r.next( bass ) -> BLIP_READER_NEXT( r, bass )
|
||||
// r.next() -> BLIP_READER_NEXT( r, blip_reader_default_bass )
|
||||
// r.end( buf ) -> BLIP_READER_END( r, buf )
|
||||
class Blip_Reader {
|
||||
public:
|
||||
int begin( Blip_Buffer& );
|
||||
blip_long read() const { return accum >> (blip_sample_bits - 16); }
|
||||
blip_long read_raw() const { return accum; }
|
||||
void next( int bass_shift = 9 ) { accum += *buf++ - (accum >> bass_shift); }
|
||||
void end( Blip_Buffer& b ) { b.reader_accum_ = accum; }
|
||||
|
||||
private:
|
||||
const Blip_Buffer::buf_t_* buf;
|
||||
blip_long accum;
|
||||
};
|
||||
|
||||
// End of public interface
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
template<int quality,int range>
|
||||
blip_inline void Blip_Synth<quality,range>::offset_resampled( blip_resampled_time_t time,
|
||||
int delta, Blip_Buffer* blip_buf ) const
|
||||
{
|
||||
// Fails if time is beyond end of Blip_Buffer, due to a bug in caller code or the
|
||||
// need for a longer buffer as set by set_sample_rate().
|
||||
assert( (blip_long) (time >> BLIP_BUFFER_ACCURACY) < blip_buf->buffer_size_ );
|
||||
delta *= impl.delta_factor;
|
||||
blip_long* BLIP_RESTRICT buf = blip_buf->buffer_ + (time >> BLIP_BUFFER_ACCURACY);
|
||||
int phase = (int) (time >> (BLIP_BUFFER_ACCURACY - BLIP_PHASE_BITS) & (blip_res - 1));
|
||||
|
||||
#if BLIP_BUFFER_FAST
|
||||
blip_long left = buf [0] + delta;
|
||||
|
||||
// Kind of crappy, but doing shift after multiply results in overflow.
|
||||
// Alternate way of delaying multiply by delta_factor results in worse
|
||||
// sub-sample resolution.
|
||||
blip_long right = (delta >> BLIP_PHASE_BITS) * phase;
|
||||
left -= right;
|
||||
right += buf [1];
|
||||
|
||||
buf [0] = left;
|
||||
buf [1] = right;
|
||||
#else
|
||||
|
||||
int const fwd = (blip_widest_impulse_ - quality) / 2;
|
||||
int const rev = fwd + quality - 2;
|
||||
int const mid = quality / 2 - 1;
|
||||
|
||||
imp_t const* BLIP_RESTRICT imp = impulses + blip_res - phase;
|
||||
|
||||
#if defined (_M_IX86) || defined (_M_IA64) || defined (__i486__) || \
|
||||
defined (__x86_64__) || defined (__ia64__) || defined (__i386__)
|
||||
|
||||
// straight forward implementation resulted in better code on GCC for x86
|
||||
|
||||
#define ADD_IMP( out, in ) \
|
||||
buf [out] += (blip_long) imp [blip_res * (in)] * delta
|
||||
|
||||
#define BLIP_FWD( i ) {\
|
||||
ADD_IMP( fwd + i, i );\
|
||||
ADD_IMP( fwd + 1 + i, i + 1 );\
|
||||
}
|
||||
#define BLIP_REV( r ) {\
|
||||
ADD_IMP( rev - r, r + 1 );\
|
||||
ADD_IMP( rev + 1 - r, r );\
|
||||
}
|
||||
|
||||
BLIP_FWD( 0 )
|
||||
if ( quality > 8 ) BLIP_FWD( 2 )
|
||||
if ( quality > 12 ) BLIP_FWD( 4 )
|
||||
{
|
||||
ADD_IMP( fwd + mid - 1, mid - 1 );
|
||||
ADD_IMP( fwd + mid , mid );
|
||||
imp = impulses + phase;
|
||||
}
|
||||
if ( quality > 12 ) BLIP_REV( 6 )
|
||||
if ( quality > 8 ) BLIP_REV( 4 )
|
||||
BLIP_REV( 2 )
|
||||
|
||||
ADD_IMP( rev , 1 );
|
||||
ADD_IMP( rev + 1, 0 );
|
||||
|
||||
#else
|
||||
|
||||
// for RISC processors, help compiler by reading ahead of writes
|
||||
|
||||
#define BLIP_FWD( i ) {\
|
||||
blip_long t0 = i0 * delta + buf [fwd + i];\
|
||||
blip_long t1 = imp [blip_res * (i + 1)] * delta + buf [fwd + 1 + i];\
|
||||
i0 = imp [blip_res * (i + 2)];\
|
||||
buf [fwd + i] = t0;\
|
||||
buf [fwd + 1 + i] = t1;\
|
||||
}
|
||||
#define BLIP_REV( r ) {\
|
||||
blip_long t0 = i0 * delta + buf [rev - r];\
|
||||
blip_long t1 = imp [blip_res * r] * delta + buf [rev + 1 - r];\
|
||||
i0 = imp [blip_res * (r - 1)];\
|
||||
buf [rev - r] = t0;\
|
||||
buf [rev + 1 - r] = t1;\
|
||||
}
|
||||
|
||||
blip_long i0 = *imp;
|
||||
BLIP_FWD( 0 )
|
||||
if ( quality > 8 ) BLIP_FWD( 2 )
|
||||
if ( quality > 12 ) BLIP_FWD( 4 )
|
||||
{
|
||||
blip_long t0 = i0 * delta + buf [fwd + mid - 1];
|
||||
blip_long t1 = imp [blip_res * mid] * delta + buf [fwd + mid ];
|
||||
imp = impulses + phase;
|
||||
i0 = imp [blip_res * mid];
|
||||
buf [fwd + mid - 1] = t0;
|
||||
buf [fwd + mid ] = t1;
|
||||
}
|
||||
if ( quality > 12 ) BLIP_REV( 6 )
|
||||
if ( quality > 8 ) BLIP_REV( 4 )
|
||||
BLIP_REV( 2 )
|
||||
|
||||
blip_long t0 = i0 * delta + buf [rev ];
|
||||
blip_long t1 = *imp * delta + buf [rev + 1];
|
||||
buf [rev ] = t0;
|
||||
buf [rev + 1] = t1;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef BLIP_FWD
|
||||
#undef BLIP_REV
|
||||
|
||||
template<int quality,int range>
|
||||
#if BLIP_BUFFER_FAST
|
||||
blip_inline
|
||||
#endif
|
||||
void Blip_Synth<quality,range>::offset( blip_time_t t, int delta, Blip_Buffer* buf ) const
|
||||
{
|
||||
offset_resampled( t * buf->factor_ + buf->offset_, delta, buf );
|
||||
}
|
||||
|
||||
template<int quality,int range>
|
||||
#if BLIP_BUFFER_FAST
|
||||
blip_inline
|
||||
#endif
|
||||
void Blip_Synth<quality,range>::update( blip_time_t t, int amp )
|
||||
{
|
||||
int delta = amp - impl.last_amp;
|
||||
impl.last_amp = amp;
|
||||
offset_resampled( t * impl.buf->factor_ + impl.buf->offset_, delta, impl.buf );
|
||||
}
|
||||
|
||||
blip_inline blip_eq_t::blip_eq_t( double t ) :
|
||||
treble( t ), rolloff_freq( 0 ), sample_rate( 44100 ), cutoff_freq( 0 ) { }
|
||||
blip_inline blip_eq_t::blip_eq_t( double t, long rf, long sr, long cf ) :
|
||||
treble( t ), rolloff_freq( rf ), sample_rate( sr ), cutoff_freq( cf ) { }
|
||||
|
||||
blip_inline int Blip_Buffer::length() const { return length_; }
|
||||
blip_inline long Blip_Buffer::samples_avail() const { return (long) (offset_ >> BLIP_BUFFER_ACCURACY); }
|
||||
blip_inline long Blip_Buffer::sample_rate() const { return sample_rate_; }
|
||||
blip_inline int Blip_Buffer::output_latency() const { return blip_widest_impulse_ / 2; }
|
||||
blip_inline long Blip_Buffer::clock_rate() const { return clock_rate_; }
|
||||
blip_inline void Blip_Buffer::clock_rate( long cps ) { factor_ = clock_rate_factor( clock_rate_ = cps ); }
|
||||
|
||||
blip_inline int Blip_Reader::begin( Blip_Buffer& blip_buf )
|
||||
{
|
||||
buf = blip_buf.buffer_;
|
||||
accum = blip_buf.reader_accum_;
|
||||
return blip_buf.bass_shift_;
|
||||
}
|
||||
|
||||
int const blip_max_length = 0;
|
||||
int const blip_default_length = 250;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
// Simple stereo Blip_Buffer for sound emulators whose oscillators output
|
||||
// either on the left only, center, or right only.
|
||||
|
||||
// Blip_Buffer 0.3.0. Copyright (C) 2003-2004 Shay Green. GNU GPL license.
|
||||
|
||||
#ifndef STEREO_BUFFER_H
|
||||
#define STEREO_BUFFER_H
|
||||
|
||||
#include "Blip_Buffer.h"
|
||||
|
||||
class Stereo_Buffer {
|
||||
public:
|
||||
Stereo_Buffer();
|
||||
~Stereo_Buffer();
|
||||
|
||||
// Same as in Blip_Buffer (see Blip_Buffer.h)
|
||||
bool set_sample_rate( long, int msec = 0 );
|
||||
void clock_rate( long );
|
||||
void bass_freq( int );
|
||||
void clear();
|
||||
|
||||
// Buffers to output synthesis to
|
||||
Blip_Buffer* left();
|
||||
Blip_Buffer* center();
|
||||
Blip_Buffer* right();
|
||||
|
||||
// Same as in Blip_Buffer. For more efficient operation, pass false
|
||||
// for was_stereo if the left and right buffers had nothing added
|
||||
// to them for this frame.
|
||||
void end_frame( blip_time_t, bool was_stereo = true );
|
||||
|
||||
// Output is stereo with channels interleved, left before right. Counts
|
||||
// are in samples, *not* pairs.
|
||||
long samples_avail() const;
|
||||
long read_samples( blip_sample_t*, long );
|
||||
|
||||
private:
|
||||
// noncopyable
|
||||
Stereo_Buffer( const Stereo_Buffer& );
|
||||
Stereo_Buffer& operator = ( const Stereo_Buffer& );
|
||||
|
||||
enum { buf_count = 3 };
|
||||
Blip_Buffer bufs [buf_count];
|
||||
bool stereo_added;
|
||||
bool was_stereo;
|
||||
|
||||
void mix_stereo( blip_sample_t*, long );
|
||||
void mix_mono( blip_sample_t*, long );
|
||||
void mix_stereo( float*, long );
|
||||
void mix_mono( float*, long );
|
||||
};
|
||||
|
||||
inline Blip_Buffer* Stereo_Buffer::left() {
|
||||
return &bufs [1];
|
||||
}
|
||||
|
||||
inline Blip_Buffer* Stereo_Buffer::center() {
|
||||
return &bufs [0];
|
||||
}
|
||||
|
||||
inline Blip_Buffer* Stereo_Buffer::right() {
|
||||
return &bufs [2];
|
||||
}
|
||||
|
||||
inline long Stereo_Buffer::samples_avail() const {
|
||||
return bufs [0].samples_avail();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,730 @@
|
|||
/* include/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Define if we are compiling for PPC architectures. */
|
||||
#undef ARCH_POWERPC
|
||||
|
||||
/* Define if we are compiling with AltiVec usage. */
|
||||
#undef ARCH_POWERPC_ALTIVEC
|
||||
|
||||
/* Define if we are compiling for 32-bit or 64-bit x86 architectures. */
|
||||
#undef ARCH_X86
|
||||
|
||||
/* Define if we are compiling for 32-bit x86 architectures. */
|
||||
#undef ARCH_X86_32
|
||||
|
||||
/* Define if we are compiling for 64-bit x86 architectures. */
|
||||
#undef ARCH_X86_64
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define to 1 if you have the `accept' function. */
|
||||
#undef HAVE_ACCEPT
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if we are compiling with ALSA support. */
|
||||
#undef HAVE_ALSA
|
||||
|
||||
/* Define if altivec.h is present and usable. */
|
||||
#undef HAVE_ALTIVEC_H
|
||||
|
||||
/* Define if we should include from OpenGL instead of GL */
|
||||
#undef HAVE_APPLE_OPENGL_FRAMEWORK
|
||||
|
||||
/* Define to 1 if you have the `argz_count' function. */
|
||||
#undef HAVE_ARGZ_COUNT
|
||||
|
||||
/* Define to 1 if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define to 1 if you have the `argz_next' function. */
|
||||
#undef HAVE_ARGZ_NEXT
|
||||
|
||||
/* Define to 1 if you have the `argz_stringify' function. */
|
||||
#undef HAVE_ARGZ_STRINGIFY
|
||||
|
||||
/* Define to 1 if you have the `asprintf' function. */
|
||||
#undef HAVE_ASPRINTF
|
||||
|
||||
/* Define to 1 if you have the `bind' function. */
|
||||
#undef HAVE_BIND
|
||||
|
||||
/* Define to 1 if the compiler understands __builtin_expect. */
|
||||
#undef HAVE_BUILTIN_EXPECT
|
||||
|
||||
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
|
||||
CoreFoundation framework. */
|
||||
#undef HAVE_CFLOCALECOPYCURRENT
|
||||
|
||||
/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
|
||||
the CoreFoundation framework. */
|
||||
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
||||
/* Define to 1 if you have the `close' function. */
|
||||
#undef HAVE_CLOSE
|
||||
|
||||
/* Define to 1 if you have the `connect' function. */
|
||||
#undef HAVE_CONNECT
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_FEOF_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FGETS_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL__SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL__SNWPRINTF
|
||||
|
||||
/* Define if we are compiling with DirectSound support. */
|
||||
#undef HAVE_DIRECTSOUND
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fopen64' function. */
|
||||
#undef HAVE_FOPEN64
|
||||
|
||||
/* Define to 1 if you have the `freeaddrinfo' function. */
|
||||
#undef HAVE_FREEADDRINFO
|
||||
|
||||
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
|
||||
#undef HAVE_FSEEKO
|
||||
|
||||
/* Define to 1 if you have the `fseeko64' function. */
|
||||
#undef HAVE_FSEEKO64
|
||||
|
||||
/* Define to 1 if you have the `fstat64' function. */
|
||||
#undef HAVE_FSTAT64
|
||||
|
||||
/* Define to 1 if you have the `ftello' function. */
|
||||
#undef HAVE_FTELLO
|
||||
|
||||
/* Define to 1 if you have the `ftello64' function. */
|
||||
#undef HAVE_FTELLO64
|
||||
|
||||
/* Define to 1 if you have the `fwprintf' function. */
|
||||
#undef HAVE_FWPRINTF
|
||||
|
||||
/* Define to 1 if you have the `gai_strerror' function. */
|
||||
#undef HAVE_GAI_STRERROR
|
||||
|
||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define to 1 if you have the `getcwd' function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define to 1 if you have the `getegid' function. */
|
||||
#undef HAVE_GETEGID
|
||||
|
||||
/* Define to 1 if you have the `getenv' function. */
|
||||
#undef HAVE_GETENV
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
#undef HAVE_GETEUID
|
||||
|
||||
/* Define to 1 if you have the `getgid' function. */
|
||||
#undef HAVE_GETGID
|
||||
|
||||
/* Define to 1 if you have the `gethostbyaddr' function. */
|
||||
#undef HAVE_GETHOSTBYADDR
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname' function. */
|
||||
#undef HAVE_GETHOSTBYNAME
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define to 1 if you have the `getpwuid' function. */
|
||||
#undef HAVE_GETPWUID
|
||||
|
||||
/* Define to 1 if you have the `getsockopt' function. */
|
||||
#undef HAVE_GETSOCKOPT
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the `getuid' function. */
|
||||
#undef HAVE_GETUID
|
||||
|
||||
/* Define if you have the iconv() function and it works. */
|
||||
#undef HAVE_ICONV
|
||||
|
||||
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
|
||||
#undef HAVE_INTMAX_T
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
|
||||
declares uintmax_t. */
|
||||
#undef HAVE_INTTYPES_H_WITH_UINTMAX
|
||||
|
||||
/* Define if we are compiling with JACK support. */
|
||||
#undef HAVE_JACK
|
||||
|
||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
#undef HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if you have the `asound' library (-lasound). */
|
||||
#undef HAVE_LIBASOUND
|
||||
|
||||
/* Define if we are compiling with libcdio support. */
|
||||
#undef HAVE_LIBCDIO
|
||||
|
||||
/* Define if we are compiling with libsndfile support. */
|
||||
#undef HAVE_LIBSNDFILE
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if we are compiling with Linux joystick support. */
|
||||
#undef HAVE_LINUX_JOYSTICK
|
||||
|
||||
/* Define to 1 if you have the `listen' function. */
|
||||
#undef HAVE_LISTEN
|
||||
|
||||
/* Define to 1 if the system has the type `long long int'. */
|
||||
#undef HAVE_LONG_LONG_INT
|
||||
|
||||
/* Define to 1 if you have the `madvise' function. */
|
||||
#undef HAVE_MADVISE
|
||||
|
||||
/* Define to 1 if you have the `mbrtowc' function. */
|
||||
#undef HAVE_MBRTOWC
|
||||
|
||||
/* Define to 1 if you have the `memcmp' function. */
|
||||
#undef HAVE_MEMCMP
|
||||
|
||||
/* Define to 1 if you have the `memcpy' function. */
|
||||
#undef HAVE_MEMCPY
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
#undef HAVE_MEMPCPY
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `mkdir' function. */
|
||||
#undef HAVE_MKDIR
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define to 1 if you have the `munmap' function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#undef HAVE_NANOSLEEP
|
||||
|
||||
/* Define to 1 if you have the `newlocale' function. */
|
||||
#undef HAVE_NEWLOCALE
|
||||
|
||||
/* Define if we are compiling with OSS support. */
|
||||
#undef HAVE_OSSDSP
|
||||
|
||||
/* Define if your printf() function supports format strings with positions. */
|
||||
#undef HAVE_POSIX_PRINTF
|
||||
|
||||
/* Define if we are compiling with POSIX sockets support. */
|
||||
#undef HAVE_POSIX_SOCKETS
|
||||
|
||||
/* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */
|
||||
#undef HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
|
||||
/* Define if the POSIX multithreading library has read/write locks. */
|
||||
#undef HAVE_PTHREAD_RWLOCK
|
||||
|
||||
/* Define to 1 if you have the `putenv' function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define to 1 if you have the `recv' function. */
|
||||
#undef HAVE_RECV
|
||||
|
||||
/* Define if we are compiling with SDL sound support. */
|
||||
#undef HAVE_SDL
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the `send' function. */
|
||||
#undef HAVE_SEND
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the `setsockopt' function. */
|
||||
#undef HAVE_SETSOCKOPT
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define to 1 if you have the `signal' function. */
|
||||
#undef HAVE_SIGNAL
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
|
||||
uintmax_t. */
|
||||
#undef HAVE_STDINT_H_WITH_UINTMAX
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `stpcpy' function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* 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 `strnlen' function. */
|
||||
#undef HAVE_STRNLEN
|
||||
|
||||
/* Define to 1 if you have the `strtoul' function. */
|
||||
#undef HAVE_STRTOUL
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_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 `tsearch' function. */
|
||||
#undef HAVE_TSEARCH
|
||||
|
||||
/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
|
||||
#undef HAVE_UINTMAX_T
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if the system has the type `unsigned long long int'. */
|
||||
#undef HAVE_UNSIGNED_LONG_LONG_INT
|
||||
|
||||
/* Define to 1 if you have the `uselocale' function. */
|
||||
#undef HAVE_USELOCALE
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 or 0, depending whether the compiler supports simple visibility
|
||||
declarations. */
|
||||
#undef HAVE_VISIBILITY
|
||||
|
||||
/* Define if you have the 'wchar_t' type. */
|
||||
#undef HAVE_WCHAR_T
|
||||
|
||||
/* Define to 1 if you have the `wcrtomb' function. */
|
||||
#undef HAVE_WCRTOMB
|
||||
|
||||
/* Define to 1 if you have the `wcslen' function. */
|
||||
#undef HAVE_WCSLEN
|
||||
|
||||
/* Define to 1 if you have the `wcsnlen' function. */
|
||||
#undef HAVE_WCSNLEN
|
||||
|
||||
/* Define if you have the 'wint_t' type. */
|
||||
#undef HAVE_WINT_T
|
||||
|
||||
/* Define to 1 if O_NOATIME works. */
|
||||
#undef HAVE_WORKING_O_NOATIME
|
||||
|
||||
/* Define to 1 if O_NOFOLLOW works. */
|
||||
#undef HAVE_WORKING_O_NOFOLLOW
|
||||
|
||||
/* Define to 1 if you have the `_mkdir' function. */
|
||||
#undef HAVE__MKDIR
|
||||
|
||||
/* Define to 1 if you have the `__fsetlocking' function. */
|
||||
#undef HAVE___FSETLOCKING
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#undef ICONV_CONST
|
||||
|
||||
/* Define if integer division by zero raises signal SIGFPE. */
|
||||
#undef INTDIV0_RAISES_SIGFPE
|
||||
|
||||
/* Define on little-endian platforms. */
|
||||
#undef LSB_FIRST
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Mednafen version definition. */
|
||||
#undef MEDNAFEN_VERSION
|
||||
|
||||
/* Mednafen version numeric. */
|
||||
#undef MEDNAFEN_VERSION_NUMERIC
|
||||
|
||||
/* Define if config.h is present */
|
||||
#undef MINILZO_HAVE_CONFIG_H
|
||||
|
||||
/* Define if mkdir takes only one argument. */
|
||||
#undef MKDIR_TAKES_ONE_ARG
|
||||
|
||||
/* Define to use fixed-point MPC decoder. */
|
||||
#undef MPC_FIXED_POINT
|
||||
|
||||
/* Define on big-endian platforms. */
|
||||
#undef MSB_FIRST
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* 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 if <inttypes.h> exists and defines unusable PRI* macros. */
|
||||
#undef PRI_MACROS_BROKEN
|
||||
|
||||
/* Defines the filesystem path-separator type. */
|
||||
#undef PSS_STYLE
|
||||
|
||||
/* Define if the pthread_in_use() detection is hard. */
|
||||
#undef PTHREAD_IN_USE_DETECTION_HARD
|
||||
|
||||
/* The size of `double', as computed by sizeof. */
|
||||
#undef SIZEOF_DOUBLE
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
/* The size of `off_t', as computed by sizeof. */
|
||||
#undef SIZEOF_OFF_T
|
||||
|
||||
/* The size of `ptrdiff_t', as computed by sizeof. */
|
||||
#undef SIZEOF_PTRDIFF_T
|
||||
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
/* The size of `void *', as computed by sizeof. */
|
||||
#undef SIZEOF_VOID_P
|
||||
|
||||
/* The size of `__int64', as computed by sizeof. */
|
||||
#undef SIZEOF___INT64
|
||||
|
||||
/* Define as the maximum value of type 'size_t', if the system doesn't define
|
||||
it. */
|
||||
#ifndef SIZE_MAX
|
||||
# undef SIZE_MAX
|
||||
#endif
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if the POSIX multithreading library can be used. */
|
||||
#undef USE_POSIX_THREADS
|
||||
|
||||
/* Define if references to the POSIX multithreading library should be made
|
||||
weak. */
|
||||
#undef USE_POSIX_THREADS_WEAK
|
||||
|
||||
/* Define if the GNU Pth multithreading library can be used. */
|
||||
#undef USE_PTH_THREADS
|
||||
|
||||
/* Define if references to the GNU Pth multithreading library should be made
|
||||
weak. */
|
||||
#undef USE_PTH_THREADS_WEAK
|
||||
|
||||
/* Define if the old Solaris multithreading library can be used. */
|
||||
#undef USE_SOLARIS_THREADS
|
||||
|
||||
/* Define if references to the old Solaris multithreading library should be
|
||||
made weak. */
|
||||
#undef USE_SOLARIS_THREADS_WEAK
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Define if the Win32 multithreading API can be used. */
|
||||
#undef USE_WIN32_THREADS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if we are compiling with debugger. */
|
||||
#undef WANT_DEBUGGER
|
||||
|
||||
/* Define if we are compiling with GBA emulation. */
|
||||
#undef WANT_GBA_EMU
|
||||
|
||||
/* Define if we are compiling with GB emulation. */
|
||||
#undef WANT_GB_EMU
|
||||
|
||||
/* Define if we are compiling with internal CJK fonts. */
|
||||
#undef WANT_INTERNAL_CJK
|
||||
|
||||
/* Define if we are compiling with Lynx emulation. */
|
||||
#undef WANT_LYNX_EMU
|
||||
|
||||
/* Define if we are compiling with Sega Genesis/MegaDrive emulation. */
|
||||
#undef WANT_MD_EMU
|
||||
|
||||
/* Define if we are compiling with NES emulation. */
|
||||
#undef WANT_NES_EMU
|
||||
|
||||
/* Define if we are compiling with NGP emulation. */
|
||||
#undef WANT_NGP_EMU
|
||||
|
||||
/* Define if we are compiling with PCE emulation. */
|
||||
#undef WANT_PCE_EMU
|
||||
|
||||
/* Define if we are compiling with separate fast PCE emulation. */
|
||||
#undef WANT_PCE_FAST_EMU
|
||||
|
||||
/* Define if we are compiling with PC-FX emulation. */
|
||||
#undef WANT_PCFX_EMU
|
||||
|
||||
/* Define if we are compiling with PlayStation emulation. */
|
||||
#undef WANT_PSX_EMU
|
||||
|
||||
/* Define if we are compiling with SMS+GG emulation. */
|
||||
#undef WANT_SMS_EMU
|
||||
|
||||
/* Define if we are compiling with SNES emulation. */
|
||||
#undef WANT_SNES_EMU
|
||||
|
||||
/* Define if we are compiling with Virtual Boy emulation. */
|
||||
#undef WANT_VB_EMU
|
||||
|
||||
/* Define if we are compiling with WonderSwan emulation. */
|
||||
#undef WANT_WSWAN_EMU
|
||||
|
||||
/* Define if we are compiling for Win32. */
|
||||
#undef WIN32
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
||||
#undef _LARGEFILE_SOURCE
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define as the type of the result of subtracting two pointers, if the system
|
||||
doesn't define it. */
|
||||
#undef ptrdiff_t
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define to unsigned long or unsigned long long if <stdint.h> and
|
||||
<inttypes.h> don't define. */
|
||||
#undef uintmax_t
|
||||
|
||||
|
||||
#define __libc_lock_t gl_lock_t
|
||||
#define __libc_lock_define gl_lock_define
|
||||
#define __libc_lock_define_initialized gl_lock_define_initialized
|
||||
#define __libc_lock_init gl_lock_init
|
||||
#define __libc_lock_lock gl_lock_lock
|
||||
#define __libc_lock_unlock gl_lock_unlock
|
||||
#define __libc_lock_recursive_t gl_recursive_lock_t
|
||||
#define __libc_lock_define_recursive gl_recursive_lock_define
|
||||
#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
|
||||
#define __libc_lock_init_recursive gl_recursive_lock_init
|
||||
#define __libc_lock_lock_recursive gl_recursive_lock_lock
|
||||
#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
|
||||
#define glthread_in_use libintl_thread_in_use
|
||||
#define glthread_lock_init_func libintl_lock_init_func
|
||||
#define glthread_lock_lock_func libintl_lock_lock_func
|
||||
#define glthread_lock_unlock_func libintl_lock_unlock_func
|
||||
#define glthread_lock_destroy_func libintl_lock_destroy_func
|
||||
#define glthread_rwlock_init_multithreaded libintl_rwlock_init_multithreaded
|
||||
#define glthread_rwlock_init_func libintl_rwlock_init_func
|
||||
#define glthread_rwlock_rdlock_multithreaded libintl_rwlock_rdlock_multithreaded
|
||||
#define glthread_rwlock_rdlock_func libintl_rwlock_rdlock_func
|
||||
#define glthread_rwlock_wrlock_multithreaded libintl_rwlock_wrlock_multithreaded
|
||||
#define glthread_rwlock_wrlock_func libintl_rwlock_wrlock_func
|
||||
#define glthread_rwlock_unlock_multithreaded libintl_rwlock_unlock_multithreaded
|
||||
#define glthread_rwlock_unlock_func libintl_rwlock_unlock_func
|
||||
#define glthread_rwlock_destroy_multithreaded libintl_rwlock_destroy_multithreaded
|
||||
#define glthread_rwlock_destroy_func libintl_rwlock_destroy_func
|
||||
#define glthread_recursive_lock_init_multithreaded libintl_recursive_lock_init_multithreaded
|
||||
#define glthread_recursive_lock_init_func libintl_recursive_lock_init_func
|
||||
#define glthread_recursive_lock_lock_multithreaded libintl_recursive_lock_lock_multithreaded
|
||||
#define glthread_recursive_lock_lock_func libintl_recursive_lock_lock_func
|
||||
#define glthread_recursive_lock_unlock_multithreaded libintl_recursive_lock_unlock_multithreaded
|
||||
#define glthread_recursive_lock_unlock_func libintl_recursive_lock_unlock_func
|
||||
#define glthread_recursive_lock_destroy_multithreaded libintl_recursive_lock_destroy_multithreaded
|
||||
#define glthread_recursive_lock_destroy_func libintl_recursive_lock_destroy_func
|
||||
#define glthread_once_func libintl_once_func
|
||||
#define glthread_once_singlethreaded libintl_once_singlethreaded
|
||||
#define glthread_once_multithreaded libintl_once_multithreaded
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MUSEPACK_CONFIG_TYPES_H__
|
||||
#define __MUSEPACK_CONFIG_TYPES_H__
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef unsigned char mpc_bool_t;
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
typedef int16_t mpc_int16_t;
|
||||
typedef uint16_t mpc_uint16_t;
|
||||
typedef int32_t mpc_int32_t;
|
||||
typedef uint32_t mpc_uint32_t;
|
||||
typedef int64_t mpc_int64_t;
|
||||
|
||||
#endif // __MUSEPACK_CONFIG_TYPES_H__
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file decoder.h
|
||||
|
||||
#ifndef _mpcdec_decoder_h_
|
||||
#define _mpcdec_decoder_h_
|
||||
|
||||
#include "huffman.h"
|
||||
#include "math.h"
|
||||
#include "mpcdec.h"
|
||||
#include "reader.h"
|
||||
#include "streaminfo.h"
|
||||
|
||||
#define MPC_SUPPORT_SV456
|
||||
|
||||
#define SEEKING_TABLE_SIZE 256u
|
||||
// set it to SLOW_SEEKING_WINDOW to not use fast seeking
|
||||
#define FAST_SEEKING_WINDOW 32
|
||||
// set it to FAST_SEEKING_WINDOW to only use fast seeking
|
||||
#define SLOW_SEEKING_WINDOW 0x80000000
|
||||
|
||||
enum {
|
||||
MPC_V_MEM = 2304,
|
||||
MPC_DECODER_MEMSIZE = 16384, // overall buffer size
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
mpc_int32_t L [36];
|
||||
mpc_int32_t R [36];
|
||||
} QuantTyp;
|
||||
|
||||
typedef struct mpc_decoder_t {
|
||||
mpc_reader *r;
|
||||
|
||||
/// @name internal state variables
|
||||
//@{
|
||||
|
||||
mpc_uint32_t dword; /// currently decoded 32bit-word
|
||||
mpc_uint32_t pos; /// bit-position within dword
|
||||
mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE]; /// read-buffer
|
||||
mpc_uint32_t Zaehler; /// actual index within read-buffer
|
||||
|
||||
mpc_uint32_t samples_to_skip;
|
||||
|
||||
mpc_uint32_t DecodedFrames;
|
||||
mpc_uint32_t OverallFrames;
|
||||
mpc_int32_t SampleRate; // Sample frequency
|
||||
|
||||
mpc_uint32_t StreamVersion; // version of bitstream
|
||||
mpc_int32_t Max_Band;
|
||||
mpc_uint32_t MPCHeaderPos; // AB: needed to support ID3v2
|
||||
|
||||
mpc_uint32_t FrameWasValid;
|
||||
mpc_uint32_t MS_used; // MS-coding used ?
|
||||
mpc_uint32_t TrueGaplessPresent;
|
||||
|
||||
mpc_uint32_t WordsRead; // counts amount of decoded dwords
|
||||
|
||||
// randomizer state variables
|
||||
mpc_uint32_t __r1;
|
||||
mpc_uint32_t __r2;
|
||||
|
||||
// seeking
|
||||
mpc_uint32_t seeking_table[SEEKING_TABLE_SIZE];
|
||||
mpc_uint32_t seeking_pwr; // distance between 2 frames in seeking_table = 2^seeking_pwr
|
||||
mpc_uint32_t seeking_table_frames; // last frame in seaking table
|
||||
mpc_uint32_t seeking_window; // number of frames to look for scalefactors
|
||||
|
||||
mpc_int32_t SCF_Index_L [32] [3];
|
||||
mpc_int32_t SCF_Index_R [32] [3]; // holds scalefactor-indices
|
||||
QuantTyp Q [32]; // holds quantized samples
|
||||
mpc_int32_t Res_L [32];
|
||||
mpc_int32_t Res_R [32]; // holds the chosen quantizer for each subband
|
||||
mpc_bool_t DSCF_Flag_L [32];
|
||||
mpc_bool_t DSCF_Flag_R [32]; // differential SCF used?
|
||||
mpc_int32_t SCFI_L [32];
|
||||
mpc_int32_t SCFI_R [32]; // describes order of transmitted SCF
|
||||
mpc_bool_t MS_Flag[32]; // MS used?
|
||||
#ifdef MPC_FIXED_POINT
|
||||
unsigned char SCF_shift[256];
|
||||
#endif
|
||||
|
||||
MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960];
|
||||
MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960];
|
||||
MPC_SAMPLE_FORMAT Y_L[36][32];
|
||||
MPC_SAMPLE_FORMAT Y_R[36][32];
|
||||
MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention)
|
||||
//@}
|
||||
|
||||
} mpc_decoder;
|
||||
|
||||
#endif // _mpc_decoder_h
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file huffman.h
|
||||
/// Data structures and functions for huffman coding.
|
||||
|
||||
#ifndef _mpcdec_huffman_h_
|
||||
#define _mpcdec_huffman_h_
|
||||
|
||||
#include "mpcdec/config_types.h"
|
||||
|
||||
#include "decoder.h"
|
||||
|
||||
struct mpc_decoder_t; // forward declare to break circular dependencies
|
||||
|
||||
/// Huffman table entry.
|
||||
typedef struct huffman_type_t {
|
||||
mpc_uint32_t Code;
|
||||
mpc_uint16_t Length;
|
||||
mpc_int16_t Value;
|
||||
} HuffmanTyp;
|
||||
|
||||
#endif // _mpcdec_huffman_h_
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file internal.h
|
||||
/// Definitions and structures used only internally by the libmpcdec.
|
||||
|
||||
#ifndef _mpcdec_internal_h
|
||||
#define _mpcdec_internal_h
|
||||
|
||||
|
||||
enum {
|
||||
MPC_DECODER_SYNTH_DELAY = 481
|
||||
};
|
||||
|
||||
/// Big/little endian 32 bit byte swapping routine.
|
||||
static __inline
|
||||
mpc_uint32_t mpc_swap32(mpc_uint32_t val) {
|
||||
return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) |
|
||||
((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24));
|
||||
}
|
||||
|
||||
/// Searches for a ID3v2-tag and reads the length (in bytes) of it.
|
||||
/// \param reader supplying raw stream data
|
||||
/// \return size of tag, in bytes
|
||||
/// \return -1 on errors of any kind
|
||||
mpc_int32_t JumpID3v2(mpc_reader* fp);
|
||||
|
||||
/// helper functions used by multiple files
|
||||
mpc_uint32_t mpc_random_int(mpc_decoder *d); // in synth_filter.c
|
||||
void mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor);
|
||||
void mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData);
|
||||
|
||||
#endif // _mpcdec_internal_h
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file math.h
|
||||
/// Libmpcdec internal math routines.
|
||||
|
||||
#ifndef _mpcdec_math_h_
|
||||
#define _mpcdec_math_h_
|
||||
|
||||
//#define MPC_FIXED_POINT
|
||||
|
||||
#define MPC_FIXED_POINT_SHIFT 16
|
||||
|
||||
#ifdef MPC_FIXED_POINT
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
#include <cmnintrin.h>
|
||||
|
||||
#define MPC_HAVE_MULHIGH
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define MPC_FIXED_POINT_SCALE_SHIFT (MPC_FIXED_POINT_SHIFT + MPC_FIXED_POINT_FRACTPART)
|
||||
#define MPC_FIXED_POINT_SCALE (1 << (MPC_FIXED_POINT_SCALE_SHIFT - 1))
|
||||
|
||||
//in fixedpoint mode, results in decode output buffer are in -MPC_FIXED_POINT_SCALE ... MPC_FIXED_POINT_SCALE range
|
||||
|
||||
#define MPC_FIXED_POINT_FRACTPART 14
|
||||
typedef mpc_int32_t MPC_SAMPLE_FORMAT;
|
||||
|
||||
typedef mpc_int64_t MPC_SAMPLE_FORMAT_MULTIPLY;
|
||||
|
||||
#define MAKE_MPC_SAMPLE(X) (MPC_SAMPLE_FORMAT)((double)(X) * (double)(((mpc_int64_t)1)<<MPC_FIXED_POINT_FRACTPART))
|
||||
#define MAKE_MPC_SAMPLE_EX(X,Y) (MPC_SAMPLE_FORMAT)((double)(X) * (double)(((mpc_int64_t)1)<<(Y)))
|
||||
|
||||
#define MPC_MULTIPLY_NOTRUNCATE(X,Y) \
|
||||
(((MPC_SAMPLE_FORMAT_MULTIPLY)(X) * (MPC_SAMPLE_FORMAT_MULTIPLY)(Y)) >> MPC_FIXED_POINT_FRACTPART)
|
||||
|
||||
#define MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z) \
|
||||
(((MPC_SAMPLE_FORMAT_MULTIPLY)(X) * (MPC_SAMPLE_FORMAT_MULTIPLY)(Y)) >> (Z))
|
||||
|
||||
#ifdef _DEBUG
|
||||
static inline MPC_SAMPLE_FORMAT MPC_MULTIPLY(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2)
|
||||
{
|
||||
MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_NOTRUNCATE(item1,item2);
|
||||
assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp);
|
||||
return (MPC_SAMPLE_FORMAT)temp;
|
||||
}
|
||||
|
||||
static inline MPC_SAMPLE_FORMAT MPC_MULTIPLY_EX(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2,unsigned shift)
|
||||
{
|
||||
MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_EX_NOTRUNCATE(item1,item2,shift);
|
||||
assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp);
|
||||
return (MPC_SAMPLE_FORMAT)temp;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define MPC_MULTIPLY(X,Y) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_NOTRUNCATE(X,Y))
|
||||
#define MPC_MULTIPLY_EX(X,Y,Z) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z))
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MPC_HAVE_MULHIGH
|
||||
#define MPC_MULTIPLY_FRACT(X,Y) _MulHigh(X,Y)
|
||||
#else
|
||||
#define MPC_MULTIPLY_FRACT(X,Y) MPC_MULTIPLY_EX(X,Y,32)
|
||||
#endif
|
||||
|
||||
#define MPC_MAKE_FRACT_CONST(X) (MPC_SAMPLE_FORMAT)((X) * (double)(((mpc_int64_t)1)<<32) )
|
||||
#define MPC_MULTIPLY_FRACT_CONST(X,Y) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST(Y))
|
||||
#define MPC_MULTIPLY_FRACT_CONST_FIX(X,Y,Z) ( MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y / (1<<(Z)) )) << (Z) )
|
||||
#define MPC_MULTIPLY_FRACT_CONST_SHR(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y / (1<<(Z)) ))
|
||||
|
||||
#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y))
|
||||
#define MPC_SCALE_CONST(X,Y,Z) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z))
|
||||
#define MPC_SCALE_CONST_SHL(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)-(S))
|
||||
#define MPC_SCALE_CONST_SHR(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)+(S))
|
||||
#define MPC_SHR(X,Y) ((X)>>(Y))
|
||||
#define MPC_SHL(X,Y) ((X)<<(Y))
|
||||
|
||||
#else
|
||||
|
||||
//in floating-point mode, decoded samples are in -1...1 range
|
||||
|
||||
typedef float MPC_SAMPLE_FORMAT;
|
||||
|
||||
#define MAKE_MPC_SAMPLE(X) ((MPC_SAMPLE_FORMAT)(X))
|
||||
#define MAKE_MPC_SAMPLE_EX(X,Y) ((MPC_SAMPLE_FORMAT)(X))
|
||||
|
||||
#define MPC_MULTIPLY_FRACT(X,Y) ((X)*(Y))
|
||||
#define MPC_MAKE_FRACT_CONST(X) (X)
|
||||
#define MPC_MULTIPLY_FRACT_CONST(X,Y) MPC_MULTPLY_FRACT(X,MPC_MAKE_FRACT_CONST(Y))
|
||||
#define MPC_MULTIPLY_FRACT_CONST_SHR(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y ))
|
||||
#define MPC_MULTIPLY_FRACT_CONST_FIX(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y ))
|
||||
|
||||
#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y))
|
||||
#define MPC_MULTIPLY(X,Y) ((X)*(Y))
|
||||
#define MPC_MULTIPLY_EX(X,Y,Z) ((X)*(Y))
|
||||
#define MPC_SCALE_CONST(X,Y,Z) ((X)*(Y))
|
||||
#define MPC_SCALE_CONST_SHL(X,Y,Z,S) ((X)*(Y))
|
||||
#define MPC_SCALE_CONST_SHR(X,Y,Z,S) ((X)*(Y))
|
||||
#define MPC_SHR(X,Y) (X)
|
||||
#define MPC_SHL(X,Y) (X)
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _mpcdec_math_h_
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file mpcdec.h
|
||||
/// Top level include file for libmpcdec.
|
||||
|
||||
#ifndef _mpcdec_h_
|
||||
#define _mpcdec_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpcdec/config_types.h"
|
||||
|
||||
#include "decoder.h"
|
||||
#include "math.h"
|
||||
#include "reader.h"
|
||||
#include "streaminfo.h"
|
||||
|
||||
enum {
|
||||
MPC_FRAME_LENGTH = (36 * 32), /// samples per mpc frame
|
||||
MPC_DECODER_BUFFER_LENGTH = 4 * MPC_FRAME_LENGTH /// required buffer size for decoder
|
||||
};
|
||||
|
||||
// error codes
|
||||
#define ERROR_CODE_OK 0
|
||||
#define ERROR_CODE_FILE -1
|
||||
#define ERROR_CODE_SV7BETA 1
|
||||
#define ERROR_CODE_CBR 2
|
||||
#define ERROR_CODE_IS 3
|
||||
#define ERROR_CODE_BLOCKSIZE 4
|
||||
#define ERROR_CODE_INVALIDSV 5
|
||||
|
||||
/// Initializes a streaminfo structure.
|
||||
/// \param si streaminfo structure to initialize
|
||||
void mpc_streaminfo_init(mpc_streaminfo *si);
|
||||
|
||||
/// Reads streaminfo header from the mpc stream supplied by r.
|
||||
/// \param si streaminfo pointer to which info will be written
|
||||
/// \param r stream reader to supply raw data
|
||||
/// \return error code
|
||||
mpc_int32_t mpc_streaminfo_read(mpc_streaminfo *si, mpc_reader *r);
|
||||
|
||||
/// Gets length of stream si, in seconds.
|
||||
/// \return length of stream in seconds
|
||||
double mpc_streaminfo_get_length(mpc_streaminfo *si);
|
||||
|
||||
/// Returns length of stream si, in samples.
|
||||
/// \return length of stream in samples
|
||||
mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si);
|
||||
|
||||
/// Sets up decoder library.
|
||||
/// Call this first when preparing to decode an mpc stream.
|
||||
/// \param r reader that will supply raw data to the decoder
|
||||
void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r);
|
||||
|
||||
/// Initializes mpc decoder with the supplied stream info parameters.
|
||||
/// Call this next after calling mpc_decoder_setup.
|
||||
/// \param si streaminfo structure indicating format of source stream
|
||||
/// \return TRUE if decoder was initalized successfully, FALSE otherwise
|
||||
mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si);
|
||||
|
||||
/// Call this next after calling mpc_decoder_setup.
|
||||
/// \param si streaminfo structure indicating format of source stream
|
||||
/// \param fast_seeking boolean 0 = use fast seeking if safe, 1 = force fast seeking
|
||||
void mpc_decoder_set_seeking(mpc_decoder *d, mpc_streaminfo *si, mpc_bool_t fast_seeking);
|
||||
|
||||
void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si);
|
||||
|
||||
/// Sets decoder sample scaling factor. All decoded samples will be multiplied
|
||||
/// by this factor.
|
||||
/// \param scale_factor multiplicative scaling factor
|
||||
void mpc_decoder_scale_output(mpc_decoder *d, double scale_factor);
|
||||
|
||||
/// Actually reads data from previously initialized stream. Call
|
||||
/// this iteratively to decode the mpc stream.
|
||||
/// \param buffer destination buffer for decoded samples
|
||||
/// \param vbr_update_acc \todo document me
|
||||
/// \param vbr_update_bits \todo document me
|
||||
/// \return -1 if an error is encountered
|
||||
/// \return 0 if the stream has been completely decoded successfully and there are no more samples
|
||||
/// \return > 0 to indicate the number of bytes that were actually read from the stream.
|
||||
mpc_uint32_t mpc_decoder_decode(
|
||||
mpc_decoder *d,
|
||||
MPC_SAMPLE_FORMAT *buffer,
|
||||
mpc_uint32_t *vbr_update_acc,
|
||||
mpc_uint32_t *vbr_update_bits);
|
||||
|
||||
mpc_uint32_t mpc_decoder_decode_frame(
|
||||
mpc_decoder *d,
|
||||
mpc_uint32_t *in_buffer,
|
||||
mpc_uint32_t in_len,
|
||||
MPC_SAMPLE_FORMAT *out_buffer);
|
||||
|
||||
/// Seeks to the specified sample in the source stream.
|
||||
mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample);
|
||||
|
||||
/// Seeks to specified position in seconds in the source stream.
|
||||
mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _mpcdec_h_
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file reader.h
|
||||
|
||||
#ifndef _mpcdec_reader_h_
|
||||
#define _mpcdec_reader_h_
|
||||
|
||||
/// \brief Stream reader interface structure.
|
||||
///
|
||||
/// This is the structure you must supply to the musepack decoding library
|
||||
/// to feed it with raw data. Implement the five member functions to provide
|
||||
/// a functional reader.
|
||||
typedef struct mpc_reader_t {
|
||||
/// Reads size bytes of data into buffer at ptr.
|
||||
mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size);
|
||||
|
||||
/// Seeks to byte position offset.
|
||||
mpc_bool_t (*seek)(void *t, mpc_int32_t offset);
|
||||
|
||||
/// Returns the current byte offset in the stream.
|
||||
mpc_int32_t (*tell)(void *t);
|
||||
|
||||
/// Returns the total length of the source stream, in bytes.
|
||||
mpc_int32_t (*get_size)(void *t);
|
||||
|
||||
/// True if the stream is a seekable stream.
|
||||
mpc_bool_t (*canseek)(void *t);
|
||||
|
||||
/// Field that can be used to identify a particular instance of
|
||||
/// reader or carry along data associated with that reader.
|
||||
void *data;
|
||||
|
||||
} mpc_reader;
|
||||
|
||||
typedef struct mpc_reader_file_t {
|
||||
mpc_reader reader;
|
||||
|
||||
FILE *file;
|
||||
long file_size;
|
||||
mpc_bool_t is_seekable;
|
||||
} mpc_reader_file;
|
||||
|
||||
/// Initializes reader with default stdio file reader implementation. Use
|
||||
/// this if you're just reading from a plain file.
|
||||
///
|
||||
/// \param r reader struct to initalize
|
||||
/// \param input input stream to attach to the reader
|
||||
void mpc_reader_setup_file_reader(mpc_reader_file *r, FILE *input);
|
||||
|
||||
#endif // _mpcdec_reader_h_
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file requant.h
|
||||
/// Requantization function definitions.
|
||||
|
||||
#ifndef _mpcdec_requant_h
|
||||
#define _mpcdec_requant_h_
|
||||
|
||||
#include "mpcdec.h"
|
||||
|
||||
/* C O N S T A N T S */
|
||||
extern const mpc_uint32_t Res_bit [18]; // bits per sample for chosen quantizer
|
||||
extern const MPC_SAMPLE_FORMAT __Cc [1 + 18]; // coefficients for requantization
|
||||
extern const mpc_int32_t __Dc [1 + 18]; // offset for requantization
|
||||
|
||||
#define Cc (__Cc + 1)
|
||||
#define Dc (__Dc + 1)
|
||||
|
||||
#endif // _mpcdec_requant_h_
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
Copyright (c) 2005, The Musepack Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the The Musepack Development Team nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// \file streaminfo.h
|
||||
|
||||
#ifndef _mpcdec_streaminfo_h_
|
||||
#define _mpcdec_streaminfo_h_
|
||||
|
||||
typedef mpc_int32_t mpc_streaminfo_off_t;
|
||||
|
||||
/// \brief mpc stream properties structure
|
||||
///
|
||||
/// Structure containing all the properties of an mpc stream. Populated
|
||||
/// by the streaminfo_read function.
|
||||
typedef struct mpc_streaminfo {
|
||||
/// @name core mpc stream properties
|
||||
//@{
|
||||
mpc_uint32_t sample_freq; ///< sample frequency of stream
|
||||
mpc_uint32_t channels; ///< number of channels in stream
|
||||
mpc_streaminfo_off_t header_position; ///< byte offset of position of header in stream
|
||||
mpc_uint32_t stream_version; ///< streamversion of stream
|
||||
mpc_uint32_t bitrate; ///< bitrate of stream file (in bps)
|
||||
double average_bitrate; ///< average bitrate of stream (in bits/sec)
|
||||
mpc_uint32_t frames; ///< number of frames in stream
|
||||
mpc_int64_t pcm_samples;
|
||||
mpc_uint32_t max_band; ///< maximum band-index used in stream (0...31)
|
||||
mpc_uint32_t is; ///< intensity stereo (0: off, 1: on)
|
||||
mpc_uint32_t ms; ///< mid/side stereo (0: off, 1: on)
|
||||
mpc_uint32_t block_size; ///< only needed for SV4...SV6 -> not supported
|
||||
mpc_uint32_t profile; ///< quality profile of stream
|
||||
const char* profile_name; ///< name of profile used by stream
|
||||
//@}
|
||||
|
||||
/// @name replaygain related fields
|
||||
//@{
|
||||
mpc_int16_t gain_title; ///< replaygain title value
|
||||
mpc_int16_t gain_album; ///< replaygain album value
|
||||
mpc_uint16_t peak_album; ///< peak album loudness level
|
||||
mpc_uint16_t peak_title; ///< peak title loudness level
|
||||
//@}
|
||||
|
||||
/// @name true gapless support data
|
||||
//@{
|
||||
mpc_uint32_t is_true_gapless; ///< true gapless? (0: no, 1: yes)
|
||||
mpc_uint32_t last_frame_samples; ///< number of valid samples within last frame
|
||||
|
||||
mpc_uint32_t encoder_version; ///< version of encoder used
|
||||
char encoder[256]; ///< encoder name
|
||||
|
||||
mpc_streaminfo_off_t tag_offset; ///< offset to file tags
|
||||
mpc_streaminfo_off_t total_file_length; ///< total length of underlying file
|
||||
//@}
|
||||
|
||||
/// @name fast seeking support
|
||||
//@{
|
||||
mpc_uint32_t fast_seek; ///< support fast seeking ? (0: no, 1: yes)
|
||||
//@}
|
||||
} mpc_streaminfo;
|
||||
|
||||
#endif // _mpcdec_streaminfo_h_
|
|
@ -0,0 +1,785 @@
|
|||
CHANGES -- trio
|
||||
|
||||
|
||||
The changes listed without a name attributed to them were most likely done by
|
||||
Bjorn Reese and/or Daniel Stenberg.
|
||||
|
||||
Version 1.14 - 2010/01/26
|
||||
-------------------------
|
||||
* David Byron
|
||||
Added trio_xstring_append_max.
|
||||
|
||||
* Fixed compilation problem on Cygwin due to lack of long double math
|
||||
(reported by Matthias Andree).
|
||||
|
||||
* David Boyce
|
||||
Added #undef of standard stdio function names before assigning trio functions
|
||||
to them.
|
||||
|
||||
* Matthias Andree
|
||||
Upgraded configure.in to use new macros instead of obsoleted macros.
|
||||
|
||||
* Matthias Andree
|
||||
Added VPATH to Makefile.in
|
||||
|
||||
* Tom Honermann
|
||||
Fixed problem with subnormal numbers which caused an infinite loop outputting
|
||||
leading spaces.
|
||||
|
||||
* Adam McLaurin
|
||||
Improved parsing performance by avoiding memset() and memcpy() on character
|
||||
arrays.
|
||||
|
||||
* Gideon Smeding
|
||||
Fixed %u scanning of signed numbers.
|
||||
|
||||
* Gideon Smeding
|
||||
Fixed group scanning for non-matching input.
|
||||
|
||||
* Fixed missing undo of look-ahead reading for scanf functions. This does only
|
||||
work for the scanf* and fscanf* functions, not dscanf* and cscanf* functions
|
||||
(reported by Gideon Smeding).
|
||||
|
||||
* If the format string is empty, scanf does not attempt to read any input.
|
||||
|
||||
* Ralf Junker
|
||||
Fixed Borland compilation for user-defined specifiers.
|
||||
|
||||
|
||||
Version 1.13 - 2008/11/09
|
||||
-------------------------
|
||||
* Ives Aerts
|
||||
Added the $<format|skip> format for user-defined specifiers, which is
|
||||
compatible with compiler warnings about mismatches between specifiers and
|
||||
arguments.
|
||||
|
||||
* Added TRIO_DEPRECATED flag (reported by David Boyce)
|
||||
|
||||
* Fixed rounding adjustment for long double (reported as bug item #2136686).
|
||||
|
||||
* Added Makefile dependency for test target (reported as bug item #2136636).
|
||||
|
||||
* David Boyce
|
||||
Fixed long long support for MSVC.
|
||||
|
||||
* Fixed potential problem with read after buffer end for non-zero terminated
|
||||
strings (reported as bug item #1828465).
|
||||
|
||||
* Andreas Stricker
|
||||
Added WinCE support.
|
||||
|
||||
* Fixed number of significant digits for %g.
|
||||
|
||||
|
||||
Version 1.12 - 2006/10/22
|
||||
-------------------------
|
||||
* Fixed scanning of floats (reported by Bernd Ahlers).
|
||||
|
||||
* Fixed configure.in for GCC on Tru64 and MIPSpro on IRIX (reported by Andreas
|
||||
Maus).
|
||||
|
||||
* Olli Savia
|
||||
Added support for LynxOS.
|
||||
|
||||
|
||||
Version 1.11 - 2006/04/08
|
||||
-------------------------
|
||||
* Mark Pickelmann
|
||||
Fixed trio_unregister. If the first element was removed, the remaining
|
||||
list would be removed as well.
|
||||
|
||||
* Fixed unintended formatting of %e that would result in non-zero numbers
|
||||
starting with zero (reported by Mark Pickelmann and Gisli Ottarsson).
|
||||
|
||||
* Fixed compilation with Sun Workshop 6 (reported by Matthias Andree).
|
||||
|
||||
* Fixed accuracy for denormalized numbers (bug item #758327).
|
||||
|
||||
* Glen Davidson
|
||||
Fixed scanning of floating-point numbers without a decimal-point (bug item
|
||||
#1370427).
|
||||
|
||||
* David Byron
|
||||
Fixed more compiler warnings.
|
||||
|
||||
* Fixed compilation of trio_to_long_double and TRIO_FEATURE_FLOAT (reported by
|
||||
David Byron).
|
||||
|
||||
* Fixed precision of large floating-point numbers (bug item #1314524).
|
||||
|
||||
* Karl Bochert
|
||||
Fixed trio_fpclassify_and_signbit to only restore the floating-point
|
||||
precision.
|
||||
|
||||
* Fixed detection of need for ieee option on FreeBSD/Alpha.
|
||||
|
||||
* Added TRIO_SNPRINTF_ONLY compilation.
|
||||
|
||||
* Fixed trio_to_double by not using strtod() on Tru64/DECC because it does not
|
||||
support hex-floats.
|
||||
|
||||
* Fixed crash on 64 bits machines related to a previous workaround in version
|
||||
1.9 for uninitialized va_list (reported by Nicolai Tufar, suggestion by
|
||||
Douglas Gwyn).
|
||||
|
||||
* Patrick Jessee
|
||||
Fixed width calculation for %g.
|
||||
|
||||
* Added macros for internal features.
|
||||
|
||||
* Jon Foster
|
||||
Added macros for conditional compilation of many features. Documented all
|
||||
the features.
|
||||
|
||||
* Karl Bochert
|
||||
Fixed problem with Borland C++, which changes the floating-point precision
|
||||
for certain math functions (log10() and _fpclass()).
|
||||
|
||||
* Karl Bochert
|
||||
Fixed compilation warnings on Borland C++.
|
||||
|
||||
* Removed any occurrence of #elif because Borland C++ reports wrong line
|
||||
numbers when they are present (reported by Karl Bochert).
|
||||
|
||||
* David Byron
|
||||
Added trio_asprintfv.
|
||||
|
||||
* Brian Chapman
|
||||
Fixed Mac OS X compilation.
|
||||
|
||||
* David Byron
|
||||
Fixed several compiler warnings.
|
||||
|
||||
* Fixed printing of out-of-range arguments for %hhd and %hd. These arguments
|
||||
can be out of range because of default integer promotion.
|
||||
|
||||
* Bob Friesenhahn
|
||||
Fixed installation of header files.
|
||||
|
||||
* Joe Orton
|
||||
Added SHELL to Makefile.in to avoid problems with CShells.
|
||||
|
||||
* Shaun Tancheff
|
||||
Fixed regresion tests for MSVC.
|
||||
|
||||
* Craig Berry
|
||||
Fixed the VMS C99 workaround.
|
||||
|
||||
|
||||
Version 1.10 - 2003/03/06
|
||||
-------------------------
|
||||
* Rearranged some include files to accommodate large file support (reported by
|
||||
Albert Chin-A-Young).
|
||||
|
||||
* Added support for SunOS 4.1.x lack of strerror, tolower, and toupper
|
||||
(reported by Peter McCluskey).
|
||||
|
||||
* Fixed pedantic compilation with TRIO_MINIMAL.
|
||||
|
||||
* Jose Kahan
|
||||
Moved <limits.h> to avoid redefinition problems.
|
||||
|
||||
* Fixed hex-float exponents (reported by Matthias Clasen).
|
||||
|
||||
* Fixed handling of negative width and precision via paramters (reported by
|
||||
Jacob Navia).
|
||||
|
||||
* Nigel Hall
|
||||
Fixed TRIO_VA_START for VMS.
|
||||
|
||||
* Rune Enggaard Lausen
|
||||
Fixed compilation for Borland C++ Builder.
|
||||
|
||||
* Fixed precision of hex-float numbers (reported by James Antill).
|
||||
|
||||
* Fixed plus sign only to be added for signed numbers.
|
||||
|
||||
* Fixed printing of integers with value and precision of zero (reported by
|
||||
James Antill).
|
||||
|
||||
* Fixed %#.o to only print one zero if the value is zero (reported by James
|
||||
Antill).
|
||||
|
||||
* Rewrote check for IEEE compilation option to remove dependency on additional
|
||||
scripts.
|
||||
|
||||
* Mehdi Lavasani
|
||||
Makefile install target fixed to work with older install programs.
|
||||
|
||||
* Collapsed the DECC, MSVC, HP-UX, and AIX code for trio_fpclassify_and_sign()
|
||||
with further preprocessing.
|
||||
|
||||
|
||||
Version 1.9 - 2002/10/13
|
||||
------------------------
|
||||
* Fixed trio_fpclassify_and_signbit on AIX 3.2
|
||||
|
||||
* Added configure check for -ieee/-mieee compilation option for Alpha machines.
|
||||
|
||||
* Craig Berry
|
||||
Fixed compilation on VMS.
|
||||
|
||||
* Albert Chin-A-Young
|
||||
Fixed incorrect conditional expression in trio_isinf.
|
||||
|
||||
* Fixed the warnings about uninitialized va_list in the printfv and scanfv
|
||||
family without the use of compiler specific pragmas (suggested by Ian
|
||||
Pilcher).
|
||||
|
||||
* Fixed space flag for floating-point numbers (reported by Ian Main).
|
||||
|
||||
|
||||
Version 1.8 - 2002/07/10
|
||||
------------------------
|
||||
* Fixed infinite loop in multibyte handling (reported by Gisli Ottarsson).
|
||||
|
||||
* Added the customizable cprintf/cscanf family which enables to user to specify
|
||||
input and output stream functions (suggested by Florian Schulze).
|
||||
|
||||
* Fixed trio_isinf by removing the HP-UX workaround, and instead making sure
|
||||
that the C99 macro will adhere to the trio return values (reported by Luke
|
||||
Dunstan).
|
||||
|
||||
* Alexander Lukyanov
|
||||
Fixed boundary case for scanning and EOF.
|
||||
|
||||
* Jacob Navia
|
||||
Enabled the L modifier for formatting.
|
||||
|
||||
* Added TRIO_MINIMAL to build trio without the string functions.
|
||||
|
||||
* Added the R modifier to print rounded floating-point numbers.
|
||||
|
||||
* Added trio_to_long_double and long double scanning (the L modifier).
|
||||
|
||||
* Added trio_locale_decimal_point, trio_locale_thousand_separator,
|
||||
trio_locale_grouping to overwrite locale settings.
|
||||
|
||||
* Rewrote TrioWriteDouble to avoid temporary buffers and thus the danger of
|
||||
buffer overflows (for instance %.5000f).
|
||||
|
||||
* Improved floating-point formatting accuracy.
|
||||
|
||||
* Fixed formatting of non-decimal exponents.
|
||||
|
||||
* Fixed thousand separator checking.
|
||||
|
||||
* Fixed %f scanning to get a float and %lf to get a double.
|
||||
|
||||
* Fixed WIN32 compilation (reported by Emmanuel Mogenet)
|
||||
|
||||
* Fixed regression test cases to exclude disabled features.
|
||||
|
||||
|
||||
Version 1.7 - 2002/05/07
|
||||
------------------------
|
||||
* Fixed trio_to_double to handle hex-floats properly.
|
||||
|
||||
* Fixed printing of %a-format to be like %e, not like %g.
|
||||
|
||||
* Fixed floating-point printing of values beyond the machine accuracy.
|
||||
|
||||
* Fixed %f for printing with large precision.
|
||||
|
||||
* Fixed the usage of C99 nan(), which caused a crash on OSF/1 (reported by
|
||||
Georg Bolz)
|
||||
|
||||
* Joe Orton
|
||||
Fixed %p on 64-bit platforms.
|
||||
|
||||
* Made trio compile with K&R compilers.
|
||||
|
||||
* Emmanuel Mogenet
|
||||
Fixed bug in trio_asprintf.
|
||||
|
||||
* Emmanuel Mogenet
|
||||
Various WIN32 fixes.
|
||||
|
||||
* Joe Orton
|
||||
Fixed trio_isinf() on HP-UX, and added test cases.
|
||||
|
||||
* Joe Orton
|
||||
Fixed non-portable use of $^ in Makefile.
|
||||
|
||||
* Joe Orton
|
||||
Added autoconf.
|
||||
|
||||
* Alexander Lukyanov
|
||||
Fixed a number of bugs in the scanning of EOF and the count specifier.
|
||||
|
||||
* Richard Jinks
|
||||
Added trio_nzero
|
||||
|
||||
* Fixed incorrect handling of return code from TrioReadChar (reported by
|
||||
Henrik Löf)
|
||||
|
||||
* Fixed parsing of character class expressions.
|
||||
|
||||
* Fixed trio_to_double which did not work with long fractions.
|
||||
|
||||
* Fixed %f for printing of large numbers.
|
||||
|
||||
* Fixed %#s to handle whitespaces as non-printable characters.
|
||||
|
||||
* Added trio_isfinite, trio_signbit, and trio_fpclassify.
|
||||
|
||||
* Added new test cases.
|
||||
|
||||
|
||||
Version 1.6 - 2002/01/13
|
||||
------------------------
|
||||
* Added dynamic string functions.
|
||||
|
||||
* Rewrote and extended documentation in JavaDoc (using Doxygen).
|
||||
|
||||
* Moved and renamed strio functions to triostr.
|
||||
|
||||
* Robert Collins
|
||||
Added definition for Cygwin.
|
||||
|
||||
* Markus Henke
|
||||
Added long double workaround for the HP C/iX compiler.
|
||||
|
||||
* Marc Verwerft
|
||||
Improved error handling for dynamically allocated strings.
|
||||
|
||||
* John Fotheringham
|
||||
Made trionan compile on OpenVMS.
|
||||
|
||||
* Added 'd' and 'D' as exponent letters when using TRIO_MICROSOFT.
|
||||
|
||||
* Fixed uninitial memory read for the parameter modifiers.
|
||||
|
||||
|
||||
Version 1.5 - 2001/09/08
|
||||
------------------------
|
||||
* Merged with libxml changes.
|
||||
|
||||
* Moved NaN and Inf handling to separate file to enable reuse in other
|
||||
projects.
|
||||
|
||||
* Igor Zlatkovic
|
||||
Fixed TrioGenerateNan for MSVC.
|
||||
|
||||
* Fixed lots of preprocessor macros and internal data structure names.
|
||||
|
||||
|
||||
Version 1.4 - 2001/06/03
|
||||
------------------------
|
||||
* Added hex-float (%a and %A) for scanning.
|
||||
|
||||
* Added wide character arguments (%ls, %ws, %S, %lc, %wc, and %C) for both
|
||||
printf and scanf.
|
||||
|
||||
* Added mutex callbacks for user-specified specifiers to enable applications to
|
||||
add thread-safety. These are registered with trio_register, where the
|
||||
namespace is set to either ":enter" to lock a mutex, or ":leave" to unlock a
|
||||
mutex.
|
||||
|
||||
* Added equivalence class expressions for scanning. For example, %[[=a=]] scans
|
||||
for all letters in the same equivalence class as the letter 'a' as defined
|
||||
by the locale.
|
||||
|
||||
* Changed character class expressions for scanning. The expressions must now
|
||||
be embedded withing an extra set of brackets, e.g. %[[:alpha:]]. This was
|
||||
done to adhere to the syntax of UNIX98 regular expressions.
|
||||
|
||||
* Added the possibility to specify standard support (TRIO_C99 etc.) as compiler
|
||||
options.
|
||||
|
||||
* Fixed conversion of hex-float in StrToDouble.
|
||||
|
||||
* Fixed formatting of hex-float numbers.
|
||||
|
||||
* Stan Boehm
|
||||
Fixed crash on QNX, which happend because some buffers on the stack were too
|
||||
big.
|
||||
|
||||
* Fixed default precision for %f and %g (reported by Jose Ortiz)
|
||||
|
||||
* Howard Kapustein
|
||||
Added the I8, I16, I32, and I64 modifiers.
|
||||
|
||||
* Jose Ortiz
|
||||
Fixed rounding problem for %e.
|
||||
|
||||
* Jose Ortiz
|
||||
Fixed various problems with the xlC and Sun C++ compilers.
|
||||
|
||||
|
||||
Version 1.3 - 2001/05/16
|
||||
------------------------
|
||||
* trio's treatment of the field width when the %e code was used was not
|
||||
correct (reported by Gisli Ottarsson). It turns out the fraction part should
|
||||
be zero-padded by default and the exponent part should be zero-prefixed if
|
||||
it is only one digit. At least that's how the GNU and Sun libc's work. The
|
||||
trio floating point output looks identical to them now.
|
||||
|
||||
* Fixed group scanning with modifiers.
|
||||
|
||||
* Fixed compilation for 64-bit Digital Unix.
|
||||
|
||||
* Igor Zlatkovic
|
||||
Fixed compilation of dprintf, which uses read/write, for MSVC.
|
||||
|
||||
* Fixed various compilation problems on Digital Unix (mainly associated with
|
||||
va_list).
|
||||
|
||||
|
||||
Version 1.2 - 2001/04/11
|
||||
------------------------
|
||||
* Added autoconf integration. If compiled with HAVE_CONFIG_H the following
|
||||
happens. Firstly, <config.h> is included. Secondly, trio will only be
|
||||
compiled if WITH_TRIO is defined herein. Thirdly, if TRIO_REPLACE_STDIO is
|
||||
defined, only stdio functions that have not been detected by autoconf, i.e.
|
||||
those not defined by HAVE_PRINTF or similar, will be replaced by trio
|
||||
functions (suggested by Daniel Veillard).
|
||||
|
||||
* Fixed '%m.nf' output. Previously trio did not treat the width properly
|
||||
in all cases (reported by Gisli Ottarsson).
|
||||
|
||||
* Added explicit promotion for the scanfv family.
|
||||
|
||||
* Fixed more C++ compilation warnings.
|
||||
|
||||
|
||||
Version 1.1 - 2001/02/25
|
||||
------------------------
|
||||
* Added explicit promotion for the printfv familiy. A float must be specified
|
||||
by %hf.
|
||||
|
||||
* Fixed positionals for printfv (reported by Gisli Ottarsson).
|
||||
|
||||
* Fixed an integer to pointer conversion problem on the SGI MIPS C compiler
|
||||
(reported by Gisli Ottarsson).
|
||||
|
||||
* Fixed ANSI C++ warnings (type casting, and namespace is a reserved keyword).
|
||||
|
||||
* Added \n to all examples in the documentation to prevent confusion.
|
||||
|
||||
* Fixed StrSubstringMax
|
||||
|
||||
|
||||
Version 1.0 - 2000/12/10
|
||||
------------------------
|
||||
* Bumped Version number.
|
||||
|
||||
|
||||
Version 0.25 - 2000/12/09
|
||||
-------------------------
|
||||
* Wrote more documentation.
|
||||
|
||||
* Improved NaN support and added NaN to regression test.
|
||||
|
||||
* Fixed C99 support.
|
||||
|
||||
* Added missing getter/setter functions.
|
||||
|
||||
|
||||
Version 0.24 - 2000/12/02
|
||||
-------------------------
|
||||
* Added callback functionality for the user-defined specifier (<>). All
|
||||
the necessary functions are defined in triop.h header file. See the
|
||||
documentation for trio_register for further detail.
|
||||
|
||||
* Wrote initial documentation on the callback functionality.
|
||||
|
||||
* Added the printfv and scanfv family of functions, which takes a pointer
|
||||
array rather than variadic arguments. Each pointer in the array must point
|
||||
to the associated data (requested by Bruce Korb).
|
||||
|
||||
* As indicated in version 0.21 the extension modifiers (<>) have now been
|
||||
completely removed.
|
||||
|
||||
* Added skipping of thousand-separators in floating-point number scanning.
|
||||
|
||||
|
||||
Version 0.23 - 2000/10/21
|
||||
-------------------------
|
||||
* Added width to scanning of floating-point numbers.
|
||||
|
||||
* Wrote more documentation on trio_printf.
|
||||
|
||||
* Fixed problem with trailing zeroes after decimal-point.
|
||||
|
||||
|
||||
Version 0.22 - 2000/08/06
|
||||
-------------------------
|
||||
* Added LC_CTYPE locale dependent character class expressions to scan lists.
|
||||
Included are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:],
|
||||
[:lower:], [:print:], [:punct:], [:space:], [:upper:], [:xdigit:]
|
||||
|
||||
* Added C escapes to alternative string formatting and scanning.
|
||||
|
||||
* Added StrSubstringMax.
|
||||
|
||||
* Wrote a little more documentation.
|
||||
|
||||
* Fixed scanf return values.
|
||||
|
||||
* Fixed a sign error for non-ascii characters.
|
||||
|
||||
|
||||
Version 0.21 - 2000/07/19
|
||||
-------------------------
|
||||
* Converted the documentation to TeX. With latex2man the documentation can
|
||||
automatically be converted into man pages.
|
||||
|
||||
* Added trio_scanf, trio_vscanf, trio_fscanf, and trio_vfscanf.
|
||||
|
||||
* Added trio_dprintf, trio_vdprintf, trio_dscanf, and trio_vdscanf. These
|
||||
functions can be used to write and read directly to pipes and sockets (the
|
||||
assume blocking sockets). Stdio buffering is surpassed, so the functions are
|
||||
async-safe. However, reading from stdin (STDIN_FILENO) or writing to stdout
|
||||
(STDOUT_FILENO) reintroduces the buffering.
|
||||
|
||||
* Paul Janzen
|
||||
Added trio_asprintf and trio_vasprintf, which are compatible with the GNU
|
||||
and BSD interfaces.
|
||||
|
||||
* Added scanlist ranges for group scanning (%[]).
|
||||
|
||||
* Added width for scanning (missing for floating-point numbers though).
|
||||
|
||||
* Added variable size modifier (&) to handle system defined types of unknown
|
||||
size. This modifier makes certain assumptions about the integer sizes, which
|
||||
may not be valid on any machine. Consequently, the modifier will remain
|
||||
undocumented, as it may be removed later.
|
||||
|
||||
* Added \777 and \xFF to alternative string scanning (%#s)
|
||||
|
||||
* Added the TRIO_REPLACE_STDIO check in the header.
|
||||
|
||||
* Improved performance of the multibyte character parsing.
|
||||
|
||||
* Fixed positionals (%n$) which had stopped working.
|
||||
|
||||
* Fixed hh and ll modifiers to allow exactly two letters and no more.
|
||||
|
||||
* Fixed ANSI C++ warnings. Also fixed the compiler warning about casting
|
||||
between integer and pointer (this has been annoying me for ages).
|
||||
|
||||
* Fixed snprintf and vsnprintf with zero buffer size.
|
||||
|
||||
* Fixed NAN problems (reported by Keith Briggs).
|
||||
|
||||
* Fixed parsing of multibyte characters. The format string was not correctly
|
||||
advanced in case of a multibyte character.
|
||||
|
||||
* Renamed many of the internal functions to have more consistant names.
|
||||
|
||||
* Removed the <quote=c> and <fill=c> modifiers. They are not really worth
|
||||
including. The other <> modifiers may disappear as well.
|
||||
|
||||
|
||||
Version 0.20 - 2000/06/05
|
||||
-------------------------
|
||||
* Added intmax_t and ptrdiff_t support.
|
||||
|
||||
* Added support for LC_NUMERIC grouping.
|
||||
|
||||
* Added double-dot notation for the conversion base. The style is now
|
||||
%width.precision.base, where any argument can be a number, an asterix
|
||||
indicating a parameter, or be omitted entirely. For example, %*..2i is
|
||||
to specify binary numbers without precision, and with width as a parameter
|
||||
on the va_list.
|
||||
|
||||
* Added sticky modifier (!), which makes subsequent specifiers of the same
|
||||
type reuse the current modifiers. Inspired by a suggestion from Gary Porter.
|
||||
|
||||
* Added group scanning (%[]). Scanlist ranges and multibyte sequences are not
|
||||
supported yet.
|
||||
|
||||
* Added count scanning (%n).
|
||||
|
||||
* Changed the number scanning to accept thousand separators and any base.
|
||||
|
||||
* Fixed positional for parameters. It is possible to write something like
|
||||
%3$*1$.*2$d (which happens to be the same as %*.*d).
|
||||
|
||||
* Fixed precision of integers.
|
||||
|
||||
* Fixed parameter flags. Before trio could only handle one parameter flag per
|
||||
specifier, although two (three with double-dot base) were possible.
|
||||
|
||||
* Fixed isinf() for those platforms where it is unimplemented.
|
||||
|
||||
|
||||
Version 0.18 - 2000/05/27
|
||||
-------------------------
|
||||
* Rewrote the entire floating-point formatting function (Danny Dulai had
|
||||
reported several errors and even supplied some patches, which unfortunately
|
||||
were lost due to the refactoring).
|
||||
|
||||
* Removed the use of strlen() in the declaration of a stack array. This
|
||||
caused problems on some compilers (besides it isn't really ANSI C compliant
|
||||
anyways). Using some arbitrarily chosen maximum value; should examine if
|
||||
some standard defines an upper limit on the length of decimal-point and
|
||||
thousands-separator (sizeof(wchar_t) perhaps?)
|
||||
|
||||
* Changed the parsing of the format string to be multibyte aware.
|
||||
|
||||
|
||||
Version 0.17 - 2000/05/19
|
||||
-------------------------
|
||||
* Added INF, -INF, and NAN for floating-point numbers.
|
||||
|
||||
* Fixed %#.9g -- alternative with precision.
|
||||
|
||||
* Ken Gibson
|
||||
Fixed printing of negative hex numbers
|
||||
|
||||
* Joerg (last name unknown)
|
||||
Fixed convertion of non-ASCII characters
|
||||
|
||||
|
||||
Version 0.16 - 1999/08/06
|
||||
-------------------------
|
||||
* Changed the constness of the second argument of StrFloat and StrDouble. The
|
||||
lack of parameter overloading in C is the reason for the strange use of
|
||||
constness in strtof and strtod.
|
||||
|
||||
* Cleaned up constness.
|
||||
|
||||
|
||||
Version 0.15 - 1999/07/23
|
||||
-------------------------
|
||||
* Fixed the internal representation of numbers from signed to unsigned. Signed
|
||||
numbers posed a problem for large unsigned numbers (reported by Tero)
|
||||
|
||||
* Fixed a tiny bug in trio_vsprintfcat
|
||||
|
||||
* Changed the meaning of the max argument of StrAppendMax to be consistant
|
||||
with StrFormatAppendMax. Now it is the maximal size of the entire target
|
||||
buffer, not just the appended size. This makes it easier to avoid buffer
|
||||
overflows (requested by Tero)
|
||||
|
||||
|
||||
Version 0.14 - 1999/05/16
|
||||
-------------------------
|
||||
* Added size_t support (just waiting for a C99 compliant compiler to add
|
||||
ptrdiff_t and intmax_t)
|
||||
|
||||
* Rewrote TrioOutStreamDouble so it does not use the libc sprintf to emulate
|
||||
floating-point anylonger.
|
||||
|
||||
* Fixed width, precision, and adjustment for numbers and doubles.
|
||||
|
||||
|
||||
Version 0.13 - 1999/05/06
|
||||
-------------------------
|
||||
* Fixed zero padding for %d. Now %d will only zero pad if explicitly requested
|
||||
to do so with the 0 flag (reported by Tero).
|
||||
|
||||
* Fixed an incorrect while() condition in TrioGetString (reported by Tero).
|
||||
|
||||
|
||||
Version 0.12 - 1999/04/19
|
||||
-------------------------
|
||||
* Fixed incorrect zero padding of pointers
|
||||
|
||||
* Added StrHash with STRIO_HASH_PLAIN
|
||||
|
||||
* Added StrFormatDateMax
|
||||
|
||||
|
||||
Version 0.11 - 1999/03/25
|
||||
-------------------------
|
||||
* Made it compile under cygwin
|
||||
|
||||
* Fixed a bug were TrioPreprocess would return an error if no formatting chars
|
||||
were found (reported by Tero).
|
||||
|
||||
|
||||
Version - 1999/03/19
|
||||
--------------------
|
||||
* Added trio_strerror and TRIO_ERROR_NAME.
|
||||
|
||||
* Changed the error codes to be positive (as errno)
|
||||
|
||||
* Fixed two reads of uninitialized memory reported by Purify
|
||||
|
||||
* Added binary specifiers 'b' and 'B' (like SCO.) ThousandSeparator can be
|
||||
used to separate nibbles (4 bit)
|
||||
|
||||
* Renamed all Internal* functions to Trio*, which seems like a better
|
||||
namespace (even though it is of no practical interest because these
|
||||
functions are not visible beyond the scope of this file.)
|
||||
|
||||
|
||||
Version - 1999/03/12
|
||||
--------------------
|
||||
* Added hex-float format for StrToDouble
|
||||
|
||||
* Double references and gaps in the arguments are not allowed (for the %n$
|
||||
format) and in both cases an error code is returned.
|
||||
|
||||
* Added StrToDouble (and StrToFloat)
|
||||
|
||||
|
||||
Version - 1999/03/08
|
||||
--------------------
|
||||
* Added InStream and OutStream to the trio_T structure.
|
||||
|
||||
* Started work on TrioScan.
|
||||
|
||||
* Return values for errors changed. Two macros to unpack the error code has
|
||||
been added to the header.
|
||||
|
||||
* Shortshort (hh) flag added.
|
||||
|
||||
* %#s also quotes the quote-char now.
|
||||
|
||||
* Removed the 'errorInFormat' boolean, which isn't used anymore after the
|
||||
functions bail out with an error instead.
|
||||
|
||||
|
||||
Version - 1999/03/04
|
||||
--------------------
|
||||
* More than MAX_PARAMETERS parametes will now cause the TrioPreprocess()
|
||||
function to return error.
|
||||
|
||||
* Unknown flags and/or specifiers cause errors too.
|
||||
|
||||
* Added trio_snprintfcat and trio_vsnprintfcat and the defined name
|
||||
StrFormatAppendMax. They append a formatted string to the end of a string.
|
||||
|
||||
* Define MAX_PARAMETERS to 128 at all times instead of using NL_ARGMAX when
|
||||
that exists.
|
||||
|
||||
* Added platform fixes for Amiga as suggested by Tero Jänkä <tesaja@utu.fi>
|
||||
|
||||
|
||||
Version - 1999/01/31
|
||||
--------------------
|
||||
* vaprintf did add a zero byte even when it had failed.
|
||||
|
||||
* Cleaned up the code for locale handling and thousand separator
|
||||
|
||||
* Added trio_aprintf() and trio_vaprintf(). They return an allocated string.
|
||||
|
||||
* Added thousands separator for numbers
|
||||
|
||||
* Added floating point support for *printf
|
||||
|
||||
|
||||
Version - 1998/10/20
|
||||
--------------------
|
||||
* StrMatchCase() called StrMatch() instead of itself recursively
|
||||
|
||||
* Rewrote the implementation of *printf and *scanf and put all the code in
|
||||
this file. Extended qualifiers and qualifiers from other standards were
|
||||
added.
|
||||
|
||||
* Added StrSpanFunction, StrToLong, and StrToUnsignedLong
|
||||
|
||||
|
||||
Version - 1998/05/23
|
||||
--------------------
|
||||
* Made the StrEqual* functions resistant to NULL pointers
|
||||
|
||||
* Turns out strdup() is no standard at all, and some platforms (I seem to
|
||||
recall HP-UX) has problems with it. Made our own StrDuplicate() instead.
|
||||
|
||||
* Added StrFormat() and StrFormatMax() to serve as sprintf() and snprintf()
|
||||
respectively.
|
|
@ -0,0 +1,235 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* $Id: trio.h,v 1.19 2009/09/13 10:12:22 breese Exp $
|
||||
*
|
||||
* Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
||||
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
||||
*
|
||||
*************************************************************************
|
||||
*
|
||||
* http://ctrio.sourceforge.net/
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef TRIO_TRIO_H
|
||||
#define TRIO_TRIO_H
|
||||
|
||||
#if !defined(WITHOUT_TRIO)
|
||||
|
||||
/*
|
||||
* Use autoconf defines if present. Packages using trio must define
|
||||
* HAVE_CONFIG_H as a compiler option themselves.
|
||||
*/
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "triop.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Error codes.
|
||||
*
|
||||
* Remember to add a textual description to trio_strerror.
|
||||
*/
|
||||
enum {
|
||||
TRIO_EOF = 1,
|
||||
TRIO_EINVAL = 2,
|
||||
TRIO_ETOOMANY = 3,
|
||||
TRIO_EDBLREF = 4,
|
||||
TRIO_EGAP = 5,
|
||||
TRIO_ENOMEM = 6,
|
||||
TRIO_ERANGE = 7,
|
||||
TRIO_ERRNO = 8,
|
||||
TRIO_ECUSTOM = 9
|
||||
};
|
||||
|
||||
/* Error macros */
|
||||
#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
|
||||
#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
|
||||
#define TRIO_ERROR_NAME(x) trio_strerror(x)
|
||||
|
||||
typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int));
|
||||
typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t));
|
||||
|
||||
TRIO_CONST char *trio_strerror TRIO_PROTO((int));
|
||||
|
||||
/*************************************************************************
|
||||
* Print Functions
|
||||
*/
|
||||
|
||||
int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...));
|
||||
int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
|
||||
int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
|
||||
int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
|
||||
int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
|
||||
int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
|
||||
int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, ...));
|
||||
int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, va_list args));
|
||||
int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...));
|
||||
int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args));
|
||||
int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
|
||||
int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
|
||||
va_list args));
|
||||
int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
|
||||
void **args));
|
||||
|
||||
int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
|
||||
int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
|
||||
va_list args));
|
||||
|
||||
#if defined(TRIO_DEPRECATED)
|
||||
char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...));
|
||||
char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
|
||||
#endif
|
||||
|
||||
int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...));
|
||||
int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args));
|
||||
int trio_asprintfv TRIO_PROTO((char **result, TRIO_CONST char *format, trio_pointer_t * args));
|
||||
|
||||
/*************************************************************************
|
||||
* Scan Functions
|
||||
*/
|
||||
int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...));
|
||||
int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args));
|
||||
int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
|
||||
int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
|
||||
int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
|
||||
int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
|
||||
int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, ...));
|
||||
int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, va_list args));
|
||||
int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...));
|
||||
int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args));
|
||||
int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args));
|
||||
|
||||
/*************************************************************************
|
||||
* Locale Functions
|
||||
*/
|
||||
void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint));
|
||||
void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator));
|
||||
void trio_locale_set_grouping TRIO_PROTO((char *grouping));
|
||||
|
||||
/*************************************************************************
|
||||
* Renaming
|
||||
*/
|
||||
#ifdef TRIO_REPLACE_STDIO
|
||||
/* Replace the <stdio.h> functions */
|
||||
#ifndef HAVE_PRINTF
|
||||
# undef printf
|
||||
# define printf trio_printf
|
||||
#endif
|
||||
#ifndef HAVE_VPRINTF
|
||||
# undef vprintf
|
||||
# define vprintf trio_vprintf
|
||||
#endif
|
||||
#ifndef HAVE_FPRINTF
|
||||
# undef fprintf
|
||||
# define fprintf trio_fprintf
|
||||
#endif
|
||||
#ifndef HAVE_VFPRINTF
|
||||
# undef vfprintf
|
||||
# define vfprintf trio_vfprintf
|
||||
#endif
|
||||
#ifndef HAVE_SPRINTF
|
||||
# undef sprintf
|
||||
# define sprintf trio_sprintf
|
||||
#endif
|
||||
#ifndef HAVE_VSPRINTF
|
||||
# undef vsprintf
|
||||
# define vsprintf trio_vsprintf
|
||||
#endif
|
||||
#ifndef HAVE_SNPRINTF
|
||||
# undef snprintf
|
||||
# define snprintf trio_snprintf
|
||||
#endif
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
# undef vsnprintf
|
||||
# define vsnprintf trio_vsnprintf
|
||||
#endif
|
||||
#ifndef HAVE_SCANF
|
||||
# undef scanf
|
||||
# define scanf trio_scanf
|
||||
#endif
|
||||
#ifndef HAVE_VSCANF
|
||||
# undef vscanf
|
||||
# define vscanf trio_vscanf
|
||||
#endif
|
||||
#ifndef HAVE_FSCANF
|
||||
# undef fscanf
|
||||
# define fscanf trio_fscanf
|
||||
#endif
|
||||
#ifndef HAVE_VFSCANF
|
||||
# undef vfscanf
|
||||
# define vfscanf trio_vfscanf
|
||||
#endif
|
||||
#ifndef HAVE_SSCANF
|
||||
# undef sscanf
|
||||
# define sscanf trio_sscanf
|
||||
#endif
|
||||
#ifndef HAVE_VSSCANF
|
||||
# undef vsscanf
|
||||
# define vsscanf trio_vsscanf
|
||||
#endif
|
||||
/* These aren't stdio functions, but we make them look similar */
|
||||
#undef dprintf
|
||||
#define dprintf trio_dprintf
|
||||
#undef vdprintf
|
||||
#define vdprintf trio_vdprintf
|
||||
#undef aprintf
|
||||
#define aprintf trio_aprintf
|
||||
#undef vaprintf
|
||||
#define vaprintf trio_vaprintf
|
||||
#undef asprintf
|
||||
#define asprintf trio_asprintf
|
||||
#undef vasprintf
|
||||
#define vasprintf trio_vasprintf
|
||||
#undef dscanf
|
||||
#define dscanf trio_dscanf
|
||||
#undef vdscanf
|
||||
#define vdscanf trio_vdscanf
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* WITHOUT_TRIO */
|
||||
|
||||
#endif /* TRIO_TRIO_H */
|
|
@ -0,0 +1,335 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* $Id: triodef.h,v 1.35 2009/09/20 11:37:14 breese Exp $
|
||||
*
|
||||
* Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
||||
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef TRIO_TRIODEF_H
|
||||
#define TRIO_TRIODEF_H
|
||||
|
||||
/*************************************************************************
|
||||
* Compiler support detection
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define TRIO_COMPILER_GCC
|
||||
#endif
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
# define TRIO_COMPILER_SUNPRO __SUNPRO_CC
|
||||
#else
|
||||
# if defined(__SUNPRO_C)
|
||||
# define TRIO_COMPILER_SUNPRO __SUNPRO_C
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# define TRIO_COMPILER_XLC
|
||||
#else
|
||||
# if defined(_AIX) && !defined(__GNUC__)
|
||||
# define TRIO_COMPILER_XLC /* Workaround for old xlc */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__DECC) || defined(__DECCXX)
|
||||
# define TRIO_COMPILER_DECC
|
||||
#else
|
||||
# if defined(__osf__) && defined(__LANGUAGE_C__) && !defined(__GNUC__)
|
||||
# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__HP_aCC) || defined(__HP_cc)
|
||||
# define TRIO_COMPILER_HP
|
||||
#endif
|
||||
|
||||
#if defined(sgi) || defined(__sgi)
|
||||
# define TRIO_COMPILER_MIPSPRO
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define TRIO_COMPILER_MSVC
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
# define TRIO_COMPILER_BCB
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Platform support detection
|
||||
*/
|
||||
|
||||
#if defined(VMS) || defined(__VMS)
|
||||
# define TRIO_PLATFORM_VMS
|
||||
#endif
|
||||
|
||||
#if defined(unix) || defined(__unix) || defined(__unix__)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_COMPILER_XLC) || defined(_AIX)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_COMPILER_DECC) || defined(__osf___)
|
||||
# if !defined(TRIO_PLATFORM_VMS)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
#endif
|
||||
|
||||
#if defined(__Lynx__)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
# define TRIO_PLATFORM_LYNX
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
#endif
|
||||
|
||||
#if defined(__QNX__)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
# define TRIO_PLATFORM_QNX
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
#endif
|
||||
|
||||
#if defined(AMIGA) && defined(TRIO_COMPILER_GCC)
|
||||
# define TRIO_PLATFORM_UNIX
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
|
||||
# define TRIO_PLATFORM_WIN32
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
# define TRIO_PLATFORM_WINCE
|
||||
#endif
|
||||
|
||||
#if defined(mpeix) || defined(__mpexl)
|
||||
# define TRIO_PLATFORM_MPEIX
|
||||
#endif
|
||||
|
||||
#if defined(_AIX)
|
||||
# define TRIO_PLATFORM_AIX
|
||||
#endif
|
||||
|
||||
#if defined(__hpux)
|
||||
# define TRIO_PLATFORM_HPUX
|
||||
#endif
|
||||
|
||||
#if defined(sun) || defined(__sun__)
|
||||
# if defined(__SVR4) || defined(__svr4__)
|
||||
# define TRIO_PLATFORM_SOLARIS
|
||||
# else
|
||||
# define TRIO_PLATFORM_SUNOS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Standards support detection
|
||||
*/
|
||||
|
||||
#if defined(__STDC__) \
|
||||
|| defined(_MSC_EXTENSIONS) \
|
||||
|| defined(TRIO_COMPILER_BCB)
|
||||
# define PREDEF_STANDARD_C89
|
||||
#endif
|
||||
#if defined(__STDC_VERSION__)
|
||||
# define PREDEF_STANDARD_C90
|
||||
#endif
|
||||
#if (__STDC_VERSION__ - 0 >= 199409L)
|
||||
# define PREDEF_STANDARD_C94
|
||||
#endif
|
||||
#if (__STDC_VERSION__ - 0 >= 199901L)
|
||||
# define PREDEF_STANDARD_C99
|
||||
#endif
|
||||
#if defined(TRIO_COMPILER_SUNPRO) && (TRIO_COMPILER_SUNPRO >= 0x420)
|
||||
# if !defined(PREDEF_STANDARD_C94)
|
||||
# define PREDEF_STANDARD_C94
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# define PREDEF_STANDARD_CXX
|
||||
#endif
|
||||
#if __cplusplus - 0 >= 199711L
|
||||
# define PREDEF_STANDARD_CXX89
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_PLATFORM_UNIX)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_VERSION)
|
||||
# define PREDEF_STANDARD_POSIX _POSIX_VERSION
|
||||
# if (_POSIX_VERSION >= 199506L)
|
||||
# define PREDEF_STANDARD_POSIX_1996
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (_XOPEN_VERSION - 0 >= 3) || defined(_XOPEN_XPG3)
|
||||
# define PREDEF_STANDARD_XPG3
|
||||
#endif
|
||||
#if (_XOPEN_VERSION - 0 >= 4) || defined(_XOPEN_XPG4)
|
||||
# define PREDEF_STANDARD_XPG4
|
||||
#endif
|
||||
#if (_XOPEN_VERSION - 0 > 4) \
|
||||
|| (defined(_XOPEN_UNIX) && (_XOPEN_VERSION - 0 == 4))
|
||||
# define PREDEF_STANDARD_UNIX95
|
||||
#endif
|
||||
#if (_XOPEN_VERSION - 0 >= 500)
|
||||
# define PREDEF_STANDARD_UNIX98
|
||||
#endif
|
||||
#if (_XOPEN_VERSION - 0 >= 600)
|
||||
# define PREDEF_STANDARD_UNIX03
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Generic defines
|
||||
*/
|
||||
|
||||
#if !defined(TRIO_PUBLIC)
|
||||
# define TRIO_PUBLIC
|
||||
#endif
|
||||
#if !defined(TRIO_PRIVATE)
|
||||
# define TRIO_PRIVATE static
|
||||
#endif
|
||||
|
||||
#if !(defined(PREDEF_STANDARD_C89) || defined(PREDEF_STANDARD_CXX))
|
||||
# define TRIO_COMPILER_ANCIENT
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_COMPILER_ANCIENT)
|
||||
# define TRIO_CONST
|
||||
# define TRIO_VOLATILE
|
||||
# define TRIO_SIGNED
|
||||
typedef double trio_long_double_t;
|
||||
typedef char * trio_pointer_t;
|
||||
# define TRIO_SUFFIX_LONG(x) x
|
||||
# define TRIO_PROTO(x) ()
|
||||
# define TRIO_NOARGS
|
||||
# define TRIO_ARGS1(list,a1) list a1;
|
||||
# define TRIO_ARGS2(list,a1,a2) list a1; a2;
|
||||
# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
|
||||
# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
|
||||
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
|
||||
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
|
||||
# define TRIO_ARGS7(list,a1,a2,a3,a4,a5,a6,a7) list a1; a2; a3; a4; a5; a6; a7;
|
||||
# define TRIO_VARGS2(list,a1,a2) list a1; a2
|
||||
# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
|
||||
# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
|
||||
# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
|
||||
# define TRIO_VA_DECL va_dcl
|
||||
# define TRIO_VA_START(x,y) va_start(x)
|
||||
# define TRIO_VA_END(x) va_end(x)
|
||||
#else /* ANSI C */
|
||||
# define TRIO_CONST const
|
||||
# define TRIO_VOLATILE volatile
|
||||
# define TRIO_SIGNED signed
|
||||
typedef long double trio_long_double_t;
|
||||
typedef void * trio_pointer_t;
|
||||
# define TRIO_SUFFIX_LONG(x) x ## L
|
||||
# define TRIO_PROTO(x) x
|
||||
# define TRIO_NOARGS void
|
||||
# define TRIO_ARGS1(list,a1) (a1)
|
||||
# define TRIO_ARGS2(list,a1,a2) (a1,a2)
|
||||
# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
|
||||
# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
|
||||
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
|
||||
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
|
||||
# define TRIO_ARGS7(list,a1,a2,a3,a4,a5,a6,a7) (a1,a2,a3,a4,a5,a6,a7)
|
||||
# define TRIO_VARGS2 TRIO_ARGS2
|
||||
# define TRIO_VARGS3 TRIO_ARGS3
|
||||
# define TRIO_VARGS4 TRIO_ARGS4
|
||||
# define TRIO_VARGS5 TRIO_ARGS5
|
||||
# define TRIO_VA_DECL ...
|
||||
# define TRIO_VA_START(x,y) va_start(x,y)
|
||||
# define TRIO_VA_END(x) va_end(x)
|
||||
#endif
|
||||
|
||||
#if defined(PREDEF_STANDARD_C99) || defined(PREDEF_STANDARD_CXX)
|
||||
# define TRIO_INLINE inline
|
||||
#else
|
||||
# if defined(TRIO_COMPILER_GCC)
|
||||
# define TRIO_INLINE __inline__
|
||||
# endif
|
||||
# if defined(TRIO_COMPILER_MSVC)
|
||||
# define TRIO_INLINE _inline
|
||||
# endif
|
||||
# if defined(TRIO_COMPILER_BCB)
|
||||
# define TRIO_INLINE __inline
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(TRIO_INLINE)
|
||||
# define TRIO_INLINE
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Workarounds
|
||||
*/
|
||||
|
||||
#if defined(TRIO_PLATFORM_VMS)
|
||||
/*
|
||||
* Computations done with constants at compile time can trigger these
|
||||
* even when compiling with IEEE enabled.
|
||||
*/
|
||||
# pragma message disable (UNDERFLOW, FLOATOVERFL)
|
||||
|
||||
# if (__CRTL_VER < 80210001)
|
||||
/*
|
||||
* Although the compiler supports C99 language constructs, the C
|
||||
* run-time library does not contain all C99 functions.
|
||||
*/
|
||||
# if defined(PREDEF_STANDARD_C99)
|
||||
# undef PREDEF_STANDARD_C99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Not all preprocessors supports the LL token.
|
||||
*/
|
||||
#if defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
|
||||
#else
|
||||
# define TRIO_COMPILER_SUPPORTS_LL
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
/*
|
||||
* Cygwin defines the macros for hosted C99, but does not support certain
|
||||
* long double math functions.
|
||||
*/
|
||||
# include <cygwin/version.h>
|
||||
# define TRIO_CYGWIN_VERSION_API CYGWIN_VERSION_API_MAJOR * 1000 + \
|
||||
CYGWIN_VERSION_API_MINOR
|
||||
/*
|
||||
* Please change the version number below when the Cygwin API supports
|
||||
* long double math functions (powl, fmodl, etc.)
|
||||
*/
|
||||
# if TRIO_CYGWIN_VERSION_API < 99999999
|
||||
# define TRIO_NO_FLOORL 1
|
||||
# define TRIO_NO_CEILL 1
|
||||
# define TRIO_NO_POWL 1
|
||||
# define TRIO_NO_FMODL 1
|
||||
# define TRIO_NO_LOG10L 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* TRIO_TRIODEF_H */
|
|
@ -0,0 +1,183 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* $Id: trionan.h,v 1.9 2005/03/27 18:52:45 breese Exp $
|
||||
*
|
||||
* Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
||||
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef TRIO_TRIONAN_H
|
||||
#define TRIO_TRIONAN_H
|
||||
|
||||
#include "triodef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_PUBLIC_NAN)
|
||||
# if !defined(TRIO_PUBLIC)
|
||||
# define TRIO_PUBLIC
|
||||
# endif
|
||||
# define TRIO_PUBLIC_NAN TRIO_PUBLIC
|
||||
#endif
|
||||
|
||||
enum {
|
||||
TRIO_FP_INFINITE,
|
||||
TRIO_FP_NAN,
|
||||
TRIO_FP_NORMAL,
|
||||
TRIO_FP_SUBNORMAL,
|
||||
TRIO_FP_ZERO
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
* Dependencies
|
||||
*/
|
||||
|
||||
#if defined(TRIO_EMBED_NAN)
|
||||
|
||||
/*
|
||||
* The application that trionan is embedded in must define which functions
|
||||
* it uses.
|
||||
*
|
||||
* The following resolves internal dependencies.
|
||||
*/
|
||||
|
||||
# if defined(TRIO_FUNC_ISNAN) \
|
||||
|| defined(TRIO_FUNC_ISINF)
|
||||
# if !defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)
|
||||
# define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_NAN)
|
||||
# if !defined(TRIO_FUNC_PINF)
|
||||
# define TRIO_FUNC_PINF
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_NINF)
|
||||
# if !defined(TRIO_FUNC_PINF)
|
||||
# define TRIO_FUNC_PINF
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* When trionan is not embedded all all functions are defined.
|
||||
*/
|
||||
|
||||
# define TRIO_FUNC_NAN
|
||||
# define TRIO_FUNC_PINF
|
||||
# define TRIO_FUNC_NINF
|
||||
# define TRIO_FUNC_NZERO
|
||||
# define TRIO_FUNC_ISNAN
|
||||
# define TRIO_FUNC_ISINF
|
||||
# define TRIO_FUNC_ISFINITE
|
||||
# define TRIO_FUNC_SIGNBIT
|
||||
# define TRIO_FUNC_FPCLASSIFY
|
||||
# define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT
|
||||
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Functions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Return NaN (Not-a-Number).
|
||||
*/
|
||||
#if defined(TRIO_FUNC_NAN)
|
||||
TRIO_PUBLIC_NAN double
|
||||
trio_nan
|
||||
TRIO_PROTO((void));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return positive infinity.
|
||||
*/
|
||||
#if defined(TRIO_FUNC_PINF)
|
||||
TRIO_PUBLIC_NAN double
|
||||
trio_pinf
|
||||
TRIO_PROTO((void));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return negative infinity.
|
||||
*/
|
||||
#if defined(TRIO_FUNC_NINF)
|
||||
TRIO_PUBLIC_NAN double
|
||||
trio_ninf
|
||||
TRIO_PROTO((void));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return negative zero.
|
||||
*/
|
||||
#if defined(TRIO_FUNC_NZERO)
|
||||
TRIO_PUBLIC_NAN double
|
||||
trio_nzero
|
||||
TRIO_PROTO((TRIO_NOARGS));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If number is a NaN return non-zero, otherwise return zero.
|
||||
*/
|
||||
#if defined(TRIO_FUNC_ISNAN)
|
||||
TRIO_PUBLIC_NAN int
|
||||
trio_isnan
|
||||
TRIO_PROTO((double number));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If number is positive infinity return 1, if number is negative
|
||||
* infinity return -1, otherwise return 0.
|
||||
*/
|
||||
#if defined(TRIO_FUNC_ISINF)
|
||||
TRIO_PUBLIC_NAN int
|
||||
trio_isinf
|
||||
TRIO_PROTO((double number));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If number is finite return non-zero, otherwise return zero.
|
||||
*/
|
||||
#if defined(TRIO_FUNC_ISFINITE)
|
||||
TRIO_PUBLIC_NAN int
|
||||
trio_isfinite
|
||||
TRIO_PROTO((double number));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_SIGNBIT)
|
||||
TRIO_PUBLIC_NAN int
|
||||
trio_signbit
|
||||
TRIO_PROTO((double number));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_FPCLASSIFY)
|
||||
TRIO_PUBLIC_NAN int
|
||||
trio_fpclassify
|
||||
TRIO_PROTO((double number));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)
|
||||
TRIO_PUBLIC_NAN int
|
||||
trio_fpclassify_and_signbit
|
||||
TRIO_PROTO((double number, int *is_negative));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRIO_TRIONAN_H */
|
|
@ -0,0 +1,473 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* $Id: triop.h,v 1.18 2009/07/05 10:14:07 breese Exp $
|
||||
*
|
||||
* Copyright (C) 2000 Bjorn Reese and Daniel Stenberg.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
||||
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
||||
*
|
||||
************************************************************************
|
||||
*
|
||||
* Private functions, types, etc. used for callback functions.
|
||||
*
|
||||
* The ref pointer is an opaque type and should remain as such.
|
||||
* Private data must only be accessible through the getter and
|
||||
* setter functions.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef TRIO_TRIOP_H
|
||||
#define TRIO_TRIOP_H
|
||||
|
||||
#include "triodef.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if defined(TRIO_COMPILER_ANCIENT)
|
||||
# include <varargs.h>
|
||||
#else
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Supported standards
|
||||
*/
|
||||
|
||||
/*
|
||||
* TRIO_C99 (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable C99 format specifier extensions, or
|
||||
* define to 1 to enable them. The format specifiers that are
|
||||
* disabled by this switch are labelled with [C99] in the format
|
||||
* specifier documentation.
|
||||
*/
|
||||
#if !defined(TRIO_C99)
|
||||
# define TRIO_C99 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_BSD (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable BSD format specifier extensions, or
|
||||
* define to 1 to enable them. The format specifiers that are
|
||||
* disabled by this switch are labelled with [BSD] in the format
|
||||
* specifier documentation.
|
||||
*/
|
||||
#if !defined(TRIO_BSD)
|
||||
# define TRIO_BSD 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_GNU (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable GNU format specifier extensions, or
|
||||
* define to 1 to enable them. The format specifiers that are
|
||||
* disabled by this switch are labelled with [GNU] in the format
|
||||
* specifier documentation.
|
||||
*/
|
||||
#if !defined(TRIO_GNU)
|
||||
# define TRIO_GNU 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_MISC (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable miscellaneous format specifier
|
||||
* extensions, or define to 1 to enable them. The format specifiers
|
||||
* that are disabled by this switch are labelled with [MISC] in the
|
||||
* format specifier documentation.
|
||||
*/
|
||||
#if !defined(TRIO_MISC)
|
||||
# define TRIO_MISC 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_UNIX98 (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable UNIX98 format specifier extensions,
|
||||
* or define to 1 to enable them. The format specifiers that are
|
||||
* disabled by this switch are labelled with [UNIX98] in the format
|
||||
* specifier documentation.
|
||||
*/
|
||||
#if !defined(TRIO_UNIX98)
|
||||
# define TRIO_UNIX98 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_MICROSOFT (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable Microsoft Visual C format specifier
|
||||
* extensions, or define to 1 to enable them. The format specifiers
|
||||
* that are disabled by this switch are labelled with [MSVC] in the
|
||||
* format specifier documentation.
|
||||
*/
|
||||
#if !defined(TRIO_MICROSOFT)
|
||||
# define TRIO_MICROSOFT 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_EXTENSION (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable Trio-specific extensions, or define
|
||||
* to 1 to enable them. This has two effects: it controls whether
|
||||
* or not the Trio user-defined formating mechanism
|
||||
* (trio_register() etc) is supported, and it enables or disables
|
||||
* Trio's own format specifier extensions. The format specifiers
|
||||
* that are disabled by this switch are labelled with [TRIO] in
|
||||
* the format specifier documentation.
|
||||
*/
|
||||
#if !defined(TRIO_EXTENSION)
|
||||
# define TRIO_EXTENSION 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_DEPRECATED (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable deprecated functionality, or define
|
||||
* to 1 to enable them.
|
||||
*/
|
||||
#if !defined(TRIO_DEPRECATED)
|
||||
# define TRIO_DEPRECATED 1
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Features
|
||||
*/
|
||||
|
||||
#if defined(TRIO_SNPRINTF_ONLY)
|
||||
# define TRIO_FEATURE_SCANF 0
|
||||
# define TRIO_FEATURE_FILE 0
|
||||
# define TRIO_FEATURE_STDIO 0
|
||||
# define TRIO_FEATURE_FD 0
|
||||
# define TRIO_FEATURE_DYNAMICSTRING 0
|
||||
# define TRIO_FEATURE_CLOSURE 0
|
||||
# define TRIO_FEATURE_STRERR 0
|
||||
# define TRIO_FEATURE_LOCALE 0
|
||||
# define TRIO_EMBED_NAN 1
|
||||
# define TRIO_EMBED_STRING 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_SCANF (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable all the scanf() variants, or define to 1
|
||||
* to enable them.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_SCANF)
|
||||
# define TRIO_FEATURE_SCANF 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_FILE (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable compilation of the trio_fprintf() and
|
||||
* trio_fscanf() family of functions, or define to 1 to enable them.
|
||||
*
|
||||
* This may be useful on an embedded platform with no filesystem.
|
||||
* Note that trio_printf() uses fwrite to write to stdout, so if you
|
||||
* do not have an implementation of fwrite() at all then you must also
|
||||
* define TRIO_FEATURE_STDIO to 0.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_FILE)
|
||||
# define TRIO_FEATURE_FILE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_STDIO (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable compilation of the trio_printf() and
|
||||
* trio_scanf() family of functions, or define to 1 to enable them.
|
||||
*
|
||||
* This may be useful on an embedded platform with no standard I/O.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_STDIO)
|
||||
# define TRIO_FEATURE_STDIO 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_FD (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable compilation of the trio_dprintf() and
|
||||
* trio_dscanf() family of functions, or define to 1 to enable them.
|
||||
*
|
||||
* This may be useful on an embedded platform with no filesystem, or on
|
||||
* a platform that supports file I/O using FILE* but not using raw file
|
||||
* descriptors.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_FD)
|
||||
# define TRIO_FEATURE_FD 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_DYNAMICSTRING (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable compilation of the trio_aprintf()
|
||||
* family of functions, or define to 1 to enable them.
|
||||
*
|
||||
* If you define both this and TRIO_MINIMAL to 0, then Trio will never
|
||||
* call malloc or free.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_DYNAMICSTRING)
|
||||
# define TRIO_FEATURE_DYNAMICSTRING 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_CLOSURE (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable compilation of the trio_cprintf() and
|
||||
* trio_cscanf() family of functions, or define to 1 to enable them.
|
||||
*
|
||||
* These functions are rarely needed. This saves a (small) amount of code.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_CLOSURE)
|
||||
# define TRIO_FEATURE_CLOSURE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_ERRORCODE (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to return -1 from the print and scan function on
|
||||
* error, or define to 1 to return a negative number with debugging
|
||||
* information as part of the return code.
|
||||
*
|
||||
* If enabled, the return code will be a negative number, which encodes
|
||||
* an error code and an error location. These can be decoded with the
|
||||
* TRIO_ERROR_CODE and TRIO_ERROR_POSITION macros.
|
||||
*/
|
||||
#if defined(TRIO_ERRORS)
|
||||
# define TRIO_FEATURE_ERRORCODE TRIO_ERRORS
|
||||
#endif
|
||||
#if !defined(TRIO_FEATURE_ERRORCODE)
|
||||
# define TRIO_FEATURE_ERRORCODE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_STRERR (=0 or =1)
|
||||
*
|
||||
* Define this to 0 if you do not use trio_strerror(), or define to 1 if
|
||||
* you do use it.
|
||||
*
|
||||
* This saves a (small) amount of code.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_STRERR)
|
||||
# define TRIO_FEATURE_STRERR 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_FLOAT (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable all floating-point support, or define
|
||||
* to 1 to enable it.
|
||||
*
|
||||
* This is useful in restricted embedded platforms that do not support
|
||||
* floating-point. Obviously you cannot use floating-point format
|
||||
* specifiers if you define this.
|
||||
*
|
||||
* Do not compile trionan.c if you disable this.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_FLOAT)
|
||||
# define TRIO_FEATURE_FLOAT 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_FEATURE_LOCALE (=0 or =1)
|
||||
*
|
||||
* Define this to 0 to disable customized locale support, or define
|
||||
* to 1 to enable it.
|
||||
*
|
||||
* This saves a (small) amount of code.
|
||||
*/
|
||||
#if !defined(TRIO_FEATURE_LOCALE)
|
||||
# define TRIO_FEATURE_LOCALE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRIO_MINIMAL
|
||||
*
|
||||
* Define this to disable building the public trionan.h and triostr.h.
|
||||
* If you define this, then you must not compile trionan.c and triostr.c
|
||||
* separately.
|
||||
*/
|
||||
#if defined(TRIO_MINIMAL)
|
||||
# if !defined(TRIO_EMBED_NAN)
|
||||
# define TRIO_EMBED_NAN
|
||||
# endif
|
||||
# if !defined(TRIO_EMBED_STRING)
|
||||
# define TRIO_EMBED_STRING
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Does not work yet. Do not enable */
|
||||
#ifndef TRIO_FEATURE_WIDECHAR
|
||||
# define TRIO_FEATURE_WIDECHAR 0
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Mapping standards to internal features
|
||||
*/
|
||||
|
||||
#if !defined(TRIO_FEATURE_HEXFLOAT)
|
||||
# define TRIO_FEATURE_HEXFLOAT (TRIO_C99 && TRIO_FEATURE_FLOAT)
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_LONGDOUBLE)
|
||||
# define TRIO_FEATURE_LONGDOUBLE TRIO_FEATURE_FLOAT
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_ERRNO)
|
||||
# define TRIO_FEATURE_ERRNO TRIO_GNU
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_QUAD)
|
||||
# define TRIO_FEATURE_QUAD (TRIO_BSD || TRIO_GNU)
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_SIZE_T)
|
||||
# define TRIO_FEATURE_SIZE_T TRIO_C99
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_SIZE_T_UPPER)
|
||||
# define TRIO_FEATURE_SIZE_T_UPPER TRIO_GNU
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_PTRDIFF_T)
|
||||
# define TRIO_FEATURE_PTRDIFF_T TRIO_C99
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_INTMAX_T)
|
||||
# define TRIO_FEATURE_INTMAX_T TRIO_C99
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_FIXED_SIZE)
|
||||
# define TRIO_FEATURE_FIXED_SIZE TRIO_MICROSOFT
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_POSITIONAL)
|
||||
# define TRIO_FEATURE_POSITIONAL TRIO_UNIX98
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_USER_DEFINED)
|
||||
# define TRIO_FEATURE_USER_DEFINED TRIO_EXTENSION
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_BINARY)
|
||||
# define TRIO_FEATURE_BINARY TRIO_EXTENSION
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_QUOTE)
|
||||
# define TRIO_FEATURE_QUOTE TRIO_EXTENSION
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_STICKY)
|
||||
# define TRIO_FEATURE_STICKY TRIO_EXTENSION
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_VARSIZE)
|
||||
# define TRIO_FEATURE_VARSIZE TRIO_EXTENSION
|
||||
#endif
|
||||
|
||||
#if !defined(TRIO_FEATURE_ROUNDING)
|
||||
# define TRIO_FEATURE_ROUNDING TRIO_EXTENSION
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Memory handling
|
||||
*/
|
||||
#ifndef TRIO_MALLOC
|
||||
# define TRIO_MALLOC(n) malloc(n)
|
||||
#endif
|
||||
#ifndef TRIO_REALLOC
|
||||
# define TRIO_REALLOC(x,n) realloc((x),(n))
|
||||
#endif
|
||||
#ifndef TRIO_FREE
|
||||
# define TRIO_FREE(x) free(x)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* User-defined specifiers
|
||||
*/
|
||||
|
||||
typedef int (*trio_callback_t) TRIO_PROTO((trio_pointer_t));
|
||||
|
||||
trio_pointer_t trio_register TRIO_PROTO((trio_callback_t callback, const char *name));
|
||||
void trio_unregister TRIO_PROTO((trio_pointer_t handle));
|
||||
|
||||
TRIO_CONST char *trio_get_format TRIO_PROTO((trio_pointer_t ref));
|
||||
/* Mednafen modification to fix a gcc warning */
|
||||
/*TRIO_CONST*/ trio_pointer_t trio_get_argument TRIO_PROTO((trio_pointer_t ref));
|
||||
|
||||
/* Modifiers */
|
||||
int trio_get_width TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_width TRIO_PROTO((trio_pointer_t ref, int width));
|
||||
int trio_get_precision TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_precision TRIO_PROTO((trio_pointer_t ref, int precision));
|
||||
int trio_get_base TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_base TRIO_PROTO((trio_pointer_t ref, int base));
|
||||
int trio_get_padding TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_padding TRIO_PROTO((trio_pointer_t ref, int is_padding));
|
||||
int trio_get_short TRIO_PROTO((trio_pointer_t ref)); /* h */
|
||||
void trio_set_shortshort TRIO_PROTO((trio_pointer_t ref, int is_shortshort));
|
||||
int trio_get_shortshort TRIO_PROTO((trio_pointer_t ref)); /* hh */
|
||||
void trio_set_short TRIO_PROTO((trio_pointer_t ref, int is_short));
|
||||
int trio_get_long TRIO_PROTO((trio_pointer_t ref)); /* l */
|
||||
void trio_set_long TRIO_PROTO((trio_pointer_t ref, int is_long));
|
||||
int trio_get_longlong TRIO_PROTO((trio_pointer_t ref)); /* ll */
|
||||
void trio_set_longlong TRIO_PROTO((trio_pointer_t ref, int is_longlong));
|
||||
int trio_get_longdouble TRIO_PROTO((trio_pointer_t ref)); /* L */
|
||||
void trio_set_longdouble TRIO_PROTO((trio_pointer_t ref, int is_longdouble));
|
||||
int trio_get_alternative TRIO_PROTO((trio_pointer_t ref)); /* # */
|
||||
void trio_set_alternative TRIO_PROTO((trio_pointer_t ref, int is_alternative));
|
||||
int trio_get_alignment TRIO_PROTO((trio_pointer_t ref)); /* - */
|
||||
void trio_set_alignment TRIO_PROTO((trio_pointer_t ref, int is_leftaligned));
|
||||
int trio_get_spacing TRIO_PROTO((trio_pointer_t ref)); /* (space) */
|
||||
void trio_set_spacing TRIO_PROTO((trio_pointer_t ref, int is_space));
|
||||
int trio_get_sign TRIO_PROTO((trio_pointer_t ref)); /* + */
|
||||
void trio_set_sign TRIO_PROTO((trio_pointer_t ref, int is_showsign));
|
||||
#if TRIO_FEATURE_QUOTE
|
||||
int trio_get_quote TRIO_PROTO((trio_pointer_t ref)); /* ' */
|
||||
void trio_set_quote TRIO_PROTO((trio_pointer_t ref, int is_quote));
|
||||
#endif
|
||||
int trio_get_upper TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_upper TRIO_PROTO((trio_pointer_t ref, int is_upper));
|
||||
#if TRIO_FEATURE_INTMAX_T
|
||||
int trio_get_largest TRIO_PROTO((trio_pointer_t ref)); /* j */
|
||||
void trio_set_largest TRIO_PROTO((trio_pointer_t ref, int is_largest));
|
||||
#endif
|
||||
#if TRIO_FEATURE_PTRDIFF_T
|
||||
int trio_get_ptrdiff TRIO_PROTO((trio_pointer_t ref)); /* t */
|
||||
void trio_set_ptrdiff TRIO_PROTO((trio_pointer_t ref, int is_ptrdiff));
|
||||
#endif
|
||||
#if TRIO_FEATURE_SIZE_T
|
||||
int trio_get_size TRIO_PROTO((trio_pointer_t ref)); /* z / Z */
|
||||
void trio_set_size TRIO_PROTO((trio_pointer_t ref, int is_size));
|
||||
#endif
|
||||
|
||||
/* Printing */
|
||||
int trio_print_ref TRIO_PROTO((trio_pointer_t ref, const char *format, ...));
|
||||
int trio_vprint_ref TRIO_PROTO((trio_pointer_t ref, const char *format, va_list args));
|
||||
int trio_printv_ref TRIO_PROTO((trio_pointer_t ref, const char *format, trio_pointer_t *args));
|
||||
|
||||
void trio_print_int TRIO_PROTO((trio_pointer_t ref, int number));
|
||||
void trio_print_uint TRIO_PROTO((trio_pointer_t ref, unsigned int number));
|
||||
/* void trio_print_long TRIO_PROTO((trio_pointer_t ref, long number)); */
|
||||
/* void trio_print_ulong TRIO_PROTO((trio_pointer_t ref, unsigned long number)); */
|
||||
void trio_print_double TRIO_PROTO((trio_pointer_t ref, double number));
|
||||
void trio_print_string TRIO_PROTO((trio_pointer_t ref, TRIO_CONST char *string));
|
||||
void trio_print_pointer TRIO_PROTO((trio_pointer_t ref, trio_pointer_t pointer));
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* TRIO_TRIOP_H */
|
|
@ -0,0 +1,681 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* $Id: triostr.h,v 1.18 2010/01/26 13:02:02 breese Exp $
|
||||
*
|
||||
* Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
||||
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef TRIO_TRIOSTR_H
|
||||
#define TRIO_TRIOSTR_H
|
||||
|
||||
/*
|
||||
* Documentation is located in triostr.c
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "triodef.h"
|
||||
#include "triop.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
TRIO_HASH_NONE = 0,
|
||||
TRIO_HASH_PLAIN,
|
||||
TRIO_HASH_TWOSIGNED
|
||||
};
|
||||
|
||||
#if !defined(TRIO_PUBLIC_STRING)
|
||||
# if !defined(TRIO_PUBLIC)
|
||||
# define TRIO_PUBLIC
|
||||
# endif
|
||||
# define TRIO_PUBLIC_STRING TRIO_PUBLIC
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Dependencies
|
||||
*/
|
||||
|
||||
#if defined(TRIO_EMBED_STRING)
|
||||
|
||||
/*
|
||||
* The application that triostr is embedded in must define which functions
|
||||
* it uses.
|
||||
*
|
||||
* The following resolves internal dependencies.
|
||||
*/
|
||||
|
||||
# if defined(TRIO_FUNC_XSTRING_SET)
|
||||
# if !defined(TRIO_FUNC_DUPLICATE)
|
||||
# define TRIO_FUNC_DUPLICATE
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_DUPLICATE) \
|
||||
|| defined(TRIO_FUNC_DUPLICATE_MAX) \
|
||||
|| defined(TRIO_FUNC_STRING_DUPLICATE) \
|
||||
|| defined(TRIO_FUNC_XSTRING_DUPLICATE)
|
||||
# if !defined(TRIO_FUNC_CREATE)
|
||||
# define TRIO_FUNC_CREATE
|
||||
# endif
|
||||
# if !defined(TRIO_FUNC_COPY_MAX)
|
||||
# define TRIO_FUNC_COPY_MAX
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_STRING_CREATE)
|
||||
# if !defined(TRIO_FUNC_STRING_DESTROY)
|
||||
# define TRIO_FUNC_STRING_DESTROY
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_STRING_DESTROY) \
|
||||
|| defined(TRIO_FUNC_XSTRING_SET)
|
||||
# if !defined(TRIO_FUNC_DESTROY)
|
||||
# define TRIO_FUNC_DESTROY
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_EQUAL_LOCALE) \
|
||||
|| defined(TRIO_FUNC_STRING_EQUAL) \
|
||||
|| defined(TRIO_FUNC_XSTRING_EQUAL)
|
||||
# if !defined(TRIO_FUNC_EQUAL)
|
||||
# define TRIO_FUNC_EQUAL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_EQUAL_CASE) \
|
||||
|| defined(TRIO_FUNC_STRING_EQUAL_CASE) \
|
||||
|| defined(TRIO_FUNC_XSTRING_EQUAL_CASE)
|
||||
# if !defined(TRIO_FUNC_EQUAL_CASE)
|
||||
# define TRIO_FUNC_EQUAL_CASE
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_SUBSTRING_MAX) \
|
||||
|| defined(TRIO_FUNC_STRING_EQUAL_MAX) \
|
||||
|| defined(TRIO_FUNC_XSTRING_EQUAL_MAX)
|
||||
# if !defined(TRIO_FUNC_EQUAL_MAX)
|
||||
# define TRIO_FUNC_EQUAL_MAX
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_TO_DOUBLE) \
|
||||
|| defined(TRIO_FUNC_TO_FLOAT)
|
||||
# if !defined(TRIO_FUNC_TO_LONG_DOUBLE)
|
||||
# define TRIO_FUNC_TO_LONG_DOUBLE
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_STRING_TERMINATE)
|
||||
# if !defined(TRIO_FUNC_XSTRING_APPEND_CHAR)
|
||||
# define TRIO_FUNC_XSTRING_APPEND_CHAR
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(TRIO_FUNC_XSTRING_APPEND_CHAR)
|
||||
# if !defined(TRIO_FUNC_STRING_SIZE)
|
||||
# define TRIO_FUNC_STRING_SIZE
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* When triostr is not embedded all functions are defined.
|
||||
*/
|
||||
|
||||
# define TRIO_FUNC_APPEND
|
||||
# define TRIO_FUNC_APPEND_MAX
|
||||
# define TRIO_FUNC_CONTAINS
|
||||
# define TRIO_FUNC_COPY
|
||||
# define TRIO_FUNC_COPY_MAX
|
||||
# define TRIO_FUNC_CREATE
|
||||
# define TRIO_FUNC_DESTROY
|
||||
# define TRIO_FUNC_DUPLICATE
|
||||
# define TRIO_FUNC_DUPLICATE_MAX
|
||||
# define TRIO_FUNC_EQUAL
|
||||
# define TRIO_FUNC_EQUAL_CASE
|
||||
# define TRIO_FUNC_EQUAL_CASE_MAX
|
||||
# define TRIO_FUNC_EQUAL_LOCALE
|
||||
# define TRIO_FUNC_EQUAL_MAX
|
||||
# define TRIO_FUNC_ERROR
|
||||
# if !defined(TRIO_PLATFORM_WINCE)
|
||||
# define TRIO_FUNC_FORMAT_DATE_MAX
|
||||
# endif
|
||||
# define TRIO_FUNC_HASH
|
||||
# define TRIO_FUNC_INDEX
|
||||
# define TRIO_FUNC_INDEX_LAST
|
||||
# define TRIO_FUNC_LENGTH
|
||||
# define TRIO_FUNC_LENGTH_MAX
|
||||
# define TRIO_FUNC_LOWER
|
||||
# define TRIO_FUNC_MATCH
|
||||
# define TRIO_FUNC_MATCH_CASE
|
||||
# define TRIO_FUNC_SPAN_FUNCTION
|
||||
# define TRIO_FUNC_SUBSTRING
|
||||
# define TRIO_FUNC_SUBSTRING_MAX
|
||||
# define TRIO_FUNC_TO_DOUBLE
|
||||
# define TRIO_FUNC_TO_FLOAT
|
||||
# define TRIO_FUNC_TO_LONG
|
||||
# define TRIO_FUNC_TO_LONG_DOUBLE
|
||||
# define TRIO_FUNC_TO_LOWER
|
||||
# define TRIO_FUNC_TO_UNSIGNED_LONG
|
||||
# define TRIO_FUNC_TO_UPPER
|
||||
# define TRIO_FUNC_TOKENIZE
|
||||
# define TRIO_FUNC_UPPER
|
||||
|
||||
# define TRIO_FUNC_STRING_APPEND
|
||||
# define TRIO_FUNC_STRING_CONTAINS
|
||||
# define TRIO_FUNC_STRING_COPY
|
||||
# define TRIO_FUNC_STRING_CREATE
|
||||
# define TRIO_FUNC_STRING_DESTROY
|
||||
# define TRIO_FUNC_STRING_DUPLICATE
|
||||
# define TRIO_FUNC_STRING_EQUAL
|
||||
# define TRIO_FUNC_STRING_EQUAL_CASE
|
||||
# define TRIO_FUNC_STRING_EQUAL_CASE_MAX
|
||||
# define TRIO_FUNC_STRING_EQUAL_MAX
|
||||
# define TRIO_FUNC_STRING_EXTRACT
|
||||
# if !defined(TRIO_PLATFORM_WINCE)
|
||||
# define TRIO_FUNC_STRING_FORMAT_DATE_MAX
|
||||
# endif
|
||||
# define TRIO_FUNC_STRING_GET
|
||||
# define TRIO_FUNC_STRING_INDEX
|
||||
# define TRIO_FUNC_STRING_INDEX_LAST
|
||||
# define TRIO_FUNC_STRING_LENGTH
|
||||
# define TRIO_FUNC_STRING_LOWER
|
||||
# define TRIO_FUNC_STRING_MATCH
|
||||
# define TRIO_FUNC_STRING_MATCH_CASE
|
||||
# define TRIO_FUNC_STRING_SIZE
|
||||
# define TRIO_FUNC_STRING_SUBSTRING
|
||||
# define TRIO_FUNC_STRING_TERMINATE
|
||||
# define TRIO_FUNC_STRING_UPPER
|
||||
|
||||
# define TRIO_FUNC_XSTRING_APPEND
|
||||
# define TRIO_FUNC_XSTRING_APPEND_CHAR
|
||||
# define TRIO_FUNC_XSTRING_APPEND_MAX
|
||||
# define TRIO_FUNC_XSTRING_CONTAINS
|
||||
# define TRIO_FUNC_XSTRING_COPY
|
||||
# define TRIO_FUNC_XSTRING_DUPLICATE
|
||||
# define TRIO_FUNC_XSTRING_EQUAL
|
||||
# define TRIO_FUNC_XSTRING_EQUAL_CASE
|
||||
# define TRIO_FUNC_XSTRING_EQUAL_CASE_MAX
|
||||
# define TRIO_FUNC_XSTRING_EQUAL_MAX
|
||||
# define TRIO_FUNC_XSTRING_MATCH
|
||||
# define TRIO_FUNC_XSTRING_MATCH_CASE
|
||||
# define TRIO_FUNC_XSTRING_SET
|
||||
# define TRIO_FUNC_XSTRING_SUBSTRING
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* String functions
|
||||
*/
|
||||
|
||||
#if defined(TRIO_FUNC_APPEND)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_append
|
||||
TRIO_PROTO((char *target, TRIO_CONST char *source));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_APPEND_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_append_max
|
||||
TRIO_PROTO((char *target, size_t max, TRIO_CONST char *source));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_CONTAINS)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_contains
|
||||
TRIO_PROTO((TRIO_CONST char *string, TRIO_CONST char *substring));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_COPY)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_copy
|
||||
TRIO_PROTO((char *target, TRIO_CONST char *source));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_COPY_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_copy_max
|
||||
TRIO_PROTO((char *target, size_t max, TRIO_CONST char *source));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_CREATE)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_create
|
||||
TRIO_PROTO((size_t size));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_DESTROY)
|
||||
TRIO_PUBLIC_STRING void
|
||||
trio_destroy
|
||||
TRIO_PROTO((char *string));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_DUPLICATE)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_duplicate
|
||||
TRIO_PROTO((TRIO_CONST char *source));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_DUPLICATE_MAX)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_duplicate_max
|
||||
TRIO_PROTO((TRIO_CONST char *source, size_t max));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_EQUAL)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_equal
|
||||
TRIO_PROTO((TRIO_CONST char *first, TRIO_CONST char *second));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_EQUAL_CASE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_equal_case
|
||||
TRIO_PROTO((TRIO_CONST char *first, TRIO_CONST char *second));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_EQUAL_CASE_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_equal_case_max
|
||||
TRIO_PROTO((TRIO_CONST char *first, size_t max, TRIO_CONST char *second));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_EQUAL_LOCALE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_equal_locale
|
||||
TRIO_PROTO((TRIO_CONST char *first, TRIO_CONST char *second));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_EQUAL_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_equal_max
|
||||
TRIO_PROTO((TRIO_CONST char *first, size_t max, TRIO_CONST char *second));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_ERROR)
|
||||
TRIO_PUBLIC_STRING TRIO_CONST char *
|
||||
trio_error
|
||||
TRIO_PROTO((int));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_FORMAT_DATE_MAX)
|
||||
TRIO_PUBLIC_STRING size_t
|
||||
trio_format_date_max
|
||||
TRIO_PROTO((char *target, size_t max, TRIO_CONST char *format, TRIO_CONST struct tm *datetime));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_HASH)
|
||||
TRIO_PUBLIC_STRING unsigned long
|
||||
trio_hash
|
||||
TRIO_PROTO((TRIO_CONST char *string, int type));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_INDEX)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_index
|
||||
TRIO_PROTO((TRIO_CONST char *string, int character));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_INDEX_LAST)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_index_last
|
||||
TRIO_PROTO((TRIO_CONST char *string, int character));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_LENGTH)
|
||||
TRIO_PUBLIC_STRING size_t
|
||||
trio_length
|
||||
TRIO_PROTO((TRIO_CONST char *string));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_LENGTH_MAX)
|
||||
TRIO_PUBLIC_STRING size_t
|
||||
trio_length_max
|
||||
TRIO_PROTO((TRIO_CONST char *string, size_t max));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_LOWER)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_lower
|
||||
TRIO_PROTO((char *target));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_MATCH)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_match
|
||||
TRIO_PROTO((TRIO_CONST char *string, TRIO_CONST char *pattern));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_MATCH_CASE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_match_case
|
||||
TRIO_PROTO((TRIO_CONST char *string, TRIO_CONST char *pattern));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_SPAN_FUNCTION)
|
||||
TRIO_PUBLIC_STRING size_t
|
||||
trio_span_function
|
||||
TRIO_PROTO((char *target, TRIO_CONST char *source, int (*Function) TRIO_PROTO((int))));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_SUBSTRING)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_substring
|
||||
TRIO_PROTO((TRIO_CONST char *string, TRIO_CONST char *substring));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_SUBSTRING_MAX)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_substring_max
|
||||
TRIO_PROTO((TRIO_CONST char *string, size_t max, TRIO_CONST char *substring));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TO_DOUBLE)
|
||||
TRIO_PUBLIC_STRING double
|
||||
trio_to_double
|
||||
TRIO_PROTO((TRIO_CONST char *source, char **endp));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TO_FLOAT)
|
||||
TRIO_PUBLIC_STRING float
|
||||
trio_to_float
|
||||
TRIO_PROTO((TRIO_CONST char *source, char **endp));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TO_LONG)
|
||||
TRIO_PUBLIC_STRING long
|
||||
trio_to_long
|
||||
TRIO_PROTO((TRIO_CONST char *source, char **endp, int base));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TO_LOWER)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_to_lower
|
||||
TRIO_PROTO((int source));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TO_LONG_DOUBLE)
|
||||
TRIO_PUBLIC_STRING trio_long_double_t
|
||||
trio_to_long_double
|
||||
TRIO_PROTO((TRIO_CONST char *source, char **endp));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TO_UNSIGNED_LONG)
|
||||
TRIO_PUBLIC_STRING unsigned long
|
||||
trio_to_unsigned_long
|
||||
TRIO_PROTO((TRIO_CONST char *source, char **endp, int base));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TO_UPPER)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_to_upper
|
||||
TRIO_PROTO((int source));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_TOKENIZE)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_tokenize
|
||||
TRIO_PROTO((char *string, TRIO_CONST char *delimiters));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_UPPER)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_upper
|
||||
TRIO_PROTO((char *target));
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Dynamic string functions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Opaque type for dynamic strings
|
||||
*/
|
||||
|
||||
typedef struct _trio_string_t trio_string_t;
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_APPEND)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_append
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_CONTAINS)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_contains
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_COPY)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_copy
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_CREATE)
|
||||
TRIO_PUBLIC_STRING trio_string_t *
|
||||
trio_string_create
|
||||
TRIO_PROTO((int initial_size));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_DESTROY)
|
||||
TRIO_PUBLIC_STRING void
|
||||
trio_string_destroy
|
||||
TRIO_PROTO((trio_string_t *self));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_DUPLICATE)
|
||||
TRIO_PUBLIC_STRING trio_string_t *
|
||||
trio_string_duplicate
|
||||
TRIO_PROTO((trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_EQUAL)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_equal
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_EQUAL_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_equal_max
|
||||
TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_EQUAL_CASE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_equal_case
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_EQUAL_CASE_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_equal_case_max
|
||||
TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_EXTRACT)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_string_extract
|
||||
TRIO_PROTO((trio_string_t *self));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_FORMAT_DATE_MAX)
|
||||
TRIO_PUBLIC_STRING size_t
|
||||
trio_string_format_date_max
|
||||
TRIO_PROTO((trio_string_t *self, size_t max, TRIO_CONST char *format, TRIO_CONST struct tm *datetime));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_GET)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_string_get
|
||||
TRIO_PROTO((trio_string_t *self, int offset));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_INDEX)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_string_index
|
||||
TRIO_PROTO((trio_string_t *self, int character));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_INDEX_LAST)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_string_index_last
|
||||
TRIO_PROTO((trio_string_t *self, int character));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_LENGTH)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_length
|
||||
TRIO_PROTO((trio_string_t *self));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_LOWER)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_lower
|
||||
TRIO_PROTO((trio_string_t *self));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_MATCH)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_match
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_MATCH_CASE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_match_case
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_SIZE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_size
|
||||
TRIO_PROTO((trio_string_t *self));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_SUBSTRING)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_string_substring
|
||||
TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_TERMINATE)
|
||||
TRIO_PUBLIC_STRING void
|
||||
trio_string_terminate
|
||||
TRIO_PROTO((trio_string_t *self));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_STRING_UPPER)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_string_upper
|
||||
TRIO_PROTO((trio_string_t *self));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_APPEND)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_append
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_APPEND_CHAR)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_append_char
|
||||
TRIO_PROTO((trio_string_t *self, char character));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_APPEND_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_append_max
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other, size_t max));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_CONTAINS)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_contains
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_COPY)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_copy
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_DUPLICATE)
|
||||
TRIO_PUBLIC_STRING trio_string_t *
|
||||
trio_xstring_duplicate
|
||||
TRIO_PROTO((TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_EQUAL)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_equal
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_EQUAL_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_equal_max
|
||||
TRIO_PROTO((trio_string_t *self, size_t max, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_EQUAL_CASE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_equal_case
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_EQUAL_CASE_MAX)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_equal_case_max
|
||||
TRIO_PROTO((trio_string_t *self, size_t max, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_MATCH)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_match
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_MATCH_CASE)
|
||||
TRIO_PUBLIC_STRING int
|
||||
trio_xstring_match_case
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_SET)
|
||||
TRIO_PUBLIC_STRING void
|
||||
trio_xstring_set
|
||||
TRIO_PROTO((trio_string_t *self, char *buffer));
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_FUNC_XSTRING_SUBSTRING)
|
||||
TRIO_PUBLIC_STRING char *
|
||||
trio_xstring_substring
|
||||
TRIO_PROTO((trio_string_t *self, TRIO_CONST char *other));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRIO_TRIOSTR_H */
|
|
@ -0,0 +1,4 @@
|
|||
2010-06-04 GNU <bug-gnu-gettext@gnu.org>
|
||||
|
||||
* Version 0.18.1 released.
|
||||
|
|
@ -0,0 +1,659 @@
|
|||
# Makefile for directory with message catalog handling library of GNU gettext
|
||||
# Copyright (C) 1995-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ..
|
||||
|
||||
# The VPATH variables allows builds with $builddir != $srcdir, assuming a
|
||||
# 'make' program that supports VPATH (such as GNU make). This line is removed
|
||||
# by autoconf automatically when "$(srcdir)" = ".".
|
||||
# In this directory, the VPATH handling is particular:
|
||||
# 1. If INTL_LIBTOOL_SUFFIX_PREFIX is 'l' (indicating a build with libtool),
|
||||
# the .c -> .lo rules carefully use $(srcdir), so that VPATH can be omitted.
|
||||
# 2. If PACKAGE = gettext-tools, VPATH _must_ be omitted, because otherwise
|
||||
# 'make' does the wrong thing if GNU gettext was configured with
|
||||
# "./configure --srcdir=`pwd`", namely it gets confused by the .lo and .la
|
||||
# files it finds in srcdir = ../../gettext-runtime/intl.
|
||||
VPATH = $(srcdir)
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
transform = @program_transform_name@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
datarootdir = @datarootdir@
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
gettextsrcdir = $(datadir)/gettext/intl
|
||||
aliaspath = $(localedir)
|
||||
subdir = intl
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# We use $(mkdir_p).
|
||||
# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
|
||||
# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
|
||||
# @install_sh@ does not start with $(SHELL), so we add it.
|
||||
# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
|
||||
# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
|
||||
# versions, $(mkinstalldirs) and $(install_sh) are unused.
|
||||
mkinstalldirs = $(SHELL) @install_sh@ -d
|
||||
install_sh = $(SHELL) @install_sh@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
mkdir_p = @mkdir_p@
|
||||
|
||||
l = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
|
||||
AR = ar
|
||||
CC = @CC@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
RANLIB = @RANLIB@
|
||||
YACC = @INTLBISON@ -y -d
|
||||
YFLAGS = --name-prefix=__gettext
|
||||
# Windows resource compiler (windres). Used when libtool is not used.
|
||||
WINDRES = @WINDRES@
|
||||
# Windows resource compiler (windres). Used via libtool.
|
||||
RC = @RC@
|
||||
|
||||
# Support for silent-rules.
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_@INTL_DEFAULT_VERBOSITY@)
|
||||
am__v_at_0 = @
|
||||
AM_V_AR = $(am__v_AR_$(V))
|
||||
am__v_AR_ = $(am__v_AR_@INTL_DEFAULT_VERBOSITY@)
|
||||
am__v_AR_0 = @echo " AR " $@;
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_@INTL_DEFAULT_VERBOSITY@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_@INTL_DEFAULT_VERBOSITY@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
AM_V_YACC = $(am__v_YACC_$(V))
|
||||
am__v_YACC_ = $(am__v_YACC_@INTL_DEFAULT_VERBOSITY@)
|
||||
am__v_YACC_0 = @echo " YACC " $@;
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_@INTL_DEFAULT_VERBOSITY@)
|
||||
am__v_lt_0 = --silent
|
||||
|
||||
# -DBUILDING_LIBINTL: Change expansion of LIBINTL_DLL_EXPORTED macro.
|
||||
# -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro.
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
|
||||
-DLIBDIR=\"$(libdir)\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL \
|
||||
-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
|
||||
-Dset_relocation_prefix=libintl_set_relocation_prefix \
|
||||
-Drelocate=libintl_relocate \
|
||||
-DDEPENDS_ON_LIBICONV=1 @DEFS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@ @CFLAG_VISIBILITY@
|
||||
LDFLAGS = @LDFLAGS@ $(LDFLAGS_@WOE32DLL@)
|
||||
LDFLAGS_yes = -Wl,--export-all-symbols
|
||||
LDFLAGS_no =
|
||||
LIBS = @LIBS@
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
HEADERS = \
|
||||
gmo.h \
|
||||
gettextP.h \
|
||||
hash-string.h \
|
||||
loadinfo.h \
|
||||
plural-exp.h \
|
||||
eval-plural.h \
|
||||
localcharset.h \
|
||||
lock.h \
|
||||
relocatable.h \
|
||||
tsearch.h tsearch.c \
|
||||
xsize.h \
|
||||
printf-args.h printf-args.c \
|
||||
printf-parse.h wprintf-parse.h printf-parse.c \
|
||||
vasnprintf.h vasnwprintf.h vasnprintf.c \
|
||||
os2compat.h \
|
||||
libgnuintl.h.in
|
||||
SOURCES = \
|
||||
bindtextdom.c \
|
||||
dcgettext.c \
|
||||
dgettext.c \
|
||||
gettext.c \
|
||||
finddomain.c \
|
||||
hash-string.c \
|
||||
loadmsgcat.c \
|
||||
localealias.c \
|
||||
textdomain.c \
|
||||
l10nflist.c \
|
||||
explodename.c \
|
||||
dcigettext.c \
|
||||
dcngettext.c \
|
||||
dngettext.c \
|
||||
ngettext.c \
|
||||
plural.y \
|
||||
plural-exp.c \
|
||||
localcharset.c \
|
||||
threadlib.c \
|
||||
lock.c \
|
||||
relocatable.c \
|
||||
langprefs.c \
|
||||
localename.c \
|
||||
log.c \
|
||||
printf.c \
|
||||
setlocale.c \
|
||||
version.c \
|
||||
osdep.c \
|
||||
os2compat.c \
|
||||
intl-exports.c \
|
||||
intl-compat.c
|
||||
OBJECTS = \
|
||||
bindtextdom.$lo \
|
||||
dcgettext.$lo \
|
||||
dgettext.$lo \
|
||||
gettext.$lo \
|
||||
finddomain.$lo \
|
||||
hash-string.$lo \
|
||||
loadmsgcat.$lo \
|
||||
localealias.$lo \
|
||||
textdomain.$lo \
|
||||
l10nflist.$lo \
|
||||
explodename.$lo \
|
||||
dcigettext.$lo \
|
||||
dcngettext.$lo \
|
||||
dngettext.$lo \
|
||||
ngettext.$lo \
|
||||
plural.$lo \
|
||||
plural-exp.$lo \
|
||||
localcharset.$lo \
|
||||
threadlib.$lo \
|
||||
lock.$lo \
|
||||
relocatable.$lo \
|
||||
langprefs.$lo \
|
||||
localename.$lo \
|
||||
log.$lo \
|
||||
printf.$lo \
|
||||
setlocale.$lo \
|
||||
version.$lo \
|
||||
osdep.$lo \
|
||||
intl-compat.$lo
|
||||
OBJECTS_RES_yes = libintl.res.$lo
|
||||
OBJECTS_RES_no =
|
||||
DISTFILES.common = Makefile.in \
|
||||
config.charset locale.alias ref-add.sin ref-del.sin export.h libintl.rc \
|
||||
$(HEADERS) $(SOURCES)
|
||||
DISTFILES.generated = plural.c
|
||||
DISTFILES.normal = VERSION
|
||||
DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc README.woe32
|
||||
DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \
|
||||
COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h \
|
||||
libgnuintl.h_vms Makefile.vms libgnuintl.h.msvc-static \
|
||||
libgnuintl.h.msvc-shared Makefile.msvc
|
||||
|
||||
all: all-@USE_INCLUDED_LIBINTL@
|
||||
all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
|
||||
all-no: all-no-@BUILD_INCLUDED_LIBINTL@
|
||||
all-no-yes: libgnuintl.$la
|
||||
all-no-no:
|
||||
|
||||
libintl.a libgnuintl.a: $(OBJECTS)
|
||||
$(AM_V_at)rm -f $@
|
||||
$(AM_V_AR)$(AR) cru $@ $(OBJECTS)
|
||||
$(AM_V_at)$(RANLIB) $@
|
||||
|
||||
libintl.la libgnuintl.la: $(OBJECTS) $(OBJECTS_RES_@WOE32@)
|
||||
$(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=link \
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(OBJECTS) @LTLIBICONV@ @INTL_MACOSX_LIBS@ $(LIBS) @LTLIBTHREAD@ @LTLIBC@ \
|
||||
$(OBJECTS_RES_@WOE32@) \
|
||||
-version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
|
||||
-rpath $(libdir) \
|
||||
-no-undefined
|
||||
|
||||
# Libtool's library version information for libintl.
|
||||
# Before making a gettext release, the gettext maintainer must change this
|
||||
# according to the libtool documentation, section "Library interface versions".
|
||||
# Maintainers of other packages that include the intl directory must *not*
|
||||
# change these values.
|
||||
LTV_CURRENT=9
|
||||
LTV_REVISION=1
|
||||
LTV_AGE=1
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .y .o .lo .sin .sed
|
||||
|
||||
.c.o:
|
||||
$(AM_V_CC)$(COMPILE) $<
|
||||
|
||||
.y.c:
|
||||
$(AM_V_YACC)$(YACC) $(YFLAGS) --output $@ $<
|
||||
$(AM_V_at)rm -f $*.h
|
||||
|
||||
bindtextdom.lo: $(srcdir)/bindtextdom.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/bindtextdom.c
|
||||
dcgettext.lo: $(srcdir)/dcgettext.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/dcgettext.c
|
||||
dgettext.lo: $(srcdir)/dgettext.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/dgettext.c
|
||||
gettext.lo: $(srcdir)/gettext.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/gettext.c
|
||||
finddomain.lo: $(srcdir)/finddomain.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/finddomain.c
|
||||
hash-string.lo: $(srcdir)/hash-string.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/hash-string.c
|
||||
loadmsgcat.lo: $(srcdir)/loadmsgcat.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c
|
||||
localealias.lo: $(srcdir)/localealias.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/localealias.c
|
||||
textdomain.lo: $(srcdir)/textdomain.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/textdomain.c
|
||||
l10nflist.lo: $(srcdir)/l10nflist.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/l10nflist.c
|
||||
explodename.lo: $(srcdir)/explodename.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/explodename.c
|
||||
dcigettext.lo: $(srcdir)/dcigettext.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/dcigettext.c
|
||||
dcngettext.lo: $(srcdir)/dcngettext.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/dcngettext.c
|
||||
dngettext.lo: $(srcdir)/dngettext.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/dngettext.c
|
||||
ngettext.lo: $(srcdir)/ngettext.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/ngettext.c
|
||||
plural.lo: $(srcdir)/plural.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/plural.c
|
||||
plural-exp.lo: $(srcdir)/plural-exp.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
|
||||
localcharset.lo: $(srcdir)/localcharset.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/localcharset.c
|
||||
threadlib.lo: $(srcdir)/threadlib.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/threadlib.c
|
||||
lock.lo: $(srcdir)/lock.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/lock.c
|
||||
relocatable.lo: $(srcdir)/relocatable.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/relocatable.c
|
||||
langprefs.lo: $(srcdir)/langprefs.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/langprefs.c
|
||||
localename.lo: $(srcdir)/localename.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/localename.c
|
||||
log.lo: $(srcdir)/log.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/log.c
|
||||
printf.lo: $(srcdir)/printf.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/printf.c
|
||||
setlocale.lo: $(srcdir)/setlocale.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/setlocale.c
|
||||
version.lo: $(srcdir)/version.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/version.c
|
||||
osdep.lo: $(srcdir)/osdep.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/osdep.c
|
||||
intl-compat.lo: $(srcdir)/intl-compat.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/intl-compat.c
|
||||
|
||||
# This rule is executed only on Woe32 systems.
|
||||
# The following sed expressions come from the windres-options script. They are
|
||||
# inlined here, so that they can be written in a Makefile without requiring a
|
||||
# temporary file. They must contain literal newlines rather than semicolons,
|
||||
# so that they work with the sed-3.02 that is shipped with MSYS.
|
||||
libintl.res.o: $(srcdir)/libintl.rc
|
||||
nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
|
||||
sed_extract_major='/^[0-9]/{'$${nl}'s/^\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \
|
||||
sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \
|
||||
sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \
|
||||
$(WINDRES) \
|
||||
"-DPACKAGE_VERSION_STRING=\\\"$(VERSION)\\\"" \
|
||||
"-DPACKAGE_VERSION_MAJOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_major"` \
|
||||
"-DPACKAGE_VERSION_MINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_minor"` \
|
||||
"-DPACKAGE_VERSION_SUBMINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_subminor"` \
|
||||
-i $(srcdir)/libintl.rc -o libintl.res.o --output-format=coff
|
||||
libintl.res.lo: $(srcdir)/libintl.rc
|
||||
nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
|
||||
sed_extract_major='/^[0-9]/{'$${nl}'s/^\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \
|
||||
sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \
|
||||
sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \
|
||||
$(LIBTOOL) --mode=compile --tag=RC $(RC) \
|
||||
"-DPACKAGE_VERSION_STRING=\\\"$(VERSION)\\\"" \
|
||||
"-DPACKAGE_VERSION_MAJOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_major"` \
|
||||
"-DPACKAGE_VERSION_MINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_minor"` \
|
||||
"-DPACKAGE_VERSION_SUBMINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_subminor"` \
|
||||
-i $(srcdir)/libintl.rc -o libintl.res.lo --output-format=coff
|
||||
|
||||
ref-add.sed: $(srcdir)/ref-add.sin
|
||||
sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-ref-add.sed
|
||||
mv t-ref-add.sed ref-add.sed
|
||||
ref-del.sed: $(srcdir)/ref-del.sin
|
||||
sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-ref-del.sed
|
||||
mv t-ref-del.sed ref-del.sed
|
||||
|
||||
INCLUDES = -I. -I$(srcdir) -I../include
|
||||
|
||||
libgnuintl.h: $(srcdir)/libgnuintl.h.in
|
||||
sed -e '/IN_LIBGLOCALE/d' \
|
||||
-e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
|
||||
-e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
|
||||
-e 's,@''HAVE_NEWLOCALE''@,@HAVE_NEWLOCALE@,g' \
|
||||
-e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
|
||||
-e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
|
||||
< $(srcdir)/libgnuintl.h.in \
|
||||
| if test '@WOE32DLL@' = yes; then \
|
||||
sed -e 's/extern \([^()]*\);/extern __declspec (dllimport) \1;/'; \
|
||||
else \
|
||||
cat; \
|
||||
fi \
|
||||
| sed -e 's/extern \([^"]\)/extern LIBINTL_DLL_EXPORTED \1/' \
|
||||
-e "/#define _LIBINTL_H/r $(srcdir)/export.h" \
|
||||
| sed -e 's,@''HAVE_VISIBILITY''@,@HAVE_VISIBILITY@,g' \
|
||||
> libgnuintl.h
|
||||
|
||||
libintl.h: $(srcdir)/libgnuintl.h.in
|
||||
sed -e '/IN_LIBGLOCALE/d' \
|
||||
-e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
|
||||
-e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
|
||||
-e 's,@''HAVE_NEWLOCALE''@,@HAVE_NEWLOCALE@,g' \
|
||||
-e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
|
||||
-e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
|
||||
< $(srcdir)/libgnuintl.h.in > libintl.h
|
||||
|
||||
charset.alias: $(srcdir)/config.charset
|
||||
$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
check: all
|
||||
|
||||
# We must not install the libintl.h/libintl.a files if we are on a
|
||||
# system which has the GNU gettext() function in its C library or in a
|
||||
# separate library.
|
||||
# If you want to use the one which comes with this version of the
|
||||
# package, you have to use `configure --with-included-gettext'.
|
||||
install: install-exec install-data
|
||||
install-exec: all
|
||||
if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
|
||||
&& test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
$(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
|
||||
$(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
|
||||
$(LIBTOOL) --mode=install \
|
||||
$(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
|
||||
if test "@RELOCATABLE@" = yes; then \
|
||||
dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl.la | sed -e "s,^',," -e "s,'\$$,,"`; \
|
||||
if test -n "$$dependencies"; then \
|
||||
rm -f $(DESTDIR)$(libdir)/libintl.la; \
|
||||
fi; \
|
||||
fi; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test "$(PACKAGE)" = "gettext-tools" \
|
||||
&& test '@USE_INCLUDED_LIBINTL@' = no \
|
||||
&& test @GLIBC2@ != no; then \
|
||||
$(mkdir_p) $(DESTDIR)$(libdir); \
|
||||
$(LIBTOOL) --mode=install \
|
||||
$(INSTALL_DATA) libgnuintl.$la $(DESTDIR)$(libdir)/libgnuintl.$la; \
|
||||
rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
|
||||
$(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so; \
|
||||
$(LIBTOOL) --mode=uninstall \
|
||||
rm -f $(DESTDIR)$(libdir)/libgnuintl.$la; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
if test @GLIBC21@ = no; then \
|
||||
case '@host_os@' in \
|
||||
darwin[56]*) \
|
||||
need_charset_alias=true ;; \
|
||||
darwin* | cygwin* | mingw* | pw32* | cegcc*) \
|
||||
need_charset_alias=false ;; \
|
||||
*) \
|
||||
need_charset_alias=true ;; \
|
||||
esac; \
|
||||
else \
|
||||
need_charset_alias=false; \
|
||||
fi; \
|
||||
if $$need_charset_alias; then \
|
||||
$(mkdir_p) $(DESTDIR)$(libdir); \
|
||||
fi; \
|
||||
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||
orig=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
else \
|
||||
if $$need_charset_alias; then \
|
||||
orig=charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(mkdir_p) $(DESTDIR)$(localedir); \
|
||||
test -f $(DESTDIR)$(localedir)/locale.alias \
|
||||
&& orig=$(DESTDIR)$(localedir)/locale.alias \
|
||||
|| orig=$(srcdir)/locale.alias; \
|
||||
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
install-data: all
|
||||
if test "$(PACKAGE)" = "gettext-tools"; then \
|
||||
$(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
|
||||
$(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
|
||||
$(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
|
||||
dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \
|
||||
for file in $$dists; do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
|
||||
dists="$(DISTFILES.generated)"; \
|
||||
for file in $$dists; do \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
$(INSTALL_DATA) $$dir/$$file \
|
||||
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
dists="$(DISTFILES.obsolete)"; \
|
||||
for file in $$dists; do \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
install-strip: install
|
||||
|
||||
install-dvi install-html install-info install-ps install-pdf:
|
||||
|
||||
installdirs:
|
||||
if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
|
||||
&& test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
$(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test "$(PACKAGE)" = "gettext-tools" \
|
||||
&& test '@USE_INCLUDED_LIBINTL@' = no \
|
||||
&& test @GLIBC2@ != no; then \
|
||||
$(mkdir_p) $(DESTDIR)$(libdir); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
if test @GLIBC21@ = no; then \
|
||||
case '@host_os@' in \
|
||||
darwin[56]*) \
|
||||
need_charset_alias=true ;; \
|
||||
darwin* | cygwin* | mingw* | pw32* | cegcc*) \
|
||||
need_charset_alias=false ;; \
|
||||
*) \
|
||||
need_charset_alias=true ;; \
|
||||
esac; \
|
||||
else \
|
||||
need_charset_alias=false; \
|
||||
fi; \
|
||||
if $$need_charset_alias; then \
|
||||
$(mkdir_p) $(DESTDIR)$(libdir); \
|
||||
fi; \
|
||||
$(mkdir_p) $(DESTDIR)$(localedir); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test "$(PACKAGE)" = "gettext-tools"; then \
|
||||
$(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
# Define this as empty until I found a useful application.
|
||||
installcheck:
|
||||
|
||||
uninstall:
|
||||
if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
|
||||
&& test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
rm -f $(DESTDIR)$(includedir)/libintl.h; \
|
||||
$(LIBTOOL) --mode=uninstall \
|
||||
rm -f $(DESTDIR)$(libdir)/libintl.$la; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test "$(PACKAGE)" = "gettext-tools" \
|
||||
&& test '@USE_INCLUDED_LIBINTL@' = no \
|
||||
&& test @GLIBC2@ != no; then \
|
||||
rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
sed -f ref-del.sed $$dest > $$temp; \
|
||||
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||
rm -f $$dest; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
fi; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
if test -f $(DESTDIR)$(localedir)/locale.alias; then \
|
||||
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||
sed -f ref-del.sed $$dest > $$temp; \
|
||||
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||
rm -f $$dest; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
fi; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test "$(PACKAGE)" = "gettext-tools"; then \
|
||||
for file in VERSION ChangeLog COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
info dvi ps pdf html:
|
||||
|
||||
$(OBJECTS): ../include/config.h libgnuintl.h
|
||||
bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo setlocale.$lo textdomain.$lo: $(srcdir)/gettextP.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h
|
||||
localename.$lo: $(srcdir)/gettextP.h
|
||||
hash-string.$lo dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
|
||||
explodename.$lo l10nflist.$lo: $(srcdir)/loadinfo.h
|
||||
dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h
|
||||
dcigettext.$lo: $(srcdir)/eval-plural.h
|
||||
localcharset.$lo: $(srcdir)/localcharset.h
|
||||
bindtextdom.$lo dcigettext.$lo finddomain.$lo loadmsgcat.$lo localealias.$lo lock.$lo log.$lo: $(srcdir)/lock.h
|
||||
localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h
|
||||
printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c
|
||||
|
||||
# A bison-2.1 generated plural.c includes <libintl.h> if ENABLE_NLS.
|
||||
PLURAL_DEPS_yes = libintl.h
|
||||
PLURAL_DEPS_no =
|
||||
plural.$lo: $(PLURAL_DEPS_@USE_INCLUDED_LIBINTL@)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES)
|
||||
here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
|
||||
|
||||
ctags: CTAGS
|
||||
|
||||
CTAGS: $(HEADERS) $(SOURCES)
|
||||
here=`pwd`; cd $(srcdir) && ctags -o $$here/CTAGS $(HEADERS) $(SOURCES)
|
||||
|
||||
id: ID
|
||||
|
||||
ID: $(HEADERS) $(SOURCES)
|
||||
here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
|
||||
|
||||
|
||||
mostlyclean:
|
||||
rm -f *.a *.la *.o *.obj *.lo core core.*
|
||||
rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed
|
||||
rm -f -r .libs _libs
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile ID TAGS
|
||||
if test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; then \
|
||||
rm -f ChangeLog.inst $(DISTFILES.normal); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
|
||||
# GNU gettext needs not contain the file `VERSION' but contains some
|
||||
# other files which should not be distributed in other packages.
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: Makefile
|
||||
if test "$(PACKAGE)" = "gettext-tools"; then \
|
||||
: ; \
|
||||
else \
|
||||
if test "$(PACKAGE)" = "gettext-runtime"; then \
|
||||
additional="$(DISTFILES.gettext)"; \
|
||||
else \
|
||||
additional="$(DISTFILES.normal)"; \
|
||||
fi; \
|
||||
$(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
|
||||
for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
cp -p $$dir/$$file $(distdir) || test $$file = Makefile.in || exit 1; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status
|
||||
# This would be more efficient, but doesn't work any more with autoconf-2.57,
|
||||
# when AC_CONFIG_FILES([intl/Makefile:somedir/Makefile.in]) is used.
|
||||
# cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1 @@
|
|||
GNU gettext library from gettext-0.18.1
|
|
@ -0,0 +1,340 @@
|
|||
/* Implementation of the bindtextdomain(3) function
|
||||
Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* Handle multi-threaded applications. */
|
||||
#ifdef _LIBC
|
||||
# include <bits/libc-lock.h>
|
||||
# define gl_rwlock_define __libc_rwlock_define
|
||||
# define gl_rwlock_wrlock __libc_rwlock_wrlock
|
||||
# define gl_rwlock_unlock __libc_rwlock_unlock
|
||||
#else
|
||||
# include "lock.h"
|
||||
#endif
|
||||
|
||||
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
|
||||
#ifndef offsetof
|
||||
# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Lock variable to protect the global data in the gettext implementation. */
|
||||
gl_rwlock_define (extern, _nl_state_lock attribute_hidden)
|
||||
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define BINDTEXTDOMAIN __bindtextdomain
|
||||
# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset
|
||||
# ifndef strdup
|
||||
# define strdup(str) __strdup (str)
|
||||
# endif
|
||||
#else
|
||||
# define BINDTEXTDOMAIN libintl_bindtextdomain
|
||||
# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
|
||||
#endif
|
||||
|
||||
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
|
||||
to be used for the DOMAINNAME message catalog.
|
||||
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
|
||||
modified, only the current value is returned.
|
||||
If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
|
||||
modified nor returned. */
|
||||
static void
|
||||
set_binding_values (const char *domainname,
|
||||
const char **dirnamep, const char **codesetp)
|
||||
{
|
||||
struct binding *binding;
|
||||
int modified;
|
||||
|
||||
/* Some sanity checks. */
|
||||
if (domainname == NULL || domainname[0] == '\0')
|
||||
{
|
||||
if (dirnamep)
|
||||
*dirnamep = NULL;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
gl_rwlock_wrlock (_nl_state_lock);
|
||||
|
||||
modified = 0;
|
||||
|
||||
for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
|
||||
{
|
||||
int compare = strcmp (domainname, binding->domainname);
|
||||
if (compare == 0)
|
||||
/* We found it! */
|
||||
break;
|
||||
if (compare < 0)
|
||||
{
|
||||
/* It is not in the list. */
|
||||
binding = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (binding != NULL)
|
||||
{
|
||||
if (dirnamep)
|
||||
{
|
||||
const char *dirname = *dirnamep;
|
||||
|
||||
if (dirname == NULL)
|
||||
/* The current binding has be to returned. */
|
||||
*dirnamep = binding->dirname;
|
||||
else
|
||||
{
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
char *result = binding->dirname;
|
||||
if (strcmp (dirname, result) != 0)
|
||||
{
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
result = (char *) _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (dirname);
|
||||
#else
|
||||
size_t len = strlen (dirname) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
memcpy (result, dirname, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
{
|
||||
if (binding->dirname != _nl_default_dirname)
|
||||
free (binding->dirname);
|
||||
|
||||
binding->dirname = result;
|
||||
modified = 1;
|
||||
}
|
||||
}
|
||||
*dirnamep = result;
|
||||
}
|
||||
}
|
||||
|
||||
if (codesetp)
|
||||
{
|
||||
const char *codeset = *codesetp;
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The current binding has be to returned. */
|
||||
*codesetp = binding->codeset;
|
||||
else
|
||||
{
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
char *result = binding->codeset;
|
||||
if (result == NULL || strcmp (codeset, result) != 0)
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (codeset);
|
||||
#else
|
||||
size_t len = strlen (codeset) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
memcpy (result, codeset, len);
|
||||
#endif
|
||||
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
{
|
||||
free (binding->codeset);
|
||||
|
||||
binding->codeset = result;
|
||||
modified = 1;
|
||||
}
|
||||
}
|
||||
*codesetp = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((dirnamep == NULL || *dirnamep == NULL)
|
||||
&& (codesetp == NULL || *codesetp == NULL))
|
||||
{
|
||||
/* Simply return the default values. */
|
||||
if (dirnamep)
|
||||
*dirnamep = _nl_default_dirname;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have to create a new binding. */
|
||||
size_t len = strlen (domainname) + 1;
|
||||
struct binding *new_binding =
|
||||
(struct binding *) malloc (offsetof (struct binding, domainname) + len);
|
||||
|
||||
if (__builtin_expect (new_binding == NULL, 0))
|
||||
goto failed;
|
||||
|
||||
memcpy (new_binding->domainname, domainname, len);
|
||||
|
||||
if (dirnamep)
|
||||
{
|
||||
const char *dirname = *dirnamep;
|
||||
|
||||
if (dirname == NULL)
|
||||
/* The default value. */
|
||||
dirname = _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
dirname = _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
char *result;
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (dirname);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_dirname;
|
||||
#else
|
||||
size_t len = strlen (dirname) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_dirname;
|
||||
memcpy (result, dirname, len);
|
||||
#endif
|
||||
dirname = result;
|
||||
}
|
||||
}
|
||||
*dirnamep = dirname;
|
||||
new_binding->dirname = (char *) dirname;
|
||||
}
|
||||
else
|
||||
/* The default value. */
|
||||
new_binding->dirname = (char *) _nl_default_dirname;
|
||||
|
||||
if (codesetp)
|
||||
{
|
||||
const char *codeset = *codesetp;
|
||||
|
||||
if (codeset != NULL)
|
||||
{
|
||||
char *result;
|
||||
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (codeset);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_codeset;
|
||||
#else
|
||||
size_t len = strlen (codeset) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_codeset;
|
||||
memcpy (result, codeset, len);
|
||||
#endif
|
||||
codeset = result;
|
||||
}
|
||||
*codesetp = codeset;
|
||||
new_binding->codeset = (char *) codeset;
|
||||
}
|
||||
else
|
||||
new_binding->codeset = NULL;
|
||||
|
||||
/* Now enqueue it. */
|
||||
if (_nl_domain_bindings == NULL
|
||||
|| strcmp (domainname, _nl_domain_bindings->domainname) < 0)
|
||||
{
|
||||
new_binding->next = _nl_domain_bindings;
|
||||
_nl_domain_bindings = new_binding;
|
||||
}
|
||||
else
|
||||
{
|
||||
binding = _nl_domain_bindings;
|
||||
while (binding->next != NULL
|
||||
&& strcmp (domainname, binding->next->domainname) > 0)
|
||||
binding = binding->next;
|
||||
|
||||
new_binding->next = binding->next;
|
||||
binding->next = new_binding;
|
||||
}
|
||||
|
||||
modified = 1;
|
||||
|
||||
/* Here we deal with memory allocation failures. */
|
||||
if (0)
|
||||
{
|
||||
failed_codeset:
|
||||
if (new_binding->dirname != _nl_default_dirname)
|
||||
free (new_binding->dirname);
|
||||
failed_dirname:
|
||||
free (new_binding);
|
||||
failed:
|
||||
if (dirnamep)
|
||||
*dirnamep = NULL;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we modified any binding, we flush the caches. */
|
||||
if (modified)
|
||||
++_nl_msg_cat_cntr;
|
||||
|
||||
gl_rwlock_unlock (_nl_state_lock);
|
||||
}
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
char *
|
||||
BINDTEXTDOMAIN (const char *domainname, const char *dirname)
|
||||
{
|
||||
set_binding_values (domainname, &dirname, NULL);
|
||||
return (char *) dirname;
|
||||
}
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
char *
|
||||
BIND_TEXTDOMAIN_CODESET (const char *domainname, const char *codeset)
|
||||
{
|
||||
set_binding_values (domainname, NULL, &codeset);
|
||||
return (char *) codeset;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Aliases for function names in GNU C Library. */
|
||||
weak_alias (__bindtextdomain, bindtextdomain);
|
||||
weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset);
|
||||
#endif
|
|
@ -0,0 +1,684 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent table of character encoding aliases.
|
||||
#
|
||||
# Copyright (C) 2000-2004, 2006-2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# The table consists of lines of the form
|
||||
# ALIAS CANONICAL
|
||||
#
|
||||
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
|
||||
# ALIAS is compared in a case sensitive way.
|
||||
#
|
||||
# CANONICAL is the GNU canonical name for this character encoding.
|
||||
# It must be an encoding supported by libiconv. Support by GNU libc is
|
||||
# also desirable. CANONICAL is case insensitive. Usually an upper case
|
||||
# MIME charset name is preferred.
|
||||
# The current list of GNU canonical charset names is as follows.
|
||||
#
|
||||
# name MIME? used by which systems
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin
|
||||
# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# ISO-8859-3 Y glibc solaris cygwin
|
||||
# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin
|
||||
# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# ISO-8859-6 Y glibc aix hpux solaris cygwin
|
||||
# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin cygwin
|
||||
# ISO-8859-8 Y glibc aix hpux osf solaris cygwin
|
||||
# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin cygwin
|
||||
# ISO-8859-13 glibc netbsd openbsd darwin cygwin
|
||||
# ISO-8859-14 glibc cygwin
|
||||
# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin
|
||||
# KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin
|
||||
# KOI8-T glibc
|
||||
# CP437 dos
|
||||
# CP775 dos
|
||||
# CP850 aix osf dos
|
||||
# CP852 dos
|
||||
# CP855 dos
|
||||
# CP856 aix
|
||||
# CP857 dos
|
||||
# CP861 dos
|
||||
# CP862 dos
|
||||
# CP864 dos
|
||||
# CP865 dos
|
||||
# CP866 freebsd netbsd openbsd darwin dos
|
||||
# CP869 dos
|
||||
# CP874 woe32 dos
|
||||
# CP922 aix
|
||||
# CP932 aix cygwin woe32 dos
|
||||
# CP943 aix
|
||||
# CP949 osf darwin woe32 dos
|
||||
# CP950 woe32 dos
|
||||
# CP1046 aix
|
||||
# CP1124 aix
|
||||
# CP1125 dos
|
||||
# CP1129 aix
|
||||
# CP1131 darwin
|
||||
# CP1250 woe32
|
||||
# CP1251 glibc solaris netbsd openbsd darwin cygwin woe32
|
||||
# CP1252 aix woe32
|
||||
# CP1253 woe32
|
||||
# CP1254 woe32
|
||||
# CP1255 glibc woe32
|
||||
# CP1256 woe32
|
||||
# CP1257 woe32
|
||||
# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin
|
||||
# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin
|
||||
# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
|
||||
# EUC-TW glibc aix hpux irix osf solaris netbsd
|
||||
# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin
|
||||
# BIG5-HKSCS glibc solaris darwin
|
||||
# GBK glibc aix osf solaris darwin cygwin woe32 dos
|
||||
# GB18030 glibc solaris netbsd darwin
|
||||
# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
|
||||
# JOHAB glibc solaris woe32
|
||||
# TIS-620 glibc aix hpux osf solaris cygwin
|
||||
# VISCII Y glibc
|
||||
# TCVN5712-1 glibc
|
||||
# ARMSCII-8 glibc darwin
|
||||
# GEORGIAN-PS glibc cygwin
|
||||
# PT154 glibc
|
||||
# HP-ROMAN8 hpux
|
||||
# HP-ARABIC8 hpux
|
||||
# HP-GREEK8 hpux
|
||||
# HP-HEBREW8 hpux
|
||||
# HP-TURKISH8 hpux
|
||||
# HP-KANA8 hpux
|
||||
# DEC-KANJI osf
|
||||
# DEC-HANYU osf
|
||||
# UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin
|
||||
#
|
||||
# Note: Names which are not marked as being a MIME name should not be used in
|
||||
# Internet protocols for information interchange (mail, news, etc.).
|
||||
#
|
||||
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
# must understand both names and treat them as equivalent.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
|
||||
host="$1"
|
||||
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
|
||||
echo "# This file contains a table of character encoding aliases,"
|
||||
echo "# suitable for operating system '${os}'."
|
||||
echo "# It was automatically generated from config.charset."
|
||||
# List of references, updated during installation:
|
||||
echo "# Packages using this file: "
|
||||
case "$os" in
|
||||
linux-gnulibc1*)
|
||||
# Linux libc5 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
echo "POSIX ASCII"
|
||||
for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
|
||||
en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
|
||||
en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
|
||||
es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
|
||||
et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
|
||||
fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
|
||||
it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
|
||||
sv_FI sv_SE; do
|
||||
echo "$l ISO-8859-1"
|
||||
echo "$l.iso-8859-1 ISO-8859-1"
|
||||
echo "$l.iso-8859-15 ISO-8859-15"
|
||||
echo "$l.iso-8859-15@euro ISO-8859-15"
|
||||
echo "$l@euro ISO-8859-15"
|
||||
echo "$l.cp-437 CP437"
|
||||
echo "$l.cp-850 CP850"
|
||||
echo "$l.cp-1252 CP1252"
|
||||
echo "$l.cp-1252@euro CP1252"
|
||||
#echo "$l.atari-st ATARI-ST" # not a commonly used encoding
|
||||
echo "$l.utf-8 UTF-8"
|
||||
echo "$l.utf-8@euro UTF-8"
|
||||
done
|
||||
for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
|
||||
sl_SI sr sr_CS sr_YU; do
|
||||
echo "$l ISO-8859-2"
|
||||
echo "$l.iso-8859-2 ISO-8859-2"
|
||||
echo "$l.cp-852 CP852"
|
||||
echo "$l.cp-1250 CP1250"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in mk mk_MK ru ru_RU; do
|
||||
echo "$l ISO-8859-5"
|
||||
echo "$l.iso-8859-5 ISO-8859-5"
|
||||
echo "$l.koi8-r KOI8-R"
|
||||
echo "$l.cp-866 CP866"
|
||||
echo "$l.cp-1251 CP1251"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in ar ar_SA; do
|
||||
echo "$l ISO-8859-6"
|
||||
echo "$l.iso-8859-6 ISO-8859-6"
|
||||
echo "$l.cp-864 CP864"
|
||||
#echo "$l.cp-868 CP868" # not a commonly used encoding
|
||||
echo "$l.cp-1256 CP1256"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in el el_GR gr gr_GR; do
|
||||
echo "$l ISO-8859-7"
|
||||
echo "$l.iso-8859-7 ISO-8859-7"
|
||||
echo "$l.cp-869 CP869"
|
||||
echo "$l.cp-1253 CP1253"
|
||||
echo "$l.cp-1253@euro CP1253"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
echo "$l.utf-8@euro UTF-8"
|
||||
done
|
||||
for l in he he_IL iw iw_IL; do
|
||||
echo "$l ISO-8859-8"
|
||||
echo "$l.iso-8859-8 ISO-8859-8"
|
||||
echo "$l.cp-862 CP862"
|
||||
echo "$l.cp-1255 CP1255"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in tr tr_TR; do
|
||||
echo "$l ISO-8859-9"
|
||||
echo "$l.iso-8859-9 ISO-8859-9"
|
||||
echo "$l.cp-857 CP857"
|
||||
echo "$l.cp-1254 CP1254"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in lt lt_LT lv lv_LV; do
|
||||
#echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
|
||||
echo "$l ISO-8859-13"
|
||||
done
|
||||
for l in ru_UA uk uk_UA; do
|
||||
echo "$l KOI8-U"
|
||||
done
|
||||
for l in zh zh_CN; do
|
||||
#echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
|
||||
echo "$l GB2312"
|
||||
done
|
||||
for l in ja ja_JP ja_JP.EUC; do
|
||||
echo "$l EUC-JP"
|
||||
done
|
||||
for l in ko ko_KR; do
|
||||
echo "$l EUC-KR"
|
||||
done
|
||||
for l in th th_TH; do
|
||||
echo "$l TIS-620"
|
||||
done
|
||||
for l in fa fa_IR; do
|
||||
#echo "$l ISIRI-3342" # a broken encoding
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
;;
|
||||
linux* | *-gnu*)
|
||||
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||
# because glibc has iconv and both glibc and libiconv support all
|
||||
# GNU canonical names directly. Therefore, the Makefile does not
|
||||
# need to install the alias file at all.
|
||||
# The following applies only to glibc-2.0.x and older libcs.
|
||||
echo "ISO_646.IRV:1983 ASCII"
|
||||
;;
|
||||
aix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "IBM-850 CP850"
|
||||
echo "IBM-856 CP856"
|
||||
echo "IBM-921 ISO-8859-13"
|
||||
echo "IBM-922 CP922"
|
||||
echo "IBM-932 CP932"
|
||||
echo "IBM-943 CP943"
|
||||
echo "IBM-1046 CP1046"
|
||||
echo "IBM-1124 CP1124"
|
||||
echo "IBM-1129 CP1129"
|
||||
echo "IBM-1252 CP1252"
|
||||
echo "IBM-eucCN GB2312"
|
||||
echo "IBM-eucJP EUC-JP"
|
||||
echo "IBM-eucKR EUC-KR"
|
||||
echo "IBM-eucTW EUC-TW"
|
||||
echo "big5 BIG5"
|
||||
echo "GBK GBK"
|
||||
echo "TIS-620 TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
hpux*)
|
||||
echo "iso88591 ISO-8859-1"
|
||||
echo "iso88592 ISO-8859-2"
|
||||
echo "iso88595 ISO-8859-5"
|
||||
echo "iso88596 ISO-8859-6"
|
||||
echo "iso88597 ISO-8859-7"
|
||||
echo "iso88598 ISO-8859-8"
|
||||
echo "iso88599 ISO-8859-9"
|
||||
echo "iso885915 ISO-8859-15"
|
||||
echo "roman8 HP-ROMAN8"
|
||||
echo "arabic8 HP-ARABIC8"
|
||||
echo "greek8 HP-GREEK8"
|
||||
echo "hebrew8 HP-HEBREW8"
|
||||
echo "turkish8 HP-TURKISH8"
|
||||
echo "kana8 HP-KANA8"
|
||||
echo "tis620 TIS-620"
|
||||
echo "big5 BIG5"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "hp15CN GB2312"
|
||||
#echo "ccdc ?" # what is this?
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "utf8 UTF-8"
|
||||
;;
|
||||
irix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
;;
|
||||
osf*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "cp850 CP850"
|
||||
echo "big5 BIG5"
|
||||
echo "dechanyu DEC-HANYU"
|
||||
echo "dechanzi GB2312"
|
||||
echo "deckanji DEC-KANJI"
|
||||
echo "deckorean EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "GBK GBK"
|
||||
echo "KSC5601 CP949"
|
||||
echo "sdeckanji EUC-JP"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "TACTIS TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
solaris*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-3 ISO-8859-3"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "koi8-r KOI8-R"
|
||||
echo "ansi-1251 CP1251"
|
||||
echo "BIG5 BIG5"
|
||||
echo "Big5-HKSCS BIG5-HKSCS"
|
||||
echo "gb2312 GB2312"
|
||||
echo "GBK GBK"
|
||||
echo "GB18030 GB18030"
|
||||
echo "cns11643 EUC-TW"
|
||||
echo "5601 EUC-KR"
|
||||
echo "ko_KR.johap92 JOHAB"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "PCK SHIFT_JIS"
|
||||
echo "TIS620.2533 TIS-620"
|
||||
#echo "sun_eu_greek ?" # what is this?
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
freebsd* | os2*)
|
||||
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
# Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
|
||||
# reuse FreeBSD's locale data for OS/2.
|
||||
echo "C ASCII"
|
||||
echo "US-ASCII ASCII"
|
||||
for l in la_LN lt_LN; do
|
||||
echo "$l.ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
|
||||
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l.ISO_8859-1 ISO-8859-1"
|
||||
echo "$l.DIS_8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO_8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO_8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU ru_SU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO_8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
netbsd*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "BIG5 BIG5"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
;;
|
||||
openbsd*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
;;
|
||||
darwin[56]*)
|
||||
# Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
for l in en_AU en_CA en_GB en_US la_LN; do
|
||||
echo "$l.US-ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
|
||||
nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l ISO-8859-1"
|
||||
echo "$l.ISO8859-1 ISO-8859-1"
|
||||
echo "$l.ISO8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in la_LN; do
|
||||
echo "$l.ISO8859-1 ISO-8859-1"
|
||||
echo "$l.ISO8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
for l in bg_BG; do
|
||||
echo "$l.CP1251 CP1251"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
darwin*)
|
||||
# Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is
|
||||
# useless:
|
||||
# - It returns the empty string when LANG is set to a locale of the
|
||||
# form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
|
||||
# LC_CTYPE file.
|
||||
# - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
|
||||
# the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
|
||||
# - The documentation says:
|
||||
# "... all code that calls BSD system routines should ensure
|
||||
# that the const *char parameters of these routines are in UTF-8
|
||||
# encoding. All BSD system functions expect their string
|
||||
# parameters to be in UTF-8 encoding and nothing else."
|
||||
# It also says
|
||||
# "An additional caveat is that string parameters for files,
|
||||
# paths, and other file-system entities must be in canonical
|
||||
# UTF-8. In a canonical UTF-8 Unicode string, all decomposable
|
||||
# characters are decomposed ..."
|
||||
# but this is not true: You can pass non-decomposed UTF-8 strings
|
||||
# to file system functions, and it is the OS which will convert
|
||||
# them to decomposed UTF-8 before accessing the file system.
|
||||
# - The Apple Terminal application displays UTF-8 by default.
|
||||
# - However, other applications are free to use different encodings:
|
||||
# - xterm uses ISO-8859-1 by default.
|
||||
# - TextEdit uses MacRoman by default.
|
||||
# We prefer UTF-8 over decomposed UTF-8-MAC because one should
|
||||
# minimize the use of decomposed Unicode. Unfortunately, through the
|
||||
# Darwin file system, decomposed UTF-8 strings are leaked into user
|
||||
# space nevertheless.
|
||||
# Then there are also the locales with encodings other than US-ASCII
|
||||
# and UTF-8. These locales can be occasionally useful to users (e.g.
|
||||
# when grepping through ISO-8859-1 encoded text files), when all their
|
||||
# file names are in US-ASCII.
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "KOI8-R KOI8-R"
|
||||
echo "KOI8-U KOI8-U"
|
||||
echo "CP866 CP866"
|
||||
echo "CP949 CP949"
|
||||
echo "CP1131 CP1131"
|
||||
echo "CP1251 CP1251"
|
||||
echo "eucCN GB2312"
|
||||
echo "GB2312 GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "Big5 BIG5"
|
||||
echo "Big5HKSCS BIG5-HKSCS"
|
||||
echo "GBK GBK"
|
||||
echo "GB18030 GB18030"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "ARMSCII-8 ARMSCII-8"
|
||||
echo "PT154 PT154"
|
||||
#echo "ISCII-DEV ?"
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
beos* | haiku*)
|
||||
# BeOS and Haiku have a single locale, and it has UTF-8 encoding.
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
msdosdjgpp*)
|
||||
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "#"
|
||||
echo "# The encodings given here may not all be correct."
|
||||
echo "# If you find that the encoding given for your language and"
|
||||
echo "# country is not the one your DOS machine actually uses, just"
|
||||
echo "# correct it in this file, and send a mail to"
|
||||
echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
|
||||
echo "# and Bruno Haible <bruno@clisp.org>."
|
||||
echo "#"
|
||||
echo "C ASCII"
|
||||
# ISO-8859-1 languages
|
||||
echo "ca CP850"
|
||||
echo "ca_ES CP850"
|
||||
echo "da CP865" # not CP850 ??
|
||||
echo "da_DK CP865" # not CP850 ??
|
||||
echo "de CP850"
|
||||
echo "de_AT CP850"
|
||||
echo "de_CH CP850"
|
||||
echo "de_DE CP850"
|
||||
echo "en CP850"
|
||||
echo "en_AU CP850" # not CP437 ??
|
||||
echo "en_CA CP850"
|
||||
echo "en_GB CP850"
|
||||
echo "en_NZ CP437"
|
||||
echo "en_US CP437"
|
||||
echo "en_ZA CP850" # not CP437 ??
|
||||
echo "es CP850"
|
||||
echo "es_AR CP850"
|
||||
echo "es_BO CP850"
|
||||
echo "es_CL CP850"
|
||||
echo "es_CO CP850"
|
||||
echo "es_CR CP850"
|
||||
echo "es_CU CP850"
|
||||
echo "es_DO CP850"
|
||||
echo "es_EC CP850"
|
||||
echo "es_ES CP850"
|
||||
echo "es_GT CP850"
|
||||
echo "es_HN CP850"
|
||||
echo "es_MX CP850"
|
||||
echo "es_NI CP850"
|
||||
echo "es_PA CP850"
|
||||
echo "es_PY CP850"
|
||||
echo "es_PE CP850"
|
||||
echo "es_SV CP850"
|
||||
echo "es_UY CP850"
|
||||
echo "es_VE CP850"
|
||||
echo "et CP850"
|
||||
echo "et_EE CP850"
|
||||
echo "eu CP850"
|
||||
echo "eu_ES CP850"
|
||||
echo "fi CP850"
|
||||
echo "fi_FI CP850"
|
||||
echo "fr CP850"
|
||||
echo "fr_BE CP850"
|
||||
echo "fr_CA CP850"
|
||||
echo "fr_CH CP850"
|
||||
echo "fr_FR CP850"
|
||||
echo "ga CP850"
|
||||
echo "ga_IE CP850"
|
||||
echo "gd CP850"
|
||||
echo "gd_GB CP850"
|
||||
echo "gl CP850"
|
||||
echo "gl_ES CP850"
|
||||
echo "id CP850" # not CP437 ??
|
||||
echo "id_ID CP850" # not CP437 ??
|
||||
echo "is CP861" # not CP850 ??
|
||||
echo "is_IS CP861" # not CP850 ??
|
||||
echo "it CP850"
|
||||
echo "it_CH CP850"
|
||||
echo "it_IT CP850"
|
||||
echo "lt CP775"
|
||||
echo "lt_LT CP775"
|
||||
echo "lv CP775"
|
||||
echo "lv_LV CP775"
|
||||
echo "nb CP865" # not CP850 ??
|
||||
echo "nb_NO CP865" # not CP850 ??
|
||||
echo "nl CP850"
|
||||
echo "nl_BE CP850"
|
||||
echo "nl_NL CP850"
|
||||
echo "nn CP865" # not CP850 ??
|
||||
echo "nn_NO CP865" # not CP850 ??
|
||||
echo "no CP865" # not CP850 ??
|
||||
echo "no_NO CP865" # not CP850 ??
|
||||
echo "pt CP850"
|
||||
echo "pt_BR CP850"
|
||||
echo "pt_PT CP850"
|
||||
echo "sv CP850"
|
||||
echo "sv_SE CP850"
|
||||
# ISO-8859-2 languages
|
||||
echo "cs CP852"
|
||||
echo "cs_CZ CP852"
|
||||
echo "hr CP852"
|
||||
echo "hr_HR CP852"
|
||||
echo "hu CP852"
|
||||
echo "hu_HU CP852"
|
||||
echo "pl CP852"
|
||||
echo "pl_PL CP852"
|
||||
echo "ro CP852"
|
||||
echo "ro_RO CP852"
|
||||
echo "sk CP852"
|
||||
echo "sk_SK CP852"
|
||||
echo "sl CP852"
|
||||
echo "sl_SI CP852"
|
||||
echo "sq CP852"
|
||||
echo "sq_AL CP852"
|
||||
echo "sr CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
|
||||
# ISO-8859-3 languages
|
||||
echo "mt CP850"
|
||||
echo "mt_MT CP850"
|
||||
# ISO-8859-5 languages
|
||||
echo "be CP866"
|
||||
echo "be_BE CP866"
|
||||
echo "bg CP866" # not CP855 ??
|
||||
echo "bg_BG CP866" # not CP855 ??
|
||||
echo "mk CP866" # not CP855 ??
|
||||
echo "mk_MK CP866" # not CP855 ??
|
||||
echo "ru CP866"
|
||||
echo "ru_RU CP866"
|
||||
echo "uk CP1125"
|
||||
echo "uk_UA CP1125"
|
||||
# ISO-8859-6 languages
|
||||
echo "ar CP864"
|
||||
echo "ar_AE CP864"
|
||||
echo "ar_DZ CP864"
|
||||
echo "ar_EG CP864"
|
||||
echo "ar_IQ CP864"
|
||||
echo "ar_IR CP864"
|
||||
echo "ar_JO CP864"
|
||||
echo "ar_KW CP864"
|
||||
echo "ar_MA CP864"
|
||||
echo "ar_OM CP864"
|
||||
echo "ar_QA CP864"
|
||||
echo "ar_SA CP864"
|
||||
echo "ar_SY CP864"
|
||||
# ISO-8859-7 languages
|
||||
echo "el CP869"
|
||||
echo "el_GR CP869"
|
||||
# ISO-8859-8 languages
|
||||
echo "he CP862"
|
||||
echo "he_IL CP862"
|
||||
# ISO-8859-9 languages
|
||||
echo "tr CP857"
|
||||
echo "tr_TR CP857"
|
||||
# Japanese
|
||||
echo "ja CP932"
|
||||
echo "ja_JP CP932"
|
||||
# Chinese
|
||||
echo "zh_CN GBK"
|
||||
echo "zh_TW CP950" # not CP938 ??
|
||||
# Korean
|
||||
echo "kr CP949" # not CP934 ??
|
||||
echo "kr_KR CP949" # not CP934 ??
|
||||
# Thai
|
||||
echo "th CP874"
|
||||
echo "th_TH CP874"
|
||||
# Other
|
||||
echo "eo CP850"
|
||||
echo "eo_EO CP850"
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,56 @@
|
|||
/* Implementation of the dcgettext(3) function.
|
||||
Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DCGETTEXT __dcgettext
|
||||
# define DCIGETTEXT __dcigettext
|
||||
#else
|
||||
# define DCGETTEXT libintl_dcgettext
|
||||
# define DCIGETTEXT libintl_dcigettext
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
char *
|
||||
DCGETTEXT (const char *domainname, const char *msgid, int category)
|
||||
{
|
||||
return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
INTDEF(__dcgettext)
|
||||
weak_alias (__dcgettext, dcgettext);
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,57 @@
|
|||
/* Implementation of the dcngettext(3) function.
|
||||
Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DCNGETTEXT __dcngettext
|
||||
# define DCIGETTEXT __dcigettext
|
||||
#else
|
||||
# define DCNGETTEXT libintl_dcngettext
|
||||
# define DCIGETTEXT libintl_dcigettext
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
char *
|
||||
DCNGETTEXT (const char *domainname,
|
||||
const char *msgid1, const char *msgid2, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dcngettext, dcngettext);
|
||||
#endif
|
|
@ -0,0 +1,58 @@
|
|||
/* Implementation of the dgettext(3) function.
|
||||
Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DGETTEXT __dgettext
|
||||
# define DCGETTEXT INTUSE(__dcgettext)
|
||||
#else
|
||||
# define DGETTEXT libintl_dgettext
|
||||
# define DCGETTEXT libintl_dcgettext
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||
LC_MESSAGES locale. */
|
||||
char *
|
||||
DGETTEXT (const char *domainname, const char *msgid)
|
||||
{
|
||||
return DCGETTEXT (domainname, msgid, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dgettext, dgettext);
|
||||
#endif
|
|
@ -0,0 +1,59 @@
|
|||
/* Implementation of the dngettext(3) function.
|
||||
Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DNGETTEXT __dngettext
|
||||
# define DCNGETTEXT __dcngettext
|
||||
#else
|
||||
# define DNGETTEXT libintl_dngettext
|
||||
# define DCNGETTEXT libintl_dcngettext
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||
LC_MESSAGES locale and skip message according to the plural form. */
|
||||
char *
|
||||
DNGETTEXT (const char *domainname,
|
||||
const char *msgid1, const char *msgid2, unsigned long int n)
|
||||
{
|
||||
return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dngettext, dngettext);
|
||||
#endif
|
|
@ -0,0 +1,108 @@
|
|||
/* Plural expression evaluation.
|
||||
Copyright (C) 2000-2003, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef STATIC
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
/* Evaluate the plural expression and return an index value. */
|
||||
STATIC
|
||||
unsigned long int
|
||||
internal_function
|
||||
plural_eval (const struct expression *pexp, unsigned long int n)
|
||||
{
|
||||
switch (pexp->nargs)
|
||||
{
|
||||
case 0:
|
||||
switch (pexp->operation)
|
||||
{
|
||||
case var:
|
||||
return n;
|
||||
case num:
|
||||
return pexp->val.num;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
/* pexp->operation must be lnot. */
|
||||
unsigned long int arg = plural_eval (pexp->val.args[0], n);
|
||||
return ! arg;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
unsigned long int leftarg = plural_eval (pexp->val.args[0], n);
|
||||
if (pexp->operation == lor)
|
||||
return leftarg || plural_eval (pexp->val.args[1], n);
|
||||
else if (pexp->operation == land)
|
||||
return leftarg && plural_eval (pexp->val.args[1], n);
|
||||
else
|
||||
{
|
||||
unsigned long int rightarg = plural_eval (pexp->val.args[1], n);
|
||||
|
||||
switch (pexp->operation)
|
||||
{
|
||||
case mult:
|
||||
return leftarg * rightarg;
|
||||
case divide:
|
||||
#if !INTDIV0_RAISES_SIGFPE
|
||||
if (rightarg == 0)
|
||||
raise (SIGFPE);
|
||||
#endif
|
||||
return leftarg / rightarg;
|
||||
case module:
|
||||
#if !INTDIV0_RAISES_SIGFPE
|
||||
if (rightarg == 0)
|
||||
raise (SIGFPE);
|
||||
#endif
|
||||
return leftarg % rightarg;
|
||||
case plus:
|
||||
return leftarg + rightarg;
|
||||
case minus:
|
||||
return leftarg - rightarg;
|
||||
case less_than:
|
||||
return leftarg < rightarg;
|
||||
case greater_than:
|
||||
return leftarg > rightarg;
|
||||
case less_or_equal:
|
||||
return leftarg <= rightarg;
|
||||
case greater_or_equal:
|
||||
return leftarg >= rightarg;
|
||||
case equal:
|
||||
return leftarg == rightarg;
|
||||
case not_equal:
|
||||
return leftarg != rightarg;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
/* pexp->operation must be qmop. */
|
||||
unsigned long int boolarg = plural_eval (pexp->val.args[0], n);
|
||||
return plural_eval (pexp->val.args[boolarg ? 1 : 2], n);
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
/* Copyright (C) 1995-1998, 2000-2001, 2003, 2005, 2007 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
/* On some strange systems still no definition of NULL is found. Sigh! */
|
||||
#ifndef NULL
|
||||
# if defined __STDC__ && __STDC__
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Split a locale name NAME into a leading language part and all the
|
||||
rest. Return a pointer to the first character after the language,
|
||||
i.e. to the first byte of the rest. */
|
||||
static char *_nl_find_language (const char *name);
|
||||
|
||||
static char *
|
||||
_nl_find_language (const char *name)
|
||||
{
|
||||
while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.')
|
||||
++name;
|
||||
|
||||
return (char *) name;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_nl_explode_name (char *name,
|
||||
const char **language, const char **modifier,
|
||||
const char **territory, const char **codeset,
|
||||
const char **normalized_codeset)
|
||||
{
|
||||
char *cp;
|
||||
int mask;
|
||||
|
||||
*modifier = NULL;
|
||||
*territory = NULL;
|
||||
*codeset = NULL;
|
||||
*normalized_codeset = NULL;
|
||||
|
||||
/* Now we determine the single parts of the locale name. First
|
||||
look for the language. Termination symbols are `_', '.', and `@'. */
|
||||
mask = 0;
|
||||
*language = cp = name;
|
||||
cp = _nl_find_language (*language);
|
||||
|
||||
if (*language == cp)
|
||||
/* This does not make sense: language has to be specified. Use
|
||||
this entry as it is without exploding. Perhaps it is an alias. */
|
||||
cp = strchr (*language, '\0');
|
||||
else
|
||||
{
|
||||
if (cp[0] == '_')
|
||||
{
|
||||
/* Next is the territory. */
|
||||
cp[0] = '\0';
|
||||
*territory = ++cp;
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@')
|
||||
++cp;
|
||||
|
||||
mask |= XPG_TERRITORY;
|
||||
}
|
||||
|
||||
if (cp[0] == '.')
|
||||
{
|
||||
/* Next is the codeset. */
|
||||
cp[0] = '\0';
|
||||
*codeset = ++cp;
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '@')
|
||||
++cp;
|
||||
|
||||
mask |= XPG_CODESET;
|
||||
|
||||
if (*codeset != cp && (*codeset)[0] != '\0')
|
||||
{
|
||||
*normalized_codeset = _nl_normalize_codeset (*codeset,
|
||||
cp - *codeset);
|
||||
if (*normalized_codeset == NULL)
|
||||
return -1;
|
||||
else if (strcmp (*codeset, *normalized_codeset) == 0)
|
||||
free ((char *) *normalized_codeset);
|
||||
else
|
||||
mask |= XPG_NORM_CODESET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cp[0] == '@')
|
||||
{
|
||||
/* Next is the modifier. */
|
||||
cp[0] = '\0';
|
||||
*modifier = ++cp;
|
||||
|
||||
if (cp[0] != '\0')
|
||||
mask |= XPG_MODIFIER;
|
||||
}
|
||||
|
||||
if (*territory != NULL && (*territory)[0] == '\0')
|
||||
mask &= ~XPG_TERRITORY;
|
||||
|
||||
if (*codeset != NULL && (*codeset)[0] == '\0')
|
||||
mask &= ~XPG_CODESET;
|
||||
|
||||
return mask;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
#if @HAVE_VISIBILITY@ && BUILDING_LIBINTL
|
||||
#define LIBINTL_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
#define LIBINTL_DLL_EXPORTED
|
||||
#endif
|
|
@ -0,0 +1,212 @@
|
|||
/* Handle list of needed message catalogs
|
||||
Copyright (C) 1995-1999, 2000-2001, 2003-2007 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* Handle multi-threaded applications. */
|
||||
#ifdef _LIBC
|
||||
# include <bits/libc-lock.h>
|
||||
# define gl_rwlock_define_initialized __libc_rwlock_define_initialized
|
||||
# define gl_rwlock_rdlock __libc_rwlock_rdlock
|
||||
# define gl_rwlock_wrlock __libc_rwlock_wrlock
|
||||
# define gl_rwlock_unlock __libc_rwlock_unlock
|
||||
#else
|
||||
# include "lock.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
/* List of already loaded domains. */
|
||||
static struct loaded_l10nfile *_nl_loaded_domains;
|
||||
|
||||
|
||||
/* Return a data structure describing the message catalog described by
|
||||
the DOMAINNAME and CATEGORY parameters with respect to the currently
|
||||
established bindings. */
|
||||
struct loaded_l10nfile *
|
||||
internal_function
|
||||
_nl_find_domain (const char *dirname, char *locale,
|
||||
const char *domainname, struct binding *domainbinding)
|
||||
{
|
||||
struct loaded_l10nfile *retval;
|
||||
const char *language;
|
||||
const char *modifier;
|
||||
const char *territory;
|
||||
const char *codeset;
|
||||
const char *normalized_codeset;
|
||||
const char *alias_value;
|
||||
int mask;
|
||||
|
||||
/* LOCALE can consist of up to four recognized parts for the XPG syntax:
|
||||
|
||||
language[_territory][.codeset][@modifier]
|
||||
|
||||
Beside the first part all of them are allowed to be missing. If
|
||||
the full specified locale is not found, the less specific one are
|
||||
looked for. The various parts will be stripped off according to
|
||||
the following order:
|
||||
(1) codeset
|
||||
(2) normalized codeset
|
||||
(3) territory
|
||||
(4) modifier
|
||||
*/
|
||||
|
||||
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
|
||||
gl_rwlock_define_initialized (static, lock);
|
||||
gl_rwlock_rdlock (lock);
|
||||
|
||||
/* If we have already tested for this locale entry there has to
|
||||
be one data set in the list of loaded domains. */
|
||||
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
||||
strlen (dirname) + 1, 0, locale, NULL, NULL,
|
||||
NULL, NULL, domainname, 0);
|
||||
|
||||
gl_rwlock_unlock (lock);
|
||||
|
||||
if (retval != NULL)
|
||||
{
|
||||
/* We know something about this locale. */
|
||||
int cnt;
|
||||
|
||||
if (retval->decided <= 0)
|
||||
_nl_load_domain (retval, domainbinding);
|
||||
|
||||
if (retval->data != NULL)
|
||||
return retval;
|
||||
|
||||
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
if (retval->successor[cnt]->decided <= 0)
|
||||
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||
|
||||
if (retval->successor[cnt]->data != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* See whether the locale value is an alias. If yes its value
|
||||
*overwrites* the alias name. No test for the original value is
|
||||
done. */
|
||||
alias_value = _nl_expand_alias (locale);
|
||||
if (alias_value != NULL)
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
locale = strdup (alias_value);
|
||||
if (locale == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
size_t len = strlen (alias_value) + 1;
|
||||
locale = (char *) malloc (len);
|
||||
if (locale == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy (locale, alias_value, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Now we determine the single parts of the locale name. First
|
||||
look for the language. Termination symbols are `_', '.', and `@'. */
|
||||
mask = _nl_explode_name (locale, &language, &modifier, &territory,
|
||||
&codeset, &normalized_codeset);
|
||||
if (mask == -1)
|
||||
/* This means we are out of core. */
|
||||
return NULL;
|
||||
|
||||
/* We need to protect modifying the _NL_LOADED_DOMAINS data. */
|
||||
gl_rwlock_wrlock (lock);
|
||||
|
||||
/* Create all possible locale entries which might be interested in
|
||||
generalization. */
|
||||
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
||||
strlen (dirname) + 1, mask, language, territory,
|
||||
codeset, normalized_codeset, modifier,
|
||||
domainname, 1);
|
||||
|
||||
gl_rwlock_unlock (lock);
|
||||
|
||||
if (retval == NULL)
|
||||
/* This means we are out of core. */
|
||||
goto out;
|
||||
|
||||
if (retval->decided <= 0)
|
||||
_nl_load_domain (retval, domainbinding);
|
||||
if (retval->data == NULL)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
if (retval->successor[cnt]->decided <= 0)
|
||||
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||
if (retval->successor[cnt]->data != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The room for an alias was dynamically allocated. Free it now. */
|
||||
if (alias_value != NULL)
|
||||
free (locale);
|
||||
|
||||
out:
|
||||
/* The space for normalized_codeset is dynamically allocated. Free it. */
|
||||
if (mask & XPG_NORM_CODESET)
|
||||
free ((void *) normalized_codeset);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
/* This is called from iconv/gconv_db.c's free_mem, as locales must
|
||||
be freed before freeing gconv steps arrays. */
|
||||
void __libc_freeres_fn_section
|
||||
_nl_finddomain_subfreeres ()
|
||||
{
|
||||
struct loaded_l10nfile *runp = _nl_loaded_domains;
|
||||
|
||||
while (runp != NULL)
|
||||
{
|
||||
struct loaded_l10nfile *here = runp;
|
||||
if (runp->data != NULL)
|
||||
_nl_unload_domain ((struct loaded_domain *) runp->data);
|
||||
runp = runp->next;
|
||||
free ((char *) here->filename);
|
||||
free (here);
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,63 @@
|
|||
/* Implementation of gettext(3) function.
|
||||
Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __need_NULL
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# include <stdlib.h> /* Just for NULL. */
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define GETTEXT __gettext
|
||||
# define DCGETTEXT INTUSE(__dcgettext)
|
||||
#else
|
||||
# define GETTEXT libintl_gettext
|
||||
# define DCGETTEXT libintl_dcgettext
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
char *
|
||||
GETTEXT (const char *msgid)
|
||||
{
|
||||
return DCGETTEXT (NULL, msgid, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__gettext, gettext);
|
||||
#endif
|
|
@ -0,0 +1,311 @@
|
|||
/* Header describing internals of libintl library.
|
||||
Copyright (C) 1995-1999, 2000-2007, 2009-2010 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _GETTEXTP_H
|
||||
#define _GETTEXTP_H
|
||||
|
||||
#include <stddef.h> /* Get size_t. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# include "../iconv/gconv_int.h"
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
# include <iconv.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Handle multi-threaded applications. */
|
||||
#ifdef _LIBC
|
||||
# include <bits/libc-lock.h>
|
||||
# define gl_rwlock_define __libc_rwlock_define
|
||||
#else
|
||||
# include "lock.h"
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
extern char *__gettext (const char *__msgid);
|
||||
extern char *__dgettext (const char *__domainname, const char *__msgid);
|
||||
extern char *__dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category);
|
||||
extern char *__ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n);
|
||||
extern char *__dngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int n);
|
||||
extern char *__dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category);
|
||||
extern char *__dcigettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
int __plural, unsigned long int __n,
|
||||
int __category);
|
||||
extern char *__textdomain (const char *__domainname);
|
||||
extern char *__bindtextdomain (const char *__domainname,
|
||||
const char *__dirname);
|
||||
extern char *__bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset);
|
||||
extern void _nl_finddomain_subfreeres (void) attribute_hidden;
|
||||
extern void _nl_unload_domain (struct loaded_domain *__domain)
|
||||
internal_function attribute_hidden;
|
||||
#else
|
||||
/* Declare the exported libintl_* functions, in a way that allows us to
|
||||
call them under their real name. */
|
||||
# undef _INTL_REDIRECT_INLINE
|
||||
# undef _INTL_REDIRECT_MACROS
|
||||
# define _INTL_REDIRECT_MACROS
|
||||
# include "libgnuintl.h"
|
||||
# ifdef IN_LIBGLOCALE
|
||||
extern char *gl_dcigettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
int __plural, unsigned long int __n,
|
||||
int __category,
|
||||
const char *__localename, const char *__encoding);
|
||||
# else
|
||||
extern char *libintl_dcigettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
int __plural, unsigned long int __n,
|
||||
int __category);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
#include "gmo.h" /* Get nls_uint32. */
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
#ifndef attribute_hidden
|
||||
# define attribute_hidden
|
||||
#endif
|
||||
|
||||
/* Tell the compiler when a conditional or integer expression is
|
||||
almost always true or almost always false. */
|
||||
#ifndef HAVE_BUILTIN_EXPECT
|
||||
# define __builtin_expect(expr, val) (expr)
|
||||
#endif
|
||||
|
||||
#ifndef W
|
||||
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <byteswap.h>
|
||||
# define SWAP(i) bswap_32 (i)
|
||||
#else
|
||||
static inline nls_uint32
|
||||
# ifdef __cplusplus
|
||||
SWAP (nls_uint32 i)
|
||||
# else
|
||||
SWAP (i)
|
||||
nls_uint32 i;
|
||||
# endif
|
||||
{
|
||||
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* In-memory representation of system dependent string. */
|
||||
struct sysdep_string_desc
|
||||
{
|
||||
/* Length of addressed string, including the trailing NUL. */
|
||||
size_t length;
|
||||
/* Pointer to addressed string. */
|
||||
const char *pointer;
|
||||
};
|
||||
|
||||
/* Cache of translated strings after charset conversion.
|
||||
Note: The strings are converted to the target encoding only on an as-needed
|
||||
basis. */
|
||||
struct converted_domain
|
||||
{
|
||||
/* The target encoding name. */
|
||||
const char *encoding;
|
||||
/* The descriptor for conversion from the message catalog's encoding to
|
||||
this target encoding. */
|
||||
#ifdef _LIBC
|
||||
__gconv_t conv;
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
iconv_t conv;
|
||||
# endif
|
||||
#endif
|
||||
/* The table of translated strings after charset conversion. */
|
||||
char **conv_tab;
|
||||
};
|
||||
|
||||
/* The representation of an opened message catalog. */
|
||||
struct loaded_domain
|
||||
{
|
||||
/* Pointer to memory containing the .mo file. */
|
||||
const char *data;
|
||||
/* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
|
||||
int use_mmap;
|
||||
/* Size of mmap()ed memory. */
|
||||
size_t mmap_size;
|
||||
/* 1 if the .mo file uses a different endianness than this machine. */
|
||||
int must_swap;
|
||||
/* Pointer to additional malloc()ed memory. */
|
||||
void *malloced;
|
||||
|
||||
/* Number of static strings pairs. */
|
||||
nls_uint32 nstrings;
|
||||
/* Pointer to descriptors of original strings in the file. */
|
||||
const struct string_desc *orig_tab;
|
||||
/* Pointer to descriptors of translated strings in the file. */
|
||||
const struct string_desc *trans_tab;
|
||||
|
||||
/* Number of system dependent strings pairs. */
|
||||
nls_uint32 n_sysdep_strings;
|
||||
/* Pointer to descriptors of original sysdep strings. */
|
||||
const struct sysdep_string_desc *orig_sysdep_tab;
|
||||
/* Pointer to descriptors of translated sysdep strings. */
|
||||
const struct sysdep_string_desc *trans_sysdep_tab;
|
||||
|
||||
/* Size of hash table. */
|
||||
nls_uint32 hash_size;
|
||||
/* Pointer to hash table. */
|
||||
const nls_uint32 *hash_tab;
|
||||
/* 1 if the hash table uses a different endianness than this machine. */
|
||||
int must_swap_hash_tab;
|
||||
|
||||
/* Cache of charset conversions of the translated strings. */
|
||||
struct converted_domain *conversions;
|
||||
size_t nconversions;
|
||||
gl_rwlock_define (, conversions_lock)
|
||||
|
||||
const struct expression *plural;
|
||||
unsigned long int nplurals;
|
||||
};
|
||||
|
||||
/* We want to allocate a string at the end of the struct. But ISO C
|
||||
doesn't allow zero sized arrays. */
|
||||
#ifdef __GNUC__
|
||||
# define ZERO 0
|
||||
#else
|
||||
# define ZERO 1
|
||||
#endif
|
||||
|
||||
/* A set of settings bound to a message domain. Used to store settings
|
||||
from bindtextdomain() and bind_textdomain_codeset(). */
|
||||
struct binding
|
||||
{
|
||||
struct binding *next;
|
||||
char *dirname;
|
||||
char *codeset;
|
||||
char domainname[ZERO];
|
||||
};
|
||||
|
||||
/* A counter which is incremented each time some previous translations
|
||||
become invalid.
|
||||
This variable is part of the external ABI of the GNU libintl. */
|
||||
#ifdef IN_LIBGLOCALE
|
||||
# include <glocale/config.h>
|
||||
extern LIBGLOCALE_DLL_EXPORTED int _nl_msg_cat_cntr;
|
||||
#else
|
||||
extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBC
|
||||
extern const char *_nl_language_preferences_default (void);
|
||||
# define gl_locale_name_canonicalize _nl_locale_name_canonicalize
|
||||
extern void _nl_locale_name_canonicalize (char *name);
|
||||
# define gl_locale_name_from_win32_LANGID _nl_locale_name_from_win32_LANGID
|
||||
/* extern const char *_nl_locale_name_from_win32_LANGID (LANGID langid); */
|
||||
# define gl_locale_name_from_win32_LCID _nl_locale_name_from_win32_LCID
|
||||
/* extern const char *_nl_locale_name_from_win32_LCID (LCID lcid); */
|
||||
# define gl_locale_name_thread_unsafe _nl_locale_name_thread_unsafe
|
||||
extern const char *_nl_locale_name_thread_unsafe (int category,
|
||||
const char *categoryname);
|
||||
# define gl_locale_name_thread _nl_locale_name_thread
|
||||
/* extern const char *_nl_locale_name_thread (int category,
|
||||
const char *categoryname); */
|
||||
# define gl_locale_name_posix _nl_locale_name_posix
|
||||
extern const char *_nl_locale_name_posix (int category,
|
||||
const char *categoryname);
|
||||
# define gl_locale_name_environ _nl_locale_name_environ
|
||||
extern const char *_nl_locale_name_environ (int category,
|
||||
const char *categoryname);
|
||||
# define gl_locale_name_default _nl_locale_name_default
|
||||
extern const char *_nl_locale_name_default (void);
|
||||
# define gl_locale_name _nl_locale_name
|
||||
/* extern const char *_nl_locale_name (int category,
|
||||
const char *categoryname); */
|
||||
#endif
|
||||
|
||||
struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
|
||||
const char *__domainname,
|
||||
struct binding *__domainbinding)
|
||||
internal_function;
|
||||
void _nl_load_domain (struct loaded_l10nfile *__domain,
|
||||
struct binding *__domainbinding)
|
||||
internal_function;
|
||||
|
||||
#ifdef IN_LIBGLOCALE
|
||||
char *_nl_find_msg (struct loaded_l10nfile *domain_file,
|
||||
struct binding *domainbinding, const char *encoding,
|
||||
const char *msgid,
|
||||
size_t *lengthp)
|
||||
internal_function;
|
||||
#else
|
||||
char *_nl_find_msg (struct loaded_l10nfile *domain_file,
|
||||
struct binding *domainbinding, const char *msgid,
|
||||
int convert, size_t *lengthp)
|
||||
internal_function;
|
||||
#endif
|
||||
|
||||
/* The internal variables in the standalone libintl.a must have different
|
||||
names than the internal variables in GNU libc, otherwise programs
|
||||
using libintl.a cannot be linked statically. */
|
||||
#if !defined _LIBC
|
||||
# define _nl_default_dirname libintl_nl_default_dirname
|
||||
# define _nl_domain_bindings libintl_nl_domain_bindings
|
||||
#endif
|
||||
|
||||
/* Contains the default location of the message catalogs. */
|
||||
extern const char _nl_default_dirname[];
|
||||
#ifdef _LIBC
|
||||
libc_hidden_proto (_nl_default_dirname)
|
||||
#endif
|
||||
|
||||
/* List with bindings of specific domains. */
|
||||
extern struct binding *_nl_domain_bindings;
|
||||
|
||||
/* The internal variables in the standalone libintl.a must have different
|
||||
names than the internal variables in GNU libc, otherwise programs
|
||||
using libintl.a cannot be linked statically. */
|
||||
#if !defined _LIBC
|
||||
# define _nl_default_default_domain libintl_nl_default_default_domain
|
||||
# define _nl_current_default_domain libintl_nl_current_default_domain
|
||||
#endif
|
||||
|
||||
/* Name of the default text domain. */
|
||||
extern const char _nl_default_default_domain[] attribute_hidden;
|
||||
|
||||
/* Default text domain in which entries for gettext(3) are to be found. */
|
||||
extern const char *_nl_current_default_domain attribute_hidden;
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
#endif /* gettextP.h */
|
|
@ -0,0 +1,152 @@
|
|||
/* Description of GNU message catalog format: general file layout.
|
||||
Copyright (C) 1995, 1997, 2000-2002, 2004, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _GETTEXT_H
|
||||
#define _GETTEXT_H 1
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* The magic number of the GNU message catalog format. */
|
||||
#define _MAGIC 0x950412de
|
||||
#define _MAGIC_SWAPPED 0xde120495
|
||||
|
||||
/* Revision number of the currently used .mo (binary) file format. */
|
||||
#define MO_REVISION_NUMBER 0
|
||||
#define MO_REVISION_NUMBER_WITH_SYSDEP_I 1
|
||||
|
||||
/* The following contortions are an attempt to use the C preprocessor
|
||||
to determine an unsigned integral type that is 32 bits wide. An
|
||||
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||
as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
|
||||
when cross-compiling. */
|
||||
|
||||
#if __STDC__
|
||||
# define UINT_MAX_32_BITS 4294967295U
|
||||
#else
|
||||
# define UINT_MAX_32_BITS 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
|
||||
This should be valid for all systems GNU cares about because
|
||||
that doesn't include 16-bit systems, and only modern systems
|
||||
(that certainly have <limits.h>) have 64+-bit integral types. */
|
||||
|
||||
#ifndef UINT_MAX
|
||||
# define UINT_MAX UINT_MAX_32_BITS
|
||||
#endif
|
||||
|
||||
#if UINT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned nls_uint32;
|
||||
#else
|
||||
# if USHRT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned short nls_uint32;
|
||||
# else
|
||||
# if ULONG_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned long nls_uint32;
|
||||
# else
|
||||
/* The following line is intended to throw an error. Using #error is
|
||||
not portable enough. */
|
||||
"Cannot determine unsigned 32-bit data type."
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Header for binary .mo file format. */
|
||||
struct mo_file_header
|
||||
{
|
||||
/* The magic number. */
|
||||
nls_uint32 magic;
|
||||
/* The revision number of the file format. */
|
||||
nls_uint32 revision;
|
||||
|
||||
/* The following are only used in .mo files with major revision 0 or 1. */
|
||||
|
||||
/* The number of strings pairs. */
|
||||
nls_uint32 nstrings;
|
||||
/* Offset of table with start offsets of original strings. */
|
||||
nls_uint32 orig_tab_offset;
|
||||
/* Offset of table with start offsets of translated strings. */
|
||||
nls_uint32 trans_tab_offset;
|
||||
/* Size of hash table. */
|
||||
nls_uint32 hash_tab_size;
|
||||
/* Offset of first hash table entry. */
|
||||
nls_uint32 hash_tab_offset;
|
||||
|
||||
/* The following are only used in .mo files with minor revision >= 1. */
|
||||
|
||||
/* The number of system dependent segments. */
|
||||
nls_uint32 n_sysdep_segments;
|
||||
/* Offset of table describing system dependent segments. */
|
||||
nls_uint32 sysdep_segments_offset;
|
||||
/* The number of system dependent strings pairs. */
|
||||
nls_uint32 n_sysdep_strings;
|
||||
/* Offset of table with start offsets of original sysdep strings. */
|
||||
nls_uint32 orig_sysdep_tab_offset;
|
||||
/* Offset of table with start offsets of translated sysdep strings. */
|
||||
nls_uint32 trans_sysdep_tab_offset;
|
||||
};
|
||||
|
||||
/* Descriptor for static string contained in the binary .mo file. */
|
||||
struct string_desc
|
||||
{
|
||||
/* Length of addressed string, not including the trailing NUL. */
|
||||
nls_uint32 length;
|
||||
/* Offset of string in file. */
|
||||
nls_uint32 offset;
|
||||
};
|
||||
|
||||
/* The following are only used in .mo files with minor revision >= 1. */
|
||||
|
||||
/* Descriptor for system dependent string segment. */
|
||||
struct sysdep_segment
|
||||
{
|
||||
/* Length of addressed string, including the trailing NUL. */
|
||||
nls_uint32 length;
|
||||
/* Offset of string in file. */
|
||||
nls_uint32 offset;
|
||||
};
|
||||
|
||||
/* Pair of a static and a system dependent segment, in struct sysdep_string. */
|
||||
struct segment_pair
|
||||
{
|
||||
/* Size of static segment. */
|
||||
nls_uint32 segsize;
|
||||
/* Reference to system dependent string segment, or ~0 at the end. */
|
||||
nls_uint32 sysdepref;
|
||||
};
|
||||
|
||||
/* Descriptor for system dependent string. */
|
||||
struct sysdep_string
|
||||
{
|
||||
/* Offset of static string segments in file. */
|
||||
nls_uint32 offset;
|
||||
/* Alternating sequence of static and system dependent segments.
|
||||
The last segment is a static segment, including the trailing NUL. */
|
||||
struct segment_pair segments[1];
|
||||
};
|
||||
|
||||
/* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF,
|
||||
regardless whether 'int' is 16 bit, 32 bit, or 64 bit. */
|
||||
#define SEGMENTS_END ((nls_uint32) ~0)
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
#endif /* gettext.h */
|
|
@ -0,0 +1,51 @@
|
|||
/* Implements a string hashing function.
|
||||
Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Specification. */
|
||||
#include "hash-string.h"
|
||||
|
||||
|
||||
/* Defines the so called `hashpjw' function by P.J. Weinberger
|
||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||
unsigned long int
|
||||
__hash_string (const char *str_param)
|
||||
{
|
||||
unsigned long int hval, g;
|
||||
const char *str = str_param;
|
||||
|
||||
/* Compute the hash value for the given string. */
|
||||
hval = 0;
|
||||
while (*str != '\0')
|
||||
{
|
||||
hval <<= 4;
|
||||
hval += (unsigned char) *str++;
|
||||
g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
|
||||
if (g != 0)
|
||||
{
|
||||
hval ^= g >> (HASHWORDBITS - 8);
|
||||
hval ^= g;
|
||||
}
|
||||
}
|
||||
return hval;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/* Description of GNU message catalog format: string hashing function.
|
||||
Copyright (C) 1995, 1997-1998, 2000-2003, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* We assume to have `unsigned long int' value with at least 32 bits. */
|
||||
#define HASHWORDBITS 32
|
||||
|
||||
|
||||
#ifndef _LIBC
|
||||
# ifdef IN_LIBINTL
|
||||
# define __hash_string libintl_hash_string
|
||||
# else
|
||||
# define __hash_string hash_string
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Defines the so called `hashpjw' function by P.J. Weinberger
|
||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||
extern unsigned long int __hash_string (const char *str_param);
|
|
@ -0,0 +1,133 @@
|
|||
/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
|
||||
Library.
|
||||
Copyright (C) 1995, 2000-2003, 2005 Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* This file redirects the gettext functions (without prefix) to those
|
||||
defined in the included GNU libintl library (with "libintl_" prefix).
|
||||
It is compiled into libintl in order to make the AM_GNU_GETTEXT test
|
||||
of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
|
||||
has the redirections primarily in the <libintl.h> include file.
|
||||
It is also compiled into libgnuintl so that libgnuintl.so can be used
|
||||
as LD_PRELOADable library on glibc systems, to provide the extra
|
||||
features that the functions in the libc don't have (namely, logging). */
|
||||
|
||||
|
||||
#undef gettext
|
||||
#undef dgettext
|
||||
#undef dcgettext
|
||||
#undef ngettext
|
||||
#undef dngettext
|
||||
#undef dcngettext
|
||||
#undef textdomain
|
||||
#undef bindtextdomain
|
||||
#undef bind_textdomain_codeset
|
||||
|
||||
|
||||
/* When building a DLL, we must export some functions. Note that because
|
||||
the functions are only defined for binary backward compatibility, we
|
||||
don't need to use __declspec(dllimport) in any case. */
|
||||
#if HAVE_VISIBILITY && BUILDING_DLL
|
||||
# define DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#elif defined _MSC_VER && BUILDING_DLL
|
||||
# define DLL_EXPORTED __declspec(dllexport)
|
||||
#else
|
||||
# define DLL_EXPORTED
|
||||
#endif
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
gettext (const char *msgid)
|
||||
{
|
||||
return libintl_gettext (msgid);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
dgettext (const char *domainname, const char *msgid)
|
||||
{
|
||||
return libintl_dgettext (domainname, msgid);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
dcgettext (const char *domainname, const char *msgid, int category)
|
||||
{
|
||||
return libintl_dcgettext (domainname, msgid, category);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
ngettext (const char *msgid1, const char *msgid2, unsigned long int n)
|
||||
{
|
||||
return libintl_ngettext (msgid1, msgid2, n);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
dngettext (const char *domainname,
|
||||
const char *msgid1, const char *msgid2, unsigned long int n)
|
||||
{
|
||||
return libintl_dngettext (domainname, msgid1, msgid2, n);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
dcngettext (const char *domainname,
|
||||
const char *msgid1, const char *msgid2, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
textdomain (const char *domainname)
|
||||
{
|
||||
return libintl_textdomain (domainname);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
bindtextdomain (const char *domainname, const char *dirname)
|
||||
{
|
||||
return libintl_bindtextdomain (domainname, dirname);
|
||||
}
|
||||
|
||||
|
||||
DLL_EXPORTED
|
||||
char *
|
||||
bind_textdomain_codeset (const char *domainname, const char *codeset)
|
||||
{
|
||||
return libintl_bind_textdomain_codeset (domainname, codeset);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/* List of exported symbols of libintl on Cygwin.
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2006.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* IMP(x) is a symbol that contains the address of x. */
|
||||
#define IMP(x) _imp__##x
|
||||
|
||||
/* Ensure that the variable x is exported from the library, and that a
|
||||
pseudo-variable IMP(x) is available. */
|
||||
#define VARIABLE(x) \
|
||||
/* Export x without redefining x. This code was found by compiling a \
|
||||
snippet: \
|
||||
extern __declspec(dllexport) int x; int x = 42; */ \
|
||||
asm (".section .drectve\n"); \
|
||||
asm (".ascii \" -export:" #x ",data\"\n"); \
|
||||
asm (".data\n"); \
|
||||
/* Allocate a pseudo-variable IMP(x). */ \
|
||||
extern int x; \
|
||||
void * IMP(x) = &x;
|
||||
|
||||
VARIABLE(libintl_version)
|
|
@ -0,0 +1,400 @@
|
|||
/* Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for stpcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if defined _LIBC || defined HAVE_ARGZ_H
|
||||
# include <argz.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
/* On some strange systems still no definition of NULL is found. Sigh! */
|
||||
#ifndef NULL
|
||||
# if defined __STDC__ && __STDC__
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Rename the non ANSI C functions. This is required by the standard
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# ifndef stpcpy
|
||||
# define stpcpy(dest, src) __stpcpy(dest, src)
|
||||
# endif
|
||||
#else
|
||||
# ifndef HAVE_STPCPY
|
||||
static char *stpcpy (char *dest, const char *src);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Pathname support.
|
||||
ISSLASH(C) tests whether C is a directory separator character.
|
||||
IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
|
||||
it may be concatenated to a directory pathname.
|
||||
*/
|
||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
||||
/* Win32, Cygwin, OS/2, DOS */
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
||||
# define HAS_DEVICE(P) \
|
||||
((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
|
||||
&& (P)[1] == ':')
|
||||
# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
|
||||
#else
|
||||
/* Unix */
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
|
||||
#endif
|
||||
|
||||
/* Define function which are usually not available. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __argz_count(argz, len) INTUSE(__argz_count) (argz, len)
|
||||
#elif defined HAVE_ARGZ_COUNT
|
||||
# undef __argz_count
|
||||
# define __argz_count argz_count
|
||||
#else
|
||||
/* Returns the number of strings in ARGZ. */
|
||||
static size_t
|
||||
argz_count__ (const char *argz, size_t len)
|
||||
{
|
||||
size_t count = 0;
|
||||
while (len > 0)
|
||||
{
|
||||
size_t part_len = strlen (argz);
|
||||
argz += part_len + 1;
|
||||
len -= part_len + 1;
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
# undef __argz_count
|
||||
# define __argz_count(argz, len) argz_count__ (argz, len)
|
||||
#endif /* !_LIBC && !HAVE_ARGZ_COUNT */
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __argz_stringify(argz, len, sep) \
|
||||
INTUSE(__argz_stringify) (argz, len, sep)
|
||||
#elif defined HAVE_ARGZ_STRINGIFY
|
||||
# undef __argz_stringify
|
||||
# define __argz_stringify argz_stringify
|
||||
#else
|
||||
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
||||
except the last into the character SEP. */
|
||||
static void
|
||||
argz_stringify__ (char *argz, size_t len, int sep)
|
||||
{
|
||||
while (len > 0)
|
||||
{
|
||||
size_t part_len = strlen (argz);
|
||||
argz += part_len;
|
||||
len -= part_len + 1;
|
||||
if (len > 0)
|
||||
*argz++ = sep;
|
||||
}
|
||||
}
|
||||
# undef __argz_stringify
|
||||
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
|
||||
#endif /* !_LIBC && !HAVE_ARGZ_STRINGIFY */
|
||||
|
||||
#ifdef _LIBC
|
||||
#elif defined HAVE_ARGZ_NEXT
|
||||
# undef __argz_next
|
||||
# define __argz_next argz_next
|
||||
#else
|
||||
static char *
|
||||
argz_next__ (char *argz, size_t argz_len, const char *entry)
|
||||
{
|
||||
if (entry)
|
||||
{
|
||||
if (entry < argz + argz_len)
|
||||
entry = strchr (entry, '\0') + 1;
|
||||
|
||||
return entry >= argz + argz_len ? NULL : (char *) entry;
|
||||
}
|
||||
else
|
||||
if (argz_len > 0)
|
||||
return argz;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
# undef __argz_next
|
||||
# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
|
||||
#endif /* !_LIBC && !HAVE_ARGZ_NEXT */
|
||||
|
||||
|
||||
/* Return number of bits set in X. */
|
||||
static inline int
|
||||
pop (int x)
|
||||
{
|
||||
/* We assume that no more than 16 bits are used. */
|
||||
x = ((x & ~0x5555) >> 1) + (x & 0x5555);
|
||||
x = ((x & ~0x3333) >> 2) + (x & 0x3333);
|
||||
x = ((x >> 4) + x) & 0x0f0f;
|
||||
x = ((x >> 8) + x) & 0xff;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
struct loaded_l10nfile *
|
||||
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
|
||||
const char *dirlist, size_t dirlist_len,
|
||||
int mask, const char *language, const char *territory,
|
||||
const char *codeset, const char *normalized_codeset,
|
||||
const char *modifier,
|
||||
const char *filename, int do_allocate)
|
||||
{
|
||||
char *abs_filename;
|
||||
struct loaded_l10nfile **lastp;
|
||||
struct loaded_l10nfile *retval;
|
||||
char *cp;
|
||||
size_t dirlist_count;
|
||||
size_t entries;
|
||||
int cnt;
|
||||
|
||||
/* If LANGUAGE contains an absolute directory specification, we ignore
|
||||
DIRLIST. */
|
||||
if (IS_ABSOLUTE_PATH (language))
|
||||
dirlist_len = 0;
|
||||
|
||||
/* Allocate room for the full file name. */
|
||||
abs_filename = (char *) malloc (dirlist_len
|
||||
+ strlen (language)
|
||||
+ ((mask & XPG_TERRITORY) != 0
|
||||
? strlen (territory) + 1 : 0)
|
||||
+ ((mask & XPG_CODESET) != 0
|
||||
? strlen (codeset) + 1 : 0)
|
||||
+ ((mask & XPG_NORM_CODESET) != 0
|
||||
? strlen (normalized_codeset) + 1 : 0)
|
||||
+ ((mask & XPG_MODIFIER) != 0
|
||||
? strlen (modifier) + 1 : 0)
|
||||
+ 1 + strlen (filename) + 1);
|
||||
|
||||
if (abs_filename == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Construct file name. */
|
||||
cp = abs_filename;
|
||||
if (dirlist_len > 0)
|
||||
{
|
||||
memcpy (cp, dirlist, dirlist_len);
|
||||
__argz_stringify (cp, dirlist_len, PATH_SEPARATOR);
|
||||
cp += dirlist_len;
|
||||
cp[-1] = '/';
|
||||
}
|
||||
|
||||
cp = stpcpy (cp, language);
|
||||
|
||||
if ((mask & XPG_TERRITORY) != 0)
|
||||
{
|
||||
*cp++ = '_';
|
||||
cp = stpcpy (cp, territory);
|
||||
}
|
||||
if ((mask & XPG_CODESET) != 0)
|
||||
{
|
||||
*cp++ = '.';
|
||||
cp = stpcpy (cp, codeset);
|
||||
}
|
||||
if ((mask & XPG_NORM_CODESET) != 0)
|
||||
{
|
||||
*cp++ = '.';
|
||||
cp = stpcpy (cp, normalized_codeset);
|
||||
}
|
||||
if ((mask & XPG_MODIFIER) != 0)
|
||||
{
|
||||
*cp++ = '@';
|
||||
cp = stpcpy (cp, modifier);
|
||||
}
|
||||
|
||||
*cp++ = '/';
|
||||
stpcpy (cp, filename);
|
||||
|
||||
/* Look in list of already loaded domains whether it is already
|
||||
available. */
|
||||
lastp = l10nfile_list;
|
||||
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
|
||||
if (retval->filename != NULL)
|
||||
{
|
||||
int compare = strcmp (retval->filename, abs_filename);
|
||||
if (compare == 0)
|
||||
/* We found it! */
|
||||
break;
|
||||
if (compare < 0)
|
||||
{
|
||||
/* It's not in the list. */
|
||||
retval = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
lastp = &retval->next;
|
||||
}
|
||||
|
||||
if (retval != NULL || do_allocate == 0)
|
||||
{
|
||||
free (abs_filename);
|
||||
return retval;
|
||||
}
|
||||
|
||||
dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1);
|
||||
|
||||
/* Allocate a new loaded_l10nfile. */
|
||||
retval =
|
||||
(struct loaded_l10nfile *)
|
||||
malloc (sizeof (*retval)
|
||||
+ (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
|
||||
* sizeof (struct loaded_l10nfile *)));
|
||||
if (retval == NULL)
|
||||
{
|
||||
free (abs_filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
retval->filename = abs_filename;
|
||||
|
||||
/* We set retval->data to NULL here; it is filled in later.
|
||||
Setting retval->decided to 1 here means that retval does not
|
||||
correspond to a real file (dirlist_count > 1) or is not worth
|
||||
looking up (if an unnormalized codeset was specified). */
|
||||
retval->decided = (dirlist_count > 1
|
||||
|| ((mask & XPG_CODESET) != 0
|
||||
&& (mask & XPG_NORM_CODESET) != 0));
|
||||
retval->data = NULL;
|
||||
|
||||
retval->next = *lastp;
|
||||
*lastp = retval;
|
||||
|
||||
entries = 0;
|
||||
/* Recurse to fill the inheritance list of RETVAL.
|
||||
If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL
|
||||
entry does not correspond to a real file; retval->filename contains
|
||||
colons. In this case we loop across all elements of DIRLIST and
|
||||
across all bit patterns dominated by MASK.
|
||||
If the DIRLIST is a single directory or entirely redundant (i.e.
|
||||
DIRLIST_COUNT == 1), we loop across all bit patterns dominated by
|
||||
MASK, excluding MASK itself.
|
||||
In either case, we loop down from MASK to 0. This has the effect
|
||||
that the extra bits in the locale name are dropped in this order:
|
||||
first the modifier, then the territory, then the codeset, then the
|
||||
normalized_codeset. */
|
||||
for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
|
||||
if ((cnt & ~mask) == 0
|
||||
&& !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0))
|
||||
{
|
||||
if (dirlist_count > 1)
|
||||
{
|
||||
/* Iterate over all elements of the DIRLIST. */
|
||||
char *dir = NULL;
|
||||
|
||||
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
|
||||
!= NULL)
|
||||
retval->successor[entries++]
|
||||
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
|
||||
cnt, language, territory, codeset,
|
||||
normalized_codeset, modifier, filename,
|
||||
1);
|
||||
}
|
||||
else
|
||||
retval->successor[entries++]
|
||||
= _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
|
||||
cnt, language, territory, codeset,
|
||||
normalized_codeset, modifier, filename, 1);
|
||||
}
|
||||
retval->successor[entries] = NULL;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Normalize codeset name. There is no standard for the codeset
|
||||
names. Normalization allows the user to use any of the common
|
||||
names. The return value is dynamically allocated and has to be
|
||||
freed by the caller. */
|
||||
const char *
|
||||
_nl_normalize_codeset (const char *codeset, size_t name_len)
|
||||
{
|
||||
size_t len = 0;
|
||||
int only_digit = 1;
|
||||
char *retval;
|
||||
char *wp;
|
||||
size_t cnt;
|
||||
|
||||
for (cnt = 0; cnt < name_len; ++cnt)
|
||||
if (isalnum ((unsigned char) codeset[cnt]))
|
||||
{
|
||||
++len;
|
||||
|
||||
if (isalpha ((unsigned char) codeset[cnt]))
|
||||
only_digit = 0;
|
||||
}
|
||||
|
||||
retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
|
||||
|
||||
if (retval != NULL)
|
||||
{
|
||||
if (only_digit)
|
||||
wp = stpcpy (retval, "iso");
|
||||
else
|
||||
wp = retval;
|
||||
|
||||
for (cnt = 0; cnt < name_len; ++cnt)
|
||||
if (isalpha ((unsigned char) codeset[cnt]))
|
||||
*wp++ = tolower ((unsigned char) codeset[cnt]);
|
||||
else if (isdigit ((unsigned char) codeset[cnt]))
|
||||
*wp++ = codeset[cnt];
|
||||
|
||||
*wp = '\0';
|
||||
}
|
||||
|
||||
return (const char *) retval;
|
||||
}
|
||||
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
/* We don't want libintl.a to depend on any other library. So we
|
||||
avoid the non-standard function stpcpy. In GNU C Library this
|
||||
function is available, though. Also allow the symbol HAVE_STPCPY
|
||||
to be defined. */
|
||||
#if !_LIBC && !HAVE_STPCPY
|
||||
static char *
|
||||
stpcpy (char *dest, const char *src)
|
||||
{
|
||||
while ((*dest++ = *src++) != '\0')
|
||||
/* Do nothing. */ ;
|
||||
return dest - 1;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,355 @@
|
|||
/* Determine the user's language preferences.
|
||||
Copyright (C) 2004-2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>.
|
||||
Win32 code originally by Michele Cicciotti <hackbunny@reactos.com>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_CFPREFERENCESCOPYAPPVALUE
|
||||
# include <string.h>
|
||||
# include <CoreFoundation/CFPreferences.h>
|
||||
# include <CoreFoundation/CFPropertyList.h>
|
||||
# include <CoreFoundation/CFArray.h>
|
||||
# include <CoreFoundation/CFString.h>
|
||||
extern void _nl_locale_name_canonicalize (char *name);
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# define WIN32_NATIVE
|
||||
#endif
|
||||
|
||||
#ifdef WIN32_NATIVE
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
# ifndef MUI_LANGUAGE_NAME
|
||||
# define MUI_LANGUAGE_NAME 8
|
||||
# endif
|
||||
# ifndef STATUS_BUFFER_OVERFLOW
|
||||
# define STATUS_BUFFER_OVERFLOW 0x80000005
|
||||
# endif
|
||||
|
||||
extern void _nl_locale_name_canonicalize (char *name);
|
||||
extern const char *_nl_locale_name_from_win32_LANGID (LANGID langid);
|
||||
extern const char *_nl_locale_name_from_win32_LCID (LCID lcid);
|
||||
|
||||
/* Get the preferences list through the MUI APIs. This works on Windows Vista
|
||||
and newer. */
|
||||
static const char *
|
||||
_nl_language_preferences_win32_mui (HMODULE kernel32)
|
||||
{
|
||||
/* DWORD GetUserPreferredUILanguages (ULONG dwFlags,
|
||||
PULONG pulNumLanguages,
|
||||
PWSTR pwszLanguagesBuffer,
|
||||
PULONG pcchLanguagesBuffer); */
|
||||
typedef DWORD (WINAPI *GetUserPreferredUILanguages_func) (ULONG, PULONG, PWSTR, PULONG);
|
||||
GetUserPreferredUILanguages_func p_GetUserPreferredUILanguages;
|
||||
|
||||
p_GetUserPreferredUILanguages =
|
||||
(GetUserPreferredUILanguages_func)
|
||||
GetProcAddress (kernel32, "GetUserPreferredUILanguages");
|
||||
if (p_GetUserPreferredUILanguages != NULL)
|
||||
{
|
||||
ULONG num_languages;
|
||||
ULONG bufsize;
|
||||
DWORD ret;
|
||||
|
||||
bufsize = 0;
|
||||
ret = p_GetUserPreferredUILanguages (MUI_LANGUAGE_NAME,
|
||||
&num_languages,
|
||||
NULL, &bufsize);
|
||||
if (ret == 0
|
||||
&& GetLastError () == STATUS_BUFFER_OVERFLOW
|
||||
&& bufsize > 0)
|
||||
{
|
||||
WCHAR *buffer = (WCHAR *) malloc (bufsize * sizeof (WCHAR));
|
||||
if (buffer != NULL)
|
||||
{
|
||||
ret = p_GetUserPreferredUILanguages (MUI_LANGUAGE_NAME,
|
||||
&num_languages,
|
||||
buffer, &bufsize);
|
||||
if (ret)
|
||||
{
|
||||
/* Convert the list from NUL-delimited WCHAR[] Win32 locale
|
||||
names to colon-delimited char[] Unix locale names.
|
||||
We assume that all these locale names are in ASCII,
|
||||
nonempty and contain no colons. */
|
||||
char *languages =
|
||||
(char *) malloc (bufsize + num_languages * 10 + 1);
|
||||
if (languages != NULL)
|
||||
{
|
||||
const WCHAR *p = buffer;
|
||||
char *q = languages;
|
||||
ULONG i;
|
||||
for (i = 0; i < num_languages; i++)
|
||||
{
|
||||
char *q1;
|
||||
char *q2;
|
||||
|
||||
q1 = q;
|
||||
if (i > 0)
|
||||
*q++ = ':';
|
||||
q2 = q;
|
||||
for (; *p != (WCHAR)'\0'; p++)
|
||||
{
|
||||
if ((unsigned char) *p != *p || *p == ':')
|
||||
{
|
||||
/* A non-ASCII character or a colon inside
|
||||
the Win32 locale name! Punt. */
|
||||
q = q1;
|
||||
break;
|
||||
}
|
||||
*q++ = (unsigned char) *p;
|
||||
}
|
||||
if (q == q1)
|
||||
/* An unexpected Win32 locale name occurred. */
|
||||
break;
|
||||
*q = '\0';
|
||||
_nl_locale_name_canonicalize (q2);
|
||||
q = q2 + strlen (q2);
|
||||
p++;
|
||||
}
|
||||
*q = '\0';
|
||||
if (q > languages)
|
||||
{
|
||||
free (buffer);
|
||||
return languages;
|
||||
}
|
||||
free (languages);
|
||||
}
|
||||
}
|
||||
free (buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get a preference. This works on Windows ME and newer. */
|
||||
static const char *
|
||||
_nl_language_preferences_win32_ME (HMODULE kernel32)
|
||||
{
|
||||
/* LANGID GetUserDefaultUILanguage (void); */
|
||||
typedef LANGID (WINAPI *GetUserDefaultUILanguage_func) (void);
|
||||
GetUserDefaultUILanguage_func p_GetUserDefaultUILanguage;
|
||||
|
||||
p_GetUserDefaultUILanguage =
|
||||
(GetUserDefaultUILanguage_func)
|
||||
GetProcAddress (kernel32, "GetUserDefaultUILanguage");
|
||||
if (p_GetUserDefaultUILanguage != NULL)
|
||||
return _nl_locale_name_from_win32_LANGID (p_GetUserDefaultUILanguage ());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get a preference. This works on Windows 95 and newer. */
|
||||
static const char *
|
||||
_nl_language_preferences_win32_95 ()
|
||||
{
|
||||
HKEY desktop_resource_locale_key;
|
||||
|
||||
if (RegOpenKeyExA (HKEY_CURRENT_USER,
|
||||
"Control Panel\\Desktop\\ResourceLocale",
|
||||
0, KEY_QUERY_VALUE, &desktop_resource_locale_key)
|
||||
== NO_ERROR)
|
||||
{
|
||||
DWORD type;
|
||||
char data[8 + 1];
|
||||
DWORD data_size = sizeof (data);
|
||||
DWORD ret;
|
||||
|
||||
ret = RegQueryValueExA (desktop_resource_locale_key, NULL, NULL,
|
||||
&type, data, &data_size);
|
||||
RegCloseKey (desktop_resource_locale_key);
|
||||
|
||||
if (ret == NO_ERROR)
|
||||
{
|
||||
/* We expect a string, at most 8 bytes long, that parses as a
|
||||
hexadecimal number. */
|
||||
if (type == REG_SZ
|
||||
&& data_size <= sizeof (data)
|
||||
&& (data_size < sizeof (data)
|
||||
|| data[sizeof (data) - 1] == '\0'))
|
||||
{
|
||||
LCID lcid;
|
||||
char *endp;
|
||||
/* Ensure it's NUL terminated. */
|
||||
if (data_size < sizeof (data))
|
||||
data[data_size] = '\0';
|
||||
/* Parse it as a hexadecimal number. */
|
||||
lcid = strtoul (data, &endp, 16);
|
||||
if (endp > data && *endp == '\0')
|
||||
return _nl_locale_name_from_win32_LCID (lcid);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get the system's preference. This can be used as a fallback. */
|
||||
static BOOL CALLBACK
|
||||
ret_first_language (HMODULE h, LPCSTR type, LPCSTR name, WORD lang, LONG_PTR param)
|
||||
{
|
||||
*(const char **)param = _nl_locale_name_from_win32_LANGID (lang);
|
||||
return FALSE;
|
||||
}
|
||||
static const char *
|
||||
_nl_language_preferences_win32_system (HMODULE kernel32)
|
||||
{
|
||||
const char *languages = NULL;
|
||||
/* Ignore the warning on mingw here. mingw has a wrong definition of the last
|
||||
parameter type of ENUMRESLANGPROC. */
|
||||
EnumResourceLanguages (kernel32, RT_VERSION, MAKEINTRESOURCE (1),
|
||||
ret_first_language, (LONG_PTR)&languages);
|
||||
return languages;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Determine the user's language preferences, as a colon separated list of
|
||||
locale names in XPG syntax
|
||||
language[_territory][.codeset][@modifier]
|
||||
The result must not be freed; it is statically allocated.
|
||||
The LANGUAGE environment variable does not need to be considered; it is
|
||||
already taken into account by the caller. */
|
||||
|
||||
const char *
|
||||
_nl_language_preferences_default (void)
|
||||
{
|
||||
#if HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */
|
||||
{
|
||||
/* Cache the preferences list, since CoreFoundation calls are expensive. */
|
||||
static const char *cached_languages;
|
||||
static int cache_initialized;
|
||||
|
||||
if (!cache_initialized)
|
||||
{
|
||||
CFTypeRef preferences =
|
||||
CFPreferencesCopyAppValue (CFSTR ("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
if (preferences != NULL
|
||||
&& CFGetTypeID (preferences) == CFArrayGetTypeID ())
|
||||
{
|
||||
CFArrayRef prefArray = (CFArrayRef)preferences;
|
||||
int n = CFArrayGetCount (prefArray);
|
||||
char buf[256];
|
||||
size_t size = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
CFTypeRef element = CFArrayGetValueAtIndex (prefArray, i);
|
||||
if (element != NULL
|
||||
&& CFGetTypeID (element) == CFStringGetTypeID ()
|
||||
&& CFStringGetCString ((CFStringRef)element,
|
||||
buf, sizeof (buf),
|
||||
kCFStringEncodingASCII))
|
||||
{
|
||||
_nl_locale_name_canonicalize (buf);
|
||||
size += strlen (buf) + 1;
|
||||
/* Most GNU programs use msgids in English and don't ship
|
||||
an en.mo message catalog. Therefore when we see "en"
|
||||
in the preferences list, arrange for gettext() to
|
||||
return the msgid, and ignore all further elements of
|
||||
the preferences list. */
|
||||
if (strcmp (buf, "en") == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (size > 0)
|
||||
{
|
||||
char *languages = (char *) malloc (size);
|
||||
|
||||
if (languages != NULL)
|
||||
{
|
||||
char *p = languages;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
CFTypeRef element =
|
||||
CFArrayGetValueAtIndex (prefArray, i);
|
||||
if (element != NULL
|
||||
&& CFGetTypeID (element) == CFStringGetTypeID ()
|
||||
&& CFStringGetCString ((CFStringRef)element,
|
||||
buf, sizeof (buf),
|
||||
kCFStringEncodingASCII))
|
||||
{
|
||||
_nl_locale_name_canonicalize (buf);
|
||||
strcpy (p, buf);
|
||||
p += strlen (buf);
|
||||
*p++ = ':';
|
||||
if (strcmp (buf, "en") == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
*--p = '\0';
|
||||
|
||||
cached_languages = languages;
|
||||
}
|
||||
}
|
||||
}
|
||||
cache_initialized = 1;
|
||||
}
|
||||
if (cached_languages != NULL)
|
||||
return cached_languages;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32_NATIVE
|
||||
{
|
||||
/* Cache the preferences list, since computing it is expensive. */
|
||||
static const char *cached_languages;
|
||||
static int cache_initialized;
|
||||
|
||||
/* Activate the new code only when the GETTEXT_MUI environment variable is
|
||||
set, for the time being, since the new code is not well tested. */
|
||||
if (!cache_initialized && getenv ("GETTEXT_MUI") != NULL)
|
||||
{
|
||||
const char *languages = NULL;
|
||||
HMODULE kernel32 = GetModuleHandle ("kernel32");
|
||||
|
||||
if (kernel32 != NULL)
|
||||
languages = _nl_language_preferences_win32_mui (kernel32);
|
||||
|
||||
if (languages == NULL && kernel32 != NULL)
|
||||
languages = _nl_language_preferences_win32_ME (kernel32);
|
||||
|
||||
if (languages == NULL)
|
||||
languages = _nl_language_preferences_win32_95 ();
|
||||
|
||||
if (languages == NULL && kernel32 != NULL)
|
||||
languages = _nl_language_preferences_win32_system (kernel32);
|
||||
|
||||
cached_languages = languages;
|
||||
cache_initialized = 1;
|
||||
}
|
||||
if (cached_languages != NULL)
|
||||
return cached_languages;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,466 @@
|
|||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995-1997, 2000-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#include <locale.h>
|
||||
#if (defined __APPLE__ && defined __MACH__) && @HAVE_NEWLOCALE@
|
||||
# include <xlocale.h>
|
||||
#endif
|
||||
|
||||
/* The LC_MESSAGES locale category is the category used by the functions
|
||||
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
|
||||
On systems that don't define it, use an arbitrary value instead.
|
||||
On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
|
||||
then includes <libintl.h> (i.e. this file!) and then only defines
|
||||
LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
|
||||
in this case. */
|
||||
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
|
||||
# define LC_MESSAGES 1729
|
||||
#endif
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
/* Provide information about the supported file formats. Returns the
|
||||
maximum minor revision number supported for a given major revision. */
|
||||
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
|
||||
((major) == 0 || (major) == 1 ? 1 : -1)
|
||||
|
||||
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
|
||||
precedence over _conio_gettext. */
|
||||
#ifdef __DJGPP__
|
||||
# undef gettext
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number: (major<<16) + (minor<<8) + subminor */
|
||||
#define LIBINTL_VERSION 0x001201
|
||||
extern int libintl_version;
|
||||
|
||||
|
||||
/* We redirect the functions to those prefixed with "libintl_". This is
|
||||
necessary, because some systems define gettext/textdomain/... in the C
|
||||
library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
|
||||
If we used the unprefixed names, there would be cases where the
|
||||
definition in the C library would override the one in the libintl.so
|
||||
shared library. Recall that on ELF systems, the symbols are looked
|
||||
up in the following order:
|
||||
1. in the executable,
|
||||
2. in the shared libraries specified on the link command line, in order,
|
||||
3. in the dependencies of the shared libraries specified on the link
|
||||
command line,
|
||||
4. in the dlopen()ed shared libraries, in the order in which they were
|
||||
dlopen()ed.
|
||||
The definition in the C library would override the one in libintl.so if
|
||||
either
|
||||
* -lc is given on the link command line and -lintl isn't, or
|
||||
* -lc is given on the link command line before -lintl, or
|
||||
* libintl.so is a dependency of a dlopen()ed shared library but not
|
||||
linked to the executable at link time.
|
||||
Since Solaris gettext() behaves differently than GNU gettext(), this
|
||||
would be unacceptable.
|
||||
|
||||
The redirection happens by default through macros in C, so that &gettext
|
||||
is independent of the compilation unit, but through inline functions in
|
||||
C++, in order not to interfere with the name mangling of class fields or
|
||||
class methods called 'gettext'. */
|
||||
|
||||
/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
|
||||
If he doesn't, we choose the method. A third possible method is
|
||||
_INTL_REDIRECT_ASM, supported only by GCC. */
|
||||
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
|
||||
# if defined __GNUC__ && __GNUC__ >= 2 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
|
||||
# define _INTL_REDIRECT_ASM
|
||||
# else
|
||||
# ifdef __cplusplus
|
||||
# define _INTL_REDIRECT_INLINE
|
||||
# else
|
||||
# define _INTL_REDIRECT_MACROS
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* Auxiliary macros. */
|
||||
#ifdef _INTL_REDIRECT_ASM
|
||||
# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
|
||||
# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
|
||||
# define _INTL_STRINGIFY(prefix) #prefix
|
||||
#else
|
||||
# define _INTL_ASM(cname)
|
||||
#endif
|
||||
|
||||
/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
|
||||
its n-th argument literally. This enables GCC to warn for example about
|
||||
printf (gettext ("foo %y")). */
|
||||
#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && defined __cplusplus)
|
||||
# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
|
||||
#else
|
||||
# define _INTL_MAY_RETURN_STRING_ARG(n)
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_gettext (const char *__msgid)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1);
|
||||
static inline char *gettext (const char *__msgid)
|
||||
{
|
||||
return libintl_gettext (__msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define gettext libintl_gettext
|
||||
#endif
|
||||
extern char *gettext (const char *__msgid)
|
||||
_INTL_ASM (libintl_gettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *dgettext (const char *__domainname, const char *__msgid)
|
||||
{
|
||||
return libintl_dgettext (__domainname, __msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dgettext libintl_dgettext
|
||||
#endif
|
||||
extern char *dgettext (const char *__domainname, const char *__msgid)
|
||||
_INTL_ASM (libintl_dgettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
{
|
||||
return libintl_dcgettext (__domainname, __msgid, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcgettext libintl_dcgettext
|
||||
#endif
|
||||
extern char *dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
_INTL_ASM (libintl_dcgettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
|
||||
/* Similar to `gettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
{
|
||||
return libintl_ngettext (__msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define ngettext libintl_ngettext
|
||||
#endif
|
||||
extern char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_ASM (libintl_ngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
static inline char *dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
{
|
||||
return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dngettext libintl_dngettext
|
||||
#endif
|
||||
extern char *dngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_ASM (libintl_dngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
#endif
|
||||
|
||||
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
static inline char *dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
{
|
||||
return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcngettext libintl_dcngettext
|
||||
#endif
|
||||
extern char *dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
_INTL_ASM (libintl_dcngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef IN_LIBGLOCALE
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_textdomain (const char *__domainname);
|
||||
static inline char *textdomain (const char *__domainname)
|
||||
{
|
||||
return libintl_textdomain (__domainname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define textdomain libintl_textdomain
|
||||
#endif
|
||||
extern char *textdomain (const char *__domainname)
|
||||
_INTL_ASM (libintl_textdomain);
|
||||
#endif
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bindtextdomain (const char *__domainname,
|
||||
const char *__dirname);
|
||||
static inline char *bindtextdomain (const char *__domainname,
|
||||
const char *__dirname)
|
||||
{
|
||||
return libintl_bindtextdomain (__domainname, __dirname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bindtextdomain libintl_bindtextdomain
|
||||
#endif
|
||||
extern char *bindtextdomain (const char *__domainname, const char *__dirname)
|
||||
_INTL_ASM (libintl_bindtextdomain);
|
||||
#endif
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset);
|
||||
static inline char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset)
|
||||
{
|
||||
return libintl_bind_textdomain_codeset (__domainname, __codeset);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
|
||||
#endif
|
||||
extern char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset)
|
||||
_INTL_ASM (libintl_bind_textdomain_codeset);
|
||||
#endif
|
||||
|
||||
#endif /* IN_LIBGLOCALE */
|
||||
|
||||
|
||||
/* Support for format strings with positions in *printf(), following the
|
||||
POSIX/XSI specification.
|
||||
Note: These replacements for the *printf() functions are visible only
|
||||
in source files that #include <libintl.h> or #include "gettext.h".
|
||||
Packages that use *printf() in source files that don't refer to _()
|
||||
or gettext() but for which the format string could be the return value
|
||||
of _() or gettext() need to add this #include. Oh well. */
|
||||
|
||||
#if !@HAVE_POSIX_PRINTF@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Get va_list. */
|
||||
#if (defined __STDC__ && __STDC__) || defined __cplusplus || defined _MSC_VER
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#if !(defined fprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef fprintf
|
||||
#define fprintf libintl_fprintf
|
||||
extern int fprintf (FILE *, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vfprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vfprintf
|
||||
#define vfprintf libintl_vfprintf
|
||||
extern int vfprintf (FILE *, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if !(defined printf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef printf
|
||||
#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
|
||||
/* Don't break __attribute__((format(printf,M,N))).
|
||||
This redefinition is only possible because the libc in NetBSD, Cygwin,
|
||||
mingw does not have a function __printf__.
|
||||
Alternatively, we could have done this redirection only when compiling with
|
||||
__GNUC__, together with a symbol redirection:
|
||||
extern int printf (const char *, ...)
|
||||
__asm__ (#__USER_LABEL_PREFIX__ "libintl_printf");
|
||||
But doing it now would introduce a binary incompatibility with already
|
||||
distributed versions of libintl on these systems. */
|
||||
# define libintl_printf __printf__
|
||||
#endif
|
||||
#define printf libintl_printf
|
||||
extern int printf (const char *, ...);
|
||||
#endif
|
||||
#if !(defined vprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vprintf
|
||||
#define vprintf libintl_vprintf
|
||||
extern int vprintf (const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if !(defined sprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef sprintf
|
||||
#define sprintf libintl_sprintf
|
||||
extern int sprintf (char *, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vsprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vsprintf
|
||||
#define vsprintf libintl_vsprintf
|
||||
extern int vsprintf (char *, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if @HAVE_SNPRINTF@
|
||||
|
||||
#if !(defined snprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef snprintf
|
||||
#define snprintf libintl_snprintf
|
||||
extern int snprintf (char *, size_t, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vsnprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vsnprintf
|
||||
#define vsnprintf libintl_vsnprintf
|
||||
extern int vsnprintf (char *, size_t, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if @HAVE_ASPRINTF@
|
||||
|
||||
#if !(defined asprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef asprintf
|
||||
#define asprintf libintl_asprintf
|
||||
extern int asprintf (char **, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vasprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vasprintf
|
||||
#define vasprintf libintl_vasprintf
|
||||
extern int vasprintf (char **, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if @HAVE_WPRINTF@
|
||||
|
||||
#undef fwprintf
|
||||
#define fwprintf libintl_fwprintf
|
||||
extern int fwprintf (FILE *, const wchar_t *, ...);
|
||||
#undef vfwprintf
|
||||
#define vfwprintf libintl_vfwprintf
|
||||
extern int vfwprintf (FILE *, const wchar_t *, va_list);
|
||||
|
||||
#undef wprintf
|
||||
#define wprintf libintl_wprintf
|
||||
extern int wprintf (const wchar_t *, ...);
|
||||
#undef vwprintf
|
||||
#define vwprintf libintl_vwprintf
|
||||
extern int vwprintf (const wchar_t *, va_list);
|
||||
|
||||
#undef swprintf
|
||||
#define swprintf libintl_swprintf
|
||||
extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
|
||||
#undef vswprintf
|
||||
#define vswprintf libintl_vswprintf
|
||||
extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for the locale chosen by the user. */
|
||||
#if (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
|
||||
|
||||
#undef setlocale
|
||||
#define setlocale libintl_setlocale
|
||||
extern char *setlocale (int, const char *);
|
||||
|
||||
#if @HAVE_NEWLOCALE@
|
||||
|
||||
#undef newlocale
|
||||
#define newlocale libintl_newlocale
|
||||
extern locale_t newlocale (int, const char *, locale_t);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
#define libintl_set_relocation_prefix libintl_set_relocation_prefix
|
||||
extern void
|
||||
libintl_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libintl.h */
|
|
@ -0,0 +1,38 @@
|
|||
/* Resources for intl.dll */
|
||||
|
||||
#include <winver.h>
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PACKAGE_VERSION_MAJOR,PACKAGE_VERSION_MINOR,PACKAGE_VERSION_SUBMINOR,0
|
||||
PRODUCTVERSION PACKAGE_VERSION_MAJOR,PACKAGE_VERSION_MINOR,PACKAGE_VERSION_SUBMINOR,0
|
||||
FILEFLAGSMASK 0x3fL /* VS_FFI_FILEFLAGSMASK */
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L /* VS_FF_DEBUG */
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x10004L /* VOS_DOS_WINDOWS32 */
|
||||
FILETYPE 0x2L /* VFT_DLL */
|
||||
FILESUBTYPE 0x0L /* VFT2_UNKNOWN */
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "04090000" /* Lang = US English, Charset = ASCII */
|
||||
BEGIN
|
||||
VALUE "Comments", "This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\0"
|
||||
VALUE "CompanyName", "Free Software Foundation\0"
|
||||
VALUE "FileDescription", "LGPLed libintl for Windows NT/2000/XP/Vista/7 and Windows 95/98/ME\0"
|
||||
VALUE "FileVersion", PACKAGE_VERSION_STRING "\0"
|
||||
VALUE "InternalName", "intl.dll\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 1995-2010\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "intl.dll\0"
|
||||
VALUE "ProductName", "libintl: accessing NLS message catalogs\0"
|
||||
VALUE "ProductVersion", PACKAGE_VERSION_STRING "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 0 /* US English, ASCII */
|
||||
END
|
||||
END
|
|
@ -0,0 +1,132 @@
|
|||
/* Copyright (C) 1996-1999, 2000-2003, 2005-2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _LOADINFO_H
|
||||
#define _LOADINFO_H 1
|
||||
|
||||
/* Declarations of locale dependent catalog lookup functions.
|
||||
Implemented in
|
||||
|
||||
localealias.c Possibly replace a locale name by another.
|
||||
explodename.c Split a locale name into its various fields.
|
||||
l10nflist.c Generate a list of filenames of possible message catalogs.
|
||||
finddomain.c Find and open the relevant message catalogs.
|
||||
|
||||
The main function _nl_find_domain() in finddomain.c is declared
|
||||
in gettextP.h.
|
||||
*/
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
#ifndef LIBINTL_DLL_EXPORTED
|
||||
# define LIBINTL_DLL_EXPORTED
|
||||
#endif
|
||||
|
||||
/* Tell the compiler when a conditional or integer expression is
|
||||
almost always true or almost always false. */
|
||||
#ifndef HAVE_BUILTIN_EXPECT
|
||||
# define __builtin_expect(expr, val) (expr)
|
||||
#endif
|
||||
|
||||
/* Separator in PATH like lists of pathnames. */
|
||||
#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
|
||||
/* Win32, OS/2, DOS */
|
||||
# define PATH_SEPARATOR ';'
|
||||
#else
|
||||
/* Unix */
|
||||
# define PATH_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
/* Encoding of locale name parts. */
|
||||
#define XPG_NORM_CODESET 1
|
||||
#define XPG_CODESET 2
|
||||
#define XPG_TERRITORY 4
|
||||
#define XPG_MODIFIER 8
|
||||
|
||||
|
||||
struct loaded_l10nfile
|
||||
{
|
||||
const char *filename;
|
||||
int decided;
|
||||
|
||||
const void *data;
|
||||
|
||||
struct loaded_l10nfile *next;
|
||||
struct loaded_l10nfile *successor[1];
|
||||
};
|
||||
|
||||
|
||||
/* Normalize codeset name. There is no standard for the codeset
|
||||
names. Normalization allows the user to use any of the common
|
||||
names. The return value is dynamically allocated and has to be
|
||||
freed by the caller. */
|
||||
extern const char *_nl_normalize_codeset (const char *codeset,
|
||||
size_t name_len);
|
||||
|
||||
/* Lookup a locale dependent file.
|
||||
*L10NFILE_LIST denotes a pool of lookup results of locale dependent
|
||||
files of the same kind, sorted in decreasing order of ->filename.
|
||||
DIRLIST and DIRLIST_LEN are an argz list of directories in which to
|
||||
look, containing at least one directory (i.e. DIRLIST_LEN > 0).
|
||||
MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER
|
||||
are the pieces of the locale name, as produced by _nl_explode_name().
|
||||
FILENAME is the filename suffix.
|
||||
The return value is the lookup result, either found in *L10NFILE_LIST,
|
||||
or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
|
||||
If the return value is non-NULL, it is added to *L10NFILE_LIST, and
|
||||
its ->next field denotes the chaining inside *L10NFILE_LIST, and
|
||||
furthermore its ->successor[] field contains a list of other lookup
|
||||
results from which this lookup result inherits. */
|
||||
extern struct loaded_l10nfile *
|
||||
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
|
||||
const char *dirlist, size_t dirlist_len, int mask,
|
||||
const char *language, const char *territory,
|
||||
const char *codeset, const char *normalized_codeset,
|
||||
const char *modifier,
|
||||
const char *filename, int do_allocate);
|
||||
|
||||
/* Lookup the real locale name for a locale alias NAME, or NULL if
|
||||
NAME is not a locale alias (but possibly a real locale name).
|
||||
The return value is statically allocated and must not be freed. */
|
||||
/* Part of the libintl ABI only for the sake of the gettext.m4 macro. */
|
||||
extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
|
||||
|
||||
/* Split a locale name NAME into its pieces: language, modifier,
|
||||
territory, codeset.
|
||||
NAME gets destructively modified: NUL bytes are inserted here and
|
||||
there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY,
|
||||
*CODESET gets assigned either a pointer into the old NAME string, or
|
||||
NULL. *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it
|
||||
is different from *CODESET; this one is dynamically allocated and has
|
||||
to be freed by the caller.
|
||||
The return value is a bitmask, where each bit corresponds to one
|
||||
filled-in value:
|
||||
XPG_MODIFIER for *MODIFIER,
|
||||
XPG_TERRITORY for *TERRITORY,
|
||||
XPG_CODESET for *CODESET,
|
||||
XPG_NORM_CODESET for *NORMALIZED_CODESET.
|
||||
*/
|
||||
extern int _nl_explode_name (char *name, const char **language,
|
||||
const char **modifier, const char **territory,
|
||||
const char **codeset,
|
||||
const char **normalized_codeset);
|
||||
|
||||
#endif /* loadinfo.h */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,549 @@
|
|||
/* Determine a canonical name for the current locale's character encoding.
|
||||
|
||||
Copyright (C) 2000-2006, 2008-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "localcharset.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
|
||||
# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# define WIN32_NATIVE
|
||||
#endif
|
||||
|
||||
#if defined __EMX__
|
||||
/* Assume EMX program runs on OS/2, even if compiled under DOS. */
|
||||
# ifndef OS2
|
||||
# define OS2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined WIN32_NATIVE
|
||||
# include <unistd.h>
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
# else
|
||||
# if 0 /* see comment below */
|
||||
# include <locale.h>
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __CYGWIN__
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# endif
|
||||
#elif defined WIN32_NATIVE
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#if defined OS2
|
||||
# define INCL_DOS
|
||||
# include <os2.h>
|
||||
#endif
|
||||
|
||||
#if ENABLE_RELOCATABLE
|
||||
# include "relocatable.h"
|
||||
#else
|
||||
# define relocate(pathname) (pathname)
|
||||
#endif
|
||||
|
||||
/* Get LIBDIR. */
|
||||
#ifndef LIBDIR
|
||||
# include "configmake.h"
|
||||
#endif
|
||||
|
||||
/* Define O_NOFOLLOW to 0 on platforms where it does not exist. */
|
||||
#ifndef O_NOFOLLOW
|
||||
# define O_NOFOLLOW 0
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
||||
/* Win32, Cygwin, OS/2, DOS */
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
||||
#endif
|
||||
|
||||
#ifndef DIRECTORY_SEPARATOR
|
||||
# define DIRECTORY_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_GETC_UNLOCKED
|
||||
# undef getc
|
||||
# define getc getc_unlocked
|
||||
#endif
|
||||
|
||||
/* The following static variable is declared 'volatile' to avoid a
|
||||
possible multithread problem in the function get_charset_aliases. If we
|
||||
are running in a threaded environment, and if two threads initialize
|
||||
'charset_aliases' simultaneously, both will produce the same value,
|
||||
and everything will be ok if the two assignments to 'charset_aliases'
|
||||
are atomic. But I don't know what will happen if the two assignments mix. */
|
||||
#if __STDC__ != 1
|
||||
# define volatile /* empty */
|
||||
#endif
|
||||
/* Pointer to the contents of the charset.alias file, if it has already been
|
||||
read, else NULL. Its format is:
|
||||
ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
|
||||
static const char * volatile charset_aliases;
|
||||
|
||||
/* Return a pointer to the contents of the charset.alias file. */
|
||||
static const char *
|
||||
get_charset_aliases (void)
|
||||
{
|
||||
const char *cp;
|
||||
|
||||
cp = charset_aliases;
|
||||
if (cp == NULL)
|
||||
{
|
||||
#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
|
||||
const char *dir;
|
||||
const char *base = "charset.alias";
|
||||
char *file_name;
|
||||
|
||||
/* Make it possible to override the charset.alias location. This is
|
||||
necessary for running the testsuite before "make install". */
|
||||
dir = getenv ("CHARSETALIASDIR");
|
||||
if (dir == NULL || dir[0] == '\0')
|
||||
dir = relocate (LIBDIR);
|
||||
|
||||
/* Concatenate dir and base into freshly allocated file_name. */
|
||||
{
|
||||
size_t dir_len = strlen (dir);
|
||||
size_t base_len = strlen (base);
|
||||
int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
|
||||
file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
|
||||
if (file_name != NULL)
|
||||
{
|
||||
memcpy (file_name, dir, dir_len);
|
||||
if (add_slash)
|
||||
file_name[dir_len] = DIRECTORY_SEPARATOR;
|
||||
memcpy (file_name + dir_len + add_slash, base, base_len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name == NULL)
|
||||
/* Out of memory. Treat the file as empty. */
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
int fd;
|
||||
|
||||
/* Open the file. Reject symbolic links on platforms that support
|
||||
O_NOFOLLOW. This is a security feature. Without it, an attacker
|
||||
could retrieve parts of the contents (namely, the tail of the
|
||||
first line that starts with "* ") of an arbitrary file by placing
|
||||
a symbolic link to that file under the name "charset.alias" in
|
||||
some writable directory and defining the environment variable
|
||||
CHARSETALIASDIR to point to that directory. */
|
||||
fd = open (file_name,
|
||||
O_RDONLY | (HAVE_WORKING_O_NOFOLLOW ? O_NOFOLLOW : 0));
|
||||
if (fd < 0)
|
||||
/* File not found. Treat it as empty. */
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fdopen (fd, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
/* Out of memory. Treat the file as empty. */
|
||||
close (fd);
|
||||
cp = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Parse the file's contents. */
|
||||
char *res_ptr = NULL;
|
||||
size_t res_size = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int c;
|
||||
char buf1[50+1];
|
||||
char buf2[50+1];
|
||||
size_t l1, l2;
|
||||
char *old_res_ptr;
|
||||
|
||||
c = getc (fp);
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (c == '\n' || c == ' ' || c == '\t')
|
||||
continue;
|
||||
if (c == '#')
|
||||
{
|
||||
/* Skip comment, to end of line. */
|
||||
do
|
||||
c = getc (fp);
|
||||
while (!(c == EOF || c == '\n'));
|
||||
if (c == EOF)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
ungetc (c, fp);
|
||||
if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
|
||||
break;
|
||||
l1 = strlen (buf1);
|
||||
l2 = strlen (buf2);
|
||||
old_res_ptr = res_ptr;
|
||||
if (res_size == 0)
|
||||
{
|
||||
res_size = l1 + 1 + l2 + 1;
|
||||
res_ptr = (char *) malloc (res_size + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
res_size += l1 + 1 + l2 + 1;
|
||||
res_ptr = (char *) realloc (res_ptr, res_size + 1);
|
||||
}
|
||||
if (res_ptr == NULL)
|
||||
{
|
||||
/* Out of memory. */
|
||||
res_size = 0;
|
||||
if (old_res_ptr != NULL)
|
||||
free (old_res_ptr);
|
||||
break;
|
||||
}
|
||||
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
|
||||
strcpy (res_ptr + res_size - (l2 + 1), buf2);
|
||||
}
|
||||
fclose (fp);
|
||||
if (res_size == 0)
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
*(res_ptr + res_size) = '\0';
|
||||
cp = res_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free (file_name);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# if defined DARWIN7
|
||||
/* To avoid the trouble of installing a file that is shared by many
|
||||
GNU packages -- many packaging systems have problems with this --,
|
||||
simply inline the aliases here. */
|
||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
||||
"ISO8859-4" "\0" "ISO-8859-4" "\0"
|
||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
||||
"ISO8859-13" "\0" "ISO-8859-13" "\0"
|
||||
"ISO8859-15" "\0" "ISO-8859-15" "\0"
|
||||
"KOI8-R" "\0" "KOI8-R" "\0"
|
||||
"KOI8-U" "\0" "KOI8-U" "\0"
|
||||
"CP866" "\0" "CP866" "\0"
|
||||
"CP949" "\0" "CP949" "\0"
|
||||
"CP1131" "\0" "CP1131" "\0"
|
||||
"CP1251" "\0" "CP1251" "\0"
|
||||
"eucCN" "\0" "GB2312" "\0"
|
||||
"GB2312" "\0" "GB2312" "\0"
|
||||
"eucJP" "\0" "EUC-JP" "\0"
|
||||
"eucKR" "\0" "EUC-KR" "\0"
|
||||
"Big5" "\0" "BIG5" "\0"
|
||||
"Big5HKSCS" "\0" "BIG5-HKSCS" "\0"
|
||||
"GBK" "\0" "GBK" "\0"
|
||||
"GB18030" "\0" "GB18030" "\0"
|
||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
||||
"ARMSCII-8" "\0" "ARMSCII-8" "\0"
|
||||
"PT154" "\0" "PT154" "\0"
|
||||
/*"ISCII-DEV" "\0" "?" "\0"*/
|
||||
"*" "\0" "UTF-8" "\0";
|
||||
# endif
|
||||
|
||||
# if defined VMS
|
||||
/* To avoid the troubles of an extra file charset.alias_vms in the
|
||||
sources of many GNU packages, simply inline the aliases here. */
|
||||
/* The list of encodings is taken from the OpenVMS 7.3-1 documentation
|
||||
"Compaq C Run-Time Library Reference Manual for OpenVMS systems"
|
||||
section 10.7 "Handling Different Character Sets". */
|
||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
||||
"ISO8859-8" "\0" "ISO-8859-8" "\0"
|
||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
||||
/* Japanese */
|
||||
"eucJP" "\0" "EUC-JP" "\0"
|
||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
||||
"DECKANJI" "\0" "DEC-KANJI" "\0"
|
||||
"SDECKANJI" "\0" "EUC-JP" "\0"
|
||||
/* Chinese */
|
||||
"eucTW" "\0" "EUC-TW" "\0"
|
||||
"DECHANYU" "\0" "DEC-HANYU" "\0"
|
||||
"DECHANZI" "\0" "GB2312" "\0"
|
||||
/* Korean */
|
||||
"DECKOREAN" "\0" "EUC-KR" "\0";
|
||||
# endif
|
||||
|
||||
# if defined WIN32_NATIVE || defined __CYGWIN__
|
||||
/* To avoid the troubles of installing a separate file in the same
|
||||
directory as the DLL and of retrieving the DLL's directory at
|
||||
runtime, simply inline the aliases here. */
|
||||
|
||||
cp = "CP936" "\0" "GBK" "\0"
|
||||
"CP1361" "\0" "JOHAB" "\0"
|
||||
"CP20127" "\0" "ASCII" "\0"
|
||||
"CP20866" "\0" "KOI8-R" "\0"
|
||||
"CP20936" "\0" "GB2312" "\0"
|
||||
"CP21866" "\0" "KOI8-RU" "\0"
|
||||
"CP28591" "\0" "ISO-8859-1" "\0"
|
||||
"CP28592" "\0" "ISO-8859-2" "\0"
|
||||
"CP28593" "\0" "ISO-8859-3" "\0"
|
||||
"CP28594" "\0" "ISO-8859-4" "\0"
|
||||
"CP28595" "\0" "ISO-8859-5" "\0"
|
||||
"CP28596" "\0" "ISO-8859-6" "\0"
|
||||
"CP28597" "\0" "ISO-8859-7" "\0"
|
||||
"CP28598" "\0" "ISO-8859-8" "\0"
|
||||
"CP28599" "\0" "ISO-8859-9" "\0"
|
||||
"CP28605" "\0" "ISO-8859-15" "\0"
|
||||
"CP38598" "\0" "ISO-8859-8" "\0"
|
||||
"CP51932" "\0" "EUC-JP" "\0"
|
||||
"CP51936" "\0" "GB2312" "\0"
|
||||
"CP51949" "\0" "EUC-KR" "\0"
|
||||
"CP51950" "\0" "EUC-TW" "\0"
|
||||
"CP54936" "\0" "GB18030" "\0"
|
||||
"CP65001" "\0" "UTF-8" "\0";
|
||||
# endif
|
||||
#endif
|
||||
|
||||
charset_aliases = cp;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
|
||||
#ifdef STATIC
|
||||
STATIC
|
||||
#endif
|
||||
const char *
|
||||
locale_charset (void)
|
||||
{
|
||||
const char *codeset;
|
||||
const char *aliases;
|
||||
|
||||
#if !(defined WIN32_NATIVE || defined OS2)
|
||||
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
||||
codeset = nl_langinfo (CODESET);
|
||||
|
||||
# ifdef __CYGWIN__
|
||||
/* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always
|
||||
returns "US-ASCII". Return the suffix of the locale name from the
|
||||
environment variables (if present) or the codepage as a number. */
|
||||
if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
|
||||
{
|
||||
const char *locale;
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
if (locale != NULL && locale[0] != '\0')
|
||||
{
|
||||
/* If the locale name contains an encoding after the dot, return
|
||||
it. */
|
||||
const char *dot = strchr (locale, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
{
|
||||
const char *modifier;
|
||||
|
||||
dot++;
|
||||
/* Look for the possible @... trailer and remove it, if any. */
|
||||
modifier = strchr (dot, '@');
|
||||
if (modifier == NULL)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (buf))
|
||||
{
|
||||
memcpy (buf, dot, modifier - dot);
|
||||
buf [modifier - dot] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Woe32 has a function returning the locale's codepage as a number:
|
||||
GetACP(). This encoding is used by Cygwin, unless the user has set
|
||||
the environment variable CYGWIN=codepage:oem (which very few people
|
||||
do).
|
||||
Output directed to console windows needs to be converted (to
|
||||
GetOEMCP() if the console is using a raster font, or to
|
||||
GetConsoleOutputCP() if it is using a TrueType font). Cygwin does
|
||||
this conversion transparently (see winsup/cygwin/fhandler_console.cc),
|
||||
converting to GetConsoleOutputCP(). This leads to correct results,
|
||||
except when SetConsoleOutputCP has been called and a raster font is
|
||||
in use. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
}
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
/* On old systems which lack it, use setlocale or getenv. */
|
||||
const char *locale = NULL;
|
||||
|
||||
/* But most old systems don't have a complete set of locales. Some
|
||||
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
|
||||
use setlocale here; it would return "C" when it doesn't support the
|
||||
locale name the user has set. */
|
||||
# if 0
|
||||
locale = setlocale (LC_CTYPE, NULL);
|
||||
# endif
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
}
|
||||
|
||||
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
||||
you set it to "language_COUNTRY.charset". In any case, we resolve it
|
||||
through the charset.alias file. */
|
||||
codeset = locale;
|
||||
|
||||
# endif
|
||||
|
||||
#elif defined WIN32_NATIVE
|
||||
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
/* Woe32 has a function returning the locale's codepage as a number:
|
||||
GetACP().
|
||||
When the output goes to a console window, it needs to be provided in
|
||||
GetOEMCP() encoding if the console is using a raster font, or in
|
||||
GetConsoleOutputCP() encoding if it is using a TrueType font.
|
||||
But in GUI programs and for output sent to files and pipes, GetACP()
|
||||
encoding is the best bet. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
|
||||
#elif defined OS2
|
||||
|
||||
const char *locale;
|
||||
static char buf[2 + 10 + 1];
|
||||
ULONG cp[3];
|
||||
ULONG cplen;
|
||||
|
||||
/* Allow user to override the codeset, as set in the operating system,
|
||||
with standard language environment variables. */
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
if (locale != NULL && locale[0] != '\0')
|
||||
{
|
||||
/* If the locale name contains an encoding after the dot, return it. */
|
||||
const char *dot = strchr (locale, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
{
|
||||
const char *modifier;
|
||||
|
||||
dot++;
|
||||
/* Look for the possible @... trailer and remove it, if any. */
|
||||
modifier = strchr (dot, '@');
|
||||
if (modifier == NULL)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (buf))
|
||||
{
|
||||
memcpy (buf, dot, modifier - dot);
|
||||
buf [modifier - dot] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
/* Resolve through the charset.alias file. */
|
||||
codeset = locale;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OS/2 has a function returning the locale's codepage as a number. */
|
||||
if (DosQueryCp (sizeof (cp), cp, &cplen))
|
||||
codeset = "";
|
||||
else
|
||||
{
|
||||
sprintf (buf, "CP%u", cp[0]);
|
||||
codeset = buf;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The canonical name cannot be determined. */
|
||||
codeset = "";
|
||||
|
||||
/* Resolve alias. */
|
||||
for (aliases = get_charset_aliases ();
|
||||
*aliases != '\0';
|
||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||
if (strcmp (codeset, aliases) == 0
|
||||
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
||||
{
|
||||
codeset = aliases + strlen (aliases) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Don't return an empty string. GNU libc and GNU libiconv interpret
|
||||
the empty string as denoting "the locale's character encoding",
|
||||
thus GNU libiconv would call this function a second time. */
|
||||
if (codeset[0] == '\0')
|
||||
codeset = "ASCII";
|
||||
|
||||
return codeset;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/* Determine a canonical name for the current locale's character encoding.
|
||||
Copyright (C) 2000-2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU CHARSET Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _LOCALCHARSET_H
|
||||
#define _LOCALCHARSET_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
extern const char * locale_charset (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LOCALCHARSET_H */
|
|
@ -0,0 +1,77 @@
|
|||
# Locale name alias data base.
|
||||
# Copyright (C) 1996-2001,2003,2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
|
||||
# The format of this file is the same as for the corresponding file of
|
||||
# the X Window System, which normally can be found in
|
||||
# /usr/lib/X11/locale/locale.alias
|
||||
# A single line contains two fields: an alias and a substitution value.
|
||||
# All entries are case independent.
|
||||
|
||||
# Note: This file is obsolete and is kept around for the time being for
|
||||
# backward compatibility. Nobody should rely on the names defined here.
|
||||
# Locales should always be specified by their full name.
|
||||
|
||||
# Packages using this file:
|
||||
|
||||
bokmal nb_NO.ISO-8859-1
|
||||
bokmål nb_NO.ISO-8859-1
|
||||
catalan ca_ES.ISO-8859-1
|
||||
croatian hr_HR.ISO-8859-2
|
||||
czech cs_CZ.ISO-8859-2
|
||||
danish da_DK.ISO-8859-1
|
||||
dansk da_DK.ISO-8859-1
|
||||
deutsch de_DE.ISO-8859-1
|
||||
dutch nl_NL.ISO-8859-1
|
||||
eesti et_EE.ISO-8859-1
|
||||
estonian et_EE.ISO-8859-1
|
||||
finnish fi_FI.ISO-8859-1
|
||||
français fr_FR.ISO-8859-1
|
||||
french fr_FR.ISO-8859-1
|
||||
galego gl_ES.ISO-8859-1
|
||||
galician gl_ES.ISO-8859-1
|
||||
german de_DE.ISO-8859-1
|
||||
greek el_GR.ISO-8859-7
|
||||
hebrew he_IL.ISO-8859-8
|
||||
hrvatski hr_HR.ISO-8859-2
|
||||
hungarian hu_HU.ISO-8859-2
|
||||
icelandic is_IS.ISO-8859-1
|
||||
italian it_IT.ISO-8859-1
|
||||
japanese ja_JP.eucJP
|
||||
japanese.euc ja_JP.eucJP
|
||||
ja_JP ja_JP.eucJP
|
||||
ja_JP.ujis ja_JP.eucJP
|
||||
japanese.sjis ja_JP.SJIS
|
||||
korean ko_KR.eucKR
|
||||
korean.euc ko_KR.eucKR
|
||||
ko_KR ko_KR.eucKR
|
||||
lithuanian lt_LT.ISO-8859-13
|
||||
no_NO nb_NO.ISO-8859-1
|
||||
no_NO.ISO-8859-1 nb_NO.ISO-8859-1
|
||||
norwegian nb_NO.ISO-8859-1
|
||||
nynorsk nn_NO.ISO-8859-1
|
||||
polish pl_PL.ISO-8859-2
|
||||
portuguese pt_PT.ISO-8859-1
|
||||
romanian ro_RO.ISO-8859-2
|
||||
russian ru_RU.ISO-8859-5
|
||||
slovak sk_SK.ISO-8859-2
|
||||
slovene sl_SI.ISO-8859-2
|
||||
slovenian sl_SI.ISO-8859-2
|
||||
spanish es_ES.ISO-8859-1
|
||||
swedish sv_SE.ISO-8859-1
|
||||
thai th_TH.TIS-620
|
||||
turkish tr_TR.ISO-8859-9
|
|
@ -0,0 +1,439 @@
|
|||
/* Handle aliases for locale names.
|
||||
Copyright (C) 1995-1999, 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#if defined _LIBC || defined HAVE___FSETLOCKING
|
||||
# include <stdio_ext.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
# undef alloca
|
||||
# define alloca __builtin_alloca
|
||||
# define HAVE_ALLOCA 1
|
||||
#else
|
||||
# ifdef _MSC_VER
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# else
|
||||
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gettextP.h"
|
||||
|
||||
#if ENABLE_RELOCATABLE
|
||||
# include "relocatable.h"
|
||||
#else
|
||||
# define relocate(pathname) (pathname)
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Rename the non ANSI C functions. This is required by the standard
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define strcasecmp __strcasecmp
|
||||
|
||||
# ifndef mempcpy
|
||||
# define mempcpy __mempcpy
|
||||
# endif
|
||||
# define HAVE_MEMPCPY 1
|
||||
# define HAVE___FSETLOCKING 1
|
||||
#endif
|
||||
|
||||
/* Handle multi-threaded applications. */
|
||||
#ifdef _LIBC
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
# include "lock.h"
|
||||
#endif
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
/* Some optimizations for glibc. */
|
||||
#ifdef _LIBC
|
||||
# define FEOF(fp) feof_unlocked (fp)
|
||||
# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp)
|
||||
#else
|
||||
# define FEOF(fp) feof (fp)
|
||||
# define FGETS(buf, n, fp) fgets (buf, n, fp)
|
||||
#endif
|
||||
|
||||
/* For those losing systems which don't have `alloca' we have to add
|
||||
some additional code emulating it. */
|
||||
#ifdef HAVE_ALLOCA
|
||||
# define freea(p) /* nothing */
|
||||
#else
|
||||
# define alloca(n) malloc (n)
|
||||
# define freea(p) free (p)
|
||||
#endif
|
||||
|
||||
#if defined _LIBC_REENTRANT || HAVE_DECL_FGETS_UNLOCKED
|
||||
# undef fgets
|
||||
# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
|
||||
#endif
|
||||
#if defined _LIBC_REENTRANT || HAVE_DECL_FEOF_UNLOCKED
|
||||
# undef feof
|
||||
# define feof(s) feof_unlocked (s)
|
||||
#endif
|
||||
|
||||
|
||||
__libc_lock_define_initialized (static, lock)
|
||||
|
||||
|
||||
struct alias_map
|
||||
{
|
||||
const char *alias;
|
||||
const char *value;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _LIBC
|
||||
# define libc_freeres_ptr(decl) decl
|
||||
#endif
|
||||
|
||||
libc_freeres_ptr (static char *string_space);
|
||||
static size_t string_space_act;
|
||||
static size_t string_space_max;
|
||||
libc_freeres_ptr (static struct alias_map *map);
|
||||
static size_t nmap;
|
||||
static size_t maxmap;
|
||||
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static size_t read_alias_file (const char *fname, int fname_len)
|
||||
internal_function;
|
||||
static int extend_alias_table (void);
|
||||
static int alias_compare (const struct alias_map *map1,
|
||||
const struct alias_map *map2);
|
||||
|
||||
|
||||
const char *
|
||||
_nl_expand_alias (const char *name)
|
||||
{
|
||||
static const char *locale_alias_path;
|
||||
struct alias_map *retval;
|
||||
const char *result = NULL;
|
||||
size_t added;
|
||||
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
if (locale_alias_path == NULL)
|
||||
locale_alias_path = LOCALE_ALIAS_PATH;
|
||||
|
||||
do
|
||||
{
|
||||
struct alias_map item;
|
||||
|
||||
item.alias = name;
|
||||
|
||||
if (nmap > 0)
|
||||
retval = (struct alias_map *) bsearch (&item, map, nmap,
|
||||
sizeof (struct alias_map),
|
||||
(int (*) (const void *,
|
||||
const void *)
|
||||
) alias_compare);
|
||||
else
|
||||
retval = NULL;
|
||||
|
||||
/* We really found an alias. Return the value. */
|
||||
if (retval != NULL)
|
||||
{
|
||||
result = retval->value;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Perhaps we can find another alias file. */
|
||||
added = 0;
|
||||
while (added == 0 && locale_alias_path[0] != '\0')
|
||||
{
|
||||
const char *start;
|
||||
|
||||
while (locale_alias_path[0] == PATH_SEPARATOR)
|
||||
++locale_alias_path;
|
||||
start = locale_alias_path;
|
||||
|
||||
while (locale_alias_path[0] != '\0'
|
||||
&& locale_alias_path[0] != PATH_SEPARATOR)
|
||||
++locale_alias_path;
|
||||
|
||||
if (start < locale_alias_path)
|
||||
added = read_alias_file (start, locale_alias_path - start);
|
||||
}
|
||||
}
|
||||
while (added != 0);
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
internal_function
|
||||
read_alias_file (const char *fname, int fname_len)
|
||||
{
|
||||
FILE *fp;
|
||||
char *full_fname;
|
||||
size_t added;
|
||||
static const char aliasfile[] = "/locale.alias";
|
||||
|
||||
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
|
||||
#ifdef HAVE_MEMPCPY
|
||||
mempcpy (mempcpy (full_fname, fname, fname_len),
|
||||
aliasfile, sizeof aliasfile);
|
||||
#else
|
||||
memcpy (full_fname, fname, fname_len);
|
||||
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Note the file is opened with cancellation in the I/O functions
|
||||
disabled. */
|
||||
fp = fopen (relocate (full_fname), "rc");
|
||||
#else
|
||||
fp = fopen (relocate (full_fname), "r");
|
||||
#endif
|
||||
freea (full_fname);
|
||||
if (fp == NULL)
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE___FSETLOCKING
|
||||
/* No threads present. */
|
||||
__fsetlocking (fp, FSETLOCKING_BYCALLER);
|
||||
#endif
|
||||
|
||||
added = 0;
|
||||
while (!FEOF (fp))
|
||||
{
|
||||
/* It is a reasonable approach to use a fix buffer here because
|
||||
a) we are only interested in the first two fields
|
||||
b) these fields must be usable as file names and so must not
|
||||
be that long
|
||||
We avoid a multi-kilobyte buffer here since this would use up
|
||||
stack space which we might not have if the program ran out of
|
||||
memory. */
|
||||
char buf[400];
|
||||
char *alias;
|
||||
char *value;
|
||||
char *cp;
|
||||
int complete_line;
|
||||
|
||||
if (FGETS (buf, sizeof buf, fp) == NULL)
|
||||
/* EOF reached. */
|
||||
break;
|
||||
|
||||
/* Determine whether the line is complete. */
|
||||
complete_line = strchr (buf, '\n') != NULL;
|
||||
|
||||
cp = buf;
|
||||
/* Ignore leading white space. */
|
||||
while (isspace ((unsigned char) cp[0]))
|
||||
++cp;
|
||||
|
||||
/* A leading '#' signals a comment line. */
|
||||
if (cp[0] != '\0' && cp[0] != '#')
|
||||
{
|
||||
alias = cp++;
|
||||
while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
|
||||
++cp;
|
||||
/* Terminate alias name. */
|
||||
if (cp[0] != '\0')
|
||||
*cp++ = '\0';
|
||||
|
||||
/* Now look for the beginning of the value. */
|
||||
while (isspace ((unsigned char) cp[0]))
|
||||
++cp;
|
||||
|
||||
if (cp[0] != '\0')
|
||||
{
|
||||
value = cp++;
|
||||
while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
|
||||
++cp;
|
||||
/* Terminate value. */
|
||||
if (cp[0] == '\n')
|
||||
{
|
||||
/* This has to be done to make the following test
|
||||
for the end of line possible. We are looking for
|
||||
the terminating '\n' which do not overwrite here. */
|
||||
*cp++ = '\0';
|
||||
*cp = '\n';
|
||||
}
|
||||
else if (cp[0] != '\0')
|
||||
*cp++ = '\0';
|
||||
|
||||
#ifdef IN_LIBGLOCALE
|
||||
/* glibc's locale.alias contains entries for ja_JP and ko_KR
|
||||
that make it impossible to use a Japanese or Korean UTF-8
|
||||
locale under the name "ja_JP" or "ko_KR". Ignore these
|
||||
entries. */
|
||||
if (strchr (alias, '_') == NULL)
|
||||
#endif
|
||||
{
|
||||
size_t alias_len;
|
||||
size_t value_len;
|
||||
|
||||
if (nmap >= maxmap)
|
||||
if (__builtin_expect (extend_alias_table (), 0))
|
||||
goto out;
|
||||
|
||||
alias_len = strlen (alias) + 1;
|
||||
value_len = strlen (value) + 1;
|
||||
|
||||
if (string_space_act + alias_len + value_len > string_space_max)
|
||||
{
|
||||
/* Increase size of memory pool. */
|
||||
size_t new_size = (string_space_max
|
||||
+ (alias_len + value_len > 1024
|
||||
? alias_len + value_len : 1024));
|
||||
char *new_pool = (char *) realloc (string_space, new_size);
|
||||
if (new_pool == NULL)
|
||||
goto out;
|
||||
|
||||
if (__builtin_expect (string_space != new_pool, 0))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nmap; i++)
|
||||
{
|
||||
map[i].alias += new_pool - string_space;
|
||||
map[i].value += new_pool - string_space;
|
||||
}
|
||||
}
|
||||
|
||||
string_space = new_pool;
|
||||
string_space_max = new_size;
|
||||
}
|
||||
|
||||
map[nmap].alias =
|
||||
(const char *) memcpy (&string_space[string_space_act],
|
||||
alias, alias_len);
|
||||
string_space_act += alias_len;
|
||||
|
||||
map[nmap].value =
|
||||
(const char *) memcpy (&string_space[string_space_act],
|
||||
value, value_len);
|
||||
string_space_act += value_len;
|
||||
|
||||
++nmap;
|
||||
++added;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Possibly not the whole line fits into the buffer. Ignore
|
||||
the rest of the line. */
|
||||
if (! complete_line)
|
||||
do
|
||||
if (FGETS (buf, sizeof buf, fp) == NULL)
|
||||
/* Make sure the inner loop will be left. The outer loop
|
||||
will exit at the `feof' test. */
|
||||
break;
|
||||
while (strchr (buf, '\n') == NULL);
|
||||
}
|
||||
|
||||
out:
|
||||
/* Should we test for ferror()? I think we have to silently ignore
|
||||
errors. --drepper */
|
||||
fclose (fp);
|
||||
|
||||
if (added > 0)
|
||||
qsort (map, nmap, sizeof (struct alias_map),
|
||||
(int (*) (const void *, const void *)) alias_compare);
|
||||
|
||||
return added;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
extend_alias_table ()
|
||||
{
|
||||
size_t new_size;
|
||||
struct alias_map *new_map;
|
||||
|
||||
new_size = maxmap == 0 ? 100 : 2 * maxmap;
|
||||
new_map = (struct alias_map *) realloc (map, (new_size
|
||||
* sizeof (struct alias_map)));
|
||||
if (new_map == NULL)
|
||||
/* Simply don't extend: we don't have any more core. */
|
||||
return -1;
|
||||
|
||||
map = new_map;
|
||||
maxmap = new_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
alias_compare (const struct alias_map *map1, const struct alias_map *map2)
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRCASECMP
|
||||
return strcasecmp (map1->alias, map2->alias);
|
||||
#else
|
||||
const unsigned char *p1 = (const unsigned char *) map1->alias;
|
||||
const unsigned char *p2 = (const unsigned char *) map2->alias;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
/* I know this seems to be odd but the tolower() function in
|
||||
some systems libc cannot handle nonalpha characters. */
|
||||
c1 = isupper (*p1) ? tolower (*p1) : *p1;
|
||||
c2 = isupper (*p2) ? tolower (*p2) : *p2;
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
return c1 - c2;
|
||||
#endif
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,928 @@
|
|||
/* Locking in multithreaded situations.
|
||||
Copyright (C) 2005-2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>, 2005.
|
||||
Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
|
||||
gthr-win32.h. */
|
||||
|
||||
/* This file contains locking primitives for use with a given thread library.
|
||||
It does not contain primitives for creating threads or for other
|
||||
synchronization primitives.
|
||||
|
||||
Normal (non-recursive) locks:
|
||||
Type: gl_lock_t
|
||||
Declaration: gl_lock_define(extern, name)
|
||||
Initializer: gl_lock_define_initialized(, name)
|
||||
Initialization: gl_lock_init (name);
|
||||
Taking the lock: gl_lock_lock (name);
|
||||
Releasing the lock: gl_lock_unlock (name);
|
||||
De-initialization: gl_lock_destroy (name);
|
||||
Equivalent functions with control of error handling:
|
||||
Initialization: err = glthread_lock_init (&name);
|
||||
Taking the lock: err = glthread_lock_lock (&name);
|
||||
Releasing the lock: err = glthread_lock_unlock (&name);
|
||||
De-initialization: err = glthread_lock_destroy (&name);
|
||||
|
||||
Read-Write (non-recursive) locks:
|
||||
Type: gl_rwlock_t
|
||||
Declaration: gl_rwlock_define(extern, name)
|
||||
Initializer: gl_rwlock_define_initialized(, name)
|
||||
Initialization: gl_rwlock_init (name);
|
||||
Taking the lock: gl_rwlock_rdlock (name);
|
||||
gl_rwlock_wrlock (name);
|
||||
Releasing the lock: gl_rwlock_unlock (name);
|
||||
De-initialization: gl_rwlock_destroy (name);
|
||||
Equivalent functions with control of error handling:
|
||||
Initialization: err = glthread_rwlock_init (&name);
|
||||
Taking the lock: err = glthread_rwlock_rdlock (&name);
|
||||
err = glthread_rwlock_wrlock (&name);
|
||||
Releasing the lock: err = glthread_rwlock_unlock (&name);
|
||||
De-initialization: err = glthread_rwlock_destroy (&name);
|
||||
|
||||
Recursive locks:
|
||||
Type: gl_recursive_lock_t
|
||||
Declaration: gl_recursive_lock_define(extern, name)
|
||||
Initializer: gl_recursive_lock_define_initialized(, name)
|
||||
Initialization: gl_recursive_lock_init (name);
|
||||
Taking the lock: gl_recursive_lock_lock (name);
|
||||
Releasing the lock: gl_recursive_lock_unlock (name);
|
||||
De-initialization: gl_recursive_lock_destroy (name);
|
||||
Equivalent functions with control of error handling:
|
||||
Initialization: err = glthread_recursive_lock_init (&name);
|
||||
Taking the lock: err = glthread_recursive_lock_lock (&name);
|
||||
Releasing the lock: err = glthread_recursive_lock_unlock (&name);
|
||||
De-initialization: err = glthread_recursive_lock_destroy (&name);
|
||||
|
||||
Once-only execution:
|
||||
Type: gl_once_t
|
||||
Initializer: gl_once_define(extern, name)
|
||||
Execution: gl_once (name, initfunction);
|
||||
Equivalent functions with control of error handling:
|
||||
Execution: err = glthread_once (&name, initfunction);
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _LOCK_H
|
||||
#define _LOCK_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
#if USE_POSIX_THREADS
|
||||
|
||||
/* Use the POSIX threads library. */
|
||||
|
||||
# include <pthread.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# if PTHREAD_IN_USE_DETECTION_HARD
|
||||
|
||||
/* The pthread_in_use() detection needs to be done at runtime. */
|
||||
# define pthread_in_use() \
|
||||
glthread_in_use ()
|
||||
extern int glthread_in_use (void);
|
||||
|
||||
# endif
|
||||
|
||||
# if USE_POSIX_THREADS_WEAK
|
||||
|
||||
/* Use weak references to the POSIX threads library. */
|
||||
|
||||
/* Weak references avoid dragging in external libraries if the other parts
|
||||
of the program don't use them. Here we use them, because we don't want
|
||||
every program that uses libintl to depend on libpthread. This assumes
|
||||
that libpthread would not be loaded after libintl; i.e. if libintl is
|
||||
loaded first, by an executable that does not depend on libpthread, and
|
||||
then a module is dynamically loaded that depends on libpthread, libintl
|
||||
will not be multithread-safe. */
|
||||
|
||||
/* The way to test at runtime whether libpthread is present is to test
|
||||
whether a function pointer's value, such as &pthread_mutex_init, is
|
||||
non-NULL. However, some versions of GCC have a bug through which, in
|
||||
PIC mode, &foo != NULL always evaluates to true if there is a direct
|
||||
call to foo(...) in the same function. To avoid this, we test the
|
||||
address of a function in libpthread that we don't use. */
|
||||
|
||||
# pragma weak pthread_mutex_init
|
||||
# pragma weak pthread_mutex_lock
|
||||
# pragma weak pthread_mutex_unlock
|
||||
# pragma weak pthread_mutex_destroy
|
||||
# pragma weak pthread_rwlock_init
|
||||
# pragma weak pthread_rwlock_rdlock
|
||||
# pragma weak pthread_rwlock_wrlock
|
||||
# pragma weak pthread_rwlock_unlock
|
||||
# pragma weak pthread_rwlock_destroy
|
||||
# pragma weak pthread_once
|
||||
# pragma weak pthread_cond_init
|
||||
# pragma weak pthread_cond_wait
|
||||
# pragma weak pthread_cond_signal
|
||||
# pragma weak pthread_cond_broadcast
|
||||
# pragma weak pthread_cond_destroy
|
||||
# pragma weak pthread_mutexattr_init
|
||||
# pragma weak pthread_mutexattr_settype
|
||||
# pragma weak pthread_mutexattr_destroy
|
||||
# ifndef pthread_self
|
||||
# pragma weak pthread_self
|
||||
# endif
|
||||
|
||||
# if !PTHREAD_IN_USE_DETECTION_HARD
|
||||
# pragma weak pthread_cancel
|
||||
# define pthread_in_use() (pthread_cancel != NULL)
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# if !PTHREAD_IN_USE_DETECTION_HARD
|
||||
# define pthread_in_use() 1
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
/* -------------------------- gl_lock_t datatype -------------------------- */
|
||||
|
||||
typedef pthread_mutex_t gl_lock_t;
|
||||
# define gl_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pthread_mutex_t NAME;
|
||||
# define gl_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer;
|
||||
# define gl_lock_initializer \
|
||||
PTHREAD_MUTEX_INITIALIZER
|
||||
# define glthread_lock_init(LOCK) \
|
||||
(pthread_in_use () ? pthread_mutex_init (LOCK, NULL) : 0)
|
||||
# define glthread_lock_lock(LOCK) \
|
||||
(pthread_in_use () ? pthread_mutex_lock (LOCK) : 0)
|
||||
# define glthread_lock_unlock(LOCK) \
|
||||
(pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0)
|
||||
# define glthread_lock_destroy(LOCK) \
|
||||
(pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0)
|
||||
|
||||
/* ------------------------- gl_rwlock_t datatype ------------------------- */
|
||||
|
||||
# if HAVE_PTHREAD_RWLOCK
|
||||
|
||||
# ifdef PTHREAD_RWLOCK_INITIALIZER
|
||||
|
||||
typedef pthread_rwlock_t gl_rwlock_t;
|
||||
# define gl_rwlock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pthread_rwlock_t NAME;
|
||||
# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer;
|
||||
# define gl_rwlock_initializer \
|
||||
PTHREAD_RWLOCK_INITIALIZER
|
||||
# define glthread_rwlock_init(LOCK) \
|
||||
(pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0)
|
||||
# define glthread_rwlock_rdlock(LOCK) \
|
||||
(pthread_in_use () ? pthread_rwlock_rdlock (LOCK) : 0)
|
||||
# define glthread_rwlock_wrlock(LOCK) \
|
||||
(pthread_in_use () ? pthread_rwlock_wrlock (LOCK) : 0)
|
||||
# define glthread_rwlock_unlock(LOCK) \
|
||||
(pthread_in_use () ? pthread_rwlock_unlock (LOCK) : 0)
|
||||
# define glthread_rwlock_destroy(LOCK) \
|
||||
(pthread_in_use () ? pthread_rwlock_destroy (LOCK) : 0)
|
||||
|
||||
# else
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int initialized;
|
||||
pthread_mutex_t guard; /* protects the initialization */
|
||||
pthread_rwlock_t rwlock; /* read-write lock */
|
||||
}
|
||||
gl_rwlock_t;
|
||||
# define gl_rwlock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_rwlock_t NAME;
|
||||
# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
|
||||
# define gl_rwlock_initializer \
|
||||
{ 0, PTHREAD_MUTEX_INITIALIZER }
|
||||
# define glthread_rwlock_init(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_rdlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_wrlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_unlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_destroy(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0)
|
||||
extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock);
|
||||
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_mutex_t lock; /* protects the remaining fields */
|
||||
pthread_cond_t waiting_readers; /* waiting readers */
|
||||
pthread_cond_t waiting_writers; /* waiting writers */
|
||||
unsigned int waiting_writers_count; /* number of waiting writers */
|
||||
int runcount; /* number of readers running, or -1 when a writer runs */
|
||||
}
|
||||
gl_rwlock_t;
|
||||
# define gl_rwlock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_rwlock_t NAME;
|
||||
# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
|
||||
# define gl_rwlock_initializer \
|
||||
{ PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
|
||||
# define glthread_rwlock_init(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_rdlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_wrlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_unlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_rwlock_destroy(LOCK) \
|
||||
(pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0)
|
||||
extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock);
|
||||
|
||||
# endif
|
||||
|
||||
/* --------------------- gl_recursive_lock_t datatype --------------------- */
|
||||
|
||||
# if HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
|
||||
# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
|
||||
typedef pthread_mutex_t gl_recursive_lock_t;
|
||||
# define gl_recursive_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pthread_mutex_t NAME;
|
||||
# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer;
|
||||
# ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER
|
||||
# define gl_recursive_lock_initializer \
|
||||
PTHREAD_RECURSIVE_MUTEX_INITIALIZER
|
||||
# else
|
||||
# define gl_recursive_lock_initializer \
|
||||
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
# endif
|
||||
# define glthread_recursive_lock_init(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_lock(LOCK) \
|
||||
(pthread_in_use () ? pthread_mutex_lock (LOCK) : 0)
|
||||
# define glthread_recursive_lock_unlock(LOCK) \
|
||||
(pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0)
|
||||
# define glthread_recursive_lock_destroy(LOCK) \
|
||||
(pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0)
|
||||
extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
|
||||
|
||||
# else
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_mutex_t recmutex; /* recursive mutex */
|
||||
pthread_mutex_t guard; /* protects the initialization */
|
||||
int initialized;
|
||||
}
|
||||
gl_recursive_lock_t;
|
||||
# define gl_recursive_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME;
|
||||
# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
|
||||
# define gl_recursive_lock_initializer \
|
||||
{ PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 }
|
||||
# define glthread_recursive_lock_init(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_lock(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_unlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_destroy(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
|
||||
extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
|
||||
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
/* Old versions of POSIX threads on Solaris did not have recursive locks.
|
||||
We have to implement them ourselves. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_mutex_t mutex;
|
||||
pthread_t owner;
|
||||
unsigned long depth;
|
||||
}
|
||||
gl_recursive_lock_t;
|
||||
# define gl_recursive_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME;
|
||||
# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
|
||||
# define gl_recursive_lock_initializer \
|
||||
{ PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 }
|
||||
# define glthread_recursive_lock_init(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_lock(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_unlock(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_destroy(LOCK) \
|
||||
(pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
|
||||
extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
|
||||
|
||||
# endif
|
||||
|
||||
/* -------------------------- gl_once_t datatype -------------------------- */
|
||||
|
||||
typedef pthread_once_t gl_once_t;
|
||||
# define gl_once_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
|
||||
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
|
||||
(pthread_in_use () \
|
||||
? pthread_once (ONCE_CONTROL, INITFUNCTION) \
|
||||
: (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
|
||||
extern int glthread_once_singlethreaded (pthread_once_t *once_control);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
#if USE_PTH_THREADS
|
||||
|
||||
/* Use the GNU Pth threads library. */
|
||||
|
||||
# include <pth.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# if USE_PTH_THREADS_WEAK
|
||||
|
||||
/* Use weak references to the GNU Pth threads library. */
|
||||
|
||||
# pragma weak pth_mutex_init
|
||||
# pragma weak pth_mutex_acquire
|
||||
# pragma weak pth_mutex_release
|
||||
# pragma weak pth_rwlock_init
|
||||
# pragma weak pth_rwlock_acquire
|
||||
# pragma weak pth_rwlock_release
|
||||
# pragma weak pth_once
|
||||
|
||||
# pragma weak pth_cancel
|
||||
# define pth_in_use() (pth_cancel != NULL)
|
||||
|
||||
# else
|
||||
|
||||
# define pth_in_use() 1
|
||||
|
||||
# endif
|
||||
|
||||
/* -------------------------- gl_lock_t datatype -------------------------- */
|
||||
|
||||
typedef pth_mutex_t gl_lock_t;
|
||||
# define gl_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pth_mutex_t NAME;
|
||||
# define gl_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pth_mutex_t NAME = gl_lock_initializer;
|
||||
# define gl_lock_initializer \
|
||||
PTH_MUTEX_INIT
|
||||
# define glthread_lock_init(LOCK) \
|
||||
(pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0)
|
||||
# define glthread_lock_lock(LOCK) \
|
||||
(pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0)
|
||||
# define glthread_lock_unlock(LOCK) \
|
||||
(pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0)
|
||||
# define glthread_lock_destroy(LOCK) \
|
||||
((void)(LOCK), 0)
|
||||
|
||||
/* ------------------------- gl_rwlock_t datatype ------------------------- */
|
||||
|
||||
typedef pth_rwlock_t gl_rwlock_t;
|
||||
# define gl_rwlock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pth_rwlock_t NAME;
|
||||
# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer;
|
||||
# define gl_rwlock_initializer \
|
||||
PTH_RWLOCK_INIT
|
||||
# define glthread_rwlock_init(LOCK) \
|
||||
(pth_in_use () && !pth_rwlock_init (LOCK) ? errno : 0)
|
||||
# define glthread_rwlock_rdlock(LOCK) \
|
||||
(pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RD, 0, NULL) ? errno : 0)
|
||||
# define glthread_rwlock_wrlock(LOCK) \
|
||||
(pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RW, 0, NULL) ? errno : 0)
|
||||
# define glthread_rwlock_unlock(LOCK) \
|
||||
(pth_in_use () && !pth_rwlock_release (LOCK) ? errno : 0)
|
||||
# define glthread_rwlock_destroy(LOCK) \
|
||||
((void)(LOCK), 0)
|
||||
|
||||
/* --------------------- gl_recursive_lock_t datatype --------------------- */
|
||||
|
||||
/* In Pth, mutexes are recursive by default. */
|
||||
typedef pth_mutex_t gl_recursive_lock_t;
|
||||
# define gl_recursive_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pth_mutex_t NAME;
|
||||
# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer;
|
||||
# define gl_recursive_lock_initializer \
|
||||
PTH_MUTEX_INIT
|
||||
# define glthread_recursive_lock_init(LOCK) \
|
||||
(pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0)
|
||||
# define glthread_recursive_lock_lock(LOCK) \
|
||||
(pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0)
|
||||
# define glthread_recursive_lock_unlock(LOCK) \
|
||||
(pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0)
|
||||
# define glthread_recursive_lock_destroy(LOCK) \
|
||||
((void)(LOCK), 0)
|
||||
|
||||
/* -------------------------- gl_once_t datatype -------------------------- */
|
||||
|
||||
typedef pth_once_t gl_once_t;
|
||||
# define gl_once_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT;
|
||||
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
|
||||
(pth_in_use () \
|
||||
? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \
|
||||
: (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
|
||||
extern int glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void));
|
||||
extern int glthread_once_singlethreaded (pth_once_t *once_control);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
#if USE_SOLARIS_THREADS
|
||||
|
||||
/* Use the old Solaris threads library. */
|
||||
|
||||
# include <thread.h>
|
||||
# include <synch.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# if USE_SOLARIS_THREADS_WEAK
|
||||
|
||||
/* Use weak references to the old Solaris threads library. */
|
||||
|
||||
# pragma weak mutex_init
|
||||
# pragma weak mutex_lock
|
||||
# pragma weak mutex_unlock
|
||||
# pragma weak mutex_destroy
|
||||
# pragma weak rwlock_init
|
||||
# pragma weak rw_rdlock
|
||||
# pragma weak rw_wrlock
|
||||
# pragma weak rw_unlock
|
||||
# pragma weak rwlock_destroy
|
||||
# pragma weak thr_self
|
||||
|
||||
# pragma weak thr_suspend
|
||||
# define thread_in_use() (thr_suspend != NULL)
|
||||
|
||||
# else
|
||||
|
||||
# define thread_in_use() 1
|
||||
|
||||
# endif
|
||||
|
||||
/* -------------------------- gl_lock_t datatype -------------------------- */
|
||||
|
||||
typedef mutex_t gl_lock_t;
|
||||
# define gl_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS mutex_t NAME;
|
||||
# define gl_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS mutex_t NAME = gl_lock_initializer;
|
||||
# define gl_lock_initializer \
|
||||
DEFAULTMUTEX
|
||||
# define glthread_lock_init(LOCK) \
|
||||
(thread_in_use () ? mutex_init (LOCK, USYNC_THREAD, NULL) : 0)
|
||||
# define glthread_lock_lock(LOCK) \
|
||||
(thread_in_use () ? mutex_lock (LOCK) : 0)
|
||||
# define glthread_lock_unlock(LOCK) \
|
||||
(thread_in_use () ? mutex_unlock (LOCK) : 0)
|
||||
# define glthread_lock_destroy(LOCK) \
|
||||
(thread_in_use () ? mutex_destroy (LOCK) : 0)
|
||||
|
||||
/* ------------------------- gl_rwlock_t datatype ------------------------- */
|
||||
|
||||
typedef rwlock_t gl_rwlock_t;
|
||||
# define gl_rwlock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS rwlock_t NAME;
|
||||
# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS rwlock_t NAME = gl_rwlock_initializer;
|
||||
# define gl_rwlock_initializer \
|
||||
DEFAULTRWLOCK
|
||||
# define glthread_rwlock_init(LOCK) \
|
||||
(thread_in_use () ? rwlock_init (LOCK, USYNC_THREAD, NULL) : 0)
|
||||
# define glthread_rwlock_rdlock(LOCK) \
|
||||
(thread_in_use () ? rw_rdlock (LOCK) : 0)
|
||||
# define glthread_rwlock_wrlock(LOCK) \
|
||||
(thread_in_use () ? rw_wrlock (LOCK) : 0)
|
||||
# define glthread_rwlock_unlock(LOCK) \
|
||||
(thread_in_use () ? rw_unlock (LOCK) : 0)
|
||||
# define glthread_rwlock_destroy(LOCK) \
|
||||
(thread_in_use () ? rwlock_destroy (LOCK) : 0)
|
||||
|
||||
/* --------------------- gl_recursive_lock_t datatype --------------------- */
|
||||
|
||||
/* Old Solaris threads did not have recursive locks.
|
||||
We have to implement them ourselves. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
mutex_t mutex;
|
||||
thread_t owner;
|
||||
unsigned long depth;
|
||||
}
|
||||
gl_recursive_lock_t;
|
||||
# define gl_recursive_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME;
|
||||
# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
|
||||
# define gl_recursive_lock_initializer \
|
||||
{ DEFAULTMUTEX, (thread_t) 0, 0 }
|
||||
# define glthread_recursive_lock_init(LOCK) \
|
||||
(thread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_lock(LOCK) \
|
||||
(thread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_unlock(LOCK) \
|
||||
(thread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
|
||||
# define glthread_recursive_lock_destroy(LOCK) \
|
||||
(thread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
|
||||
extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
|
||||
|
||||
/* -------------------------- gl_once_t datatype -------------------------- */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile int inited;
|
||||
mutex_t mutex;
|
||||
}
|
||||
gl_once_t;
|
||||
# define gl_once_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_once_t NAME = { 0, DEFAULTMUTEX };
|
||||
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
|
||||
(thread_in_use () \
|
||||
? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \
|
||||
: (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
|
||||
extern int glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void));
|
||||
extern int glthread_once_singlethreaded (gl_once_t *once_control);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
#if USE_WIN32_THREADS
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/* We can use CRITICAL_SECTION directly, rather than the Win32 Event, Mutex,
|
||||
Semaphore types, because
|
||||
- we need only to synchronize inside a single process (address space),
|
||||
not inter-process locking,
|
||||
- we don't need to support trylock operations. (TryEnterCriticalSection
|
||||
does not work on Windows 95/98/ME. Packages that need trylock usually
|
||||
define their own mutex type.) */
|
||||
|
||||
/* There is no way to statically initialize a CRITICAL_SECTION. It needs
|
||||
to be done lazily, once only. For this we need spinlocks. */
|
||||
|
||||
typedef struct { volatile int done; volatile long started; } gl_spinlock_t;
|
||||
|
||||
/* -------------------------- gl_lock_t datatype -------------------------- */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gl_spinlock_t guard; /* protects the initialization */
|
||||
CRITICAL_SECTION lock;
|
||||
}
|
||||
gl_lock_t;
|
||||
# define gl_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_lock_t NAME;
|
||||
# define gl_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_lock_t NAME = gl_lock_initializer;
|
||||
# define gl_lock_initializer \
|
||||
{ { 0, -1 } }
|
||||
# define glthread_lock_init(LOCK) \
|
||||
(glthread_lock_init_func (LOCK), 0)
|
||||
# define glthread_lock_lock(LOCK) \
|
||||
glthread_lock_lock_func (LOCK)
|
||||
# define glthread_lock_unlock(LOCK) \
|
||||
glthread_lock_unlock_func (LOCK)
|
||||
# define glthread_lock_destroy(LOCK) \
|
||||
glthread_lock_destroy_func (LOCK)
|
||||
extern void glthread_lock_init_func (gl_lock_t *lock);
|
||||
extern int glthread_lock_lock_func (gl_lock_t *lock);
|
||||
extern int glthread_lock_unlock_func (gl_lock_t *lock);
|
||||
extern int glthread_lock_destroy_func (gl_lock_t *lock);
|
||||
|
||||
/* ------------------------- gl_rwlock_t datatype ------------------------- */
|
||||
|
||||
/* It is impossible to implement read-write locks using plain locks, without
|
||||
introducing an extra thread dedicated to managing read-write locks.
|
||||
Therefore here we need to use the low-level Event type. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE *array; /* array of waiting threads, each represented by an event */
|
||||
unsigned int count; /* number of waiting threads */
|
||||
unsigned int alloc; /* length of allocated array */
|
||||
unsigned int offset; /* index of first waiting thread in array */
|
||||
}
|
||||
gl_carray_waitqueue_t;
|
||||
typedef struct
|
||||
{
|
||||
gl_spinlock_t guard; /* protects the initialization */
|
||||
CRITICAL_SECTION lock; /* protects the remaining fields */
|
||||
gl_carray_waitqueue_t waiting_readers; /* waiting readers */
|
||||
gl_carray_waitqueue_t waiting_writers; /* waiting writers */
|
||||
int runcount; /* number of readers running, or -1 when a writer runs */
|
||||
}
|
||||
gl_rwlock_t;
|
||||
# define gl_rwlock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_rwlock_t NAME;
|
||||
# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
|
||||
# define gl_rwlock_initializer \
|
||||
{ { 0, -1 } }
|
||||
# define glthread_rwlock_init(LOCK) \
|
||||
(glthread_rwlock_init_func (LOCK), 0)
|
||||
# define glthread_rwlock_rdlock(LOCK) \
|
||||
glthread_rwlock_rdlock_func (LOCK)
|
||||
# define glthread_rwlock_wrlock(LOCK) \
|
||||
glthread_rwlock_wrlock_func (LOCK)
|
||||
# define glthread_rwlock_unlock(LOCK) \
|
||||
glthread_rwlock_unlock_func (LOCK)
|
||||
# define glthread_rwlock_destroy(LOCK) \
|
||||
glthread_rwlock_destroy_func (LOCK)
|
||||
extern void glthread_rwlock_init_func (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_rdlock_func (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_wrlock_func (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_unlock_func (gl_rwlock_t *lock);
|
||||
extern int glthread_rwlock_destroy_func (gl_rwlock_t *lock);
|
||||
|
||||
/* --------------------- gl_recursive_lock_t datatype --------------------- */
|
||||
|
||||
/* The Win32 documentation says that CRITICAL_SECTION already implements a
|
||||
recursive lock. But we need not rely on it: It's easy to implement a
|
||||
recursive lock without this assumption. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gl_spinlock_t guard; /* protects the initialization */
|
||||
DWORD owner;
|
||||
unsigned long depth;
|
||||
CRITICAL_SECTION lock;
|
||||
}
|
||||
gl_recursive_lock_t;
|
||||
# define gl_recursive_lock_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME;
|
||||
# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
|
||||
# define gl_recursive_lock_initializer \
|
||||
{ { 0, -1 }, 0, 0 }
|
||||
# define glthread_recursive_lock_init(LOCK) \
|
||||
(glthread_recursive_lock_init_func (LOCK), 0)
|
||||
# define glthread_recursive_lock_lock(LOCK) \
|
||||
glthread_recursive_lock_lock_func (LOCK)
|
||||
# define glthread_recursive_lock_unlock(LOCK) \
|
||||
glthread_recursive_lock_unlock_func (LOCK)
|
||||
# define glthread_recursive_lock_destroy(LOCK) \
|
||||
glthread_recursive_lock_destroy_func (LOCK)
|
||||
extern void glthread_recursive_lock_init_func (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock);
|
||||
extern int glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock);
|
||||
|
||||
/* -------------------------- gl_once_t datatype -------------------------- */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile int inited;
|
||||
volatile long started;
|
||||
CRITICAL_SECTION lock;
|
||||
}
|
||||
gl_once_t;
|
||||
# define gl_once_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_once_t NAME = { -1, -1 };
|
||||
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
|
||||
(glthread_once_func (ONCE_CONTROL, INITFUNCTION), 0)
|
||||
extern void glthread_once_func (gl_once_t *once_control, void (*initfunction) (void));
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS)
|
||||
|
||||
/* Provide dummy implementation if threads are not supported. */
|
||||
|
||||
/* -------------------------- gl_lock_t datatype -------------------------- */
|
||||
|
||||
typedef int gl_lock_t;
|
||||
# define gl_lock_define(STORAGECLASS, NAME)
|
||||
# define gl_lock_define_initialized(STORAGECLASS, NAME)
|
||||
# define glthread_lock_init(NAME) 0
|
||||
# define glthread_lock_lock(NAME) 0
|
||||
# define glthread_lock_unlock(NAME) 0
|
||||
# define glthread_lock_destroy(NAME) 0
|
||||
|
||||
/* ------------------------- gl_rwlock_t datatype ------------------------- */
|
||||
|
||||
typedef int gl_rwlock_t;
|
||||
# define gl_rwlock_define(STORAGECLASS, NAME)
|
||||
# define gl_rwlock_define_initialized(STORAGECLASS, NAME)
|
||||
# define glthread_rwlock_init(NAME) 0
|
||||
# define glthread_rwlock_rdlock(NAME) 0
|
||||
# define glthread_rwlock_wrlock(NAME) 0
|
||||
# define glthread_rwlock_unlock(NAME) 0
|
||||
# define glthread_rwlock_destroy(NAME) 0
|
||||
|
||||
/* --------------------- gl_recursive_lock_t datatype --------------------- */
|
||||
|
||||
typedef int gl_recursive_lock_t;
|
||||
# define gl_recursive_lock_define(STORAGECLASS, NAME)
|
||||
# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME)
|
||||
# define glthread_recursive_lock_init(NAME) 0
|
||||
# define glthread_recursive_lock_lock(NAME) 0
|
||||
# define glthread_recursive_lock_unlock(NAME) 0
|
||||
# define glthread_recursive_lock_destroy(NAME) 0
|
||||
|
||||
/* -------------------------- gl_once_t datatype -------------------------- */
|
||||
|
||||
typedef int gl_once_t;
|
||||
# define gl_once_define(STORAGECLASS, NAME) \
|
||||
STORAGECLASS gl_once_t NAME = 0;
|
||||
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
|
||||
(*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0)
|
||||
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
/* Macros with built-in error handling. */
|
||||
|
||||
/* -------------------------- gl_lock_t datatype -------------------------- */
|
||||
|
||||
#define gl_lock_init(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_lock_init (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_lock_lock(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_lock_lock (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_lock_unlock(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_lock_unlock (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_lock_destroy(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_lock_destroy (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* ------------------------- gl_rwlock_t datatype ------------------------- */
|
||||
|
||||
#define gl_rwlock_init(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_rwlock_init (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_rwlock_rdlock(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_rwlock_rdlock (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_rwlock_wrlock(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_rwlock_wrlock (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_rwlock_unlock(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_rwlock_unlock (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_rwlock_destroy(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_rwlock_destroy (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* --------------------- gl_recursive_lock_t datatype --------------------- */
|
||||
|
||||
#define gl_recursive_lock_init(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_recursive_lock_init (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_recursive_lock_lock(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_recursive_lock_lock (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_recursive_lock_unlock(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_recursive_lock_unlock (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
#define gl_recursive_lock_destroy(NAME) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_recursive_lock_destroy (&NAME)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* -------------------------- gl_once_t datatype -------------------------- */
|
||||
|
||||
#define gl_once(NAME, INITFUNCTION) \
|
||||
do \
|
||||
{ \
|
||||
if (glthread_once (&NAME, INITFUNCTION)) \
|
||||
abort (); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
#endif /* _LOCK_H */
|
|
@ -0,0 +1,128 @@
|
|||
/* Log file output.
|
||||
Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Handle multi-threaded applications. */
|
||||
#ifdef _LIBC
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
# include "lock.h"
|
||||
#endif
|
||||
|
||||
/* Separator between msgctxt and msgid in .mo files. */
|
||||
#define MSGCTXT_SEPARATOR '\004' /* EOT */
|
||||
|
||||
/* Print an ASCII string with quotes and escape sequences where needed. */
|
||||
static void
|
||||
print_escaped (FILE *stream, const char *str, const char *str_end)
|
||||
{
|
||||
putc ('"', stream);
|
||||
for (; str != str_end; str++)
|
||||
if (*str == '\n')
|
||||
{
|
||||
fputs ("\\n\"", stream);
|
||||
if (str + 1 == str_end)
|
||||
return;
|
||||
fputs ("\n\"", stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*str == '"' || *str == '\\')
|
||||
putc ('\\', stream);
|
||||
putc (*str, stream);
|
||||
}
|
||||
putc ('"', stream);
|
||||
}
|
||||
|
||||
static char *last_logfilename = NULL;
|
||||
static FILE *last_logfile = NULL;
|
||||
__libc_lock_define_initialized (static, lock)
|
||||
|
||||
static inline void
|
||||
_nl_log_untranslated_locked (const char *logfilename, const char *domainname,
|
||||
const char *msgid1, const char *msgid2, int plural)
|
||||
{
|
||||
FILE *logfile;
|
||||
const char *separator;
|
||||
|
||||
/* Can we reuse the last opened logfile? */
|
||||
if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0)
|
||||
{
|
||||
/* Close the last used logfile. */
|
||||
if (last_logfilename != NULL)
|
||||
{
|
||||
if (last_logfile != NULL)
|
||||
{
|
||||
fclose (last_logfile);
|
||||
last_logfile = NULL;
|
||||
}
|
||||
free (last_logfilename);
|
||||
last_logfilename = NULL;
|
||||
}
|
||||
/* Open the logfile. */
|
||||
last_logfilename = (char *) malloc (strlen (logfilename) + 1);
|
||||
if (last_logfilename == NULL)
|
||||
return;
|
||||
strcpy (last_logfilename, logfilename);
|
||||
last_logfile = fopen (logfilename, "a");
|
||||
if (last_logfile == NULL)
|
||||
return;
|
||||
}
|
||||
logfile = last_logfile;
|
||||
|
||||
fprintf (logfile, "domain ");
|
||||
print_escaped (logfile, domainname, domainname + strlen (domainname));
|
||||
separator = strchr (msgid1, MSGCTXT_SEPARATOR);
|
||||
if (separator != NULL)
|
||||
{
|
||||
/* The part before the MSGCTXT_SEPARATOR is the msgctxt. */
|
||||
fprintf (logfile, "\nmsgctxt ");
|
||||
print_escaped (logfile, msgid1, separator);
|
||||
msgid1 = separator + 1;
|
||||
}
|
||||
fprintf (logfile, "\nmsgid ");
|
||||
print_escaped (logfile, msgid1, msgid1 + strlen (msgid1));
|
||||
if (plural)
|
||||
{
|
||||
fprintf (logfile, "\nmsgid_plural ");
|
||||
print_escaped (logfile, msgid2, msgid2 + strlen (msgid2));
|
||||
fprintf (logfile, "\nmsgstr[0] \"\"\n");
|
||||
}
|
||||
else
|
||||
fprintf (logfile, "\nmsgstr \"\"\n");
|
||||
putc ('\n', logfile);
|
||||
}
|
||||
|
||||
/* Add to the log file an entry denoting a failed translation. */
|
||||
void
|
||||
_nl_log_untranslated (const char *logfilename, const char *domainname,
|
||||
const char *msgid1, const char *msgid2, int plural)
|
||||
{
|
||||
__libc_lock_lock (lock);
|
||||
_nl_log_untranslated_locked (logfilename, domainname, msgid1, msgid2, plural);
|
||||
__libc_lock_unlock (lock);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/* Implementation of ngettext(3) function.
|
||||
Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __need_NULL
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# include <stdlib.h> /* Just for NULL. */
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define NGETTEXT __ngettext
|
||||
# define DCNGETTEXT __dcngettext
|
||||
#else
|
||||
# define NGETTEXT libintl_ngettext
|
||||
# define DCNGETTEXT libintl_dcngettext
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
char *
|
||||
NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n)
|
||||
{
|
||||
return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__ngettext, ngettext);
|
||||
#endif
|
|
@ -0,0 +1,98 @@
|
|||
/* OS/2 compatibility functions.
|
||||
Copyright (C) 2001-2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#define OS2_AWARE
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
/* A version of getenv() that works from DLLs */
|
||||
extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue);
|
||||
|
||||
char *
|
||||
_nl_getenv (const char *name)
|
||||
{
|
||||
unsigned char *value;
|
||||
if (DosScanEnv (name, &value))
|
||||
return NULL;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
/* A fixed size buffer. */
|
||||
char libintl_nl_default_dirname[MAXPATHLEN+1];
|
||||
|
||||
char *_nlos2_libdir = NULL;
|
||||
char *_nlos2_localealiaspath = NULL;
|
||||
char *_nlos2_localedir = NULL;
|
||||
|
||||
static __attribute__((constructor)) void
|
||||
nlos2_initialize ()
|
||||
{
|
||||
char *root = getenv ("UNIXROOT");
|
||||
char *gnulocaledir = getenv ("GNULOCALEDIR");
|
||||
|
||||
_nlos2_libdir = gnulocaledir;
|
||||
if (!_nlos2_libdir)
|
||||
{
|
||||
if (root)
|
||||
{
|
||||
size_t sl = strlen (root);
|
||||
_nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
|
||||
memcpy (_nlos2_libdir, root, sl);
|
||||
memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
|
||||
}
|
||||
else
|
||||
_nlos2_libdir = LIBDIR;
|
||||
}
|
||||
|
||||
_nlos2_localealiaspath = gnulocaledir;
|
||||
if (!_nlos2_localealiaspath)
|
||||
{
|
||||
if (root)
|
||||
{
|
||||
size_t sl = strlen (root);
|
||||
_nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
|
||||
memcpy (_nlos2_localealiaspath, root, sl);
|
||||
memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
|
||||
}
|
||||
else
|
||||
_nlos2_localealiaspath = LOCALE_ALIAS_PATH;
|
||||
}
|
||||
|
||||
_nlos2_localedir = gnulocaledir;
|
||||
if (!_nlos2_localedir)
|
||||
{
|
||||
if (root)
|
||||
{
|
||||
size_t sl = strlen (root);
|
||||
_nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
|
||||
memcpy (_nlos2_localedir, root, sl);
|
||||
memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
|
||||
}
|
||||
else
|
||||
_nlos2_localedir = LOCALEDIR;
|
||||
}
|
||||
|
||||
if (strlen (_nlos2_localedir) <= MAXPATHLEN)
|
||||
strcpy (libintl_nl_default_dirname, _nlos2_localedir);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/* OS/2 compatibility defines.
|
||||
This file is intended to be included from config.h
|
||||
Copyright (C) 2001-2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* When included from os2compat.h we need all the original definitions */
|
||||
#ifndef OS2_AWARE
|
||||
|
||||
#undef LIBDIR
|
||||
#define LIBDIR _nlos2_libdir
|
||||
extern char *_nlos2_libdir;
|
||||
|
||||
#undef LOCALEDIR
|
||||
#define LOCALEDIR _nlos2_localedir
|
||||
extern char *_nlos2_localedir;
|
||||
|
||||
#undef LOCALE_ALIAS_PATH
|
||||
#define LOCALE_ALIAS_PATH _nlos2_localealiaspath
|
||||
extern char *_nlos2_localealiaspath;
|
||||
|
||||
#endif
|
||||
|
||||
#undef HAVE_STRCASECMP
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
|
||||
/* We have our own getenv() which works even if library is compiled as DLL */
|
||||
#define getenv _nl_getenv
|
||||
|
||||
/* Older versions of gettext used -1 as the value of LC_MESSAGES */
|
||||
#define LC_MESSAGES_COMPAT (-1)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue