This commit is contained in:
2008-06-04 02:18:55 +00:00
parent 5786cae59c
commit 8179c37c29
105 changed files with 0 additions and 0 deletions

249
ase/lib/utl/aseutl.bdsproj Normal file
View File

@ -0,0 +1,249 @@
<?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">main.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="aseutl.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="main.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="str" FORMNAME="" DESIGNCLASS=""/>
<FILE FILENAME="ctype.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="mem" FORMNAME="" DESIGNCLASS=""/>
<FILE FILENAME="http.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="mem" FORMNAME="" DESIGNCLASS=""/>
<FILE FILENAME="stdio.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="aseutl.bdsproj">
<precompile mode="0" cancancel="0" capture="-1" showconsole="0">mkdir $(PROJECTDIR)..\release\lib
mkdir $(PROJECTDIR)..\debug\lib
</precompile>
</buildevent>
</buildevents>
</CPlusPlusBuilder.Personality>
</BorlandProject>

135
ase/lib/utl/aseutl.dsp Normal file
View File

@ -0,0 +1,135 @@
# Microsoft Developer Studio Project File - Name="aseutl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=aseutl - 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 "aseutl.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 "aseutl.mak" CFG="aseutl - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "aseutl - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "aseutl - 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)" == "aseutl - 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)" == "aseutl - 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
# 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 "aseutl - Win32 Release"
# Name "aseutl - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ctype.c
# End Source File
# Begin Source File
SOURCE=.\http.c
# End Source File
# Begin Source File
SOURCE=.\main.c
# End Source File
# Begin Source File
SOURCE=.\stdio.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ctype.h
# End Source File
# Begin Source File
SOURCE=.\http.h
# End Source File
# Begin Source File
SOURCE=.\main.h
# End Source File
# Begin Source File
SOURCE=.\stdio.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

460
ase/lib/utl/aseutl.vcproj Normal file
View File

@ -0,0 +1,460 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="aseutl"
ProjectGUID="{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}"
RootNamespace="aseutl"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<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>
<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>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="ctype.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\http.c"
>
</File>
<File
RelativePath="main.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="stdio.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="ctype.h"
>
</File>
<File
RelativePath=".\http.h"
>
</File>
<File
RelativePath="main.h"
>
</File>
<File
RelativePath="stdio.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>

152
ase/lib/utl/ctype.c Normal file
View File

@ -0,0 +1,152 @@
/*
* $Id: ctype.c 132 2008-03-17 10:27:02Z baconevi $
*
* {License}
*/
#include <ase/utl/ctype.h>
#if defined(ASE_CHAR_IS_MCHAR)
#include <ctype.h>
ase_bool_t ase_isupper (ase_cint_t c)
{
return isupper (c);
}
ase_bool_t ase_islower (ase_cint_t c)
{
return islower (c);
}
ase_bool_t ase_isalpha (ase_cint_t c)
{
return isalpha (c);
}
ase_bool_t ase_isdigit (ase_cint_t c)
{
return isdigit (c);
}
ase_bool_t ase_isxdigit (ase_cint_t c)
{
return isxdigit (c);
}
ase_bool_t ase_isalnum (ase_cint_t c)
{
return isalnum (c);
}
ase_bool_t ase_isspace (ase_cint_t c)
{
return isspace (c);
}
ase_bool_t ase_isprint (ase_cint_t c)
{
return isprint (c);
}
ase_bool_t ase_isgraph (ase_cint_t c)
{
return isgraph (c);
}
ase_bool_t ase_iscntrl (ase_cint_t c)
{
return iscntrl (c);
}
ase_bool_t ase_ispunct (ase_cint_t c)
{
return ispunct (c);
}
ase_cint_t ase_toupper (ase_cint_t c)
{
return toupper (c);
}
ase_cint_t ase_tolower (ase_cint_t c)
{
return tolower (c);
}
#elif defined(ASE_CHAR_IS_WCHAR)
#include <ctype.h>
#include <wctype.h>
ase_bool_t ase_isupper (ase_cint_t c)
{
return iswupper (c);
}
ase_bool_t ase_islower (ase_cint_t c)
{
return iswlower (c);
}
ase_bool_t ase_isalpha (ase_cint_t c)
{
return iswalpha (c);
}
ase_bool_t ase_isdigit (ase_cint_t c)
{
return iswdigit (c);
}
ase_bool_t ase_isxdigit (ase_cint_t c)
{
return iswxdigit (c);
}
ase_bool_t ase_isalnum (ase_cint_t c)
{
return iswalnum (c);
}
ase_bool_t ase_isspace (ase_cint_t c)
{
return iswspace (c);
}
ase_bool_t ase_isprint (ase_cint_t c)
{
return iswprint (c);
}
ase_bool_t ase_isgraph (ase_cint_t c)
{
return iswgraph (c);
}
ase_bool_t ase_iscntrl (ase_cint_t c)
{
return iswcntrl (c);
}
ase_bool_t ase_ispunct (ase_cint_t c)
{
return iswpunct (c);
}
ase_cint_t ase_toupper (ase_cint_t c)
{
return towupper (c);
}
ase_cint_t ase_tolower (ase_cint_t c)
{
return towlower (c);
}
#else
#error unsupported character type
#endif

