+++ /dev/null
-import os, sys, commands, string
-from makeversion import get_version
-# OS Detection:
-OS = commands.getoutput('uname')
-
-Import('GLOBALS')
-Import(GLOBALS)
-
-# make scons link shared libs against static libs
-g_env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
-
-# make gcc accept default parameters in function typedefs
-g_env['CXXFLAGS'] += '-fpermissive '
-
-g_env['CXXFLAGS'] += '-fPIC '
-g_env['CCFLAGS'] += '-fPIC '
-
-def build_list(s_prefix, s_string):
- s_list = Split(s_string)
- for i in range(len(s_list)):
- s_list[i] = s_prefix + '/' + s_list[i]
- return s_list
-
-# common code ------------------------------------------------------
-
-cmdlib_lib = g_env.StaticLibrary(target='libs/cmdlib', source='libs/cmdlib/cmdlib.cpp')
-
-
-mathlib_src = 'mathlib.c bbox.c linear.c m4x4.c ray.c'
-mathlib_lib = g_env.StaticLibrary(target='libs/mathlib', source=build_list('libs/mathlib', mathlib_src))
-
-
-md5lib_lib = g_env.StaticLibrary(target='libs/md5lib', source='libs/md5lib/md5lib.c')
-
-
-ddslib_lib = g_env.StaticLibrary(target='libs/ddslib', source='libs/ddslib/ddslib.c')
-
-
-jpeg_env = g_env.Copy()
-jpeg_env.Prepend(CPPPATH = 'libs/jpeg6')
-jpeg_src = 'jcomapi.cpp jdcoefct.cpp jdinput.cpp jdpostct.cpp jfdctflt.cpp jpgload.cpp jdapimin.cpp jdcolor.cpp jdmainct.cpp jdsample.cpp jidctflt.cpp jutils.cpp jdapistd.cpp jddctmgr.cpp jdmarker.cpp jdtrans.cpp jmemmgr.cpp jdatasrc.cpp jdhuff.cpp jdmaster.cpp jerror.cpp jmemnobs.cpp'
-jpeg_lib = jpeg_env.StaticLibrary(target='libs/jpeg', source=build_list('libs/jpeg6', jpeg_src))
-
-
-net_lib = g_env.StaticLibrary(target='libs/l_net', source=['libs/l_net/l_net.c', 'libs/l_net/l_net_berkley.c'])
-
-
-picomodel_src = 'picointernal.c picomodel.c picomodules.c pm_3ds.c pm_ase.c pm_md3.c pm_obj.c\
- pm_ms3d.c pm_mdc.c pm_fm.c pm_md2.c pm_lwo.c lwo/clip.c lwo/envelope.c lwo/list.c lwo/lwio.c\
- lwo/lwo2.c lwo/lwob.c lwo/pntspols.c lwo/surface.c lwo/vecmath.c lwo/vmap.c'
-picomodel_lib = g_env.StaticLibrary(target='libs/picomodel', source=build_list('libs/picomodel', picomodel_src))
-
-
-synapse_env = g_env.Copy()
-synapse_env.useGlib2()
-synapse_env.useXML2()
-synapse_env['CPPPATH'].append('include')
-synapse_src = 'synapse.cpp'
-synapse_lib = synapse_env.StaticLibrary(target='libs/synapse', source=build_list('libs/synapse', synapse_src))
-# scons 0.95. Doesn't recognize archive compatible for dynamic modules
-# see thread: http://scons.tigris.org/servlets/BrowseList?listName=users&by=thread&from=168952&to=168952&first=1&count=2
-
-
-splines_env = g_env.Copy()
-splines_src = build_list('libs/splines',
-'math_angles.cpp math_matrix.cpp math_quaternion.cpp math_vector.cpp q_parse.cpp q_shared.cpp splines.cpp util_str.cpp')
-splines_env['CPPPATH'].append('include')
-splines_lib = splines_env.StaticLibrary(target='libs/splines', source=splines_src)
-
-
-# end static / common libraries ---------------------------------------------------
-
-# q3map ---------------------------------------------------------------------------
-
-q3map_env = g_env.Copy()
-q3map_env['CPPPATH'].append('include')
-q3map_env.useXML2()
-q3map_env.useGlib2()
-q3map_env.usePNG()
-q3map_env.usePThread()
-q3map_env.Prepend(CPPPATH='tools/quake3/common')
-
-q3map_common_src = [
- 'common/cmdlib.c',
- 'common/imagelib.c',
- 'common/inout.c',
- 'common/mutex.c',
- 'common/polylib.c',
- 'common/scriplib.c',
- 'common/threads.c',
- 'common/unzip.c',
- 'common/vfs.c' ]
-
-q3map_src = [
- 'q3map2/brush.c',
- 'q3map2/brush_primit.c',
- 'q3map2/bsp.c',
- 'q3map2/facebsp.c',
- 'q3map2/fog.c',
- 'q3map2/leakfile.c',
- 'q3map2/map.c',
- 'q3map2/model.c',
- 'q3map2/patch.c',
- 'q3map2/portals.c',
- 'q3map2/prtfile.c',
- 'q3map2/surface.c',
- 'q3map2/surface_fur.c',
- 'q3map2/surface_meta.c',
- 'q3map2/tjunction.c',
- 'q3map2/tree.c',
- 'q3map2/writebsp.c',
- 'q3map2/image.c',
- 'q3map2/light.c',
- 'q3map2/light_bounce.c',
- 'q3map2/light_trace.c',
- 'q3map2/light_ydnar.c',
- 'q3map2/lightmaps_ydnar.c',
- 'q3map2/vis.c',
- 'q3map2/visflow.c',
- 'q3map2/bspfile_abstract.c',
- 'q3map2/bspfile_ibsp.c',
- 'q3map2/bspfile_rbsp.c',
- 'q3map2/decals.c',
- 'q3map2/main.c',
- 'q3map2/mesh.c',
- 'q3map2/path_init.c',
- 'q3map2/shaders.c',
- 'q3map2/surface_extra.c',
- 'q3map2/surface_foliage.c',
- 'q3map2/convert_ase.c',
- 'q3map2/convert_map.c' ]
-
-q3map_full_src = [ ]
-for i in q3map_common_src + q3map_src:
- q3map_full_src.append('tools/quake3/' + i)
-
-q3map_full_src.append('libs/libmathlib.a')
-q3map_full_src.append('libs/libl_net.a')
-q3map_full_src.append('libs/libjpeg.a')
-q3map_full_src.append('libs/libpicomodel.a')
-q3map_full_src.append('libs/libmd5lib.a')
-q3map_full_src.append('libs/libddslib.a')
-
-q3map_env.Program(target='q3map2.' + g_cpu, source=q3map_full_src )
-q3map_env.Install(INSTALL, 'q3map2.' + g_cpu)
-
-# end q3map2 ----------------------------------------------------------------------
-
-# q3data ---------------------------------------------------------------------------
-
-q3data_env = q3map_env.Copy()
-
-q3data_common_src = [
- 'common/aselib.c',
- 'common/bspfile.c',
- 'common/cmdlib.c',
- 'common/imagelib.c',
- 'common/inout.c',
- 'common/scriplib.c',
- 'common/trilib.c',
- 'common/unzip.c',
- 'common/vfs.c'
- ]
-
-q3data_src = [
- 'q3data/3dslib.c',
- 'q3data/compress.c',
- 'q3data/images.c',
- 'q3data/md3lib.c',
- 'q3data/models.c',
- 'q3data/p3dlib.c',
- 'q3data/polyset.c',
- 'q3data/q3data.c',
- 'q3data/stripper.c',
- 'q3data/video.c' ]
-
-q3data_full_src = [ ]
-for i in q3data_common_src + q3data_src:
- q3data_full_src.append('tools/quake3/' + i)
-
-q3data_full_src.append('libs/libmathlib.a')
-q3data_full_src.append('libs/libl_net.a')
-
-q3data_env.Program( target = 'q3data.' + g_cpu, source = q3data_full_src )
-q3data_env.Install( INSTALL, 'q3data.' + g_cpu )
-
-# end q3data ----------------------------------------------------------------------
-
-# q2_tools ---------------------------------------------------------------------------
-
-q2_tools_env = g_env.Copy()
-q2_tools_env['CPPPATH'].append('include')
-q2_tools_env.useXML2()
-q2_tools_env.usePThread()
-q2_tools_env.Prepend(CPPPATH='tools/quake2/common')
-
-q2_tools_common_src = [
- 'common/bspfile.c',
- 'common/cmdlib.c',
- 'common/inout.c',
- 'common/l3dslib.c',
- 'common/lbmlib.c',
- 'common/mathlib.c',
- 'common/path_init.c',
- 'common/polylib.c',
- 'common/scriplib.c',
- 'common/threads.c',
- 'common/trilib.c'
-]
-
-
-q2_tools_q2map_src = [
- 'q2map/brushbsp.c',
- 'q2map/csg.c',
- 'q2map/faces.c',
- 'q2map/flow.c',
- 'q2map/glfile.c',
- 'q2map/leakfile.c',
- 'q2map/lightmap.c',
- 'q2map/main.c',
- 'q2map/map.c',
- 'q2map/nodraw.c',
- 'q2map/patches.c',
- 'q2map/portals.c',
- 'q2map/prtfile.c',
- 'q2map/qbsp.c',
- 'q2map/qrad.c',
- 'q2map/qvis.c',
- 'q2map/textures.c',
- 'q2map/trace.c',
- 'q2map/tree.c',
- 'q2map/writebsp.c'
-]
-
-q2_tools_qdata3_common_src = [
- 'common/bspfile.c',
- 'common/cmdlib.c',
- 'common/inout.c',
- 'common/l3dslib.c',
- 'common/lbmlib.c',
- 'common/mathlib.c',
- 'common/path_init.c',
- 'common/scriplib.c',
- 'common/threads.c',
- 'common/trilib.c'
-]
-
-q2_tools_qdata3_src = [
- 'qdata/images.c',
- 'qdata/models.c',
- 'qdata/qdata.c',
- 'qdata/sprites.c',
- 'qdata/tables.c',
- 'qdata/video.c'
-]
-
-q2_tools_q2map_full_src = [ ]
-for i in q2_tools_common_src + q2_tools_q2map_src:
- q2_tools_q2map_full_src.append('tools/quake2/' + i)
-
-q2_tools_q2map_full_src.append('libs/libl_net.a')
-
-q2_tools_qdata3_full_src = [ ]
-for i in q2_tools_common_src + q2_tools_qdata3_src:
- q2_tools_qdata3_full_src.append('tools/quake2/' + i)
-
-q2_tools_qdata3_full_src.append('libs/libl_net.a')
-
-if ( OS != 'Darwin' ):
- q2_tools_env.Program(target='quake2_tools/q2map', source=q2_tools_q2map_full_src )
- q2_tools_env.Install(INSTALL + '/q2', 'quake2_tools/q2map' )
-
- q2_tools_env.Program(target='quake2_tools/qdata3', source=q2_tools_qdata3_full_src )
- q2_tools_env.Install(INSTALL + '/q2', 'quake2_tools/qdata3' )
-
-
-# end q2_tools ----------------------------------------------------------------------
-
-# qdata3_heretic2 ---------------------------------------------------------------------------
-
-heretic2_tools_env = g_env.Copy()
-heretic2_tools_env['CPPPATH'].append('include')
-heretic2_tools_env.useXML2()
-heretic2_tools_env.usePThread()
-heretic2_tools_env.Prepend(CPPPATH='tools/quake2/qdata_heretic2')
-heretic2_tools_env.Prepend(CPPPATH='tools/quake2/qdata_heretic2/qcommon')
-heretic2_tools_env.Prepend(CPPPATH='tools/quake2/qdata_heretic2/common')
-
-heretic2_tools_qdata3_common_src = [
- 'qdata_heretic2/common/bspfile.c',
- 'qdata_heretic2/common/cmdlib.c',
- 'qdata_heretic2/common/inout.c',
- 'qdata_heretic2/common/l3dslib.c',
- 'qdata_heretic2/common/lbmlib.c',
- 'qdata_heretic2/common/mathlib.c',
- 'qdata_heretic2/common/path_init.c',
- 'qdata_heretic2/common/qfiles.c',
- 'qdata_heretic2/common/scriplib.c',
- 'qdata_heretic2/common/threads.c',
- 'qdata_heretic2/common/token.c',
- 'qdata_heretic2/common/trilib.c'
-]
-
-heretic2_tools_qdata3_qcommon_src = [
- 'qdata_heretic2/qcommon/reference.c',
- 'qdata_heretic2/qcommon/resourcemanager.c',
- 'qdata_heretic2/qcommon/skeletons.c'
-]
-
-heretic2_tools_qdata3_src = [
- 'qdata_heretic2/animcomp.c',
- 'qdata_heretic2/book.c',
- 'qdata_heretic2/fmodels.c',
- 'qdata_heretic2/images.c',
- 'qdata_heretic2/jointed.c',
- 'qdata_heretic2/models.c',
- 'qdata_heretic2/pics.c',
- 'qdata_heretic2/qdata.c',
- 'qdata_heretic2/qd_skeletons.c',
- 'qdata_heretic2/sprites.c',
- 'qdata_heretic2/svdcmp.c',
- 'qdata_heretic2/tables.c',
- 'qdata_heretic2/tmix.c',
- 'qdata_heretic2/video.c'
-]
-
-heretic2_tools_qdata3_full_src = [ ]
-for i in heretic2_tools_qdata3_common_src + heretic2_tools_qdata3_qcommon_src + heretic2_tools_qdata3_src:
- heretic2_tools_qdata3_full_src.append('tools/quake2/' + i)
-
-heretic2_tools_qdata3_full_src.append('libs/libl_net.a')
-
-heretic2_tools_env['CCFLAGS'] += '-D_LINUX '
-
-if ( OS != 'Darwin' ):
- heretic2_tools_env.Program(target='heretic2_tools/qdata3', source=heretic2_tools_qdata3_full_src )
- heretic2_tools_env.Install(INSTALL + '/heretic2', 'heretic2_tools/qdata3' )
-
- heretic2_q2map_env = q2_tools_env
- heretic2_q2map_env.Install(INSTALL + '/heretic2', 'quake2_tools/q2map' )
-
-# end heretic2_tools ----------------------------------------------------------------------
-
-
-
-# radiant, modules and plugins ----------------------------------------------------
-
-module_env = g_env.Copy()
-module_env['CPPPATH'].append('include')
-if ( OS == 'Darwin' ):
- module_env['LINKFLAGS'] += '-dynamiclib -ldl '
-else:
- module_env['LINKFLAGS'] += '-ldl '
-module_env['LIBPREFIX'] = ''
-module_env.useGlib2()
-module_env.useXML2()
-
-module_env.SharedLibrarySafe(target='fgd', source=['plugins/eclassfgd/plugin.cpp', 'libs/libsynapse.a'])
-module_env.Install(INSTALL + '/modules', 'fgd.so')
-
-vfspk3_lst=build_list('plugins/vfspk3', 'vfspk3.cpp vfs.cpp unzip.cpp')
-vfspk3_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='vfspk3', source=vfspk3_lst)
-module_env.Install(INSTALL + '/modules', 'vfspk3.so')
-
-vfswad_lst=build_list('plugins/vfswad', 'unwad.cpp vfs.cpp vfswad.cpp')
-vfswad_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='vfswad', source=vfswad_lst)
-module_env.Install(INSTALL + '/modules', 'vfswad.so')
-
-vfspak_lst=build_list('plugins/vfspak', 'vfspak.cpp vfs.cpp')
-vfspak_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='vfspak', source=vfspak_lst)
-module_env.Install(INSTALL + '/q2/modules', 'vfspak.so')
-module_env.Install(INSTALL + '/heretic2/modules', 'vfspak.so')
-
-shaders_lst=build_list('plugins/shaders', 'shaders.cpp plugin.cpp')
-shaders_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='shaders', source=shaders_lst)
-module_env.Install(INSTALL + '/modules', 'shaders.so')
-
-image_lst=build_list('plugins/image', 'jpeg.cpp image.cpp lbmlib.cpp')
-image_lst.append('libs/libsynapse.a')
-image_lst.append('libs/libjpeg.a')
-module_env.SharedLibrarySafe(target='image', source=image_lst)
-module_env.Install(INSTALL + '/modules', 'image.so')
-
-imagewal_lst=build_list('plugins/imagewal', 'wal.cpp imagewal.cpp')
-imagewal_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='imagewal', source=imagewal_lst)
-module_env.Install(INSTALL + '/q2/modules', 'imagewal.so')
-
-imagem8_lst=build_list('plugins/imagem8', 'm8.cpp m32.cpp imagem8.cpp')
-imagem8_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='imagem8', source=imagem8_lst)
-module_env.Install(INSTALL + '/heretic2/modules', 'imagem8.so')
-
-imagehl_lst=build_list('plugins/imagehl', 'imagehl.cpp lbmlib.cpp')
-imagehl_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='imagehl', source=imagehl_lst)
-module_env.Install(INSTALL + '/modules', 'imagehl.so')
-
-imagepng_lst=build_list('plugins/imagepng', 'plugin.cpp')
-imagepng_lst.append('libs/libsynapse.a')
-module_env.usePNG()
-module_env.SharedLibrarySafe(target='imagepng', source=imagepng_lst)
-module_env.Install(INSTALL + '/modules', 'imagepng.so')
-
-map_lst=build_list('plugins/map', 'plugin.cpp parse.cpp write.cpp')
-map_lst.append('libs/libsynapse.a')
-map_lst.append('libs/libcmdlib.a')
-module_env.SharedLibrarySafe(target='map', source=map_lst)
-module_env.Install(INSTALL + '/modules', 'map.so')
-
-mapxml_lst=build_list('plugins/mapxml', 'plugin.cpp xmlparse.cpp xmlwrite.cpp')
-mapxml_lst.append('libs/libsynapse.a')
-module_env.SharedLibrarySafe(target='mapxml', source=mapxml_lst)
-module_env.Install(INSTALL + '/modules', 'mapxml.so')
-
-model_lst=build_list('plugins/model', 'plugin.cpp model.cpp cpicomodel.cpp cpicosurface.cpp remap.cpp')
-model_lst.append('libs/libsynapse.a')
-model_lst.append('libs/libpicomodel.a')
-model_lst.append('libs/libmathlib.a')
-module_env.SharedLibrarySafe(target='model', source=model_lst)
-module_env.Install(INSTALL + '/modules', 'model.so')
-
-entity_lst = build_list('plugins/entity', 'plugin.cpp entity_entitymodel.cpp miscmodel.cpp eclassmodel.cpp entity.cpp light.cpp')
-entity_lst.append('libs/libsynapse.a')
-entity_lst.append('libs/libmathlib.a')
-module_env.SharedLibrarySafe(target='entity', source=entity_lst)
-module_env.Install(INSTALL + '/modules', 'entity.so')
-
-bob_env = module_env.Copy()
-bob_env.useGtk2()
-bob_lst = build_list('contrib/bobtoolz/',
-'dialogs/dialogs-gtk.cpp bobToolz-GTK.cpp bsploader.cpp cportals.cpp DBobView.cpp \
-DBrush.cpp DEntity.cpp DEPair.cpp DListener.cpp DMap.cpp DPatch.cpp DPlane.cpp DPoint.cpp \
-DShape.cpp DTrainDrawer.cpp DTreePlanter.cpp DVisDrawer.cpp DWinding.cpp funchandlers-GTK.cpp \
-lists.cpp misc.cpp ScriptParser.cpp shapes.cpp visfind.cpp')
-bob_lst.append('libs/libsynapse.a')
-bob_lst.append('libs/libmathlib.a')
-bob_lst.append('libs/libcmdlib.a')
-bob_env['CPPPATH'].append('contrib/bobtoolz/dialogs')
-bob_env.SharedLibrarySafe(target='bobtoolz', source=bob_lst)
-bob_env.Install(INSTALL + '/plugins', 'bobtoolz.so')
-
-camera_lst = build_list('contrib/camera',
-'camera.cpp dialogs.cpp dialogs_common.cpp funchandlers.cpp listener.cpp misc.cpp renderer.cpp')
-camera_lst.append('libs/libsynapse.a')
-camera_lst.append('libs/libsplines.a')
-bob_env.SharedLibrarySafe(target='camera', source=camera_lst)
-bob_env.Install(INSTALL + '/plugins', 'camera.so')
-
-prtview_lst = build_list('contrib/prtview',
-'AboutDialog.cpp ConfigDialog.cpp LoadPortalFileDialog.cpp portals.cpp prtview.cpp')
-prtview_lst.append('libs/libsynapse.a')
-prtview_env = bob_env.Copy()
-prtview_env['CXXFLAGS'] += '-DGTK_PLUGIN '
-prtview_env.SharedLibrarySafe(target='prtview', source=prtview_lst)
-prtview_env.Install(INSTALL + '/plugins', 'prtview.so')
-
-gensurf_lst = build_list('contrib/gtkgensurf',
-'bitmap.cpp dec.cpp face.cpp font.cpp gendlgs.cpp genmap.cpp gensurf.cpp heretic.cpp plugin.cpp view.cpp triangle.c')
-gensurf_lst.append('libs/libsynapse.a')
-bob_env.SharedLibrarySafe(target='gensurf', source=gensurf_lst)
-bob_env.Install(INSTALL + '/plugins', 'gensurf.so')
-
-surface_lst = build_list('plugins/surface', 'surfdlg_plugin.cpp surfacedialog.cpp')
-surface_lst.append('libs/libsynapse.a')
-surface_lst.append('libs/libmathlib.a')
-surface_env = module_env.Copy()
-surface_env.useGtk2()
-surface_env.SharedLibrarySafe(target='surface', source=surface_lst)
-surface_env.Install(INSTALL + '/modules', 'surface.so')
-
-surface_quake2_lst = build_list('plugins/surface_quake2', 'surfdlg_plugin.cpp surfacedialog.cpp surfaceflagsdialog_quake2.cpp')
-surface_quake2_lst.append('libs/libsynapse.a')
-surface_quake2_lst.append('libs/libmathlib.a')
-surface_quake2_env = module_env.Copy()
-surface_quake2_env.useGtk2()
-surface_quake2_env.SharedLibrarySafe(target='surface_quake2', source=surface_quake2_lst)
-surface_quake2_env.Install(INSTALL + '/q2/modules', 'surface_quake2.so')
-
-surface_heretic2_lst = build_list('plugins/surface_heretic2', 'surfdlg_plugin.cpp surfacedialog.cpp surfaceflagsdialog_heretic2.cpp')
-surface_heretic2_lst.append('libs/libsynapse.a')
-surface_heretic2_lst.append('libs/libmathlib.a')
-surface_heretic2_env = module_env.Copy()
-surface_heretic2_env.useGtk2()
-surface_heretic2_env.SharedLibrarySafe(target='surface_heretic2', source=surface_heretic2_lst)
-surface_heretic2_env.Install(INSTALL + '/heretic2/modules', 'surface_heretic2.so')
-
-bkgrnd2d_list = build_list( 'contrib/bkgrnd2d', 'bkgrnd2d.cpp plugin.cpp dialog.cpp' )
-bkgrnd2d_list.append( 'libs/libsynapse.a' )
-bkgrnd2d_env = module_env.Copy()
-bkgrnd2d_env.useGtk2()
-bkgrnd2d_env.SharedLibrarySafe( target='bkgrnd2d', source=bkgrnd2d_list )
-bkgrnd2d_env.Install( INSTALL + '/plugins', 'bkgrnd2d.so' )
-
-radiant_env = g_env.Copy()
-radiant_env['CPPPATH'].append('include')
-radiant_env['LINKFLAGS'] += '-ldl '
-if ( OS == 'Darwin' ):
- radiant_env['CXXFLAGS'] += '-fno-common '
- radiant_env['CCFLAGS'] += '-fno-common '
- radiant_env['LINKFLAGS'] += '-lX11 -lGL -lGLU '
-radiant_env['LIBPREFIX'] = ''
-radiant_env.useGlib2()
-radiant_env.useXML2()
-radiant_env.useGtk2()
-radiant_env.useGtkGLExt()
-
-radiant_src=[ 'qgl.c', 'brush.cpp', 'brush_primit.cpp', 'brushscript.cpp', 'camwindow.cpp', 'csg.cpp',
- 'dialog.cpp', 'dialoginfo.cpp', 'drag.cpp', 'eclass.cpp', 'eclass_def.cpp', 'error.cpp', 'feedback.cpp',
- 'file.cpp', 'findtexturedialog.cpp', 'glinterface.cpp', 'glwidget.cpp', 'glwindow.cpp', 'groupdialog.cpp',
- 'gtkdlgs.cpp', 'gtkmisc.cpp', 'main.cpp', 'mainframe.cpp', 'map.cpp', 'missing.cpp', 'parse.cpp',
- 'patchdialog.cpp', 'pluginentities.cpp', 'pluginmanager.cpp', 'pmesh.cpp', 'points.cpp', 'preferences.cpp',
- 'profile.cpp', 'qe3.cpp', 'qgl_ext.cpp', 'select.cpp', 'selectedface.cpp', 'surfacedialog.cpp',
- 'surfaceplugin.cpp', 'targetname.cpp', 'texmanip.cpp', 'texwindow.cpp', 'undo.cpp', 'vertsel.cpp',
- 'watchbsp.cpp', 'winding.cpp', 'xywindow.cpp', 'z.cpp', 'zwindow.cpp', 'filters.cpp', 'bp_dlg.cpp', 'ui.cpp' ]
-
-for i in range(len(radiant_src)):
- radiant_src[i] = 'radiant/' + radiant_src[i]
-
-radiant_src.append('libs/libmathlib.a')
-radiant_src.append('libs/libcmdlib.a')
-radiant_src.append('libs/libl_net.a')
-radiant_src.append('libs/libsynapse.a')
-
-radiant_env.Program(target='radiant.' + g_cpu, source=radiant_src)
-radiant_env.Install(INSTALL, 'radiant.' + g_cpu)
-
-# setup -------------------------------------------------------------------------------------------
-
-class setup_builder:
-
- g_dryrun = 0
-
- def system(self, cmd):
- if (self.g_dryrun):
- print cmd
- else:
- sys.stdout.write(cmd)
- ret = commands.getstatusoutput(cmd)
- print ret[1]
- if (ret[0] != 0):
- raise 'command failed'
-
- def copy_core(self):
- # binaries and misc
- self.system('mkdir -p %s/modules' % self.SETUP_BIN_DIR)
- self.system('mkdir -p %s/plugins' % self.SETUP_BIN_DIR)
- self.system('cp install/%s %s' % (self.EDITOR_BIN, self.SETUP_BIN_DIR))
- self.system('cp install/modules/*.so %s/modules' % self.SETUP_BIN_DIR )
- self.system('cp install/plugins/*.so %s/plugins' % self.SETUP_BIN_DIR )
- self.system('cp install/q3map2.%s %s' % ( g_cpu, self.SETUP_BIN_DIR ) )
- self.M4_STDC = ''
- if (not self.g_darwin):
- # fugly
- # copy libgcc_s and stdc++ over to distribute it and reduce potential ABI fuckups
- ret = commands.getstatusoutput('ldd -r install/' + self.EDITOR_BIN + ' 2>/dev/null | grep libgcc_s | sed -e \'s/.* => \\([^ ]*\\) .*/\\1/\'')
- if (ret[0] != 0):
- raise 'ldd command failed'
- self.system('cp ' + ret[1] + ' ' + self.SETUP_BIN_DIR)
- ret = commands.getstatusoutput('ldd -r install/' + self.EDITOR_BIN + ' 2>/dev/null | grep libstdc++ | sed -e \'s/.* => \\([^ ]*\\) .*/\\1/\'')
- if (ret[0] != 0):
- raise 'ldd command failed'
- lines = string.split(ret[1], '\n')
- self.M4_STDC = '"'
- for i in lines:
- self.system('cp ' + i + ' ' + self.SETUP_BIN_DIR)
- self.M4_STDC += os.path.basename(i) + ' \n'
- self.M4_STDC += '"'
- # hack for symlink
- # setup process generates the wrapper at install time
- # but we need a dummy executable for symlink in loki_setup
- self.system('echo -n "#!/bin/sh\necho If you read this then there was a bug during setup. Report the bug and try running %s directly from it\'s installation directory.\n" > %s/radiant' % (self.EDITOR_BIN, self.SETUP_BIN_DIR));
- self.system('echo -n "#!/bin/sh\necho If you read this then there was a bug during setup. Report the bug and try running %s directly from it\'s installation directory.\n" > %s/q3map2' % (self.EDITOR_BIN, self.SETUP_BIN_DIR));
- ## this goes to the core install directory
- DEST = self.SETUP_DIR + '/core'
- self.system('mkdir -p ' + DEST + '/modules/bitmaps')
- # general content stuff
- self.system('cp -R plugins/model/bitmaps/* ' + DEST + '/modules/bitmaps')
- self.system('cp -R setup/data/tools/* ' + DEST)
- self.system('cp -R radiant/bitmaps ' + DEST)
- self.system('cp setup/changelog.txt ' + DEST)
- self.system('cp setup/openurl.sh ' + DEST)
- self.system('cp tools/quake3/q3map2/changelog.q3map2.txt ' + DEST)
- # documentation
- self.system('cp -R docs/manual/Q3Rad_Manual ' + DEST)
- self.system('cp -R docs/manual/quake3/Compile_Manual ' + DEST)
- self.system('cp -R docs/manual/quake3/Model_Manual ' + DEST)
- self.system('cp -R docs/manual/quake3/Terrain_Manual ' + DEST)
- # copy plugins media
- self.system('mkdir -p ' + DEST + '/plugins/bitmaps')
- self.system('cp -R contrib/bobtoolz/bitmaps/* ' + DEST + '/plugins/bitmaps')
- self.system('cp -R contrib/bobtoolz/bt ' + DEST + '/plugins')
- self.system('cp -R contrib/camera/bitmaps/* ' + DEST + '/plugins/bitmaps' )
- self.system('cp -R contrib/bkgrnd2d/bitmaps/* ' + DEST + '/plugins/bitmaps' )
-
- def copy_q3(self):
- # binaries
- self.system('mkdir -p ' + self.SETUP_BIN_DIR + '/q3')
- if ( self.g_darwin == 0 ):
- self.system('cp setup/linux/bspc ' + self.SETUP_BIN_DIR + '/q3')
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/q3'
- self.system('mkdir -p ' + DEST)
- self.system('cp setup/data/tools/synapse.config ' + DEST)
- self.system('cp setup/data/tools/game.xlink ' + DEST)
- self.system('cp -R docs/manual/quake3/Team_Arena_Mapping_Help ' + DEST)
- self.system('cp -R docs/manual/quake3/New_Teams_For_Q3TA ' + DEST)
- self.system('cp -R docs/manual/quake3/Q3AShader_Manual ' + DEST)
-
- # goes in the game install path
- DEST = self.SETUP_DIR + '/q3'
- self.system('mkdir -p ' + DEST)
- self.system('cp -R setup/data/baseq3 ' + DEST)
- self.system('cp -R setup/data/missionpack ' + DEST)
-
- def copy_wolf(self):
- # binaries
- self.system('mkdir -p ' + self.SETUP_BIN_DIR + '/wolf')
- if ( self.g_darwin == 0 ):
- self.system('cp ../WolfPack/bin/Linux/bspc ' + self.SETUP_BIN_DIR + '/wolf')
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/wolf'
- self.system('mkdir -p ' + DEST)
- self.system('cp ../WolfPack/synapse.config ' + DEST)
- self.system('cp -R ../WolfPack/docs ' + DEST)
- self.system('cp ../WolfPack/game.xlink ' + DEST)
- self.system('cp ../WolfPack/bin/aascfg_lg.c ' + DEST)
- self.system('cp ../WolfPack/bin/aascfg_sm.c ' + DEST)
- self.system('cp ../WolfPack/bin/bspc.ai ' + DEST)
-
- # goes in the game install path
- DEST = self.SETUP_DIR + '/wolf/main'
- self.system('mkdir -p ' + DEST)
- self.system('cp ../WolfPack/astro-skies.pk3 ' + DEST)
- self.system('cp ../WolfPack/common-astro-spog.pk3 ' + DEST)
- self.system('cp ../WolfPack/lights.pk3 ' + DEST)
- self.system('cp -R ../WolfPack/scripts ' + DEST)
- self.system('cp -R ../WolfPack/maps ' + DEST)
- self.system('cp -R ../WolfPack/models ' + DEST)
-
- def copy_et(self):
- # goes in core
- DEST = self.SETUP_DIR + '/core/et'
- self.system('mkdir -p ' + DEST)
- self.system('cp -R ../ETPack/bitmaps ' + DEST)
- self.system('cp -R ../ETPack/docs ' + DEST)
- self.system('cp ../ETPack/game.xlink ' + DEST)
- self.system('cp ../ETPack/synapse.config ' + DEST)
-
- # goes in game install path
- DEST = self.SETUP_DIR + '/et/etmain'
- self.system('mkdir -p ' + DEST)
- self.system('cp ../ETPack/astro-skies.pk3 ' + DEST)
- self.system('cp ../ETPack/common.pk3 ' + DEST)
- self.system('cp ../ETPack/goldrush.pcx ' + DEST)
- self.system('cp ../ETPack/lights.pk3 ' + DEST)
- self.system('cp ../ETPack/mapmedia.pk3 ' + DEST)
- self.system('cp -R ../ETPack/scripts ' + DEST)
- self.system('cp -R ../ETPack/maps ' + DEST)
- self.system('cp -R ../ETPack/models ' + DEST)
-
- def copy_q2(self):
- # binaries
- self.system('cp -R install/q2 %s' % (self.SETUP_BIN_DIR))
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/q2'
- self.system('mkdir -p ' + DEST + '/modules')
- self.system('cp ../Q2Pack/game.xlink ' + DEST)
- self.system('cp ../Q2Pack/synapse.config ' + DEST)
- self.system('cp install/q2/q2map install/q2/qdata3 ' + DEST)
- self.system('cp -R install/q2/modules ' + DEST )
-
- # goes in game install path
- DEST = self.SETUP_DIR + '/q2'
- self.system('mkdir -p ' + DEST + '/baseq2')
- self.system('cp -R ../Q2Pack/baseq2/* ' + DEST + '/baseq2')
-
- def copy_her2(self):
- # binaries
- self.system('cp -R install/heretic2 %s' % (self.SETUP_BIN_DIR))
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/heretic2'
- self.system('mkdir -p ' + DEST + '/modules')
- self.system('cp ../Her2Pack/game.xlink ' + DEST)
- self.system('cp ../Her2Pack/synapse.config ' + DEST)
- self.system('cp install/q2/q2map install/heretic2/qdata3 ' + DEST)
- self.system('cp -R install/heretic2/modules ' + DEST )
-
- # goes in game install path
- DEST = self.SETUP_DIR + '/heretic2'
- self.system('mkdir -p ' + DEST + '/base')
- self.system('cp -R ../Her2Pack/base/* ' + DEST + '/base')
-
- def build_setup(self):
- self.system( 'cp -R ' + self.SETUP_IMAGE_OS + '/* ' + self.SETUP_DIR )
- self.system( 'cp -fR ' + self.SETUP_IMAGE + '/* ' + self.SETUP_DIR )
- self.system('cp setup/license.txt ' + self.SETUP_DIR)
- self.system('cp setup/linux/README ' + self.SETUP_DIR)
- OS_DEFS=''
- if (self.g_darwin):
- OS_DEFS='--define=M4_OSX'
- M4_LINE = OS_DEFS + ' --define=M4_VER_MAJOR=' + self.major + ' --define=M4_VER_MINOR=' + self.minor + ' --define=M4_VER=' + self.line
- M4_LINE += ' --define=M4_GAME_ET=%d' % self.DO_GAME_ET
- M4_LINE += ' --define=M4_GAME_Q2=%d' % self.DO_GAME_Q2
- if ( self.M4_STDC != '' ):
- M4_LINE += ' --define=M4_STDC=' + self.M4_STDC
- # setup.xml
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.data/setup.xml.in > ' + self.SETUP_DIR + '/setup.data/setup.xml')
- # postinstall.sh
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.data/postinstall.sh.in > ' + self.SETUP_DIR + '/setup.data/postinstall.sh')
- # config.sh
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.data/config.sh.in > ' + self.SETUP_DIR + '/setup.data/config.sh')
- # setup.sh
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.sh.in > ' + self.SETUP_DIR + '/setup.sh')
- self.system('chmod +x ' +self.SETUP_DIR + '/setup.sh')
- self.system('find ' + self.SETUP_DIR + ' -name .svn | while read i ; do rm -r "$i" ; done')
- # pack it up
- self.system('setup/linux/makeself/makeself.sh ' + self.SETUP_DIR + ' ' + self.SETUP_TARGET + ' "GtkRadiant ' + self.line + ' setup" ./setup.sh')
- if (self.g_darwin):
- def build_fink_deb(self):
- print "Building installer .deb\n"
- self.F_REV = '1'
- self.FINKINFO_DIR = '/sw/fink/10.2/unstable/main/finkinfo/games'
- self.TARBALL_DIR='radiant-' + self.F_REV + '.' + self.major
- self.TARBALL_NAME='radiant-' + self.F_REV + '.' + self.major + '.tar.gz'
- self.TARBALL_DEST='/sw/src'
-
- # prepare package description
- self.system('mkdir -p ' + self.FINKINFO_DIR)
- self.system('m4 ' + M4_LINE + ' --define=M4_SETUP_TARGET=' + self.SETUP_TARGET + ' --define=M4_F_REV=' + self.F_REV + ' ' + 'setup/osx/radiant.info.m4 > ' + self.FINKINFO_DIR + '/radiant-' + self.TARBALL_DIR + '.info')
-
- # build the tarball
- self.system('if [ -r /tmp/' + self.TARBALL_DIR + ' ] ; then rm -r ' '/tmp/' + self.TARBALL_DIR + ' ; fi')
- self.system('mkdir -p ' '/tmp/' + self.TARBALL_DIR)
- self.system('cp ' + self.SETUP_TARGET + ' ' + '/tmp/' + self.TARBALL_DIR)
- self.system('cd /tmp ; tar -cvzf ' + self.TARBALL_NAME + ' ' + self.TARBALL_DIR + ' ; cp ' + self.TARBALL_NAME + ' ' + self.TARBALL_DEST + '/')
- self.system('/sw/bin/fink rebuild radiant')
-
- build_fink_deb(self)
-
- def spawn_setup(self, env, target, source):
- if ( OS == 'Darwin' ):
- self.g_darwin = 1
- else:
- self.g_darwin = 0
- (self.line, self.major, self.minor) = get_version()
- print 'Setup: GtkRadiant %s' % self.line
- if ( self.g_darwin ):
- self.SETUP_IMAGE_OS = '../loki_setup/image'
- else:
- self.SETUP_IMAGE_OS = 'setup/linux/setup_image.Linux'
- self.SETUP_IMAGE = 'setup/linux/setup_image'
- self.SETUP_DIR = '/tmp/radiant-setup.%d' % os.getpid()
- self.EDITOR_BIN='radiant.' + g_cpu
- if ( self.g_darwin ):
- self.SETUP_BIN_DIR = self.SETUP_DIR + '/bin/Darwin/ppc'
- self.SETUP_TARGET = 'osx-radiant-%s.run' % self.line
- else:
- self.SETUP_BIN_DIR = self.SETUP_DIR + '/bin/Linux/x86'
- self.SETUP_TARGET = 'linux-radiant-%s.run' % self.line
- # TODO: eval a conf file instead
- self.DO_CORE=1
- self.DO_GAME_Q3=1
- self.DO_GAME_WOLF=1
- self.DO_GAME_ET=1
- self.DO_GAME_Q2=1
- self.DO_GAME_HER2=1
- if ( self.g_darwin ):
- self.DO_GAME_Q2=0
- self.DO_GAME_ET=0
- self.DO_GAME_HER2=0
- # verbose a bit
- print 'version: %s major: %s minor: %s\neditor core: %d\nq3: %d\nwolf: %d\nq2: %d\nher2: %d' % (self.line, self.major, self.minor, self.DO_CORE, self.DO_GAME_Q3, self.DO_GAME_WOLF, self.DO_GAME_Q2, self.DO_GAME_HER2)
- if (self.DO_CORE):
- self.copy_core()
- if (self.DO_GAME_Q3):
- self.copy_q3()
- if (self.DO_GAME_WOLF):
- self.copy_wolf()
- if (self.DO_GAME_ET):
- self.copy_et()
- if (self.DO_GAME_Q2):
- self.copy_q2()
- if (self.DO_GAME_HER2):
- self.copy_her2()
- self.build_setup()
- return 0
-
-def spawn_setup(env, target, source):
- setup = setup_builder()
- setup.spawn_setup(env, target, source)
-
-# NOTE: could modify g_env to add the deps auto when calling SharedLibrarySafe ..
-if (SETUP == '1'):
- g_env.Command('foo', INSTALL + '/radiant.' + g_cpu, [ spawn_setup ] )
- depends_list = [
- INSTALL + '/modules/entity.so',
- INSTALL + '/modules/fgd.so',
- INSTALL + '/modules/imagehl.so',
- INSTALL + '/modules/image.so',
- INSTALL + '/modules/imagepng.so',
- INSTALL + '/modules/map.so',
- INSTALL + '/modules/mapxml.so',
- INSTALL + '/modules/model.so',
- INSTALL + '/modules/shaders.so',
- INSTALL + '/modules/surface.so',
- INSTALL + '/modules/vfspk3.so',
- INSTALL + '/modules/vfswad.so',
- INSTALL + '/plugins/bobtoolz.so',
- INSTALL + '/plugins/camera.so',
- INSTALL + '/plugins/prtview.so',
- INSTALL + '/plugins/gensurf.so',
- INSTALL + '/plugins/bkgrnd2d.so',
- INSTALL + '/q3map2.' + g_cpu,
- INSTALL + '/radiant.' + g_cpu,
- INSTALL + '/q3data.' + g_cpu ]
- if ( OS != 'Darwin' ):
- depends_list += [
- INSTALL + '/q2/modules/imagewal.so',
- INSTALL + '/q2/modules/surface_quake2.so',
- INSTALL + '/q2/modules/vfspak.so',
- INSTALL + '/q2/q2map',
- INSTALL + '/q2/qdata3',
- INSTALL + '/heretic2/modules/imagem8.so',
- INSTALL + '/heretic2/modules/surface_heretic2.so',
- INSTALL + '/heretic2/modules/vfspak.so',
- INSTALL + '/heretic2/qdata3',
- INSTALL + '/heretic2/q2map' ]
- g_env.Depends( 'foo', depends_list )
-
-# end setup ---------------------------------------------------------------------------------------
--- /dev/null
+# -*- mode: python -*-
+# ZeroRadiant build scripts
+# TTimo <ttimo@idsoftware.com>
+# http://scons.sourceforge.net
+
+import os
+
+Import( [ 'utils', 'config', 'settings', 'project' ] )
+
+( libpath, libname ) = os.path.split( project )
+libname = os.path.splitext( libname )[0]
+
+env = Environment()
+settings.SetupEnvironment( env, config )
+proj = utils.vcproj( os.path.join( GetLaunchDir(), project ) )
+
+# some filtering. may need to improve that
+add_sources = []
+( drop, files ) = proj.filterSource( r'.*l_net_wins\.c' )
+if ( len( drop ) != 0 ):
+ add_sources.append( 'l_net_berkeley.c' )
+
+#env.StaticLibrary( libname, [ os.path.join( libpath, i ) for i in files ] )
+objects = []
+for i in files + add_sources:
+ objects.append( env.StaticObject( os.path.join( libpath, i ) ) )
+
+Return( 'objects' )
--- /dev/null
+# -*- mode: python -*-
+# ZeroRadiant build scripts
+# TTimo <ttimo@idsoftware.com>
+# http://scons.sourceforge.net
+
+import os
+
+Import( [ 'utils', 'config', 'settings', 'lib_objects' ] )
+
+env = Environment()
+settings.SetupEnvironment( env, config, useGtk = True, useGtkGL = True )
+proj = utils.vcproj( os.path.join( GetLaunchDir(), 'radiant/radiant.vcproj' ) )
+
+env.Program( 'radiant.bin', lib_objects + [ os.path.join( 'radiant', i ) for i in proj.getSourceFiles() ] )
+
-# scons build script\r
+# -*- mode: python -*-\r
+# ZeroRadiant build scripts\r
+# TTimo <ttimo@idsoftware.com>\r
# http://scons.sourceforge.net\r
\r
-import commands, re, sys, os, pickle, string, popen2\r
-from makeversion import radiant_makeversion, get_version\r
-from osx_setup import do_osx_setup\r
+import sys, os, platform, cPickle\r
\r
-# to access some internal stuff\r
-import SCons\r
+import utils, config\r
\r
-conf_filename='site.conf'\r
-# there is a default hardcoded value, you can override on command line, those are saved between runs\r
-# we only handle strings\r
-serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'SETUP']\r
+conf_filename = 'site.sconf'\r
\r
-# help -------------------------------------------\r
-\r
-Help("""\r
-Usage: scons [OPTIONS] [TARGET] [CONFIG]\r
-\r
-[OPTIONS] and [TARGET] are covered in command line options, use scons -H\r
-\r
-[CONFIG]: KEY="VALUE" [...]\r
-a number of configuration options saved between runs in the """ + conf_filename + """ file\r
-erase """ + conf_filename + """ to start with default settings again\r
-\r
-CC\r
-CXX\r
- Specify C and C++ compilers (defaults gcc and g++)\r
- ex: CC="gcc-3.2"\r
- You can use ccache and distcc, for instance:\r
- CC="ccache distcc gcc" CXX="ccache distcc g++"\r
-\r
-JOBS\r
- Parallel build\r
- ex: JOBS="4" is a good setting on SMP machines\r
-\r
-BUILD\r
- Use debug/release to select build settings\r
- ex: BUILD="release" - default is debug\r
- OSX: use BUILD="info" to generate the set of release files\r
-\r
-SETUP\r
- Build a setup - default 0\r
-"""\r
-)\r
-\r
-# end help ---------------------------------------\r
- \r
-# sanity -----------------------------------------\r
-\r
-# use q decently recent python release\r
-EnsurePythonVersion( 2, 1 )\r
-# above 0.90\r
-EnsureSConsVersion( 0, 95 )\r
-print 'SCons ' + SCons.__version__\r
-\r
-# end sanity -------------------------------------\r
-\r
-# system detection -------------------------------\r
-\r
-# CPU type\r
-g_cpu = commands.getoutput('uname -m')\r
-exp = re.compile('.*i?86.*')\r
-if (g_cpu == 'Power Macintosh'):\r
- g_cpu = 'ppc'\r
-elif exp.match(g_cpu):\r
- g_cpu = 'x86'\r
-else:\r
- g_cpu = 'cpu'\r
-\r
-# OS\r
-OS = commands.getoutput('uname')\r
-\r
-if (OS == 'Linux'):\r
- # libc .. do the little magic!\r
- # NOTE: this used to work fine up to libc 2.3\r
- libc = commands.getoutput('/lib/libc.so.6 |grep "GNU C "|grep version|awk -F "version " \'{ print $2 }\'|cut -b -3')\r
-\r
-# end system detection ---------------------------\r
-\r
-# default settings -------------------------------\r
-\r
-CC='gcc'\r
-CXX='g++'\r
-JOBS='1'\r
-BUILD='debug'\r
-INSTALL='#install'\r
-SETUP='0'\r
-g_build_root = 'build'\r
-\r
-# end default settings ---------------------------\r
-\r
-# site settings ----------------------------------\r
-\r
-site_dict = {}\r
-if (os.path.exists(conf_filename)):\r
- site_file = open(conf_filename, 'r')\r
- p = pickle.Unpickler(site_file)\r
- site_dict = p.load()\r
- print 'Loading build configuration from ' + conf_filename\r
- for k, v in site_dict.items():\r
- exec_cmd = k + '=\"' + v + '\"'\r
- print exec_cmd\r
- exec(exec_cmd)\r
-\r
-# end site settings ------------------------------\r
-\r
-# command line settings --------------------------\r
-\r
-for k in serialized:\r
- if (ARGUMENTS.has_key(k)):\r
- exec_cmd = k + '=\"' + ARGUMENTS[k] + '\"'\r
- print 'Command line: ' + exec_cmd\r
- exec(exec_cmd)\r
-\r
-# end command line settings ----------------------\r
-\r
-# sanity check -----------------------------------\r
-\r
-if (SETUP == '1' and BUILD != 'release' and BUILD != 'info'):\r
- print 'Forcing release build for setup'\r
- BUILD = 'release'\r
-\r
-def GetGCCVersion(name):\r
- ret = commands.getstatusoutput('%s -dumpversion' % name)\r
- if ( ret[0] != 0 ):\r
- return None\r
- vers = string.split(ret[1], '.')\r
- if ( len(vers) == 2 ):\r
- return [ vers[0], vers[1], 0 ]\r
- elif ( len(vers) == 3 ):\r
- return vers\r
- return None\r
-\r
-ver_cc = GetGCCVersion(CC)\r
-ver_cxx = GetGCCVersion(CXX)\r
-\r
-# end sanity check -------------------------------\r
-\r
-# save site configuration ----------------------\r
-\r
-for k in serialized:\r
- exec_cmd = 'site_dict[\'' + k + '\'] = ' + k\r
- exec(exec_cmd)\r
-\r
-site_file = open(conf_filename, 'w')\r
-p = pickle.Pickler(site_file)\r
-p.dump(site_dict)\r
-site_file.close()\r
-\r
-# end save site configuration ------------------\r
-\r
-# general configuration, target selection --------\r
-\r
-SConsignFile( "scons.signatures" )\r
-\r
-g_build = g_build_root + '/' + BUILD\r
-\r
-SetOption('num_jobs', JOBS)\r
-\r
-LINK = CXX\r
-# common flags\r
-CCFLAGS = ''\r
-CXXFLAGS = '-pipe -DQ_NO_STLPORT '\r
-CPPPATH = []\r
-if (BUILD == 'debug'):\r
- CXXFLAGS += '-g -D_DEBUG '\r
- CCFLAGS += '-g -D_DEBUG '\r
-elif (BUILD == 'release'):\r
- CXXFLAGS += '-g -O2 '\r
- CCFLAGS += '-g -O2 '\r
-elif ( BUILD == 'info' ):\r
- print 'Preparing OSX release'\r
- ( line, major, minor ) = get_version()\r
- do_osx_setup( major, minor, 'osx-radiant-%s.run' % line )\r
- sys.exit( 0 )\r
+try:\r
+ sys.argv.index( '-h' )\r
+except:\r
+ pass\r
else:\r
- print 'Unknown build configuration ' + BUILD\r
- sys.exit( 0 )\r
-\r
-LINKFLAGS = ''\r
-if ( OS == 'Linux' ):\r
- LINKFLAGS += '-Wl,-fini,fini_stub '\r
-if ( OS == 'Darwin' ):\r
- CCFLAGS += '-force_cpusubtype_ALL -fPIC '\r
- CXXFLAGS += '-force_cpusubtype_ALL -fPIC -fno-exceptions -fno-rtti '\r
- CPPPATH.append('/sw/include')\r
- CPPPATH.append('/usr/X11R6/include')\r
- LINKFLAGS += '-L/sw/lib -L/usr/lib -L/usr/X11R6/lib '\r
-\r
-CPPPATH.append('libs')\r
-\r
-# extend the standard Environment a bit\r
-class idEnvironment(Environment):\r
-\r
- def useGlib2(self):\r
- self['CXXFLAGS'] += '`pkg-config glib-2.0 --cflags` '\r
- self['CCFLAGS'] += '`pkg-config glib-2.0 --cflags` '\r
- self['LINKFLAGS'] += '`pkg-config glib-2.0 --libs` '\r
- \r
- def useXML2(self):\r
- self['CXXFLAGS'] += '`xml2-config --cflags` ' \r
- self['CCFLAGS'] += '`xml2-config --cflags` ' \r
- self['LINKFLAGS'] += '`xml2-config --libs` '\r
-\r
- def useGtk2(self):\r
- self['CXXFLAGS'] += '`pkg-config gtk+-2.0 --cflags` '\r
- self['CCFLAGS'] += '`pkg-config gtk+-2.0 --cflags` '\r
- self['LINKFLAGS'] += '`pkg-config gtk+-2.0 --libs-only-L` `pkg-config gtk+-2.0 --libs-only-l` '\r
- \r
- def useGtkGLExt(self):\r
- self['CXXFLAGS'] += '`pkg-config gtkglext-1.0 --cflags` '\r
- self['CCFLAGS'] += '`pkg-config gtkglext-1.0 --cflags` '\r
- self['LINKFLAGS'] += '`pkg-config gtkglext-1.0 --libs-only-L` `pkg-config gtkglext-1.0 --libs-only-l` ' \r
- \r
- def usePNG(self):\r
- self['CXXFLAGS'] += '`libpng-config --cflags` '\r
- self['CCFLAGS'] += '`libpng-config --cflags` '\r
- self['LINKFLAGS'] += '`libpng-config --ldflags` '\r
-\r
- def usePThread(self):\r
- if ( OS == 'Darwin' ):\r
- self['LINKFLAGS'] += '-lpthread -Wl,-stack_size,0x400000 '\r
- else:\r
- self['LINKFLAGS'] += '-lpthread '\r
-\r
- def CheckLDD(self, target, source, env):\r
- file = target[0]\r
- if (not os.path.isfile(file.abspath)):\r
- print('ERROR: CheckLDD: target %s not found\n' % target[0])\r
- Exit(1)\r
- # not using os.popen3 as I want to check the return code\r
- ldd = popen2.Popen3('`which ldd` -r %s' % target[0], 1)\r
- stdout_lines = ldd.fromchild.readlines()\r
- stderr_lines = ldd.childerr.readlines()\r
- ldd_ret = ldd.wait()\r
- del ldd\r
- have_undef = 0\r
- if ( ldd_ret != 0 ):\r
- print "ERROR: ldd command returned with exit code %d" % ldd_ret\r
- os.system('rm %s' % target[0])\r
- Exit()\r
- for i_line in stderr_lines:\r
- print repr(i_line)\r
- regex = re.compile('undefined symbol: (.*)\t\\((.*)\\)\n')\r
- if ( regex.match(i_line) ):\r
- symbol = regex.sub('\\1', i_line)\r
- try:\r
- env['ALLOWED_SYMBOLS'].index(symbol)\r
- except:\r
- have_undef = 1\r
- else:\r
- print "ERROR: failed to parse ldd stderr line: %s" % i_line\r
- os.system('rm %s' % target[0])\r
- Exit(1)\r
- if ( have_undef ):\r
- print "ERROR: undefined symbols"\r
- os.system('rm %s' % target[0])\r
- Exit(1)\r
- \r
- def SharedLibrarySafe(self, target, source):\r
- self.SharedLibrary(target, source)\r
- if (OS != 'Darwin'):\r
- AddPostAction(target + '.so', self.CheckLDD)\r
-\r
-g_env = idEnvironment(ENV = os.environ, \r
- CC = CC,\r
- CXX = CXX,\r
- LINK = LINK,\r
- CCFLAGS = CCFLAGS,\r
- CXXFLAGS = CXXFLAGS,\r
- CPPPATH = CPPPATH,\r
- LINKFLAGS = LINKFLAGS)\r
-\r
-# export the globals\r
-GLOBALS = 'g_env INSTALL SETUP g_cpu'\r
-\r
-radiant_makeversion('\\ngcc version: %s.%s.%s' % ( ver_cc[0], ver_cc[1], ver_cc[2] ) )\r
-\r
-# end general configuration ----------------------\r
-\r
-# targets ----------------------------------------\r
-\r
-Default('.')\r
-\r
-Export('GLOBALS ' + GLOBALS)\r
-BuildDir(g_build, '.', duplicate = 0)\r
-SConscript(g_build + '/SConscript')\r
-\r
-# end targets ------------------------------------\r
+ Help(\r
+"""\r
+======================================================================\r
+ZeroRadiant build system quick help\r
+\r
+You need scons v0.97.0d20070918.r2446 or newer\r
+\r
+Default build (release), just run scons at the toplevel\r
+\r
+debug build:\r
+$ scons config=debug\r
+======================================================================\r
+""" )\r
+ Return()\r
+\r
+active_configs = []\r
+\r
+# load up configurations from the save file\r
+if ( os.path.exists( conf_filename ) ):\r
+ f = open( conf_filename )\r
+ print 'reading saved configuration from site.conf'\r
+ try:\r
+ while ( True ):\r
+ c = cPickle.load( f )\r
+ active_configs.append( c )\r
+ except:\r
+ pass\r
+\r
+# read the command line and build configs\r
+config_statements = sys.argv[1:]\r
+active_configs = config.ConfigParser().parseStatements( active_configs, config_statements )\r
+assert( len( active_configs ) >= 1 )\r
+\r
+# save the config\r
+print 'saving updated configuration'\r
+f = open( conf_filename, 'wb' )\r
+for c in active_configs:\r
+ cPickle.dump( c, f, -1 )\r
+\r
+print 'emit build rules'\r
+for c in active_configs:\r
+ print 'emit configuration: %s' % repr( c )\r
+ c.emit()\r
--- /dev/null
+import sys, traceback, platform, re, commands
+
+if __name__ != '__main__':
+ from SCons.Script import *
+
+import utils
+
+# config = debug release
+# aliases are going to be very needed here
+# we have dependency situations too
+# target =
+
+class Config:
+ # not used atm, but useful to keep a list in mind
+ # may use them eventually for the 'all' and other aliases expansions?
+ target_choices = utils.Enum( 'radiant' )
+ config_choices = utils.Enum( 'debug', 'release' )
+
+ # aliases
+ # 'all' -> for each choices
+ # 'gamecode' for the targets, 'game' 'cgame' 'ui'
+
+ def __init__( self ):
+ # initialize defaults
+ self.target_selected = [ 'radiant' ]
+ self.config_selected = [ 'release' ]
+ # those are global to each config
+ self.cc = 'gcc-4.1'
+ self.cxx = 'g++-4.1'
+
+ def __repr__( self ):
+ return 'config: target=%s config=%s' % ( self.target_selected, self.config_selected )
+
+ def _processTarget( self, ops ):
+ self.target_selected = ops
+
+ def _processConfig( self, ops ):
+ self.config_selected = ops
+
+ def _processCC( self, ops ):
+ self.cc = ops
+
+ def _processCXX( self, ops ):
+ self.cxx = ops
+
+ def setupParser( self, operators ):
+ operators['target'] = self._processTarget
+ operators['config'] = self._processConfig
+ operators['cc'] = self._processCC
+ operators['cxx'] = self._processCXX
+
+ def emit( self ):
+ settings = self
+ for config in self.config_selected:
+ Export( 'utils', 'settings', 'config' )
+ build_dir = os.path.join( 'build', config )
+ BuildDir( build_dir, '.', duplicate = 0 )
+ # left out jpeg6, splines
+ lib_objects = []
+ for project in [ 'libs/synapse/synapse.vcproj', 'libs/cmdlib/cmdlib.vcproj', 'libs/mathlib/mathlib.vcproj', 'libs/l_net/l_net.vcproj', 'libs/ddslib/ddslib.vcproj', 'libs/picomodel/picomodel.vcproj', 'libs/md5lib/md5lib.vcproj' ]:
+ Export( 'project' )
+ lib_objects += SConscript( os.path.join( build_dir, 'SConscript.lib' ) )
+ Export( 'lib_objects' )
+ SConscript( os.path.join( build_dir, 'SConscript.radiant' ) )
+
+ def SetupEnvironment( self, env, config, useGtk = False, useGtkGL = False ):
+ env['CC'] = self.cc
+ env['CXX'] = self.cxx
+ ( ret, xml2 ) = commands.getstatusoutput( 'xml2-config --cflags' )
+ if ( ret != 0 ):
+ print 'xml2-config failed'
+ assert( False )
+ xml2libs = commands.getoutput( 'xml2-config --libs' )
+ env.Append( LINKFLAGS = xml2libs.split( ' ' ) )
+ baseflags = [ '-m32', '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.split( ' ' ) ]
+ if ( useGtk ):
+ ( ret, gtk2 ) = commands.getstatusoutput( 'pkg-config gtk+-2.0 --cflags' )
+ if ( ret != 0 ):
+ print 'pkg-config gtk+-2.0 failed'
+ assert( False )
+ baseflags += gtk2.split( ' ' )
+ gtk2libs = commands.getoutput( 'pkg-config gtk+-2.0 --libs' )
+ env.Append( LINKFLAGS = gtk2libs.split( ' ' ) )
+ else:
+ ( ret, glib ) = commands.getstatusoutput( 'pkg-config glib-2.0 --cflags' )
+ if ( ret != 0 ):
+ print 'pkg-config glib-2.0 failed'
+ assert( False )
+ baseflags += glib.split( ' ' )
+ if ( useGtkGL ):
+ ( ret, gtkgl ) = commands.getstatusoutput( 'pkg-config gtkglext-1.0 --cflags' )
+ if ( ret != 0 ):
+ print 'pkg-config gtkglext-1.0 failed'
+ assert( False )
+ baseflags += gtkgl.split( ' ' )
+ gtkgllibs = commands.getoutput( 'pkg-config gtkglext-1.0 --libs' )
+ env.Append( LINKFLAGS = gtkgllibs.split( ' ' ) )
+
+ env.Append( CFLAGS = baseflags )
+ env.Append( CXXFLAGS = baseflags + [ '-fpermissive', '-fvisibility-inlines-hidden' ] )
+ env.Append( CPPPATH = [ 'include', 'libs' ] )
+ env.Append( CPPDEFINES = [ 'Q_NO_STLPORT' ] )
+ if ( config == 'debug' ):
+ env.Append( CFLAGS = [ '-g' ] )
+ env.Append( CPPDEFINES = [ '_DEBUG' ] )
+ else:
+ env.Append( CFLAGS = [ '-O3', '-march=pentium3', '-Winline', '-ffast-math', '-fno-unsafe-math-optimizations' ] )
+
+# parse the config statement line to produce/update an existing config list
+# the configs expose a list of keywords and accepted values, which the engine parses out
+class ConfigParser:
+ def __init__( self ):
+ self.operators = {}
+
+ def _processOp( self, ops ):
+ assert( len( ops ) == 1 )
+ op = ops.pop()
+ if ( op == 'clear' ):
+ self.configs = []
+ self.current_config = None
+ elif ( op == 'pop' ):
+ self.configs.pop()
+ self.current_config = None
+ elif ( op == 'push' ):
+ self.configs.append( self.current_config )
+ self.current_config = Config()
+ self._setupParser( self.current_config )
+
+ def _setupParser( self, c ):
+ self.operators = { 'op' : self._processOp }
+ c.setupParser( self.operators )
+
+ def _parseStatement( self, s ):
+ statement_re = re.compile( '(.*)=(.*)' )
+ value_list_re = re.compile( '([^,]*),?' )
+ if ( not statement_re.match( s ) ):
+ print 'syntax error (statement match): %s' % repr( s )
+ return
+ statement_split = statement_re.split( s )
+ if ( len( statement_split ) != 4 ):
+ print 'syntax error (statement split): %s' % repr( s )
+ return
+ ( foo, name, value, bar ) = statement_split
+ value_split = value_list_re.split( value )
+ if ( len( value_split ) < 2 or len( value_split ) % 2 != 1 ):
+ print 'syntax error (value split): %s' % ( repr( value_split ) )
+ return
+ try:
+ value_array = []
+ value_split.reverse()
+ value_split.pop()
+ while ( len( value_split ) != 0 ):
+ value_array.append( value_split.pop() )
+ value_split.pop()
+ except:
+ print traceback.print_exception( sys.exc_type, sys.exc_value, sys.exc_traceback )
+ print 'syntax error (value to array): %s' % ( repr( value_split ) )
+ return
+
+ return ( name, value_array )
+
+ def parseStatements( self, _configs, statements ):
+ self.current_config = None
+ self.configs = _configs
+ if ( self.configs is None ):
+ self.configs = []
+ for s in statements:
+
+ if ( self.current_config is None ):
+ # use a provided config, or create a default one
+ if ( len( self.configs ) > 0 ):
+ self.current_config = self.configs.pop()
+ else:
+ self.current_config = Config()
+ # setup the operator table for this config
+ # NOTE: have that in self._processOp too
+ self._setupParser( self.current_config )
+
+ ret = self._parseStatement( s )
+ if ( ret is None ):
+ print 'stop statement parse at %s' % repr( s )
+ break
+ ( name, value_array ) = ret
+ try:
+ processor = self.operators[name]
+ except:
+ print 'unknown operator %s - stop statement parse at %s' % ( repr( name ), repr( s ) )
+ break
+ processor( value_array )
+
+ if ( not self.current_config is None ):
+ self.configs.append( self.current_config )
+ # make sure there is at least one config
+ if ( len( self.configs ) == 0 ):
+ print 'pushing a default config'
+ self.configs.append( Config() )
+ return self.configs
+
+import unittest
+
+class TestConfigParse( unittest.TestCase ):
+
+ def setUp( self ):
+ self.parser = ConfigParser()
+
+ def testBasicParse( self ):
+ # test basic config parsing
+ # needs to cleanly stop at the first config statement that is not recognized
+ configs = self.parser.parseStatements( None, [ 'game=missionpack', 'config=qvm', 'foobar' ] )
+ print repr( configs )
+
+ def testMultiParse( self ):
+ # multiple configs seperated by commas
+ configs = self.parser.parseStatements( None, [ 'target=server,game,cgame' ] )
+ print repr( configs )
+
+ def testOp( self ):
+ # test the operator for multiple configs
+ configs = self.parser.parseStatements( None, [ 'target=core', 'config=release', 'op=push', 'target=game,cgame,ui', 'config=debug' ] )
+ print repr( configs )
+
+if __name__ == '__main__':
+ unittest.main()
<References>\r
</References>\r
<Files>\r
- <File RelativePath=".\CMDLIB.cpp">\r
+ <File RelativePath=".\cmdlib.cpp">\r
</File>\r
<File RelativePath="..\cmdlib.h">\r
</File>\r
</Files>\r
<Globals>\r
</Globals>\r
-</VisualStudioProject>
\ No newline at end of file
+</VisualStudioProject>\r
<References>\r
</References>\r
<Files>\r
- <File RelativePath=".\Jchuff.h">\r
+ <File RelativePath=".\jchuff.h">\r
</File>\r
- <File RelativePath=".\JCOMAPI.cpp">\r
+ <File RelativePath=".\jcomapi.cpp">\r
</File>\r
- <File RelativePath=".\Jconfig.h">\r
+ <File RelativePath=".\jconfig.h">\r
</File>\r
- <File RelativePath=".\JDAPIMIN.cpp">\r
+ <File RelativePath=".\jdapimin.cpp">\r
</File>\r
- <File RelativePath=".\JDAPISTD.cpp">\r
+ <File RelativePath=".\jdapistd.cpp">\r
</File>\r
- <File RelativePath=".\JDATASRC.cpp">\r
+ <File RelativePath=".\jdatasrc.cpp">\r
</File>\r
- <File RelativePath=".\JDCOEFCT.cpp">\r
+ <File RelativePath=".\jdcoefct.cpp">\r
</File>\r
- <File RelativePath=".\JDCOLOR.cpp">\r
+ <File RelativePath=".\jdcolor.cpp">\r
</File>\r
- <File RelativePath=".\Jdct.h">\r
+ <File RelativePath=".\jdct.h">\r
</File>\r
- <File RelativePath=".\JDDCTMGR.cpp">\r
+ <File RelativePath=".\jddctmgr.cpp">\r
</File>\r
- <File RelativePath=".\JDHUFF.cpp">\r
+ <File RelativePath=".\jdhuff.cpp">\r
</File>\r
- <File RelativePath=".\Jdhuff.h">\r
+ <File RelativePath=".\jdhuff.h">\r
</File>\r
- <File RelativePath=".\JDINPUT.cpp">\r
+ <File RelativePath=".\jdinput.cpp">\r
</File>\r
- <File RelativePath=".\JDMAINCT.cpp">\r
+ <File RelativePath=".\jdmainct.cpp">\r
</File>\r
- <File RelativePath=".\JDMARKER.cpp">\r
+ <File RelativePath=".\jdmarker.cpp">\r
</File>\r
- <File RelativePath=".\JDMASTER.cpp">\r
+ <File RelativePath=".\jdmaster.cpp">\r
</File>\r
- <File RelativePath=".\JDPOSTCT.cpp">\r
+ <File RelativePath=".\jdpostct.cpp">\r
</File>\r
- <File RelativePath=".\JDSAMPLE.cpp">\r
+ <File RelativePath=".\jdsample.cpp">\r
</File>\r
- <File RelativePath=".\JDTRANS.cpp">\r
+ <File RelativePath=".\jdtrans.cpp">\r
</File>\r
- <File RelativePath=".\JERROR.cpp">\r
+ <File RelativePath=".\jerror.cpp">\r
</File>\r
- <File RelativePath=".\Jerror.h">\r
+ <File RelativePath=".\jerror.h">\r
</File>\r
- <File RelativePath=".\JFDCTFLT.cpp">\r
+ <File RelativePath=".\jfdctflt.cpp">\r
</File>\r
- <File RelativePath=".\JIDCTFLT.cpp">\r
+ <File RelativePath=".\jidctflt.cpp">\r
</File>\r
- <File RelativePath=".\Jinclude.h">\r
+ <File RelativePath=".\jinclude.h">\r
</File>\r
- <File RelativePath=".\JMEMMGR.cpp">\r
+ <File RelativePath=".\jmemmgr.cpp">\r
</File>\r
- <File RelativePath=".\JMEMNOBS.cpp">\r
+ <File RelativePath=".\jmemnobs.cpp">\r
</File>\r
- <File RelativePath=".\Jmemsys.h">\r
+ <File RelativePath=".\jmemsys.h">\r
</File>\r
- <File RelativePath=".\Jmorecfg.h">\r
+ <File RelativePath=".\jmorecfg.h">\r
</File>\r
- <File RelativePath=".\Jpegint.h">\r
+ <File RelativePath=".\jpegint.h">\r
</File>\r
- <File RelativePath=".\JPGLOAD.cpp">\r
+ <File RelativePath=".\jpgload.cpp">\r
</File>\r
- <File RelativePath=".\JUTILS.cpp">\r
+ <File RelativePath=".\jutils.cpp">\r
</File>\r
- <File RelativePath=".\Jversion.h">\r
+ <File RelativePath=".\jversion.h">\r
</File>\r
</Files>\r
<Globals>\r
</Globals>\r
-</VisualStudioProject>
\ No newline at end of file
+</VisualStudioProject>\r
--- /dev/null
+/*\r
+Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
+For a list of contributors, see the accompanying CONTRIBUTORS file.\r
+\r
+This file is part of GtkRadiant.\r
+\r
+GtkRadiant is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+GtkRadiant is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with GtkRadiant; if not, write to the Free Software\r
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+*/\r
+\r
+//===========================================================================\r
+//\r
+// Name: l_net_wins.c\r
+// Function: WinSock\r
+// Programmer: MrElusive\r
+// Last update: TTimo: cross-platform version, l_net library\r
+// Tab Size: 2\r
+// Notes:\r
+//===========================================================================\r
+\r
+//#include <windows.h>\r
+#include <unistd.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "l_net.h"\r
+#include "l_net_wins.h"\r
+\r
+#include <arpa/inet.h>\r
+#include <sys/types.h>\r
+#include <sys/socket.h>\r
+#include <sys/ioctl.h>\r
+#include <netinet/in.h>\r
+#include <netinet/tcp.h>\r
+#include <errno.h>\r
+#include <netdb.h>\r
+#define SOCKET_ERROR -1\r
+#define INVALID_SOCKET -1\r
+\r
+extern void WinPrint(char *str, ...);\r
+\r
+#define WinError WinPrint\r
+\r
+#define qtrue 1\r
+#define qfalse 0\r
+\r
+#define ioctlsocket ioctl\r
+#define closesocket close\r
+\r
+int WSAGetLastError()\r
+{\r
+ return errno;\r
+}\r
+\r
+/*\r
+typedef struct tag_error_struct\r
+{\r
+ int errnum;\r
+ LPSTR errstr;\r
+} ERROR_STRUCT;\r
+*/\r
+\r
+typedef struct tag_error_struct\r
+{\r
+ int errnum;\r
+ const char *errstr;\r
+} ERROR_STRUCT;\r
+\r
+#define NET_NAMELEN 64\r
+\r
+static char my_tcpip_address[NET_NAMELEN];\r
+\r
+#define DEFAULTnet_hostport 26000\r
+\r
+#define MAXHOSTNAMELEN 256\r
+\r
+static int net_acceptsocket = -1; // socket for fielding new connections\r
+static int net_controlsocket;\r
+static int net_hostport; // udp port number for acceptsocket\r
+static int net_broadcastsocket = 0;\r
+//static qboolean ifbcastinit = qfalse;\r
+//static struct sockaddr_s broadcastaddr;\r
+static struct sockaddr_s broadcastaddr;\r
+\r
+static unsigned long myAddr;\r
+\r
+ERROR_STRUCT errlist[] = {\r
+ {EACCES,"EACCES - The address is protected, user is not root"},\r
+ {EAGAIN,"EAGAIN - Operation on non-blocking socket that cannot return immediatly"},\r
+ {EBADF, "EBADF - sockfd is not a valid descriptor"},\r
+ {EFAULT, "EFAULT - The parameter is not in a writable part of the user address space"},\r
+ {EINVAL,"EINVAL - The socket is already bound to an address"},\r
+ {ENOBUFS,"ENOBUFS - not enough memory"},\r
+ {ENOMEM, "ENOMEM - not enough memory"},\r
+ {ENOTCONN, "ENOTCONN - not connected"},\r
+ {ENOTSOCK,"ENOTSOCK - Argument is file descriptor not a socket"},\r
+ {EOPNOTSUPP,"ENOTSUPP - The referenced socket is not of type SOCK_STREAM"},\r
+ {EPERM, "EPERM - Firewall rules forbid connection"},\r
+ {-1, NULL}\r
+};\r
+\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+char *WINS_ErrorMessage(int error)\r
+{\r
+ int search = 0;\r
+\r
+ if (!error) return "No error occurred";\r
+\r
+ for (search = 0; errlist[search].errstr; search++)\r
+ {\r
+ if (error == errlist[search].errnum)\r
+ return (char *)errlist[search].errstr;\r
+ } //end for\r
+\r
+ return "Unknown error";\r
+} //end of the function WINS_ErrorMessage\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_Init(void)\r
+{\r
+ int i;\r
+ struct hostent *local;\r
+ char buff[MAXHOSTNAMELEN];\r
+ struct sockaddr_s addr;\r
+ char *p;\r
+ int r;\r
+/* \r
+ linux doesn't have anything to initialize for the net\r
+ "Windows .. built for the internet .. the internet .. built with unix" \r
+ */\r
+#if 0\r
+ WORD wVersionRequested; \r
+\r
+ wVersionRequested = MAKEWORD(2, 2);\r
+\r
+ r = WSAStartup (wVersionRequested, &winsockdata);\r
+\r
+ if (r)\r
+ {\r
+ WinPrint("Winsock initialization failed.\n");\r
+ return -1;\r
+ }\r
+#endif\r
+ /*\r
+ i = COM_CheckParm ("-udpport");\r
+ if (i == 0)*/\r
+ net_hostport = DEFAULTnet_hostport;\r
+ /*\r
+ else if (i < com_argc-1)\r
+ net_hostport = Q_atoi (com_argv[i+1]);\r
+ else\r
+ Sys_Error ("WINS_Init: you must specify a number after -udpport");\r
+ */\r
+\r
+ // determine my name & address\r
+ gethostname(buff, MAXHOSTNAMELEN);\r
+ local = gethostbyname(buff);\r
+ myAddr = *(int *)local->h_addr_list[0];\r
+\r
+ // if the quake hostname isn't set, set it to the machine name\r
+// if (Q_strcmp(hostname.string, "UNNAMED") == 0)\r
+ {\r
+ // see if it's a text IP address (well, close enough)\r
+ for (p = buff; *p; p++)\r
+ if ((*p < '0' || *p > '9') && *p != '.')\r
+ break;\r
+\r
+ // if it is a real name, strip off the domain; we only want the host\r
+ if (*p)\r
+ {\r
+ for (i = 0; i < 15; i++)\r
+ if (buff[i] == '.')\r
+ break;\r
+ buff[i] = 0;\r
+ }\r
+// Cvar_Set ("hostname", buff);\r
+ }\r
+\r
+ //++timo WTF is that net_controlsocket? it's sole purpose is to retrieve the local IP?\r
+ if ((net_controlsocket = WINS_OpenSocket (0)) == SOCKET_ERROR)\r
+ WinError("WINS_Init: Unable to open control socket\n");\r
+\r
+ ((struct sockaddr_in *)&broadcastaddr)->sin_family = AF_INET;\r
+ ((struct sockaddr_in *)&broadcastaddr)->sin_addr.s_addr = INADDR_BROADCAST;\r
+ ((struct sockaddr_in *)&broadcastaddr)->sin_port = htons((u_short)net_hostport);\r
+\r
+ WINS_GetSocketAddr (net_controlsocket, &addr);\r
+ strcpy(my_tcpip_address, WINS_AddrToString (&addr));\r
+ p = strrchr (my_tcpip_address, ':');\r
+ if (p) *p = 0;\r
+ WinPrint("Winsock Initialized\n");\r
+\r
+ return net_controlsocket;\r
+} //end of the function WINS_Init\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+char *WINS_MyAddress(void)\r
+{\r
+ return my_tcpip_address;\r
+} //end of the function WINS_MyAddress\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+void WINS_Shutdown(void)\r
+{\r
+ //WINS_Listen(0);\r
+ WINS_CloseSocket(net_controlsocket);\r
+// WSACleanup();\r
+ //\r
+ WinPrint("Winsock Shutdown\n");\r
+} //end of the function WINS_Shutdown\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+/*\r
+void WINS_Listen(int state)\r
+{\r
+ // enable listening\r
+ if (state)\r
+ {\r
+ if (net_acceptsocket != -1)\r
+ return;\r
+ if ((net_acceptsocket = WINS_OpenSocket (net_hostport)) == -1)\r
+ WinError ("WINS_Listen: Unable to open accept socket\n");\r
+ return;\r
+ }\r
+\r
+ // disable listening\r
+ if (net_acceptsocket == -1)\r
+ return;\r
+ WINS_CloseSocket (net_acceptsocket);\r
+ net_acceptsocket = -1;\r
+} //end of the function WINS_Listen*/\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_OpenSocket(int port)\r
+{\r
+ int newsocket;\r
+ struct sockaddr_in address;\r
+ u_long _true = 1;\r
+\r
+ if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_OpenSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return -1;\r
+ } //end if\r
+\r
+ if (ioctlsocket (newsocket, FIONBIO, &_true) == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_OpenSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ closesocket(newsocket);\r
+ return -1;\r
+ } //end if\r
+\r
+ memset((char *) &address, 0, sizeof(address));\r
+ address.sin_family = AF_INET;\r
+ address.sin_addr.s_addr = INADDR_ANY;\r
+ address.sin_port = htons((u_short)port);\r
+ if( bind (newsocket, (void *)&address, sizeof(address)) == -1)\r
+ {\r
+ WinPrint("WINS_OpenSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ closesocket(newsocket);\r
+ return -1;\r
+ } //end if\r
+\r
+ return newsocket;\r
+} //end of the function WINS_OpenSocket\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_OpenReliableSocket(int port)\r
+{\r
+ int newsocket;\r
+ struct sockaddr_in address;\r
+ qboolean _true = 0xFFFFFFFF;\r
+\r
+ //IPPROTO_TCP\r
+ //\r
+ if ((newsocket = socket(AF_INET, SOCK_STREAM, 0)) == -1)\r
+ {\r
+ WinPrint("WINS_OpenReliableSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return -1;\r
+ } //end if\r
+\r
+ memset((char *) &address, 0, sizeof(address));\r
+ address.sin_family = AF_INET;\r
+ address.sin_addr.s_addr = htonl(INADDR_ANY);\r
+ address.sin_port = htons((u_short)port);\r
+ if (bind(newsocket, (void *)&address, sizeof(address)) == -1)\r
+ {\r
+ WinPrint("WINS_OpenReliableSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ closesocket(newsocket);\r
+ return -1;\r
+ } //end if\r
+\r
+ //\r
+ if (setsockopt(newsocket, IPPROTO_TCP, TCP_NODELAY, (void *) &_true, sizeof(int)) == -1)\r
+ {\r
+ WinPrint("WINS_OpenReliableSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ WinPrint("setsockopt error\n");\r
+ } //end if\r
+\r
+ return newsocket;\r
+} //end of the function WINS_OpenReliableSocket\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_Listen(int socket)\r
+{\r
+ u_long _true = 1;\r
+\r
+ if (ioctlsocket(socket, FIONBIO, &_true) == -1)\r
+ {\r
+ WinPrint("WINS_Listen: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return -1;\r
+ } //end if\r
+ if (listen(socket, SOMAXCONN) == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_Listen: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return -1;\r
+ } //end if\r
+ return 0;\r
+} //end of the function WINS_Listen\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_Accept(int socket, struct sockaddr_s *addr)\r
+{\r
+ int addrlen = sizeof (struct sockaddr_s);\r
+ int newsocket;\r
+ qboolean _true = 1;\r
+\r
+ newsocket = accept(socket, (struct sockaddr *)addr, &addrlen);\r
+ if (newsocket == INVALID_SOCKET)\r
+ {\r
+ if (errno == EAGAIN) return -1;\r
+ WinPrint("WINS_Accept: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return -1;\r
+ } //end if\r
+ //\r
+ if (setsockopt(newsocket, IPPROTO_TCP, TCP_NODELAY, (void *) &_true, sizeof(int)) == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_Accept: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ WinPrint("setsockopt error\n");\r
+ } //end if\r
+ return newsocket;\r
+} //end of the function WINS_Accept\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_CloseSocket(int socket)\r
+{\r
+ /*\r
+ if (socket == net_broadcastsocket)\r
+ net_broadcastsocket = 0;\r
+ */\r
+// shutdown(socket, SD_SEND);\r
+\r
+ if (closesocket(socket) == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_CloseSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return SOCKET_ERROR;\r
+ } //end if\r
+ return 0;\r
+} //end of the function WINS_CloseSocket\r
+//===========================================================================\r
+// this lets you type only as much of the net address as required, using\r
+// the local network components to fill in the rest\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+static int PartialIPAddress (char *in, struct sockaddr_s *hostaddr)\r
+{\r
+ char buff[256];\r
+ char *b;\r
+ int addr;\r
+ int num;\r
+ int mask;\r
+ \r
+ buff[0] = '.';\r
+ b = buff;\r
+ strcpy(buff+1, in);\r
+ if (buff[1] == '.') b++;\r
+\r
+ addr = 0;\r
+ mask=-1;\r
+ while (*b == '.')\r
+ {\r
+ num = 0;\r
+ if (*++b < '0' || *b > '9') return -1;\r
+ while (!( *b < '0' || *b > '9'))\r
+ num = num*10 + *(b++) - '0';\r
+ mask<<=8;\r
+ addr = (addr<<8) + num;\r
+ }\r
+ \r
+ hostaddr->sa_family = AF_INET;\r
+ ((struct sockaddr_in *)hostaddr)->sin_port = htons((u_short)net_hostport);\r
+ ((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr);\r
+ \r
+ return 0;\r
+} //end of the function PartialIPAddress\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_Connect(int socket, struct sockaddr_s *addr)\r
+{\r
+ int ret;\r
+ u_long _true2 = 0xFFFFFFFF;\r
+\r
+ ret = connect(socket, (struct sockaddr *)addr, sizeof(struct sockaddr_s));\r
+ if (ret == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_Connect: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return -1;\r
+ } //end if\r
+ if (ioctlsocket(socket, FIONBIO, &_true2) == -1)\r
+ {\r
+ WinPrint("WINS_Connect: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ return -1;\r
+ } //end if\r
+ return 0;\r
+} //end of the function WINS_Connect\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_CheckNewConnections(void)\r
+{\r
+ char buf[4];\r
+\r
+ if (net_acceptsocket == -1)\r
+ return -1;\r
+\r
+ if (recvfrom(net_acceptsocket, buf, 4, MSG_PEEK, NULL, NULL) > 0)\r
+ return net_acceptsocket;\r
+ return -1;\r
+} //end of the function WINS_CheckNewConnections\r
+//===========================================================================\r
+// returns the number of bytes read\r
+// 0 if no bytes available\r
+// -1 on failure\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_Read(int socket, byte *buf, int len, struct sockaddr_s *addr)\r
+{\r
+ int addrlen = sizeof (struct sockaddr_s);\r
+ int ret;\r
+\r
+ if (addr)\r
+ {\r
+ ret = recvfrom(socket, buf, len, 0, (struct sockaddr *)addr, &addrlen);\r
+ if (ret == -1)\r
+ {\r
+// errno = WSAGetLastError();\r
+\r
+ if (errno == EAGAIN || errno == ENOTCONN)\r
+ return 0;\r
+ } //end if\r
+ } //end if\r
+ else\r
+ {\r
+ ret = recv(socket, buf, len, 0);\r
+ // if there's no data on the socket ret == -1 and errno == EAGAIN\r
+ // MSDN states that if ret == 0 the socket has been closed\r
+ // man recv doesn't say anything\r
+ if (ret == 0)\r
+ return -1;\r
+ if (ret == SOCKET_ERROR)\r
+ {\r
+// errno = WSAGetLastError();\r
+\r
+ if (errno == EAGAIN || errno == ENOTCONN)\r
+ return 0;\r
+ } //end if\r
+ } //end else\r
+ if (ret == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_Read: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ } //end if\r
+ return ret;\r
+} //end of the function WINS_Read\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_MakeSocketBroadcastCapable (int socket)\r
+{\r
+ int i = 1;\r
+\r
+ // make this socket broadcast capable\r
+ if (setsockopt(socket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i)) < 0)\r
+ return -1;\r
+ net_broadcastsocket = socket;\r
+\r
+ return 0;\r
+} //end of the function WINS_MakeSocketBroadcastCapable\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_Broadcast (int socket, byte *buf, int len)\r
+{\r
+ int ret;\r
+\r
+ if (socket != net_broadcastsocket)\r
+ {\r
+ if (net_broadcastsocket != 0)\r
+ WinError("Attempted to use multiple broadcasts sockets\n");\r
+ ret = WINS_MakeSocketBroadcastCapable (socket);\r
+ if (ret == -1)\r
+ {\r
+ WinPrint("Unable to make socket broadcast capable\n");\r
+ return ret;\r
+ }\r
+ }\r
+\r
+ return WINS_Write (socket, buf, len, &broadcastaddr);\r
+} //end of the function WINS_Broadcast\r
+//===========================================================================\r
+// returns qtrue on success or qfalse on failure\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_Write(int socket, byte *buf, int len, struct sockaddr_s *addr)\r
+{\r
+ int ret, written;\r
+\r
+ if (addr)\r
+ {\r
+ written = 0;\r
+ while(written < len)\r
+ {\r
+ ret = sendto (socket, &buf[written], len-written, 0, (struct sockaddr *)addr, sizeof(struct sockaddr_s));\r
+ if (ret == SOCKET_ERROR)\r
+ {\r
+ if (WSAGetLastError() != EAGAIN)\r
+ return qfalse;\r
+ //++timo FIXME: what is this used for?\r
+// Sleep(1000);\r
+ } //end if\r
+ else\r
+ {\r
+ written += ret;\r
+ }\r
+ }\r
+ } //end if\r
+ else\r
+ {\r
+ written = 0;\r
+ while(written < len)\r
+ {\r
+ ret = send(socket, buf, len, 0);\r
+ if (ret == SOCKET_ERROR)\r
+ {\r
+ if (WSAGetLastError() != EAGAIN)\r
+ return qfalse;\r
+ //++timo FIXME: what is this used for?\r
+// Sleep(1000);\r
+ } //end if\r
+ else\r
+ {\r
+ written += ret;\r
+ }\r
+ }\r
+ } //end else\r
+ if (ret == SOCKET_ERROR)\r
+ {\r
+ WinPrint("WINS_Write: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
+ } //end if\r
+ return (ret == len);\r
+} //end of the function WINS_Write\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+char *WINS_AddrToString (struct sockaddr_s *addr)\r
+{\r
+ static char buffer[22];\r
+ int haddr;\r
+\r
+ haddr = ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr);\r
+ sprintf(buffer, "%d.%d.%d.%d:%d", (haddr >> 24) & 0xff, (haddr >> 16) & 0xff, (haddr >> 8) & 0xff, haddr & 0xff, ntohs(((struct sockaddr_in *)addr)->sin_port));\r
+ return buffer;\r
+} //end of the function WINS_AddrToString\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_StringToAddr(char *string, struct sockaddr_s *addr)\r
+{\r
+ int ha1, ha2, ha3, ha4, hp;\r
+ int ipaddr;\r
+\r
+ sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp);\r
+ ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;\r
+\r
+ addr->sa_family = AF_INET;\r
+ ((struct sockaddr_in *)addr)->sin_addr.s_addr = htonl(ipaddr);\r
+ ((struct sockaddr_in *)addr)->sin_port = htons((u_short)hp);\r
+ return 0;\r
+} //end of the function WINS_StringToAddr\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_GetSocketAddr(int socket, struct sockaddr_s *addr)\r
+{\r
+ int addrlen = sizeof(struct sockaddr_s);\r
+ unsigned int a;\r
+\r
+ memset(addr, 0, sizeof(struct sockaddr_s));\r
+ getsockname(socket, (struct sockaddr *)addr, &addrlen);\r
+ a = ((struct sockaddr_in *)addr)->sin_addr.s_addr;\r
+ if (a == 0 || a == inet_addr("127.0.0.1"))\r
+ ((struct sockaddr_in *)addr)->sin_addr.s_addr = myAddr;\r
+\r
+ return 0;\r
+} //end of the function WINS_GetSocketAddr\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_GetNameFromAddr (struct sockaddr_s *addr, char *name)\r
+{\r
+ struct hostent *hostentry;\r
+\r
+ hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET);\r
+ if (hostentry)\r
+ {\r
+ strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1);\r
+ return 0;\r
+ }\r
+\r
+ strcpy (name, WINS_AddrToString (addr));\r
+ return 0;\r
+} //end of the function WINS_GetNameFromAddr\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_GetAddrFromName(char *name, struct sockaddr_s *addr)\r
+{\r
+ struct hostent *hostentry;\r
+\r
+ if (name[0] >= '0' && name[0] <= '9')\r
+ return PartialIPAddress (name, addr);\r
+ \r
+ hostentry = gethostbyname (name);\r
+ if (!hostentry)\r
+ return -1;\r
+\r
+ addr->sa_family = AF_INET;\r
+ ((struct sockaddr_in *)addr)->sin_port = htons((u_short)net_hostport);\r
+ ((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0];\r
+\r
+ return 0;\r
+} //end of the function WINS_GetAddrFromName\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_AddrCompare (struct sockaddr_s *addr1, struct sockaddr_s *addr2)\r
+{\r
+ if (addr1->sa_family != addr2->sa_family)\r
+ return -1;\r
+\r
+ if (((struct sockaddr_in *)addr1)->sin_addr.s_addr != ((struct sockaddr_in *)addr2)->sin_addr.s_addr)\r
+ return -1;\r
+\r
+ if (((struct sockaddr_in *)addr1)->sin_port != ((struct sockaddr_in *)addr2)->sin_port)\r
+ return 1;\r
+\r
+ return 0;\r
+} //end of the function WINS_AddrCompare\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_GetSocketPort (struct sockaddr_s *addr)\r
+{\r
+ return ntohs(((struct sockaddr_in *)addr)->sin_port);\r
+} //end of the function WINS_GetSocketPort\r
+//===========================================================================\r
+//\r
+// Parameter: -\r
+// Returns: -\r
+// Changes Globals: -\r
+//===========================================================================\r
+int WINS_SetSocketPort (struct sockaddr_s *addr, int port)\r
+{\r
+ ((struct sockaddr_in *)addr)->sin_port = htons((u_short)port);\r
+ return 0;\r
+} //end of the function WINS_SetSocketPort\r
+++ /dev/null
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
-*/\r
-\r
-//===========================================================================\r
-//\r
-// Name: l_net_wins.c\r
-// Function: WinSock\r
-// Programmer: MrElusive\r
-// Last update: TTimo: cross-platform version, l_net library\r
-// Tab Size: 2\r
-// Notes:\r
-//===========================================================================\r
-\r
-//#include <windows.h>\r
-#include <unistd.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include "l_net.h"\r
-#include "l_net_wins.h"\r
-\r
-#include <arpa/inet.h>\r
-#include <sys/types.h>\r
-#include <sys/socket.h>\r
-#include <sys/ioctl.h>\r
-#include <netinet/in.h>\r
-#include <netinet/tcp.h>\r
-#include <errno.h>\r
-#include <netdb.h>\r
-#define SOCKET_ERROR -1\r
-#define INVALID_SOCKET -1\r
-\r
-extern void WinPrint(char *str, ...);\r
-\r
-#define WinError WinPrint\r
-\r
-#define qtrue 1\r
-#define qfalse 0\r
-\r
-#define ioctlsocket ioctl\r
-#define closesocket close\r
-\r
-int WSAGetLastError()\r
-{\r
- return errno;\r
-}\r
-\r
-/*\r
-typedef struct tag_error_struct\r
-{\r
- int errnum;\r
- LPSTR errstr;\r
-} ERROR_STRUCT;\r
-*/\r
-\r
-typedef struct tag_error_struct\r
-{\r
- int errnum;\r
- const char *errstr;\r
-} ERROR_STRUCT;\r
-\r
-#define NET_NAMELEN 64\r
-\r
-static char my_tcpip_address[NET_NAMELEN];\r
-\r
-#define DEFAULTnet_hostport 26000\r
-\r
-#define MAXHOSTNAMELEN 256\r
-\r
-static int net_acceptsocket = -1; // socket for fielding new connections\r
-static int net_controlsocket;\r
-static int net_hostport; // udp port number for acceptsocket\r
-static int net_broadcastsocket = 0;\r
-//static qboolean ifbcastinit = qfalse;\r
-//static struct sockaddr_s broadcastaddr;\r
-static struct sockaddr_s broadcastaddr;\r
-\r
-static unsigned long myAddr;\r
-\r
-ERROR_STRUCT errlist[] = {\r
- {EACCES,"EACCES - The address is protected, user is not root"},\r
- {EAGAIN,"EAGAIN - Operation on non-blocking socket that cannot return immediatly"},\r
- {EBADF, "EBADF - sockfd is not a valid descriptor"},\r
- {EFAULT, "EFAULT - The parameter is not in a writable part of the user address space"},\r
- {EINVAL,"EINVAL - The socket is already bound to an address"},\r
- {ENOBUFS,"ENOBUFS - not enough memory"},\r
- {ENOMEM, "ENOMEM - not enough memory"},\r
- {ENOTCONN, "ENOTCONN - not connected"},\r
- {ENOTSOCK,"ENOTSOCK - Argument is file descriptor not a socket"},\r
- {EOPNOTSUPP,"ENOTSUPP - The referenced socket is not of type SOCK_STREAM"},\r
- {EPERM, "EPERM - Firewall rules forbid connection"},\r
- {-1, NULL}\r
-};\r
-\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-char *WINS_ErrorMessage(int error)\r
-{\r
- int search = 0;\r
-\r
- if (!error) return "No error occurred";\r
-\r
- for (search = 0; errlist[search].errstr; search++)\r
- {\r
- if (error == errlist[search].errnum)\r
- return (char *)errlist[search].errstr;\r
- } //end for\r
-\r
- return "Unknown error";\r
-} //end of the function WINS_ErrorMessage\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_Init(void)\r
-{\r
- int i;\r
- struct hostent *local;\r
- char buff[MAXHOSTNAMELEN];\r
- struct sockaddr_s addr;\r
- char *p;\r
- int r;\r
-/* \r
- linux doesn't have anything to initialize for the net\r
- "Windows .. built for the internet .. the internet .. built with unix" \r
- */\r
-#if 0\r
- WORD wVersionRequested; \r
-\r
- wVersionRequested = MAKEWORD(2, 2);\r
-\r
- r = WSAStartup (wVersionRequested, &winsockdata);\r
-\r
- if (r)\r
- {\r
- WinPrint("Winsock initialization failed.\n");\r
- return -1;\r
- }\r
-#endif\r
- /*\r
- i = COM_CheckParm ("-udpport");\r
- if (i == 0)*/\r
- net_hostport = DEFAULTnet_hostport;\r
- /*\r
- else if (i < com_argc-1)\r
- net_hostport = Q_atoi (com_argv[i+1]);\r
- else\r
- Sys_Error ("WINS_Init: you must specify a number after -udpport");\r
- */\r
-\r
- // determine my name & address\r
- gethostname(buff, MAXHOSTNAMELEN);\r
- local = gethostbyname(buff);\r
- myAddr = *(int *)local->h_addr_list[0];\r
-\r
- // if the quake hostname isn't set, set it to the machine name\r
-// if (Q_strcmp(hostname.string, "UNNAMED") == 0)\r
- {\r
- // see if it's a text IP address (well, close enough)\r
- for (p = buff; *p; p++)\r
- if ((*p < '0' || *p > '9') && *p != '.')\r
- break;\r
-\r
- // if it is a real name, strip off the domain; we only want the host\r
- if (*p)\r
- {\r
- for (i = 0; i < 15; i++)\r
- if (buff[i] == '.')\r
- break;\r
- buff[i] = 0;\r
- }\r
-// Cvar_Set ("hostname", buff);\r
- }\r
-\r
- //++timo WTF is that net_controlsocket? it's sole purpose is to retrieve the local IP?\r
- if ((net_controlsocket = WINS_OpenSocket (0)) == SOCKET_ERROR)\r
- WinError("WINS_Init: Unable to open control socket\n");\r
-\r
- ((struct sockaddr_in *)&broadcastaddr)->sin_family = AF_INET;\r
- ((struct sockaddr_in *)&broadcastaddr)->sin_addr.s_addr = INADDR_BROADCAST;\r
- ((struct sockaddr_in *)&broadcastaddr)->sin_port = htons((u_short)net_hostport);\r
-\r
- WINS_GetSocketAddr (net_controlsocket, &addr);\r
- strcpy(my_tcpip_address, WINS_AddrToString (&addr));\r
- p = strrchr (my_tcpip_address, ':');\r
- if (p) *p = 0;\r
- WinPrint("Winsock Initialized\n");\r
-\r
- return net_controlsocket;\r
-} //end of the function WINS_Init\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-char *WINS_MyAddress(void)\r
-{\r
- return my_tcpip_address;\r
-} //end of the function WINS_MyAddress\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-void WINS_Shutdown(void)\r
-{\r
- //WINS_Listen(0);\r
- WINS_CloseSocket(net_controlsocket);\r
-// WSACleanup();\r
- //\r
- WinPrint("Winsock Shutdown\n");\r
-} //end of the function WINS_Shutdown\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-/*\r
-void WINS_Listen(int state)\r
-{\r
- // enable listening\r
- if (state)\r
- {\r
- if (net_acceptsocket != -1)\r
- return;\r
- if ((net_acceptsocket = WINS_OpenSocket (net_hostport)) == -1)\r
- WinError ("WINS_Listen: Unable to open accept socket\n");\r
- return;\r
- }\r
-\r
- // disable listening\r
- if (net_acceptsocket == -1)\r
- return;\r
- WINS_CloseSocket (net_acceptsocket);\r
- net_acceptsocket = -1;\r
-} //end of the function WINS_Listen*/\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_OpenSocket(int port)\r
-{\r
- int newsocket;\r
- struct sockaddr_in address;\r
- u_long _true = 1;\r
-\r
- if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_OpenSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return -1;\r
- } //end if\r
-\r
- if (ioctlsocket (newsocket, FIONBIO, &_true) == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_OpenSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- closesocket(newsocket);\r
- return -1;\r
- } //end if\r
-\r
- memset((char *) &address, 0, sizeof(address));\r
- address.sin_family = AF_INET;\r
- address.sin_addr.s_addr = INADDR_ANY;\r
- address.sin_port = htons((u_short)port);\r
- if( bind (newsocket, (void *)&address, sizeof(address)) == -1)\r
- {\r
- WinPrint("WINS_OpenSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- closesocket(newsocket);\r
- return -1;\r
- } //end if\r
-\r
- return newsocket;\r
-} //end of the function WINS_OpenSocket\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_OpenReliableSocket(int port)\r
-{\r
- int newsocket;\r
- struct sockaddr_in address;\r
- qboolean _true = 0xFFFFFFFF;\r
-\r
- //IPPROTO_TCP\r
- //\r
- if ((newsocket = socket(AF_INET, SOCK_STREAM, 0)) == -1)\r
- {\r
- WinPrint("WINS_OpenReliableSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return -1;\r
- } //end if\r
-\r
- memset((char *) &address, 0, sizeof(address));\r
- address.sin_family = AF_INET;\r
- address.sin_addr.s_addr = htonl(INADDR_ANY);\r
- address.sin_port = htons((u_short)port);\r
- if (bind(newsocket, (void *)&address, sizeof(address)) == -1)\r
- {\r
- WinPrint("WINS_OpenReliableSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- closesocket(newsocket);\r
- return -1;\r
- } //end if\r
-\r
- //\r
- if (setsockopt(newsocket, IPPROTO_TCP, TCP_NODELAY, (void *) &_true, sizeof(int)) == -1)\r
- {\r
- WinPrint("WINS_OpenReliableSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- WinPrint("setsockopt error\n");\r
- } //end if\r
-\r
- return newsocket;\r
-} //end of the function WINS_OpenReliableSocket\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_Listen(int socket)\r
-{\r
- u_long _true = 1;\r
-\r
- if (ioctlsocket(socket, FIONBIO, &_true) == -1)\r
- {\r
- WinPrint("WINS_Listen: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return -1;\r
- } //end if\r
- if (listen(socket, SOMAXCONN) == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_Listen: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return -1;\r
- } //end if\r
- return 0;\r
-} //end of the function WINS_Listen\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_Accept(int socket, struct sockaddr_s *addr)\r
-{\r
- int addrlen = sizeof (struct sockaddr_s);\r
- int newsocket;\r
- qboolean _true = 1;\r
-\r
- newsocket = accept(socket, (struct sockaddr *)addr, &addrlen);\r
- if (newsocket == INVALID_SOCKET)\r
- {\r
- if (errno == EAGAIN) return -1;\r
- WinPrint("WINS_Accept: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return -1;\r
- } //end if\r
- //\r
- if (setsockopt(newsocket, IPPROTO_TCP, TCP_NODELAY, (void *) &_true, sizeof(int)) == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_Accept: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- WinPrint("setsockopt error\n");\r
- } //end if\r
- return newsocket;\r
-} //end of the function WINS_Accept\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_CloseSocket(int socket)\r
-{\r
- /*\r
- if (socket == net_broadcastsocket)\r
- net_broadcastsocket = 0;\r
- */\r
-// shutdown(socket, SD_SEND);\r
-\r
- if (closesocket(socket) == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_CloseSocket: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return SOCKET_ERROR;\r
- } //end if\r
- return 0;\r
-} //end of the function WINS_CloseSocket\r
-//===========================================================================\r
-// this lets you type only as much of the net address as required, using\r
-// the local network components to fill in the rest\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-static int PartialIPAddress (char *in, struct sockaddr_s *hostaddr)\r
-{\r
- char buff[256];\r
- char *b;\r
- int addr;\r
- int num;\r
- int mask;\r
- \r
- buff[0] = '.';\r
- b = buff;\r
- strcpy(buff+1, in);\r
- if (buff[1] == '.') b++;\r
-\r
- addr = 0;\r
- mask=-1;\r
- while (*b == '.')\r
- {\r
- num = 0;\r
- if (*++b < '0' || *b > '9') return -1;\r
- while (!( *b < '0' || *b > '9'))\r
- num = num*10 + *(b++) - '0';\r
- mask<<=8;\r
- addr = (addr<<8) + num;\r
- }\r
- \r
- hostaddr->sa_family = AF_INET;\r
- ((struct sockaddr_in *)hostaddr)->sin_port = htons((u_short)net_hostport);\r
- ((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr);\r
- \r
- return 0;\r
-} //end of the function PartialIPAddress\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_Connect(int socket, struct sockaddr_s *addr)\r
-{\r
- int ret;\r
- u_long _true2 = 0xFFFFFFFF;\r
-\r
- ret = connect(socket, (struct sockaddr *)addr, sizeof(struct sockaddr_s));\r
- if (ret == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_Connect: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return -1;\r
- } //end if\r
- if (ioctlsocket(socket, FIONBIO, &_true2) == -1)\r
- {\r
- WinPrint("WINS_Connect: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- return -1;\r
- } //end if\r
- return 0;\r
-} //end of the function WINS_Connect\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_CheckNewConnections(void)\r
-{\r
- char buf[4];\r
-\r
- if (net_acceptsocket == -1)\r
- return -1;\r
-\r
- if (recvfrom(net_acceptsocket, buf, 4, MSG_PEEK, NULL, NULL) > 0)\r
- return net_acceptsocket;\r
- return -1;\r
-} //end of the function WINS_CheckNewConnections\r
-//===========================================================================\r
-// returns the number of bytes read\r
-// 0 if no bytes available\r
-// -1 on failure\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_Read(int socket, byte *buf, int len, struct sockaddr_s *addr)\r
-{\r
- int addrlen = sizeof (struct sockaddr_s);\r
- int ret;\r
-\r
- if (addr)\r
- {\r
- ret = recvfrom(socket, buf, len, 0, (struct sockaddr *)addr, &addrlen);\r
- if (ret == -1)\r
- {\r
-// errno = WSAGetLastError();\r
-\r
- if (errno == EAGAIN || errno == ENOTCONN)\r
- return 0;\r
- } //end if\r
- } //end if\r
- else\r
- {\r
- ret = recv(socket, buf, len, 0);\r
- // if there's no data on the socket ret == -1 and errno == EAGAIN\r
- // MSDN states that if ret == 0 the socket has been closed\r
- // man recv doesn't say anything\r
- if (ret == 0)\r
- return -1;\r
- if (ret == SOCKET_ERROR)\r
- {\r
-// errno = WSAGetLastError();\r
-\r
- if (errno == EAGAIN || errno == ENOTCONN)\r
- return 0;\r
- } //end if\r
- } //end else\r
- if (ret == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_Read: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- } //end if\r
- return ret;\r
-} //end of the function WINS_Read\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_MakeSocketBroadcastCapable (int socket)\r
-{\r
- int i = 1;\r
-\r
- // make this socket broadcast capable\r
- if (setsockopt(socket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i)) < 0)\r
- return -1;\r
- net_broadcastsocket = socket;\r
-\r
- return 0;\r
-} //end of the function WINS_MakeSocketBroadcastCapable\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_Broadcast (int socket, byte *buf, int len)\r
-{\r
- int ret;\r
-\r
- if (socket != net_broadcastsocket)\r
- {\r
- if (net_broadcastsocket != 0)\r
- WinError("Attempted to use multiple broadcasts sockets\n");\r
- ret = WINS_MakeSocketBroadcastCapable (socket);\r
- if (ret == -1)\r
- {\r
- WinPrint("Unable to make socket broadcast capable\n");\r
- return ret;\r
- }\r
- }\r
-\r
- return WINS_Write (socket, buf, len, &broadcastaddr);\r
-} //end of the function WINS_Broadcast\r
-//===========================================================================\r
-// returns qtrue on success or qfalse on failure\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_Write(int socket, byte *buf, int len, struct sockaddr_s *addr)\r
-{\r
- int ret, written;\r
-\r
- if (addr)\r
- {\r
- written = 0;\r
- while(written < len)\r
- {\r
- ret = sendto (socket, &buf[written], len-written, 0, (struct sockaddr *)addr, sizeof(struct sockaddr_s));\r
- if (ret == SOCKET_ERROR)\r
- {\r
- if (WSAGetLastError() != EAGAIN)\r
- return qfalse;\r
- //++timo FIXME: what is this used for?\r
-// Sleep(1000);\r
- } //end if\r
- else\r
- {\r
- written += ret;\r
- }\r
- }\r
- } //end if\r
- else\r
- {\r
- written = 0;\r
- while(written < len)\r
- {\r
- ret = send(socket, buf, len, 0);\r
- if (ret == SOCKET_ERROR)\r
- {\r
- if (WSAGetLastError() != EAGAIN)\r
- return qfalse;\r
- //++timo FIXME: what is this used for?\r
-// Sleep(1000);\r
- } //end if\r
- else\r
- {\r
- written += ret;\r
- }\r
- }\r
- } //end else\r
- if (ret == SOCKET_ERROR)\r
- {\r
- WinPrint("WINS_Write: %s\n", WINS_ErrorMessage(WSAGetLastError()));\r
- } //end if\r
- return (ret == len);\r
-} //end of the function WINS_Write\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-char *WINS_AddrToString (struct sockaddr_s *addr)\r
-{\r
- static char buffer[22];\r
- int haddr;\r
-\r
- haddr = ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr);\r
- sprintf(buffer, "%d.%d.%d.%d:%d", (haddr >> 24) & 0xff, (haddr >> 16) & 0xff, (haddr >> 8) & 0xff, haddr & 0xff, ntohs(((struct sockaddr_in *)addr)->sin_port));\r
- return buffer;\r
-} //end of the function WINS_AddrToString\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_StringToAddr(char *string, struct sockaddr_s *addr)\r
-{\r
- int ha1, ha2, ha3, ha4, hp;\r
- int ipaddr;\r
-\r
- sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp);\r
- ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;\r
-\r
- addr->sa_family = AF_INET;\r
- ((struct sockaddr_in *)addr)->sin_addr.s_addr = htonl(ipaddr);\r
- ((struct sockaddr_in *)addr)->sin_port = htons((u_short)hp);\r
- return 0;\r
-} //end of the function WINS_StringToAddr\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_GetSocketAddr(int socket, struct sockaddr_s *addr)\r
-{\r
- int addrlen = sizeof(struct sockaddr_s);\r
- unsigned int a;\r
-\r
- memset(addr, 0, sizeof(struct sockaddr_s));\r
- getsockname(socket, (struct sockaddr *)addr, &addrlen);\r
- a = ((struct sockaddr_in *)addr)->sin_addr.s_addr;\r
- if (a == 0 || a == inet_addr("127.0.0.1"))\r
- ((struct sockaddr_in *)addr)->sin_addr.s_addr = myAddr;\r
-\r
- return 0;\r
-} //end of the function WINS_GetSocketAddr\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_GetNameFromAddr (struct sockaddr_s *addr, char *name)\r
-{\r
- struct hostent *hostentry;\r
-\r
- hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET);\r
- if (hostentry)\r
- {\r
- strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1);\r
- return 0;\r
- }\r
-\r
- strcpy (name, WINS_AddrToString (addr));\r
- return 0;\r
-} //end of the function WINS_GetNameFromAddr\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_GetAddrFromName(char *name, struct sockaddr_s *addr)\r
-{\r
- struct hostent *hostentry;\r
-\r
- if (name[0] >= '0' && name[0] <= '9')\r
- return PartialIPAddress (name, addr);\r
- \r
- hostentry = gethostbyname (name);\r
- if (!hostentry)\r
- return -1;\r
-\r
- addr->sa_family = AF_INET;\r
- ((struct sockaddr_in *)addr)->sin_port = htons((u_short)net_hostport);\r
- ((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0];\r
-\r
- return 0;\r
-} //end of the function WINS_GetAddrFromName\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_AddrCompare (struct sockaddr_s *addr1, struct sockaddr_s *addr2)\r
-{\r
- if (addr1->sa_family != addr2->sa_family)\r
- return -1;\r
-\r
- if (((struct sockaddr_in *)addr1)->sin_addr.s_addr != ((struct sockaddr_in *)addr2)->sin_addr.s_addr)\r
- return -1;\r
-\r
- if (((struct sockaddr_in *)addr1)->sin_port != ((struct sockaddr_in *)addr2)->sin_port)\r
- return 1;\r
-\r
- return 0;\r
-} //end of the function WINS_AddrCompare\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_GetSocketPort (struct sockaddr_s *addr)\r
-{\r
- return ntohs(((struct sockaddr_in *)addr)->sin_port);\r
-} //end of the function WINS_GetSocketPort\r
-//===========================================================================\r
-//\r
-// Parameter: -\r
-// Returns: -\r
-// Changes Globals: -\r
-//===========================================================================\r
-int WINS_SetSocketPort (struct sockaddr_s *addr, int port)\r
-{\r
- ((struct sockaddr_in *)addr)->sin_port = htons((u_short)port);\r
- return 0;\r
-} //end of the function WINS_SetSocketPort\r
\r
// seems to be required for str.h\r
#include <glib.h>\r
+#include <glib/gstdio.h>\r
\r
#include "synapse.h"\r
#if defined (__linux__) || defined (__APPLE__)\r
<Filter Name="Code">\r
<File RelativePath=".\bp_dlg.cpp">\r
</File>\r
- <File RelativePath=".\BRUSH.cpp">\r
+ <File RelativePath=".\brush.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\CSG.cpp">\r
+ <File RelativePath=".\csg.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\DIALOG.cpp">\r
+ <File RelativePath=".\dialog.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\DRAG.cpp">\r
+ <File RelativePath=".\drag.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\ECLASS.cpp">\r
+ <File RelativePath=".\eclass.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
<File RelativePath=".\error.cpp">\r
</File>\r
- <File RelativePath=".\FILE.cpp">\r
+ <File RelativePath=".\file.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
<File RelativePath=".\glwidget.cpp">\r
</File>\r
- <File RelativePath=".\GLWINDOW.cpp">\r
+ <File RelativePath=".\glwindow.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\GTKMISC.cpp">\r
+ <File RelativePath=".\gtkmisc.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\MAIN.cpp">\r
+ <File RelativePath=".\main.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\MAP.cpp">\r
+ <File RelativePath=".\map.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\MISSING.cpp">\r
+ <File RelativePath=".\missing.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\PARSE.cpp">\r
+ <File RelativePath=".\parse.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\PMESH.cpp">\r
+ <File RelativePath=".\pmesh.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\POINTS.cpp">\r
+ <File RelativePath=".\points.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\PROFILE.cpp">\r
+ <File RelativePath=".\profile.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\QE3.cpp">\r
+ <File RelativePath=".\qe3.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
<File RelativePath=".\qgl_ext.cpp">\r
</File>\r
- <File RelativePath=".\SELECT.cpp">\r
+ <File RelativePath=".\select.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
<File RelativePath=".\ui.cpp">\r
</File>\r
- <File RelativePath=".\UNDO.cpp">\r
+ <File RelativePath=".\undo.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\VERTSEL.cpp">\r
+ <File RelativePath=".\vertsel.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\WINDING.cpp">\r
+ <File RelativePath=".\winding.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\XYWINDOW.cpp">\r
+ <File RelativePath=".\xywindow.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\Z.cpp">\r
+ <File RelativePath=".\z.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</File>\r
- <File RelativePath=".\ZWINDOW.cpp">\r
+ <File RelativePath=".\zwindow.cpp">\r
<FileConfiguration Name="Debug|Win32">\r
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PrecompiledHeaderThrough="stdafx.h" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"/>\r
</FileConfiguration>\r
</Files>\r
<Globals>\r
</Globals>\r
-</VisualStudioProject>
\ No newline at end of file
+</VisualStudioProject>\r
--- /dev/null
+# -*- mode: python -*-\r
+# QuakeZero build scripts\r
+# TTimo <ttimo@idsoftware.com>\r
+# http://scons.sourceforge.net\r
+\r
+import os, commands, platform, xml.sax, re, string\r
+\r
+class vcproj( xml.sax.handler.ContentHandler ):\r
+ def __init__( self, filepath ):\r
+ self.source_files = []\r
+ self.misc_files = []\r
+ self._files = []\r
+ print 'parse %s' % filepath\r
+ xml.sax.parse( filepath, self )\r
+\r
+ def getSourceFiles( self ):\r
+ return self.source_files\r
+\r
+ def filterSource( self, expression, filelist = None ):\r
+ if ( filelist is None ):\r
+ filelist = self.source_files\r
+ match = []\r
+ nomatch = []\r
+ for s in filelist:\r
+ if ( re.match( expression, s ) ):\r
+ match.append( s )\r
+ else:\r
+ nomatch.append( s )\r
+ return ( match, nomatch )\r
+\r
+ def startElement( self, name, attrs ):\r
+ if ( name == 'File' ):\r
+ self._files.append( attrs.getValue('RelativePath') )\r
+\r
+ def endDocument( self ):\r
+ # split into source and headers, remap path seperator to the platform\r
+ for f in self._files:\r
+ if ( platform.system() != 'Windows' ):\r
+ f = f.replace( '\\', '/' )\r
+ if ( f[-2:] == '.c' or f[-4:] == '.cpp' ):\r
+ self.source_files.append( f.encode('ascii') )\r
+ else:\r
+ self.misc_files.append( f )\r
+ print '%d source files' % len( self.source_files )\r
+\r
+# action uses LDD to verify that the source doesn't hold unresolved symbols\r
+# setup as an AddPostAction of a regular SharedLibrary call\r
+def CheckUnresolved( source, target, env ):\r
+ print 'CheckUnresolved %s' % target[0].abspath\r
+ if ( not os.path.isfile( target[0].abspath ) ):\r
+ print 'CheckUnresolved: %s does not exist' % target[0]\r
+ return 1 # fail\r
+ ( status, output ) = commands.getstatusoutput( 'ldd -r %s' % target[0] )\r
+ if ( status != 0 ):\r
+ print 'CheckUnresolved: ldd command failed (exit code %d)' % status\r
+ os.system( 'rm %s' % target[ 0 ] )\r
+ return 1 # fail\r
+ lines = string.split( output, '\n' )\r
+ have_undef = 0\r
+ for i_line in lines:\r
+ regex = re.compile('undefined symbol: (.*)\t\\((.*)\\)')\r
+ if ( regex.match( i_line ) ):\r
+ symbol = regex.sub( '\\1', i_line )\r
+ try:\r
+ env['ALLOWED_SYMBOLS'].index( symbol )\r
+ except:\r
+ have_undef = 1\r
+ if ( have_undef ):\r
+ print output\r
+ print "CheckUnresolved: undefined symbols"\r
+ os.system('rm %s' % target[0])\r
+ return 1\r
+\r
+# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486\r
+\r
+def Enum(*names):\r
+ ##assert names, "Empty enums are not supported" # <- Don't like empty enums? Uncomment!\r
+\r
+ class EnumClass(object):\r
+ __slots__ = names\r
+ def __iter__(self): return iter(constants)\r
+ def __len__(self): return len(constants)\r
+ def __getitem__(self, i): return constants[i]\r
+ def __repr__(self): return 'Enum' + str(names)\r
+ def __str__(self): return 'enum ' + str(constants)\r
+\r
+ class EnumValue(object):\r
+ __slots__ = ('__value')\r
+ def __init__(self, value): self.__value = value\r
+ Value = property(lambda self: self.__value)\r
+ EnumType = property(lambda self: EnumType)\r
+ def __hash__(self): return hash(self.__value)\r
+ def __cmp__(self, other):\r
+ # C fans might want to remove the following assertion\r
+ # to make all enums comparable by ordinal value {;))\r
+ assert self.EnumType is other.EnumType, "Only values from the same enum are comparable"\r
+ return cmp(self.__value, other.__value)\r
+ def __invert__(self): return constants[maximum - self.__value]\r
+ def __nonzero__(self): return bool(self.__value)\r
+ def __repr__(self): return str(names[self.__value])\r
+\r
+ maximum = len(names) - 1\r
+ constants = [None] * len(names)\r
+ for i, each in enumerate(names):\r
+ val = EnumValue(i)\r
+ setattr(EnumClass, each, val)\r
+ constants[i] = val\r
+ constants = tuple(constants)\r
+ EnumType = EnumClass()\r
+ return EnumType\r
+\r
+#if __name__ == '__main__':\r
+# print '\n*** Enum Demo ***'\r
+# print '--- Days of week ---'\r
+# Days = Enum('Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su')\r
+# print Days\r
+# print Days.Mo\r
+# print Days.Fr\r
+# print Days.Mo < Days.Fr\r
+# print list(Days)\r
+# for each in Days:\r
+# print 'Day:', each\r
+# print '--- Yes/No ---'\r
+# Confirmation = Enum('No', 'Yes')\r
+# answer = Confirmation.No\r
+# print 'Your answer is not', ~answer\r
+\r