This commit is contained in:
250
ase/lib/cmn/asecmn.bdsproj
Normal file
250
ase/lib/cmn/asecmn.bdsproj
Normal file
@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<BorlandProject>
|
||||
<PersonalityInfo>
|
||||
<Option>
|
||||
<Option Name="Personality">CPlusPlusBuilder.Personality</Option>
|
||||
<Option Name="ProjectType">CppStaticLibrary</Option>
|
||||
<Option Name="Version">1.0</Option>
|
||||
<Option Name="GUID">{C16C0B49-6DA4-43F4-9DA8-021728817084}</Option>
|
||||
</Option>
|
||||
</PersonalityInfo>
|
||||
<CPlusPlusBuilder.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">misc.c</Source>
|
||||
</Source>
|
||||
<BCBPROJECT>
|
||||
<project version="10.0">
|
||||
<property category="build.config" name="active" value="0"/>
|
||||
<property category="build.config" name="count" value="1"/>
|
||||
<property category="build.config" name="excludedefaultforzero" value="0"/>
|
||||
<property category="build.config.0" name="builddir" value="Debug"/>
|
||||
<property category="build.config.0" name="key" value="Debug_Build"/>
|
||||
<property category="build.config.0" name="name" value="Debug Build"/>
|
||||
<property category="build.config.0" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.0" name="type" value="Toolset"/>
|
||||
<property category="build.config.0" name="win32.win32b.builddir" value="debug"/>
|
||||
<property category="build.config.1" name="key" value="Release_Build"/>
|
||||
<property category="build.config.1" name="name" value="Release Build"/>
|
||||
<property category="build.config.1" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.1" name="type" value="Toolset"/>
|
||||
<property category="build.config.1" name="win32.win32b.builddir" value="release"/>
|
||||
<property category="build.node" name="lastconfig" value="Debug_Build"/>
|
||||
<property category="build.node" name="libraries" value="vcl.lib rtl.lib"/>
|
||||
<property category="build.node" name="name" value="asecmn.lib"/>
|
||||
<property category="build.node" name="packages" value="vclx;vcl;rtl;dbrtl;vcldb;adortl;dbxcds;dbexpress;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;soaprtl;dsnap;bdertl;vcldbx"/>
|
||||
<property category="build.node" name="sparelibs" value="rtl.lib vcl.lib"/>
|
||||
<property category="build.node" name="use_packages" value="0"/>
|
||||
<property category="build.platform" name="active" value="win32"/>
|
||||
<property category="build.platform" name="win32.Debug_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.Release_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.default" value="win32b"/>
|
||||
<property category="build.platform" name="win32.enabled" value="1"/>
|
||||
<property category="build.platform" name="win32.win32b.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.listfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.objfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.xreffile.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.A.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.AK.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.AU.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.1" value="_DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.H=.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.H=.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Hc.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.He.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Hs.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Jgi.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Jgx.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Od.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.k.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.1" value="debug"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.r.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vG.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vG0.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vi.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.y.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$O.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.1" value="DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.V.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.Gn.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib\debug"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.z.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zi.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tlib" name="option.outputdir.arg.1" value="..\debug\lib"/>
|
||||
<property category="win32.Debug_Build.win32b.tlib" name="option.outputdir.arg.merge" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.tlib" name="option.outputdir.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.1" value="NDEBUG"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.H=.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.H=.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.Hc.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.He.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.Hs.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.O2.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.k.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.1" value="release"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.noregistervars.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.r.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.rd.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.vi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$D.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$O.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.V.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib\release"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.z.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zi.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zn.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.tlib" name="option.outputdir.arg.1" value="..\release\lib"/>
|
||||
<property category="win32.Release_Build.win32b.tlib" name="option.outputdir.arg.merge" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tlib" name="option.outputdir.enabled" value="1"/>
|
||||
<optionset name="all_configurations">
|
||||
<property category="node" name="displayname" value="All Configurations"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.1" value="$(BDS)\lib\vcl100.csm"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hc.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.1" value="..\.."/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.2" value="C:\projects\ase\cmn"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.3" value="$(BDS)\include"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.4" value="$(BDS)\include\dinkumware"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.5" value="$(BDS)\include\vcl"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.b.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.n.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.n.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.1" value="_RTLDLL"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.2" value="NO_STRICT"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tW.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWC.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWD.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWM.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.1" value="C:\projects\ase\cmn"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.1" value="C:\projects\ase\cmn"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.1" value="C:\projects\ase\cmn"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.1" value="C:\projects\ase\cmn"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.2" value="C:\Documents and Settings\Administrator\My Documents\Borland Studio Projects"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.3" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.4" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.1" value="C:\projects\ase\cmn"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Gi.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.3" value="$(BDS)\lib\psdk"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpd.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpe.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpp.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.aa.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.ap.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.dynamicrtl.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.tlib" name="option.dynamicrtl.enabled" value="0"/>
|
||||
</optionset>
|
||||
</project>
|
||||
<FILELIST>
|
||||
<FILE FILENAME="str_bas.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="str" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="str_cnv.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="str" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="str_dyn.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="str" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="mem.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="mem" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="misc.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="misc" FORMNAME="" DESIGNCLASS=""/>
|
||||
</FILELIST>
|
||||
<IDEOPTIONS>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1033</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
<Debugging>
|
||||
<Debugging Name="DebugSourceDirs"></Debugging>
|
||||
</Debugging>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams"></Parameters>
|
||||
<Parameters Name="Launcher"></Parameters>
|
||||
<Parameters Name="UseLauncher">False</Parameters>
|
||||
<Parameters Name="DebugCWD"></Parameters>
|
||||
<Parameters Name="HostApplication"></Parameters>
|
||||
<Parameters Name="RemoteHost"></Parameters>
|
||||
<Parameters Name="RemotePath"></Parameters>
|
||||
<Parameters Name="RemoteParams"></Parameters>
|
||||
<Parameters Name="RemoteLauncher"></Parameters>
|
||||
<Parameters Name="UseRemoteLauncher">False</Parameters>
|
||||
<Parameters Name="RemoteCWD"></Parameters>
|
||||
<Parameters Name="RemoteDebug">False</Parameters>
|
||||
<Parameters Name="Debug Symbols Search Path"></Parameters>
|
||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||
</Parameters>
|
||||
<Linker>
|
||||
<Linker Name="LibPrefix"></Linker>
|
||||
<Linker Name="LibSuffix"></Linker>
|
||||
<Linker Name="LibVersion"></Linker>
|
||||
</Linker>
|
||||
</IDEOPTIONS>
|
||||
</BCBPROJECT>
|
||||
<buildevents>
|
||||
<buildevent file="asecmn.bdsproj">
|
||||
<precompile mode="0" cancancel="0" capture="-1" showconsole="0">mkdir $(PROJECTDIR)..\release\lib
|
||||
mkdir $(PROJECTDIR)..\debug\lib
|
||||
</precompile>
|
||||
</buildevent>
|
||||
</buildevents>
|
||||
</CPlusPlusBuilder.Personality>
|
||||
</BorlandProject>
|
132
ase/lib/cmn/asecmn.dsp
Normal file
132
ase/lib/cmn/asecmn.dsp
Normal file
@ -0,0 +1,132 @@
|
||||
# Microsoft Developer Studio Project File - Name="asecmn" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=asecmn - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asecmn.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asecmn.mak" CFG="asecmn - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "asecmn - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "asecmn - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "asecmn - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../release/lib"
|
||||
# PROP Intermediate_Dir "release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /Za /W3 /GX /O2 /I "../.." /D "NDEBUG" /D "WIN32" /D "_UNICODE" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "asecmn - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../debug/lib"
|
||||
# PROP Intermediate_Dir "debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /Za /W3 /Gm /GX /ZI /Od /I "../.." /D "_DEBUG" /D "WIN32" /D "_UNICODE" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "asecmn - Win32 Release"
|
||||
# Name "asecmn - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mem.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\str_bas.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\str_cnv.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\str_dyn.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mem.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\str.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
528
ase/lib/cmn/asecmn.vcproj
Normal file
528
ase/lib/cmn/asecmn.vcproj
Normal file
@ -0,0 +1,528 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="asecmn"
|
||||
ProjectGUID="{17621C83-40C9-4305-BAF9-132E250B5FE3}"
|
||||
RootNamespace="asecmn"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../.."
|
||||
PreprocessorDefinitions="_DEBUG;WIN32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DisableLanguageExtensions="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../.."
|
||||
PreprocessorDefinitions="_DEBUG;WIN32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DisableLanguageExtensions="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="../.."
|
||||
PreprocessorDefinitions="NDEBUG;WIN32"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="../.."
|
||||
PreprocessorDefinitions="NDEBUG;WIN32"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="mem.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="misc.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="str_bas.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="str_cnv.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="str_dyn.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="mem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="str.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
64
ase/lib/cmn/conf_msw.h
Normal file
64
ase/lib/cmn/conf_msw.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* $Id: conf_msw.h 116 2008-03-03 11:15:37Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
/*
|
||||
Macro Meaning
|
||||
_WIN64 A 64-bit platform.
|
||||
_WIN32 A 32-bit platform. This value is also defined by the 64-bit
|
||||
compiler for backward compatibility.
|
||||
_WIN16 A 16-bit platform
|
||||
|
||||
The following macros are specific to the architecture.
|
||||
|
||||
Macro Meaning
|
||||
_M_IA64 Intel Itanium Processor Family
|
||||
_M_IX86 x86 platform
|
||||
_M_X64 x64 platform
|
||||
*/
|
||||
|
||||
#define ASE_ENDIAN_LITTLE
|
||||
|
||||
#define ASE_SIZEOF_CHAR 1
|
||||
#define ASE_SIZEOF_SHORT 2
|
||||
#define ASE_SIZEOF_INT 4
|
||||
|
||||
/*#ifdef _WIN64
|
||||
#define ASE_SIZEOF_LONG 8
|
||||
#else*/
|
||||
#define ASE_SIZEOF_LONG 4
|
||||
/*#endif*/
|
||||
|
||||
#if defined(__POCC__) || defined(__DMC__)
|
||||
/* pelles c with no microsoft extension */
|
||||
#define ASE_SIZEOF_LONG_LONG 8
|
||||
|
||||
#define ASE_SIZEOF___INT8 0
|
||||
#define ASE_SIZEOF___INT16 0
|
||||
#define ASE_SIZEOF___INT32 0
|
||||
#define ASE_SIZEOF___INT64 0
|
||||
#define ASE_SIZEOF___INT96 0
|
||||
#define ASE_SIZEOF___INT128 0
|
||||
#else
|
||||
#define ASE_SIZEOF_LONG_LONG 0
|
||||
|
||||
#define ASE_SIZEOF___INT8 1
|
||||
#define ASE_SIZEOF___INT16 2
|
||||
#define ASE_SIZEOF___INT32 4
|
||||
#define ASE_SIZEOF___INT64 8
|
||||
#define ASE_SIZEOF___INT96 0
|
||||
#define ASE_SIZEOF___INT128 0
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#define ASE_SIZEOF_VOID_P 8
|
||||
#else
|
||||
#define ASE_SIZEOF_VOID_P 4
|
||||
#endif
|
||||
|
||||
#define ASE_SIZEOF_FLOAT 4
|
||||
#define ASE_SIZEOF_DOUBLE 8
|
||||
#define ASE_SIZEOF_LONG_DOUBLE 16
|
||||
#define ASE_SIZEOF_WCHAR_T 2
|
44
ase/lib/cmn/conf_unx.h.in
Normal file
44
ase/lib/cmn/conf_unx.h.in
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* $Id: conf_unx.h.in,v 1.3 2007/04/30 05:55:36 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
/* Big Endian */
|
||||
#undef ASE_ENDIAN_BIG
|
||||
|
||||
/* Little Endian */
|
||||
#undef ASE_ENDIAN_LITTLE
|
||||
|
||||
/* Unknown Endian */
|
||||
#undef ASE_ENDIAN_UNKNOWN
|
||||
|
||||
/* long long */
|
||||
#undef ASE_HAVE_LONG_LONG
|
||||
|
||||
/* long double */
|
||||
#undef ASE_HAVE_LONG_DOUBLE
|
||||
|
||||
/* data type size */
|
||||
#define ASE_SIZEOF_CHAR 0
|
||||
#define ASE_SIZEOF_SHORT 0
|
||||
#define ASE_SIZEOF_INT 0
|
||||
#define ASE_SIZEOF_LONG 0
|
||||
#define ASE_SIZEOF_LONG_LONG 0
|
||||
#define ASE_SIZEOF___INT8 0
|
||||
#define ASE_SIZEOF___INT16 0
|
||||
#define ASE_SIZEOF___INT32 0
|
||||
#define ASE_SIZEOF___INT64 0
|
||||
#define ASE_SIZEOF___INT128 0
|
||||
#define ASE_SIZEOF_VOID_P 0
|
||||
#define ASE_SIZEOF_FLOAT 0
|
||||
#define ASE_SIZEOF_DOUBLE 0
|
||||
#define ASE_SIZEOF_LONG_DOUBLE 0
|
||||
#define ASE_SIZEOF_WCHAR_T 0
|
||||
|
||||
/* char is wchar */
|
||||
#undef ASE_CHAR_IS_WCHAR
|
||||
|
||||
/* char is mchar */
|
||||
#undef ASE_CHAR_IS_MCHAR
|
||||
|
90
ase/lib/cmn/conf_vms.h
Normal file
90
ase/lib/cmn/conf_vms.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* $Id: conf_vms.h 116 2008-03-03 11:15:37Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
/* all of vax, alpha, ia64 are in the little endian. */
|
||||
#define ASE_ENDIAN_LITTLE
|
||||
|
||||
/*
|
||||
* Refer to the chapter 3 of the following URL for the data sizes.
|
||||
* http://h71000.www7.hp.com/commercial/c/docs/6180profile.html
|
||||
*/
|
||||
|
||||
#define ASE_SIZEOF_CHAR 1
|
||||
#define ASE_SIZEOF_SHORT 2
|
||||
#define ASE_SIZEOF_INT 4
|
||||
#define ASE_SIZEOF_LONG 4
|
||||
|
||||
#if defined(vax) || defined(__vax)
|
||||
#define ASE_SIZEOF_LONG_LONG 0
|
||||
#elif defined(alpha) || defined(__alpha)
|
||||
#define ASE_SIZEOF_LONG_LONG 8
|
||||
#elif defined(ia64) || defined(__ia64)
|
||||
#define ASE_SIZEOF_LONG_LONG 8
|
||||
#else
|
||||
#define ASE_SIZEOF_LONG_LONG 0
|
||||
#endif
|
||||
|
||||
#define ASE_SIZEOF___INT8 1
|
||||
#define ASE_SIZEOF___INT16 2
|
||||
#define ASE_SIZEOF___INT32 4
|
||||
|
||||
#if defined(vax) || defined(__vax)
|
||||
#define ASE_SIZEOF___INT64 0
|
||||
#elif defined(alpha) || defined(__alpha)
|
||||
#define ASE_SIZEOF___INT64 8
|
||||
#elif defined(ia64) || defined(__ia64)
|
||||
#define ASE_SIZEOF___INT64 8
|
||||
#else
|
||||
#define ASE_SIZEOF___INT64 0
|
||||
#endif
|
||||
|
||||
#define ASE_SIZEOF___INT96 0
|
||||
#define ASE_SIZEOF___INT128 0
|
||||
|
||||
#if defined(vax) || defined(__vax)
|
||||
#define ASE_SIZEOF_VOID_P 4
|
||||
#elif defined(alpha) || defined(__alpha)
|
||||
#if __INITIAL_POINTER_SIZE==64
|
||||
#pragma pointer_size 64
|
||||
#define ASE_SIZEOF_VOID_P 8
|
||||
#elif __INITIAL_POINTER_SIZE==32
|
||||
#pragma pointer_size 32
|
||||
#define ASE_SIZEOF_VOID_P 4
|
||||
#elif __INITIAL_POINTER_SIZE==0
|
||||
#define ASE_SIZEOF_VOID_P 4
|
||||
#else
|
||||
#error "unsupported initial pointer size"
|
||||
#endif
|
||||
#elif defined(ia64) || defined(__ia64)
|
||||
#if __INITIAL_POINTER_SIZE==64
|
||||
#pragma pointer_size 64
|
||||
#define ASE_SIZEOF_VOID_P 8
|
||||
#elif __INITIAL_POINTER_SIZE==32
|
||||
#pragma pointer_size 32
|
||||
#define ASE_SIZEOF_VOID_P 4
|
||||
#elif __INITIAL_POINTER_SIZE==0
|
||||
#define ASE_SIZEOF_VOID_P 4
|
||||
#else
|
||||
#error "unsupported initial pointer size"
|
||||
#endif
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
|
||||
#define ASE_SIZEOF_FLOAT 4
|
||||
#define ASE_SIZEOF_DOUBLE 8
|
||||
|
||||
#if defined(vax) || defined(__vax)
|
||||
#define ASE_SIZEOF_LONG_DOUBLE 8
|
||||
#elif defined(alpha) || defined(__alpha)
|
||||
#define ASE_SIZEOF_LONG_DOUBLE 16
|
||||
#elif defined(ia64) || defined(__ia64)
|
||||
#define ASE_SIZEOF_LONG_DOUBLE 16
|
||||
#else
|
||||
#define ASE_SIZEOF_LONG_DOUBLE 0
|
||||
#endif
|
||||
|
||||
#define ASE_SIZEOF_WCHAR_T 4
|
21
ase/lib/cmn/descrip.mms
Normal file
21
ase/lib/cmn/descrip.mms
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# OpenVMS MMS/MMK
|
||||
#
|
||||
|
||||
objects = mem.obj,str_bas.obj,str_cnv.obj,str_dyn.obj,map.obj,rex.obj,misc.obj
|
||||
|
||||
CFLAGS = /include="../.."
|
||||
#CFLAGS = /pointer_size=long /include="../.."
|
||||
LIBRFLAGS =
|
||||
|
||||
asecmn.olb : $(objects)
|
||||
$(LIBR)/create $(MMS$TARGET) $(objects)
|
||||
# $(LIBR)/replace $(LIBRFLAGS) $(MMS$TARGET),$(objects)
|
||||
|
||||
mem.obj depends_on mem.c
|
||||
str_bas.obj depends_on str_bas.c
|
||||
str_cnv.obj depends_on str_cnv.c
|
||||
str_dyn.obj depends_on str_dyn.c
|
||||
map.obj depends_on map.c
|
||||
rex.obj depends_on rex.c
|
||||
misc.obj depends_on misc.c
|
161
ase/lib/cmn/macros.h
Normal file
161
ase/lib/cmn/macros.h
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* $Id: macros.h 116 2008-03-03 11:15:37Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#ifndef _ASE_MACROS_H_
|
||||
#define _ASE_MACROS_H_
|
||||
|
||||
#include <ase/cmn/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
/*#define ASE_NULL ((ase_uint_t)0)*/
|
||||
#define ASE_NULL (0)
|
||||
#else
|
||||
#define ASE_NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
#define ASE_CHAR_EOF ((ase_cint_t)-1)
|
||||
|
||||
#define ASE_SIZEOF(n) (sizeof(n))
|
||||
#define ASE_COUNTOF(n) (sizeof(n)/sizeof(n[0]))
|
||||
#define ASE_OFFSETOF(type,member) ((ase_size_t)&((type*)0)->member)
|
||||
|
||||
#define ASE_TYPE_IS_SIGNED(type) (((type)0) > ((type)-1))
|
||||
#define ASE_TYPE_IS_UNSIGNED(type) (((type)0) < ((type)-1))
|
||||
|
||||
#define ASE_TYPE_SIGNED_MAX(type) \
|
||||
((type)~((type)1 << (ASE_SIZEOF(type) * 8 - 1)))
|
||||
#define ASE_TYPE_UNSIGNED_MAX(type) ((type)(~(type)0))
|
||||
|
||||
#define ASE_TYPE_SIGNED_MIN(type) \
|
||||
((type)((type)1 << (ASE_SIZEOF(type) * 8 - 1)))
|
||||
#define ASE_TYPE_UNSIGNED_MIN(type) ((type)0)
|
||||
|
||||
#define ASE_TYPE_MAX(type) \
|
||||
((ASE_TYPE_IS_SIGNED(type)? ASE_TYPE_SIGNED_MAX(type): ASE_TYPE_UNSIGNED_MAX(type)))
|
||||
#define ASE_TYPE_MIN(type) \
|
||||
((ASE_TYPE_IS_SIGNED(type)? ASE_TYPE_SIGNED_MIN(type): ASE_TYPE_UNSIGNED_MIN(type)))
|
||||
|
||||
#define ASE_IS_POWOF2(x) (((x) & ((x) - 1)) == 0)
|
||||
|
||||
#define ASE_SWAP(x,y,original_type,casting_type) \
|
||||
do { \
|
||||
x = (original_type)((casting_type)(x) ^ (casting_type)(y)); \
|
||||
y = (original_type)((casting_type)(y) ^ (casting_type)(x)); \
|
||||
x = (original_type)((casting_type)(x) ^ (casting_type)(y)); \
|
||||
} while (0)
|
||||
|
||||
#define ASE_ABS(x) ((x) < 0? -(x): (x))
|
||||
|
||||
#define ASE_LOOP_CONTINUE(id) goto __loop_ ## id ## _begin__;
|
||||
#define ASE_LOOP_BREAK(id) goto __loop_ ## id ## _end__;
|
||||
#define ASE_LOOP_BEGIN(id) __loop_ ## id ## _begin__: {
|
||||
#define ASE_LOOP_END(id) ASE_LOOP_CONTINUE(id) } __loop_ ## id ## _end__:;
|
||||
|
||||
#define ASE_REPEAT(n,blk) \
|
||||
do { \
|
||||
ase_size_t __ase_repeat_x1__ = (ase_size_t)(n); \
|
||||
ase_size_t __ase_repeat_x2__ = __ase_repeat_x1__ >> 4; \
|
||||
__ase_repeat_x1__ &= 15; \
|
||||
while (__ase_repeat_x1__-- > 0) { blk; } \
|
||||
while (__ase_repeat_x2__-- > 0) { \
|
||||
blk; blk; blk; blk; blk; blk; blk; blk; \
|
||||
blk; blk; blk; blk; blk; blk; blk; blk; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define ASE_MQ_I(val) #val
|
||||
#define ASE_MQ(val) ASE_MQ_I(val)
|
||||
#define ASE_MC(ch) ((ase_mchar_t)ch)
|
||||
#define ASE_MS(str) ((const ase_mchar_t*)str)
|
||||
#define ASE_MT(txt) (txt)
|
||||
|
||||
#define ASE_WQ_I(val) (L ## #val)
|
||||
#define ASE_WQ(val) ASE_WQ_I(val)
|
||||
#define ASE_WC(ch) ((ase_wchar_t)L ## ch)
|
||||
#define ASE_WS(str) ((const ase_wchar_t*)L ## str)
|
||||
#define ASE_WT(txt) (L ## txt)
|
||||
|
||||
#if defined(ASE_CHAR_IS_MCHAR)
|
||||
#define ASE_C(ch) ASE_MC(ch)
|
||||
#define ASE_S(str) ASE_MS(str)
|
||||
#define ASE_T(txt) ASE_MT(txt)
|
||||
#else
|
||||
#define ASE_C(ch) ASE_WC(ch)
|
||||
#define ASE_S(str) ASE_WS(str)
|
||||
#define ASE_T(txt) ASE_WT(txt)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define ASE_BEGIN_PACKED_STRUCT(x) struct x {
|
||||
#define ASE_END_PACKED_STRUCT() } __attribute__((packed));
|
||||
#else
|
||||
#define ASE_BEGIN_PACKED_STRUCT(x) struct x {
|
||||
#define ASE_END_PACKED_STRUCT() };
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define ASE_ASSERT(expr) ((void)0)
|
||||
#define ASE_ASSERTX(expr,desc) ((void)0)
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void ase_assert_abort (void);
|
||||
void ase_assert_printf (const ase_char_t* fmt, ...);
|
||||
int ase_assert_failed (
|
||||
const ase_char_t* expr, const ase_char_t* desc,
|
||||
const ase_char_t* file, ase_size_t line);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ASE_ASSERT(expr) (void)((expr) || \
|
||||
(ase_assert_failed (ASE_T(#expr), ASE_NULL, ASE_T(__FILE__), __LINE__), 0))
|
||||
#define ASE_ASSERTX(expr,desc) (void)((expr) || \
|
||||
(ase_assert_failed (ASE_T(#expr), ASE_T(desc), ASE_T(__FILE__), __LINE__), 0))
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
#include <stdlib.h>
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <crtdbg.h>
|
||||
|
||||
#define ASE_MALLOC(mmgr,size) malloc (size)
|
||||
#define ASE_REALLOC(mmgr,ptr,size) realloc (ptr, size)
|
||||
#define ASE_FREE(mmgr,ptr) free (ptr)
|
||||
#else
|
||||
|
||||
#define ASE_MALLOC(mmgr,size) \
|
||||
(mmgr)->malloc((mmgr)->custom_data, size)
|
||||
#define ASE_REALLOC(mmgr,ptr,size) \
|
||||
(mmgr)->realloc((mmgr)->custom_data, ptr, size)
|
||||
#define ASE_FREE(mmgr,ptr) \
|
||||
(mmgr)->free((mmgr)->custom_data, ptr)
|
||||
#endif
|
||||
|
||||
#define ASE_ISUPPER(ccls,c) (ccls)->is_upper((ccls)->custom_data,c)
|
||||
#define ASE_ISLOWER(ccls,c) (ccls)->is_lower((ccls)->custom_data,c)
|
||||
#define ASE_ISALPHA(ccls,c) (ccls)->is_alpha((ccls)->custom_data,c)
|
||||
#define ASE_ISDIGIT(ccls,c) (ccls)->is_digit((ccls)->custom_data,c)
|
||||
#define ASE_ISXDIGIT(ccls,c) (ccls)->is_xdigit((ccls)->custom_data,c)
|
||||
#define ASE_ISALNUM(ccls,c) (ccls)->is_alnum((ccls)->custom_data,c)
|
||||
#define ASE_ISSPACE(ccls,c) (ccls)->is_space((ccls)->custom_data,c)
|
||||
#define ASE_ISPRINT(ccls,c) (ccls)->is_print((ccls)->custom_data,c)
|
||||
#define ASE_ISGRAPH(ccls,c) (ccls)->is_graph((ccls)->custom_data,c)
|
||||
#define ASE_ISCNTRL(ccls,c) (ccls)->is_cntrl((ccls)->custom_data,c)
|
||||
#define ASE_ISPUNCT(ccls,c) (ccls)->is_punct((ccls)->custom_data,c)
|
||||
#define ASE_TOUPPER(ccls,c) (ccls)->to_upper((ccls)->custom_data,c)
|
||||
#define ASE_TOLOWER(ccls,c) (ccls)->to_lower((ccls)->custom_data,c)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define ASE_BEGIN_NAMESPACE(x) namespace x {
|
||||
#define ASE_END_NAMESPACE(x) }
|
||||
#define ASE_BEGIN_NAMESPACE2(x,y) namespace x { namespace y {
|
||||
#define ASE_END_NAMESPACE2(y,x) }}
|
||||
#endif
|
||||
|
||||
#endif
|
65
ase/lib/cmn/makefile.in
Normal file
65
ase/lib/cmn/makefile.in
Normal file
@ -0,0 +1,65 @@
|
||||
#
|
||||
# $Id: makefile.in,v 1.3 2007/04/30 05:55:36 bacon Exp $
|
||||
#
|
||||
|
||||
NAME = asecmn
|
||||
|
||||
CC = @CC@
|
||||
AR = @AR@
|
||||
MAKE = @MAKE@
|
||||
RANLIB = @RANLIB@
|
||||
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/..
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
MODE = @BUILDMODE@
|
||||
|
||||
OUT_DIR = ../$(MODE)/lib
|
||||
OUT_FILE = $(OUT_DIR)/lib$(NAME).a
|
||||
|
||||
TMP_DIR = $(MODE)
|
||||
|
||||
OBJ_FILES = \
|
||||
$(TMP_DIR)/mem.o \
|
||||
$(TMP_DIR)/str_bas.o \
|
||||
$(TMP_DIR)/str_cnv.o \
|
||||
$(TMP_DIR)/str_dyn.o \
|
||||
$(TMP_DIR)/map.o \
|
||||
$(TMP_DIR)/rex.o \
|
||||
$(TMP_DIR)/misc.o
|
||||
|
||||
lib: $(OUT_FILE)
|
||||
|
||||
$(OUT_FILE): $(TMP_DIR) $(OBJ_FILES) $(OUT_DIR)
|
||||
$(AR) cr $(OUT_FILE) $(OBJ_FILES)
|
||||
if [ ! -z "$(RANLIB)" ]; then $(RANLIB) $(OUT_FILE); fi
|
||||
|
||||
$(TMP_DIR)/mem.o: mem.c
|
||||
$(CC) $(CFLAGS) -o $@ -c mem.c
|
||||
|
||||
$(TMP_DIR)/str_bas.o: str_bas.c
|
||||
$(CC) $(CFLAGS) -o $@ -c str_bas.c
|
||||
|
||||
$(TMP_DIR)/str_cnv.o: str_cnv.c
|
||||
$(CC) $(CFLAGS) -o $@ -c str_cnv.c
|
||||
|
||||
$(TMP_DIR)/str_dyn.o: str_dyn.c
|
||||
$(CC) $(CFLAGS) -o $@ -c str_dyn.c
|
||||
|
||||
$(TMP_DIR)/map.o: map.c
|
||||
$(CC) $(CFLAGS) -o $@ -c map.c
|
||||
|
||||
$(TMP_DIR)/rex.o: rex.c
|
||||
$(CC) $(CFLAGS) -o $@ -c rex.c
|
||||
|
||||
$(TMP_DIR)/misc.o: misc.c
|
||||
$(CC) $(CFLAGS) -o $@ -c misc.c
|
||||
|
||||
$(OUT_DIR):
|
||||
mkdir -p $(OUT_DIR)
|
||||
|
||||
$(TMP_DIR):
|
||||
mkdir -p $(TMP_DIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(OUT_FILE) $(OBJ_FILES)
|
||||
|
439
ase/lib/cmn/map.c
Normal file
439
ase/lib/cmn/map.c
Normal file
@ -0,0 +1,439 @@
|
||||
/*
|
||||
* $Id: map.c 156 2008-03-22 12:09:35Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#include <ase/cmn/map.h>
|
||||
#include <ase/cmn/str.h>
|
||||
|
||||
static ase_size_t hashkey (const ase_char_t* keyptr, ase_size_t keylen);
|
||||
static int rehash (ase_map_t* map);
|
||||
|
||||
#define FREE_PAIR(map,pair) \
|
||||
do { \
|
||||
if ((map)->freeval != ASE_NULL) \
|
||||
(map)->freeval ((map)->owner, ASE_PAIR_VAL(pair)); \
|
||||
ASE_FREE ((map)->mmgr, pair); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
#define RECYCLE_PAIR(map,pair) \
|
||||
do { \
|
||||
if ((map)->freeval != ASE_NULL) \
|
||||
(map)->freeval ((map)->owner, ASE_PAIR_VAL(pair)); \
|
||||
(pair)->next = (map)->fp; \
|
||||
(map)->fp = (pair); \
|
||||
} while (0)
|
||||
*/
|
||||
|
||||
ase_map_t* ase_map_open (
|
||||
void* owner, ase_size_t capa, unsigned int factor,
|
||||
void(*freeval)(void*,void*), void(*sameval)(void*,void*),
|
||||
ase_mmgr_t* mmgr)
|
||||
{
|
||||
ase_map_t* map;
|
||||
|
||||
ASE_ASSERTX (capa > 0, "the initial capacity should be greater than 0");
|
||||
|
||||
map = (ase_map_t*) ASE_MALLOC (mmgr, ASE_SIZEOF(ase_map_t));
|
||||
if (map == ASE_NULL) return ASE_NULL;
|
||||
|
||||
map->mmgr = mmgr;
|
||||
map->buck = (ase_pair_t**)
|
||||
ASE_MALLOC (mmgr, ASE_SIZEOF(ase_pair_t*)*capa);
|
||||
if (map->buck == ASE_NULL)
|
||||
{
|
||||
ASE_FREE (mmgr, map);
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
map->owner = owner;
|
||||
map->capa = capa;
|
||||
map->size = 0;
|
||||
map->freeval = freeval;
|
||||
map->sameval = sameval;
|
||||
while (capa > 0) map->buck[--capa] = ASE_NULL;
|
||||
|
||||
map->factor = factor;
|
||||
map->threshold = ((ase_size_t)map->factor) * map->capa / 100;
|
||||
|
||||
/*map->fp = ASE_NULL;*/
|
||||
return map;
|
||||
}
|
||||
|
||||
void ase_map_close (ase_map_t* map)
|
||||
{
|
||||
ase_map_clear (map);
|
||||
ASE_FREE (map->mmgr, map->buck);
|
||||
ASE_FREE (map->mmgr, map);
|
||||
}
|
||||
|
||||
void ase_map_clear (ase_map_t* map)
|
||||
{
|
||||
ase_size_t i;
|
||||
ase_pair_t* pair, * next;
|
||||
|
||||
/*
|
||||
while (map->fp != ASE_NULL)
|
||||
{
|
||||
next = ASE_PAIR_LNK(map->fp);
|
||||
ASE_FREE (map->mmgr, map->fp);
|
||||
map->fp = next;
|
||||
}
|
||||
*/
|
||||
|
||||
for (i = 0; i < map->capa; i++)
|
||||
{
|
||||
pair = map->buck[i];
|
||||
|
||||
while (pair != ASE_NULL)
|
||||
{
|
||||
next = ASE_PAIR_LNK(pair);
|
||||
FREE_PAIR (map, pair);
|
||||
map->size--;
|
||||
pair = next;
|
||||
}
|
||||
|
||||
map->buck[i] = ASE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ase_size_t ase_map_getsize (ase_map_t* map)
|
||||
{
|
||||
return map->size;
|
||||
}
|
||||
|
||||
ase_pair_t* ase_map_get (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen)
|
||||
{
|
||||
ase_pair_t* pair;
|
||||
ase_size_t hc;
|
||||
|
||||
hc = hashkey(keyptr,keylen) % map->capa;
|
||||
pair = map->buck[hc];
|
||||
|
||||
while (pair != ASE_NULL)
|
||||
{
|
||||
if (ase_strxncmp (
|
||||
ASE_PAIR_KEYPTR(pair), ASE_PAIR_KEYLEN(pair),
|
||||
keyptr, keylen) == 0) return pair;
|
||||
|
||||
pair = ASE_PAIR_LNK(pair);
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_pair_t* ase_map_put (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen, void* val)
|
||||
{
|
||||
int n;
|
||||
ase_pair_t* px;
|
||||
|
||||
n = ase_map_putx (map, keyptr, keylen, val, &px);
|
||||
if (n < 0) return ASE_NULL;
|
||||
return px;
|
||||
}
|
||||
|
||||
int ase_map_putx (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen,
|
||||
void* val, ase_pair_t** px)
|
||||
{
|
||||
ase_pair_t* pair, * fp, * fp2;
|
||||
ase_size_t hc;
|
||||
|
||||
hc = hashkey(keyptr,keylen) % map->capa;
|
||||
pair = map->buck[hc];
|
||||
|
||||
while (pair != ASE_NULL)
|
||||
{
|
||||
if (ase_strxncmp (
|
||||
ASE_PAIR_KEYPTR(pair), ASE_PAIR_KEYLEN(pair),
|
||||
keyptr, keylen) == 0)
|
||||
{
|
||||
if (px != ASE_NULL)
|
||||
*px = ase_map_setpair (map, pair, val);
|
||||
else
|
||||
ase_map_setpair (map, pair, val);
|
||||
|
||||
return 0; /* value changed for the existing key */
|
||||
}
|
||||
pair = ASE_PAIR_LNK(pair);
|
||||
}
|
||||
|
||||
if (map->threshold > 0 &&
|
||||
map->size >= map->threshold)
|
||||
{
|
||||
if (rehash(map) == 0) /* ignore the rehash error */
|
||||
{
|
||||
hc = hashkey(keyptr,keylen) % map->capa;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ASE_ASSERT (pair == ASE_NULL);
|
||||
|
||||
/*
|
||||
fp = map->fp; fp2 = ASE_NULL;
|
||||
while (fp != ASE_NULL)
|
||||
{
|
||||
if (fp->key.len == keylen)
|
||||
{
|
||||
pair = fp;
|
||||
if (fp2 == ASE_NULL) map->fp = fp->next;
|
||||
else fp2->next = fp->next;
|
||||
break;
|
||||
}
|
||||
|
||||
fp2 = fp;
|
||||
fp = fp->next;
|
||||
}
|
||||
|
||||
if (pair == ASE_NULL)
|
||||
{
|
||||
*/
|
||||
pair = (ase_pair_t*) ASE_MALLOC (map->mmgr,
|
||||
ASE_SIZEOF(ase_pair_t) + ((keylen+1)*ASE_SIZEOF(*keyptr)));
|
||||
if (pair == ASE_NULL) return -1; /* error */
|
||||
/*}*/
|
||||
|
||||
/* duplicate the key if it is new */
|
||||
ASE_PAIR_KEYPTR(pair) = (ase_char_t*)(pair + 1);
|
||||
ase_strncpy (ASE_PAIR_KEYPTR(pair), keyptr, keylen);
|
||||
|
||||
ASE_PAIR_KEYLEN(pair) = keylen;
|
||||
ASE_PAIR_VAL(pair) = val;
|
||||
ASE_PAIR_LNK(pair) = map->buck[hc];
|
||||
map->buck[hc] = pair;
|
||||
map->size++;
|
||||
|
||||
if (px != ASE_NULL) *px = pair;
|
||||
return 1; /* new key added */
|
||||
}
|
||||
|
||||
ase_pair_t* ase_map_set (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen,
|
||||
void* val)
|
||||
{
|
||||
ase_pair_t* pair;
|
||||
ase_size_t hc;
|
||||
|
||||
hc = hashkey(keyptr,keylen) % map->capa;
|
||||
pair = map->buck[hc];
|
||||
|
||||
while (pair != ASE_NULL)
|
||||
{
|
||||
if (ase_strxncmp (
|
||||
ASE_PAIR_KEYPTR(pair), ASE_PAIR_KEYLEN(pair),
|
||||
keyptr, keylen) == 0)
|
||||
{
|
||||
return ase_map_setpair (map, pair, val);
|
||||
}
|
||||
pair = ASE_PAIR_LNK(pair);
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_pair_t* ase_map_getpair (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen,
|
||||
void** val)
|
||||
{
|
||||
ase_pair_t* pair;
|
||||
|
||||
pair = ase_map_get (map, keyptr, keylen);
|
||||
if (pair == ASE_NULL) return ASE_NULL;
|
||||
*val = ASE_PAIR_VAL(pair);
|
||||
|
||||
return pair;
|
||||
}
|
||||
|
||||
ase_pair_t* ase_map_setpair (ase_map_t* map, ase_pair_t* pair, void* val)
|
||||
{
|
||||
/* use this function with care */
|
||||
if (ASE_PAIR_VAL(pair) == val)
|
||||
{
|
||||
/* if the old value and the new value are the same,
|
||||
* it just calls the handler for this condition.
|
||||
* No value replacement occurs. */
|
||||
if (map->sameval != ASE_NULL)
|
||||
{
|
||||
map->sameval (map->owner, val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* frees the old value */
|
||||
if (map->freeval != ASE_NULL)
|
||||
{
|
||||
map->freeval (map->owner, ASE_PAIR_VAL(pair));
|
||||
}
|
||||
|
||||
/* the new value takes the place */
|
||||
ASE_PAIR_VAL(pair) = val;
|
||||
}
|
||||
|
||||
|
||||
return pair;
|
||||
}
|
||||
|
||||
int ase_map_remove (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen)
|
||||
{
|
||||
ase_pair_t* pair, * prev;
|
||||
ase_size_t hc;
|
||||
|
||||
hc = hashkey(keyptr,keylen) % map->capa;
|
||||
pair = map->buck[hc];
|
||||
prev = ASE_NULL;
|
||||
|
||||
while (pair != ASE_NULL)
|
||||
{
|
||||
if (ase_strxncmp (
|
||||
ASE_PAIR_KEYPTR(pair), ASE_PAIR_KEYLEN(pair),
|
||||
keyptr, keylen) == 0)
|
||||
{
|
||||
if (prev == ASE_NULL)
|
||||
map->buck[hc] = ASE_PAIR_LNK(pair);
|
||||
else ASE_PAIR_LNK(prev) = ASE_PAIR_LNK(pair);
|
||||
|
||||
/*RECYCLE_PAIR (map, pair);*/
|
||||
FREE_PAIR (map, pair);
|
||||
|
||||
map->size--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
prev = pair;
|
||||
pair = ASE_PAIR_LNK(pair);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ase_map_walk (ase_map_t* map, int (*walker) (ase_pair_t*,void*), void* arg)
|
||||
{
|
||||
ase_size_t i;
|
||||
ase_pair_t* pair, * next;
|
||||
|
||||
for (i = 0; i < map->capa; i++)
|
||||
{
|
||||
pair = map->buck[i];
|
||||
|
||||
while (pair != ASE_NULL)
|
||||
{
|
||||
next = ASE_PAIR_LNK(pair);
|
||||
if (walker(pair,arg) == -1) return -1;
|
||||
pair = next;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ase_pair_t* ase_map_getfirstpair (ase_map_t* map, ase_size_t* buckno)
|
||||
{
|
||||
ase_size_t i;
|
||||
ase_pair_t* pair;
|
||||
|
||||
for (i = 0; i < map->capa; i++)
|
||||
{
|
||||
pair = map->buck[i];
|
||||
if (pair != ASE_NULL)
|
||||
{
|
||||
*buckno = i;
|
||||
return pair;
|
||||
}
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_pair_t* ase_map_getnextpair (
|
||||
ase_map_t* map, ase_pair_t* pair, ase_size_t* buckno)
|
||||
{
|
||||
ase_size_t i;
|
||||
ase_pair_t* next;
|
||||
|
||||
next = ASE_PAIR_LNK(pair);
|
||||
if (next != ASE_NULL)
|
||||
{
|
||||
/* no change in bucket number */
|
||||
return next;
|
||||
}
|
||||
|
||||
for (i = (*buckno)+1; i < map->capa; i++)
|
||||
{
|
||||
pair = map->buck[i];
|
||||
if (pair != ASE_NULL)
|
||||
{
|
||||
*buckno = i;
|
||||
return pair;
|
||||
}
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
|
||||
static ase_size_t hashkey (const ase_char_t* keyptr, ase_size_t keylen)
|
||||
{
|
||||
ase_size_t n = 0, i;
|
||||
const ase_char_t* end = keyptr + keylen;
|
||||
|
||||
while (keyptr < end)
|
||||
{
|
||||
ase_byte_t* bp = (ase_byte_t*)keyptr;
|
||||
for (i = 0; i < ASE_SIZEOF(*keyptr); i++) n = n * 31 + *bp++;
|
||||
keyptr++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static int rehash (ase_map_t* map)
|
||||
{
|
||||
ase_size_t i, hc, new_capa;
|
||||
ase_pair_t** new_buck;
|
||||
|
||||
new_capa = (map->capa >= 65536)? (map->capa + 65536): (map->capa << 1);
|
||||
|
||||
new_buck = (ase_pair_t**) ASE_MALLOC (
|
||||
map->mmgr, ASE_SIZEOF(ase_pair_t*) * new_capa);
|
||||
if (new_buck == ASE_NULL)
|
||||
{
|
||||
/* once rehash fails, the rehashing is disabled */
|
||||
map->threshold = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < new_capa; i++) new_buck[i] = ASE_NULL;
|
||||
|
||||
for (i = 0; i < map->capa; i++)
|
||||
{
|
||||
ase_pair_t* pair = map->buck[i];
|
||||
|
||||
while (pair != ASE_NULL)
|
||||
{
|
||||
ase_pair_t* next = ASE_PAIR_LNK(pair);
|
||||
|
||||
hc = hashkey(
|
||||
ASE_PAIR_KEYPTR(pair),
|
||||
ASE_PAIR_KEYLEN(pair)) % new_capa;
|
||||
|
||||
ASE_PAIR_LNK(pair) = new_buck[hc];
|
||||
new_buck[hc] = pair;
|
||||
|
||||
pair = next;
|
||||
}
|
||||
}
|
||||
|
||||
ASE_FREE (map->mmgr, map->buck);
|
||||
map->buck = new_buck;
|
||||
map->capa = new_capa;
|
||||
map->threshold = ((ase_size_t)map->factor) * map->capa / 100;
|
||||
|
||||
return 0;
|
||||
}
|
134
ase/lib/cmn/map.h
Normal file
134
ase/lib/cmn/map.h
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* $Id: map.h 158 2008-03-22 13:19:33Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#ifndef _ASE_CMN_MAP_H_
|
||||
#define _ASE_CMN_MAP_H_
|
||||
|
||||
#include <ase/cmn/types.h>
|
||||
#include <ase/cmn/macros.h>
|
||||
|
||||
typedef struct ase_map_t ase_map_t;
|
||||
typedef struct ase_pair_t ase_pair_t;
|
||||
|
||||
struct ase_pair_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
ase_char_t* ptr;
|
||||
ase_size_t len;
|
||||
} key;
|
||||
|
||||
void* val;
|
||||
|
||||
/* used internally */
|
||||
ase_pair_t* next;
|
||||
};
|
||||
|
||||
struct ase_map_t
|
||||
{
|
||||
/* map owner. passed to freeval and sameval as the first argument */
|
||||
void* owner;
|
||||
|
||||
ase_size_t size;
|
||||
ase_size_t capa;
|
||||
|
||||
unsigned int factor;
|
||||
ase_size_t threshold;
|
||||
|
||||
ase_pair_t** buck;
|
||||
|
||||
void (*freeval) (void* owner,void* val);
|
||||
void (*sameval) (void* owner,void* val);
|
||||
|
||||
/* the mmgr pointed at by mmgr should be valid
|
||||
* while the map is alive as the contents are
|
||||
* not replicated */
|
||||
ase_mmgr_t* mmgr;
|
||||
|
||||
/* list of free pairs */
|
||||
/*ase_pair_t* fp;*/
|
||||
};
|
||||
|
||||
#define ASE_PAIR_KEYPTR(p) ((p)->key.ptr)
|
||||
#define ASE_PAIR_KEYLEN(p) ((p)->key.len)
|
||||
#define ASE_PAIR_VAL(p) ((p)->val)
|
||||
#define ASE_PAIR_LNK(p) ((p)->next)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Creates a hashed map with a dynamic array bucket and a list of values linked
|
||||
*
|
||||
* @param owner [in]
|
||||
* @param capa [in]
|
||||
* @param factor [in]
|
||||
* @param freeval [in]
|
||||
* @param sameval [in]
|
||||
* @param mmgr [in]
|
||||
*/
|
||||
ase_map_t* ase_map_open (
|
||||
void* owner, ase_size_t capa, unsigned int factor,
|
||||
void(*freeval)(void*,void*), void(*sameval)(void*,void*),
|
||||
ase_mmgr_t* mmgr);
|
||||
|
||||
/**
|
||||
* Destroys a hashed map
|
||||
*/
|
||||
void ase_map_close (ase_map_t* map);
|
||||
|
||||
void ase_map_clear (ase_map_t* map);
|
||||
|
||||
ase_size_t ase_map_getsize (ase_map_t* map);
|
||||
|
||||
ase_pair_t* ase_map_get (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen);
|
||||
|
||||
ase_pair_t* ase_map_put (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen,
|
||||
void* val);
|
||||
|
||||
int ase_map_putx (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen,
|
||||
void* val, ase_pair_t** px);
|
||||
|
||||
ase_pair_t* ase_map_set (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen,
|
||||
void* val);
|
||||
|
||||
ase_pair_t* ase_map_getpair (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen,
|
||||
void** val);
|
||||
|
||||
ase_pair_t* ase_map_setpair (ase_map_t* map, ase_pair_t* pair, void* val);
|
||||
|
||||
int ase_map_remove (
|
||||
ase_map_t* map, const ase_char_t* keyptr, ase_size_t keylen);
|
||||
|
||||
int ase_map_walk (ase_map_t* map, int (*walker)(ase_pair_t*,void*), void* arg);
|
||||
|
||||
/**
|
||||
* Gets the pointer to the first pair in the map.
|
||||
* @param map [in]
|
||||
* @param buckno [out]
|
||||
*/
|
||||
ase_pair_t* ase_map_getfirstpair (ase_map_t* map, ase_size_t* buckno);
|
||||
|
||||
/**
|
||||
* Gets the pointer to the next pair in the map.
|
||||
* @param map [in]
|
||||
* @param pair [in]
|
||||
* @param buckno [in out]
|
||||
*/
|
||||
ase_pair_t* ase_map_getnextpair (
|
||||
ase_map_t* map, ase_pair_t* pair, ase_size_t* buckno);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
401
ase/lib/cmn/mem.c
Normal file
401
ase/lib/cmn/mem.c
Normal file
@ -0,0 +1,401 @@
|
||||
/*
|
||||
* $Id: mem.c 177 2008-04-26 04:58:10Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#include <ase/cmn/mem.h>
|
||||
|
||||
#if defined(__SPU__)
|
||||
#include <spu_intrinsics.h>
|
||||
#define SPU_VUC_SIZE ASE_SIZEOF(vector unsigned char)
|
||||
#endif
|
||||
|
||||
/*#define IS_UNALIGNED(ptr) (((ase_size_t)ptr)%ASE_SIZEOF(ase_size_t))*/
|
||||
#define IS_UNALIGNED(ptr) (((ase_size_t)ptr)&(ASE_SIZEOF(ase_size_t)-1))
|
||||
#define IS_ALIGNED(ptr) (!IS_UNALIGNED(ptr))
|
||||
|
||||
#define IS_EITHER_UNALIGNED(ptr1,ptr2) \
|
||||
(((ase_size_t)ptr1|(ase_size_t)ptr2)&(ASE_SIZEOF(ase_size_t)-1))
|
||||
#define IS_BOTH_ALIGNED(ptr1,ptr2) (!IS_EITHER_UNALIGNED(ptr1,ptr2))
|
||||
|
||||
void* ase_memcpy (void* dst, const void* src, ase_size_t n)
|
||||
{
|
||||
#if defined(ASE_BUILD_FOR_SIZE)
|
||||
|
||||
ase_byte_t* d = (ase_byte_t*)dst;
|
||||
ase_byte_t* s = (ase_byte_t*)src;
|
||||
while (n-- > 0) *d++ = *s++;
|
||||
return dst;
|
||||
|
||||
#elif defined(__SPU__)
|
||||
|
||||
ase_byte_t* d;
|
||||
ase_byte_t* s;
|
||||
|
||||
if (n >= SPU_VUC_SIZE &&
|
||||
(((ase_size_t)dst) & (SPU_VUC_SIZE-1)) == 0 &&
|
||||
(((ase_size_t)src) & (SPU_VUC_SIZE-1)) == 0)
|
||||
{
|
||||
vector unsigned char* du = (vector unsigned char*)dst;
|
||||
vector unsigned char* su = (vector unsigned char*)src;
|
||||
|
||||
do
|
||||
{
|
||||
*du++ = *su++;
|
||||
n -= SPU_VUC_SIZE;
|
||||
}
|
||||
while (n >= SPU_VUC_SIZE);
|
||||
|
||||
d = (ase_byte_t*)du;
|
||||
s = (ase_byte_t*)su;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = (ase_byte_t*)dst;
|
||||
s = (ase_byte_t*)src;
|
||||
}
|
||||
|
||||
while (n-- > 0) *d++ = *s++;
|
||||
return dst;
|
||||
|
||||
#else
|
||||
|
||||
ase_byte_t* d;
|
||||
ase_byte_t* s;
|
||||
|
||||
if (n >= ASE_SIZEOF(ase_size_t) && IS_BOTH_ALIGNED(dst,src))
|
||||
{
|
||||
ase_size_t* du = (ase_size_t*)dst;
|
||||
ase_size_t* su = (ase_size_t*)src;
|
||||
|
||||
do
|
||||
{
|
||||
*du++ = *su++;
|
||||
n -= ASE_SIZEOF(ase_size_t);
|
||||
}
|
||||
while (n >= ASE_SIZEOF(ase_size_t));
|
||||
|
||||
d = (ase_byte_t*)du;
|
||||
s = (ase_byte_t*)su;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = (ase_byte_t*)dst;
|
||||
s = (ase_byte_t*)src;
|
||||
}
|
||||
|
||||
while (n-- > 0) *d++ = *s++;
|
||||
return dst;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void* ase_memmove (void* dst, const void* src, ase_size_t n)
|
||||
{
|
||||
const ase_byte_t* sre = (const ase_byte_t*)src + n;
|
||||
|
||||
if (dst <= src || dst >= (const void*)sre)
|
||||
{
|
||||
ase_byte_t* d = (ase_byte_t*)dst;
|
||||
const ase_byte_t* s = (const ase_byte_t*)src;
|
||||
while (n-- > 0) *d++ = *s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_byte_t* dse = (ase_byte_t*)dst + n;
|
||||
while (n-- > 0) *--dse = *--sre;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
void* ase_memset (void* dst, int val, ase_size_t n)
|
||||
{
|
||||
#if defined(ASE_BUILD_FOR_SIZE)
|
||||
|
||||
ase_byte_t* d = (ase_byte_t*)dst;
|
||||
while (n-- > 0) *d++ = (ase_byte_t)val;
|
||||
return dst;
|
||||
|
||||
#elif defined(__SPU__)
|
||||
|
||||
ase_byte_t* d;
|
||||
ase_size_t rem;
|
||||
|
||||
if (n <= 0) return dst;
|
||||
|
||||
d = (ase_byte_t*)dst;
|
||||
|
||||
/* spu SIMD instructions require 16-byte alignment */
|
||||
rem = ((ase_size_t)dst) & (SPU_VUC_SIZE-1);
|
||||
if (rem > 0)
|
||||
{
|
||||
/* handle leading unaligned part */
|
||||
do { *d++ = (ase_byte_t)val; }
|
||||
while (n-- > 0 && ++rem < SPU_VUC_SIZE);
|
||||
}
|
||||
|
||||
/* do the vector copy */
|
||||
if (n >= SPU_VUC_SIZE)
|
||||
{
|
||||
/* a vector of 16 unsigned char cells */
|
||||
vector unsigned char v16;
|
||||
/* a pointer to such a vector */
|
||||
vector unsigned char* vd = (vector unsigned char*)d;
|
||||
|
||||
/* fills all 16 unsigned char cells with the same value
|
||||
* no need to use shift and bitwise-or owing to splats */
|
||||
v16 = spu_splats((ase_byte_t)val);
|
||||
|
||||
do
|
||||
{
|
||||
*vd++ = v16;
|
||||
n -= SPU_VUC_SIZE;
|
||||
}
|
||||
while (n >= SPU_VUC_SIZE);
|
||||
|
||||
d = (ase_byte_t*)vd;
|
||||
}
|
||||
|
||||
/* handle the trailing part */
|
||||
while (n-- > 0) *d++ = (ase_byte_t)val;
|
||||
return dst;
|
||||
|
||||
#else
|
||||
|
||||
ase_byte_t* d;
|
||||
ase_size_t rem;
|
||||
|
||||
if (n <= 0) return dst;
|
||||
|
||||
d = (ase_byte_t*)dst;
|
||||
|
||||
rem = IS_UNALIGNED(dst);
|
||||
if (rem > 0)
|
||||
{
|
||||
do { *d++ = (ase_byte_t)val; }
|
||||
while (n-- > 0 && ++rem < ASE_SIZEOF(ase_size_t));
|
||||
}
|
||||
|
||||
if (n >= ASE_SIZEOF(ase_size_t))
|
||||
{
|
||||
ase_size_t* u = (ase_size_t*)d;
|
||||
ase_size_t uv = 0;
|
||||
int i;
|
||||
|
||||
if (val != 0)
|
||||
{
|
||||
for (i = 0; i < ASE_SIZEOF(ase_size_t); i++)
|
||||
uv = (uv << 8) | (ase_byte_t)val;
|
||||
}
|
||||
|
||||
ASE_ASSERT (IS_ALIGNED(u));
|
||||
do
|
||||
{
|
||||
*u++ = uv;
|
||||
n -= ASE_SIZEOF(ase_size_t);
|
||||
}
|
||||
while (n >= ASE_SIZEOF(ase_size_t));
|
||||
|
||||
d = (ase_byte_t*)u;
|
||||
}
|
||||
|
||||
while (n-- > 0) *d++ = (ase_byte_t)val;
|
||||
return dst;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int ase_memcmp (const void* s1, const void* s2, ase_size_t n)
|
||||
{
|
||||
#if defined(ASE_BUILD_FOR_SIZE)
|
||||
|
||||
const ase_byte_t* b1 = (const ase_byte_t*)s1;
|
||||
const ase_byte_t* b2 = (const ase_byte_t*)s2;
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*b1 != *b2) return *b1 - *b2;
|
||||
b1++; b2++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
#elif defined(__SPU__)
|
||||
|
||||
const ase_byte_t* b1;
|
||||
const ase_byte_t* b2;
|
||||
|
||||
if (n >= SPU_VUC_SIZE &&
|
||||
(((ase_size_t)s1) & (SPU_VUC_SIZE-1)) == 0 &&
|
||||
(((ase_size_t)s2) & (SPU_VUC_SIZE-1)) == 0)
|
||||
{
|
||||
vector unsigned char* v1 = (vector unsigned char*)s1;
|
||||
vector unsigned char* v2 = (vector unsigned char*)s2;
|
||||
|
||||
vector unsigned int tmp;
|
||||
|
||||
do
|
||||
{
|
||||
unsigned int cnt;
|
||||
unsigned int pat;
|
||||
|
||||
/* compare 16 chars at one time */
|
||||
tmp = spu_gather(spu_cmpeq(*v1,*v2));
|
||||
/* extract the bit pattern */
|
||||
pat = spu_extract(tmp, 0);
|
||||
/* invert the bit patterns */
|
||||
pat = 0xFFFF & ~pat;
|
||||
|
||||
/* put it back to the vector */
|
||||
tmp = spu_insert (pat, tmp, 0);
|
||||
/* count the leading zeros */
|
||||
cnt = spu_extract(spu_cntlz(tmp),0);
|
||||
/* 32 leading zeros mean that
|
||||
* all characters are the same */
|
||||
if (cnt != 32)
|
||||
{
|
||||
/* otherwise, calculate the
|
||||
* unmatching pointer address */
|
||||
b1 = (const ase_byte_t*)v1 + (cnt - 16);
|
||||
b2 = (const ase_byte_t*)v2 + (cnt - 16);
|
||||
break;
|
||||
}
|
||||
|
||||
v1++; v2++;
|
||||
n -= SPU_VUC_SIZE;
|
||||
|
||||
if (n < SPU_VUC_SIZE)
|
||||
{
|
||||
b1 = (const ase_byte_t*)v1;
|
||||
b2 = (const ase_byte_t*)v2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
b1 = (const ase_byte_t*)s1;
|
||||
b2 = (const ase_byte_t*)s2;
|
||||
}
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*b1 != *b2) return *b1 - *b2;
|
||||
b1++; b2++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
#else
|
||||
const ase_byte_t* b1;
|
||||
const ase_byte_t* b2;
|
||||
|
||||
if (n >= ASE_SIZEOF(ase_size_t) && IS_BOTH_ALIGNED(s1,s2))
|
||||
{
|
||||
const ase_size_t* u1 = (const ase_size_t*)s1;
|
||||
const ase_size_t* u2 = (const ase_size_t*)s2;
|
||||
|
||||
do
|
||||
{
|
||||
if (*u1 != *u2) break;
|
||||
u1++; u2++;
|
||||
n -= ASE_SIZEOF(ase_size_t);
|
||||
}
|
||||
while (n >= ASE_SIZEOF(ase_size_t));
|
||||
|
||||
b1 = (const ase_byte_t*)u1;
|
||||
b2 = (const ase_byte_t*)u2;
|
||||
}
|
||||
else
|
||||
{
|
||||
b1 = (const ase_byte_t*)s1;
|
||||
b2 = (const ase_byte_t*)s2;
|
||||
}
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*b1 != *b2) return *b1 - *b2;
|
||||
b1++; b2++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void* ase_memchr (const void* s, int val, ase_size_t n)
|
||||
{
|
||||
const ase_byte_t* x = (const ase_byte_t*)s;
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*x == (ase_byte_t)val) return (void*)x;
|
||||
x++;
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
void* ase_memrchr (const void* s, int val, ase_size_t n)
|
||||
{
|
||||
const ase_byte_t* x = (ase_byte_t*)s + n - 1;
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*x == (ase_byte_t)val) return (void*)x;
|
||||
x--;
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
void* ase_memmem (const void* hs, ase_size_t hl, const void* nd, ase_size_t nl)
|
||||
{
|
||||
if (nl <= hl)
|
||||
{
|
||||
ase_size_t i;
|
||||
const ase_byte_t* h = (const ase_byte_t*)hs;
|
||||
|
||||
for (i = hl - nl + 1; i > 0; i--)
|
||||
{
|
||||
if (ase_memcmp(h, nd, nl) == 0) return (void*)h;
|
||||
h++;
|
||||
}
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
void* ase_memrmem (const void* hs, ase_size_t hl, const void* nd, ase_size_t nl)
|
||||
{
|
||||
if (nl <= hl)
|
||||
{
|
||||
ase_size_t i;
|
||||
const ase_byte_t* h;
|
||||
|
||||
/* things are slightly more complacated
|
||||
* when searching backward */
|
||||
if (nl == 0)
|
||||
{
|
||||
/* when the needle is empty, it returns
|
||||
* the pointer to the last byte of the haystack.
|
||||
* this is because ase_memmem returns the pointer
|
||||
* to the first byte of the haystack when the
|
||||
* needle is empty. but I'm not so sure if this
|
||||
* is really desirable behavior */
|
||||
h = (const ase_byte_t*)hs + hl - 1;
|
||||
return (void*)h;
|
||||
}
|
||||
|
||||
h = (const ase_byte_t*)hs + hl - nl;
|
||||
for (i = hl - nl + 1; i > 0; i--)
|
||||
{
|
||||
if (ase_memcmp(h, nd, nl) == 0) return (void*)h;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
30
ase/lib/cmn/mem.h
Normal file
30
ase/lib/cmn/mem.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* $Id: mem.h 177 2008-04-26 04:58:10Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#ifndef _ASE_CMN_MEM_H_
|
||||
#define _ASE_CMN_MEM_H_
|
||||
|
||||
#include <ase/cmn/types.h>
|
||||
#include <ase/cmn/macros.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* ase_memcpy (void* dst, const void* src, ase_size_t n);
|
||||
void* ase_memmove (void* dst, const void* src, ase_size_t n);
|
||||
void* ase_memset (void* dst, int val, ase_size_t n);
|
||||
int ase_memcmp (const void* s1, const void* s2, ase_size_t n);
|
||||
void* ase_memchr (const void* s, int val, ase_size_t n);
|
||||
void* ase_memrchr (const void* s, int val, ase_size_t n);
|
||||
void* ase_memmem (const void* hs, ase_size_t hl, const void* nd, ase_size_t nl);
|
||||
void* ase_memrmem (const void* hs, ase_size_t hl, const void* nd, ase_size_t nl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
39
ase/lib/cmn/misc.c
Normal file
39
ase/lib/cmn/misc.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* $Id: misc.c 116 2008-03-03 11:15:37Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
#pragma hdrstop
|
||||
#define Library
|
||||
#endif
|
||||
|
||||
#include <ase/cmn/types.h>
|
||||
#include <ase/cmn/macros.h>
|
||||
|
||||
#ifndef NDEBUG
|
||||
int ase_assert_failed (
|
||||
const ase_char_t* expr, const ase_char_t* desc,
|
||||
const ase_char_t* file, ase_size_t line)
|
||||
{
|
||||
if (desc == ASE_NULL)
|
||||
{
|
||||
ase_assert_printf (
|
||||
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n"),
|
||||
file, (unsigned long)line, expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_assert_printf (
|
||||
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n\nDESCRIPTION:\n%s\n"),
|
||||
file, (unsigned long)line, expr, desc);
|
||||
|
||||
}
|
||||
|
||||
ase_assert_abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
75
ase/lib/cmn/msw-bcc.mak
Normal file
75
ase/lib/cmn/msw-bcc.mak
Normal file
@ -0,0 +1,75 @@
|
||||
NAME = asecmn
|
||||
|
||||
!ifndef MODE
|
||||
MODE = release
|
||||
!endif
|
||||
|
||||
CC = bcc32
|
||||
LD = ilink32
|
||||
AR = tlib
|
||||
|
||||
CFLAGS = -WM -WU -RT- -w -q -I..\..
|
||||
|
||||
!IF "$(MODE)" == "debug"
|
||||
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG
|
||||
!ELSEIF "$(MODE)" == "release"
|
||||
CFLAGS = $(CFLAGS) -DNDEBUG -O2
|
||||
!ELSE
|
||||
CFLAGS = $(CFLAGS)
|
||||
!ENDIF
|
||||
|
||||
OUT_DIR = ..\$(MODE)\lib
|
||||
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
||||
|
||||
TMP_DIR = $(MODE)
|
||||
|
||||
OBJ_FILES_LIB = \
|
||||
$(TMP_DIR)\mem.obj \
|
||||
$(TMP_DIR)\str_bas.obj \
|
||||
$(TMP_DIR)\str_cnv.obj \
|
||||
$(TMP_DIR)\str_dyn.obj \
|
||||
$(TMP_DIR)\map.obj \
|
||||
$(TMP_DIR)\rex.obj \
|
||||
$(TMP_DIR)\misc.obj
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(TMP_DIR) $(OUT_DIR) $(OUT_FILE_LIB)
|
||||
|
||||
$(OUT_FILE_LIB): $(OBJ_FILES_LIB)
|
||||
$(AR) $(OUT_FILE_LIB) @&&!
|
||||
+-$(**: = &^
|
||||
+-)
|
||||
!
|
||||
|
||||
$(TMP_DIR)\mem.obj: mem.c
|
||||
$(CC) $(CFLAGS) -o$@ -c mem.c
|
||||
|
||||
$(TMP_DIR)\str_bas.obj: str_bas.c
|
||||
$(CC) $(CFLAGS) -o$@ -c str_bas.c
|
||||
|
||||
$(TMP_DIR)\str_cnv.obj: str_cnv.c
|
||||
$(CC) $(CFLAGS) -o$@ -c str_cnv.c
|
||||
|
||||
$(TMP_DIR)\str_dyn.obj: str_dyn.c
|
||||
$(CC) $(CFLAGS) -o$@ -c str_dyn.c
|
||||
|
||||
$(TMP_DIR)\map.obj: map.c
|
||||
$(CC) $(CFLAGS) -o$@ -c map.c
|
||||
|
||||
$(TMP_DIR)\rex.obj: rex.c
|
||||
$(CC) $(CFLAGS) -o$@ -c rex.c
|
||||
|
||||
$(TMP_DIR)\misc.obj: misc.c
|
||||
$(CC) $(CFLAGS) -o$@ -c misc.c
|
||||
|
||||
$(OUT_DIR):
|
||||
-md $(OUT_DIR)
|
||||
|
||||
$(TMP_DIR):
|
||||
-md $(TMP_DIR)
|
||||
|
||||
clean:
|
||||
-del $(OUT_FILE_LIB)
|
||||
-del $(OBJ_FILES_LIB)
|
||||
|
71
ase/lib/cmn/msw-cl.mak
Normal file
71
ase/lib/cmn/msw-cl.mak
Normal file
@ -0,0 +1,71 @@
|
||||
NAME = asecmn
|
||||
MODE = release
|
||||
|
||||
CC = cl
|
||||
LD = link
|
||||
AR = link
|
||||
|
||||
CFLAGS = /nologo /W3 -I..\..
|
||||
|
||||
!IF "$(MODE)" == "debug"
|
||||
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /MTd /Zi
|
||||
!ELSEIF "$(MODE)" == "release"
|
||||
CFLAGS = $(CFLAGS) -DNDEBUG /MT /O2
|
||||
!ELSE
|
||||
CFLAGS = $(CFLAGS) /MT
|
||||
!ENDIF
|
||||
|
||||
OUT_DIR = ..\$(MODE)\lib
|
||||
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
||||
|
||||
TMP_DIR = $(MODE)
|
||||
|
||||
OBJ_FILES_LIB = \
|
||||
$(TMP_DIR)\mem.obj \
|
||||
$(TMP_DIR)\str_bas.obj \
|
||||
$(TMP_DIR)\str_cnv.obj \
|
||||
$(TMP_DIR)\str_dyn.obj \
|
||||
$(TMP_DIR)\map.obj \
|
||||
$(TMP_DIR)\rex.obj \
|
||||
$(TMP_DIR)\misc.obj
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(OUT_FILE_LIB)
|
||||
|
||||
$(OUT_FILE_LIB): $(TMP_DIR) $(OUT_DIR) $(OBJ_FILES_LIB)
|
||||
$(AR) /lib @<<
|
||||
/nologo /out:$(OUT_FILE_LIB) $(OBJ_FILES_LIB)
|
||||
<<
|
||||
|
||||
$(TMP_DIR)\mem.obj: mem.c
|
||||
$(CC) $(CFLAGS) /Fo$@ /c mem.c
|
||||
|
||||
$(TMP_DIR)\str_bas.obj: str_bas.c
|
||||
$(CC) $(CFLAGS) /Fo$@ /c str_bas.c
|
||||
|
||||
$(TMP_DIR)\str_cnv.obj: str_cnv.c
|
||||
$(CC) $(CFLAGS) /Fo$@ /c str_cnv.c
|
||||
|
||||
$(TMP_DIR)\str_dyn.obj: str_dyn.c
|
||||
$(CC) $(CFLAGS) /Fo$@ /c str_dyn.c
|
||||
|
||||
$(TMP_DIR)\map.obj: map.c
|
||||
$(CC) $(CFLAGS) /Fo$@ /c map.c
|
||||
|
||||
$(TMP_DIR)\rex.obj: rex.c
|
||||
$(CC) $(CFLAGS) /Fo$@ /c rex.c
|
||||
|
||||
$(TMP_DIR)\misc.obj: misc.c
|
||||
$(CC) $(CFLAGS) /Fo$@ /c misc.c
|
||||
|
||||
$(OUT_DIR):
|
||||
-md $(OUT_DIR)
|
||||
|
||||
$(TMP_DIR):
|
||||
-md $(TMP_DIR)
|
||||
|
||||
clean:
|
||||
-del $(OUT_FILE_LIB)
|
||||
-del $(OBJ_FILES_LIB)
|
||||
|
62
ase/lib/cmn/msw-dmc.mak
Normal file
62
ase/lib/cmn/msw-dmc.mak
Normal file
@ -0,0 +1,62 @@
|
||||
#
|
||||
# You may override the value of MODE by specifying from the command-line
|
||||
# make -f msw-dmc.mak MODE=debug
|
||||
#
|
||||
|
||||
NAME = asecmn
|
||||
MODE = release
|
||||
|
||||
CC = dmc
|
||||
AR = lib
|
||||
|
||||
CFLAGS = -mn -I..\.. -DUNICODE -D_UNICODE
|
||||
|
||||
OUT_DIR = ..\$(MODE)\lib
|
||||
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
||||
|
||||
TMP_DIR = $(MODE)
|
||||
|
||||
OBJ_FILES_LIB = \
|
||||
$(TMP_DIR)\mem.obj \
|
||||
$(TMP_DIR)\str_bas.obj \
|
||||
$(TMP_DIR)\str_cnv.obj \
|
||||
$(TMP_DIR)\str_dyn.obj \
|
||||
$(TMP_DIR)\map.obj \
|
||||
$(TMP_DIR)\rex.obj \
|
||||
$(TMP_DIR)\misc.obj
|
||||
|
||||
all: $(OUT_FILE_LIB)
|
||||
|
||||
$(OUT_FILE_LIB): $(TMP_DIR) $(OUT_DIR) $(OBJ_FILES_LIB)
|
||||
$(AR) -c $(OUT_FILE_LIB) $(OBJ_FILES_LIB)
|
||||
|
||||
$(TMP_DIR)\mem.obj: mem.c
|
||||
$(CC) $(CFLAGS) -o$@ -c mem.c
|
||||
|
||||
$(TMP_DIR)\str_bas.obj: str_bas.c
|
||||
$(CC) $(CFLAGS) -o$@ -c str_bas.c
|
||||
|
||||
$(TMP_DIR)\str_cnv.obj: str_cnv.c
|
||||
$(CC) $(CFLAGS) -o$@ -c str_cnv.c
|
||||
|
||||
$(TMP_DIR)\str_dyn.obj: str_dyn.c
|
||||
$(CC) $(CFLAGS) -o$@ -c str_dyn.c
|
||||
|
||||
$(TMP_DIR)\map.obj: map.c
|
||||
$(CC) $(CFLAGS) -o$@ -c map.c
|
||||
|
||||
$(TMP_DIR)\rex.obj: rex.c
|
||||
$(CC) $(CFLAGS) -o$@ -c rex.c
|
||||
|
||||
$(TMP_DIR)\misc.obj: misc.c
|
||||
$(CC) $(CFLAGS) -o$@ -c misc.c
|
||||
|
||||
$(OUT_DIR):
|
||||
md $(OUT_DIR)
|
||||
|
||||
$(TMP_DIR):
|
||||
md $(TMP_DIR)
|
||||
|
||||
clean:
|
||||
del $(OUT_FILE_LIB) $(OBJ_FILES_LIB)
|
||||
|
17
ase/lib/cmn/pack.h
Normal file
17
ase/lib/cmn/pack.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* $Id: pack.h 116 2008-03-03 11:15:37Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#elif defined(__HP_aCC) || defined(__HP_cc)
|
||||
#pragma PACK 1
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#pragma pack(push,1)
|
||||
#elif defined(__DECC)
|
||||
#pragma pack(push,1)
|
||||
#else
|
||||
#pragma pack(1)
|
||||
#endif
|
2007
ase/lib/cmn/rex.c
Normal file
2007
ase/lib/cmn/rex.c
Normal file
File diff suppressed because it is too large
Load Diff
94
ase/lib/cmn/rex.h
Normal file
94
ase/lib/cmn/rex.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* $Id: rex.h 116 2008-03-03 11:15:37Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#ifndef _ASE_CMN_REX_H_
|
||||
#define _ASE_CMN_REX_H_
|
||||
|
||||
#include <ase/cmn/types.h>
|
||||
#include <ase/cmn/macros.h>
|
||||
|
||||
/*
|
||||
* Regular Esseression Syntax
|
||||
* A regular expression is zero or more branches, separated by '|'.
|
||||
* ......
|
||||
* ......
|
||||
*
|
||||
* Compiled form of a regular expression:
|
||||
*
|
||||
* | expression |
|
||||
* | header | branch | branch | branch |
|
||||
* | nb | el | na | bl | cmd | arg | cmd | arg | na | bl | cmd | arg | na | bl | cmd |
|
||||
*
|
||||
* nb: the number of branches
|
||||
* el: the length of a expression including the length of nb and el
|
||||
* na: the number of atoms
|
||||
* bl: the length of a branch including the length of na and bl
|
||||
* cmd: The command and repetition info encoded together.
|
||||
* Some commands require an argument to follow them but some other don't.
|
||||
* It is encoded as follows:
|
||||
*
|
||||
* Subexpressions can be nested by having the command "GROUP"
|
||||
* and a subexpression as its argument.
|
||||
*
|
||||
* Examples:
|
||||
* a.c -> |1|6|5|ORD_CHAR(no bound)|a|ANY_CHAR(no bound)|ORD_CHAR(no bound)|c|
|
||||
* ab|xy -> |2|10|4|ORD_CHAR(no bound)|a|ORD_CHAR(no bound)|b|4|ORD_CHAR(no bound)|x|ORD_CHAR(no bound)|y|
|
||||
*/
|
||||
|
||||
#define ASE_REX_NA(code) (*(ase_size_t*)(code))
|
||||
|
||||
#define ASE_REX_LEN(code) \
|
||||
(*(ase_size_t*)((ase_byte_t*)(code)+ASE_SIZEOF(ase_size_t)))
|
||||
|
||||
enum ase_rex_option_t
|
||||
{
|
||||
ASE_REX_IGNORECASE = (1 << 0)
|
||||
};
|
||||
|
||||
enum ase_rex_errnum_t
|
||||
{
|
||||
ASE_REX_ENOERR = 0,
|
||||
ASE_REX_ENOMEM,
|
||||
ASE_REX_ERECUR, /* recursion too deep */
|
||||
ASE_REX_ERPAREN, /* a right parenthesis is expected */
|
||||
ASE_REX_ERBRACKET, /* a right bracket is expected */
|
||||
ASE_REX_ERBRACE, /* a right brace is expected */
|
||||
ASE_REX_EUNBALPAR, /* unbalanced parenthesis */
|
||||
ASE_REX_ECOLON, /* a colon is expected */
|
||||
ASE_REX_ECRANGE, /* invalid character range */
|
||||
ASE_REX_ECCLASS, /* invalid character class */
|
||||
ASE_REX_EBRANGE, /* invalid boundary range */
|
||||
ASE_REX_EEND, /* unexpected end of the pattern */
|
||||
ASE_REX_EGARBAGE /* garbage after the pattern */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* ase_buildrex (
|
||||
ase_mmgr_t* mmgr, ase_size_t depth,
|
||||
const ase_char_t* ptn, ase_size_t len, int* errnum);
|
||||
|
||||
int ase_matchrex (
|
||||
ase_mmgr_t* mmgr, ase_ccls_t* ccls, ase_size_t depth,
|
||||
void* code, int option,
|
||||
const ase_char_t* str, ase_size_t len,
|
||||
const ase_char_t** match_ptr, ase_size_t* match_len, int* errnum);
|
||||
|
||||
void ase_freerex (ase_mmgr_t* mmgr, void* code);
|
||||
|
||||
ase_bool_t ase_isemptyrex (void* code);
|
||||
|
||||
#if 0
|
||||
void ase_dprintrex (ase_rex_t* rex, void* rex);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
200
ase/lib/cmn/str.h
Normal file
200
ase/lib/cmn/str.h
Normal file
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* $Id: str.h 159 2008-04-01 08:37:30Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#ifndef _ASE_CMN_STR_H_
|
||||
#define _ASE_CMN_STR_H_
|
||||
|
||||
#include <ase/cmn/types.h>
|
||||
#include <ase/cmn/macros.h>
|
||||
|
||||
#define ASE_STR_LEN(x) ((x)->size)
|
||||
#define ASE_STR_SIZE(x) ((x)->size + 1)
|
||||
#define ASE_STR_CAPA(x) ((x)->capa)
|
||||
#define ASE_STR_BUF(x) ((x)->buf)
|
||||
#define ASE_STR_CHAR(x,idx) ((x)->buf[idx])
|
||||
|
||||
typedef struct ase_str_t ase_str_t;
|
||||
|
||||
struct ase_str_t
|
||||
{
|
||||
ase_char_t* buf;
|
||||
ase_size_t size;
|
||||
ase_size_t capa;
|
||||
ase_mmgr_t* mmgr;
|
||||
ase_bool_t __dynamic;
|
||||
};
|
||||
|
||||
/* int ase_chartonum (ase_char_t c, int base) */
|
||||
#define ASE_CHARTONUM(c,base) \
|
||||
((c>=ASE_T('0') && c<=ASE_T('9'))? ((c-ASE_T('0')<base)? (c-ASE_T('0')): base): \
|
||||
(c>=ASE_T('A') && c<=ASE_T('Z'))? ((c-ASE_T('A')+10<base)? (c-ASE_T('A')+10): base): \
|
||||
(c>=ASE_T('a') && c<=ASE_T('z'))? ((c-ASE_T('a')+10<base)? (c-ASE_T('a')+10): base): base)
|
||||
|
||||
/* ase_strtonum (const ase_char_t* nptr, ase_char_t** endptr, int base) */
|
||||
#define ASE_STRTONUM(value,nptr,endptr,base) \
|
||||
{ \
|
||||
int __ston_f = 0, __ston_v; \
|
||||
const ase_char_t* __ston_ptr = nptr; \
|
||||
for (;;) { \
|
||||
ase_char_t __ston_c = *__ston_ptr; \
|
||||
if (__ston_c == ASE_T(' ') || \
|
||||
__ston_c == ASE_T('\t')) { __ston_ptr++; continue; } \
|
||||
if (__ston_c == ASE_T('-')) { __ston_f++; __ston_ptr++; } \
|
||||
if (__ston_c == ASE_T('+')) { __ston_ptr++; } \
|
||||
break; \
|
||||
} \
|
||||
for (value = 0; (__ston_v = ASE_CHARTONUM(*__ston_ptr, base)) < base; __ston_ptr++) { \
|
||||
value = value * base + __ston_v; \
|
||||
} \
|
||||
if (endptr != ASE_NULL) *((const ase_char_t**)endptr) = __ston_ptr; \
|
||||
if (__ston_f > 0) value *= -1; \
|
||||
}
|
||||
|
||||
/* ase_strxtonum (const ase_char_t* nptr, ase_size_t len, ase_char_char** endptr, int base) */
|
||||
#define ASE_STRXTONUM(value,nptr,len,endptr,base) \
|
||||
{ \
|
||||
int __ston_f = 0, __ston_v; \
|
||||
const ase_char_t* __ston_ptr = nptr; \
|
||||
const ase_char_t* __ston_end = __ston_ptr + len; \
|
||||
value = 0; \
|
||||
while (__ston_ptr < __ston_end) { \
|
||||
ase_char_t __ston_c = *__ston_ptr; \
|
||||
if (__ston_c == ASE_T(' ') || __ston_c == ASE_T('\t')) { \
|
||||
__ston_ptr++; continue; \
|
||||
} \
|
||||
if (__ston_c == ASE_T('-')) { __ston_f++; __ston_ptr++; } \
|
||||
if (__ston_c == ASE_T('+')) { __ston_ptr++; } \
|
||||
break; \
|
||||
} \
|
||||
for (value = 0; __ston_ptr < __ston_end && \
|
||||
(__ston_v = ASE_CHARTONUM(*__ston_ptr, base)) != base; __ston_ptr++) { \
|
||||
value = value * base + __ston_v; \
|
||||
} \
|
||||
if (endptr != ASE_NULL) *((const ase_char_t**)endptr) = __ston_ptr; \
|
||||
if (__ston_f > 0) value *= -1; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* basic string functions
|
||||
*/
|
||||
ase_size_t ase_strlen (const ase_char_t* str);
|
||||
|
||||
ase_size_t ase_strcpy (
|
||||
ase_char_t* buf, const ase_char_t* str);
|
||||
ase_size_t ase_strxcpy (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str);
|
||||
ase_size_t ase_strncpy (
|
||||
ase_char_t* buf, const ase_char_t* str, ase_size_t len);
|
||||
ase_size_t ase_strxncpy (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len);
|
||||
|
||||
ase_size_t ase_strxcat (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str);
|
||||
ase_size_t ase_strxncat (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len);
|
||||
|
||||
int ase_strcmp (const ase_char_t* s1, const ase_char_t* s2);
|
||||
int ase_strxcmp (const ase_char_t* s1, ase_size_t len1, const ase_char_t* s2);
|
||||
int ase_strxncmp (
|
||||
const ase_char_t* s1, ase_size_t len1,
|
||||
const ase_char_t* s2, ase_size_t len2);
|
||||
|
||||
int ase_strcasecmp (
|
||||
const ase_char_t* s1, const ase_char_t* s2, ase_ccls_t* ccls);
|
||||
int ase_strxncasecmp (
|
||||
const ase_char_t* s1, ase_size_t len1,
|
||||
const ase_char_t* s2, ase_size_t len2, ase_ccls_t* ccls);
|
||||
|
||||
ase_char_t* ase_strdup (const ase_char_t* str, ase_mmgr_t* mmgr);
|
||||
ase_char_t* ase_strxdup (
|
||||
const ase_char_t* str, ase_size_t len, ase_mmgr_t* mmgr);
|
||||
ase_char_t* ase_strxdup2 (
|
||||
const ase_char_t* str1, ase_size_t len1,
|
||||
const ase_char_t* str2, ase_size_t len2, ase_mmgr_t* mmgr);
|
||||
|
||||
ase_char_t* ase_strstr (const ase_char_t* str, const ase_char_t* sub);
|
||||
ase_char_t* ase_strxstr (
|
||||
const ase_char_t* str, ase_size_t size, const ase_char_t* sub);
|
||||
ase_char_t* ase_strxnstr (
|
||||
const ase_char_t* str, ase_size_t strsz,
|
||||
const ase_char_t* sub, ase_size_t subsz);
|
||||
|
||||
ase_char_t* ase_strchr (const ase_char_t* str, ase_cint_t c);
|
||||
ase_char_t* ase_strxchr (const ase_char_t* str, ase_size_t len, ase_cint_t c);
|
||||
ase_char_t* ase_strrchr (const ase_char_t* str, ase_cint_t c);
|
||||
ase_char_t* ase_strxrchr (const ase_char_t* str, ase_size_t len, ase_cint_t c);
|
||||
|
||||
/* Checks if a string begins with a substring */
|
||||
ase_char_t* ase_strbeg (const ase_char_t* str, const ase_char_t* sub);
|
||||
ase_char_t* ase_strxbeg (
|
||||
const ase_char_t* str, ase_size_t len, const ase_char_t* sub);
|
||||
ase_char_t* ase_strnbeg (
|
||||
const ase_char_t* str, const ase_char_t* sub, ase_size_t len);
|
||||
ase_char_t* ase_strxnbeg (
|
||||
const ase_char_t* str, ase_size_t len1,
|
||||
const ase_char_t* sub, ase_size_t len2);
|
||||
|
||||
/* Checks if a string ends with a substring */
|
||||
ase_char_t* ase_strend (const ase_char_t* str, const ase_char_t* sub);
|
||||
ase_char_t* ase_strxend (
|
||||
const ase_char_t* str, ase_size_t len, const ase_char_t* sub);
|
||||
ase_char_t* ase_strnend (
|
||||
const ase_char_t* str, const ase_char_t* sub, ase_size_t len);
|
||||
ase_char_t* ase_strxnend (
|
||||
const ase_char_t* str, ase_size_t len1,
|
||||
const ase_char_t* sub, ase_size_t len2);
|
||||
|
||||
/*
|
||||
* string conversion
|
||||
*/
|
||||
int ase_strtoi (const ase_char_t* str);
|
||||
long ase_strtol (const ase_char_t* str);
|
||||
unsigned int ase_strtoui (const ase_char_t* str);
|
||||
unsigned long ase_strtoul (const ase_char_t* str);
|
||||
|
||||
int ase_strxtoi (const ase_char_t* str, ase_size_t len);
|
||||
long ase_strxtol (const ase_char_t* str, ase_size_t len);
|
||||
unsigned int ase_strxtoui (const ase_char_t* str, ase_size_t len);
|
||||
unsigned long ase_strxtoul (const ase_char_t* str, ase_size_t len);
|
||||
|
||||
ase_int_t ase_strtoint (const ase_char_t* str);
|
||||
ase_long_t ase_strtolong (const ase_char_t* str);
|
||||
ase_uint_t ase_strtouint (const ase_char_t* str);
|
||||
ase_ulong_t ase_strtoulong (const ase_char_t* str);
|
||||
|
||||
ase_int_t ase_strxtoint (const ase_char_t* str, ase_size_t len);
|
||||
ase_long_t ase_strxtolong (const ase_char_t* str, ase_size_t len);
|
||||
ase_uint_t ase_strxtouint (const ase_char_t* str, ase_size_t len);
|
||||
ase_ulong_t ase_strxtoulong (const ase_char_t* str, ase_size_t len);
|
||||
|
||||
/*
|
||||
* dynamic string
|
||||
*/
|
||||
|
||||
ase_str_t* ase_str_open (ase_str_t* str, ase_size_t capa, ase_mmgr_t* mmgr);
|
||||
void ase_str_close (ase_str_t* str);
|
||||
void ase_str_clear (ase_str_t* str);
|
||||
|
||||
void ase_str_forfeit (ase_str_t* str);
|
||||
void ase_str_swap (ase_str_t* str, ase_str_t* str2);
|
||||
|
||||
ase_size_t ase_str_cpy (ase_str_t* str, const ase_char_t* s);
|
||||
ase_size_t ase_str_ncpy (ase_str_t* str, const ase_char_t* s, ase_size_t len);
|
||||
|
||||
ase_size_t ase_str_cat (ase_str_t* str, const ase_char_t* s);
|
||||
ase_size_t ase_str_ncat (ase_str_t* str, const ase_char_t* s, ase_size_t len);
|
||||
ase_size_t ase_str_ccat (ase_str_t* str, ase_char_t c);
|
||||
ase_size_t ase_str_nccat (ase_str_t* str, ase_char_t c, ase_size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
469
ase/lib/cmn/str_bas.c
Normal file
469
ase/lib/cmn/str_bas.c
Normal file
@ -0,0 +1,469 @@
|
||||
/*
|
||||
* $Id: str_bas.c 159 2008-04-01 08:37:30Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#include <ase/cmn/str.h>
|
||||
#include <ase/cmn/mem.h>
|
||||
|
||||
ase_size_t ase_strlen (const ase_char_t* str)
|
||||
{
|
||||
const ase_char_t* p = str;
|
||||
while (*p != ASE_T('\0')) p++;
|
||||
return p - str;
|
||||
}
|
||||
|
||||
ase_size_t ase_strcpy (ase_char_t* buf, const ase_char_t* str)
|
||||
{
|
||||
ase_char_t* org = buf;
|
||||
while ((*buf++ = *str++) != ASE_T('\0'));
|
||||
return buf - org - 1;
|
||||
}
|
||||
|
||||
ase_size_t ase_strxcpy (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str)
|
||||
{
|
||||
ase_char_t* p, * p2;
|
||||
|
||||
p = buf; p2 = buf + bsz - 1;
|
||||
|
||||
while (p < p2)
|
||||
{
|
||||
if (*str == ASE_T('\0')) break;
|
||||
*p++ = *str++;
|
||||
}
|
||||
|
||||
if (bsz > 0) *p = ASE_T('\0');
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
ase_size_t ase_strncpy (
|
||||
ase_char_t* buf, const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
/*
|
||||
const ase_char_t* end = str + len;
|
||||
while (str < end) *buf++ = *str++;
|
||||
*buf = ASE_T('\0');
|
||||
return len;
|
||||
*/
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
ase_size_t n = (len-1) >> 3; /* (len-1) / 8 */
|
||||
|
||||
switch (len & 7) /* len % 8 */
|
||||
{
|
||||
repeat:
|
||||
case 0: *buf++ = *str++;
|
||||
case 7: *buf++ = *str++;
|
||||
case 6: *buf++ = *str++;
|
||||
case 5: *buf++ = *str++;
|
||||
case 4: *buf++ = *str++;
|
||||
case 3: *buf++ = *str++;
|
||||
case 2: *buf++ = *str++;
|
||||
case 1: *buf++ = *str++;
|
||||
if (n <= 0) break;
|
||||
n--;
|
||||
goto repeat;
|
||||
}
|
||||
}
|
||||
|
||||
*buf = ASE_T('\0');
|
||||
return len;
|
||||
}
|
||||
|
||||
ase_size_t ase_strxncpy (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
ase_size_t n;
|
||||
|
||||
if (bsz <= 0) return 0;
|
||||
if ((n = bsz - 1) > len) n = len;
|
||||
ase_memcpy (buf, str, n * ASE_SIZEOF(ase_char_t));
|
||||
buf[n] = ASE_T('\0');
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ase_size_t ase_strxcat (ase_char_t* buf, ase_size_t bsz, const ase_char_t* str)
|
||||
{
|
||||
ase_char_t* p, * p2;
|
||||
ase_size_t blen;
|
||||
|
||||
blen = ase_strlen(buf);
|
||||
if (blen >= bsz) return blen; /* something wrong */
|
||||
|
||||
p = buf + blen;
|
||||
p2 = buf + bsz - 1;
|
||||
|
||||
while (p < p2)
|
||||
{
|
||||
if (*str == ASE_T('\0')) break;
|
||||
*p++ = *str++;
|
||||
}
|
||||
|
||||
if (bsz > 0) *p = ASE_T('\0');
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
|
||||
ase_size_t ase_strxncat (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
ase_char_t* p, * p2;
|
||||
const ase_char_t* end;
|
||||
ase_size_t blen;
|
||||
|
||||
blen = ase_strlen(buf);
|
||||
if (blen >= bsz) return blen; /* something wrong */
|
||||
|
||||
p = buf + blen;
|
||||
p2 = buf + bsz - 1;
|
||||
|
||||
end = str + len;
|
||||
|
||||
while (p < p2)
|
||||
{
|
||||
if (str >= end) break;
|
||||
*p++ = *str++;
|
||||
}
|
||||
|
||||
if (bsz > 0) *p = ASE_T('\0');
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
int ase_strcmp (const ase_char_t* s1, const ase_char_t* s2)
|
||||
{
|
||||
while (*s1 == *s2)
|
||||
{
|
||||
if (*s1 == ASE_T('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int ase_strxcmp (const ase_char_t* s1, ase_size_t len, const ase_char_t* s2)
|
||||
{
|
||||
const ase_char_t* end = s1 + len;
|
||||
while (s1 < end && *s2 != ASE_T('\0') && *s1 == *s2) s1++, s2++;
|
||||
if (s1 == end && *s2 == ASE_T('\0')) return 0;
|
||||
if (*s1 == *s2) return (s1 < end)? 1: -1;
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int ase_strxncmp (
|
||||
const ase_char_t* s1, ase_size_t len1,
|
||||
const ase_char_t* s2, ase_size_t len2)
|
||||
{
|
||||
ase_char_t c1, c2;
|
||||
const ase_char_t* end1 = s1 + len1;
|
||||
const ase_char_t* end2 = s2 + len2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = *s1;
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = *s2;
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
||||
|
||||
int ase_strcasecmp (
|
||||
const ase_char_t* s1, const ase_char_t* s2, ase_ccls_t* ccls)
|
||||
{
|
||||
while (ASE_TOUPPER(ccls,*s1) == ASE_TOUPPER(ccls,*s2))
|
||||
{
|
||||
if (*s1 == ASE_C('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (ASE_TOUPPER(ccls,*s1) > ASE_TOUPPER(ccls,*s2))? 1: -1;
|
||||
}
|
||||
|
||||
int ase_strxncasecmp (
|
||||
const ase_char_t* s1, ase_size_t len1,
|
||||
const ase_char_t* s2, ase_size_t len2, ase_ccls_t* ccls)
|
||||
{
|
||||
ase_char_t c1, c2;
|
||||
const ase_char_t* end1 = s1 + len1;
|
||||
const ase_char_t* end2 = s2 + len2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = ASE_TOUPPER (ccls, *s1);
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = ASE_TOUPPER (ccls, *s2);
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strdup (const ase_char_t* str, ase_mmgr_t* mmgr)
|
||||
{
|
||||
ase_char_t* tmp;
|
||||
|
||||
tmp = (ase_char_t*) ASE_MALLOC (
|
||||
mmgr, (ase_strlen(str)+1)*ASE_SIZEOF(ase_char_t));
|
||||
if (tmp == ASE_NULL) return ASE_NULL;
|
||||
|
||||
ase_strcpy (tmp, str);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxdup (
|
||||
const ase_char_t* str, ase_size_t len, ase_mmgr_t* mmgr)
|
||||
{
|
||||
ase_char_t* tmp;
|
||||
|
||||
tmp = (ase_char_t*) ASE_MALLOC (
|
||||
mmgr, (len+1)*ASE_SIZEOF(ase_char_t));
|
||||
if (tmp == ASE_NULL) return ASE_NULL;
|
||||
|
||||
ase_strncpy (tmp, str, len);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxdup2 (
|
||||
const ase_char_t* str1, ase_size_t len1,
|
||||
const ase_char_t* str2, ase_size_t len2, ase_mmgr_t* mmgr)
|
||||
{
|
||||
ase_char_t* tmp;
|
||||
|
||||
tmp = (ase_char_t*) ASE_MALLOC (
|
||||
mmgr, (len1+len2+1) * ASE_SIZEOF(ase_char_t));
|
||||
if (tmp == ASE_NULL) return ASE_NULL;
|
||||
|
||||
ase_strncpy (tmp, str1, len1);
|
||||
ase_strncpy (tmp + len1, str2, len2);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strstr (const ase_char_t* str, const ase_char_t* sub)
|
||||
{
|
||||
const ase_char_t* x, * y;
|
||||
|
||||
y = sub;
|
||||
if (*y == ASE_T('\0')) return (ase_char_t*)str;
|
||||
|
||||
while (*str != ASE_T('\0'))
|
||||
{
|
||||
if (*str != *y)
|
||||
{
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
|
||||
x = str;
|
||||
while (1)
|
||||
{
|
||||
if (*y == ASE_T('\0')) return (ase_char_t*)str;
|
||||
if (*x++ != *y++) break;
|
||||
}
|
||||
|
||||
y = sub;
|
||||
str++;
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxstr (
|
||||
const ase_char_t* str, ase_size_t size, const ase_char_t* sub)
|
||||
{
|
||||
return ase_strxnstr (str, size, sub, ase_strlen(sub));
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxnstr (
|
||||
const ase_char_t* str, ase_size_t strsz,
|
||||
const ase_char_t* sub, ase_size_t subsz)
|
||||
{
|
||||
const ase_char_t* end, * subp;
|
||||
|
||||
if (subsz == 0) return (ase_char_t*)str;
|
||||
if (strsz < subsz) return ASE_NULL;
|
||||
|
||||
end = str + strsz - subsz;
|
||||
subp = sub + subsz;
|
||||
|
||||
while (str <= end)
|
||||
{
|
||||
const ase_char_t* x = str;
|
||||
const ase_char_t* y = sub;
|
||||
|
||||
while (ase_true)
|
||||
{
|
||||
if (y >= subp) return (ase_char_t*)str;
|
||||
if (*x != *y) break;
|
||||
x++; y++;
|
||||
}
|
||||
|
||||
str++;
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strchr (const ase_char_t* str, ase_cint_t c)
|
||||
{
|
||||
while (*str != ASE_T('\0'))
|
||||
{
|
||||
if (*str == c) return (ase_char_t*)str;
|
||||
str++;
|
||||
}
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxchr (const ase_char_t* str, ase_size_t len, ase_cint_t c)
|
||||
{
|
||||
const ase_char_t* end = str + len;
|
||||
|
||||
while (str < end)
|
||||
{
|
||||
if (*str == c) return (ase_char_t*)str;
|
||||
str++;
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strrchr (const ase_char_t* str, ase_cint_t c)
|
||||
{
|
||||
const ase_char_t* end = str;
|
||||
|
||||
while (*end != ASE_T('\0')) end++;
|
||||
|
||||
while (end > str)
|
||||
{
|
||||
if (*--end == c) return (ase_char_t*)end;
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxrchr (const ase_char_t* str, ase_size_t len, ase_cint_t c)
|
||||
{
|
||||
const ase_char_t* end = str + len;
|
||||
|
||||
while (end > str)
|
||||
{
|
||||
if (*--end == c) return (ase_char_t*)end;
|
||||
}
|
||||
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strbeg (const ase_char_t* str, const ase_char_t* sub)
|
||||
{
|
||||
while (*sub != ASE_T('\0'))
|
||||
{
|
||||
if (*str != *sub) return ASE_NULL;
|
||||
str++; sub++;
|
||||
}
|
||||
|
||||
/* returns the pointer to the next character of the match */
|
||||
return (ase_char_t*)str;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxbeg (
|
||||
const ase_char_t* str, ase_size_t len, const ase_char_t* sub)
|
||||
{
|
||||
const ase_char_t* end = str + len;
|
||||
|
||||
while (*sub != ASE_T('\0'))
|
||||
{
|
||||
if (str >= end || *str != *sub) return ASE_NULL;
|
||||
str++; sub++;
|
||||
}
|
||||
|
||||
/* returns the pointer to the next character of the match */
|
||||
return (ase_char_t*)str;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strnbeg (
|
||||
const ase_char_t* str, const ase_char_t* sub, ase_size_t len)
|
||||
{
|
||||
const ase_char_t* end = sub + len;
|
||||
|
||||
while (sub < end)
|
||||
{
|
||||
if (*str == ASE_T('\0') || *str != *sub) return ASE_NULL;
|
||||
str++; sub++;
|
||||
}
|
||||
|
||||
/* returns the pointer to the next character of the match */
|
||||
return (ase_char_t*)str;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxnbeg (
|
||||
const ase_char_t* str, ase_size_t len1,
|
||||
const ase_char_t* sub, ase_size_t len2)
|
||||
{
|
||||
const ase_char_t* end1, * end2;
|
||||
|
||||
if (len2 > len1) return ASE_NULL;
|
||||
|
||||
end1 = str + len1;
|
||||
end2 = sub + len2;
|
||||
|
||||
while (sub < end2)
|
||||
{
|
||||
if (str >= end1 || *str != *sub) return ASE_NULL;
|
||||
str++; sub++;
|
||||
}
|
||||
|
||||
/* returns the pointer to the next character of the match */
|
||||
return (ase_char_t*)str;
|
||||
}
|
||||
|
||||
ase_char_t* ase_strend (const ase_char_t* str, const ase_char_t* sub)
|
||||
{
|
||||
return ase_strxnend (str, ase_strlen(str), sub, ase_strlen(sub));
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxend (
|
||||
const ase_char_t* str, ase_size_t len, const ase_char_t* sub)
|
||||
{
|
||||
return ase_strxnend (str, len, sub, ase_strlen(sub));
|
||||
}
|
||||
|
||||
ase_char_t* ase_strnend (
|
||||
const ase_char_t* str, const ase_char_t* sub, ase_size_t len)
|
||||
{
|
||||
return ase_strxnend (str, ase_strlen(str), sub, len);
|
||||
}
|
||||
|
||||
ase_char_t* ase_strxnend (
|
||||
const ase_char_t* str, ase_size_t len1,
|
||||
const ase_char_t* sub, ase_size_t len2)
|
||||
{
|
||||
const ase_char_t* end1, * end2;
|
||||
|
||||
if (len2 > len1) return ASE_NULL;
|
||||
|
||||
end1 = str + len1;
|
||||
end2 = sub + len2;
|
||||
|
||||
while (end2 > sub)
|
||||
{
|
||||
if (end1 <= str) return ASE_NULL;
|
||||
if (*(--end1) != *(--end2)) return ASE_NULL;
|
||||
}
|
||||
|
||||
/* returns the pointer to the match start */
|
||||
return (ase_char_t*)end1;
|
||||
}
|
120
ase/lib/cmn/str_cnv.c
Normal file
120
ase/lib/cmn/str_cnv.c
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* $Id: str_cnv.c 142 2008-03-18 06:29:25Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#include <ase/cmn/str.h>
|
||||
#include <ase/cmn/mem.h>
|
||||
|
||||
int ase_strtoi (const ase_char_t* str)
|
||||
{
|
||||
int v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
long ase_strtol (const ase_char_t* str)
|
||||
{
|
||||
long v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
unsigned int ase_strtoui (const ase_char_t* str)
|
||||
{
|
||||
unsigned int v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
unsigned long ase_strtoul (const ase_char_t* str)
|
||||
{
|
||||
unsigned long v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
int ase_strxtoi (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
int v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
long ase_strxtol (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
long v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
unsigned int ase_strxtoui (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
unsigned int v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
unsigned long ase_strxtoul (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
unsigned long v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_int_t ase_strtoint (const ase_char_t* str)
|
||||
{
|
||||
ase_int_t v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_long_t ase_strtolong (const ase_char_t* str)
|
||||
{
|
||||
ase_long_t v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_uint_t ase_strtouint (const ase_char_t* str)
|
||||
{
|
||||
ase_uint_t v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_ulong_t ase_strtoulong (const ase_char_t* str)
|
||||
{
|
||||
ase_ulong_t v;
|
||||
ASE_STRTONUM (v, str, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_int_t ase_strxtoint (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
ase_int_t v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_long_t ase_strxtolong (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
ase_long_t v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_uint_t ase_strxtouint (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
ase_uint_t v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
||||
|
||||
ase_ulong_t ase_strxtoulong (const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
ase_ulong_t v;
|
||||
ASE_STRXTONUM (v, str, len, ASE_NULL, 10);
|
||||
return v;
|
||||
}
|
165
ase/lib/cmn/str_dyn.c
Normal file
165
ase/lib/cmn/str_dyn.c
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* $Id: str_dyn.c 141 2008-03-18 04:09:04Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#include <ase/cmn/str.h>
|
||||
#include <ase/cmn/mem.h>
|
||||
|
||||
ase_str_t* ase_str_open (ase_str_t* str, ase_size_t capa, ase_mmgr_t* mmgr)
|
||||
{
|
||||
if (str == ASE_NULL)
|
||||
{
|
||||
str = (ase_str_t*)
|
||||
ASE_MALLOC (mmgr, ASE_SIZEOF(ase_str_t));
|
||||
if (str == ASE_NULL) return ASE_NULL;
|
||||
str->__dynamic = ase_true;
|
||||
}
|
||||
else str->__dynamic = ase_false;
|
||||
|
||||
str->mmgr = mmgr;
|
||||
str->buf = (ase_char_t*) ASE_MALLOC (
|
||||
mmgr, ASE_SIZEOF(ase_char_t) * (capa + 1));
|
||||
if (str->buf == ASE_NULL)
|
||||
{
|
||||
if (str->__dynamic) ASE_FREE (mmgr, str);
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
str->size = 0;
|
||||
str->capa = capa;
|
||||
str->buf[0] = ASE_T('\0');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void ase_str_close (ase_str_t* str)
|
||||
{
|
||||
ASE_FREE (str->mmgr, str->buf);
|
||||
if (str->__dynamic) ASE_FREE (str->mmgr, str);
|
||||
}
|
||||
|
||||
void ase_str_clear (ase_str_t* str)
|
||||
{
|
||||
str->size = 0;
|
||||
str->buf[0] = ASE_T('\0');
|
||||
}
|
||||
|
||||
void ase_str_forfeit (ase_str_t* str)
|
||||
{
|
||||
if (str->__dynamic) ASE_FREE (str->mmgr, str);
|
||||
}
|
||||
|
||||
void ase_str_swap (ase_str_t* str, ase_str_t* str1)
|
||||
{
|
||||
ase_str_t tmp;
|
||||
|
||||
tmp.buf = str->buf;
|
||||
tmp.size = str->size;
|
||||
tmp.capa = str->capa;
|
||||
tmp.mmgr = str->mmgr;
|
||||
|
||||
str->buf = str1->buf;
|
||||
str->size = str1->size;
|
||||
str->capa = str1->capa;
|
||||
str->mmgr = str1->mmgr;
|
||||
|
||||
str1->buf = tmp.buf;
|
||||
str1->size = tmp.size;
|
||||
str1->capa = tmp.capa;
|
||||
str1->mmgr = tmp.mmgr;
|
||||
}
|
||||
|
||||
ase_size_t ase_str_cpy (ase_str_t* str, const ase_char_t* s)
|
||||
{
|
||||
/* TODO: improve it */
|
||||
return ase_str_ncpy (str, s, ase_strlen(s));
|
||||
}
|
||||
|
||||
ase_size_t ase_str_ncpy (ase_str_t* str, const ase_char_t* s, ase_size_t len)
|
||||
{
|
||||
ase_char_t* buf;
|
||||
|
||||
if (len > str->capa)
|
||||
{
|
||||
buf = (ase_char_t*) ASE_MALLOC (
|
||||
str->mmgr, ASE_SIZEOF(ase_char_t) * (len + 1));
|
||||
if (buf == ASE_NULL) return (ase_size_t)-1;
|
||||
|
||||
ASE_FREE (str->mmgr, str->buf);
|
||||
str->capa = len;
|
||||
str->buf = buf;
|
||||
}
|
||||
|
||||
str->size = ase_strncpy (str->buf, s, len);
|
||||
str->buf[str->size] = ASE_T('\0');
|
||||
return str->size;
|
||||
}
|
||||
|
||||
ase_size_t ase_str_cat (ase_str_t* str, const ase_char_t* s)
|
||||
{
|
||||
/* TODO: improve it */
|
||||
return ase_str_ncat (str, s, ase_strlen(s));
|
||||
}
|
||||
|
||||
ase_size_t ase_str_ncat (ase_str_t* str, const ase_char_t* s, ase_size_t len)
|
||||
{
|
||||
if (len > str->capa - str->size)
|
||||
{
|
||||
ase_char_t* tmp;
|
||||
ase_size_t capa;
|
||||
|
||||
capa = str->size + len;
|
||||
|
||||
/* double the capa if necessary for concatenation */
|
||||
if (capa < str->capa * 2) capa = str->capa * 2;
|
||||
|
||||
if (str->mmgr->realloc != ASE_NULL)
|
||||
{
|
||||
tmp = (ase_char_t*) ASE_REALLOC (
|
||||
str->mmgr, str->buf,
|
||||
ASE_SIZEOF(ase_char_t) * (capa + 1));
|
||||
if (tmp == ASE_NULL) return (ase_size_t)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (ase_char_t*) ASE_MALLOC (
|
||||
str->mmgr, ASE_SIZEOF(ase_char_t)*(capa+1));
|
||||
if (tmp == ASE_NULL) return (ase_size_t)-1;
|
||||
if (str->buf != ASE_NULL)
|
||||
{
|
||||
ase_memcpy (tmp, str->buf,
|
||||
ASE_SIZEOF(ase_char_t)*(str->capa+1));
|
||||
ASE_FREE (str->mmgr, str->buf);
|
||||
}
|
||||
}
|
||||
|
||||
str->capa = capa;
|
||||
str->buf = tmp;
|
||||
}
|
||||
|
||||
str->size += ase_strncpy (&str->buf[str->size], s, len);
|
||||
str->buf[str->size] = ASE_T('\0');
|
||||
return str->size;
|
||||
}
|
||||
|
||||
ase_size_t ase_str_ccat (ase_str_t* str, ase_char_t c)
|
||||
{
|
||||
return ase_str_ncat (str, &c, 1);
|
||||
}
|
||||
|
||||
ase_size_t ase_str_nccat (ase_str_t* str, ase_char_t c, ase_size_t len)
|
||||
{
|
||||
while (len > 0)
|
||||
{
|
||||
if (ase_str_ncat (str, &c, 1) == (ase_size_t)-1)
|
||||
{
|
||||
return (ase_size_t)-1;
|
||||
}
|
||||
|
||||
len--;
|
||||
}
|
||||
return str->size;
|
||||
}
|
||||
|
289
ase/lib/cmn/types.h
Normal file
289
ase/lib/cmn/types.h
Normal file
@ -0,0 +1,289 @@
|
||||
/*
|
||||
* $Id: types.h 155 2008-03-22 06:47:27Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#ifndef _ASE_TYPES_H_
|
||||
#define _ASE_TYPES_H_
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <ase/cmn/conf_msw.h>
|
||||
#elif defined(vms) || defined(__vms)
|
||||
#include <ase/cmn/conf_vms.h>
|
||||
#elif defined(__unix__) || defined(__unix) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__SPU__)
|
||||
#if !defined(__unix__)
|
||||
#define __unix__
|
||||
#endif
|
||||
#if !defined(__unix)
|
||||
#define __unix
|
||||
#endif
|
||||
#include <ase/cmn/conf_unx.h>
|
||||
#else
|
||||
#error unsupported operating system
|
||||
#endif
|
||||
|
||||
/* boolean type */
|
||||
typedef int ase_bool_t;
|
||||
#define ase_true (0 == 0)
|
||||
#define ase_false (0 != 0)
|
||||
|
||||
/* tri-state type */
|
||||
typedef int ase_tri_t;
|
||||
#define ase_alive 1
|
||||
#define ase_zombie 0
|
||||
#define ase_dead -1
|
||||
|
||||
/* integer that can hold a pointer */
|
||||
#if (defined(hpux) || defined(__hpux) || defined(__hpux__)) && (ASE_SIZEOF_VOID_P == ASE_SIZEOF_LONG)
|
||||
typedef long ase_int_t;
|
||||
typedef unsigned long ase_uint_t;
|
||||
#elif defined(__SPU__) && (ASE_SIZEOF_VOID_P == ASE_SIZEOF_LONG)
|
||||
typedef long ase_int_t;
|
||||
typedef unsigned long ase_uint_t;
|
||||
#elif ASE_SIZEOF_VOID_P == ASE_SIZEOF_INT
|
||||
typedef int ase_int_t;
|
||||
typedef unsigned int ase_uint_t;
|
||||
#elif ASE_SIZEOF_VOID_P == ASE_SIZEOF_LONG
|
||||
typedef long ase_int_t;
|
||||
typedef unsigned long ase_uint_t;
|
||||
#elif ASE_SIZEOF_VOID_P == ASE_SIZEOF_LONG_LONG
|
||||
typedef long long ase_int_t;
|
||||
typedef unsigned long long ase_uint_t;
|
||||
#elif ASE_SIZEOF_VOID_P == ASE_SIZEOF___INT32
|
||||
typedef __int32 ase_int_t;
|
||||
typedef unsigned __int32 ase_uint_t;
|
||||
#elif ASE_SIZEOF_VOID_P == ASE_SIZEOF___INT64
|
||||
typedef __int64 ase_int_t;
|
||||
typedef unsigned __int64 ase_uint_t;
|
||||
#else
|
||||
#error unsupported pointer size
|
||||
#endif
|
||||
|
||||
|
||||
/* the largest integer supported by the system */
|
||||
#if ASE_SIZEOF_LONG_LONG != 0
|
||||
typedef long long ase_long_t;
|
||||
typedef unsigned long long ase_ulong_t;
|
||||
#elif ASE_SIZEOF___INT64 != 0
|
||||
typedef __int64 ase_long_t;
|
||||
typedef unsigned __int64 ase_ulong_t;
|
||||
#else
|
||||
typedef long ase_long_t;
|
||||
typedef unsigned long ase_ulong_t;
|
||||
#endif
|
||||
|
||||
/* integers of specific size */
|
||||
#if ASE_SIZEOF_CHAR == 1
|
||||
typedef char ase_int8_t;
|
||||
typedef unsigned char ase_uint8_t;
|
||||
#elif ASE_SIZEOF___INT8 == 1
|
||||
typedef __int8 ase_int8_t;
|
||||
typedef unsigned __int8 ase_uint8_t;
|
||||
#endif
|
||||
|
||||
#if ASE_SIZEOF_SHORT == 2
|
||||
typedef short ase_int16_t;
|
||||
typedef unsigned short ase_uint16_t;
|
||||
#elif ASE_SIZEOF___INT16 == 2
|
||||
typedef __int16 ase_int16_t;
|
||||
typedef unsigned __int16 ase_uint16_t;
|
||||
#endif
|
||||
|
||||
#if ASE_SIZEOF_INT == 4
|
||||
typedef int ase_int32_t;
|
||||
typedef unsigned int ase_uint32_t;
|
||||
#elif ASE_SIZEOF_LONG == 4
|
||||
typedef long ase_int32_t;
|
||||
typedef unsigned long ase_uint32_t;
|
||||
#elif ASE_SIZEOF___INT32 == 4
|
||||
typedef __int32 ase_int32_t;
|
||||
typedef unsigned __int32 ase_uint32_t;
|
||||
#endif
|
||||
|
||||
#if ASE_SIZEOF_INT == 8
|
||||
#define ASE_HAVE_INT64_T
|
||||
#define ASE_HAVE_UINT64_T
|
||||
typedef int ase_int64_t;
|
||||
typedef unsigned int ase_uint64_t;
|
||||
#elif ASE_SIZEOF_LONG == 8
|
||||
#define ASE_HAVE_INT64_T
|
||||
#define ASE_HAVE_UINT64_T
|
||||
typedef long ase_int64_t;
|
||||
typedef unsigned long ase_uint64_t;
|
||||
#elif ASE_SIZEOF_LONG_LONG == 8
|
||||
#define ASE_HAVE_INT64_T
|
||||
#define ASE_HAVE_UINT64_T
|
||||
typedef long long ase_int64_t;
|
||||
typedef unsigned long long ase_uint64_t;
|
||||
#elif ASE_SIZEOF___INT64 == 8
|
||||
#define ASE_HAVE_INT64_T
|
||||
#define ASE_HAVE_UINT64_T
|
||||
typedef __int64 ase_int64_t;
|
||||
typedef unsigned __int64 ase_uint64_t;
|
||||
#endif
|
||||
|
||||
#if ASE_SIZEOF_INT == 16
|
||||
#define ASE_HAVE_INT128_T
|
||||
#define ASE_HAVE_UINT128_T
|
||||
typedef int ase_int128_t;
|
||||
typedef unsigned int ase_uint128_t;
|
||||
#elif ASE_SIZEOF_LONG == 16
|
||||
#define ASE_HAVE_INT128_T
|
||||
#define ASE_HAVE_UINT128_T
|
||||
typedef long ase_int128_t;
|
||||
typedef unsigned long ase_uint128_t;
|
||||
#elif ASE_SIZEOF_LONG_LONG == 16
|
||||
#define ASE_HAVE_INT128_T
|
||||
#define ASE_HAVE_UINT128_T
|
||||
typedef long long ase_int128_t;
|
||||
typedef unsigned long long ase_uint128_t;
|
||||
#elif ASE_SIZEOF___INT128 == 16
|
||||
#define ASE_HAVE_INT128_T
|
||||
#define ASE_HAVE_UINT128_T
|
||||
typedef __int128 ase_int128_t;
|
||||
typedef unsigned __int128 ase_uint128_t;
|
||||
#endif
|
||||
|
||||
/* miscellaneous integral types */
|
||||
typedef ase_uint8_t ase_byte_t;
|
||||
typedef ase_uint_t ase_size_t;
|
||||
typedef ase_int_t ase_ssize_t;
|
||||
typedef ase_uint_t ase_word_t;
|
||||
|
||||
/* floating-point number */
|
||||
#if defined(__FreeBSD__)
|
||||
/* TODO: check if the support for long double is complete.
|
||||
* if so, use long double for ase_real_t */
|
||||
#define ASE_SIZEOF_REAL ASE_SIZEOF_DOUBLE
|
||||
typedef double ase_real_t;
|
||||
#elif ASE_SIZEOF_LONG_DOUBLE > ASE_SIZEOF_DOUBLE
|
||||
#define ASE_SIZEOF_REAL ASE_SIZEOF_LONG_DOUBLE
|
||||
typedef long double ase_real_t;
|
||||
#else
|
||||
#define ASE_SIZEOF_REAL ASE_SIZEOF_DOUBLE
|
||||
typedef double ase_real_t;
|
||||
#endif
|
||||
|
||||
/* character types */
|
||||
typedef char ase_mchar_t;
|
||||
typedef int ase_mcint_t;
|
||||
|
||||
#if defined(__cplusplus) && (!defined(_MSC_VER) || (defined(_MSC_VER)&&defined(_NATIVE_WCHAR_T_DEFINED)))
|
||||
/* C++ */
|
||||
|
||||
typedef wchar_t ase_wchar_t;
|
||||
typedef wchar_t ase_wcint_t;
|
||||
|
||||
/* all the way down from here for C */
|
||||
#elif (ASE_SIZEOF_WCHAR_T == 2) || (ASE_SIZEOF_WCHAR_T == 0)
|
||||
typedef unsigned short ase_wchar_t;
|
||||
typedef unsigned short ase_wcint_t;
|
||||
#elif (ASE_SIZEOF_WCHAR_T == 4)
|
||||
#if defined(vms) || defined(__vms)
|
||||
typedef unsigned int ase_wchar_t;
|
||||
typedef int ase_wcint_t;
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
typedef int ase_wchar_t;
|
||||
typedef int ase_wcint_t;
|
||||
#elif (defined(sun) || defined(__sun)) && defined(_LP64)
|
||||
typedef int ase_wchar_t;
|
||||
typedef int ase_wcint_t;
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
typedef int ase_wchar_t;
|
||||
typedef int ase_wcint_t;
|
||||
#elif defined(hpux) || defined(__hpux) || defined(__hpux__)
|
||||
#if defined(__HP_cc) || defined(__HP_aCC)
|
||||
typedef unsigned int ase_wchar_t;
|
||||
#else
|
||||
typedef int ase_wchar_t;
|
||||
#endif
|
||||
typedef int ase_wcint_t;
|
||||
#elif ASE_SIZEOF_LONG == 4
|
||||
typedef long ase_wchar_t;
|
||||
typedef long ase_wcint_t;
|
||||
#elif ASE_SIZEOF_INT == 4
|
||||
typedef int ase_wchar_t;
|
||||
typedef int ase_wcint_t;
|
||||
#else
|
||||
#error no supported data type for wchar_t
|
||||
#endif
|
||||
#else
|
||||
#error unsupported size of wchar_t
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && (defined(UNICODE)||defined(_UNICODE))
|
||||
#define ASE_CHAR_IS_WCHAR
|
||||
typedef ase_wchar_t ase_char_t;
|
||||
typedef ase_wcint_t ase_cint_t;
|
||||
#else
|
||||
#if defined(ASE_CHAR_IS_MCHAR)
|
||||
typedef ase_mchar_t ase_char_t;
|
||||
typedef ase_mcint_t ase_cint_t;
|
||||
#elif defined(ASE_CHAR_IS_WCHAR)
|
||||
typedef ase_wchar_t ase_char_t;
|
||||
typedef ase_wcint_t ase_cint_t;
|
||||
#elif defined(_MBCS)
|
||||
#define ASE_CHAR_IS_MCHAR
|
||||
typedef ase_mchar_t ase_char_t;
|
||||
typedef ase_mcint_t ase_cint_t;
|
||||
#else
|
||||
#define ASE_CHAR_IS_WCHAR
|
||||
typedef ase_wchar_t ase_char_t;
|
||||
typedef ase_wcint_t ase_cint_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ASE_CHAR_IS_WCHAR) && defined(_WIN32)
|
||||
#ifndef UNICODE
|
||||
#define UNICODE
|
||||
#endif
|
||||
#ifndef _UNICODE
|
||||
#define _UNICODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct ase_cstr_t ase_cstr_t;
|
||||
typedef struct ase_mmgr_t ase_mmgr_t;
|
||||
typedef struct ase_ccls_t ase_ccls_t;
|
||||
|
||||
typedef void* (*ase_malloc_t) (void* custom, ase_size_t n);
|
||||
typedef void* (*ase_realloc_t) (void* custom, void* ptr, ase_size_t n);
|
||||
typedef void (*ase_free_t) (void* custom, void* ptr);
|
||||
|
||||
typedef ase_bool_t (*ase_isccls_t) (void* custom, ase_cint_t c);
|
||||
typedef ase_cint_t (*ase_toccls_t) (void* custom, ase_cint_t c);
|
||||
|
||||
struct ase_cstr_t
|
||||
{
|
||||
const ase_char_t* ptr;
|
||||
ase_size_t len;
|
||||
};
|
||||
|
||||
struct ase_mmgr_t
|
||||
{
|
||||
ase_malloc_t malloc;
|
||||
ase_realloc_t realloc;
|
||||
ase_free_t free;
|
||||
void* custom_data;
|
||||
};
|
||||
|
||||
struct ase_ccls_t
|
||||
{
|
||||
ase_isccls_t is_upper;
|
||||
ase_isccls_t is_lower;
|
||||
ase_isccls_t is_alpha;
|
||||
ase_isccls_t is_digit;
|
||||
ase_isccls_t is_xdigit;
|
||||
ase_isccls_t is_alnum;
|
||||
ase_isccls_t is_space;
|
||||
ase_isccls_t is_print;
|
||||
ase_isccls_t is_graph;
|
||||
ase_isccls_t is_cntrl;
|
||||
ase_isccls_t is_punct;
|
||||
ase_toccls_t to_upper;
|
||||
ase_toccls_t to_lower;
|
||||
void* custom_data;
|
||||
};
|
||||
|
||||
#endif
|
17
ase/lib/cmn/unpack.h
Normal file
17
ase/lib/cmn/unpack.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* $Id: unpack.h 116 2008-03-03 11:15:37Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#elif defined(__HP_aCC) || defined(__HP_cc)
|
||||
#pragma PACK
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#pragma pack(pop)
|
||||
#elif defined(__DECC)
|
||||
#pragma pack(pop)
|
||||
#else
|
||||
#pragma pack()
|
||||
#endif
|
Reference in New Issue
Block a user