remove duplicated code from sfctool.c, sftags.c
Link with hacklib to provide them instead
This commit is contained in:
+36
-35
@@ -298,23 +298,24 @@ recover-version.o: ../src/version.c $(HACK_H)
|
|||||||
# dependencies for optional sfctool
|
# dependencies for optional sfctool
|
||||||
#
|
#
|
||||||
# object files for sfctool utility
|
# object files for sfctool utility
|
||||||
SFCTOOLOBJS = $(TARGETPFX)sfctool.o $(TARGETPFX)sf-alloc.o \
|
SFCTOOLOBJS = $(TARGETPFX)sfctool.o \
|
||||||
$(TARGETPFX)sf-monst.o $(TARGETPFX)sf-objects.o \
|
$(TARGETPFX)sf-alloc.o $(TARGETPFX)sfdata.o \
|
||||||
$(TARGETPFX)sfbase.o $(TARGETPFX)sfstruct.o \
|
$(TARGETPFX)sfexpasc.o $(TARGETPFX)sf-cfgfiles.o \
|
||||||
$(TARGETPFX)sfexpasc.o \
|
$(TARGETPFX)sf-date.o $(TARGETPFX)sf-artifact.o \
|
||||||
$(TARGETPFX)sfdata.o $(TARGETPFX)sf-nhlua.o \
|
$(TARGETPFX)sf-calendar.o $(TARGETPFX)sf-decl.o \
|
||||||
$(TARGETPFX)panic.o $(TARGETPFX)sf-date.o \
|
|
||||||
$(TARGETPFX)sf-decl.o $(TARGETPFX)sf-artifact.o \
|
|
||||||
$(TARGETPFX)sf-dungeon.o $(TARGETPFX)sf-end.o \
|
$(TARGETPFX)sf-dungeon.o $(TARGETPFX)sf-end.o \
|
||||||
$(TARGETPFX)sf-engrave.o $(TARGETPFX)sf-cfgfiles.o \
|
$(TARGETPFX)sf-engrave.o $(TARGETPFX)sf-files.o \
|
||||||
$(TARGETPFX)sf-files.o $(TARGETPFX)sf-light.o \
|
$(TARGETPFX)sf-light.o $(TARGETPFX)sf-mdlib.o \
|
||||||
$(TARGETPFX)sf-mdlib.o $(TARGETPFX)sf-mkmaze.o \
|
$(TARGETPFX)sf-mkmaze.o $(TARGETPFX)sf-mkroom.o \
|
||||||
$(TARGETPFX)sf-mkroom.o $(TARGETPFX)sf-o_init.o \
|
$(TARGETPFX)sf-monst.o $(TARGETPFX)sf-nhlua.o \
|
||||||
$(TARGETPFX)sf-region.o $(TARGETPFX)sf-restore.o \
|
$(TARGETPFX)sf-objects.o $(TARGETPFX)sf-o_init.o \
|
||||||
$(TARGETPFX)sf-rumors.o $(TARGETPFX)sf-sys.o \
|
$(TARGETPFX)panic.o $(TARGETPFX)sf-region.o \
|
||||||
|
$(TARGETPFX)sf-restore.o $(TARGETPFX)sf-rumors.o \
|
||||||
|
$(TARGETPFX)sfbase.o $(TARGETPFX)sf-struct.o \
|
||||||
|
$(TARGETPFX)strutil.o $(TARGETPFX)sf-sys.o \
|
||||||
$(TARGETPFX)sf-timeout.o $(TARGETPFX)sf-track.o \
|
$(TARGETPFX)sf-timeout.o $(TARGETPFX)sf-track.o \
|
||||||
$(TARGETPFX)sf-version.o $(TARGETPFX)sf-worm.o \
|
$(TARGETPFX)sf-version.o $(TARGETPFX)sf-worm.o
|
||||||
$(TARGETPFX)strutil.o
|
|
||||||
SFCTOOLBIN = sfctool
|
SFCTOOLBIN = sfctool
|
||||||
|
|
||||||
SFFLAGS=-DSFCTOOL -DNOPANICTRACE -DNOCRASHREPORT -DNO_CHRONICLE
|
SFFLAGS=-DSFCTOOL -DNOPANICTRACE -DNOCRASHREPORT -DNO_CHRONICLE
|
||||||
@@ -324,26 +325,22 @@ $(SFCTOOLBIN): $(SFCTOOLOBJS) $(HACKLIB)
|
|||||||
$(TARGET_CLINK) $(TARGET_LFLAGS) -o $@ $(SFCTOOLOBJS) $(HACKLIB) $(TARGET_LIBS)
|
$(TARGET_CLINK) $(TARGET_LFLAGS) -o $@ $(SFCTOOLOBJS) $(HACKLIB) $(TARGET_LIBS)
|
||||||
$(TARGETPFX)sfctool.o: sfctool.c $(HACK_H) ../include/sfprocs.h
|
$(TARGETPFX)sfctool.o: sfctool.c $(HACK_H) ../include/sfprocs.h
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfctool.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfctool.c
|
||||||
$(TARGETPFX)sfdata.o: sfdata.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfdata.c
|
|
||||||
$(TARGETPFX)sfexpasc.o: sfexpasc.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfexpasc.c
|
|
||||||
$(TARGETPFX)sf-alloc.o: ../src/alloc.c
|
$(TARGETPFX)sf-alloc.o: ../src/alloc.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/alloc.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/alloc.c
|
||||||
|
$(TARGETPFX)sf-calendar.o: ../src/calendar.c
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/calendar.c
|
||||||
|
$(TARGETPFX)sf-cfgfiles.o: ../src/cfgfiles.c
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/cfgfiles.c
|
||||||
$(TARGETPFX)sf-date.o: ../src/date.c
|
$(TARGETPFX)sf-date.o: ../src/date.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/date.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/date.c
|
||||||
$(TARGETPFX)sf-decl.o: ../src/decl.c
|
$(TARGETPFX)sf-decl.o: ../src/decl.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/decl.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/decl.c
|
||||||
$(TARGETPFX)sf-panic.o: panic.c $(CONFIG_H)
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c panic.c
|
|
||||||
$(TARGETPFX)sf-monst.o: ../src/monst.c
|
$(TARGETPFX)sf-monst.o: ../src/monst.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/monst.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/monst.c
|
||||||
$(TARGETPFX)sf-objects.o: ../src/objects.c
|
$(TARGETPFX)sf-objects.o: ../src/objects.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/objects.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/objects.c
|
||||||
$(TARGETPFX)sf-sfbase.o: ../src/sfbase.c
|
$(TARGETPFX)sf-panic.o: panic.c $(CONFIG_H)
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfbase.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c panic.c
|
||||||
$(TARGETPFX)sfstruct.o: ../src/sfstruct.c
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfstruct.c
|
|
||||||
$(TARGETPFX)sf-artifact.o: ../src/artifact.c
|
$(TARGETPFX)sf-artifact.o: ../src/artifact.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/artifact.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/artifact.c
|
||||||
$(TARGETPFX)sf-dungeon.o: ../src/dungeon.c
|
$(TARGETPFX)sf-dungeon.o: ../src/dungeon.c
|
||||||
@@ -352,8 +349,6 @@ $(TARGETPFX)sf-end.o: ../src/end.c
|
|||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/end.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/end.c
|
||||||
$(TARGETPFX)sf-engrave.o: ../src/engrave.c
|
$(TARGETPFX)sf-engrave.o: ../src/engrave.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/engrave.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/engrave.c
|
||||||
$(TARGETPFX)sf-cfgfiles.o: ../src/cfgfiles.c
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/cfgfiles.c
|
|
||||||
$(TARGETPFX)sf-files.o: ../src/files.c
|
$(TARGETPFX)sf-files.o: ../src/files.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/files.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/files.c
|
||||||
$(TARGETPFX)sf-light.o: ../src/light.c
|
$(TARGETPFX)sf-light.o: ../src/light.c
|
||||||
@@ -364,6 +359,8 @@ $(TARGETPFX)sf-mkmaze.o: ../src/mkmaze.c
|
|||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkmaze.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkmaze.c
|
||||||
$(TARGETPFX)sf-mkroom.o: ../src/mkroom.c
|
$(TARGETPFX)sf-mkroom.o: ../src/mkroom.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkroom.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkroom.c
|
||||||
|
$(TARGETPFX)sf-nhlua.o: ../src/nhlua.c
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/nhlua.c
|
||||||
$(TARGETPFX)sf-o_init.o: ../src/o_init.c
|
$(TARGETPFX)sf-o_init.o: ../src/o_init.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/o_init.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/o_init.c
|
||||||
$(TARGETPFX)sf-region.o: ../src/region.c
|
$(TARGETPFX)sf-region.o: ../src/region.c
|
||||||
@@ -372,6 +369,16 @@ $(TARGETPFX)sf-restore.o: ../src/restore.c
|
|||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/restore.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/restore.c
|
||||||
$(TARGETPFX)sf-rumors.o: ../src/rumors.c
|
$(TARGETPFX)sf-rumors.o: ../src/rumors.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/rumors.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/rumors.c
|
||||||
|
$(TARGETPFX)sfbase.o: ../src/sfbase.c
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfbase.c
|
||||||
|
$(TARGETPFX)sfdata.o: sfdata.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfdata.c
|
||||||
|
$(TARGETPFX)sfexpasc.o: sfexpasc.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfexpasc.c
|
||||||
|
$(TARGETPFX)sf-struct.o: ../src/sfstruct.c
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfstruct.c
|
||||||
|
$(TARGETPFX)strutil.o: ../src/strutil.c
|
||||||
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/strutil.c
|
||||||
$(TARGETPFX)sf-sys.o: ../src/sys.c
|
$(TARGETPFX)sf-sys.o: ../src/sys.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sys.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sys.c
|
||||||
$(TARGETPFX)sf-timeout.o: ../src/timeout.c
|
$(TARGETPFX)sf-timeout.o: ../src/timeout.c
|
||||||
@@ -382,15 +389,9 @@ $(TARGETPFX)sf-version.o: ../src/version.c
|
|||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/version.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/version.c
|
||||||
$(TARGETPFX)sf-worm.o: ../src/worm.c
|
$(TARGETPFX)sf-worm.o: ../src/worm.c
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c
|
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c
|
||||||
$(TARGETPFX)sf-nhlua.o: ../src/nhlua.c
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/nhlua.c
|
|
||||||
$(TARGETPFX)sfbase.o: ../src/sfbase.c
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfbase.c
|
|
||||||
$(TARGETPFX)strutil.o: ../src/strutil.c
|
|
||||||
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/strutil.c
|
|
||||||
|
|
||||||
sftags: sftags.o
|
sftags: sftags.o $(HACKLIB)
|
||||||
$(CLINK) $(LFLAGS) -o $@ sftags.o $(LIBS)
|
$(CLINK) $(LFLAGS) -o $@ sftags.o $(HACKLIB) $(LIBS)
|
||||||
sftags.o: sftags.c $(HACK_H)
|
sftags.o: sftags.c $(HACK_H)
|
||||||
$(CC) $(CFLAGS) -c sftags.c
|
$(CC) $(CFLAGS) -c sftags.c
|
||||||
../include/sfproto.h: sf.tags sftags
|
../include/sfproto.h: sf.tags sftags
|
||||||
|
|||||||
+13
-14
@@ -2479,21 +2479,18 @@ $(DAT)bogusmon: $(U)makedefs.exe $(DAT)bogusmon.txt
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# sfutil
|
# sfutil
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
SFCTOOLOBJS = $(OUTL)sfctool.o $(OUTL)sf-alloc.o \
|
SFCTOOLOBJS = $(OUTL)sfctool.o \
|
||||||
$(OUTL)sf-monst.o $(OUTL)sf-objects.o \
|
$(OUTL)sf-alloc.o $(OUTL)sf-artifact.o $(OUTL)sfdata.o \
|
||||||
$(OUTL)sfbase.o $(OUTL)sf-struct.o \
|
$(OUTL)sf-date.o $(OUTL)sf-decl.o $(OUTL)sf-calendar.o \
|
||||||
$(OUTL)sfexpasc.o \
|
$(OUTL)sf-cfgfiles.o $(OUTL)sf-dungeon.o $(OUTL)sf-end.o \
|
||||||
$(OUTL)sfdata.o $(OUTL)sf-nhlua.o \
|
|
||||||
$(OUTL)panic.o $(OUTL)sf-date.o $(OUTL)sf-decl.o \
|
|
||||||
$(OUTL)sf-artifact.o $(OUTL)sf-cfgfiles.o \
|
|
||||||
$(OUTL)sf-dungeon.o $(OUTL)sf-end.o \
|
|
||||||
$(OUTL)sf-engrave.o $(OUTL)sf-files.o $(OUTL)sf-light.o \
|
$(OUTL)sf-engrave.o $(OUTL)sf-files.o $(OUTL)sf-light.o \
|
||||||
$(OUTL)sf-mdlib.o $(OUTL)sf-mkmaze.o $(OUTL)sf-mkroom.o \
|
$(OUTL)sf-mdlib.o $(OUTL)sf-mkmaze.o $(OUTL)sf-mkroom.o \
|
||||||
$(OUTL)sf-o_init.o $(OUTL)sf-region.o \
|
$(OUTL)sf-monst.o $(OUTL)sf-nhlua.o $(OUTL)sf-objects.o \
|
||||||
$(OUTL)sf-restore.o $(OUTL)sf-rumors.o \
|
$(OUTL)sf-o_init.o $(OUTL)panic.o $(OUTL)sf-region.o \
|
||||||
|
$(OUTL)sf-restore.o $(OUTL)sf-rumors.o $(OUTL)sfbase.o \
|
||||||
|
$(OUTL)sfexpasc.o $(OUTL)sf-struct.o $(OUTL)strutil.o \
|
||||||
$(OUTL)sf-sys.o $(OUTL)sf-timeout.o $(OUTL)sf-track.o \
|
$(OUTL)sf-sys.o $(OUTL)sf-timeout.o $(OUTL)sf-track.o \
|
||||||
$(OUTL)sf-version.o $(OUTL)sf-worm.o \
|
$(OUTL)sf-version.o $(OUTL)sf-worm.o $(OUTL)sf-windsys.o
|
||||||
$(OUTL)strutil.o $(OUTL)sf-windsys.o
|
|
||||||
|
|
||||||
SFCTOOLBIN = $(BinDir)sfctool.exe
|
SFCTOOLBIN = $(BinDir)sfctool.exe
|
||||||
SFFLAGS = -DSFCTOOL -DNOPANICTRACE -DNOCRASHREPORT -DNO_CHRONICLE
|
SFFLAGS = -DSFCTOOL -DNOPANICTRACE -DNOCRASHREPORT -DNO_CHRONICLE
|
||||||
@@ -2534,6 +2531,8 @@ $(OUTL)sf-struct.o: $(SRC)sfstruct.c
|
|||||||
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)sfstruct.c
|
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)sfstruct.c
|
||||||
$(OUTL)sf-artifact.o: $(SRC)artifact.c
|
$(OUTL)sf-artifact.o: $(SRC)artifact.c
|
||||||
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)artifact.c
|
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)artifact.c
|
||||||
|
$(OUTL)sf-calendar.o: $(SRC)calendar.c
|
||||||
|
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)calendar.c
|
||||||
$(OUTL)sf-cfgfiles.o: $(SRC)cfgfiles.c
|
$(OUTL)sf-cfgfiles.o: $(SRC)cfgfiles.c
|
||||||
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)cfgfiles.c
|
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)cfgfiles.c
|
||||||
$(OUTL)sf-dungeon.o: $(SRC)dungeon.c
|
$(OUTL)sf-dungeon.o: $(SRC)dungeon.c
|
||||||
@@ -2575,8 +2574,8 @@ $(OUTL)sf-sys.o: $(SRC)sys.c
|
|||||||
$(OUTL)sf-windsys.o: $(MSWSYS)windsys.c
|
$(OUTL)sf-windsys.o: $(MSWSYS)windsys.c
|
||||||
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(MSWSYS)windsys.c
|
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(MSWSYS)windsys.c
|
||||||
|
|
||||||
$(UTIL)sftags.exe: $(OUTL)sftags.o
|
$(UTIL)sftags.exe: $(OUTL)sftags.o $(OUTLHACKLIB)
|
||||||
$(link) $(LFLAGS) /OUT:$@ $(OUTL)sftags.o
|
$(link) $(LFLAGS) /OUT:$@ $(OUTL)sftags.o $(OUTLHACKLIB)
|
||||||
$(OUTL)sftags.o: $(UTIL)sftags.c $(HACK_H)
|
$(OUTL)sftags.o: $(UTIL)sftags.c $(HACK_H)
|
||||||
$(Q)$(CC) $(CFLAGS) -Fo$@ -c $(UTIL)sftags.c
|
$(Q)$(CC) $(CFLAGS) -Fo$@ -c $(UTIL)sftags.c
|
||||||
$(INCL)sfproto.h: $(UTIL)sftags.exe $(UTIL)sf.tags
|
$(INCL)sfproto.h: $(UTIL)sftags.exe $(UTIL)sf.tags
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
<ClCompile Include="$(UtilDir)sfexpasc.c" />
|
<ClCompile Include="$(UtilDir)sfexpasc.c" />
|
||||||
<ClCompile Include="$(UtilDir)sfdata.c" />
|
<ClCompile Include="$(UtilDir)sfdata.c" />
|
||||||
<ClCompile Include="$(SysWindDir)windsys.c" />
|
<ClCompile Include="$(SysWindDir)windsys.c" />
|
||||||
|
<ClCompile Include="$(SrcDir)calendar.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="$(IncDir)extern.h" />
|
<ClInclude Include="$(IncDir)extern.h" />
|
||||||
|
|||||||
@@ -91,6 +91,8 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>hacklib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -108,6 +110,8 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>hacklib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@@ -121,6 +125,8 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>hacklib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@@ -139,6 +145,8 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>hacklib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|||||||
+15
-141
@@ -153,7 +153,6 @@ const char *const rensuffixes[] = {
|
|||||||
extern boolean get_user_home_folder(char *homebuf, size_t sz); /* files.c */
|
extern boolean get_user_home_folder(char *homebuf, size_t sz); /* files.c */
|
||||||
extern void set_default_prefix_locations(const char *programPath);
|
extern void set_default_prefix_locations(const char *programPath);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum saveformats convertstyle = exportascii;
|
enum saveformats convertstyle = exportascii;
|
||||||
|
|
||||||
boolean chosen_unconvert = FALSE, explicit_option = FALSE;
|
boolean chosen_unconvert = FALSE, explicit_option = FALSE;
|
||||||
@@ -693,17 +692,27 @@ read_sysconf(void)
|
|||||||
#endif /* SYSCF */
|
#endif /* SYSCF */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* provided for linkage only */
|
||||||
|
|
||||||
DISABLE_WARNING_FORMAT_NONLITERAL
|
DISABLE_WARNING_FORMAT_NONLITERAL
|
||||||
|
|
||||||
/* provided for linkage only */
|
void
|
||||||
|
raw_printf(const char *line, ...)
|
||||||
|
{
|
||||||
|
va_list the_args;
|
||||||
|
|
||||||
|
va_start(the_args, line);
|
||||||
|
vfprintf(stdout, line, the_args);
|
||||||
|
va_end(the_args);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
error(const char *s, ...)
|
error(const char *s, ...)
|
||||||
{
|
{
|
||||||
va_list the_args;
|
va_list the_args;
|
||||||
|
|
||||||
va_start(the_args, s);
|
va_start(the_args, s);
|
||||||
printf(s, the_args);
|
vprintf(s, the_args);
|
||||||
va_end(the_args);
|
va_end(the_args);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -714,7 +723,7 @@ pline(const char *s, ...)
|
|||||||
va_list the_args;
|
va_list the_args;
|
||||||
|
|
||||||
va_start(the_args, s);
|
va_start(the_args, s);
|
||||||
printf(s, the_args);
|
vprintf(s, the_args);
|
||||||
va_end(the_args);
|
va_end(the_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,148 +733,13 @@ impossible(const char *s, ...)
|
|||||||
va_list the_args;
|
va_list the_args;
|
||||||
|
|
||||||
va_start(the_args, s);
|
va_start(the_args, s);
|
||||||
printf(s, the_args);
|
vprintf(s, the_args);
|
||||||
va_end(the_args);
|
va_end(the_args);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
RESTORE_WARNING_FORMAT_NONLITERAL
|
||||||
|
|
||||||
/* TIME_type: type of the argument to time(); we actually use &(time_t) */
|
|
||||||
#if defined(BSD) && !defined(POSIX_TYPES)
|
|
||||||
#define TIME_type long *
|
|
||||||
#else
|
|
||||||
#define TIME_type time_t *
|
|
||||||
#endif
|
|
||||||
/* LOCALTIME_type: type of the argument to localtime() */
|
|
||||||
#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) \
|
|
||||||
|| (defined(BSD) && !defined(POSIX_TYPES))
|
|
||||||
#define LOCALTIME_type long *
|
|
||||||
#else
|
|
||||||
#define LOCALTIME_type time_t *
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(AMIGA) && !defined(AZTEC_C) && !defined(__SASC_60) \
|
|
||||||
&& !defined(_DCC) && !defined(__GNUC__)
|
|
||||||
extern struct tm *localtime(time_t *);
|
|
||||||
#endif
|
|
||||||
static struct tm *getlt(void);
|
|
||||||
|
|
||||||
time_t
|
|
||||||
getnow(void)
|
|
||||||
{
|
|
||||||
time_t datetime = 0;
|
|
||||||
|
|
||||||
(void) time((TIME_type) &datetime);
|
|
||||||
return datetime;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct tm *
|
|
||||||
getlt(void)
|
|
||||||
{
|
|
||||||
time_t date = getnow();
|
|
||||||
|
|
||||||
return localtime((LOCALTIME_type) &date);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
getyear(void)
|
|
||||||
{
|
|
||||||
return (1900 + getlt()->tm_year);
|
|
||||||
}
|
|
||||||
|
|
||||||
time_t
|
|
||||||
time_from_yyyymmddhhmmss(char *buf)
|
|
||||||
{
|
|
||||||
int k;
|
|
||||||
time_t timeresult = (time_t) 0;
|
|
||||||
struct tm t, *lt;
|
|
||||||
char *d, *p, y[5], mo[3], md[3], h[3], mi[3], s[3];
|
|
||||||
|
|
||||||
if (buf && strlen(buf) == 14) {
|
|
||||||
d = buf;
|
|
||||||
p = y; /* year */
|
|
||||||
for (k = 0; k < 4; ++k)
|
|
||||||
*p++ = *d++;
|
|
||||||
*p = '\0';
|
|
||||||
p = mo; /* month */
|
|
||||||
for (k = 0; k < 2; ++k)
|
|
||||||
*p++ = *d++;
|
|
||||||
*p = '\0';
|
|
||||||
p = md; /* day */
|
|
||||||
for (k = 0; k < 2; ++k)
|
|
||||||
*p++ = *d++;
|
|
||||||
*p = '\0';
|
|
||||||
p = h; /* hour */
|
|
||||||
for (k = 0; k < 2; ++k)
|
|
||||||
*p++ = *d++;
|
|
||||||
*p = '\0';
|
|
||||||
p = mi; /* minutes */
|
|
||||||
for (k = 0; k < 2; ++k)
|
|
||||||
*p++ = *d++;
|
|
||||||
*p = '\0';
|
|
||||||
p = s; /* seconds */
|
|
||||||
for (k = 0; k < 2; ++k)
|
|
||||||
*p++ = *d++;
|
|
||||||
*p = '\0';
|
|
||||||
lt = getlt();
|
|
||||||
if (lt) {
|
|
||||||
t = *lt;
|
|
||||||
t.tm_year = atoi(y) - 1900;
|
|
||||||
t.tm_mon = atoi(mo) - 1;
|
|
||||||
t.tm_mday = atoi(md);
|
|
||||||
t.tm_hour = atoi(h);
|
|
||||||
t.tm_min = atoi(mi);
|
|
||||||
t.tm_sec = atoi(s);
|
|
||||||
timeresult = mktime(&t);
|
|
||||||
}
|
|
||||||
return timeresult;
|
|
||||||
}
|
|
||||||
return (time_t) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
yyyymmddhhmmss(time_t date)
|
|
||||||
{
|
|
||||||
long datenum;
|
|
||||||
static char datestr[15];
|
|
||||||
struct tm *lt;
|
|
||||||
|
|
||||||
if (date == 0)
|
|
||||||
lt = getlt();
|
|
||||||
else
|
|
||||||
#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) \
|
|
||||||
|| defined(BSD)
|
|
||||||
lt = localtime((long *) (&date));
|
|
||||||
#else
|
|
||||||
lt = localtime(&date);
|
|
||||||
#endif
|
|
||||||
/* just in case somebody's localtime supplies (year % 100)
|
|
||||||
rather than the expected (year - 1900) */
|
|
||||||
if (lt->tm_year < 70)
|
|
||||||
datenum = (long) lt->tm_year + 2000L;
|
|
||||||
else
|
|
||||||
datenum = (long) lt->tm_year + 1900L;
|
|
||||||
Snprintf(datestr, sizeof datestr, "%04ld%02d%02d%02d%02d%02d",
|
|
||||||
datenum, lt->tm_mon + 1,
|
|
||||||
lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec);
|
|
||||||
return datestr;
|
|
||||||
}
|
|
||||||
|
|
||||||
DISABLE_WARNING_FORMAT_NONLITERAL
|
|
||||||
|
|
||||||
void
|
|
||||||
raw_printf(const char *line, ...)
|
|
||||||
{
|
|
||||||
va_list the_args;
|
|
||||||
|
|
||||||
va_start(the_args, line);
|
|
||||||
fprintf(stdout, line, the_args);
|
|
||||||
va_end(the_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
/* normalize file name - we don't like .'s, /'s, spaces */
|
/* normalize file name - we don't like .'s, /'s, spaces */
|
||||||
void
|
void
|
||||||
@@ -898,7 +772,7 @@ regularize(char *s)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* UNIX */
|
||||||
|
|
||||||
int
|
int
|
||||||
util_strncmpi(const char *s1, const char *s2, size_t sz)
|
util_strncmpi(const char *s1, const char *s2, size_t sz)
|
||||||
|
|||||||
+137
-102
@@ -83,7 +83,7 @@ struct needs_array_handling {
|
|||||||
#define SFDATA_NAME "../util/sfdata.c"
|
#define SFDATA_NAME "../util/sfdata.c"
|
||||||
|
|
||||||
static char *fgetline(FILE*);
|
static char *fgetline(FILE*);
|
||||||
static void quit(void);
|
ATTRNORETURN static void quit(void) NORETURN;
|
||||||
static void out_of_memory(void);
|
static void out_of_memory(void);
|
||||||
static void doline(char *);
|
static void doline(char *);
|
||||||
static void chain(struct tagstruct *);
|
static void chain(struct tagstruct *);
|
||||||
@@ -154,6 +154,16 @@ static long lineno;
|
|||||||
static char ssdef[BUFSZ];
|
static char ssdef[BUFSZ];
|
||||||
static char fieldfixbuf[BUFSZ];
|
static char fieldfixbuf[BUFSZ];
|
||||||
static boolean suppress_count;
|
static boolean suppress_count;
|
||||||
|
static char folderprefix[BUFSZ];
|
||||||
|
static char filenmbuf[
|
||||||
|
#if defined(UNIX) && defined(PATHLEN)
|
||||||
|
PATHLEN
|
||||||
|
#elif defined(WIN32) && defined(_MAX_PATH)
|
||||||
|
_MAX_PATH
|
||||||
|
#else
|
||||||
|
BUFSZ * 4
|
||||||
|
#endif
|
||||||
|
];
|
||||||
|
|
||||||
#define NHTYPE_SIMPLE 1
|
#define NHTYPE_SIMPLE 1
|
||||||
#define NHTYPE_COMPLEX 2
|
#define NHTYPE_COMPLEX 2
|
||||||
@@ -268,8 +278,7 @@ struct nhdatatypes_t readtagstypes[] = {
|
|||||||
{ NHTYPE_COMPLEX, (char *) "version_info", sizeof(struct version_info) },
|
{ NHTYPE_COMPLEX, (char *) "version_info", sizeof(struct version_info) },
|
||||||
{ NHTYPE_COMPLEX, (char *) "vlaunchinfo", sizeof(union vlaunchinfo) },
|
{ NHTYPE_COMPLEX, (char *) "vlaunchinfo", sizeof(union vlaunchinfo) },
|
||||||
{ NHTYPE_COMPLEX, (char *) "vptrs", sizeof(union vptrs) },
|
{ NHTYPE_COMPLEX, (char *) "vptrs", sizeof(union vptrs) },
|
||||||
{ NHTYPE_COMPLEX, (char *) "you", sizeof(struct you) }
|
{ NHTYPE_COMPLEX, (char *) "you", sizeof(struct you) },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -311,13 +320,30 @@ DISABLE_WARNING_UNREACHABLE_CODE
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
tagcount = 0;
|
tagcount = 0;
|
||||||
|
#if defined(WIN32)
|
||||||
|
char fbuf[_MAX_PATH];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
folderprefix[0] = '\0';
|
||||||
if (argc > 1) infilenm = argv[1];
|
if (argc > 1) infilenm = argv[1];
|
||||||
if (!infilenm || !*infilenm) infilenm = DEFAULTTAGNAME;
|
if (!infilenm || !*infilenm) infilenm = DEFAULTTAGNAME;
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
if (!file_exists(infilenm)) {
|
||||||
|
/* (void) GetCurrentDirectoryA(sizeof cdir, (LPSTR) cdir); */
|
||||||
|
Strcpy(folderprefix, "../../../");
|
||||||
|
(void) snprintf(fbuf, sizeof fbuf, "%s%s", folderprefix, DEFAULTTAGNAME);
|
||||||
|
if (!file_exists(fbuf)) {
|
||||||
|
fprintf(stdout, "%s doesn't exist\n", fbuf);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
infilenm = (const char *) fbuf;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
infile = fopen(infilenm,"r");
|
infile = fopen(infilenm,"r");
|
||||||
if (!infile) {
|
if (!infile) {
|
||||||
printf("%s not found or unavailable\n",infilenm);
|
printf("%s not found or unavailable\n", infilenm);
|
||||||
quit();
|
quit();
|
||||||
} else {
|
} else {
|
||||||
while (fgets(line, sizeof line, infile)) {
|
while (fgets(line, sizeof line, infile)) {
|
||||||
@@ -341,6 +367,20 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
boolean
|
||||||
|
file_exists(const char *path)
|
||||||
|
{
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
/* Just see if it's there */
|
||||||
|
if (stat(path, &sb)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
RESTORE_WARNINGS
|
RESTORE_WARNINGS
|
||||||
|
|
||||||
static void doline(char *aline)
|
static void doline(char *aline)
|
||||||
@@ -373,23 +413,19 @@ static void doline(char *aline)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tagstruct * ALIGN32 prevtag = NULL;
|
struct tagstruct * ALIGN32 prevtag = 0;
|
||||||
|
|
||||||
static void chain(struct tagstruct *tag)
|
static void
|
||||||
|
chain(struct tagstruct *tag)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!first) {
|
if (!first) {
|
||||||
tag->next = (struct tagstruct *)0;
|
tag->next = (struct tagstruct *) 0;
|
||||||
first = tag;
|
first = tag;
|
||||||
} else {
|
} else {
|
||||||
tag->next = (struct tagstruct *)0;
|
tag->next = (struct tagstruct *) 0;
|
||||||
if (prevtag) {
|
|
||||||
if (prevtag->marker == 0xDEADBEEF) {
|
if (prevtag->marker == 0xDEADBEEF) {
|
||||||
prevtag->next = tag;
|
prevtag->next = tag;
|
||||||
} else {
|
|
||||||
printf("Possible corruption.");
|
|
||||||
quit();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
printf("Error - No previous tag at %s\n", tag->tag);
|
printf("Error - No previous tag at %s\n", tag->tag);
|
||||||
}
|
}
|
||||||
@@ -491,6 +527,10 @@ void set_member_array_size(struct tagstruct *tmptag)
|
|||||||
static void parseExtensionFields (struct tagstruct *tmptag, char *buf)
|
static void parseExtensionFields (struct tagstruct *tmptag, char *buf)
|
||||||
{
|
{
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
|
#ifdef WIN32
|
||||||
|
int debug_catch = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (p != (char *)0 && *p != '\0') {
|
while (p != (char *)0 && *p != '\0') {
|
||||||
while (*p == TAB)
|
while (*p == TAB)
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
@@ -510,6 +550,10 @@ static void parseExtensionFields (struct tagstruct *tmptag, char *buf)
|
|||||||
*colon = '\0';
|
*colon = '\0';
|
||||||
if ((strcmp (key, "struct") == 0) ||
|
if ((strcmp (key, "struct") == 0) ||
|
||||||
(strcmp (key, "union") == 0)) {
|
(strcmp (key, "union") == 0)) {
|
||||||
|
#ifdef WIN32
|
||||||
|
if (!strcmp(key, "union"))
|
||||||
|
debug_catch = 1;
|
||||||
|
#endif
|
||||||
colon = strstr(value,"::");
|
colon = strstr(value,"::");
|
||||||
if (colon)
|
if (colon)
|
||||||
value = colon +2;
|
value = colon +2;
|
||||||
@@ -609,15 +653,6 @@ taglineparse(char *p, struct tagstruct *tmptag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eos() is copied from hacklib.c */
|
|
||||||
/* return the end of a string (pointing at '\0') */
|
|
||||||
char *
|
|
||||||
eos(char *s)
|
|
||||||
{
|
|
||||||
while (*s) s++; /* s += strlen(s); */
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char stripbuf[255];
|
static char stripbuf[255];
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -990,28 +1025,45 @@ static void generate_c_files(void)
|
|||||||
boolean did_i;
|
boolean did_i;
|
||||||
boolean normalize_param_used;
|
boolean normalize_param_used;
|
||||||
|
|
||||||
SFDATA = fopen(SFDATA_NAME, "w");
|
#ifdef WIN32
|
||||||
|
int debug_catch = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,SFDATA_NAME);
|
||||||
|
SFDATA = fopen(filenmbuf, "w");
|
||||||
if (!SFDATA) return;
|
if (!SFDATA) return;
|
||||||
|
|
||||||
SFPROTO = fopen(SFPROTO_NAME, "w");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix, SFPROTO_NAME);
|
||||||
|
SFPROTO = fopen(filenmbuf, "w");
|
||||||
if (!SFPROTO) return;
|
if (!SFPROTO) return;
|
||||||
|
|
||||||
SFO_DATA = fopen("../util/sfo_data.tmp", "w");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfo_data.tmp");
|
||||||
|
SFO_DATA = fopen(filenmbuf, "w");
|
||||||
if (!SFO_DATA) return;
|
if (!SFO_DATA) return;
|
||||||
|
|
||||||
SFO_PROTO = fopen("../include/sfo_proto.tmp", "w");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix, "../include/sfo_proto.tmp");
|
||||||
|
SFO_PROTO = fopen(filenmbuf, "w");
|
||||||
if (!SFO_PROTO) return;
|
if (!SFO_PROTO) return;
|
||||||
|
|
||||||
SFI_PROTO = fopen("../include/sfi_proto.tmp", "w");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../include/sfi_proto.tmp");
|
||||||
|
SFI_PROTO = fopen(filenmbuf, "w");
|
||||||
if (!SFI_PROTO) return;
|
if (!SFI_PROTO) return;
|
||||||
|
|
||||||
SFI_DATA = fopen("../util/sfi_data.tmp", "w");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfi_data.tmp");
|
||||||
|
SFI_DATA = fopen(filenmbuf, "w");
|
||||||
if (!SFI_DATA) return;
|
if (!SFI_DATA) return;
|
||||||
|
|
||||||
SFDATATMP = fopen("../util/sfdata.tmp", "w");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfdata.tmp");
|
||||||
|
SFDATATMP = fopen(filenmbuf, "w");
|
||||||
if (!SFDATATMP) return;
|
if (!SFDATATMP) return;
|
||||||
|
|
||||||
SF_NORMALIZE_POINTERS = fopen("../util/sfnormptrs.tmp", "w");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfnormptrs.tmp");
|
||||||
|
SF_NORMALIZE_POINTERS = fopen(filenmbuf, "w");
|
||||||
if (!SF_NORMALIZE_POINTERS) return;
|
if (!SF_NORMALIZE_POINTERS) return;
|
||||||
|
|
||||||
(void) time(&clocktim);
|
(void) time(&clocktim);
|
||||||
@@ -1071,6 +1123,7 @@ static void generate_c_files(void)
|
|||||||
|
|
||||||
if (readtagstypes[k].dtclass == NHTYPE_COMPLEX) {
|
if (readtagstypes[k].dtclass == NHTYPE_COMPLEX) {
|
||||||
|
|
||||||
|
|
||||||
if (!strncmpi(readtagstypes[k].dtype,"Bitfield",8)) {
|
if (!strncmpi(readtagstypes[k].dtype,"Bitfield",8)) {
|
||||||
Fprintf(SFO_DATA,
|
Fprintf(SFO_DATA,
|
||||||
"\nvoid\nsfo_bitfield(nhfp,\n"
|
"\nvoid\nsfo_bitfield(nhfp,\n"
|
||||||
@@ -1094,17 +1147,22 @@ static void generate_c_files(void)
|
|||||||
if (!strncmpi(readtagstypes[k].dtype,"version_info",8))
|
if (!strncmpi(readtagstypes[k].dtype,"version_info",8))
|
||||||
insert_const = TRUE;
|
insert_const = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WIN32
|
||||||
|
if (!strncmpi(readtagstypes[k].dtype, "vlaunchinfo", 11)
|
||||||
|
|| !strncmpi(readtagstypes[k].dtype, "vptrs", 5)
|
||||||
|
|| k == SIZE(readtagstypes) - 2)
|
||||||
|
debug_catch = TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
pt = (const char *) 0;
|
pt = (const char *) 0;
|
||||||
t = first;
|
t = first;
|
||||||
while(t) {
|
while(t) {
|
||||||
if (t->tagtype == 'u' && !strcmp(t->tag, readtagstypes[k].dtype)) {
|
if (!strcmp(t->tag, readtagstypes[k].dtype)) {
|
||||||
pt = "union";
|
pt = (t->tagtype == 'u') ? "union" : "struct";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t = t->next;
|
t = t->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pt) {
|
if (!pt) {
|
||||||
pt = "struct";
|
pt = "struct";
|
||||||
}
|
}
|
||||||
@@ -1208,6 +1266,7 @@ static void generate_c_files(void)
|
|||||||
&& !strcmp(readtagstypes[k].dtype, "engrave_info"))
|
&& !strcmp(readtagstypes[k].dtype, "engrave_info"))
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (t->tagtype == 's') {
|
if (t->tagtype == 's') {
|
||||||
char *ss = strstr(t->searchtext,"{$/");
|
char *ss = strstr(t->searchtext,"{$/");
|
||||||
|
|
||||||
@@ -1553,52 +1612,64 @@ static void generate_c_files(void)
|
|||||||
|
|
||||||
/* Consolidate SFO_* and SFI_* etc into single files */
|
/* Consolidate SFO_* and SFI_* etc into single files */
|
||||||
|
|
||||||
SFO_DATA = fopen("../util/sfo_data.tmp", "r");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfo_data.tmp");
|
||||||
|
SFO_DATA = fopen(filenmbuf, "r");
|
||||||
if (!SFO_DATA) return;
|
if (!SFO_DATA) return;
|
||||||
while ((gline = fgetline(SFO_DATA)) != 0) {
|
while ((gline = fgetline(SFO_DATA)) != 0) {
|
||||||
(void) fputs(gline, SFDATA);
|
(void) fputs(gline, SFDATA);
|
||||||
free(gline);
|
free(gline);
|
||||||
}
|
}
|
||||||
(void) fclose(SFO_DATA);
|
(void) fclose(SFO_DATA);
|
||||||
(void) remove("../util/sfo_data.tmp");
|
(void) remove(filenmbuf);
|
||||||
|
|
||||||
SFI_DATA = fopen("../util/sfi_data.tmp", "r");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfi_data.tmp");
|
||||||
|
SFI_DATA = fopen(filenmbuf, "r");
|
||||||
if (!SFI_DATA) return;
|
if (!SFI_DATA) return;
|
||||||
while ((gline = fgetline(SFI_DATA)) != 0) {
|
while ((gline = fgetline(SFI_DATA)) != 0) {
|
||||||
(void) fputs(gline, SFDATA);
|
(void) fputs(gline, SFDATA);
|
||||||
free(gline);
|
free(gline);
|
||||||
}
|
}
|
||||||
(void) fclose(SFI_DATA);
|
(void) fclose(SFI_DATA);
|
||||||
(void) remove("../util/sfi_data.tmp");
|
(void) remove(filenmbuf);
|
||||||
|
|
||||||
SFO_PROTO = fopen("../include/sfo_proto.tmp", "r");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../include/sfo_proto.tmp");
|
||||||
|
SFO_PROTO = fopen(filenmbuf, "r");
|
||||||
if (!SFO_PROTO) return;
|
if (!SFO_PROTO) return;
|
||||||
while ((gline = fgetline(SFO_PROTO)) != 0) {
|
while ((gline = fgetline(SFO_PROTO)) != 0) {
|
||||||
(void) fputs(gline, SFPROTO);
|
(void) fputs(gline, SFPROTO);
|
||||||
free(gline);
|
free(gline);
|
||||||
}
|
}
|
||||||
(void) fclose(SFO_PROTO);
|
(void) fclose(SFO_PROTO);
|
||||||
(void) remove("../include/sfo_proto.tmp");
|
(void) remove(filenmbuf);
|
||||||
|
|
||||||
SFI_PROTO = fopen("../include/sfi_proto.tmp", "r");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../include/sfi_proto.tmp");
|
||||||
|
SFI_PROTO = fopen(filenmbuf, "r");
|
||||||
if (!SFI_PROTO) return;
|
if (!SFI_PROTO) return;
|
||||||
while ((gline = fgetline(SFI_PROTO)) != 0) {
|
while ((gline = fgetline(SFI_PROTO)) != 0) {
|
||||||
(void) fputs(gline, SFPROTO);
|
(void) fputs(gline, SFPROTO);
|
||||||
free(gline);
|
free(gline);
|
||||||
}
|
}
|
||||||
(void) fclose(SFI_PROTO);
|
(void) fclose(SFI_PROTO);
|
||||||
(void) remove("../include/sfi_proto.tmp");
|
(void) remove(filenmbuf);
|
||||||
|
|
||||||
SFDATATMP = fopen("../util/sfdata.tmp", "r");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfdata.tmp");
|
||||||
|
SFDATATMP = fopen(filenmbuf, "r");
|
||||||
if (!SFDATATMP) return;
|
if (!SFDATATMP) return;
|
||||||
while ((gline = fgetline(SFDATATMP)) != 0) {
|
while ((gline = fgetline(SFDATATMP)) != 0) {
|
||||||
(void) fputs(gline, SFDATA);
|
(void) fputs(gline, SFDATA);
|
||||||
free(gline);
|
free(gline);
|
||||||
}
|
}
|
||||||
(void) fclose(SFDATATMP);
|
(void) fclose(SFDATATMP);
|
||||||
(void) remove("../util/sfdata.tmp");
|
(void) remove(filenmbuf);
|
||||||
|
|
||||||
SF_NORMALIZE_POINTERS = fopen("../util/sfnormptrs.tmp", "r");
|
Snprintf(filenmbuf, sizeof filenmbuf, "%s%s", folderprefix,
|
||||||
|
"../util/sfnormptrs.tmp");
|
||||||
|
SF_NORMALIZE_POINTERS = fopen(filenmbuf, "r");
|
||||||
if (!SF_NORMALIZE_POINTERS)
|
if (!SF_NORMALIZE_POINTERS)
|
||||||
return;
|
return;
|
||||||
while ((gline = fgetline(SF_NORMALIZE_POINTERS)) != 0) {
|
while ((gline = fgetline(SF_NORMALIZE_POINTERS)) != 0) {
|
||||||
@@ -1606,7 +1677,7 @@ static void generate_c_files(void)
|
|||||||
free(gline);
|
free(gline);
|
||||||
}
|
}
|
||||||
(void) fclose(SF_NORMALIZE_POINTERS);
|
(void) fclose(SF_NORMALIZE_POINTERS);
|
||||||
(void) remove("../util/sfnormptrs.tmp");
|
(void) remove(filenmbuf);
|
||||||
|
|
||||||
Fprintf(SFDATA, "/*sfdata.c*/\n");
|
Fprintf(SFDATA, "/*sfdata.c*/\n");
|
||||||
Fprintf(SFPROTO,"#endif /* SFPROTO_H */\n");
|
Fprintf(SFPROTO,"#endif /* SFPROTO_H */\n");
|
||||||
@@ -1687,6 +1758,7 @@ dtfn(const char *str,
|
|||||||
if (!str)
|
if (!str)
|
||||||
return (char *)0;
|
return (char *)0;
|
||||||
(void)strncpy(buf, str, 127);
|
(void)strncpy(buf, str, 127);
|
||||||
|
buf[sizeof buf - 1] = '\0';
|
||||||
|
|
||||||
c = buf;
|
c = buf;
|
||||||
while (*c) c++; /* eos */
|
while (*c) c++; /* eos */
|
||||||
@@ -1812,10 +1884,18 @@ fgetline(FILE *fd)
|
|||||||
{
|
{
|
||||||
static const int inc = 256;
|
static const int inc = 256;
|
||||||
int len = inc;
|
int len = inc;
|
||||||
char *c = malloc(len), *ret;
|
char *c = malloc(len), *ret, *loc, *avoidleak;
|
||||||
|
|
||||||
|
if (!c) {
|
||||||
|
fprintf(stderr, "Memory issue\n");
|
||||||
|
quit();
|
||||||
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ret = fgets(c + len - inc, inc, fd);
|
loc = c + len - inc;
|
||||||
|
if (!loc) {
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
ret = fgets(loc, inc, fd);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
free(c);
|
free(c);
|
||||||
c = NULL;
|
c = NULL;
|
||||||
@@ -1825,13 +1905,19 @@ fgetline(FILE *fd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len += inc;
|
len += inc;
|
||||||
|
avoidleak = c;
|
||||||
c = realloc(c, len);
|
c = realloc(c, len);
|
||||||
|
if (!c) {
|
||||||
|
free(avoidleak);
|
||||||
|
quit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
int
|
int
|
||||||
strncmpi(register const char *s1, register const char *s2, size_t n)
|
strncmpi(const char *s1, const char *s2, size_t n)
|
||||||
{
|
{
|
||||||
register char t1, t2;
|
register char t1, t2;
|
||||||
|
|
||||||
@@ -1847,59 +1933,8 @@ strncmpi(register const char *s1, register const char *s2, size_t n)
|
|||||||
}
|
}
|
||||||
return 0; /* s1 == s2 */
|
return 0; /* s1 == s2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force 'c' into uppercase */
|
|
||||||
char
|
|
||||||
highc(char c)
|
|
||||||
{
|
|
||||||
return (char) (('a' <= c && c <= 'z') ? (c & ~040) : c);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* force 'c' into lowercase */
|
|
||||||
char
|
|
||||||
lowc(char c)
|
|
||||||
{
|
|
||||||
return (char) (('A' <= c && c <= 'Z') ? (c | 040) : c);
|
|
||||||
}
|
|
||||||
|
|
||||||
DISABLE_WARNING_FORMAT_NONLITERAL
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wrap snprintf for use in the main code.
|
|
||||||
*
|
|
||||||
* Wrap reasons:
|
|
||||||
* 1. If there are any platform issues, we have one spot to fix them -
|
|
||||||
* snprintf is a routine with a troubling history of bad implementations.
|
|
||||||
* 2. Add combersome error checking in one spot. Problems with text wrangling
|
|
||||||
* do not have to be fatal.
|
|
||||||
* 3. Gcc 9+ will issue a warning unless the return value is used.
|
|
||||||
* Annoyingly, explicitly casting to void does not remove the error.
|
|
||||||
* So, use the result - see reason #2.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
nh_snprintf(const char *func, int myline, char *str, size_t size,
|
|
||||||
const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
#ifdef NO_VSNPRINTF
|
|
||||||
n = vsprintf(str, fmt, ap);
|
|
||||||
#else
|
|
||||||
n = vsnprintf(str, size, fmt, ap);
|
|
||||||
#endif
|
#endif
|
||||||
va_end(ap);
|
|
||||||
if (n < 0 || (size_t)n >= size) { /* is there a problem? */
|
|
||||||
fprintf(stderr, "snprintf %s: func %s, file line %d",
|
|
||||||
n < 0 ? "format error"
|
|
||||||
: "overflow",
|
|
||||||
func, myline);
|
|
||||||
str[size-1] = 0; /* make sure it is nul terminated */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
|
||||||
|
|
||||||
struct already_in_sfbase {
|
struct already_in_sfbase {
|
||||||
int typ;
|
int typ;
|
||||||
|
|||||||
Reference in New Issue
Block a user