34
ase/lib/utl/ctype.h Normal file
View File

@ -0,0 +1,34 @@
/*
* $Id: ctype.h 131 2008-03-17 08:57:23Z baconevi $
*/
#ifndef _ASE_UTL_CTYPE_H_
#define _ASE_UTL_CTYPE_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#ifdef __cplusplus
extern "C" {
#endif
ase_bool_t ase_isupper (ase_cint_t c);
ase_bool_t ase_islower (ase_cint_t c);
ase_bool_t ase_isalpha (ase_cint_t c);
ase_bool_t ase_isdigit (ase_cint_t c);
ase_bool_t ase_isxdigit (ase_cint_t c);
ase_bool_t ase_isalnum (ase_cint_t c);
ase_bool_t ase_isspace (ase_cint_t c);
ase_bool_t ase_isprint (ase_cint_t c);
ase_bool_t ase_isgraph (ase_cint_t c);
ase_bool_t ase_iscntrl (ase_cint_t c);
ase_bool_t ase_ispunct (ase_cint_t c);
ase_cint_t ase_toupper (ase_cint_t c);
ase_cint_t ase_tolower (ase_cint_t c);
#ifdef __cplusplus
}
#endif
#endif

18
ase/lib/utl/descrip.mms Normal file
View File

@ -0,0 +1,18 @@
#
# OpenVMS MMS/MMK
#
objects = main.obj,ctype.obj,stdio.obj,http.obj,getopt.obj
CFLAGS = /include="../.."
#CFLAGS = /pointer_size=long /include="../.."
LIBRFLAGS =
aseutl.olb : $(objects)
$(LIBR)/create $(MMS$TARGET) $(objects)
main.obj depends_on main.c
ctype.obj depends_on ctype.c
stdio.obj depends_on stdio.c
http.obj depends_on http.c
getopt.obj depends_on getopt.c

133
ase/lib/utl/getopt.c Normal file
View File

@ -0,0 +1,133 @@
/*
* $Id: getopt.c 160 2008-04-08 13:59:49Z baconevi $
*
* {License}
*/
#include <ase/utl/getopt.h>
#include <ase/cmn/str.h>
/*
* ase_getopt is based on BSD getopt.
* --------------------------------------------------------------------------
*
* Copyright (c) 1987-2002 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* A. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* B. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* C. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* --------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BADCH ASE_T('?')
#define BADARG ASE_T(':')
#define EMSG ASE_T("")
#define optstr opt->str
#define optarg opt->arg
#define optind opt->ind
#define optopt opt->opt
#define place opt->cur
ase_cint_t ase_getopt (int argc, ase_char_t* const* argv, ase_opt_t* opt)
{
ase_char_t* oli; /* option letter list index */
if (place == ASE_NULL)
{
place = EMSG;
optind = 1;
}
if (*place == ASE_T('\0'))
{
/* update scanning pointer */
if (optind >= argc || *(place = argv[optind]) != ASE_T('-'))
{
place = EMSG;
return ASE_CHAR_EOF;
}
if (place[1] != ASE_T('\0') && *++place == ASE_T('-'))
{
/* found "--" */
++optind;
place = EMSG;
return ASE_CHAR_EOF;
}
} /* option letter okay? */
if ((optopt = *place++) == ASE_T(':') ||
(oli = ase_strchr(optstr, optopt)) == ASE_NULL)
{
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
*/
if (optopt == (int)'-') return ASE_CHAR_EOF;
if (*place == ASE_T('\0')) ++optind;
return BADCH;
}
if (*++oli != ASE_T(':'))
{
/* don't need argument */
optarg = ASE_NULL;
if (*place == ASE_T('\0')) ++optind;
}
else
{
/* need an argument */
if (*place != ASE_T('\0'))
{
/* no white space */
optarg = place;
}
else if (argc <= ++optind)
{
/* no arg */
place = EMSG;
/*if (*optstr == ASE_T(':'))*/ return BADARG;
/*return BADCH;*/
}
else
{
/* white space */
optarg = argv[optind];
}
place = EMSG;
++optind;
}
return optopt; /* dump back option letter */
}

42
ase/lib/utl/getopt.h Normal file
View File

