Commit Graph

123 Commits

Author SHA1 Message Date
7790fd7d29 Removes duplication of Clamp function.
Reviewed By: wraitii
Commented By: Stan
Differential Revision: https://code.wildfiregames.com/D1763
This was SVN commit r23002.
2019-09-26 21:14:21 +00:00
43137fef3f Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c).
Differential Revision: https://code.wildfiregames.com/D716
Refs 09e974e1cb
Reviewed By: bb
Change in agreement with leper.

This was SVN commit r19899.
2017-07-10 14:26:24 +00:00
b18f74da44 Remove trailing whitespace and whitespace in empty lines of source/ except source/third_party/.
This was SVN commit r18987.
2016-11-23 11:18:37 +00:00
85a1f880ab Fix compatibility with LLVM libc++ (used on OS X).
libc++ vector asserts that allocator::value_type is correct, so we have
to pass in the correct types.

This was SVN commit r15231.
2014-05-26 16:48:28 +00:00
0720025073 cleanup
reduce dependency on PCH. move KiB constants to alignment, ARRAY_SIZE to
code_annotation.h.
move glext_funcs.h to external_libraries/glext_funcs.h, move part of
ogl.h to external_libraries/opengl.h
remove unused saturating arithmetic functions

This was SVN commit r9363.
2011-04-30 13:22:46 +00:00
4663ac0fe7 split debug_assert into ENSURE and ASSERT as discussed in a previous meeting.
the old debug_assert always ran and tested the expression, which slows
down release builds. wrapping them in #ifndef NDEBUG is clumsy. the new
ASSERT behaves like assert and ENSURE like the old debug_assert. Let's
change any time-critical but not-super-important ENSURE to ASSERT to
speed up release builds. (already done in bits.h and unique_range.h)

This was SVN commit r9362.
2011-04-30 13:01:45 +00:00
a0a245d0ec sync with work. add u8_from_larger, sys_IsDebuggerPresent, wdll_main.h;
robustify waio file mode and remove a safety check (since
OVERLAPPED.Internal is documented to be subject to change)

This was SVN commit r9050.
2011-03-11 16:29:27 +00:00
f79056efbd fix CPU topology problem under VMs reported by Philip (update workspaces required)
also moved lib.h's code generation macros into a separate file to break
a circular dependency with lib.h's use of debug_assert, and added a stub
implementation of sysdep/numa.h

This was SVN commit r7808.
2010-07-25 17:10:57 +00:00
ef602c3dfd fixes/improvements from work
- improved form of noncopyable that avoids inheritance warnings
- PCH updates to allow more restrictive MINIMAL_PCH
sound/SoundGroup.cpp: fix copy-paste error

This was SVN commit r7498.
2010-05-03 12:27:39 +00:00
b4f680594b fixes from work:
- correct AllocateAligned deleter and alignment value
- workaround for boost #pragma pack warnings
add DivideRoundUp

This was SVN commit r7439.
2010-04-06 12:06:02 +00:00
1861448e6c needed to split lib into separate headers and source files, which requires lots of drudgery to specify paths for each include filename (no longer relying on same-directory lookups)
also rename wchar -> utf8 to avoid conflict with <wchar.h> (requires
rebuild of workspace)
(unfortunately copying history fails to "502 bad gateway"; had to delete
old + add new independently)

This was SVN commit r7340.
2010-03-01 14:52:58 +00:00
c2fd939898 license change to the more permissible Expat/MIT license for lib/ (see forum thread)
This was SVN commit r7316.
2010-02-08 16:23:39 +00:00
a46f3432f3 harmless changes in preparation for moving to unicode
ia32: fix: ia32_GetCallTarget wasn't always initializing target
x86_x64: use macro implementation for rdtsc to reduce timing overhead

This was SVN commit r7160.
2009-11-03 16:30:21 +00:00
1743645fd3 Simplify the overly-complex CppDoc-breaking file headers
This was SVN commit r6832.
2009-04-18 17:51:05 +00:00
214b0e6683 Removed outdated licensing information
This was SVN commit r6831.
2009-04-18 17:17:34 +00:00
c9fa7f13d9 Add GPL header
This was SVN commit r6830.
2009-04-18 17:00:33 +00:00
c0ed950657 had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).

it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.

after several hours, the code now requires fewer casts and less
guesswork.

other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.

This was SVN commit r5942.
2008-05-11 18:48:32 +00:00
41d3ef5fa5 Fix compile on GCC 4.1, where the ArraySize function trick did not work.
This was SVN commit r5418.
2007-10-17 07:36:12 +00:00
8a92304b25 better ARRAY_SIZE macro that refuses to compile when passed a pointer.
this prevents bugs along the lines of the recently reported
StringStripper issue.

