// This provides better project control over rounding to int from double // than wxRound() did. This scheme provides better logging in Debug builds // and it provides for compile time calculation of constants. #include <stdio.h> #include <assert.h> #include <limits.h> //-----<KiROUND KIT>------------------------------------------------------------ /** * KiROUND * rounds a floating point number to an int using * "round halfway cases away from zero". * In Debug build an assert fires if will not fit into an int. */ #if defined( DEBUG ) // DEBUG: a macro to capture line and file, then calls this inline static inline int KiRound( double v, int line, const char* filename ) { v = v < 0 ? v - 0.5 : v + 0.5; if( v > INT_MAX + 0.5 ) { printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v ); } else if( v < INT_MIN - 0.5 ) { printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v ); } return int( v ); } #define KiROUND( v ) KiRound( v, __LINE__, __FILE__ ) #else // RELEASE: a macro so compile can pre-compute constants. #define KiROUND( v ) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 ) #endif //-----</KiROUND KIT>----------------------------------------------------------- // Only a macro is compile time calculated, an inline function causes a static constructor // in a situation like this. // Therefore the Release build is best done with a MACRO not an inline function. int Computed = KiROUND( 14.3 * 8 ); int main( int argc, char** argv ) { for( double d = double(INT_MAX)-1; d < double(INT_MAX)+8; d += 2.0 ) { int i = KiROUND( d ); printf( "t: %d %.16g\n", i, d ); } return 0; } |
||
---|---|---|
3d-viewer | ||
CMakeModules | ||
Documentation | ||
bitmap2component | ||
bitmaps_png | ||
common | ||
cvpcb | ||
demos | ||
eeschema | ||
gerbview | ||
helpers/tools_to_build_newstroke-font | ||
include | ||
kicad | ||
new | ||
packaging | ||
pcb_calculator | ||
pcbnew | ||
polygon | ||
potrace | ||
resources | ||
scripts | ||
template | ||
tools | ||
.bzrignore | ||
AUTHORS.txt | ||
CHANGELOG.txt | ||
CMakeLists.txt | ||
COPYRIGHT.txt | ||
CTestConfig.cmake | ||
Doxyfile | ||
HOW_TO_CONTRIBUTE.txt | ||
INSTALL.txt | ||
README.txt | ||
TODO.txt | ||
copyright.h | ||
license_for_documentation.txt | ||
notes_about_pcbnew_new_file_format.odt | ||
uncrustify.cfg | ||
version.txt |
README.txt
KiCad README ============ For specific documentation like Compiling, GUI translation, Old changelogs see the Documentation subfolder. Files ----- AUTHORS.txt - The authors, contributors, document writers and translators list CHANGELOG.txt - This years changelog (see for previous years Documentation/changelogs) CMakeList.txt - CMAKE build tool script COPYRIGHT.txt - A copy of the GNU General Public License Version 2 CTestConfig.txt - Support for CTest and CDash testing tools Doxyfile - Doxygen preferences INSTALL.txt - The release (binairy) installation instructions TODO.txt - Todo list uncrustify.cfg - Uncrustify code formatting tool preferences version.txt - The current stable released version Subdirectories -------------- 3d-viewer - Sourcecode of 3D viewer bitmaps - Menu and program icons bitmap2component - Sourcecode of a small application to create a footprint or a component from a B&W bitmap this component or footprint has just graphic items that show the bitmap CMakeModules - Modules for the CMAKE build tool common - Sourcecode of the common library (common functions shared across whole suite) cvpcb - Sourcecode of CvPCB, tool to link components with footprints sourcecode demos - Some demo examples Documentation - Compiling documentation. Translating the GUI, old changelogs etcetera. eeschema - Sourcecode of the schematic editor gerbview - Sourcecode of the gerber viewer helpers - Helper tools and utilities for development include - Interfaces to the common library internat - Internationalisation files kicad - Sourcecode of the project manager packaging - Files for packaging on Windows and Mac OSX pcbnew - Sourcecode of the printed circuit board editor polygon - Sourcecode of the polygon library resources - Resources for installation, freedesktop mime-types for linux scripts - Helper scripts. For building, sourcecode packaging, font setting, pcb adjusting. template - Project template(s)