@ -0,0 +1,42 @@
/*
* $Id: getopt.h 137 2008-03-17 12:35:02Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_GETOPT_H_
#define _ASE_UTL_GETOPT_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
typedef struct ase_opt_t ase_opt_t;
struct ase_opt_t
{
/* input */
const ase_char_t* str;
/* output */
ase_cint_t opt; /* character checked for validity */
ase_char_t* arg; /* argument associated with an option */
int err;
/* input + output */
int ind; /* index into parent argv vector */
/* internal */
ase_char_t* cur;
};
#ifdef __cplusplus
extern "C" {
#endif
ase_cint_t ase_getopt (int argc, ase_char_t* const* argv, ase_opt_t* opt);
#ifdef __cplusplus
}
#endif
#endif

191
ase/lib/utl/http.c Normal file
View File

@ -0,0 +1,191 @@
/*
* $Id: http.c 116 2008-03-03 11:15:37Z baconevi $
*/
#include <ase/utl/http.h>
#include <ase/utl/ctype.h>
#include <ase/cmn/mem.h>
static int is_http_space (ase_char_t c)
{
return ase_isspace(c) && c != ASE_T('\r') && c != ASE_T('\n');
}
#define is_http_ctl(c) ase_iscntrl(c)
static int is_http_separator (ase_char_t c)
{
return c == ASE_T('(') ||
c == ASE_T(')') ||
c == ASE_T('<') ||
c == ASE_T('>') ||
c == ASE_T('@') ||
c == ASE_T(',') ||
c == ASE_T(';') ||
c == ASE_T(':') ||
c == ASE_T('\\') ||
c == ASE_T('\"') ||
c == ASE_T('/') ||
c == ASE_T('[') ||
c == ASE_T(']') ||
c == ASE_T('?') ||
c == ASE_T('=') ||
c == ASE_T('{') ||
c == ASE_T('}') ||
c == ASE_T('\t') ||
c == ASE_T(' ');
}
static int is_http_token (ase_char_t c)
{
return ase_isprint(c) && !is_http_ctl(c) && !is_http_separator(c);
}
static int digit_to_num (ase_char_t c)
{
if (c >= ASE_T('0') && c <= ASE_T('9')) return c - ASE_T('0');
if (c >= ASE_T('A') && c <= ASE_T('Z')) return c - ASE_T('A') + 10;
if (c >= ASE_T('a') && c <= ASE_T('z')) return c - ASE_T('a') + 10;
return -1;
}
ase_char_t* ase_parsehttpreq (ase_char_t* buf, ase_http_req_t* req)
{
ase_char_t* p = buf, * x;
/* ignore leading spaces */
while (is_http_space(*p)) p++;
/* the method should start with an alphabet */
if (!ase_isalpha(*p)) return ASE_NULL;
/* scan the method */
req->method = p; while (ase_isalpha(*p)) p++;
/* the method should be followed by a space */
if (!is_http_space(*p)) return ASE_NULL;
/* null-terminate the method */
*p++ = ASE_T('\0');
/* skip spaces */
while (is_http_space(*p)) p++;
/* scan the url */
req->path.ptr = p;
req->args.ptr = ASE_NULL;
x = p;
while (ase_isprint(*p) && !ase_isspace(*p))
{
if (*p == ASE_T('%') && ase_isxdigit(*(p+1)) && ase_isxdigit(*(p+2)))
{
*x++ = (digit_to_num(*(p+1)) << 4) + digit_to_num(*(p+2));
p += 3;
}
else if (*p == ASE_T('?') && req->args.ptr == ASE_NULL)
{
/* ? must be explicit to be a argument instroducer.
* %3f is just a literal. */
req->path.len = x - req->path.ptr;
*x++ = ASE_T('\0');
req->args.ptr = x;
p++;
}
else *x++ = *p++;
}
/* the url should be followed by a space */
if (!is_http_space(*p)) return ASE_NULL;
/* null-terminate the url and store the length */
if (req->args.ptr != ASE_NULL)
req->args.len = x - req->args.ptr;
else
req->path.len = x - req->path.ptr;
*x++ = ASE_T('\0');
/* path should start with a slash */
if (req->path.len <= 0 || req->path.ptr[0] != ASE_T('/')) return ASE_NULL;
/* skip spaces */
do { p++; } while (is_http_space(*p));
/* check http version */
if ((p[0] == ASE_T('H') || p[0] == ASE_T('h')) &&
(p[1] == ASE_T('T') || p[1] == ASE_T('t')) &&
(p[2] == ASE_T('T') || p[2] == ASE_T('t')) &&
(p[3] == ASE_T('P') || p[3] == ASE_T('p')) &&
p[4] == ASE_T('/') && p[6] == ASE_T('.'))
{
if (!ase_isdigit(p[5])) return ASE_NULL;
if (!ase_isdigit(p[7])) return ASE_NULL;
req->vers.major = p[5] - ASE_T('0');
req->vers.minor = p[7] - ASE_T('0');
p += 8;
}
else return ASE_NULL;
while (ase_isspace(*p))
{
if (*p++ == ASE_T('\n')) goto ok;
}
/* not terminating with a new line.
* maybe garbage after the request line */
if (*p != ASE_T('\0')) return ASE_NULL;
ok:
/* returns the next position */
return p;
}
ase_char_t* ase_parsehttphdr (ase_char_t* buf, ase_http_hdr_t* hdr)
{
ase_char_t* p = buf, * last;
/* ignore leading spaces including CR and NL */
while (ase_isspace(*p)) p++;
if (*p == ASE_T('\0'))
{
/* no more header line */
ase_memset (hdr, 0, ASE_SIZEOF(*hdr));
return p;
}
if (!is_http_token(*p)) return ASE_NULL;
hdr->name.ptr = p;
do { p++; } while (is_http_token(*p));
last = p;
hdr->name.len = last - hdr->name.ptr;
while (is_http_space(*p)) p++;
if (*p != ASE_T(':')) return ASE_NULL;
*last = ASE_T('\0');
do { p++; } while (is_http_space(*p));
hdr->value.ptr = last = p;
while (ase_isprint(*p))
{
if (!ase_isspace(*p++)) last = p;
}
hdr->value.len = last - hdr->value.ptr;
while (ase_isspace(*p))
{
if (*p++ == ASE_T('\n')) goto ok;
}
/* not terminating with a new line.
* maybe garbage after the header line */
if (*p != ASE_T('\0')) return ASE_NULL;
ok:
*last = ASE_T('\0');
return p;
}