This was SVN commit r5381.
2007-10-01 19:12:59 +00:00
d478e21f2b Linux compatibility
This was SVN commit r5092.
2007-05-26 16:39:26 +00:00
452d67f0b7 # vista compat (fixes wsnd issue) and improvements
lib: move IsSimilarMagnitude and downcasters here from single modules
where they're used
acpi: simplify by only using v1.0 or 2.0 tables
snd: add note on why OpenAL can't be used
mahaf: change prefix
wcpu: cache results, reinstate wcpu_ClockFrequency
win: add winreg.h for registry functions
wsnd: only do the DSound thing on non-vista (and delay-load to avoid
overhead)
wutil: add code to correctly detect windows version

This was SVN commit r5090.
2007-05-26 15:34:10 +00:00
cded0936c5 # housekeeping
. update moduleInit mechanism and move it out of lib.cpp. now has a
thread-safe reference count and allows repeated init/shutdown (required
for self-tests)
. vfs now depends on h_mgr; h_mgr need therefore no longer explicitly be
shutdown (e.g. in self-tests)
. acpi: minor fixes
. cpu: AtomicAdd and CAS now take volatile variable (safer)
. mahaf: unload driver on shutdown (did this for DriverVerifier, but
it's 'cleaner' in general)
. wdbg_sym
. wfilesystem: get rid of manual declarations of deprecated functions;
implement them via trampoline instead

This was SVN commit r5086.
2007-05-21 23:24:56 +00:00
9d2acce9d8 # SwEng/cleanup
- deleted most old libraries/headers in codepit to avoid confusion (they
are now in SVN anyway). updated required-libraries-linux.txt accordingly
- moved rand() into separate file, out of lib.cpp
- removed CGUIScrollBarStyle.cpp to avoid empty-file warning
- wxwidgets.h: remove redundant #pragma lib and include wxw PCH
- move openal-specific stuff to external_libraries/openal.h
- cpu, bsd: macosx is-a bsd, so only test OS_BSD

This was SVN commit r5082.
2007-05-18 00:14:26 +00:00
a34b759720 . split up lib.h/.cpp, include the remnants from PCH, remove (pretty much universal) include of it.
. timer, config: fix definition of ALLOW_RDTSC
. add movsx_be64 (for whirlpool), revise implementation, move to
byte_order, add test
. MAX -> std::max, remove those macros
. add timestamp to system_info as requested by philip

This was SVN commit r5050.
2007-05-09 21:01:11 +00:00
b755ddefda remove all author/modified by tags.
make include guards consistent.

This was SVN commit r5040.
2007-05-07 16:33:24 +00:00
4be0fe18a0 # SwEng
. major compat fixes for interoperation with wxw.
. add crashlog_sender (modified version of debgrpt wxw sample). compiles
but untested, will be changed heavily
further improvements:
. wposix no longer declares CRT functions. instead, use CRT headers..
but don't allow their (incorrect/non-POSIX) declarations to propagate to
users.
. split up win.cpp into wstartup, wutil, winit
. extern "C" -> EXTERN_C
. move sdl.* to lib/external_libraries and add png.h+zlib.h (fixes for
and include of the library)

This was SVN commit r5028.
2007-05-04 17:30:32 +00:00
5a427440d0 #SwEng
fpclassify fix
EntityManager: rename getExtant -> GetExtantAsHandles, fix its
implementation+call site to avoid dynamic alloc/auto ptr, rename extant
-> IsExtant
vsnprintf2 -> sys_vsnprintf. remove printf.h (function is declared in
sysdep header)
use SUS/posix-ish strcasecmp instead of defining that to the
windows-only stricmp
add cppdoc for ia32/cpu

This was SVN commit r5011.
2007-04-30 19:58:04 +00:00
be3f3bdbfb # SwEng / MacOSX compat
further cleanup to sysdep.h: avoid pulling in win and ia32; split header
up into stl, compiler, and the actual sys_* API. (all but the latter are
in PCH).

timer: also avoid dragging in ia32
win: move snprintf fix to posix.h
cpu: simplify reasoning about cores, now given as logicalPerCore (not
package)
vfs_optimizer: fix if archive building is partially disabled

This was SVN commit r5008.
2007-04-30 14:35:19 +00:00
e8a0626248 # improvements to foundation code
(merged in from thesis project branch)

allocator: remember page-aligned size (prevent resize error)
config, sysdep, lib: add implementation of wcsdup for macosX
path_util: add path_package_copy and cleanup
file: add dir_exists, dir_create uses _mkdir (avoids mode_t param)

This was SVN commit r4984.
2007-04-22 16:43:54 +00:00
27b6ffe2d6 # housekeeping
sorry, update-workspaces + rebuild is necessary (moved boost/utility
into PCH)

- ps/ : committed additional documentation on behalf of Joe.
- lib/ : HAVE_C99 - replace with specific e.g. HAVE_NPRINTF; intended to
help with MacOSX compat (by no longer requiring us to lie about
STDC_VERSION)
- NO_COPY_CTOR -> boost::noncopyable

This was SVN commit r4825.
2007-02-01 01:34:17 +00:00
0bb0df5b2c # new year's cleanup (reduce dependencies, clean up headers)
- remove headers always included from PCH
- nommgr.h is only included ifdef REDEFINED_NEW (allows leaving out the
mmgr stuff)
- in lib/*.cpp, moved the corresponding include file to right behind the
PCH (catches headers that aren't compilable by themselves)
- byte_order no longer depends on SDL
- add debug_level (another means of filtering debug output; needed for
thesis)
- split posix stuff up into subdirs (lib/posix and sysdep/win/wposix).
makes including only some of the modules (e.g. sockets, time) much
easier.

This was SVN commit r4728.
2007-01-01 21:25:47 +00:00
e3e0d513b5 # minor fixes exposed by ICC 9.0 warnings
This was SVN commit r4701.
2006-12-17 00:49:09 +00:00
b4cf155040 # fix 2 problems with self-test on linux (lock-free init and path separator test)
fixes #159
fixes #160

lib: add moduleInit helpers (centralizes a bit of code and saves typing;
sorry for the recompile)
path_util: allow '\\' as separator (see rationale there)
lockfree.cpp: use moduleInit, no longer rely on type/value of
pthread_key_t (which was a hack)

This was SVN commit r4635.
2006-11-11 17:46:41 +00:00
714e436e3c Made AT_STARTUP use an unnamed namespace, to avoid collisions between structs in different files that happen to have the same name (which sometimes causes the constructors to get mixed up by the linker)
This was SVN commit r4378.
2006-09-23 00:01:00 +00:00
871cdb6ef9 # SwEng (reduce full recompiles by splitting up master error header)
- error codes now accessed as ERR::NO_MEM, INFO::OK etc.
- no more X-macros => the above are now recognized by visual assist
- error codes are defined by the module originating them (lib_errors has
some generic ones)
  => no full rebuild when adding some
- error descriptions are now in C++ files => can be changed without full
rebuild

added AT_STARTUP in lib.h.

This was SVN commit r4374.
2006-09-22 13:19:40 +00:00
6a7ee226f0 Restored Windows compatibility (and hopefully didn't break OS X compatibility).
Fixed copy-constructor-generation warnings in VS2003.

This was SVN commit r4232.
2006-08-21 21:27:12 +00:00
7e3265899c # fix errors in self-tests and the code they test. all now run through.
(archive_builder and compression tests are disabled ATM)

also fixed some compile warnings inside cxxtest.

refs #117

This was SVN commit r4021.
2006-06-24 10:44:08 +00:00
ee4c7965dd # merge all local changes; moving over to new SVN server
* app_hooks: add display_error; can be used by atlas to override our
dialog box
* lots of small fixes (mostly pertaining to headers)
* debug: clean up display_error, protect from reentrancy, fix a few edge
cases (e.g. error message from dtor -> exit pressed -> suppress all
subsequent errors)
* delay_load: add warning: NLSO ctors are unreliable since we're
compiling into static lib

This was SVN commit r4009.
2006-06-22 18:26:08 +00:00
5f7855f7f0 Simplification of #Include paths: relative names are used only for included files in the same directory as the including file; everything else uses the full path relative to source/.
This was SVN commit r3930.
2006-06-02 02:10:27 +00:00
1ead202b24 # add CppDoc comments; prepare for automated testing
ia32: prepend CPUCap enum names and rdtsc with ia32 to avoid conflicts.
move all self tests into separate headers as required for Cxxtest.
adts: remove some dead code.

add CppDoc comments to debug, lib (with heavy cleanup), tex, tex_codec,
snd_mgr
slight improvements to path

tex: refactor; split out tex_decode and encode to allow self-test

This was SVN commit r3911.
2006-05-31 04:01:59 +00:00
2db8963039 # big VFS update: laid groundwork for running as non-admin; move XMB files into separate directory tree
^ actually that was last revision, but forgot this there :P

housekeeping/cleanup of smaller issues I noticed while working:
lib: add NO_COPY_CTOR macro
lib_errors: fix descriptions, rename
INFO_ALREADY_PRESENT->INFO_ALREADY_EXISTS

* refactor "is valid VFS dir" to VFS_PATH_IS_DIR macro
* remove some scaffolding
* update docs
* scour all VFS APIs, make sure they receive valid VFS dir paths

second try for Trac notification:
closes #79
closes #80

This was SVN commit r3876.
2006-05-17 16:47:49 +00:00
3d26549032 Fixed file properties - removed svn:executable and svn:keywords (left over from CVS conversion?) from all files; set svn:eol-style=native for *.cpp, *.h (and fixed files with inconsistent line endings)
This was SVN commit r3802.
2006-04-23 23:14:18 +00:00
836cd08d5e # add CppDoc file header to all files, along with their descriptions.
also:
- renamed wdll to delay_load, and wdll_ver to dll_ver
- removed empty wcpu

This was SVN commit r3751.
2006-04-11 23:59:08 +00:00
6eac18d9fe # housekeeping (improve unreachable code annotations and avoid compiler warnings)
adts: use SAFE_FREE
config: add CONFIG_FINAL; use it in
compression,vfs_optimizer,scriptablecomplex
lib: add discussion of unreachable code avoidance; revise UNREACHABLE
and add NODEFAULT
ogl_tex, tex_dds: remove some unnecessary UNREACHABLE
sysdep: move compiler-specific implementation of UNREACHABLE here.
use NODEFAULT in snd, wdbg, wposix, wsdl

This was SVN commit r3739.
2006-04-10 06:44:54 +00:00
8371f42da9 # IO bugfixes and improvements; more support for cache/seek measurements
adts: slight improvements
allocators: change POOL_VARIABLE_ALLOCS to -1 for safety; fix invalid
assumptions of it being 0
lib: more expressive param names
file: add file_get_random_name for randomized trace generation; allow
file_cache.h to declare externally visible file_buf_alloc API

file_cache: zero-length file bugfix; also add several flags to the API
routines allowing statistics gathering to be disabled (avoids distorting
stats due to e.g. trace_entry_causes_io cache simulation)

file_stats: add archive builder info; separate IO timing and seek
accounting (-> correct results)

trace: add random generation capability
vfs: made responsible for cache hit/miss accounting (fixes cache miss
rate display)

This was SVN commit r3681.
2006-03-24 21:56:00 +00:00
3d93740456 - allocators: SingleAllocator: renamed free method to release() to avoid need for nommgr
- lib, sysdep.h: move DIR_SEP to sysdep.h
- archive, compression: minor touchups
- zip: large refactor: all accesses to little-endian structs are now
done by helper functions (fixes bug: wasn't endian swapping ECDR). also
detect unfinished zip files (for VFS mount to ignore)
- tex_dds: fix comment

This was SVN commit r3634.
2006-03-15 05:18:32 +00:00
9de2ec0c20 ObjectBase.cpp: replace incorrect RNG with rand(min,max)
lib: remove rand_up_to - superceded by rand(min,max)

This was SVN commit r3515.
2006-02-15 04:03:29 +00:00
21f8f8555e adts: remove_least_valuable safely handles empty cache
lib: add u32_hi/lo
archive: move archive builder logic here from vf_optimizer
file_cache: add flush() call - used when simulating cache
vfs_optimizer: WIP, not yet functional: file gatherer, 50% of TSP tour
generator

This was SVN commit r3486.
2006-02-09 05:59:33 +00:00
1227cb2f6d adts: add RingBuf self-test. RingBuf: make entry#0 the 'head' and pop_front a no-op if empty.
allocators: allow pool_create at NLSO ctor time
lib: add rand() function based on libc rand and self-test. (this allows
easily returning a random number within a range, and avoids a number of
pitfalls - the naive rand()%range approach is baaad)
precompiled: add self_test.h, so that self tests won't be accidentally
disabled by forgetting to include the header

file_cache: add self-test; fixed 2 bugs that exposed (was incorrectly
splitting large blocks and not setting class_size bit properly). fix
weird corner case in BlockMgr (attempting to free LRU block but it is
locked).

file_io, wdbg_sym: tiny fixes

This was SVN commit r3461.
2006-02-03 04:02:53 +00:00
f06f0c8240 adts.cpp: remove DynArray, which was an array of pages. (obsoleted by DynArray/Pool allocators)
adts.h: add Cache (landlord algorithm), move DynHashTbl here from
vfs_tree; expand RingBuf and fix its iterator
allocators: minor tweaks+bugfixes; add SingleAllocator C++ wrapper
config, types: avoid stupid ICC warnings
lib: add round_down, u32_from_u16, SAFE_FREE

This was SVN commit r3414.
2006-01-23 07:59:20 +00:00