66
ase/lib/utl/http.h Normal file
View File

@ -0,0 +1,66 @@
/*
* $Id: http.h 132 2008-03-17 10:27:02Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_HTTP_H_
#define _ASE_UTL_HTTP_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
/* returns the type of http method */
typedef struct ase_http_req_t ase_http_req_t;
typedef struct ase_http_hdr_t ase_http_hdr_t;
struct ase_http_req_t
{
ase_char_t* method;
struct
{
ase_char_t* ptr;
ase_size_t len;
} path;
struct
{
ase_char_t* ptr;
ase_size_t len;
} args;
struct
{
char major;
char minor;
} vers;
};
struct ase_http_hdr_t
{
struct
{
ase_char_t* ptr;
ase_size_t len;
} name;
struct
{
ase_char_t* ptr;
ase_size_t len;
} value;
};
#ifdef __cplusplus
extern "C" {
#endif
ase_char_t* ase_parsehttpreq (ase_char_t* buf, ase_http_req_t* req);
ase_char_t* ase_parsehttphdr (ase_char_t* buf, ase_http_hdr_t* hdr);
#ifdef __cplusplus
}
#endif
#endif

93
ase/lib/utl/main.c Normal file
View File

@ -0,0 +1,93 @@
/*
* $Id: main.c 116 2008-03-03 11:15:37Z baconevi $
*
* {License}
*/
#include <ase/utl/main.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#if defined(_WIN32)
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]))
{
return mf (argc, argv);
}
#elif defined(ASE_CHAR_IS_WCHAR)
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]))
{
int i, ret;
ase_char_t** v;
setlocale (LC_ALL, "");
v = (ase_char_t**) malloc (argc * ASE_SIZEOF(ase_char_t*));
if (v == NULL) return -1;
for (i = 0; i < argc; i++) v[i] = NULL;
for (i = 0; i < argc; i++)
{
ase_size_t n, len, rem;
char* p = argv[i];
len = 0; rem = strlen (p);
while (*p != '\0')
{
int x = mblen (p, rem);
if (x == -1)
{
ret = -1;
goto exit_main;
}
if (x == 0) break;
p += x; rem -= x; len++;
}
#if (defined(vms) || defined(__vms)) && (ASE_SIZEOF_VOID_P >= 8)
v[i] = (ase_char_t*) _malloc32 ((len+1)*ASE_SIZEOF(ase_char_t));
#else
v[i] = (ase_char_t*) malloc ((len+1)*ASE_SIZEOF(ase_char_t));
#endif
if (v[i] == NULL)
{
ret = -1;
goto exit_main;
}
n = mbstowcs (v[i], argv[i], len);
if (n == (size_t)-1)
{
/* error */
return -1;
}
if (n == len) v[i][len] = ASE_T('\0');
}
/* TODO: envp... */
//ret = mf (argc, v, NULL);
ret = mf (argc, v);
exit_main:
for (i = 0; i < argc; i++)
{
if (v[i] != NULL) free (v[i]);
}
free (v);
return ret;
}
#else
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]))
{
return mf (argc, argv);
}
#endif

33
ase/lib/utl/main.h Normal file
View File

@ -0,0 +1,33 @@
/*
* $Id: main.h 132 2008-03-17 10:27:02Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_MAIN_H_
#define _ASE_UTL_MAIN_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#if defined(_WIN32)
#include <tchar.h>
#define ase_main _tmain
typedef ase_char_t ase_achar_t;
#else
#define ase_main main
typedef ase_mchar_t ase_achar_t;
#endif
#ifdef __cplusplus
extern "C" {
#endif
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]));
#ifdef __cplusplus
}
#endif
#endif

57
ase/lib/utl/makefile.in Normal file
View File

@ -0,0 +1,57 @@
#
# $Id: makefile.in,v 1.3 2007/04/30 08:32:50 bacon Exp $
#
NAME = aseutl
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)/main.o \
$(TMP_DIR)/ctype.o \
$(TMP_DIR)/stdio.o \
$(TMP_DIR)/http.o \
$(TMP_DIR)/getopt.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)/main.o: main.c
$(CC) $(CFLAGS) -o $@ -c main.c
$(TMP_DIR)/ctype.o: ctype.c
$(CC) $(CFLAGS) -o $@ -c ctype.c
$(TMP_DIR)/stdio.o: stdio.c
$(CC) $(CFLAGS) -o $@ -c stdio.c
$(TMP_DIR)/http.o: http.c
$(CC) $(CFLAGS) -o $@ -c http.c
$(TMP_DIR)/getopt.o: getopt.c
$(CC) $(CFLAGS) -o $@ -c getopt.c
$(OUT_DIR):
mkdir -p $(OUT_DIR)
$(TMP_DIR):
mkdir -p $(TMP_DIR)
clean:
rm -rf $(OUT_FILE) $(OBJ_FILES)

63
ase/lib/utl/msw-bcc.mak Normal file
View File

@ -0,0 +1,63 @@
NAME = aseutl
!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)\main.obj \
$(TMP_DIR)\ctype.obj \
$(TMP_DIR)\stdio.obj \
$(TMP_DIR)\http.obj
all: lib
lib: $(TMP_DIR) $(OUT_DIR) $(OUT_FILE_LIB)
$(OUT_FILE_LIB): $(OBJ_FILES_LIB)
$(AR) $(OUT_FILE_LIB) @&&!
+-$(**: = &^
+-)
!
$(TMP_DIR)\main.obj: main.c
$(CC) $(CFLAGS) -o$@ -c main.c
$(TMP_DIR)\ctype.obj: ctype.c
$(CC) $(CFLAGS) -o$@ -c ctype.c
$(TMP_DIR)\stdio.obj: stdio.c
$(CC) $(CFLAGS) -o$@ -c stdio.c
$(TMP_DIR)\http.obj: http.c
$(CC) $(CFLAGS) -o$@ -c http.c
$(OUT_DIR):
-md $(OUT_DIR)
$(TMP_DIR):
-md $(TMP_DIR)
clean:
-del $(OUT_FILE_LIB)
-del $(OBJ_FILES_LIB)

59
ase/lib/utl/msw-cl.mak Normal file
View File

@ -0,0 +1,59 @@
NAME = aseutl
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)\main.obj \
$(TMP_DIR)\ctype.obj \
$(TMP_DIR)\stdio.obj \
$(TMP_DIR)\http.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)\main.obj: main.c
$(CC) $(CFLAGS) /Fo$@ /c main.c
$(TMP_DIR)\ctype.obj: ctype.c
$(CC) $(CFLAGS) /Fo$@ /c ctype.c
$(TMP_DIR)\stdio.obj: stdio.c
$(CC) $(CFLAGS) /Fo$@ /c stdio.c
$(TMP_DIR)\http.obj: http.c
$(CC) $(CFLAGS) /Fo$@ /c http.c
$(OUT_DIR):
-md $(OUT_DIR)
$(TMP_DIR):
-md $(TMP_DIR)
clean:
-del $(OUT_FILE_LIB)
-del $(OBJ_FILES_LIB)

50
ase/lib/utl/msw-dmc.mak Normal file
View File

@ -0,0 +1,50 @@
#
# You may override the value of MODE by specifying from the command-line
# make -f msw-dmc.mak MODE=debug
#
NAME = aseutl
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)\main.obj \
$(TMP_DIR)\ctype.obj \
$(TMP_DIR)\stdio.obj \
$(TMP_DIR)\http.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)\main.obj: main.c
$(CC) $(CFLAGS) -o$@ -c main.c
$(TMP_DIR)\ctype.obj: ctype.c
$(CC) $(CFLAGS) -o$@ -c ctype.c
$(TMP_DIR)\stdio.obj: stdio.c
$(CC) $(CFLAGS) -o$@ -c stdio.c
$(TMP_DIR)\http.obj: http.c
$(CC) $(CFLAGS) -o$@ -c http.c
$(OUT_DIR):
md $(OUT_DIR)
$(TMP_DIR):
md $(TMP_DIR)
clean:
del $(OUT_FILE_LIB) $(OBJ_FILES_LIB)

476
ase/lib/utl/stdio.c Normal file
View File

@ -0,0 +1,476 @@
/*
* $Id: stdio.c 149 2008-03-20 09:49:53Z baconevi $
*
* {License}
*/
#include <ase/utl/stdio.h>
#include <ase/utl/ctype.h>
#include <wchar.h>
#include <stdlib.h>
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX 2048
#endif
#if defined(_WIN32)
int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list ap)
{
int n;
n = _vsntprintf (buf, size, fmt, ap);
if (n < 0 || (size_t)n >= size)
{
if (size > 0) buf[size-1] = ASE_T('\0');
n = -1;
}
return n;
}
int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vsprintf (buf, size, fmt, ap);
va_end (ap);
return n;
}
#else
static ase_char_t* __adjust_format (const ase_char_t* format);
int ase_vfprintf (ASE_FILE *stream, const ase_char_t* fmt, va_list ap)
{
int n;
ase_char_t* nf = __adjust_format (fmt);
if (nf == NULL) return -1;
#ifdef ASE_CHAR_IS_MCHAR
n = vfprintf (stream, nf, ap);
#else
n = vfwprintf (stream, nf, ap);
#endif
free (nf);
return n;
}
int ase_vprintf (const ase_char_t* fmt, va_list ap)
{
return ase_vfprintf (stdout, fmt, ap);
}
int ase_fprintf (ASE_FILE* file, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vfprintf (file, fmt, ap);
va_end (ap);
return n;
}
int ase_printf (const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vprintf (fmt, ap);
va_end (ap);
return n;
}
int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list ap)
{
int n;
ase_char_t* nf = __adjust_format (fmt);
if (nf == NULL) return -1;
#if defined(ASE_CHAR_IS_MCHAR)
n = vsnprintf (buf, size, nf, ap);
#elif defined(_WIN32)
n = _vsnwprintf (buf, size, nf, ap);
#else
n = vswprintf (buf, size, nf, ap);
#endif
if (n < 0 || (size_t)n >= size)
{
if (size > 0) buf[size-1] = ASE_T('\0');
n = -1;
}
free (nf);
return n;
}
int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vsprintf (buf, size, fmt, ap);
va_end (ap);
return n;
}
#define MOD_SHORT 1
#define MOD_LONG 2
#define MOD_LONGLONG 3
#define ADDC(buf,c) \
do { \
if (buf.len >= buf.cap) \
{ \
ase_char_t* tmp; \
tmp = (ase_char_t*)realloc ( \
buf.ptr, sizeof(ase_char_t)*(buf.cap+256+1)); \
if (tmp == NULL) \
{ \
free (buf.ptr); \
return NULL; \
} \
buf.ptr = tmp; \
buf.cap = buf.cap + 256; \
} \
buf.ptr[buf.len++] = c; \
} while (0)
static ase_char_t* __adjust_format (const ase_char_t* format)
{
const ase_char_t* fp = format;
int modifier;
ase_char_t ch;
struct
{
ase_char_t* ptr;
ase_size_t len;
ase_size_t cap;
} buf;
buf.len = 0;
buf.cap = 256;
#if (defined(vms) || defined(__vms)) && (ASE_SIZEOF_VOID_P >= 8)
buf.ptr = (ase_char_t*) _malloc32 (sizeof(ase_char_t)*(buf.cap+1));
#else
buf.ptr = (ase_char_t*) malloc (sizeof(ase_char_t)*(buf.cap+1));
#endif
if (buf.ptr == NULL) return NULL;
while (*fp != ASE_T('\0'))
{
while (*fp != ASE_T('\0') && *fp != ASE_T('%'))
{
ADDC (buf, *fp++);
}
if (*fp == ASE_T('\0')) break;
ch = *fp++;
ADDC (buf, ch); /* add % */
ch = *fp++;
/* flags */
while (1)
{
if (ch == ASE_T(' ') || ch == ASE_T('+') ||
ch == ASE_T('-') || ch == ASE_T('#'))
{
ADDC (buf, ch);
ch = *fp++;
}
else
{
if (ch == ASE_T('0'))
{
ADDC (buf, ch);
ch = *fp++;
}
break;
}
}
/* check the width */
if (ch == ASE_T('*'))
{
ADDC (buf, ch);
ch = *fp++;
}
else
{
while (ase_isdigit(ch))
{
ADDC (buf, ch);
ch = *fp++;
}
}
/* precision */
if (ch == ASE_T('.'))
{
ADDC (buf, ch);
ch = *fp++;
if (ch == ASE_T('*'))
{
ADDC (buf, ch);
ch = *fp++;
}
else
{
while (ase_isdigit(ch))
{
ADDC (buf, ch);
ch = *fp++;
}
}
}
/* modifier */
for (modifier = 0;;)
{
if (ch == ASE_T('h')) modifier = MOD_SHORT;
else if (ch == ASE_T('l'))
{
modifier = (modifier == MOD_LONG)? MOD_LONGLONG: MOD_LONG;
}
else break;
ch = *fp++;
}
/* type */
if (ch == ASE_T('%')) ADDC (buf, ch);
else if (ch == ASE_T('c') || ch == ASE_T('s'))
{
#if !defined(ASE_CHAR_IS_MCHAR) && !defined(_WIN32)
ADDC (buf, 'l');
#endif
ADDC (buf, ch);
}
else if (ch == ASE_T('C') || ch == ASE_T('S'))
{
#if defined(_WIN32)
ADDC (buf, ch);
#else
#ifdef ASE_CHAR_IS_MCHAR
ADDC (buf, 'l');
#endif
ADDC (buf, ase_tolower(ch));
#endif
}
else if (ch == ASE_T('d') || ch == ASE_T('i') ||
ch == ASE_T('o') || ch == ASE_T('u') ||
ch == ASE_T('x') || ch == ASE_T('X'))
{
if (modifier == MOD_SHORT)
{
ADDC (buf, 'h');
}
else if (modifier == MOD_LONG)
{
ADDC (buf, 'l');
}
else if (modifier == MOD_LONGLONG)
{
#if defined(_WIN32) && !defined(__LCC__)
ADDC (buf, 'I');
ADDC (buf, '6');
ADDC (buf, '4');
#else
ADDC (buf, 'l');
ADDC (buf, 'l');
#endif
}
ADDC (buf, ch);
}
else if (ch == ASE_T('\0')) break;
else ADDC (buf, ch);
}
buf.ptr[buf.len] = ASE_T('\0');
return buf.ptr;
}
#endif
int ase_dprintf (const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vfprintf (stderr, fmt, ap);
va_end (ap);
return n;
}
ASE_FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode)
{
#if defined(_WIN32)
return _tfopen (path, mode);
#elif defined(ASE_CHAR_IS_MCHAR)
return fopen (path, mode);
#else
char path_mb[PATH_MAX + 1];
char mode_mb[32];
size_t n;
n = wcstombs (path_mb, path, ASE_COUNTOF(path_mb));
if (n == (size_t)-1) return NULL;
if (n == ASE_COUNTOF(path_mb)) path_mb[ASE_COUNTOF(path_mb)-1] = '\0';
n = wcstombs (mode_mb, mode, ASE_COUNTOF(mode_mb));
if (n == (size_t)-1) return NULL;
if (n == ASE_COUNTOF(mode_mb)) path_mb[ASE_COUNTOF(mode_mb)-1] = '\0';
return fopen (path_mb, mode_mb);
#endif
}
ASE_FILE* ase_popen (const ase_char_t* cmd, const ase_char_t* mode)
{
#if defined(__SPU__)
/* popen is not available */
#warning ############################################
#warning ase_popen is NOT SUPPORTED in this platform.
#warning #############################################
return ASE_NULL;
#elif defined(_WIN32)
#if defined(__DMC__)
/* TODO: implement this for DMC */
#warning ############################################
#warning ase_popen is NOT SUPPORTED in this platform.
#warning #############################################
return ASE_NULL;
#else
return _tpopen (cmd, mode);
#endif
#elif defined(ASE_CHAR_IS_MCHAR)
return popen (cmd, mode);
#else
char cmd_mb[PATH_MAX + 1];
char mode_mb[32];
size_t n;
n = wcstombs (cmd_mb, cmd, ASE_COUNTOF(cmd_mb));
if (n == (size_t)-1) return NULL;
if (n == ASE_COUNTOF(cmd_mb)) cmd_mb[ASE_COUNTOF(cmd_mb)-1] = '\0';
n = wcstombs (mode_mb, mode, ASE_COUNTOF(mode_mb));
if (n == (size_t)-1) return NULL;
if (n == ASE_COUNTOF(mode_mb)) cmd_mb[ASE_COUNTOF(mode_mb)-1] = '\0';
return popen (cmd_mb, mode_mb);
#endif
}
static int isnl (const ase_char_t* ptr, ase_size_t len, void* delim)
{
return (ptr[len-1] == *(ase_char_t*)delim)? 1: 0;
}
ase_ssize_t ase_getline (ase_char_t **buf, ase_size_t *n, ASE_FILE *fp)
{
ase_char_t nl = ASE_T('\n');
return ase_getdelim (buf, n, isnl, &nl, fp);
}
ase_ssize_t ase_getdelim (
ase_char_t **buf, ase_size_t *n,
ase_getdelim_t fn, void* fnarg, ASE_FILE *fp)
{
ase_char_t* b;
ase_size_t capa;
ase_size_t len = 0;
int x;
ASE_ASSERT (buf != ASE_NULL);
ASE_ASSERT (n != ASE_NULL);
b = *buf;
capa = *n;
if (b == ASE_NULL)
{
capa = 256;
#if (defined(vms) || defined(__vms)) && (ASE_SIZEOF_VOID_P >= 8)
b = (ase_char_t*) _malloc32 (sizeof(ase_char_t)*(capa+1));
#else
b = (ase_char_t*) malloc (sizeof(ase_char_t)*(capa+1));
#endif
if (b == ASE_NULL) return -2;
}
if (ase_feof(fp))
{
len = (ase_size_t)-1;
goto exit_task;
}
while (1)
{
ase_cint_t c = ase_fgetc(fp);
if (c == ASE_CHAR_EOF)
{
if (ase_ferror(fp))
{
len = (ase_size_t)-2;
goto exit_task;
}
if (len == 0)
{
len = (ase_size_t)-1;
goto exit_task;
}
break;
}
if (len+1 >= capa)
{
ase_size_t ncapa = capa + 256;
ase_char_t* nb;
nb = realloc (b, ncapa*sizeof(ase_char_t));
if (nb == ASE_NULL)
{
len = (ase_size_t)-2;
goto exit_task;
}
b = nb;
capa = ncapa;
}
b[len++] = c;
x = fn (b, len, fnarg);
if (x < 0)
{
len = (ase_size_t)-3;
goto exit_task;
}
if (x > 0) break;
}
b[len] = ASE_T('\0');
exit_task:
*buf = b;
*n = capa;
return (ase_ssize_t)len;
}

88
ase/lib/utl/stdio.h Normal file
View File

@ -0,0 +1,88 @@
/*
* $Id: stdio.h 148 2008-03-18 08:26:52Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_STDIO_H_
#define _ASE_UTL_STDIO_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
#if defined(_WIN32)
#include <tchar.h>
#define ase_printf _tprintf
#define ase_vprintf _vtprintf
#define ase_fprintf _ftprintf
#define ase_vfprintf _vftprintf
#define ase_fgets(x,y,s) _fgetts(x,y,s)
#define ase_fgetc(x) _fgettc(x)
#define ase_fputs(x,s) _fputts(x,s)
#define ase_fputc(x,s) _fputtc(x,s)
#elif defined(ASE_CHAR_IS_MCHAR)
#define ase_fgets(x,y,s) fgets(x,y,s)
#define ase_fgetc(x) fgetc(x)
#define ase_fputs(x,s) fputs(x,s)
#define ase_fputc(x,s) fputc(x,s)
#else
#define ase_fgets(x,y,s) fgetws(x,y,s)
#define ase_fgetc(x) fgetwc(x)
#define ase_fputs(x,s) fputws(x,s)
#define ase_fputc(x,s) fputwc(x,s)
#endif
#define ase_feof(s) feof(s)
#define ase_ferror(s) ferror(s)
#define ase_clearerr(s) clearerr(s)
#define ase_fflush(s) fflush(s)
#define ase_fclose(s) fclose(s)
#define ASE_FILE FILE
#define ASE_STDIN stdin
#define ASE_STDOUT stdout
#define ASE_STDERR stderr
typedef int (*ase_getdelim_t) (const ase_char_t* ptr,ase_size_t len, void* arg);
#ifdef __cplusplus
extern "C" {
#endif
int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list ap);
int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...);
#if !defined(_WIN32)
int ase_vfprintf (ASE_FILE *stream, const ase_char_t* fmt, va_list ap);
int ase_vprintf (const ase_char_t* fmt, va_list ap);
int ase_fprintf (ASE_FILE* file, const ase_char_t* fmt, ...);
int ase_printf (const ase_char_t* fmt, ...);
#endif
int ase_dprintf (const ase_char_t* fmt, ...);
ASE_FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode);
ASE_FILE* ase_popen (const ase_char_t* cmd, const ase_char_t* mode);
/**
* returns -2 on error, -1 on eof, length of data read on success
*/
ase_ssize_t ase_getline (ase_char_t **buf, ase_size_t *n, ASE_FILE *fp);
/**
* returns -3 on line breaker error, -2 on error, -1 on eof,
* length of data read on success
*/
ase_ssize_t ase_getdelim (
ase_char_t **buf, ase_size_t *n,
ase_getdelim_t fn, void* fnarg, ASE_FILE *fp);
#ifdef __cplusplus
}
#endif
#endif