Compare commits

...
327 Commits
Author SHA1 Message Date
Mark 953021ec9d Merge pull request #303 from stepcode/review/inverse-attributes
inverse attributes...finally!
2014-12-26 15:12:05 -05:00
Mark Pictor c8f14a0821 bump version (0.8), update AUTHORS, NEWS for v0.8, add travis-ci build status to README 2014-12-26 15:10:00 -05:00
Mark 63049515d1 Merge pull request #300 from cshorler/python_properties_and_assert
Python properties and assert
2014-12-26 14:29:32 -05:00
Mark ca7487fa95 Merge pull request #299 from cshorler/investigate_ply_usage
Investigate Ply usage
2014-12-26 14:28:49 -05:00
Mark Pictor 0f5179e74b oops, forgot an include 2014-12-26 13:51:09 -05:00
Mark Pictor bfbd8df61e minor cleanup 2014-12-26 13:34:38 -05:00
Mark Pictor dfe69a923d bug in superInvAttrIter allowed null pointer return for ia 2014-12-26 13:34:38 -05:00
Mark Pictor 50452e8282 fix inv attr code in SDAI_Application_instance 2014-12-26 13:34:38 -05:00
Mark Pictor e74d4dc813 fix inverse attr initialization; attr was being found but it wasn't exiting the loop 2014-12-26 13:34:38 -05:00
Mark Pictor 653625f56a fix crash with lazy loading and unexpected newlines, found in cd209 files 2014-12-26 13:34:38 -05:00
Mark Pictor 5f702fb702 fix dumpComplexInst func, stupid mistake - was using wrong data member 2014-12-26 13:34:38 -05:00
Mark Pictor 8273ce1866 lazyRefs works now 2014-12-26 13:34:38 -05:00
Mark Pictor efb82853b7 don't print code for inverse data members, they're in iAMap now 2014-12-26 13:34:37 -05:00
Mark Pictor 37901afbbb redo attribute numbering, print inverse attr access members separately 2014-12-26 13:34:37 -05:00
Mark Pictor 6bac26d3c7 add index to struct Variable_, fix some whitespace 2014-12-26 13:34:37 -05:00
Mark Pictor ff3fd1f5e7 _complex is now bool, not int - update STEPcomplex ctors 2014-12-26 13:34:37 -05:00
Mark Pictor 9313b8e6ee move some attr-specific stuff from classes_entity to classes_attribute, also minor cleanup 2014-12-26 13:34:37 -05:00
Mark Pictor 921de860b0 closer... 2014-12-26 13:34:28 -05:00
Mark Pictor 5df2f69930 inching forward on inverse attrs 2014-12-26 13:32:24 -05:00
Mark Pictor 31bf315543 const correctness in superInvAttrIter 2014-12-26 13:32:24 -05:00
Mark Pictor 87c66bb4dc flesh out InitIAttrs() in eDesc, instance 2014-12-26 13:32:23 -05:00
Mark Pictor c91109b7b4 add functions to access schema class members 2014-12-26 13:32:23 -05:00
Mark Pictor febbb636fc allow const or non-const for ed iter 2014-12-26 13:32:23 -05:00
Mark Pictor 7976c8bee5 loop through ed's with inverse attrs, connecting them to what they point at 2014-12-26 13:32:23 -05:00
Mark Pictor 0b42b2fe89 oops, move eDesc initialization back into SdaiAll
otherwise, they may be initialized after being ref'd in attrDescs
2014-12-26 13:32:23 -05:00
Mark Pictor d36d12c6d3 fix failing schema 2014-12-26 13:32:23 -05:00
Mark Pictor 86bbc327fa cleanup 2014-12-26 13:32:23 -05:00
Mark Pictor c8cfac3acc some types still print in SdaiAll 2014-12-26 13:32:23 -05:00
Mark Pictor 9efd75ebc1 add some small schemas and a .p21; should be examined, maybe moved/simplified 2014-12-26 13:32:23 -05:00
Mark Pictor 98283dca34 more work on inverse attrs, code generation 2014-12-26 13:31:21 -05:00
Mark Pictor 65c703b811 work on inverse attrs 2014-12-26 13:29:08 -05:00
Mark Pictor 2374029ae8 cleanup 2014-12-26 13:29:08 -05:00
Mark Pictor c6d841789e initialize entity iAttrs using eDesc 2014-12-26 13:29:08 -05:00
Mark Pictor 14689c6db6 split ENTITYprint_new() into two, print into different files
* split into ENTITYprint_descriptors(), ENTITYprint_classes()
  * the former is now called from ENTITYprint_cc()
* make some changes to the args (don't pass ComplexCollect, just a bool)
2014-12-26 13:29:08 -05:00
Mark Pictor 01db3788a2 silence a signed-unsigned warning by using size_t 2014-12-26 13:29:07 -05:00
Mark Pictor 712d9657e8 improve comments, whitespace 2014-12-26 13:29:07 -05:00
Mark Pictor 168e7a93ed split up a 32-line fprintf 2014-12-26 13:29:07 -05:00
Mark Pictor 7ae34348be indents in generated code 2014-12-26 13:29:07 -05:00
Mark Pictor 1e95f8f61e remove LIBcopy_constructor() - unused since 1992(!) 2014-12-26 13:29:07 -05:00
Mark Pictor 4df86e5fea schema name changed for some p21 tests - update it 2014-12-26 13:29:07 -05:00
Mark Pictor 78427423ab redo some comments 2014-12-26 13:29:07 -05:00
Mark Pictor c2c0a6443b reformat some error message code, add one message for complex insts 2014-12-26 13:29:07 -05:00
Mark Pictor 674fa941f6 delete the array of names after creating a STEPcomplex 2014-12-26 13:29:07 -05:00
Mark Pictor 9db1170803 improve some comments in lazy loading code 2014-12-26 13:29:07 -05:00
Mark Pictor 7089bdbf5c when loading instance dependencies, seek to original position afterwards
otherwise, SDAI_Application_instance::STEPRead() will crash and burn when the file position changes on it
2014-12-26 13:29:07 -05:00
Mark Pictor 409315841b fix test dependency so 'make test ARGS=-jN' works 2014-12-26 13:29:07 -05:00
Mark Pictor 4bde538c65 add comment with express that fails 2014-12-26 13:28:54 -05:00
Mark Pictor 6955a03fca check for both aggr and non-aggr inverse attributes 2014-12-26 13:28:54 -05:00
Mark Pictor b31ffa3968 more changes to attrIsObj() 2014-12-26 13:28:22 -05:00
Mark Pictor 06bfc7d4d1 handle both aggr and non-aggr inverses 2014-12-26 13:28:21 -05:00
Mark Pictor 73b3c1b901 fix assertion - can either be aggregate or instance 2014-12-26 13:28:21 -05:00
Mark Pictor 66deaafb30 change behavior of attrIsObj() fn in classes_attribute 2014-12-26 13:27:02 -05:00
Mark Pictor 9e1d078b46 add 2 protos to classes_attribute header 2014-12-26 13:27:02 -05:00
Mark Pictor 31331651df modify const-ness in AGGRprint_access_methods 2014-12-26 13:27:02 -05:00
Mark Pictor 6117e532f8 move much of ATTRprint_access_methods into a series of smaller funcs 2014-12-26 13:27:02 -05:00
Mark Pictor b9db4568fe CONST -> const in a few more places 2014-12-26 13:27:02 -05:00
Mark Pictor ea24200c67 make STEPinvAttrList work with the new setter/getter variants 2014-12-26 13:27:02 -05:00
Mark Pictor acdc338c9d static setter/getter won't always have the same signature
detect whether to use sdaiApplicationInstance or EntityAggregate
2014-12-26 13:27:02 -05:00
Mark Pictor 9cf54cf374 add attrIsObj(), which returns true if const and non-const methods are sensible for a given var 2014-12-26 13:27:02 -05:00
Mark Pictor ea339e2ffa exp2cxx: move select getters into own function, print const and non-const 2014-12-26 13:27:01 -05:00
Mark Pictor 14d7b32320 remove duplicate function prototypes that masked a signature change 2014-12-26 13:27:01 -05:00
Mark Pictor 62ef3c6edd add const getter for string/bin attr's 2014-12-26 13:27:01 -05:00
Mark Pictor 521a999af9 change const getter for entity attr's 2014-12-26 13:27:01 -05:00
Mark Pictor 47d42ad558 invert sense of test in logging code - wouldn't print unless null 2014-12-26 13:27:01 -05:00
Mark Pictor f63835532b move string/binary access methods into 2 small funcs 2014-12-26 13:27:01 -05:00
Mark Pictor cd08570a3f print const and non-const getters for select attrs 2014-12-26 13:27:01 -05:00
Mark Pictor 4a01038cd0 fix a couple comments 2014-12-26 13:27:01 -05:00
Mark Pictor 3132089419 note that unity headers are probably useless since the main schema header includes all of the headers 2014-12-26 13:27:01 -05:00
Mark Pictor 5c0bea384c add braces and indenting to two LISTdo..LISTod's 2014-12-26 13:27:01 -05:00
Mark Pictor d64bbc3611 move count var so that derived attrs are counted
otherwise, the attr numbers in the ctor will be off by the number of preceding derived attrs
2014-12-26 13:27:01 -05:00
Mark Pictor 236778a5fc generated code: also print a const getter in class header when attr is a pointer type 2014-12-26 13:27:01 -05:00
Mark Pictor d6bb20d81b use instMgrBase in SDAI_Select operator test 2014-12-26 13:27:00 -05:00
Mark Pictor 6cb750a3eb don't print const for getter 2014-12-26 13:27:00 -05:00
Mark Pictor 118d8b295b merge with instMgrBase commit 2014-12-26 13:27:00 -05:00
Mark Pictor 64dd1d2a9a two libstructor_print calls missing neededAttr param 2014-12-26 13:27:00 -05:00
Mark Pictor 2ae605d5ae rename var - 'class' may not be a C keyword, but it's confusing 2014-12-26 13:27:00 -05:00
Mark Pictor 23a5a62397 formatting 2014-12-26 13:27:00 -05:00
Mark Pictor aaa1ca04a6 fix a few comments 2014-12-26 13:27:00 -05:00
Mark Pictor d4f13e0179 replace entity access member code with call to new func 2014-12-26 13:27:00 -05:00
Mark Pictor 800453e68a split entity methods out of ATTRprint_access_methods into 2 new funcs
second new func prints log stuff, called by other func 3x
2014-12-26 13:27:00 -05:00
Mark Pictor a74dc1d32c forgot to add 'const' keyword in several places after changing the ..._get_head() fn 2014-12-26 13:27:00 -05:00
Mark Pictor d9c89b9e94 when printing initializers, skip derived attrs 2014-12-26 13:27:00 -05:00
Mark Pictor fdcdd5a966 forgot to replace InstMgr with InstMgrBase in selects.c 2014-12-26 13:26:59 -05:00
Mark Pictor 7222c91c01 update inverse attr test 3 2014-12-26 13:26:59 -05:00
Mark Pictor 51acb993da whoops, don't pretend an instance can't be found if it is already loaded 2014-12-26 13:26:59 -05:00
Mark Pictor ebb7a920f2 use InstMgrBase instead of InstMgr in most stepcore classes
this is so that lazyInstMgr functions will be called when necessary
2014-12-26 13:26:59 -05:00
Mark Pictor f6078d8b5b eliminate unused buffer 2014-12-26 13:26:59 -05:00
Mark Pictor 4b3e433667 in generated c++: create data members for null pointers 2014-12-26 13:26:59 -05:00
Mark Pictor 1fddd17a64 in generated c++: ensure pointer is non-null before calling shallowCopy 2014-12-26 13:26:59 -05:00
Mark Pictor 647ecbcf99 in generated c++: ensure that pointers are zeroed (DataMemberInitializers()) 2014-12-26 13:26:59 -05:00
Mark Pictor ef2c01d76c in generated c++: in constructors, populate iAttrs
is populated with inverse attrs, setters, getters
2014-12-26 13:26:59 -05:00
Mark Pictor e17938afe8 generated c++: static setter/getter for inverse attrs 2014-12-26 13:26:59 -05:00
Mark Pictor d5f693a862 use STEPinvAttrList in sdaiApplication_Instance 2014-12-26 13:26:59 -05:00
Mark Pictor bd402b2567 add STEPinvAttrList for inv attr descs and setter/getter pointers
this will allow access to inverse attr values even with late binding, and is necessary to
set these attr values when the instances are being loaded
2014-12-26 13:26:59 -05:00
Mark Pictor ca560239ce use lazyRefs in lazyInstMgr 2014-12-26 13:26:55 -05:00
Mark Pictor b3b464632b trivial changes 2014-12-26 13:24:59 -05:00
Mark Pictor 0188910a3a add lazyRefs.h 2014-12-26 13:24:59 -05:00
Mark Pictor 35ead380af include subsuperiterators header 2014-12-26 13:24:59 -05:00
Mark Pictor b1387b731e improve comments, a few other small changes that don't affect behavior 2014-12-26 13:24:56 -05:00
Mark Pictor d1062cddfa use lazyInstMgr for inverse_attr3.cc 2014-12-26 13:21:52 -05:00
Mark Pictor 6e636d1c20 add variable names to some prototypes in ErrorDescriptor header 2014-12-26 13:21:52 -05:00
Mark Pictor f3cd328b24 add a FIXME 2014-12-26 13:21:52 -05:00
Mark Pictor 7867505fdc macro CONST -> const 2014-12-26 13:21:52 -05:00
Mark Pictor 57d3d2fe07 improve some comments for doxygen 2014-12-26 13:21:52 -05:00
Mark Pictor 259750e31e split a big fprintf up for readability 2014-12-26 13:21:52 -05:00
Mark Pictor 9144443d69 doxify comments in classes_misc.c 2014-12-26 13:21:52 -05:00
Mark Pictor 6004ba458b remove outdated comment from inverse_attr2.cc 2014-12-26 13:21:52 -05:00
Mark Pictor 2d060e7cc3 minor changes to judyLArray.h, judy.c 2014-12-26 13:21:52 -05:00
Mark Pictor 6419146cf1 functions to look up instance type in file 2014-12-26 13:21:47 -05:00
Mark Pictor ffd0da9ceb default to case insensitive when searching by instance type 2014-12-26 13:08:08 -05:00
Mark Pictor bf39d90382 _mainRegistry wasn't initialized 2014-12-26 13:08:07 -05:00
Mark Pictor 5b14529f63 warning about comparison that was always true 2014-12-26 13:08:07 -05:00
Mark Pictor 60141ce6f7 abstract class with non-virtual destructor 2014-12-26 13:08:07 -05:00
Cliff Yapp f72e01e610 Apply BRL-CAD change r61607 - Harden verify_generated.cmake.in to odd pathnames 2014-08-17 23:25:03 -04:00
Cliff Yapp 7531579d39 Update generated expscan.c file 2014-08-17 23:23:02 -04:00
Cliff Yapp 2ff6f4b434 Apply BRL-CAD change r61104 from brlcad - remove the misspelled readme markdown file that only contains the word 'Howto' 2014-08-17 23:12:37 -04:00
Cliff Yapp f357ef4c83 Apply BRL-CAD change r61065 - The insertion mechanism for the sortedMaster array performed very badly in the case where a large file has a batch of low-id-number entities towards the end of the file. Tossing in std::map in place of that array avoids the bad corner case, but we may pay a performance penalty in other situations - depending on what the bottle necks are, this may be work revisiting. For now, this seems to work well enough. 2014-08-17 23:09:50 -04:00
Cliff Yapp 752f976475 Suppress CMake warning 26 - need to figure out the 'right' approach eventually, but for now this is needed with CMake 3.0 2014-08-17 23:04:24 -04:00
Cliff Yapp 03dbb8ee9f Apply BRL-CAD change r58740 from tbrowder2 - fix typo 2014-08-17 22:57:17 -04:00
Cliff Yapp 3e51af51b4 Apply BRL-CAD change r58523 from n_reed - include ios header for std::ios namespace; fixes 'symbol not found' in exp2cxx on os x 2014-08-17 22:55:44 -04:00
Cliff Yapp 87e1f9948c Apply BRL-CAD change r58222 from tbrowder2 - added FIXME to warn of error with tightned standards 2014-08-17 22:54:01 -04:00
Cliff Yapp b905bec990 Apply BRL-CAD change r58172 from tbrowder2 - correct grammar 2014-08-17 22:52:56 -04:00
Cliff Yapp 63298df542 Until we reach a final decision on what to do about the schema_scanner, handle the .exe case 2014-08-01 21:04:23 -04:00
Cliff Yapp 319a8ab59d Only set a property on lazy_test-static if it is present as a target. 2014-08-01 21:01:37 -04:00
Cliff Yapp 607f732671 Need the NO_REGISTRY flag for the static version of this target as well. 2014-08-01 07:24:27 -04:00
Cliff Yapp e649757417 Install schema headers in locations that match the build tree hierarchy, so include directives will work both with in-build-tree and installed stepcode layouts. 2014-07-31 21:26:57 -04:00
Christopher Horler 4515ffca43 improvements to error handling
* Lexer now has a compatibility mode for entity names not all in uppercase
* Lexer now takes an extra argument header_limit, input is searched for
  valid start point, extra text up to header_limit is ignored.
2014-06-22 20:38:52 +01:00
Christopher Horler 4e90ff65e8 add logging to module, and mapping of lexer attributes lineno and lexpos to improve error messages 2014-06-22 12:11:56 +01:00
Christopher Horler e18b6d5c2a check for duplicate entity definitions in input 2014-06-20 22:34:38 +01:00
Christopher Horler ecaa9ba13f Update Python syntax and class definitions / style
- properties now use the @property decorator
- the assert statement is used in some places to enable disabling checks
2014-06-18 00:35:47 +01:00
Christopher Horler 53fac955ba add debug option to parse, add support to lexer for entity keywords 2014-06-17 22:17:37 +01:00
Christopher Horler aee532dd14 Use Ply for parser implementation 2014-06-17 20:07:06 +01:00
Christopher Horler 5840883239 add 'build' subdir ignores for CMake and Python 2014-06-17 19:59:01 +01:00
Mark df100f5764 Merge pull request #298 from cshorler/ap203e2_fixes
Ap203e2 fixes
2014-06-15 14:06:45 -04:00
Christopher Horler b65af6f982 first fix for Python MRO issue 2014-06-08 20:47:00 +01:00
Christopher Horler 65d3937e72 add simple sort to Linked_List implementation 2014-06-08 20:44:50 +01:00
Christopher Horler d635ee5ca8 fix some NameErrors due to ordering of the output classes / types 2014-06-08 20:43:30 +01:00
Christopher Horler bd80de24bc add simple support for logical XOR output, assumes parameters are already boolean types 2014-06-07 21:16:53 +01:00
Christopher Horler 44a6abb36e update REPEAT / looping statement outputs 2014-06-07 21:13:35 +01:00
Christopher Horler cabf5df7ac map special characters \x9 \xA \xD in EXPRESS literals to Python \t \n \r 2014-06-07 21:11:17 +01:00
Christopher Horler 5fc6630b3f Python keywords are replaced by keyword_ (underscore), this fixes a few associated outputs to avoid invalid Python code 2014-06-07 21:01:16 +01:00
Mark b7df5a0e6f Merge pull request #296 from jasondegraw/master
Add CMAKE_GENERATOR to schema scanner build
2014-04-23 20:36:11 -04:00
Jason W. DeGraw 9aa3b4201f Add CMAKE_GENERATOR to schema scanner build
Command line configuration with MinGW on Windows was failing
in schemaScanner.cmake because the generator wasn't getting
passed through to the build of the scanner. This commit adds
the generator to the scanner build command and fixes #295.
2014-04-19 14:38:12 -04:00
Cliff Yapp 6d57acff5b Apparently get_filename_component needs some help when it comes to windows drive names. 2014-04-08 21:22:55 -04:00
Mark c3094242c8 Merge pull request #294 from hoiji09/master
Added a function to lazyInstMgr for recursively getting Instance Dependencies.
2014-03-30 12:37:59 -04:00
hoiji09 1c048abd2e Removing self dependency of an instance
lazyInstMgr::instanceDependencies will now not add the instance being queried for in the generated dependency list.
2014-03-30 09:35:06 +05:30
hoiji09 3e4af5a77e Changes in printDeps test module
Changed the function return type from int to void, replaced '\n' by std::endl. Minor modifications to other print statements
2014-03-30 09:22:19 +05:30
hoiji09 a285652f01 Removed extra whitespace
The whitespace accidently got added in the last commit
2014-03-30 08:49:52 +05:30
Cliff Yapp 5abaebb04b Try to make the RELATIVE_PATH_TO_TOPLEVEL macro robust for out-of-src-dir situations. 2014-03-29 12:24:44 -04:00
hoiji09 35b76941bd Added instanceDependencies function in lazyInstMgr
This function lists all instances that one instance recursively depends upon
2014-03-27 21:11:25 +05:30
Mark 7301b34c27 Merge pull request #293 from hoiji09/master
Buffering a read to speedup lazy loading
2014-03-17 17:14:22 -04:00
hoiji09 e4426e3a64 Resolved bad error messages 2014-03-14 11:35:53 +05:30
hoiji09 39d37e9b09 Missing newline added 2014-03-14 07:51:47 +05:30
hoiji09 a7fc5d1e76 Added a comment on double checking.
The double checking is done while parsing a instance id from the file to a variable of type InstanceID
2014-03-14 00:24:00 +05:30
hoiji09 f6fde2f1e1 strtoull macro support for MSVC. 2014-03-14 00:14:18 +05:30
hoiji09 d43b52d61e Splitting warning and error detection 2014-03-10 09:07:32 +05:30
hoiji09 9cded87862 Safer String to Integer conversion.
Accurate inference of number of characters in the string representation of the instance number. On finding a very large instance number, lazyloading will skip that section.
2014-03-10 07:34:02 +05:30
hoiji09 8de8875cd8 Corrected a Malformed comment 2014-03-09 18:50:50 +05:30
hoiji09 7ff99c9564 Added std::endl to the warning message 2014-03-09 18:42:44 +05:30
hoiji09 3f0115631b Updated error message
The error message on finding a very large instance ID is saner
2014-03-09 12:24:27 +05:30
hoiji09 bcd9a58abc Buffered a read to increase speed in Lazy Loading
Added a buffer in SectionReader::readInstanceNumber(). This leads to 1.5x speedup of lazy loading on a 32-bit System. Also Adhered to comments pointed out in the previous commit.
2014-03-06 10:57:40 +05:30
Mark 4a0a27cc30 Merge pull request #289 from stepcode/mp/config-parse-rebase
Split generated code
2014-03-05 22:52:31 -05:00
hoiji09 5c24152afe Introduced a buffer in SectionReader::readInstanceNumber() to fasten lazy loading 2014-03-05 09:51:47 +05:30
Mark Pictor 87fbca7359 C string safety in TYPEget_ctype / TYPE_get_ctype
Check string lengths, only copy if necessary

found due to an OSX segfault - the static char[] retval was getting copied into itself due to recursion

    frame #4: 0x00007fff92da1860 libsystem_c.dylib`__chk_fail + 48
    frame #5: 0x00007fff92da1870 libsystem_c.dylib`__chk_fail_overlap + 16
    frame #6: 0x00007fff92da18a1 libsystem_c.dylib`__chk_overlap + 49
    frame #7: 0x00007fff92da1a6c libsystem_c.dylib`__strcpy_chk + 64
    frame #8: 0x0000000100013a98 exp2cxx`TYPEget_ctype(t=0x0000000101a580e0) + 280 at class_strings.c:56
2014-03-04 20:10:04 -05:00
Mark 2338dd11e1 increase schema scanner config/build timeouts
config is slow on windows and the 10s limit caused intermittent failures
2014-03-02 15:44:33 -05:00
Mark Pictor f1ee9585d1 add dependencies for tests, so tests won't fail if 'make' wasn't run before 'make test' 2014-03-01 13:49:30 -05:00
Mark Pictor 5d78a327db update AP203Minimum - generated code is in different dir now 2014-03-01 13:47:42 -05:00
Mark Pictor 832a6e75b6 print ReferentType calls, etc, to files->init for TYPEs that are typedef'd 2014-03-01 11:53:31 -05:00
Mark Pictor 252f19754f remove empty loop 2014-03-01 11:53:31 -05:00
Mark Pictor 1598dee630 remove useless switch statement, replace with if 2014-03-01 11:53:31 -05:00
Mark Pictor 15993bdd96 improve 2 error messages 2014-03-01 11:53:31 -05:00
Mark Pictor a8ffbc17d3 missing colon in error messages 2014-03-01 11:53:31 -05:00
Mark Pictor 7f0a0f852f fix tests that were broken by file name changes 2014-03-01 11:53:31 -05:00
Mark Pictor cd0d8b496b cannot treat the schema scanner source as a config file, so add /*WARNING*/ 2014-03-01 11:53:31 -05:00
Mark Pictor 4d945de475 perplex/lemon/re2c not found messages can confuse users
make find_package quiet for all 3, then if all were found, print a message
to that effect.
2014-03-01 11:53:30 -05:00
Mark Pictor bbe607be60 fix copy/paste error in cmake message 2014-03-01 11:53:30 -05:00
Mark Pictor 38467bdca3 add build logic for unity builds (mostly in generated CMLists) 2014-03-01 11:53:30 -05:00
Mark Pictor 78d99f2f4e change generated CMLists ws to better match starseeker's ws 2014-03-01 11:53:30 -05:00
Mark Pictor 5c021b2b7f tests were broken because macro name changed
make two variables CACHE INTERNAL so that their values are available in other scopes (i.e. in test dirs)
2014-03-01 11:53:30 -05:00
Cliff Yapp 10fb7419b5 More whitespace and case tweaks 2014-03-01 11:53:30 -05:00
Cliff Yapp f4ac673b71 whitespace and case changes on .cmake files 2014-03-01 11:53:30 -05:00
Cliff Yapp 1696fea0c7 Case and whitespace on toplevel CMake files 2014-03-01 11:53:30 -05:00
Cliff Yapp 44e02c957a whitespace changes 2014-03-01 11:53:30 -05:00
Cliff Yapp c0e74a9eef Add CMake footer comment to CMake files 2014-02-28 22:06:09 -05:00
Mark Pictor a7579f0bc9 remove helper function header - code moved to headers for individual types/entities 2014-02-28 22:02:07 -05:00
Mark Pictor 317b40bff0 minor formatting changes 2014-02-28 22:02:07 -05:00
Mark Pictor d4d42b7d1c print helper functions in header 2014-02-28 22:02:07 -05:00
davyw 492f455598 allow schema scanner to build on windows 2014-02-28 22:02:07 -05:00
Mark Pictor 2ccc5ce360 add underscore to schema shortname for readability - Sdai -> Sdai_ 2014-02-28 22:02:07 -05:00
Mark Pictor 05a74dedd8 change code generation message a bit 2014-02-28 22:02:07 -05:00
Mark Pictor 5043c035a3 renamed enums, selects don't get their own files 2014-02-28 22:02:07 -05:00
Mark Pictor 426e2b4ab3 add two cmake messages 2014-02-28 22:02:07 -05:00
Mark Pictor 2d651bfad4 unnecessary variable in a macro 2014-02-28 22:02:07 -05:00
starseeker c6f0c44a02 print file count, not list of all files, when generating. 2014-02-28 22:02:07 -05:00
starseeker 6533032fd9 workaround makefile corruption by changing how file lists are handled 2014-02-28 22:02:07 -05:00
Mark Pictor 26822ef959 exp2cxx wasn't running because script args were handled incorrectly 2014-02-28 22:02:07 -05:00
Mark Pictor 86f884b399 TODO 2014-02-28 22:02:06 -05:00
Mark Pictor 4fd5dd9f74 improve cmake comments, user messages 2014-02-28 22:02:06 -05:00
Mark Pictor 8e08f71fe8 don't build schema scanner unless schemas are to be built 2014-02-28 22:02:06 -05:00
Mark Pictor b320bfe3f7 generate a short schema name in the schema scanner
this name is one of:
* the schema file name without extension,
* the schema dir name if in sc/data/ and 3+ chars
* or the official schema name on the SCHEMA line.
2014-02-28 22:02:06 -05:00
Mark Pictor 34d917fb19 update scanner to match renamed schema macros file 2014-02-28 22:02:06 -05:00
Mark Pictor 86bae779b0 inching forward on schema scanner 2014-02-28 22:02:06 -05:00
Mark Pictor b15ba38edf try again to make msvc use same dir as other compilers 2014-02-28 22:02:06 -05:00
Mark Pictor 96bd4520b5 move more schema logic into new file, rename file 2014-02-28 22:02:06 -05:00
Mark Pictor 5dd996d38d add mkDirIfNone(), like mkdir but no error if path is already a dir 2014-02-28 22:02:06 -05:00
Mark Pictor 5384fe0dbb fix locate_schema macro 2014-02-28 22:02:06 -05:00
Mark Pictor 2d4346dd5a better way of printing user messages after everything else 2014-02-28 22:02:06 -05:00
Mark Pictor ce6a37e49a move output dirs logic into separate file so schema_scanner can use it as well 2014-02-28 22:02:06 -05:00
Mark Pictor 0b2f9ee3fc move packaging and uninstall into SC_Build_opts.cmake 2014-02-28 22:02:06 -05:00
Mark Pictor a9120d79f7 move logic related to creating sc_cf.h, sc_version_string.h to own file 2014-02-28 22:02:06 -05:00
Mark Pictor e1fe3e0b9f move lexer/parser generation logic into own file 2014-02-28 22:02:05 -05:00
Mark Pictor d14e7670c2 put cmake locale stuff in its own file 2014-02-28 22:02:05 -05:00
Mark Pictor 37a95f5e63 move build optons, build/install dirs, etc to SC_Build_opts.cmake 2014-02-28 22:02:05 -05:00
Mark Pictor 207d6c26c2 remove old message 2014-02-28 22:02:05 -05:00
Mark Pictor 7de64b6bc4 rename SC_Utils.cmake to SC_Targets.cmake 2014-02-28 22:02:05 -05:00
Mark Pictor a4e96f62ff put path macros in a separate file, and include it 2014-02-28 22:02:05 -05:00
Mark Pictor 993c40f6ad MSVC insists on putting schema_scanner.exe in a different dir 2014-02-28 22:02:05 -05:00
Mark Pictor a035292cf0 another TODO 2014-02-28 22:02:05 -05:00
Mark Pictor 6ca7b04dfd cxxSchemaMacros.cmake - will contain macros used in the generated CMakeLists files 2014-02-28 22:02:05 -05:00
Mark Pictor 427ecaf09f add schema scanner README 2014-02-28 22:02:05 -05:00
Mark Pictor b7a8ac4cbb make build/schema dir 2014-02-28 22:02:05 -05:00
Mark Pictor 2e6ee6695a cmake changes to match new behavior of scanner 2014-02-28 22:02:05 -05:00
Mark Pictor 86bf2dff99 maybe this will force MSVC to behave?
http://stackoverflow.com/questions/7229571/cmake-visual-studio-debug-folder
http://www.cmake.org/cmake/help/v2.8.8/cmake.html#prop_tgt:RUNTIME_OUTPUT_DIRECTORY_CONFIG
2014-02-28 22:02:05 -05:00
Mark Pictor c4fde8c96f comment, formatting 2014-02-28 22:02:04 -05:00
Mark Pictor 3088d3d63f check for errors in 2 places 2014-02-28 22:02:04 -05:00
Mark Pictor 99fbadcdfd print path to the dir containing the generated CMakeLists for CMake 2014-02-28 22:02:04 -05:00
Mark Pictor 685e95f618 windows needs _snprintf 2014-02-28 22:02:04 -05:00
Mark Pictor b8d35ce517 improve formatting of generated CMakeLists 2014-02-28 22:02:04 -05:00
Mark Pictor d1f57453dd print ss contents not address 2014-02-28 22:02:04 -05:00
Mark Pictor 86302fb0f3 take a stab at writing a CMakeLists.txt for the schema 2014-02-28 22:02:04 -05:00
Mark Pictor 4efb670ddf used wrong variable to set output dir 2014-02-28 22:02:04 -05:00
Mark Pictor 5bdac5427b use schemas subdir for output? 2014-02-28 22:02:04 -05:00
Mark Pictor a01fa5708a start on creating cmakelists within the schema scanner 2014-02-28 22:02:04 -05:00
Mark Pictor ec4eed7367 rename schemaScanner to .cpp 2014-02-28 22:02:04 -05:00
Mark Pictor c080fbc8dc aggregates are always builtin 2014-02-28 22:02:04 -05:00
Mark Pictor 599f51891d always clean and rebuild the schema scanner when cmake executes 2014-02-28 22:02:04 -05:00
Mark Pictor ce4227c6b5 don't print file names for built in types 2014-02-28 22:02:04 -05:00
Mark Pictor 0dd18d246a improve some comments 2014-02-28 22:02:03 -05:00
Mark Pictor 1cc0beec4b eliminate gcc warnings 2014-02-28 22:02:03 -05:00
Mark Pictor aa8842ea56 allow schema scanner to be built when sc_version_string.h doesn't exist 2014-02-28 22:02:03 -05:00
Mark Pictor 2cd5d494f9 move keywords from express.[ch] to exp_kw.[ch] 2014-02-28 22:02:03 -05:00
Mark Pictor 6092c9b29f move some functions from express.[ch] to info.[ch] 2014-02-28 22:02:03 -05:00
Mark Pictor 8f57958813 print better messages in schemaScanner.cmake 2014-02-28 22:02:03 -05:00
Mark Pictor 10ef152fc6 assertion - is a type really a type? 2014-02-28 22:02:03 -05:00
Mark Pictor 95d339e2c7 use schema scanner in data/CMakeLists.txt 2014-02-28 22:02:03 -05:00
Mark Pictor 25521ee3af make the schema scanner macro do more work; getting close now 2014-02-28 22:02:03 -05:00
Mark Pictor f7c56d3e5a move fns 2014-02-28 22:02:03 -05:00
Mark Pictor b2b0039d2f update exp2cxx to use new code 2014-02-28 22:02:03 -05:00
Mark Pictor 91e9528afe perhaps I shouldn't print a type name for entities and vice versa 2014-02-28 22:02:03 -05:00
Mark Pictor 52acad573b move some functions related to class/file names into class_strings.c/h
this is to reduce the number of source files necessary for the schema scanner
2014-02-28 22:02:02 -05:00
Mark Pictor 44ab3e3352 run the schema scanner from data/CMakeLists.txt 2014-02-28 22:02:02 -05:00
Mark Pictor 30b04d741f update schema scanner 2014-02-28 22:02:02 -05:00
Mark Pictor abf0541ae9 remove TODO file - both items in it were fixed long ago 2014-02-28 22:02:02 -05:00
Mark Pictor bb41fd4863 initial revision of schema scanner 2014-02-28 22:02:02 -05:00
Mark Pictor 9c5e27590d expparse.y revision log dates to the 90's - remove most of it 2014-02-28 22:02:02 -05:00
Mark Pictor 0b16a413f7 use 'const char *' for filename 2014-02-28 21:55:43 -05:00
davyw 0d533f55df Split classes files into classes_attribute, classes_entity and classes_type. 2014-02-28 21:55:43 -05:00
davyw c6cfc06f4f Added import/export macro for sc_mkdir. 2014-02-28 21:55:43 -05:00
Mark Pictor d4a21dd654 const warning 2014-02-28 21:55:43 -05:00
Mark Pictor 166db7d178 use sc_mkdir 2014-02-28 21:55:43 -05:00
Mark Pictor 0bf73eece7 cross-platform mkdir 2014-02-28 21:55:43 -05:00
davyw 5a6b972e47 Moved type init code to type specific files. 2014-02-28 21:55:43 -05:00
davyw 9e6b419a53 Write enumeration and select types to their own files. 2014-02-28 21:55:43 -05:00
davyw 33b0629e1e Fixes to get generated files to build. 2014-02-28 21:55:43 -05:00
davyw 05ade5ca60 Split generated c++ code in a separate file for each entity. 2014-02-28 21:55:43 -05:00
Mark 0a46b861a5 Merge pull request #288 from stepcode/review/prettyprint_DIV
pretty print: integer and real division have different operators
2014-02-26 21:00:13 -05:00
Mark Pictor 2c8a05fa0a add exppp div/slash test to ensure this stays fixed 2014-02-25 18:48:13 -05:00
Mark Pictor eb9193038c commit 01f6e26 fixed integer division (DIV) but broke real division (/) 2014-02-25 17:36:00 -05:00
Mark Pictor d691bdf4d2 message for syntax error didn't actually say syntax error 2014-02-25 17:23:21 -05:00
Mark c686fc163b Merge pull request #287 from stepcode/review/prettyprint_VAR
don't omit 'VAR' keyword when prettyprinting
2014-02-24 21:02:04 -05:00
Mark Pictor 587ce0f16b use flags.var in exppp 2014-02-24 20:39:20 -05:00
Mark Pictor 7ccf768adf neaten up header 2014-02-24 20:37:55 -05:00
Mark Pictor 14c854e0df add flags.var to parser for procedure params marked VAR 2014-02-24 20:37:32 -05:00
Mark 9899ad937b Merge pull request #286 from stepcode/review/exppp_var_order
preserve EXPPP variable order
2014-02-23 14:58:34 -05:00
Mark 171671db1f Don't aggressively wrap SUBTYPEs - leave as before 2014-02-23 14:58:10 -05:00
Mark Pictor d4c7d1bf6f put each SUBTYPE/SUPERTYPE on its own line, indent ONEOF 2014-02-20 20:13:36 -05:00
Mark Pictor d10d955f74 when pretty-printing, order LOCAL vars the same way as in source file 2014-02-20 19:18:50 -05:00
Mark Pictor 626635b644 use Variable.offset to order LOCAL variables
previously, this was only used for attr order in Entity's

these two uses should not conflict
2014-02-20 19:16:03 -05:00
Mark f64d8f75ca Merge pull request #285 from stepcode/review/ap203min_regression
ap203min regression
2014-02-17 20:46:33 -05:00
Mark Pictor 4c13ff422f cleanup in selects.c 2014-02-17 19:52:46 -05:00
Mark Pictor caf887ed03 improve formatting of generated select class code 2014-02-17 19:32:41 -05:00
Mark Pictor 860d612086 test SDAI_Select assignment operator 2014-02-17 19:29:18 -05:00
Mark Pictor 2685dbcf31 generated code: in select assignment operator, call base class assignment operator 2014-02-17 19:27:53 -05:00
Mark Pictor 1ec21780c6 Add virtual assignment operator and copy constructor to SDAI_Select
Related to commit f43a106ac3 (removal of pure virtual assignment operator) -
that commit eliminated an MSVC linker error, but caused a regression on linux
2014-02-17 18:37:54 -05:00
Mark 58dd89044c Merge pull request #283 from stepcode/dw/msvc_linker_fixes
Msvc linker fixes + static libs
2014-02-09 19:50:41 -05:00
davyw 995a8a7fe9 Added libraries to SC_ADDEXEC libslist parameter.
When building static libs, all dependent libraries need to be provided to liblist.
When building shared libs, this is not needed, but does not break the build.
2014-02-09 22:56:07 +01:00
davyw e7bbcc0909 Split SC_ADDEXEC macro to handle static and shared libs build. 2014-02-05 22:30:55 +01:00
davyw bc298808dd Removed MSVC exclusion for SC_BUILD_STATIC_LIBS. 2014-02-05 22:29:55 +01:00
davyw 0c0ff74429 Removed duplicate definition of SchemaInit function.
SchemaInit is already declared in 'schema.h'.
2014-02-04 21:22:17 +01:00
davyw f3c56ceafc Added SC_SCHEMA_EXPORT macro's for generated types.
Fixes MSVC linker errors in user code.
2014-02-03 22:03:58 +01:00
Mark ca1a34a698 Merge pull request #281 from stepcode/review/ur-redecl
Redeclared attrs, qualifiers, and uniqueness rules
2014-01-19 09:31:58 -08:00
Mark Pictor ee86226f5e print warning rather than removing the qualifiers from redeclared attrs in URs 2014-01-08 20:00:53 -05:00
Mark Pictor 2fd8d1a0be don't print misleading redeclaration warning 2014-01-07 20:07:23 -05:00
Mark Pictor 98bc5049f7 exppp: redeclared attrs in URs shouldn't have qualifiers 2014-01-07 20:03:51 -05:00
Mark Pictor 5fa2ebb677 schema for redeclaration and UR 2014-01-07 20:02:50 -05:00
Mark f4369ba902 Merge pull request #280 from stepcode/review/msvc_linker_fixes
Review/msvc linker fixes
2013-12-30 08:18:28 -08:00
Mark e343668210 Merge pull request #279 from stepcode/review/lost-qualifiers
Lost qualifiers on inverse attributes and uniqueness rules
2013-12-30 08:18:14 -08:00
davyw 02ef60aee2 Added DEFINE_DLL_IMPORTS to add_schema_dependent_test macro.
Added stepcore to libraries of aggregate_bound_runtime test to fix linker error.
2013-12-29 18:23:55 +01:00
davyw 530c796284 Added SC_SCHEMA_EXPORT macro for each generated entity class. 2013-12-29 18:19:10 +01:00
davyw f43a106ac3 Removed pure virtual operator= reference from SDAI_Select class.
(Results in linking errors on windows otherwise)
2013-12-29 18:18:20 +01:00
davyw 46951e3b32 Added import/export macro's for STEPattribute operator==, operator!= and sameADesc(). 2013-12-28 08:26:00 +01:00
Mark Pictor 8f72192262 add inverse and unique qualifiers tests for exp2cxx 2013-12-27 14:12:09 -05:00
Mark Pictor 3ee5fc0ca8 clean up a bit 2013-12-27 14:12:09 -05:00
Mark Pictor d061b146d5 makes more sense to have these schemas under test/unitary_schemas 2013-12-27 14:12:09 -05:00
Mark Pictor b3a284a59a add exppp test for inverse qualifiers 2013-12-27 14:12:09 -05:00
Mark Pictor 4a4c39fae9 rename lost_qualifiers.*, modify files accordingly 2013-12-27 14:12:09 -05:00
Mark Pictor 29a15c5db9 in exppp, print inverse attrs as expressions 2013-12-27 14:12:09 -05:00
Mark Pictor 17c518cd12 use Expression for Unique rules in exp2cxx 2013-12-27 14:12:09 -05:00
Mark Pictor 49a6227103 add test for lost qualifiers on unique rules 2013-12-27 14:12:08 -05:00
Mark Pictor a8a7a723c8 actually build and test long string test 2013-12-27 14:12:08 -05:00
Mark Pictor 21e029c362 wrong variable name for testing 2013-12-27 14:12:08 -05:00
Mark Pictor c0e6d32290 fix compile error with exppp test for long strings 2013-12-27 14:12:08 -05:00
Mark Pictor d68b60fb39 change lost qualifiers test schema to match exppp output formatting exactly 2013-12-27 14:12:08 -05:00
Mark Pictor a379152c80 reformat a comment 2013-12-27 14:12:08 -05:00
Mark Pictor c56ee55128 update exppp to use Expression for Unique rules 2013-12-27 14:12:08 -05:00
Mark Pictor 9eba5b18dd sync generated files 2013-12-27 14:12:08 -05:00
Mark Pictor 701f90025c use Expression for Unique rules
this changes libexpress only - must change exppp, exp2cxx, exp2python
2013-12-27 14:12:08 -05:00
Mark Pictor 66d6406ed9 test schema for lost qualifiers - still need to automate the test 2013-12-27 14:12:08 -05:00
Mark Pictor 19e96fa6fa update generated parser files 2013-12-27 14:12:08 -05:00
Mark Pictor 0754642e31 attribute_decl comment 2013-12-27 14:12:07 -05:00
Mark Pictor 0c0714260a is it really this easy to do qualified inverse attrs right? 2013-12-27 14:11:51 -05:00
Mark Pictor 05333b3185 comment some productions in expparse.y 2013-12-23 15:24:34 -05:00
Mark 6772b3a64e Merge pull request #277 from stepcode/review/msvc_fixes
Review/msvc fixes
2013-12-15 13:28:16 -08:00
davyw 31f0644b26 Removed explicit exports of template class std::string.
(To resolve linker error on MSVC 2010)
2013-12-05 23:00:24 +01:00
davyw b9922e2e0a Added include files to make sure functions from pretty_subtype.c get exported properly on windows. 2013-12-05 22:59:06 +01:00
davyw 95597e8a71 Moved variable declaration to top of function to fix compiler errors on MSVC. 2013-12-05 22:58:16 +01:00
Mark Pictor a13481e543 update AP242 to v1.27 (N8324)
retrieved from
http://stepmod.cvs.sourceforge.net/viewvc/stepmod/stepmod/data/modules/ap242_managed_model_based_3d_engineering/mim_lf.exp?revision=1.27
2013-11-17 13:26:04 -05:00
179 changed files with 43979 additions and 46451 deletions
+2
View File
@@ -0,0 +1,2 @@
/build
+6 -1
View File
@@ -5,21 +5,26 @@ http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/src/other/step/?vie
In alphabetical order:
Bertucat, Roch (rbertucat)
Bowman, W. Keith (indianlarry)
da Costa, Raphael Kubo (rakuco)
DeGraw, Jason (jasondegraw)
Easterbrook, Zach (lainiwakurax)
Greenwald, Erik (erikg, erikgreenwald)
Horler, Chris (cshorler)
Lanning, Craig (craigl64)
Loman, David (davidloman)
McDonald, Rob (ramcdona)
Mittal, Pulkit (hoiji09)
Morrison, Christopher Sean (sean, morrison, brlcad)
Paviot, Thomas (tpaviot)
Pictor, Mark (mpictor)
Reed, Nick (nickreed)
Shah, Kesha (kesha)
Shah, Kesha (kesha, keshashah)
Thomas, Dawn (homovulgaris, madant)
Wouters, Dave (davyw)
Yapp, Clifford (starseeker)
Special thanks:
Hunten, Keith (Lockheed Martin)
Lubbell, Joshua (NIST)
Stirk, Charlie (CostVision)
Thurman, Tom (TRThurman)
+87 -386
View File
@@ -32,427 +32,128 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# *******************************************************************
# *** SC's CMakeLists.txt ***
# *** STEPcode's CMakeLists.txt ***
# *******************************************************************
# This file contains the top level CMakeLists.txt logic for the
# SC software package.
# STEPcode software package.
PROJECT(SC)
project(SC)
# SC version
SET(SC_VERSION_MAJOR 0)
SET(SC_VERSION_MINOR 7-dev)
SET(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
set(SC_VERSION_MAJOR 0)
set(SC_VERSION_MINOR 7-dev)
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
# SC ABI version. SC_ABI_SOVERSION should be incremented
# for each release introducing API incompatibilities
SET(SC_ABI_SOVERSION 2)
SET(SC_ABI_VERSION ${SC_ABI_SOVERSION}.0.0)
set(SC_ABI_SOVERSION 2)
set(SC_ABI_VERSION ${SC_ABI_SOVERSION}.0.0)
# Minimum required version of CMake
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
IF(COMMAND CMAKE_POLICY)
cmake_minimum_required(VERSION 2.8.7)
if(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
IF( NOT DEFINED INCLUDE_INSTALL_DIR )
SET( INCLUDE_INSTALL_DIR include )
ENDIF( NOT DEFINED INCLUDE_INSTALL_DIR )
IF( NOT DEFINED LIB_INSTALL_DIR )
SET( LIB_INSTALL_DIR lib )
ENDIF( NOT DEFINED LIB_INSTALL_DIR )
IF( NOT DEFINED BIN_INSTALL_DIR )
SET( BIN_INSTALL_DIR bin )
ENDIF( NOT DEFINED BIN_INSTALL_DIR )
IF( NOT DEFINED SC_BUILD_TYPE )
SET( SC_BUILD_TYPE "Debug" CACHE STRING "Build type" ) # By default set debug build
ENDIF( NOT DEFINED SC_BUILD_TYPE )
IF(NOT SC_IS_SUBBUILD)
SET(CMAKE_BUILD_TYPE ${SC_BUILD_TYPE} CACHE INTERNAL "Build type, immutable" FORCE )
ELSE(NOT SC_IS_SUBBUILD)
SET(CMAKE_BUILD_TYPE ${SC_BUILD_TYPE} )
ENDIF(NOT SC_IS_SUBBUILD)
# Define helper macro OPTION_WITH_DEFAULT
MACRO( OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT )
IF( NOT DEFINED ${OPTION_NAME} )
SET( ${OPTION_NAME} ${OPTION_DEFAULT} )
ENDIF( NOT DEFINED ${OPTION_NAME} )
OPTION( ${OPTION_NAME} "${OPTION_STRING}" ${${OPTION_NAME}} )
ENDMACRO( OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT )
# build shared libs by default
OPTION_WITH_DEFAULT(SC_BUILD_SHARED_LIBS "Build shared libs" ON )
# don't build static libs by default
OPTION_WITH_DEFAULT(SC_BUILD_STATIC_LIBS "Build static libs" OFF)
OPTION_WITH_DEFAULT(SC_PYTHON_GENERATOR "Compile exp2python" ON)
OPTION_WITH_DEFAULT(SC_CPP_GENERATOR "Compile exp2cxx" ON)
OPTION_WITH_DEFAULT(SC_MEMMGR_ENABLE_CHECKS "Enable sc_memmgr's memory leak detection" OFF)
OPTION_WITH_DEFAULT(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
if(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS )
set( SC_SDAI_ADDITIONAL_EXES_SRCS "" CACHE STRING "Source files for additional executables to be linked with SDAI libs" )
endif(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS )
if( NOT DEFINED SC_BUILD_SCHEMAS )
set( SCHEMAS_WARNING TRUE )
#this makes SC_BUILD_SCHEMAS show up in cmake-gui
SET(SC_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built" )
endif( NOT DEFINED SC_BUILD_SCHEMAS )
if ("${CMAKE_VERSION}" VERSION_GREATER 2.99)
CMAKE_POLICY(SET CMP0026 OLD)
endif ("${CMAKE_VERSION}" VERSION_GREATER 2.99)
endif(COMMAND CMAKE_POLICY)
# CMake derives much of its functionality from modules, typically
# stored in one directory - let CMake know where to find them.
SET(SC_CMAKE_DIR "${SC_SOURCE_DIR}/cmake")
set(SC_CMAKE_DIR "${SC_SOURCE_DIR}/cmake")
if(NOT IS_SUBBUILD)
SET(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
set(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
else(NOT IS_SUBBUILD)
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
endif(NOT IS_SUBBUILD)
INCLUDE(${SC_CMAKE_DIR}/SC_Utils.cmake)
# testing and compilation options, build output dirs, install dirs, uninstall, package creation, etc
include(${SC_CMAKE_DIR}/SC_Build_opts.cmake)
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables and set them
# to "C" so things like date output are as expected
SET(_orig_lc_all $ENV{LC_ALL})
SET(_orig_lc_messages $ENV{LC_MESSAGES})
SET(_orig_lang $ENV{LANG})
IF(_orig_lc_all)
SET(ENV{LC_ALL} C)
ENDIF(_orig_lc_all)
IF(_orig_lc_messages)
SET(ENV{LC_MESSAGES} C)
ENDIF(_orig_lc_messages)
IF(_orig_lang)
SET(ENV{LANG} C)
ENDIF(_orig_lang)
# SC_ADDEXEC and SC_ADDLIB macros, dllimport/export, etc
include(${SC_CMAKE_DIR}/SC_Targets.cmake)
# Macros related to paths
include(${SC_CMAKE_DIR}/SC_Paths.cmake)
# locale stuff
include(${SC_CMAKE_DIR}/SC_Locale.cmake)
# logic related to regenerating the lexer and parser source code
include(${SC_CMAKE_DIR}/SC_Regenerate.cmake)
if(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS)
set(SC_SDAI_ADDITIONAL_EXES_SRCS "" CACHE STRING "Source files for additional executables to be linked with SDAI libs")
endif(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS)
if(NOT DEFINED SC_BUILD_SCHEMAS)
list(APPEND CONFIG_END_MESSAGES
"** CMake variable SC_BUILD_SCHEMAS was not set. Defaults to building ALL schemas, which will take a"
" while; see http://stepcode.org/mw/index.php?title=STEPcode_CMake_variables#SC_BUILD_SCHEMAS")
#this makes SC_BUILD_SCHEMAS show up in cmake-gui
set(SC_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built")
endif(NOT DEFINED SC_BUILD_SCHEMAS)
list(APPEND CONFIG_END_MESSAGES
".. Don't worry about any messages above about missing headers or failed tests, as long as"
" you see 'Configuring done' below. Headers and features vary by compiler."
".. Generating step can take a while if you are building several schemas.")
# create config headers sc_cf.h and sc_version_string.h
include(${SC_CMAKE_DIR}/SC_Config_Headers.cmake)
#---------------------------------------------------------------------
# Coverage option
OPTION_WITH_DEFAULT( SC_ENABLE_COVERAGE "Enable code coverage test" OFF )
IF(SC_ENABLE_COVERAGE)
SET(SC_ENABLE_TESTING ON CACHE BOOL "Testing enabled by coverage option" FORCE)
# build static libs, better coverage report
SET(SC_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE )
SET(SC_BUILD_STATIC_LIBS ON CACHE BOOL "Build static libs" FORCE )
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage" CACHE STRING "Extra linker flags required by code coverage" FORCE)
SET(SC_BUILD_TYPE "Debug" CACHE STRING "Build type required by testing framework" FORCE)
SET( SC_PYTHON_GENERATOR OFF ) #won't build with static libs
ENDIF(SC_ENABLE_COVERAGE)
#---------------------------------------------------------------------
# Testing option
OPTION_WITH_DEFAULT( SC_ENABLE_TESTING "Enable unittesting framework" OFF )
IF(SC_ENABLE_TESTING)
if( NOT DEFINED SC_BUILD_SCHEMAS )
set( SC_BUILD_SCHEMAS "ALL" ) #test all schemas, unless otherwise specified
endif()
INCLUDE(CTest)
ENABLE_TESTING()
ENDIF(SC_ENABLE_TESTING)
#---------------------------------------------------------------------
# The following logic is what allows binaries to run successfully in
# the build directory AND install directory. Thanks to plplot for
# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX.
# Documentation of these options is available at
# http://www.cmake.org/Wiki/CMake_RPATH_handling
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# the RPATH/INSTALL_NAME_DIR to be used when installing
if (NOT APPLE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
endif(NOT APPLE)
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH which point to
# directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#-----------------------------------------------------------------------------
# Output directories.
# When this is a subbuild, assume that the parent project controls these
IF( NOT SC_IS_SUBBUILD )
IF(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
IF(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
ENDIF(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
IF(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SC_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
FOREACH(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
STRING(TOUPPER "${CFG_TYPE}" CFG_TYPE)
IF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
ENDIF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
IF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SC_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
ENDFOREACH()
ENDIF( NOT SC_IS_SUBBUILD )
#-----------------------------------------------------------------------------
# Configure install locations.
# The location in which to install SC. Need a good Debug location
# for Windows. Only do this if CMAKE_INSTALL_PREFIX hasn't been set
# already, to try and allow parent builds (if any) some control.
if(NOT SC_IS_SUBBUILD)
IF(NOT WIN32)
IF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
SET(SC_INSTALL_PREFIX "${SC_SOURCE_DIR}/../sc-install")
ELSE()
SET(SC_INSTALL_PREFIX "/usr/local")
ENDIF()
ENDIF(NOT WIN32)
SET( SC_INSTALL_PREFIX ${SC_INSTALL_PREFIX} CACHE
PATH "Install prefix prepended to target to create install location" )
SET( CMAKE_INSTALL_PREFIX ${SC_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories if target destination is not absolute, immutable" FORCE )
endif(NOT SC_IS_SUBBUILD)
OPTION(SC_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
MARK_AS_ADVANCED(SC_BUILD_EXPRESS_ONLY)
# Take the sc config file template as the starting point for
# sc_cf.h.in - scripts may need to append to the template, so
# it is read into memory initially.
SET(CONFIG_H_FILE ${SC_BINARY_DIR}/include/sc_cf.h.in)
set_source_files_properties(${CONFIG_H_FILE} PROPERTIES GENERATED TRUE)
set(CMAKE_CURRENT_PROJECT SC)
define_property(GLOBAL PROPERTY SC_CONFIG_H_CONTENTS BRIEF_DOCS "config.h.in contents" FULL_DOCS "config.h.in contents for SC project")
if(NOT COMMAND CONFIG_H_APPEND)
macro(CONFIG_H_APPEND PROJECT_NAME NEW_CONTENTS)
if(PROJECT_NAME)
get_property(${PROJECT_NAME}_CONFIG_H_CONTENTS GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS)
set(${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS "${${PROJECT_NAME}_CONFIG_H_CONTENTS}${NEW_CONTENTS}")
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS "${${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS}")
endif(PROJECT_NAME)
endmacro(CONFIG_H_APPEND NEW_CONTENTS)
endif(NOT COMMAND CONFIG_H_APPEND)
file(READ ${SC_SOURCE_DIR}/include/sc_cf_cmake.h.in CONFIG_H_FILE_CONTENTS)
CONFIG_H_APPEND(SC "${CONFIG_H_FILE_CONTENTS}")
# The Express parser uses the tools Perplex, RE2C and Lemon to generate code
# from higher level inputs. Depending on available tools and options, the
# SC build can either re-generate code as part of the build, or use cached
# files that are ready for compilation.
#
# SC_GENERATE_LEXER_PARSER is the "high level" control a user sets to determine
# how the SC build will interact (or not) with these tools. AUTO (the
# default) means it will search for the necessary tools, and use them only if
# everything is found. If not, it will fall back to the cached versions. If
# this option is set to ON and the necessary tools are not found, the
# configure step will fail. If it is set to OFF, SC will not even try to use
# the generators and will instead use the cached sources.
if(NOT SC_GENERATE_LEXER_PARSER)
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
else(NOT SC_GENERATE_LEXER_PARSER)
string(TOUPPER "${SC_GENERATE_LEXER_PARSER}" SC_GENERATE_LEXER_PARSER)
endif(NOT SC_GENERATE_LEXER_PARSER)
set_property(CACHE SC_GENERATE_LEXER_PARSER PROPERTY STRINGS AUTO ON OFF)
if (NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
message(WARNING "Unknown value ${SC_GENERATE_LEXER_PARSER} supplied for BRLCAD_WORD_SIZE - defaulting to AUTO")
message(WARNING "Valid options are AUTO, ON and OFF")
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
endif (NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
# If the generators have not been turned off, we need to check for them
if(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
find_package(LEMON)
find_package(RE2C)
find_package(PERPLEX)
if(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
# Templates may be anywhere - make sure we have a stable path if a relative
# path was specified at CMake time
get_filename_component(lemon_template_fpath "${LEMON_TEMPLATE}" ABSOLUTE)
if(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
get_filename_component(LEMON_TEMPLATE "${CMAKE_BINARY_DIR}/${LEMON_TEMPLATE}" ABSOLUTE)
endif(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
get_filename_component(perplex_template_fpath "${PERPLEX_TEMPLATE}" ABSOLUTE)
if(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
get_filename_component(PERPLEX_TEMPLATE "${CMAKE_BINARY_DIR}/${PERPLEX_TEMPLATE}" ABSOLUTE)
endif(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
if(NOT COMMAND LEMON_TARGET)
include(${SC_CMAKE_DIR}/LEMON_Util.cmake)
endif(NOT COMMAND LEMON_TARGET)
if(NOT COMMAND PERPLEX_TARGET)
include(${SC_CMAKE_DIR}/PERPLEX_Util.cmake)
endif(NOT COMMAND PERPLEX_TARGET)
set(SC_GENERATE_LP_SOURCES 1)
else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
if("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
message(FATAL_ERROR "\nSC_GENERATE_LEXER_PARSER set to ON, but one or more components of the Perplex/RE2C/Lemon toolchain were not found.\n")
else("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
set(SC_GENERATE_LP_SOURCES 0)
endif("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
endif(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
else(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
set(SC_GENERATE_LP_SOURCES 0)
endif(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
INCLUDE(CheckLibraryExists)
INCLUDE(CheckIncludeFile)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckTypeSize)
INCLUDE(CMakePushCheckState)
INCLUDE(CheckCXXSourceRuns)
CHECK_INCLUDE_FILE(ndir.h HAVE_NDIR_H)
CHECK_INCLUDE_FILE(stdarg.h HAVE_STDARG_H)
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/param.h HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILE(sysent.h HAVE_SYSENT_H)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
CHECK_INCLUDE_FILE(process.h HAVE_PROCESS_H)
CHECK_INCLUDE_FILE(io.h HAVE_IO_H)
CHECK_FUNCTION_EXISTS(abs HAVE_ABS)
CHECK_FUNCTION_EXISTS(memcpy HAVE_MEMCPY)
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS(getopt HAVE_GETOPT)
CHECK_TYPE_SIZE("ssize_t" SSIZE_T)
set( TEST_STD_THREAD "
#include <iostream>
#include <thread>
void do_work() {
std::cout << \"thread\" << std::endl;
}
int main() {
std::thread t(do_work);
t.join();
}
" )
cmake_push_check_state()
if( UNIX )
set( CMAKE_REQUIRED_FLAGS "-pthread -std=c++0x" )
else( UNIX )
# vars probably need set for MSVC11, embarcadero, etc
endif( UNIX )
CHECK_CXX_SOURCE_RUNS( "${TEST_STD_THREAD}" HAVE_STD_THREAD ) #quotes are *required*!
cmake_pop_check_state()
# Now that all the tests are done, configure the sc_cf.h file:
get_property(CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SC_CONFIG_H_CONTENTS)
file(WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS}")
configure_file(${CONFIG_H_FILE} ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h)
################ create sc_version_string.h, http://stackoverflow.com/questions/3780667
# Using 'ver_string' instead of 'sc_version_string.h' is a trick to force the
# command to always execute when the custom target is built. It works because
# a file by that name never exists.
configure_file(${SC_CMAKE_DIR}/sc_version_string.cmake ${SC_BINARY_DIR}/sc_version_string.cmake @ONLY)
add_custom_target(version_string ALL DEPENDS ver_string )
# creates sc_version_string.h using cmake script
add_custom_command(OUTPUT ver_string ${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SC_SOURCE_DIR}
-DBINARY_DIR=${SC_BINARY_DIR}
-P ${SC_BINARY_DIR}/sc_version_string.cmake)
# sc_version_string.h is a generated file
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE )
################
if(MSVC)
# add_definitions( -Wall )
add_definitions( -D__MSVC__ -D__WIN32__ )
add_definitions(-D__MSVC__ -D__WIN32__)
# Disable warning for preferred usage of secure functions (example strcpy should be strcpy_s, ...)
add_definitions( -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS )
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
elseif(BORLAND)
add_definitions( -D__BORLAND__ -D__WIN32__ )
add_definitions(-D__BORLAND__ -D__WIN32__)
else()
add_definitions( -pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long )
add_definitions(-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long)
endif()
include_directories(
${SC_SOURCE_DIR}/include
${SC_BINARY_DIR}/include
)
)
ADD_SUBDIRECTORY(src/base)
ADD_SUBDIRECTORY(src/express)
ADD_SUBDIRECTORY(src/exppp)
ADD_SUBDIRECTORY(src/exp2cxx)
ADD_SUBDIRECTORY(src/exp2python)
ADD_SUBDIRECTORY(src/clstepcore)
ADD_SUBDIRECTORY(src/cleditor)
ADD_SUBDIRECTORY(src/cldai)
ADD_SUBDIRECTORY(src/clutils)
if( NOT WIN32 ) # don't build cllazyfile on windows until export/import macros are in place
ADD_SUBDIRECTORY( src/cllazyfile )
endif( NOT WIN32 )
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(data)
IF(SC_ENABLE_TESTING)
ADD_SUBDIRECTORY( test )
ENDIF(SC_ENABLE_TESTING)
ADD_SUBDIRECTORY(doc)
add_subdirectory(src/base)
add_subdirectory(src/express)
add_subdirectory(src/exppp)
add_subdirectory(src/exp2cxx)
add_subdirectory(src/exp2python)
add_subdirectory(src/clstepcore)
add_subdirectory(src/cleditor)
add_subdirectory(src/cldai)
add_subdirectory(src/clutils)
if(NOT WIN32) # don't build cllazyfile on windows until export/import macros are in place
add_subdirectory(src/cllazyfile)
endif(NOT WIN32)
add_subdirectory(include)
add_subdirectory(data)
if(SC_ENABLE_TESTING)
add_subdirectory(test)
endif(SC_ENABLE_TESTING)
add_subdirectory(doc)
if( SCHEMAS_WARNING )
message( "** CMake variable SC_BUILD_SCHEMAS was not set. Defaults to building ALL schemas, which will take a")
message(" while; see http://stepcode.org/mw/index.php?title=STEPcode_CMake_variables#SC_BUILD_SCHEMAS" )
endif( SCHEMAS_WARNING )
message( ".. Don't worry about any messages above about missing headers or failed tests, as long as\n you see '-- Configuring done' below. Headers and features vary by compiler." )
# 'make core' builds everything that isn't generated. for devs.
add_custom_target(core)
add_dependencies(core stepdai check-express stepeditor exp2cxx)
# this is for testing - 'make core' builds everything that isn't generated
add_custom_target( core )
add_dependencies( core stepdai check-express stepeditor exp2cxx )
# CONFIG_END_MESSAGES - list of messages to be printed after everything else is done.
# THIS MUST BE LAST to ensure that they are visible to the user without scrolling.
foreach(_msg ${CONFIG_END_MESSAGES})
message("${_msg}")
endforeach(_msg ${CONFIG_END_MESSAGES})
if(NOT SC_IS_SUBBUILD)
###############################################################################
# SC Packaging #
# $make package #
###############################################################################
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEPcode")
SET(CPACK_SET_DESTDIR "ON")
SET(CPACK_PACKAGE_VERSION_MAJOR ${SC_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${SC_VERSION_MINOR})
SET(CPACK_PACKAGE_NAME SC )
SET(CPACK_PACKAGE_CONTACT "SC Developers <scl-dev@googlegroups.com>")
INCLUDE(CPack)
########################################################################################
# Uninstall code #
# From http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F #
# ######################################################################################
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif(NOT SC_IS_SUBBUILD)
+8
View File
@@ -8,3 +8,11 @@ set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=StepClassLibrary")
set(CTEST_DROP_SITE_CDASH TRUE)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+21
View File
@@ -1,4 +1,25 @@
STEPcode -- http://github.com/stepcode/stepcode -- http://stepcode.org
************************************************************************
Release 0.8 (December, 2014)
New since v0.7:
* handle diamond inheritance, derived Attributes
* rename fedex_python, fedex_plus to exp2py, exp2cxx
* many changes to the pretty printer, due to use in reformatting draft
and IS schemas (Thanks Tom!)
* parser was also changed due to errors caught while pretty printing
- we can be much more confident that the parser is correct now
* fix incorrect quoting of timestamp in p21 header
* fix various copy constructors and ShallowCopy() members
* split generated code into many small files
- far easier to open generated code in editors
- support more compilers
- small files are combined (via #include statements) into a few
large files for faster "unitary" builds, if the compiler can handle it
- unitary builds are faster than the previous builds
* most compiler warnings fixed
* finally, all tests pass!
************************************************************************
Release 0.7 (April, 2013)
+5 -2
View File
@@ -1,5 +1,8 @@
Travis-CI build status:
[![Build Status](https://travis-ci.org/stepcode/stepcode.svg?branch=master)](https://travis-ci.org/stepcode/stepcode)
***********************************************************************
STEPcode v0.7 -- stepcode.org, github.com/stepcode/stepcode
STEPcode v0.8 -- stepcode.org, github.com/stepcode/stepcode
* What is STEPcode? SC reads ISO10303-11 EXPRESS schemas and generates
C++ source code that can read and write Part 21 files conforming
@@ -54,4 +57,4 @@ Download astyle from http://sourceforge.net/projects/astyle/files/astyle/
***********************************************************************
For more info, see the wiki.
For more info, see the wiki.
+1 -1
View File
@@ -1 +1 @@
0.7
0.8
-6
View File
@@ -1,6 +0,0 @@
(from BRL-CAD)
* rewrite express parser to not require lex/yacc
* verify/fix step parser generation with newer AP schemas, seems to be
outputting invalid syntax.
+51 -44
View File
@@ -24,61 +24,68 @@
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
MACRO(CHECK_C_FILE_RUNS SOURCE VAR)
IF("${VAR}" MATCHES "^${VAR}$")
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
macro(CHECK_C_FILE_RUNS SOURCE VAR)
if("${VAR}" MATCHES "^${VAR}$")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
IF(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
ELSE(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
ENDIF(CMAKE_REQUIRED_LIBRARIES)
IF(CMAKE_REQUIRED_INCLUDES)
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
ELSE(CMAKE_REQUIRED_INCLUDES)
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
ENDIF(CMAKE_REQUIRED_INCLUDES)
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
else(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
endif(CMAKE_REQUIRED_LIBRARIES)
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
else(CMAKE_REQUIRED_INCLUDES)
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
endif(CMAKE_REQUIRED_INCLUDES)
MESSAGE(STATUS "Performing Test ${VAR}")
TRY_RUN(${VAR}_EXITCODE ${VAR}_COMPILED
message(STATUS "Performing Test ${VAR}")
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR}
${SOURCE}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${FILE_RUN_DEFINITIONS}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${FILE_RUN_DEFINITIONS}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
"${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
COMPILE_OUTPUT_VARIABLE OUTPUT)
# if it did not compile make the return value fail code of 1
IF(NOT ${VAR}_COMPILED)
SET(${VAR}_EXITCODE 1)
ENDIF(NOT ${VAR}_COMPILED)
if(NOT ${VAR}_COMPILED)
set(${VAR}_EXITCODE 1)
endif(NOT ${VAR}_COMPILED)
# if the return value was 0 then it worked
IF("${${VAR}_EXITCODE}" EQUAL 0)
SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
MESSAGE(STATUS "Performing Test ${VAR} - Success")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
"Return value: ${${VAR}}\n"
"Source file was:\n${SOURCE}\n")
ELSE("${${VAR}_EXITCODE}" EQUAL 0)
IF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
SET(${VAR} "${${VAR}_EXITCODE}")
ELSE(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
message(STATUS "Performing Test ${VAR} - Success")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
"Return value: ${${VAR}}\n"
"Source file was:\n${SOURCE}\n")
else("${${VAR}_EXITCODE}" EQUAL 0)
if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
set(${VAR} "${${VAR}_EXITCODE}")
else(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
MESSAGE(STATUS "Performing Test ${VAR} - Failed")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
"Return value: ${${VAR}_EXITCODE}\n"
"Source file was:\n${SOURCE}\n")
message(STATUS "Performing Test ${VAR} - Failed")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
"Return value: ${${VAR}_EXITCODE}\n"
"Source file was:\n${SOURCE}\n")
ENDIF("${${VAR}_EXITCODE}" EQUAL 0)
ENDIF("${VAR}" MATCHES "^${VAR}$")
ENDMACRO(CHECK_C_FILE_RUNS)
endif("${${VAR}_EXITCODE}" EQUAL 0)
endif("${VAR}" MATCHES "^${VAR}$")
endmacro(CHECK_C_FILE_RUNS)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+4 -4
View File
@@ -15,18 +15,18 @@
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
+4 -4
View File
@@ -15,18 +15,18 @@
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
+8
View File
@@ -8,3 +8,11 @@ mark_as_advanced(RE2C_EXECUTABLE)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+8 -8
View File
@@ -24,18 +24,18 @@
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
@@ -106,9 +106,9 @@ macro(LEMON_TARGET Name LemonInput LemonSource LemonHeader)
# rename generated outputs
if(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
add_custom_command(
OUTPUT ${LemonSource}
OUTPUT ${LemonSource}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${LemonSource}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
)
set(LEMON_${Name}_OUTPUTS ${LemonSource} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
@@ -116,7 +116,7 @@ macro(LEMON_TARGET Name LemonInput LemonSource LemonHeader)
add_custom_command(
OUTPUT ${LemonHeader}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${LemonHeader}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
)
set(LEMON_${Name}_OUTPUTS ${LemonHeader} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${LemonHeader}" STREQUAL "${LEMON_GEN_HEADER}")
@@ -125,7 +125,7 @@ macro(LEMON_TARGET Name LemonInput LemonSource LemonHeader)
# make sure we clean up generated output and copied input
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS}")
else("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS};${LEMON_BIN_INPUT}")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+6 -6
View File
@@ -1,5 +1,5 @@
# Defines two macros - PERPLEX_TARGET, which takes perplex inputs and
# runs both perplex and re2c to generate C source code/headers, and
# runs both perplex and re2c to generate C source code/headers, and
# ADD_PERPLEX_LEMON_DEPENDENCY which is used to set up dependencies between
# scanner and parser targets when necessary.
#
@@ -21,7 +21,7 @@
# ${PERPLEX_MyScanner_OUTPUTS}
# )
# ====================================================================
#
#
#=============================================================================
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
@@ -31,18 +31,18 @@
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
+152
View File
@@ -0,0 +1,152 @@
# testing and compilation options, build output dirs, install dirs, etc
# included by root CMakeLists
if(NOT DEFINED INCLUDE_INSTALL_DIR)
set(INCLUDE_INSTALL_DIR include)
endif(NOT DEFINED INCLUDE_INSTALL_DIR)
if(NOT DEFINED LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR lib)
endif(NOT DEFINED LIB_INSTALL_DIR)
if(NOT DEFINED BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR bin)
endif(NOT DEFINED BIN_INSTALL_DIR)
if(NOT DEFINED SC_BUILD_TYPE)
set(SC_BUILD_TYPE "Debug" CACHE STRING "Build type") # By default set debug build
endif(NOT DEFINED SC_BUILD_TYPE)
if(NOT SC_IS_SUBBUILD)
set(CMAKE_BUILD_TYPE ${SC_BUILD_TYPE} CACHE INTERNAL "Build type, immutable" FORCE)
else(NOT SC_IS_SUBBUILD)
set(CMAKE_BUILD_TYPE ${SC_BUILD_TYPE})
endif(NOT SC_IS_SUBBUILD)
# Define helper macro OPTION_WITH_DEFAULT
macro(OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT)
if(NOT DEFINED ${OPTION_NAME})
set(${OPTION_NAME} ${OPTION_DEFAULT})
endif(NOT DEFINED ${OPTION_NAME})
option(${OPTION_NAME} "${OPTION_STRING}" ${${OPTION_NAME}})
endmacro(OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT)
# build shared libs by default
OPTION_WITH_DEFAULT(SC_BUILD_SHARED_LIBS "Build shared libs" ON)
# don't build static libs by default
OPTION_WITH_DEFAULT(SC_BUILD_STATIC_LIBS "Build static libs" OFF)
OPTION_WITH_DEFAULT(SC_PYTHON_GENERATOR "Compile exp2python" ON)
OPTION_WITH_DEFAULT(SC_CPP_GENERATOR "Compile exp2cxx" ON)
OPTION_WITH_DEFAULT(SC_MEMMGR_ENABLE_CHECKS "Enable sc_memmgr's memory leak detection" OFF)
OPTION_WITH_DEFAULT(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
option(SC_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
mark_as_advanced(SC_BUILD_EXPRESS_ONLY)
#---------------------------------------------------------------------
# Coverage option
OPTION_WITH_DEFAULT(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
if(SC_ENABLE_COVERAGE)
set(SC_ENABLE_TESTING ON CACHE BOOL "Testing enabled by coverage option" FORCE)
# build static libs, better coverage report
set(SC_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
set(SC_BUILD_STATIC_LIBS ON CACHE BOOL "Build static libs" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage" CACHE STRING "Extra linker flags required by code coverage" FORCE)
set(SC_BUILD_TYPE "Debug" CACHE STRING "Build type required by testing framework" FORCE)
set(SC_PYTHON_GENERATOR OFF) #won't build with static libs
endif(SC_ENABLE_COVERAGE)
#---------------------------------------------------------------------
# Testing option
OPTION_WITH_DEFAULT(SC_ENABLE_TESTING "Enable unittesting framework" OFF)
if(SC_ENABLE_TESTING)
if(NOT DEFINED SC_BUILD_SCHEMAS)
set(SC_BUILD_SCHEMAS "ALL") #test all schemas, unless otherwise specified
endif()
include(CTest)
ENABLE_TESTING()
endif(SC_ENABLE_TESTING)
#---------------------------------------------------------------------
# The following logic is what allows binaries to run successfully in
# the build directory AND install directory. Thanks to plplot for
# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX.
# Documentation of these options is available at
# http://www.cmake.org/Wiki/CMake_RPATH_handling
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# the RPATH/INSTALL_NAME_DIR to be used when installing
if (NOT APPLE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
endif(NOT APPLE)
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH which point to
# directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# When this is a subbuild, assume that the parent project controls all of the following
#======================================================================================
if(NOT SC_IS_SUBBUILD)
# Output directories. In a separate file so it can be used by the schema scanner CMake as well.
include(${SC_CMAKE_DIR}/SC_Outdirs.cmake)
#-----------------------------------------------------------------------------
# Configure install locations. Only do this if CMAKE_INSTALL_PREFIX hasn't
# been set already, to try and allow parent builds (if any) some control.
#
# Need a good Debug location for Windows.
if(NOT WIN32)
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(SC_INSTALL_PREFIX "${SC_SOURCE_DIR}/../sc-install")
else()
set(SC_INSTALL_PREFIX "/usr/local")
endif()
endif(NOT WIN32)
set(SC_INSTALL_PREFIX ${SC_INSTALL_PREFIX} CACHE
PATH "Install prefix prepended to target to create install location")
set(CMAKE_INSTALL_PREFIX ${SC_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories if target destination is not absolute, immutable" FORCE)
#-----------------------------------------------------------------------------
# SC Packaging
# $make package
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEPcode")
set(CPACK_SET_DESTDIR "ON")
set(CPACK_PACKAGE_VERSION_MAJOR ${SC_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SC_VERSION_MINOR})
set(CPACK_PACKAGE_NAME SC)
set(CPACK_PACKAGE_CONTACT "SC Developers <scl-dev@googlegroups.com>")
include(CPack)
#-----------------------------------------------------------------------------
# Uninstall target
# From http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif(NOT SC_IS_SUBBUILD)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+115
View File
@@ -0,0 +1,115 @@
# macros to be used in the CMakeLists generated by the schema scanner
# uses SC_GENERATE_CXX_ONESHOT - if true, files will only be generated once. this is useful when debugging and modifying code, not otherwise. TODO: print a warning when set
if(NOT DEFINED SC_GENERATE_CXX_ONESHOT)
set(SC_GENERATE_CXX_ONESHOT FALSE)
endif(NOT DEFINED SC_GENERATE_CXX_ONESHOT)
# find all part 21 files in schema dir, add a test for each one
macro(P21_TESTS sfile)
get_filename_component(SCHEMA_DIR ${sfile} PATH)
file(GLOB_RECURSE P21_FILES ${SCHEMA_DIR}/*.stp ${SCHEMA_DIR}/*.step ${SCHEMA_DIR}/*.p21 ${SCHEMA_DIR}/*.ifc)
foreach(TEST_FILE ${P21_FILES})
get_filename_component(FNAME ${TEST_FILE} NAME_WE)
add_test(NAME read_write_cpp_${PROJECT_NAME}_${FNAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND p21read_${PROJECT_NAME} ${TEST_FILE})
set_tests_properties(read_write_cpp_${PROJECT_NAME}_${FNAME} PROPERTIES DEPENDS build_cpp_${PROJECT_NAME} LABELS cpp_schema_rw)
if(NOT WIN32)
add_test(NAME read_lazy_cpp_${PROJECT_NAME}_${FNAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND lazy_${PROJECT_NAME} ${TEST_FILE})
set_tests_properties(read_lazy_cpp_${PROJECT_NAME}_${FNAME} PROPERTIES DEPENDS build_lazy_cpp_${PROJECT_NAME} LABELS cpp_schema_rw)
endif(NOT WIN32)
endforeach()
endmacro(P21_TESTS sfile)
# create p21read_sdai_*, lazy_sdai_*, any exes listed in SC_SDAI_ADDITIONAL_EXES_SRCS
macro(SCHEMA_EXES)
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
SC_ADDEXEC(p21read_${PROJECT_NAME} "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" "${PROJECT_NAME};stepdai;stepcore;stepeditor;steputils;base" "TESTABLE")
#add_dependencies(p21read_${PROJECT_NAME} version_string)
if(NOT WIN32)
SC_ADDEXEC(lazy_${PROJECT_NAME} "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc" "${PROJECT_NAME};steplazyfile;stepdai;stepcore;stepeditor;steputils;base" "TESTABLE")
#add_dependencies(lazy_${PROJECT_NAME} version_string)
endif(NOT WIN32)
#add user-defined executables
foreach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
get_filename_component(name ${src} NAME_WE)
get_filename_component(path ${src} ABSOLUTE)
SC_ADDEXEC(${name}_${PROJECT_NAME} "${src}" "${PROJECT_NAME};stepdai;stepcore;stepeditor;steputils;base" "TESTABLE")
add_dependencies(${name}_${PROJECT_NAME} version_string)
#set_target_properties(${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}")
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
ENDMACRO(SCHEMA_EXES)
# label the tests and set dependencies
macro(SCHEMA_TESTS)
add_test(NAME generate_cpp_${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target generate_cpp_${PROJECT_NAME}
--config $<CONFIGURATION>)
set_tests_properties(generate_cpp_${PROJECT_NAME} PROPERTIES LABELS cpp_schema_gen)
add_test(NAME build_cpp_${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target p21read_${PROJECT_NAME}
--config $<CONFIGURATION>)
set_tests_properties(build_cpp_${PROJECT_NAME} PROPERTIES DEPENDS generate_cpp_${PROJECT_NAME} LABELS cpp_schema_build)
if(NOT WIN32)
add_test(NAME build_lazy_cpp_${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target lazy_${PROJECT_NAME}
--config $<CONFIGURATION>)
set_tests_properties(build_lazy_cpp_${PROJECT_NAME} PROPERTIES DEPENDS build_cpp_${PROJECT_NAME} LABELS cpp_schema_build)
endif(NOT WIN32)
endmacro(SCHEMA_TESTS)
# SCHEMA_TARGETS macro -
# expFile: path to express file
# schemaName: name of the schema
# sourceFiles: list of .cc and .h files
#
# create targets for the schema(s) in expFile
# targets include gen_cxx_*, sdai_cxx_*, p21read_*, lazyp21_*, ...
macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
# schema scanner comes up with a short schema name for PROJECT() (which sets ${PROJECT_NAME})
message(STATUS "Will generate ${${PROJECT_NAME}_file_count} C++ files for ${PROJECT_NAME}.")
add_custom_target(generate_cpp_${PROJECT_NAME} DEPENDS exp2cxx ${expFile} ${sourceFiles} SOURCES ${sourceFiles})
# this calls a cmake script because it doesn't seem to be possible
# to divert stdout, stderr in cmake except via execute_process
add_custom_command(OUTPUT ${sourceFiles}
COMMAND ${CMAKE_COMMAND} -DEXE=\"$<TARGET_FILE:exp2cxx>\" -DEXP=\"${expFile}\"
-DONESHOT=\"${SC_GENERATE_CXX_ONESHOT}\" -DSDIR=\"${CMAKE_CURRENT_LIST_DIR}\"
-P ${SC_CMAKE_DIR}/SC_Run_exp2cxx.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMENT "[exp2cxx] Generating ${${PROJECT_NAME}_file_count} C++ files for ${PROJECT_NAME}."
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${SC_SOURCE_DIR}/src/cldai ${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/base/judy/src
)
# if testing is enabled, "TESTABLE" sets property EXCLUDE_FROM_ALL and prevents installation
SC_ADDLIB(${PROJECT_NAME} "${sourceFiles}" "stepdai;stepcore;stepeditor;steputils;base" "TESTABLE")
add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME})
SCHEMA_EXES()
SCHEMA_TESTS()
P21_TESTS(${expFile})
# TODO add test to verify that schema scanner output matches fedex_plus output
endmacro(SCHEMA_TARGETS expFile schemaName sourceFiles)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+96
View File
@@ -0,0 +1,96 @@
# create sc_cf.h and sc_version_string.h
# Take the sc config file template as the starting point for
# sc_cf.h.in - scripts may need to append to the template, so
# it is read into memory initially.
set(CONFIG_H_FILE ${SC_BINARY_DIR}/include/sc_cf.h.in)
set_source_files_properties(${CONFIG_H_FILE} PROPERTIES GENERATED TRUE)
set(CMAKE_CURRENT_PROJECT SC)
define_property(GLOBAL PROPERTY SC_CONFIG_H_CONTENTS BRIEF_DOCS "config.h.in contents" FULL_DOCS "config.h.in contents for SC project")
if(NOT COMMAND CONFIG_H_APPEND)
macro(CONFIG_H_APPEND PROJECT_NAME NEW_CONTENTS)
if(PROJECT_NAME)
get_property(${PROJECT_NAME}_CONFIG_H_CONTENTS GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS)
set(${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS "${${PROJECT_NAME}_CONFIG_H_CONTENTS}${NEW_CONTENTS}")
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS "${${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS}")
endif(PROJECT_NAME)
endmacro(CONFIG_H_APPEND NEW_CONTENTS)
endif(NOT COMMAND CONFIG_H_APPEND)
file(READ ${SC_SOURCE_DIR}/include/sc_cf_cmake.h.in CONFIG_H_FILE_CONTENTS)
CONFIG_H_APPEND(SC "${CONFIG_H_FILE_CONTENTS}")
include(CheckLibraryExists)
include(CheckIncludeFile)
include(CheckFunctionExists)
include(CheckTypeSize)
include(CMakePushCheckState)
include(CheckCXXSourceRuns)
CHECK_INCLUDE_FILE(ndir.h HAVE_NDIR_H)
CHECK_INCLUDE_FILE(stdarg.h HAVE_STDARG_H)
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/param.h HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILE(sysent.h HAVE_SYSENT_H)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
CHECK_INCLUDE_FILE(process.h HAVE_PROCESS_H)
CHECK_INCLUDE_FILE(io.h HAVE_IO_H)
CHECK_FUNCTION_EXISTS(abs HAVE_ABS)
CHECK_FUNCTION_EXISTS(memcpy HAVE_MEMCPY)
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS(getopt HAVE_GETOPT)
CHECK_TYPE_SIZE("ssize_t" SSIZE_T)
set( TEST_STD_THREAD "
#include <iostream>
#include <thread>
void do_work() {
std::cout << \"thread\" << std::endl;
}
int main() {
std::thread t(do_work);
t.join();
}
" )
cmake_push_check_state()
if( UNIX )
set( CMAKE_REQUIRED_FLAGS "-pthread -std=c++0x" )
else( UNIX )
# vars probably need set for MSVC11, embarcadero, etc
endif( UNIX )
CHECK_CXX_SOURCE_RUNS( "${TEST_STD_THREAD}" HAVE_STD_THREAD ) #quotes are *required*!
cmake_pop_check_state()
# Now that all the tests are done, configure the sc_cf.h file:
get_property(CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SC_CONFIG_H_CONTENTS)
file(WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS}")
configure_file(${CONFIG_H_FILE} ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h)
# ------------------------
# create sc_version_string.h, http://stackoverflow.com/questions/3780667
# Using 'ver_string' instead of 'sc_version_string.h' is a trick to force the
# command to always execute when the custom target is built. It works because
# a file by that name never exists.
configure_file(${SC_CMAKE_DIR}/sc_version_string.cmake ${SC_BINARY_DIR}/sc_version_string.cmake @ONLY)
add_custom_target(version_string ALL DEPENDS ver_string )
# creates sc_version_string.h using cmake script
add_custom_command(OUTPUT ver_string ${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SC_SOURCE_DIR}
-DBINARY_DIR=${SC_BINARY_DIR}
-P ${SC_BINARY_DIR}/sc_version_string.cmake)
# sc_version_string.h is a generated file
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE )
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+22
View File
@@ -0,0 +1,22 @@
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables and set them
# to "C" so things like date output are as expected
set(_orig_lc_all $ENV{LC_ALL})
set(_orig_lc_messages $ENV{LC_MESSAGES})
set(_orig_lang $ENV{LANG})
if(_orig_lc_all)
set(ENV{LC_ALL} C)
endif(_orig_lc_all)
if(_orig_lc_messages)
set(ENV{LC_MESSAGES} C)
endif(_orig_lc_messages)
if(_orig_lang)
set(ENV{LANG} C)
endif(_orig_lang)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+30
View File
@@ -0,0 +1,30 @@
# in its own file so that it can be used by the schema scanner as well
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
endif(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
if(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
endif(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SC_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
endif(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE)
if(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
set("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
endif(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
if(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
set("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SC_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
endif(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
if(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
set("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SC_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
endif(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
endforeach()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+93
View File
@@ -0,0 +1,93 @@
macro(REVERSE_PATH in_path out_path drive_path)
set(reversed_path)
set(tmp_subpath "${in_path}")
while(NOT "${tmp_subpath}" STREQUAL "" AND NOT "${tmp_subpath}" STREQUAL "/")
get_filename_component(piece "${tmp_subpath}" NAME)
get_filename_component(tmp_subpath "${tmp_subpath}" PATH)
if(piece)
set(reversed_path "${reversed_path}/${piece}")
else(piece)
set(${drive_path} ${tmp_subpath})
set(tmp_subpath)
endif(piece)
endwhile(NOT "${tmp_subpath}" STREQUAL "" AND NOT "${tmp_subpath}" STREQUAL "/")
set("${out_path}" "${reversed_path}")
endmacro(REVERSE_PATH)
macro(GET_COMMON_ROOT_PATH dir1 dir2 common_subpath)
get_filename_component(testpath "${dir1}" REALPATH)
set(dir1_rev)
set(dir2_rev)
REVERSE_PATH("${dir1}" dir1_rev drive_name_1)
REVERSE_PATH("${dir2}" dir2_rev drive_name_2)
if("${drive_name_1}" STREQUAL "${drive_name_2}")
set(component_same 1)
set(${common_subpath})
while(component_same)
get_filename_component(piece1 "${dir1_rev}" NAME)
get_filename_component(dir1_rev "${dir1_rev}" PATH)
get_filename_component(piece2 "${dir2_rev}" NAME)
get_filename_component(dir2_rev "${dir2_rev}" PATH)
if("${piece1}" STREQUAL "${piece2}")
set(${common_subpath} "${${common_subpath}}/${piece1}")
else("${piece1}" STREQUAL "${piece2}")
set(component_same 0)
endif("${piece1}" STREQUAL "${piece2}")
endwhile(component_same)
if(drive_name_1)
set(${common_subpath} "${drive_name_1}${${common_subpath}}")
string(REPLACE "//" "/" ${common_subpath} "${${common_subpath}}")
endif(drive_name_1)
endif("${drive_name_1}" STREQUAL "${drive_name_2}")
endmacro(GET_COMMON_ROOT_PATH)
macro(RELATIVE_PATH_TO_TOPLEVEL current_dir rel_path)
set(common_root_path)
GET_COMMON_ROOT_PATH("${SC_SOURCE_DIR}" "${current_dir}" common_root_path)
string(REPLACE "${common_root_path}" "" subpath "${current_dir}")
string(REPLACE "${common_root_path}" "" needed_src_path "${SC_SOURCE_DIR}")
string(REGEX REPLACE "^/" "" subpath "${subpath}")
string(REGEX REPLACE "^/" "" needed_src_path "${needed_src_path}")
string(LENGTH "${subpath}" PATH_LENGTH)
if(PATH_LENGTH GREATER 0)
set(${rel_path} "..")
get_filename_component(subpath "${subpath}" PATH)
string(LENGTH "${subpath}" PATH_LENGTH)
while(PATH_LENGTH GREATER 0)
set(${rel_path} "${${rel_path}}/..")
get_filename_component(subpath "${subpath}" PATH)
string(LENGTH "${subpath}" PATH_LENGTH)
endwhile(PATH_LENGTH GREATER 0)
endif(PATH_LENGTH GREATER 0)
set(${rel_path} "${${rel_path}}/${needed_src_path}")
string(REPLACE "//" "/" ${rel_path} "${${rel_path}}")
endmacro(RELATIVE_PATH_TO_TOPLEVEL current_dir rel_path)
macro(LOCATE_SCHEMA SCHEMA_FILE _res_var)
if(EXISTS "${CMAKE_BINARY_DIR}/${SCHEMA_FILE}") #is it a path relative to build dir?
set(${_res_var} "${CMAKE_BINARY_DIR}/${SCHEMA_FILE}")
elseif(EXISTS "${SC_SOURCE_DIR}/data/${SCHEMA_FILE}") # path relative to STEPcode/data?
set(${_res_var} "${SC_SOURCE_DIR}/data/${SCHEMA_FILE}")
elseif(EXISTS ${SCHEMA_FILE}) # already an absolute path
set(${_res_var} ${SCHEMA_FILE})
else()
message(FATAL_ERROR "Cannot find ${CMAKE_BINARY_DIR}/${SCHEMA_FILE} or ${SC_SOURCE_DIR}/data/${SCHEMA_FILE}/*.exp or ${SCHEMA_FILE}")
endif()
if(IS_DIRECTORY ${${_res_var}}) #if it is a dir, look for one .exp file inside
file(GLOB ${_res_var} ${${_res_var}}/*.exp)
endif()
if(NOT EXISTS ${${_res_var}})
message(FATAL_ERROR "Expected one express file. Found '${${_res_var}}' instead.")
endif()
endmacro(LOCATE_SCHEMA SCHEMA_FILE _res_var)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+68
View File
@@ -0,0 +1,68 @@
# The Express parser uses the tools Perplex, RE2C and Lemon to generate code
# from higher level inputs. Depending on available tools and options, the
# SC build can either re-generate code as part of the build, or use cached
# files that are ready for compilation.
#
# SC_GENERATE_LEXER_PARSER is the "high level" control a user sets to determine
# how the SC build will interact (or not) with these tools. AUTO (the
# default) means it will search for the necessary tools, and use them only if
# everything is found. If not, it will fall back to the cached versions. If
# this option is set to ON and the necessary tools are not found, the
# configure step will fail. If it is set to OFF, SC will not even try to use
# the generators and will instead use the cached sources.
if(NOT DEFINED SC_GENERATE_LEXER_PARSER)
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
set(_verbosity "QUIET")
else(NOT DEFINED SC_GENERATE_LEXER_PARSER)
string(TOUPPER "${SC_GENERATE_LEXER_PARSER}" SC_GENERATE_LEXER_PARSER)
endif(NOT DEFINED SC_GENERATE_LEXER_PARSER)
set_property(CACHE SC_GENERATE_LEXER_PARSER PROPERTY STRINGS AUTO ON OFF)
if (NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
message(WARNING "Unknown value ${SC_GENERATE_LEXER_PARSER} supplied for SC_GENERATE_LEXER_PARSER - defaulting to AUTO")
message(WARNING "Valid options are AUTO, ON and OFF")
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
endif (NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
# If the generators have not been turned off, we need to check for them
if(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
find_package(LEMON ${_verbosity})
find_package(RE2C ${_verbosity})
find_package(PERPLEX ${_verbosity})
if(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
# Templates may be anywhere - make sure we have a stable path if a relative
# path was specified at CMake time
get_filename_component(lemon_template_fpath "${LEMON_TEMPLATE}" ABSOLUTE)
if(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
get_filename_component(LEMON_TEMPLATE "${CMAKE_BINARY_DIR}/${LEMON_TEMPLATE}" ABSOLUTE)
endif(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
get_filename_component(perplex_template_fpath "${PERPLEX_TEMPLATE}" ABSOLUTE)
if(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
get_filename_component(PERPLEX_TEMPLATE "${CMAKE_BINARY_DIR}/${PERPLEX_TEMPLATE}" ABSOLUTE)
endif(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
if(NOT COMMAND LEMON_TARGET)
include(${SC_CMAKE_DIR}/LEMON_Util.cmake)
endif(NOT COMMAND LEMON_TARGET)
if(NOT COMMAND PERPLEX_TARGET)
include(${SC_CMAKE_DIR}/PERPLEX_Util.cmake)
endif(NOT COMMAND PERPLEX_TARGET)
set(SC_GENERATE_LP_SOURCES 1)
message(".. Found perplex, re2c, and lemon - can regenerate lexer/parser if necessary")
else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
if("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
message(FATAL_ERROR "\nSC_GENERATE_LEXER_PARSER set to ON, but one or more components of the Perplex/RE2C/Lemon toolchain were not found.\n")
else("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
set(SC_GENERATE_LP_SOURCES 0)
endif("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
endif(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
else(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
set(SC_GENERATE_LP_SOURCES 0)
endif(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+25
View File
@@ -0,0 +1,25 @@
# if oneshot is true, don't run exp2cxx if source files exist. if schema.cc exists, assume others do
if(ONESHOT AND EXISTS "${SDIR}/schema.cc")
message("WARNING: SC_GENERATE_CXX_ONESHOT is enabled. If generated code has been modified, it will NOT be rewritten!")
message("This is ONLY for debugging STEPcode internals!")
else()
execute_process(COMMAND ${EXE} ${EXP}
WORKING_DIRECTORY ${SDIR}
RESULT_VARIABLE _res
OUTPUT_FILE exp2cxx_stdout.txt
ERROR_FILE exp2cxx_stderr.txt
)
if(NOT "${_res}" STREQUAL "0")
message(FATAL_ERROR "${EXE} reported an error for ${EXP}.\nsee exp2cxx_stdout.txt and exp2cxx_stderr.txt in ${SDIR} for details.")
endif(NOT "${_res}" STREQUAL "0")
# TODO count number of lines in stdout/stderr and tell user?
endif()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+168
View File
@@ -0,0 +1,168 @@
# set compile definitions for dll exports on windows
macro(DEFINE_DLL_EXPORTS libname)
if(MSVC OR BORLAND)
if(${libname} MATCHES "sdai_.*")
set(export "SC_SCHEMA_DLL_EXPORTS")
else()
string(REGEX REPLACE "lib" "" shortname "${libname}")
string(REGEX REPLACE "step" "" LOWERCORE "${shortname}")
string(TOUPPER ${LOWERCORE} UPPER_CORE)
set(export "SC_${UPPER_CORE}_DLL_EXPORTS")
endif()
get_target_property(defs ${libname} COMPILE_DEFINITIONS)
if(defs) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false
set(defs "${defs};${export}")
else(defs)
set(defs "${export}")
endif(defs)
set_target_properties(${libname} PROPERTIES COMPILE_DEFINITIONS "${defs}")
endif(MSVC OR BORLAND)
endmacro(DEFINE_DLL_EXPORTS libname)
# set compile definitions for dll imports on windows
macro(DEFINE_DLL_IMPORTS tgt libs)
if(MSVC OR BORLAND)
get_target_property(defs ${tgt} COMPILE_DEFINITIONS)
if(NOT defs) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false
set(defs "")
endif(NOT defs)
foreach(lib ${libs})
string(REGEX REPLACE "lib" "" shortname "${lib}")
string(REGEX REPLACE "step" "" LOWERCORE "${shortname}")
string(TOUPPER ${LOWERCORE} UPPER_CORE)
list(APPEND defs "SC_${UPPER_CORE}_DLL_IMPORTS")
endforeach(lib ${libs})
if(DEFINED defs)
if(defs)
set_target_properties(${tgt} PROPERTIES COMPILE_DEFINITIONS "${defs}")
endif(defs)
endif(DEFINED defs)
endif(MSVC OR BORLAND)
endmacro(DEFINE_DLL_IMPORTS tgt libs)
#EXCLUDE_OR_INSTALL(target destination ARGV3)
# installs ${target} in ${destination} unless testing is enabled AND ${arg_3} == "TESTABLE",
# in which case the EXCLUDE_FROM_ALL property is set for testing.
# EXCLUDE_FROM_ALL cannot be set on targets that are to be installed,
# so either test the target or install it - but not both
macro(EXCLUDE_OR_INSTALL target dest arg_3)
if(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
INSTALL(TARGETS ${target} DESTINATION ${dest})
else(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON)
endif(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
endmacro(EXCLUDE_OR_INSTALL target dest arg_3)
#SC_ADDEXEC(execname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
# optional args can also be used by MSVC-specific code, but it looks like these two uses
# will not conflict because the MSVC args must contain "STRICT"
macro(SC_ADDEXEC execname srcslist libslist)
if(SC_BUILD_SHARED_LIBS)
add_executable(${execname} ${srcslist})
target_link_libraries(${execname} ${libslist})
DEFINE_DLL_IMPORTS(${execname} "${libslist}") #add import definitions for all libs that the executable is linked to
EXCLUDE_OR_INSTALL(${execname} "bin" "${ARGV3}")
# Enable extra compiler flags if local executables and/or global options dictate
set(LOCAL_COMPILE_FLAGS "")
foreach(extraarg ${ARGN})
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
endforeach(extraarg ${ARGN})
if(LOCAL_COMPILE_FLAGS)
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
endif(LOCAL_COMPILE_FLAGS)
endif(SC_BUILD_SHARED_LIBS)
if(SC_BUILD_STATIC_LIBS)
if(NOT SC_BUILD_SHARED_LIBS)
set(staticexecname "${execname}")
else()
set(staticexecname "${execname}-static")
endif(NOT SC_BUILD_SHARED_LIBS)
add_executable(${staticexecname} ${srcslist})
target_link_libraries(${staticexecname} ${libslist})
EXCLUDE_OR_INSTALL(${staticexecname} "bin" "${ARGV3}")
# Enable extra compiler flags if local executables and/or global options dictate
set(LOCAL_COMPILE_FLAGS "")
foreach(extraarg ${ARGN})
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
endforeach(extraarg ${ARGN})
if(LOCAL_COMPILE_FLAGS)
set_target_properties(${staticexecname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
endif(LOCAL_COMPILE_FLAGS)
endif(SC_BUILD_STATIC_LIBS)
endmacro(SC_ADDEXEC execname srcslist libslist)
#SC_ADDLIB(libname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
# optional args can also be used by MSVC-specific code, but it looks like these two uses
# will not conflict because the MSVC args must contain "STRICT"
macro(SC_ADDLIB libname srcslist libslist)
string(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}")
if(SC_BUILD_SHARED_LIBS)
add_library(${libname} SHARED ${srcslist})
DEFINE_DLL_EXPORTS(${libname})
if(NOT "${libs}" MATCHES "NONE")
target_link_libraries(${libname} ${libslist})
DEFINE_DLL_IMPORTS(${libname} "${libslist}")
endif(NOT "${libs}" MATCHES "NONE")
set_target_properties(${libname} PROPERTIES VERSION ${SC_ABI_VERSION} SOVERSION ${SC_ABI_SOVERSION})
EXCLUDE_OR_INSTALL(${libname} "lib" "${ARGV3}")
if(APPLE)
set_target_properties(${libname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
endif(SC_BUILD_SHARED_LIBS)
if(SC_BUILD_STATIC_LIBS)
if(NOT SC_BUILD_SHARED_LIBS)
set(staticlibname "${libname}")
else()
set(staticlibname "${libname}-static")
endif(NOT SC_BUILD_SHARED_LIBS)
add_library(${staticlibname} STATIC ${srcslist})
DEFINE_DLL_EXPORTS(${staticlibname})
if(NOT ${libs} MATCHES "NONE")
target_link_libraries(${staticlibname} "${libslist}")
DEFINE_DLL_IMPORTS(${staticlibname} ${libslist})
endif(NOT ${libs} MATCHES "NONE")
if(NOT WIN32)
set_target_properties(${staticlibname} PROPERTIES OUTPUT_NAME "${libname}")
endif(NOT WIN32)
if(WIN32)
# We need the lib prefix on win32, so add it even if our add_library
# wrapper function has removed it due to the target name - see
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F
set_target_properties(${staticlibname} PROPERTIES PREFIX "lib")
endif(WIN32)
EXCLUDE_OR_INSTALL(${staticlibname} "lib" "${ARGV3}")
if(APPLE)
set_target_properties(${staticlibname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
endif(SC_BUILD_STATIC_LIBS)
# Enable extra compiler flags if local libraries and/or global options dictate
set(LOCAL_COMPILE_FLAGS "")
foreach(extraarg ${ARGN})
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
endforeach(extraarg ${ARGN})
if(LOCAL_COMPILE_FLAGS)
if(BUILD_SHARED_LIBS)
set_target_properties(${libname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
endif(BUILD_SHARED_LIBS)
if(BUILD_STATIC_LIBS)
set_target_properties(${staticlibname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
endif(BUILD_STATIC_LIBS)
endif(LOCAL_COMPILE_FLAGS)
endmacro(SC_ADDLIB libname srcslist libslist)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-138
View File
@@ -1,138 +0,0 @@
# set compile definitions for dll exports on windows
MACRO(DEFINE_DLL_EXPORTS libname)
IF( MSVC OR BORLAND )
if( ${libname} MATCHES "sdai_.*" )
set( export "SC_SCHEMA_DLL_EXPORTS" )
else()
STRING(REGEX REPLACE "lib" "" shortname "${libname}")
STRING(REGEX REPLACE "step" "" LOWERCORE "${shortname}")
STRING(TOUPPER ${LOWERCORE} UPPER_CORE)
set( export "SC_${UPPER_CORE}_DLL_EXPORTS" )
endif()
get_target_property(defs ${libname} COMPILE_DEFINITIONS )
if( defs ) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false
set( defs "${defs};${export}")
else( defs )
set( defs "${export}")
endif( defs )
set_target_properties(${libname} PROPERTIES COMPILE_DEFINITIONS "${defs}" )
ENDIF( MSVC OR BORLAND )
ENDMACRO(DEFINE_DLL_EXPORTS libname)
# set compile definitions for dll imports on windows
MACRO( DEFINE_DLL_IMPORTS tgt libs )
IF( MSVC OR BORLAND )
get_target_property(defs ${tgt} COMPILE_DEFINITIONS )
if( NOT defs ) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false
set( defs "")
endif( NOT defs )
foreach( lib ${libs} )
STRING(REGEX REPLACE "lib" "" shortname "${lib}")
STRING(REGEX REPLACE "step" "" LOWERCORE "${shortname}")
STRING(TOUPPER ${LOWERCORE} UPPER_CORE)
list( APPEND defs "SC_${UPPER_CORE}_DLL_IMPORTS" )
endforeach( lib ${libs} )
if( DEFINED defs )
if( defs )
set_target_properties( ${tgt} PROPERTIES COMPILE_DEFINITIONS "${defs}" )
endif( defs )
endif( DEFINED defs )
ENDIF( MSVC OR BORLAND )
ENDMACRO( DEFINE_DLL_IMPORTS tgt libs )
#EXCLUDE_OR_INSTALL(target destination ARGV3)
# installs ${target} in ${destination} unless testing is enabled AND ${arg_3} == "TESTABLE",
# in which case the EXCLUDE_FROM_ALL property is set for testing.
# EXCLUDE_FROM_ALL cannot be set on targets that are to be installed,
# so either test the target or install it - but not both
MACRO(EXCLUDE_OR_INSTALL target dest arg_3 )
if( NOT ( ( SC_ENABLE_TESTING ) AND ( "${arg_3}" STREQUAL "TESTABLE" ) ) )
INSTALL(TARGETS ${target} DESTINATION ${dest})
else( NOT ( ( SC_ENABLE_TESTING ) AND ( "${arg_3}" STREQUAL "TESTABLE" ) ) )
set_target_properties( ${target} PROPERTIES EXCLUDE_FROM_ALL ON )
endif( NOT ( ( SC_ENABLE_TESTING ) AND ( "${arg_3}" STREQUAL "TESTABLE" ) ) )
ENDMACRO(EXCLUDE_OR_INSTALL target dest arg_3 )
#SC_ADDEXEC( execname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
# optional args can also be used by MSVC-specific code, but it looks like these two uses
# will not conflict because the MSVC args must contain "STRICT"
MACRO(SC_ADDEXEC execname srcslist libslist)
add_executable(${execname} ${srcslist})
target_link_libraries(${execname} ${libslist})
DEFINE_DLL_IMPORTS(${execname} "${libslist}") #add import definitions for all libs that the executable is linked to
EXCLUDE_OR_INSTALL( ${execname} "bin" "${ARGV3}" )
# Enable extra compiler flags if local executables and/or global options dictate
SET(LOCAL_COMPILE_FLAGS "")
FOREACH(extraarg ${ARGN})
IF(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
ENDIF(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
ENDFOREACH(extraarg ${ARGN})
IF(LOCAL_COMPILE_FLAGS)
SET_TARGET_PROPERTIES(${execname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
ENDIF(LOCAL_COMPILE_FLAGS)
ENDMACRO(SC_ADDEXEC execname srcslist libslist)
#SC_ADDLIB( libname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
# optional args can also be used by MSVC-specific code, but it looks like these two uses
# will not conflict because the MSVC args must contain "STRICT"
MACRO(SC_ADDLIB libname srcslist libslist)
STRING(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}")
IF(SC_BUILD_SHARED_LIBS)
add_library(${libname} SHARED ${srcslist})
DEFINE_DLL_EXPORTS(${libname})
if(NOT "${libs}" MATCHES "NONE")
target_link_libraries(${libname} ${libslist})
DEFINE_DLL_IMPORTS(${libname} "${libslist}" )
endif(NOT "${libs}" MATCHES "NONE")
SET_TARGET_PROPERTIES(${libname} PROPERTIES VERSION ${SC_ABI_VERSION} SOVERSION ${SC_ABI_SOVERSION} )
EXCLUDE_OR_INSTALL( ${libname} "lib" "${ARGV3}" )
if(APPLE)
set_target_properties(${libname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
ENDIF(SC_BUILD_SHARED_LIBS)
IF(SC_BUILD_STATIC_LIBS AND NOT MSVC)
if( NOT SC_BUILD_SHARED_LIBS )
set( staticlibname "${libname}" )
else()
set( staticlibname "${libname}-static" )
endif( NOT SC_BUILD_SHARED_LIBS )
add_library(${staticlibname} STATIC ${srcslist})
DEFINE_DLL_EXPORTS(${staticlibname})
if(NOT ${libs} MATCHES "NONE")
target_link_libraries(${staticlibname} "${libslist}")
DEFINE_DLL_IMPORTS(${staticlibname} ${libslist} )
endif(NOT ${libs} MATCHES "NONE")
IF(NOT WIN32)
SET_TARGET_PROPERTIES(${staticlibname} PROPERTIES OUTPUT_NAME "${libname}")
ENDIF(NOT WIN32)
IF(WIN32)
# We need the lib prefix on win32, so add it even if our add_library
# wrapper function has removed it due to the target name - see
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F
SET_TARGET_PROPERTIES(${staticlibname} PROPERTIES PREFIX "lib")
ENDIF(WIN32)
EXCLUDE_OR_INSTALL( ${staticlibname} "lib" "${ARGV3}" )
if(APPLE)
set_target_properties(${staticlibname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
ENDIF(SC_BUILD_STATIC_LIBS AND NOT MSVC)
# Enable extra compiler flags if local libraries and/or global options dictate
SET(LOCAL_COMPILE_FLAGS "")
FOREACH(extraarg ${ARGN})
IF(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
ENDIF(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
ENDFOREACH(extraarg ${ARGN})
IF(LOCAL_COMPILE_FLAGS)
IF(BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(${libname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
ENDIF(BUILD_SHARED_LIBS)
IF(BUILD_STATIC_LIBS AND NOT MSVC)
SET_TARGET_PROPERTIES(${staticlibname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
ENDIF(BUILD_STATIC_LIBS AND NOT MSVC)
ENDIF(LOCAL_COMPILE_FLAGS)
ENDMACRO(SC_ADDLIB libname srcslist libslist)
+23 -15
View File
@@ -1,22 +1,30 @@
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+55 -48
View File
@@ -4,7 +4,6 @@
# http://stackoverflow.com/questions/3780667
# http://www.cmake.org/pipermail/cmake/2009-February/027014.html
set(SC_IS_SUBBUILD "@SC_IS_SUBBUILD@")
#---------- find commit id ------------------
@@ -13,68 +12,76 @@ set(SC_IS_SUBBUILD "@SC_IS_SUBBUILD@")
#create a tag with 'git tag <name>' and 'git push --tags'
#if git can't be found, uses contents of SC_VERSION.txt
set(VERS_FILE ${SOURCE_DIR}/SC_VERSION.txt )
if( EXISTS ${SOURCE_DIR}/.git )
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags WORKING_DIRECTORY ${SOURCE_DIR}
RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COMMIT_ID )
if( NOT ${res_var} EQUAL 0 )
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
if(NOT SC_IS_SUBBUILD)
message( WARNING "Git failed (probably no tags in repo). Build will contain revision info from ${VERS_FILE}." )
endif(NOT SC_IS_SUBBUILD)
endif()
else(GIT_FOUND)
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
set(VERS_FILE ${SOURCE_DIR}/SC_VERSION.txt)
if(EXISTS ${SOURCE_DIR}/.git)
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags WORKING_DIRECTORY ${SOURCE_DIR}
RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COMMIT_ID)
if(NOT ${res_var} EQUAL 0)
file(READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255)
if(NOT SC_IS_SUBBUILD)
message(WARNING "Git failed (probably no tags in repo). Build will contain revision info from ${VERS_FILE}.")
endif(NOT SC_IS_SUBBUILD)
endif()
else(GIT_FOUND)
file(READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255)
if(NOT SC_IS_SUBBUILD)
message( WARNING "Git not found. Build will contain revision info from ${VERS_FILE}." )
message(WARNING "Git not found. Build will contain revision info from ${VERS_FILE}.")
endif(NOT SC_IS_SUBBUILD)
endif(GIT_FOUND)
endif(GIT_FOUND)
else()
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
if(NOT SC_IS_SUBBUILD)
message( WARNING "Git failed ('.git' not found). Build will contain revision info from ${VERS_FILE}." )
endif(NOT SC_IS_SUBBUILD)
file(READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255)
if(NOT SC_IS_SUBBUILD)
message(WARNING "Git failed ('.git' not found). Build will contain revision info from ${VERS_FILE}.")
endif(NOT SC_IS_SUBBUILD)
endif()
string( REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID} )
string(REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID})
#-------------- date and time ---------------
#once cmake_minimum_required is >= 2.8.11, we can use TIMESTAMP:
#string( TIMESTAMP date_time_string )
#string(TIMESTAMP date_time_string)
if( UNIX )
execute_process( COMMAND date "+%d %b %Y %H:%M" OUTPUT_VARIABLE date_time_string OUTPUT_STRIP_TRAILING_WHITESPACE )
elseif( WIN32 )
execute_process( COMMAND cmd /c date /t OUTPUT_VARIABLE currentDate OUTPUT_STRIP_TRAILING_WHITESPACE )
execute_process( COMMAND cmd /c time /t OUTPUT_VARIABLE currentTime OUTPUT_STRIP_TRAILING_WHITESPACE )
set ( date_time_string "${currentDate} ${currentTime}" )
if(UNIX)
execute_process(COMMAND date "+%d %b %Y %H:%M" OUTPUT_VARIABLE date_time_string OUTPUT_STRIP_TRAILING_WHITESPACE)
elseif(WIN32)
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE currentDate OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE currentTime OUTPUT_STRIP_TRAILING_WHITESPACE)
set (date_time_string "${currentDate} ${currentTime}")
else()
set( date_time_string "\" __DATE__ \" \" __TIME__ \" " )
if( NOT SC_IS_SUBBUILD )
message( STATUS "Unknown platform - using date from preprocessor" )
endif( NOT SC_IS_SUBBUILD )
set(date_time_string "\" __DATE__ \" \" __TIME__ \" ")
if(NOT SC_IS_SUBBUILD)
message(STATUS "Unknown platform - using date from preprocessor")
endif(NOT SC_IS_SUBBUILD)
endif()
set( header_string "/* sc_version_string.h - written by cmake. Changes will be lost! */\n"
"#ifndef SC_VERSION_STRING\n"
"#define SC_VERSION_STRING\n\n"
"/*\n** The git commit id looks like \"test-1-g5e1fb47\", where test is the\n"
"** name of the last tagged git revision, 1 is the number of commits since that tag,\n"
"** 'g' is unknown, and 5e1fb47 is the first 7 chars of the git sha1 commit id.\n"
"** timestamp is created from date/time commands on known platforms, and uses\n"
"** preprocessor macros elsewhere.\n*/\n\n"
"static char sc_version[512] = {\n"
" \"git commit id: ${GIT_COMMIT_ID}, build timestamp ${date_time_string}\"\n"
"}\;\n\n"
"#endif\n"
)
set(header_string "/* sc_version_string.h - written by cmake. Changes will be lost! */\n"
"#ifndef SC_VERSION_STRING\n"
"#define SC_VERSION_STRING\n\n"
"/*\n** The git commit id looks like \"test-1-g5e1fb47\", where test is the\n"
"** name of the last tagged git revision, 1 is the number of commits since that tag,\n"
"** 'g' is unknown, and 5e1fb47 is the first 7 chars of the git sha1 commit id.\n"
"** timestamp is created from date/time commands on known platforms, and uses\n"
"** preprocessor macros elsewhere.\n*/\n\n"
"static char sc_version[512] = {\n"
" \"git commit id: ${GIT_COMMIT_ID}, build timestamp ${date_time_string}\"\n"
"}\;\n\n"
"#endif\n"
)
file(WRITE sc_version_string.h.txt ${header_string} )
file(WRITE sc_version_string.h.txt ${header_string})
# copy the file to the final header only if the version changes
# reduces needless rebuilds
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
sc_version_string.h.txt ${BINARY_DIR}/include/sc_version_string.h)
sc_version_string.h.txt ${BINARY_DIR}/include/sc_version_string.h)
if(NOT SC_IS_SUBBUILD)
message("-- sc_version_string.h is up-to-date.")
endif(NOT SC_IS_SUBBUILD)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+77
View File
@@ -0,0 +1,77 @@
project(SC_SUBPROJECT_SCHEMA_SCANNER)
cmake_minimum_required(VERSION 2.8.7)
if(NOT ("${CALLED_FROM}" STREQUAL "STEPCODE_CMAKELISTS" AND DEFINED SC_ROOT AND DEFINED SC_BUILDDIR))
message(" ${CALLED_FROM} ${SC_ROOT} ${SC_BUILDDIR}")
message(FATAL_ERROR "This is not a truly independent project; it should be built during the STEPcode configuration stage.")
endif()
# SC_ROOT: SC root dir
# SC_BUILDDIR: SC build dir, so generated headers can be found
set(CMAKE_BUILD_TYPE Debug)
# set all target location variables so that MSVC will put the executable the same place as other compilers
set(SC_BINARY_DIR ${SC_BUILDDIR})
include(${CMAKE_CURRENT_SOURCE_DIR}/../SC_Outdirs.cmake)
set(schema_scanner_src
${SC_ROOT}/src/base/sc_mkdir.c
${SC_ROOT}/src/exp2cxx/genCxxFilenames.c
${SC_ROOT}/src/exp2cxx/class_strings.c
${SC_ROOT}/src/express/generated/expparse.c
${SC_ROOT}/src/express/generated/expscan.c
${SC_ROOT}/src/express/alg.c
${SC_ROOT}/src/express/caseitem.c
${SC_ROOT}/src/express/dict.c
${SC_ROOT}/src/express/entity.c
${SC_ROOT}/src/express/error.c
${SC_ROOT}/src/express/exp_kw.c
${SC_ROOT}/src/express/expr.c
${SC_ROOT}/src/express/express.c
${SC_ROOT}/src/express/hash.c
${SC_ROOT}/src/express/lexact.c
${SC_ROOT}/src/express/linklist.c
${SC_ROOT}/src/express/memory.c
${SC_ROOT}/src/express/object.c
${SC_ROOT}/src/express/info.c
${SC_ROOT}/src/express/resolve.c
${SC_ROOT}/src/express/schema.c
${SC_ROOT}/src/express/scope.c
${SC_ROOT}/src/express/stmt.c
${SC_ROOT}/src/express/symbol.c
${SC_ROOT}/src/express/type.c
${SC_ROOT}/src/express/variable.c
${CMAKE_CURRENT_SOURCE_DIR}/schemaScanner.cc
)
include_directories(
${SC_ROOT}/include/
${SC_ROOT}/src/express/
${SC_ROOT}/src/express/generated
${SC_ROOT}/src/base
${SC_ROOT}/src/exp2cxx
${SC_BUILDDIR}/include
)
if(MSVC)
add_definitions(-D__MSVC__ -D__WIN32__)
# Disable warning for preferred usage of secure functions (example strcpy should be strcpy_s, ...)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
elseif(BORLAND)
add_definitions(-D__BORLAND__ -D__WIN32__)
else()
add_definitions(-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long)
endif()
add_definitions(-DSCHEMA_SCANNER)
add_executable(schema_scanner ${schema_scanner_src})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+10
View File
@@ -0,0 +1,10 @@
README for STEPcode schema scanner
--------------
The files in this directory are for a schema scanner executable, built by CMake during the configuration stage.
This scanner is used to determine the file names that exp2cxx will use. In CMake, all file names must be known before
configuration finishes - so it is necessary to parse the schemas early.
This appears to be a standalone project to CMake, but it is intended to be built only as part of STEPcode. It is configured,
built, and executed during the configuration stage of STEPcode.
+336
View File
@@ -0,0 +1,336 @@
/** \file schemaScanner.cc
* This file, along with part of libexpress, are compiled (at configure time)
* into a static executable. This executable is a schema scanner that is used
* by CMake to determine what files exp2cxx will create. Otherwise, we'd need
* to use a few huge files - there is no other way to tell CMake what the
* generated files will be called.
*/
/* WARNING
* If you modify this file, you must re-run cmake. It doesn't seem to be possible
* to re-run cmake automatically, as CMake's configure_file() gets confused by
* the '${' and '}' in writeLists() below.
*/
extern "C" {
# include "expparse.h"
# include "expscan.h"
# include "express/scope.h"
# include "genCxxFilenames.h"
# include "sc_mkdir.h"
# include <string.h>
# if defined( _WIN32 ) || defined ( __WIN32__ )
# include <direct.h>
# define getcwd _getcwd
# else
# include <unistd.h>
# endif
}
#include <string>
#include <sstream>
#include <iomanip>
#include <fstream>
#include <iostream>
int multiple_inheritance = 0;
using std::string;
using std::stringstream;
using std::endl;
using std::ofstream;
using std::cerr;
using std::cout;
/** \return true for types that exp2cxx won't generate code for */
bool notGenerated( const Type t ) {
switch( TYPEget_body( t )->type ) {
case integer_:
case real_:
case string_:
case binary_:
case boolean_:
case number_:
case logical_:
case aggregate_:
case bag_:
case set_:
case list_:
case array_:
return true;
default:
break;
}
/* from addRenameTypedefs() in multpass.c - check for renamed
* enums and selects - exp2cxx prints typedefs for them */
if( ( TYPEis_enumeration( t ) || TYPEis_select( t ) ) && ( TYPEget_head( t ) ) ) {
return true;
}
return false;
}
/** \return a short name for the schema
* this name is intended to be unique, but no special care is put into its generation
* the official schema name seems most likely to not be unique, but it is generally the longest
*
* picks the shortest of:
* * the name of the dir containing the file (if in sc/data),
* * the name of the file containing the schema (minus extension),
* * the official name of the schema, passed in arg 'longName'
*
* TODO: maybe also consider an acronym, such that 'test_array_bounds_expr' becomes 'tabe', 'TABE', 'T_A_B_E', or similar
*/
string makeShortName( const char * longName ) {
//input_filename is path to file. we will extract dir name and file name from it.
string dirname = input_filename, filename = input_filename, schname = longName;
const char slash = '/';
//for filename, get rid of dir name(s), if any, as well as the extension
size_t sl = filename.rfind( slash );
if( sl != string::npos ) {
filename.erase( 0, sl + 1 );
}
size_t dot = filename.rfind( '.' );
if( dot != string::npos ) {
filename.erase( dot );
}
//for dirname, get rid of the filename and ensure it's in data/
sl = dirname.rfind( slash );
if( sl != string::npos ) {
dirname.erase( sl );
}
const char * dat = "data";
size_t data = dirname.find( dat );
if( ( data == string::npos ) || ( dirname[ data + strlen( dat ) ] != slash ) ) {
//doesn't contain 'data/'. clear it so it'll be ignored.
dirname.clear();
} else {
//get rid of all but last dir name
dirname.erase( 0, dirname.rfind( slash ) + 1 );
}
//use dir name if it's at least 3 chars and shorter than file name
//length requirement gets rid of short, undescriptive dir names - including '.' and '..'
if( ( dirname.size() > 2 ) && ( dirname.size() < filename.size() ) ) {
filename = dirname;
}
if( strlen( longName ) < filename.size() ) {
filename = longName;
}
filename.insert( 0, "sdai_" );
return filename;
}
/** write a CMakeLists.txt file for the schema; print its directory to stdout for CMake's add_subdirectory() command */
void writeLists( const char * schemaName, stringstream & eh, stringstream & ei, int ecount,
stringstream & th, stringstream & ti, int tcount ) {
string shortName = makeShortName( schemaName );
if( mkDirIfNone( shortName.c_str() ) < 0 ) {
cerr << "Error creating directory " << shortName << " at " << __FILE__ << ":" << __LINE__;
perror( 0 );
exit( EXIT_FAILURE );
}
size_t nameLen = strlen( schemaName );
string schema_upper( nameLen, char() );
for( size_t i = 0; i < nameLen; ++i) {
schema_upper[i] = toupper(schemaName[i]);
}
string cmListsPath = shortName;
cmListsPath += "/CMakeLists.txt";
ofstream cmLists;
cmLists.open( cmListsPath.c_str() );
if( !cmLists.good() ) {
cerr << "error opening file " << cmListsPath << " - exiting." << endl;
exit( EXIT_FAILURE );
}
cmLists << "# ----- GENERATED FILE -----" << endl;
cmLists << "# ----- Do not edit! -----" << endl << endl;
cmLists << "# schema name: " << schemaName << endl;
cmLists << "# (short name: " << shortName << ")" << endl;
cmLists << "# " << ecount << " entities, " << tcount << " types" << endl << endl;
cmLists << "# targets, logic, etc are within a set of macros shared by all schemas" << endl;
cmLists << "include(${SC_CMAKE_DIR}/SC_CXX_schema_macros.cmake)" << endl;
// * 2 for headers, + 10 other files
cmLists << "set(" << shortName << "_file_count " << ( ( ecount + tcount ) * 2 ) + 10 << ")" << endl << endl;
cmLists << "PROJECT(" << shortName << ")" << endl;
cmLists << "# list headers so they can be installed - entity, type, misc" << endl;
cmLists << "set(" << shortName << "_entity_hdrs" << endl;
cmLists << eh.str();
cmLists << " )" << endl << endl;
cmLists << "set(" << shortName << "_type_hdrs" << endl;
cmLists << th.str();
cmLists << " )" << endl << endl;
cmLists << "set(" << shortName << "_misc_hdrs" << endl;
cmLists << " Sdaiclasses.h schema.h" << endl;
cmLists << " Sdai" << schema_upper << "Names.h" << endl;
cmLists << " Sdai" << schema_upper << ".h" << endl;
cmLists << " )" << endl << endl;
cmLists << "# install all headers" << endl;
cmLists << "set(all_headers ${" << shortName << "_entity_hdrs} ${" << shortName << "_type_hdrs} ${" << shortName << "_misc_hdrs})" << endl;
cmLists << "foreach( header_file ${all_headers} )" << endl;
cmLists << " set(curr_dir)" << endl;
cmLists << " get_filename_component(curr_dir ${header_file} PATH)" << endl;
cmLists << " get_filename_component(curr_name ${header_file} NAME)" << endl;
cmLists << " if (curr_dir)" << endl;
cmLists << " install( FILES ${header_file} DESTINATION \"include/schemas/" << shortName << "/${curr_dir}\" )" << endl;
cmLists << " else (curr_dir)" << endl;
cmLists << " install( FILES ${header_file} DESTINATION \"include/schemas/" << shortName << "\" )" << endl;
cmLists << " endif (curr_dir)" << endl;
cmLists << "endforeach()" << endl;
cmLists << "# implementation files - 3 lists" << endl << endl;
cmLists << "# unity build: #include small .cc files to reduce the number" << endl;
cmLists << "# of translation units that must be compiled" << endl;
cmLists << "if(SC_UNITY_BUILD)" << endl << " # turns off include statements within type and entity .cc's - the unity T.U.'s include a unity header" << endl;
cmLists << " add_definitions( -DSC_SDAI_UNITY_BUILD)" << endl;
cmLists << " set(" << shortName << "_entity_impls Sdai" << schema_upper << "_unity_entities.cc)" << endl;
cmLists << " set(" << shortName << "_type_impls Sdai" << schema_upper << "_unity_types.cc)" << endl;
cmLists << "else(SC_UNITY_BUILD)" << endl;
cmLists << " set(" << shortName << "_entity_impls" << endl;
cmLists << ei.str();
cmLists << " )" << endl << endl;
cmLists << " set(" << shortName << "_type_impls" << endl;
cmLists << ti.str();
cmLists << " )" << endl;
cmLists << "endif(SC_UNITY_BUILD)" << endl << endl;
cmLists << "set( " << shortName << "_misc_impls" << endl;
cmLists << " SdaiAll.cc compstructs.cc schema.cc" << endl;
cmLists << " Sdai" << schema_upper << ".cc" << endl;
cmLists << " Sdai" << schema_upper << ".init.cc )" << endl << endl;
cmLists << "set(schema_target_files ${" << shortName << "_entity_impls} " << "${" << shortName << "_type_impls} " << "${" << shortName << "_misc_impls})" << endl;
cmLists << "SCHEMA_TARGETS(\"" << input_filename << "\" \"" << schemaName << "\"" << endl;
cmLists << " \"${schema_target_files}\")" << endl;
cmLists.close();
char pwd[BUFSIZ] = {0};
if( getcwd( pwd, BUFSIZ ) ) {
cout << pwd << "/" << shortName << endl;
} else {
cerr << "Error encountered by getcwd() for " << shortName << " - exiting. Error was ";
perror( 0 );
exit( EXIT_FAILURE );
}
}
void printSchemaFilenames( Schema sch ){
const int numColumns = 2;
const int colWidth = 75;
const char * tab = " ";
stringstream typeHeaders, typeImpls, entityHeaders, entityImpls;
typeHeaders << tab;
typeImpls << tab;
entityHeaders << tab;
entityImpls << tab;
int ecount = 0, tcount = 0;
DictionaryEntry de;
Generic x;
filenames_t fn;
DICTdo_init( sch->symbol_table, &de );
while( 0 != ( x = DICTdo( &de ) ) ) {
switch( DICT_type ) {
case OBJ_ENTITY:
fn = getEntityFilenames( ( Entity ) x );
entityHeaders << std::left << std::setw( colWidth ) << fn.header << " ";
entityImpls << std::left << std::setw( colWidth ) << fn.impl << " ";
++ecount;
if( ( ecount % numColumns ) == 0 ) {
// columns
entityHeaders << endl << tab;
entityImpls << endl << tab;
}
break;
case OBJ_TYPE: {
Type t = ( Type ) x;
if( TYPEis_enumeration( t ) && ( TYPEget_head( t ) ) ) {
/* t is a renamed enum type, for which exp2cxx
* will print a typedef in an existing file */
break;
}
if( notGenerated( t ) ) {
/* skip builtin types */
break;
}
fn = getTypeFilenames( t );
typeHeaders << std::left << std::setw( colWidth ) << fn.header << " ";
typeImpls << std::left << std::setw( colWidth ) << fn.impl << " ";
++tcount;
if( ( tcount % numColumns ) == 0 ) {
typeHeaders << endl << tab;
typeImpls << endl << tab;
}
break;
}
/* case OBJ_FUNCTION:
* case OBJ_PROCEDURE:
* case OBJ_RULE: */
default:
/* ignore everything else */
/* TODO: if DEBUG is defined, print the names of these to stderr */
break;
}
}
//write the CMakeLists.txt
writeLists( sch->symbol.name, entityHeaders, entityImpls, ecount, typeHeaders, typeImpls, tcount );
}
int main( int argc, char ** argv ) {
/* TODO init globals! */
Schema schema;
DictionaryEntry de;
/* copied from fedex.c */
Express model;
if( ( argc != 2 ) || ( strlen( argv[1] ) < 1 ) ) {
fprintf( stderr, "\nUsage: %s file.exp\nOutput: a CMakeLists.txt to build the schema,", argv[0] );
fprintf( stderr, " containing file names for entities, types, etc\n" );
fprintf( stderr, "also prints (to stdout) the absolute path to the directory CMakeLists.txt was created in\n" );
exit( EXIT_FAILURE );
}
EXPRESSprogram_name = argv[0];
input_filename = argv[1];
EXPRESSinitialize();
model = EXPRESScreate();
EXPRESSparse( model, ( FILE * )0, input_filename );
if( ERRORoccurred ) {
EXPRESSdestroy( model );
exit( EXIT_FAILURE );
}
EXPRESSresolve( model );
if( ERRORoccurred ) {
int result = EXPRESS_fail( model );
EXPRESScleanup();
EXPRESSdestroy( model );
exit( result );
}
DICTdo_type_init( model->symbol_table, &de, OBJ_SCHEMA );
while( 0 != ( schema = ( Schema )DICTdo( &de ) ) ) {
printSchemaFilenames( schema );
}
EXPRESSdestroy( model );
exit( EXIT_SUCCESS );
}
+110
View File
@@ -0,0 +1,110 @@
# this file should be included from data/CMakeLists.txt
#
# at configure time, this builds a small program
# which will parse express schemas to determine
# what files exp2cxx will create for that schema.
#
# The SCHEMA_CMLIST macro is to be used to run this
# program. It will set variables for schema name(s),
# headers, and implementation files.
# in a unity build, many small .cc files are #included to create a few large translation units
# this makes compilation faster, but sometimes runs into compiler limitations
if(NOT DEFINED SC_UNITY_BUILD)
if(BORLAND)
message(".. Will not do unity build for this compiler.")
set(SC_UNITY_BUILD FALSE)
else()
message(".. Assuming compiler is capable of unity build.")
set(SC_UNITY_BUILD TRUE)
endif(BORLAND)
message(".. Override by setting SC_UNITY_BUILD; TRUE will result in *huge* translation units, higher memory use in compilation, and faster build times.")
else(NOT DEFINED SC_UNITY_BUILD)
message(".. Respecting user-defined SC_UNITY_BUILD value of ${SC_UNITY_BUILD}.")
endif(NOT DEFINED SC_UNITY_BUILD)
# --- variables ---
# SC_ROOT: SC root dir
# SC_BUILDDIR: SC build dir, so generated headers can be found
# SCANNER_SRC_DIR: dir this file is in
# SCANNER_OUT_DIR: location of binary, same dir as SC uses
# SCANNER_BUILD_DIR: location scanner is built
set(SCANNER_SRC_DIR ${SC_CMAKE_DIR}/schema_scanner)
set(SCANNER_BUILD_DIR ${SC_BINARY_DIR}/schema_scanner CACHE INTERNAL "location for scanner build, config files (copied schemas)")
set(SCANNER_OUT_DIR ${SC_BINARY_DIR}/bin CACHE INTERNAL "location for schema_scanner executable")
#write a cmake file for the cache. the alternative is a very long
# command line - and the command line can't have newlines in it
set(initial_scanner_cache ${SCANNER_BUILD_DIR}/initial_scanner_cache.cmake)
file(WRITE ${initial_scanner_cache} "
set(SC_ROOT \"${SC_SOURCE_DIR}\" CACHE STRING \"root dir\")
set(SC_BUILDDIR \"${SC_BINARY_DIR}\" CACHE PATH \"build dir\")
set(CALLED_FROM \"STEPCODE_CMAKELISTS\" CACHE STRING \"verification\")
set(CMAKE_BUILD_TYPE \"Debug\" CACHE STRING \"build type\")
set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\" CACHE STRING \"compiler\")
set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\" CACHE STRING \"compiler\")
")
message("-- Compiling schema scanner...")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SC_BINARY_DIR}/schemas)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SCANNER_BUILD_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -C ${initial_scanner_cache} ${SCANNER_SRC_DIR} -G ${CMAKE_GENERATOR}
WORKING_DIRECTORY ${SCANNER_BUILD_DIR}
TIMEOUT 60
OUTPUT_VARIABLE _ss_config_out
RESULT_VARIABLE _ss_config_stat
ERROR_VARIABLE _ss_config_err
)
if(NOT ${_ss_config_stat} STREQUAL "0")
message(FATAL_ERROR "Scanner config status: ${_ss_config_stat}. stdout:\n${_ss_config_out}\nstderr:\n${_ss_config_err}")
endif(NOT ${_ss_config_stat} STREQUAL "0")
execute_process(COMMAND ${CMAKE_COMMAND} --build ${SCANNER_BUILD_DIR} --config Debug --clean-first
WORKING_DIRECTORY ${SCANNER_BUILD_DIR}
TIMEOUT 120 # should take far less than 2m
OUTPUT_VARIABLE _ss_build_out
RESULT_VARIABLE _ss_build_stat
ERROR_VARIABLE _ss_build_err
)
if(NOT ${_ss_build_stat} STREQUAL "0")
message(FATAL_ERROR "Scanner build status: ${_ss_build_stat}. stdout:\n${_ss_build_out}\nstderr:\n${_ss_build_err}")
endif(NOT ${_ss_build_stat} STREQUAL "0")
message("-- Schema scanner built. Running it...")
# not sure if it makes sense to install this or not...
if(WIN32)
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner.exe DESTINATION ${BIN_INSTALL_DIR})
else(WIN32)
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner DESTINATION ${BIN_INSTALL_DIR})
endif(WIN32)
# macro SCHEMA_CMLIST
# runs the schema scanner on one express file, creating a CMakeLists.txt file for each schema found. Those files are added via add_subdirectory().
#
# SCHEMA_FILE - path to the schema
# TODO should we have a result variable to return schema name(s) found?
macro(SCHEMA_CMLIST SCHEMA_FILE)
execute_process(COMMAND ${SCANNER_OUT_DIR}/schema_scanner ${SCHEMA_FILE}
WORKING_DIRECTORY ${SC_BINARY_DIR}/schemas
RESULT_VARIABLE _ss_stat
OUTPUT_VARIABLE _ss_out
ERROR_VARIABLE _ss_err
)
if(NOT "${_ss_stat}" STREQUAL "0")
#check size of output, put in file if large?
message(FATAL_ERROR "Schema scan for '${SCHEMA_FILE}'\nexited with error code '${_ss_stat}'\nstdout:\n${_ss_out}\nstderr:\n${_ss_err}\n")
endif(NOT "${_ss_stat}" STREQUAL "0")
# scanner output format: each line contains an absolute path. each path is a dir containing a CMakeLists for one schema
# there will usually be a single line of output, but it is not illegal for multiple schemas to exist in one .exp file
string(STRIP "${_ss_out}" _ss_stripped)
string(REGEX REPLACE "\\\n" ";" _list ${_ss_stripped})
foreach(_dir ${_list})
add_subdirectory(${_dir} ${_dir}) #specify source and binary dirs as the same
endforeach(_dir ${_ss_out})
# configure_file forces cmake to run again if the schema has been modified
#if multiple schemas in one file, _schema is the last one printed.
configure_file(${SCHEMA_FILE} ${SCANNER_BUILD_DIR}/${_schema})
endmacro(SCHEMA_CMLIST SCHEMA_FILE)
+2 -2
View File
@@ -69,8 +69,8 @@ if(NOT DEBUGGING_GENERATED_SOURCES)
endforeach(outf ${output_files})
endif(NOT LOCKED_SOURCE_DIR)
else (NOT DEBUGGING_GENERATED_SOURCES)
else(NOT DEBUGGING_GENERATED_SOURCES)
message("\nNote: DEBUGGING_GENERATED_SOURCES is enabled - generated outputs will contain configuration-specific debugging information, so syncing cached output files is not possible. To restore normal behavior, disable DEBUGGING_GENERATED_SOURCES.\n")
endif(NOT DEBUGGING_GENERATED_SOURCES)
+4 -4
View File
@@ -1,15 +1,15 @@
# Inherit the parent CMake setting
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)
set(CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
# Include the file the provides the baseline against which
# current files will be compared
if(NOT DEBUGGING_GENERATED_SOURCES)
include(@BASELINE_INFORMATION_FILE@)
include("@BASELINE_INFORMATION_FILE@")
# Define a variety of convenience routines
include(@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake)
include("@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake")
# Individually verify all of the files in question.
set(filelist "@CACHED_FILELIST@")
@@ -20,7 +20,7 @@ if(NOT DEBUGGING_GENERATED_SOURCES)
message(FATAL_ERROR "Generated sources have been modified. These files should never be modified directly except when debugging faulty output from the generators - changes to lexer and parser logic should be made to the generator input files. If this is a debugging situation, set the variable DEBUGGING_GENERATED_SOURCES to ON during the CMake configure.")
endif(srcs_pass)
# If we got by that test, see if it looks like these
# If we got by that test, see if it looks like these
# sources came from the current input files. It's not
# a failure condition if they didn't, but warn about it.
set(filelist "@INPUT_FILELIST@")
+18 -10
View File
@@ -1,11 +1,11 @@
# run_ctest.cmake
# `ctest -S run_ctest.cmake`
set( CTEST_SOURCE_DIRECTORY . )
set( CTEST_BINARY_DIRECTORY build_matrix )
set( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
set( CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind )
set( CTEST_INITIAL_CACHE "
set(CTEST_SOURCE_DIRECTORY .)
set(CTEST_BINARY_DIRECTORY build_matrix)
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind)
set(CTEST_INITIAL_CACHE "
SITE:STRING=${CTEST_SITE}
BUILDNAME:STRING=${CTEST_BUILD_NAME}
SC_ENABLE_TESTING:BOOL=ON
@@ -15,11 +15,19 @@ SC_BUILD_TYPE:STRING=Debug
ctest_start(matrix)
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS -DSC_ENABLE_TESTING=ON )
ctest_build( BUILD "${CTEST_BINARY_DIRECTORY}" )
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS -DSC_ENABLE_TESTING=ON)
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}")
message("running tests")
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE_LABEL "cpp_schema_....*" )
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE_LABEL "cpp_schema_....*")
message("running python script")
execute_process( COMMAND python ../misc/wiki-scripts/update-matrix.py
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} )
execute_process(COMMAND python ../misc/wiki-scripts/update-matrix.py
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+30 -175
View File
@@ -1,181 +1,36 @@
# To build one or more schemas, configure with
# 'cmake -DSC_BUILD_SCHEMAS="path/to/schema.exp;path/to/schema2.exp"
# you can specify a schema in 3 ways:
# * path relative to build dir
# * path relative to sc/data (this dir)
# * absolute path
#
# cmake goes through the above options in order until it finds one
# that exists. if ${path} is a dir, cmake expects to find a single
# .exp file inside, which it uses. otherwise, ${path} is assumed to
# be an express file.
MACRO(RELATIVE_PATH_TO_TOPLEVEL current_dir rel_path)
string(REPLACE "${SC_SOURCE_DIR}" "" subpath "${current_dir}")
string(REGEX REPLACE "^/" "" subpath "${subpath}")
string(LENGTH "${subpath}" PATH_LENGTH)
if(PATH_LENGTH GREATER 0)
set(${rel_path} "..")
get_filename_component(subpath "${subpath}" PATH)
string(LENGTH "${subpath}" PATH_LENGTH)
while(PATH_LENGTH GREATER 0)
set(${rel_path} "${${rel_path}}/..")
get_filename_component(subpath "${subpath}" PATH)
string(LENGTH "${subpath}" PATH_LENGTH)
endwhile(PATH_LENGTH GREATER 0)
endif(PATH_LENGTH GREATER 0)
ENDMACRO(RELATIVE_PATH_TO_TOPLEVEL current_dir rel_path)
if(NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
include(${SC_CMAKE_DIR}/schema_scanner/schemaScanner.cmake)
foreach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
get_filename_component(name ${src} NAME_WE)
message(STATUS "Additional SDAI executable: ${name}")
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
# This function runs fedex on one express file. The generated source goes in a dir
# in the build dir, and it is compiled into a library. A p21read executable is
# compiled and linked to the lib. p21read is used to test the lib.
FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
if( EXISTS "${CMAKE_BINARY_DIR}/${SCHEMA_FILE}" ) #is it a path relative to build dir?
set( SCHEMA_FILE "${CMAKE_BINARY_DIR}/${SCHEMA_FILE}" )
elseif( EXISTS "${SC_SOURCE_DIR}/data/${SCHEMA_FILE}" ) # path relative to STEPcode/data?
set( SCHEMA_FILE "${SC_SOURCE_DIR}/data/${SCHEMA_FILE}" )
elseif( NOT EXISTS ${SCHEMA_FILE} ) # absolute path
message( FATAL_ERROR "Cannot find ${CMAKE_BINARY_DIR}/${SCHEMA_FILE} or ${SC_SOURCE_DIR}/data/${SCHEMA_FILE} or ${SCHEMA_FILE}" )
endif()
if(SC_BUILD_SCHEMAS STREQUAL "ALL")
file(GLOB_RECURSE SC_BUILD_SCHEMAS ${SC_SOURCE_DIR}/data/*.exp)
endif()
foreach(FILE ${SC_BUILD_SCHEMAS})
# figure out an absolute path to the file
LOCATE_SCHEMA(${FILE} abspath)
SCHEMA_CMLIST(${abspath})
endforeach()
endif(NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
if( IS_DIRECTORY ${SCHEMA_FILE} ) #if it is a dir, look for one .exp file inside
file(GLOB SCHEMA_FILE ${SCHEMA_FILE}/*.exp )
endif()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
if( NOT EXISTS ${SCHEMA_FILE} )
message(FATAL_ERROR "Expected one express file. Found '${SCHEMA_FILE}' instead.")
endif()
# read the schema name from a line like 'SCHEMA AUTOMOTIVE_DESIGN;'
file(STRINGS ${SCHEMA_FILE} SCHEMA_STATEMENT LIMIT_COUNT 1 REGEX "^SCHEMA .*")
string(REGEX REPLACE "^SCHEMA \(.*\)\;$" "\\1" SCHEMA_N ${SCHEMA_STATEMENT} )
string(TOUPPER ${SCHEMA_N} SCHEMA_LONG_NAME) #exp2cxx always uses upper case for file names
get_filename_component( SCHEMA_SN ${SCHEMA_FILE} NAME )
string( REGEX REPLACE "\(.*\).[Ee][Xx][Pp]" "\\1" SCHEMA_SHORT_NAME ${SCHEMA_SN} )
project( sdai_${SCHEMA_SHORT_NAME} )
message( STATUS "Generating code for ${SCHEMA_SHORT_NAME}.")
set( SCHEMA_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_SHORT_NAME} )
#the names of the files that will be generated
set( FEDEX_HEADERS ${SCHEMA_OUTPUT_DIR}/Sdaiclasses.h ${SCHEMA_OUTPUT_DIR}/schema.h
${SCHEMA_OUTPUT_DIR}/Sdai${SCHEMA_LONG_NAME}.h )
set( FEDEX_OUT ${SCHEMA_OUTPUT_DIR}/compstructs.cc ${SCHEMA_OUTPUT_DIR}/schema.cc
${SCHEMA_OUTPUT_DIR}/Sdai${SCHEMA_LONG_NAME}.cc ${SCHEMA_OUTPUT_DIR}/SdaiAll.cc
${SCHEMA_OUTPUT_DIR}/Sdai${SCHEMA_LONG_NAME}.init.cc ${FEDEX_HEADERS} )
install( FILES ${FEDEX_HEADERS} DESTINATION include/${SCHEMA_SHORT_NAME} )
# *cannot* use include_directories() because the includes keep piling up - if building
# multiple schemas, each one will use the include dirs from all previous schemas. Since
# one header (schema.h) is always named the same, this will not work. only workaround
# seems to be set_target_properties( <target> PROPERTIES COMPILE_FLAGS <flags> )
set( ${PROJECT_NAME}_COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR} -I${SC_SOURCE_DIR}/src/cldai -I${SC_SOURCE_DIR}/src/cleditor -I${SC_SOURCE_DIR}/src/clutils -I${SCHEMA_OUTPUT_DIR} -I${SC_SOURCE_DIR}/src/clstepcore -I${SC_SOURCE_DIR}/src/base" )
add_custom_command( OUTPUT ${SCHEMA_OUTPUT_DIR}
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${SCHEMA_OUTPUT_DIR}
COMMENT "Creating ${SCHEMA_OUTPUT_DIR} for schema ${SCHEMA_SHORT_NAME}")
add_custom_command( OUTPUT ${FEDEX_OUT}
COMMAND exp2cxx ARGS ${SCHEMA_FILE}
DEPENDS ${SCHEMA_FILE} ${SCHEMA_OUTPUT_DIR}
WORKING_DIRECTORY ${SCHEMA_OUTPUT_DIR}
COMMENT "Running exp2cxx for ${SCHEMA_SHORT_NAME}..."
VERBATIM )
add_custom_target( generate_cpp_${SCHEMA_SHORT_NAME} DEPENDS ${FEDEX_OUT} SOURCES ${FEDEX_OUT} )
if( SC_ENABLE_COVERAGE AND NOT SC_COVER_SCHEMAS )
# Coverage will always be sparse on schema libs. Compiling the libs with the -fprofile-arcs and
# -ftest-coverage is extremely slow. We can avoid that by temporarily changing build type to release.
set( PREV_BUILD_TYPE ${CMAKE_BUILD_TYPE} )
set( CMAKE_BUILD_TYPE "Release" )
endif( SC_ENABLE_COVERAGE AND NOT SC_COVER_SCHEMAS )
# if testing is enabled, "TESTABLE" sets property EXCLUDE_FROM_ALL and prevents installation
SC_ADDLIB( ${PROJECT_NAME} "${FEDEX_OUT}" "stepdai;stepcore;stepeditor;steputils;base" "TESTABLE" )
add_dependencies( ${PROJECT_NAME} generate_cpp_${SCHEMA_SHORT_NAME} )
set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
${${PROJECT_NAME}_COMPILE_FLAGS} )
if( TARGET ${PROJECT_NAME}-static )
set_target_properties( ${PROJECT_NAME}-static PROPERTIES COMPILE_FLAGS
${${PROJECT_NAME}_COMPILE_FLAGS} )
endif( TARGET ${PROJECT_NAME}-static )
if( SC_ENABLE_COVERAGE AND NOT SC_COVER_SCHEMAS )
set( CMAKE_BUILD_TYPE ${PREV_BUILD_TYPE} )
endif( SC_ENABLE_COVERAGE AND NOT SC_COVER_SCHEMAS )
add_test( NAME generate_cpp_${SCHEMA_SHORT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target generate_cpp_${SCHEMA_SHORT_NAME}
--config $<CONFIGURATION> )
add_test( NAME build_cpp_${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target p21read_${PROJECT_NAME}
--config $<CONFIGURATION> )
if(NOT WIN32)
add_test( NAME build_lazy_cpp_${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target lazy_${PROJECT_NAME}
--config $<CONFIGURATION> )
endif(NOT WIN32)
# label the tests and set dependencies
set_tests_properties( generate_cpp_${SCHEMA_SHORT_NAME} PROPERTIES LABELS cpp_schema_gen )
if(NOT WIN32)
set_tests_properties( build_lazy_cpp_${PROJECT_NAME} build_cpp_${PROJECT_NAME} PROPERTIES DEPENDS generate_cpp_${SCHEMA_SHORT_NAME} LABELS cpp_schema_build )
endif(NOT WIN32)
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
SC_ADDEXEC( p21read_${PROJECT_NAME} "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" "${PROJECT_NAME};base" "TESTABLE" )
if(NOT WIN32)
SC_ADDEXEC( lazy_${PROJECT_NAME} "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc" "${PROJECT_NAME};steplazyfile;stepeditor" "TESTABLE" )
endif(NOT WIN32)
add_dependencies( p21read_${PROJECT_NAME} version_string )
if(NOT WIN32)
add_dependencies( lazy_${PROJECT_NAME} version_string )
endif(NOT WIN32)
set_target_properties( p21read_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
${${PROJECT_NAME}_COMPILE_FLAGS} )
if(NOT WIN32)
set_target_properties( lazy_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${${PROJECT_NAME}_COMPILE_FLAGS} -I${SC_SOURCE_DIR}/src/base/judy/src" )
endif(NOT WIN32)
#add user-defined executables
foreach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
get_filename_component( name ${src} NAME_WE )
get_filename_component( path ${src} ABSOLUTE )
SC_ADDEXEC( ${name}_${PROJECT_NAME} "${src}" "${PROJECT_NAME};base" "TESTABLE" )
add_dependencies( ${name}_${PROJECT_NAME} version_string )
set_target_properties( ${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
"${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}" )
endforeach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
#find all part 21 files in schema dir, add a test for each one
get_filename_component( SCHEMA_DIR ${SCHEMA_FILE} PATH )
file( GLOB_RECURSE P21_FILES ${SCHEMA_DIR}/*.stp ${SCHEMA_DIR}/*.step ${SCHEMA_DIR}/*.p21 ${SCHEMA_DIR}/*.ifc )
foreach( TEST_FILE ${P21_FILES} )
get_filename_component( FNAME ${TEST_FILE} NAME_WE )
add_test( NAME read_write_cpp_${SCHEMA_SHORT_NAME}_${FNAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND p21read_${PROJECT_NAME} ${TEST_FILE} )
set_tests_properties( read_write_cpp_${SCHEMA_SHORT_NAME}_${FNAME} PROPERTIES DEPENDS build_cpp_${PROJECT_NAME} LABELS cpp_schema_rw )
if(NOT WIN32)
add_test( NAME read_lazy_cpp_${SCHEMA_SHORT_NAME}_${FNAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND lazy_${PROJECT_NAME} ${TEST_FILE} )
set_tests_properties( read_lazy_cpp_${SCHEMA_SHORT_NAME}_${FNAME} PROPERTIES DEPENDS build_lazy_cpp_${PROJECT_NAME} LABELS cpp_schema_rw )
endif(NOT WIN32)
endforeach()
ENDFUNCTION(BUILD_A_SCHEMA)
#----------------------------------------------------------------------------------------------------
if( DEFINED SC_BUILD_SCHEMAS )
foreach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
get_filename_component( name ${src} NAME_WE )
message( STATUS "Additional SDAI executable: ${name}" )
endforeach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
if( SC_BUILD_SCHEMAS STREQUAL "ALL" )
file( GLOB_RECURSE SC_BUILD_SCHEMAS ${SC_SOURCE_DIR}/data/*.exp )
endif()
foreach( ap ${SC_BUILD_SCHEMAS} )
BUILD_A_SCHEMA( ${ap} )
endforeach()
endif()
+4 -1
View File
@@ -1,6 +1,6 @@
(* This is a MODIFIED version of AP203 Amd. 1.
The change was to remove a useless IF...ELSE...ENDIF statement that always evaluated
the same way. Statements in the branch that was never executed caused problems with
the same way. Statements in the branch that were never executed caused problems with
libexpress, and it was easier to modify the schema than to come up with a generic
fix for libexpress. This change does *not* affect the behavior of the schema.
@@ -14,6 +14,9 @@
SCHEMA config_control_design;
CONSTANT
(* FIXME: gcc error on next statement with c99/POSIX:
Syntax error: "(" unexpected
*)
dummy_gri : geometric_representation_item := representation_item('') ||
geometric_representation_item();
dummy_tri : topological_representation_item := representation_item('')
+33007 -38333
View File
File diff suppressed because it is too large Load Diff
+15 -7
View File
@@ -1,12 +1,20 @@
SET(sc_MANS
man/man1/fedex.1
man/man1/exp2cxx.1
)
set(sc_MANS
man/man1/fedex.1
man/man1/exp2cxx.1
)
if(NOT DEFINED MAN_DIR)
set(MAN_DIR share/man)
endif(NOT DEFINED MAN_DIR)
IF(NOT WIN32)
INSTALL(FILES ${sc_MANS} DESTINATION ${MAN_DIR}/man1)
ENDIF(NOT WIN32)
if(NOT WIN32)
install(FILES ${sc_MANS} DESTINATION ${MAN_DIR}/man1)
endif(NOT WIN32)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+55 -51
View File
@@ -5,87 +5,91 @@
# freely copied in part or in full for any purpose. No acknowledgment is required
# for the use of this file.
#
PROJECT( AP203Minimum )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
project(AP203Minimum)
cmake_minimum_required(VERSION 2.8)
# Set STEPCODE_ROOT_DIR to point to the root of the STEPcode source tree.
if( NOT DEFINED STEPCODE_ROOT_DIR )
message( FATAL_ERROR "STEPCODE_ROOT_DIR is not defined! Set via cmake-gui or on command line:\n cmake .. -DSTEPCODE_ROOT_DIR=/path/to/sc" )
endif( NOT DEFINED STEPCODE_ROOT_DIR )
if(NOT DEFINED STEPCODE_ROOT_DIR)
message(FATAL_ERROR "STEPCODE_ROOT_DIR is not defined! Set via cmake-gui or on command line:\n cmake .. -DSTEPCODE_ROOT_DIR=/path/to/sc")
endif(NOT DEFINED STEPCODE_ROOT_DIR)
# STEPCODE_ROOT_DIR is relative or absolute path?
if( EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
set( STEPCODE_ROOT_DIR "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}" )
message( "** STEPCODE_ROOT_DIR is a relative path; converted to absolute path: ${STEPCODE_ROOT_DIR}." )
if(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
set(STEPCODE_ROOT_DIR "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}")
message("** STEPCODE_ROOT_DIR is a relative path; converted to absolute path: ${STEPCODE_ROOT_DIR}.")
else()
if( NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
message( FATAL_ERROR "**** Cannot locate STEPCODE_ROOT_DIR - try an absolute path." )
endif( NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
endif( EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
if(NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
message(FATAL_ERROR "**** Cannot locate STEPCODE_ROOT_DIR - try an absolute path.")
endif(NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
endif(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
# Use STEPcode as library, but build from this build process.
set( SC_IS_SUBBUILD TRUE )
set(SC_IS_SUBBUILD TRUE)
# Build type, DEBUG or RELEASE
if( NOT DEFINED CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Debug )
endif( NOT DEFINED CMAKE_BUILD_TYPE )
set( SC_BUILD_TYPE ${CMAKE_BUILD_TYPE} )
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif(NOT DEFINED CMAKE_BUILD_TYPE)
set(SC_BUILD_TYPE ${CMAKE_BUILD_TYPE})
# Path to STEPcode
set( STEPCODE_BUILD_DIR ${CMAKE_BINARY_DIR}/sc CACHE PATH "STEPcode build subdir" )
set(STEPCODE_BUILD_DIR ${CMAKE_BINARY_DIR}/sc CACHE PATH "STEPcode build subdir")
# STEP schema to build and link against.
set( SCHEMA ap203 )
set( SC_BUILD_SCHEMAS ${SCHEMA} CACHE INTERNAL "Schema, internal, immutable" FORCE )
set(SCHEMA ap203)
set(SC_BUILD_SCHEMAS ${SCHEMA} CACHE INTERNAL "Schema, internal, immutable" FORCE)
# Parse out schema name and library.
set( SCHEMA_PATH "${STEPCODE_ROOT_DIR}/data/${SCHEMA}/*.exp" )
file( GLOB SCHEMA_FILE "${SCHEMA_PATH}" )
set(SCHEMA_PATH "${STEPCODE_ROOT_DIR}/data/${SCHEMA}/*.exp")
file(GLOB SCHEMA_FILE "${SCHEMA_PATH}")
if( NOT EXISTS ${SCHEMA_FILE} )
message( FATAL_ERROR "Cannot find the schema; cannot continue. Looked for ${SCHEMA_PATH} from ${CMAKE_CURRENT_LIST_DIR}" )
endif( NOT EXISTS ${SCHEMA_FILE} )
if(NOT EXISTS ${SCHEMA_FILE})
message(FATAL_ERROR "Cannot find the schema; cannot continue. Looked for ${SCHEMA_PATH} from ${CMAKE_CURRENT_LIST_DIR}")
endif(NOT EXISTS ${SCHEMA_FILE})
get_filename_component( SCHEMA_SN ${SCHEMA_FILE} NAME )
string( REGEX REPLACE "\(.*\).[Ee][Xx][Pp]" "\\1" SCHEMA_LINK_NAME ${SCHEMA_SN} )
set( STEPCODE_LIBRARIES base stepcore stepeditor stepdai steputils sdai_${SCHEMA_LINK_NAME} )
get_filename_component(SCHEMA_SN ${SCHEMA_FILE} NAME)
string(REGEX REPLACE "\(.*\).[Ee][Xx][Pp]" "sdai_\\1" SCHEMA_LINK_NAME ${SCHEMA_SN})
set(STEPCODE_LIBRARIES base stepcore stepeditor stepdai steputils ${SCHEMA_LINK_NAME})
# Add STEPCode project to CMake build.
add_subdirectory( ${STEPCODE_ROOT_DIR} "${CMAKE_CURRENT_BINARY_DIR}/sc" EXCLUDE_FROM_ALL )
add_subdirectory(${STEPCODE_ROOT_DIR} "${CMAKE_CURRENT_BINARY_DIR}/sc" EXCLUDE_FROM_ALL)
# Set up STEPcode include directories.
set( STEPCODE_INCLUDE_DIR
${STEPCODE_ROOT_DIR}/src/base
${STEPCODE_ROOT_DIR}/src/clstepcore
${STEPCODE_ROOT_DIR}/src/cldai
${STEPCODE_ROOT_DIR}/src/clutils
${STEPCODE_ROOT_DIR}/src/cleditor
${STEPCODE_BUILD_DIR}/include
${STEPCODE_ROOT_DIR}/include
${CMAKE_BINARY_DIR}
)
set(STEPCODE_INCLUDE_DIR
${STEPCODE_ROOT_DIR}/src/base
${STEPCODE_ROOT_DIR}/src/clstepcore
${STEPCODE_ROOT_DIR}/src/cldai
${STEPCODE_ROOT_DIR}/src/clutils
${STEPCODE_ROOT_DIR}/src/cleditor
${STEPCODE_BUILD_DIR}/include
${STEPCODE_ROOT_DIR}/include
${CMAKE_BINARY_DIR}
${STEPCODE_BUILD_DIR}/schemas/${SCHEMA_LINK_NAME}
)
# Reset sane values for build destination. Otherwise, everything ends up in ${CMAKE_BINARY_DIR}/sc
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include_directories(
${STEPCODE_INCLUDE_DIR}
)
${STEPCODE_INCLUDE_DIR}
)
# Application sources and headers
set( SRCS
ap203min.cpp
)
set(SRCS ap203min.cpp)
set( HDRS
)
set(HDRS )
add_executable( ${PROJECT_NAME} ${SRCS} ${HDRS} )
add_executable(${PROJECT_NAME} ${SRCS} ${HDRS})
target_link_libraries( ${PROJECT_NAME} ${STEPCODE_LIBRARIES} )
target_link_libraries(${PROJECT_NAME} ${STEPCODE_LIBRARIES})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-I${STEPCODE_BUILD_DIR}/data/${SCHEMA_LINK_NAME}" )
-4
View File
@@ -49,10 +49,6 @@
// $./AP203Minimum
// AP203Minimum outfile.stp
extern void
SchemaInit( class Registry & );
#include <STEPfile.h>
#include <sdai.h>
#include <STEPattribute.h>
+19 -11
View File
@@ -1,4 +1,4 @@
SET(express_HDRS
set(express_HDRS
express/alg.h
express/basic.h
express/caseitem.h
@@ -20,21 +20,29 @@ SET(express_HDRS
express/symbol.h
express/type.h
express/variable.h
)
)
install(FILES ${express_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/express)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/express)
SET(exppp_HDRS
set(exppp_HDRS
exppp/exppp.h
)
)
install(FILES ${exppp_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/exppp)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/exppp)
install(FILES ordered_attrs.h
sc_export.h
sc_stdbool.h
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
sc_export.h
sc_stdbool.h
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
install(FILES ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h
${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+1 -1
View File
@@ -69,7 +69,7 @@ struct tag {
/** location of fulltext of algorithm in source file */
struct FullText {
char * filename;
const char * filename;
unsigned int start, end;
};
+1 -1
View File
@@ -83,7 +83,7 @@ typedef struct Error_Warning_ {
/********************/
extern SC_EXPRESS_EXPORT bool __ERROR_buffer_errors;
extern SC_EXPRESS_EXPORT char * current_filename;
extern SC_EXPRESS_EXPORT const char * current_filename;
/* flag to remember whether non-warning errors have occurred */
extern SC_EXPRESS_EXPORT bool ERRORoccurred;
+127
View File
@@ -0,0 +1,127 @@
#ifndef EXP_KW_H
#define EXP_KW_H
#include "sc_export.h"
extern SC_EXPRESS_EXPORT char * KW_ABS;
extern SC_EXPRESS_EXPORT char * KW_ABSTRACT;
extern SC_EXPRESS_EXPORT char * KW_ACOS;
extern SC_EXPRESS_EXPORT char * KW_AGGREGATE;
extern SC_EXPRESS_EXPORT char * KW_ALIAS;
extern SC_EXPRESS_EXPORT char * KW_AND;
extern SC_EXPRESS_EXPORT char * KW_ANDOR;
extern SC_EXPRESS_EXPORT char * KW_ARRAY;
extern SC_EXPRESS_EXPORT char * KW_AS;
extern SC_EXPRESS_EXPORT char * KW_ASIN;
extern SC_EXPRESS_EXPORT char * KW_ATAN;
extern SC_EXPRESS_EXPORT char * KW_BAG;
extern SC_EXPRESS_EXPORT char * KW_BEGIN;
extern SC_EXPRESS_EXPORT char * KW_BINARY;
extern SC_EXPRESS_EXPORT char * KW_BLENGTH;
extern SC_EXPRESS_EXPORT char * KW_BOOLEAN;
extern SC_EXPRESS_EXPORT char * KW_BY;
extern SC_EXPRESS_EXPORT char * KW_CASE;
extern SC_EXPRESS_EXPORT char * KW_CONST_E;
extern SC_EXPRESS_EXPORT char * KW_CONSTANT;
extern SC_EXPRESS_EXPORT char * KW_CONTEXT;
extern SC_EXPRESS_EXPORT char * KW_COS;
extern SC_EXPRESS_EXPORT char * KW_DERIVE;
extern SC_EXPRESS_EXPORT char * KW_DIV;
extern SC_EXPRESS_EXPORT char * KW_ELSE;
extern SC_EXPRESS_EXPORT char * KW_END;
extern SC_EXPRESS_EXPORT char * KW_END_ALIAS;
extern SC_EXPRESS_EXPORT char * KW_END_CASE;
extern SC_EXPRESS_EXPORT char * KW_END_CONSTANT;
extern SC_EXPRESS_EXPORT char * KW_END_CONTEXT;
extern SC_EXPRESS_EXPORT char * KW_END_ENTITY;
extern SC_EXPRESS_EXPORT char * KW_END_FUNCTION;
extern SC_EXPRESS_EXPORT char * KW_END_IF;
extern SC_EXPRESS_EXPORT char * KW_END_LOCAL;
extern SC_EXPRESS_EXPORT char * KW_END_MODEL;
extern SC_EXPRESS_EXPORT char * KW_END_PROCEDURE;
extern SC_EXPRESS_EXPORT char * KW_END_REPEAT;
extern SC_EXPRESS_EXPORT char * KW_END_RULE;
extern SC_EXPRESS_EXPORT char * KW_END_SCHEMA;
extern SC_EXPRESS_EXPORT char * KW_END_TYPE;
extern SC_EXPRESS_EXPORT char * KW_ENTITY;
extern SC_EXPRESS_EXPORT char * KW_ENUMERATION;
extern SC_EXPRESS_EXPORT char * KW_ESCAPE;
extern SC_EXPRESS_EXPORT char * KW_EXISTS;
extern SC_EXPRESS_EXPORT char * KW_EXP;
extern SC_EXPRESS_EXPORT char * KW_FALSE;
extern SC_EXPRESS_EXPORT char * KW_FIXED;
extern SC_EXPRESS_EXPORT char * KW_FOR;
extern SC_EXPRESS_EXPORT char * KW_FORMAT;
extern SC_EXPRESS_EXPORT char * KW_FROM;
extern SC_EXPRESS_EXPORT char * KW_FUNCTION;
extern SC_EXPRESS_EXPORT char * KW_GENERIC;
extern SC_EXPRESS_EXPORT char * KW_HIBOUND;
extern SC_EXPRESS_EXPORT char * KW_HIINDEX;
extern SC_EXPRESS_EXPORT char * KW_IF;
extern SC_EXPRESS_EXPORT char * KW_IN;
extern SC_EXPRESS_EXPORT char * KW_INCLUDE;
extern SC_EXPRESS_EXPORT char * KW_INSERT;
extern SC_EXPRESS_EXPORT char * KW_INTEGER;
extern SC_EXPRESS_EXPORT char * KW_INVERSE;
extern SC_EXPRESS_EXPORT char * KW_LENGTH;
extern SC_EXPRESS_EXPORT char * KW_LIKE;
extern SC_EXPRESS_EXPORT char * KW_LIST;
extern SC_EXPRESS_EXPORT char * KW_LOBOUND;
extern SC_EXPRESS_EXPORT char * KW_LOCAL;
extern SC_EXPRESS_EXPORT char * KW_LOG;
extern SC_EXPRESS_EXPORT char * KW_LOG10;
extern SC_EXPRESS_EXPORT char * KW_LOG2;
extern SC_EXPRESS_EXPORT char * KW_LOGICAL;
extern SC_EXPRESS_EXPORT char * KW_LOINDEX;
extern SC_EXPRESS_EXPORT char * KW_MOD;
extern SC_EXPRESS_EXPORT char * KW_MODEL;
extern SC_EXPRESS_EXPORT char * KW_NOT;
extern SC_EXPRESS_EXPORT char * KW_NUMBER;
extern SC_EXPRESS_EXPORT char * KW_NVL;
extern SC_EXPRESS_EXPORT char * KW_ODD;
extern SC_EXPRESS_EXPORT char * KW_OF;
extern SC_EXPRESS_EXPORT char * KW_ONEOF;
extern SC_EXPRESS_EXPORT char * KW_OPTIONAL;
extern SC_EXPRESS_EXPORT char * KW_OR;
extern SC_EXPRESS_EXPORT char * KW_OTHERWISE;
extern SC_EXPRESS_EXPORT char * KW_PI;
extern SC_EXPRESS_EXPORT char * KW_PROCEDURE;
extern SC_EXPRESS_EXPORT char * KW_QUERY;
extern SC_EXPRESS_EXPORT char * KW_REAL;
extern SC_EXPRESS_EXPORT char * KW_REFERENCE;
extern SC_EXPRESS_EXPORT char * KW_REMOVE;
extern SC_EXPRESS_EXPORT char * KW_REPEAT;
extern SC_EXPRESS_EXPORT char * KW_RETURN;
extern SC_EXPRESS_EXPORT char * KW_ROLESOF;
extern SC_EXPRESS_EXPORT char * KW_RULE;
extern SC_EXPRESS_EXPORT char * KW_SCHEMA;
extern SC_EXPRESS_EXPORT char * KW_SELECT;
extern SC_EXPRESS_EXPORT char * KW_SELF;
extern SC_EXPRESS_EXPORT char * KW_SET;
extern SC_EXPRESS_EXPORT char * KW_SIN;
extern SC_EXPRESS_EXPORT char * KW_SIZEOF;
extern SC_EXPRESS_EXPORT char * KW_SKIP;
extern SC_EXPRESS_EXPORT char * KW_SQRT;
extern SC_EXPRESS_EXPORT char * KW_STRING;
extern SC_EXPRESS_EXPORT char * KW_SUBTYPE;
extern SC_EXPRESS_EXPORT char * KW_SUPERTYPE;
extern SC_EXPRESS_EXPORT char * KW_TAN;
extern SC_EXPRESS_EXPORT char * KW_THEN;
extern SC_EXPRESS_EXPORT char * KW_TO;
extern SC_EXPRESS_EXPORT char * KW_TRUE;
extern SC_EXPRESS_EXPORT char * KW_TYPE;
extern SC_EXPRESS_EXPORT char * KW_TYPEOF;
extern SC_EXPRESS_EXPORT char * KW_UNIQUE;
extern SC_EXPRESS_EXPORT char * KW_UNKNOWN;
extern SC_EXPRESS_EXPORT char * KW_UNTIL;
extern SC_EXPRESS_EXPORT char * KW_USE;
extern SC_EXPRESS_EXPORT char * KW_USEDIN;
extern SC_EXPRESS_EXPORT char * KW_VALUE;
extern SC_EXPRESS_EXPORT char * KW_VALUE_IN;
extern SC_EXPRESS_EXPORT char * KW_VALUE_UNIQUE;
extern SC_EXPRESS_EXPORT char * KW_VAR;
extern SC_EXPRESS_EXPORT char * KW_WHERE;
extern SC_EXPRESS_EXPORT char * KW_WHILE;
extern SC_EXPRESS_EXPORT char * KW_XOR;
#endif /* EXP_KW_H */
+2 -125
View File
@@ -115,127 +115,6 @@ extern SC_EXPRESS_EXPORT Error ERROR_warn_small_real;
extern SC_EXPRESS_EXPORT struct Scope_ * FUNC_NVL;
extern SC_EXPRESS_EXPORT struct Scope_ * FUNC_USEDIN;
extern SC_EXPRESS_EXPORT char * KW_ABS;
extern SC_EXPRESS_EXPORT char * KW_ABSTRACT;
extern SC_EXPRESS_EXPORT char * KW_ACOS;
extern SC_EXPRESS_EXPORT char * KW_AGGREGATE;
extern SC_EXPRESS_EXPORT char * KW_ALIAS;
extern SC_EXPRESS_EXPORT char * KW_AND;
extern SC_EXPRESS_EXPORT char * KW_ANDOR;
extern SC_EXPRESS_EXPORT char * KW_ARRAY;
extern SC_EXPRESS_EXPORT char * KW_AS;
extern SC_EXPRESS_EXPORT char * KW_ASIN;
extern SC_EXPRESS_EXPORT char * KW_ATAN;
extern SC_EXPRESS_EXPORT char * KW_BAG;
extern SC_EXPRESS_EXPORT char * KW_BEGIN;
extern SC_EXPRESS_EXPORT char * KW_BINARY;
extern SC_EXPRESS_EXPORT char * KW_BLENGTH;
extern SC_EXPRESS_EXPORT char * KW_BOOLEAN;
extern SC_EXPRESS_EXPORT char * KW_BY;
extern SC_EXPRESS_EXPORT char * KW_CASE;
extern SC_EXPRESS_EXPORT char * KW_CONST_E;
extern SC_EXPRESS_EXPORT char * KW_CONSTANT;
extern SC_EXPRESS_EXPORT char * KW_CONTEXT;
extern SC_EXPRESS_EXPORT char * KW_COS;
extern SC_EXPRESS_EXPORT char * KW_DERIVE;
extern SC_EXPRESS_EXPORT char * KW_DIV;
extern SC_EXPRESS_EXPORT char * KW_ELSE;
extern SC_EXPRESS_EXPORT char * KW_END;
extern SC_EXPRESS_EXPORT char * KW_END_ALIAS;
extern SC_EXPRESS_EXPORT char * KW_END_CASE;
extern SC_EXPRESS_EXPORT char * KW_END_CONSTANT;
extern SC_EXPRESS_EXPORT char * KW_END_CONTEXT;
extern SC_EXPRESS_EXPORT char * KW_END_ENTITY;
extern SC_EXPRESS_EXPORT char * KW_END_FUNCTION;
extern SC_EXPRESS_EXPORT char * KW_END_IF;
extern SC_EXPRESS_EXPORT char * KW_END_LOCAL;
extern SC_EXPRESS_EXPORT char * KW_END_MODEL;
extern SC_EXPRESS_EXPORT char * KW_END_PROCEDURE;
extern SC_EXPRESS_EXPORT char * KW_END_REPEAT;
extern SC_EXPRESS_EXPORT char * KW_END_RULE;
extern SC_EXPRESS_EXPORT char * KW_END_SCHEMA;
extern SC_EXPRESS_EXPORT char * KW_END_TYPE;
extern SC_EXPRESS_EXPORT char * KW_ENTITY;
extern SC_EXPRESS_EXPORT char * KW_ENUMERATION;
extern SC_EXPRESS_EXPORT char * KW_ESCAPE;
extern SC_EXPRESS_EXPORT char * KW_EXISTS;
extern SC_EXPRESS_EXPORT char * KW_EXP;
extern SC_EXPRESS_EXPORT char * KW_FALSE;
extern SC_EXPRESS_EXPORT char * KW_FIXED;
extern SC_EXPRESS_EXPORT char * KW_FOR;
extern SC_EXPRESS_EXPORT char * KW_FORMAT;
extern SC_EXPRESS_EXPORT char * KW_FROM;
extern SC_EXPRESS_EXPORT char * KW_FUNCTION;
extern SC_EXPRESS_EXPORT char * KW_GENERIC;
extern SC_EXPRESS_EXPORT char * KW_HIBOUND;
extern SC_EXPRESS_EXPORT char * KW_HIINDEX;
extern SC_EXPRESS_EXPORT char * KW_IF;
extern SC_EXPRESS_EXPORT char * KW_IN;
extern SC_EXPRESS_EXPORT char * KW_INCLUDE;
extern SC_EXPRESS_EXPORT char * KW_INSERT;
extern SC_EXPRESS_EXPORT char * KW_INTEGER;
extern SC_EXPRESS_EXPORT char * KW_INVERSE;
extern SC_EXPRESS_EXPORT char * KW_LENGTH;
extern SC_EXPRESS_EXPORT char * KW_LIKE;
extern SC_EXPRESS_EXPORT char * KW_LIST;
extern SC_EXPRESS_EXPORT char * KW_LOBOUND;
extern SC_EXPRESS_EXPORT char * KW_LOCAL;
extern SC_EXPRESS_EXPORT char * KW_LOG;
extern SC_EXPRESS_EXPORT char * KW_LOG10;
extern SC_EXPRESS_EXPORT char * KW_LOG2;
extern SC_EXPRESS_EXPORT char * KW_LOGICAL;
extern SC_EXPRESS_EXPORT char * KW_LOINDEX;
extern SC_EXPRESS_EXPORT char * KW_MOD;
extern SC_EXPRESS_EXPORT char * KW_MODEL;
extern SC_EXPRESS_EXPORT char * KW_NOT;
extern SC_EXPRESS_EXPORT char * KW_NUMBER;
extern SC_EXPRESS_EXPORT char * KW_NVL;
extern SC_EXPRESS_EXPORT char * KW_ODD;
extern SC_EXPRESS_EXPORT char * KW_OF;
extern SC_EXPRESS_EXPORT char * KW_ONEOF;
extern SC_EXPRESS_EXPORT char * KW_OPTIONAL;
extern SC_EXPRESS_EXPORT char * KW_OR;
extern SC_EXPRESS_EXPORT char * KW_OTHERWISE;
extern SC_EXPRESS_EXPORT char * KW_PI;
extern SC_EXPRESS_EXPORT char * KW_PROCEDURE;
extern SC_EXPRESS_EXPORT char * KW_QUERY;
extern SC_EXPRESS_EXPORT char * KW_REAL;
extern SC_EXPRESS_EXPORT char * KW_REFERENCE;
extern SC_EXPRESS_EXPORT char * KW_REMOVE;
extern SC_EXPRESS_EXPORT char * KW_REPEAT;
extern SC_EXPRESS_EXPORT char * KW_RETURN;
extern SC_EXPRESS_EXPORT char * KW_ROLESOF;
extern SC_EXPRESS_EXPORT char * KW_RULE;
extern SC_EXPRESS_EXPORT char * KW_SCHEMA;
extern SC_EXPRESS_EXPORT char * KW_SELECT;
extern SC_EXPRESS_EXPORT char * KW_SELF;
extern SC_EXPRESS_EXPORT char * KW_SET;
extern SC_EXPRESS_EXPORT char * KW_SIN;
extern SC_EXPRESS_EXPORT char * KW_SIZEOF;
extern SC_EXPRESS_EXPORT char * KW_SKIP;
extern SC_EXPRESS_EXPORT char * KW_SQRT;
extern SC_EXPRESS_EXPORT char * KW_STRING;
extern SC_EXPRESS_EXPORT char * KW_SUBTYPE;
extern SC_EXPRESS_EXPORT char * KW_SUPERTYPE;
extern SC_EXPRESS_EXPORT char * KW_TAN;
extern SC_EXPRESS_EXPORT char * KW_THEN;
extern SC_EXPRESS_EXPORT char * KW_TO;
extern SC_EXPRESS_EXPORT char * KW_TRUE;
extern SC_EXPRESS_EXPORT char * KW_TYPE;
extern SC_EXPRESS_EXPORT char * KW_TYPEOF;
extern SC_EXPRESS_EXPORT char * KW_UNIQUE;
extern SC_EXPRESS_EXPORT char * KW_UNKNOWN;
extern SC_EXPRESS_EXPORT char * KW_UNTIL;
extern SC_EXPRESS_EXPORT char * KW_USE;
extern SC_EXPRESS_EXPORT char * KW_USEDIN;
extern SC_EXPRESS_EXPORT char * KW_VALUE;
extern SC_EXPRESS_EXPORT char * KW_VALUE_IN;
extern SC_EXPRESS_EXPORT char * KW_VALUE_UNIQUE;
extern SC_EXPRESS_EXPORT char * KW_VAR;
extern SC_EXPRESS_EXPORT char * KW_WHERE;
extern SC_EXPRESS_EXPORT char * KW_WHILE;
extern SC_EXPRESS_EXPORT char * KW_XOR;
/******************************/
/* macro function definitions */
/******************************/
@@ -255,11 +134,9 @@ extern SC_EXPRESS_EXPORT void EXPRESSparse PROTO( ( Express, FILE *, ch
extern SC_EXPRESS_EXPORT void EXPRESSinitialize PROTO( ( void ) );
extern SC_EXPRESS_EXPORT void EXPRESScleanup PROTO( ( void ) );
extern SC_EXPRESS_EXPORT void EXPRESSresolve PROTO( ( Express ) );
extern SC_EXPRESS_EXPORT char * EXPRESSversion PROTO( ( void ) );
extern SC_EXPRESS_EXPORT int EXPRESS_fail PROTO( ( Express ) );
extern SC_EXPRESS_EXPORT int EXPRESS_succeed PROTO( ( Express ) );
extern SC_EXPRESS_EXPORT int EXPRESS_fail( Express model );
extern SC_EXPRESS_EXPORT int EXPRESS_succeed( Express model );
extern void EXPRESSinit_init PROTO( ( void ) );
extern SC_EXPRESS_EXPORT void EXPRESSusage( int _exit ); /**< exit unless _exit is non-zero */
extern SC_EXPRESS_EXPORT void build_complex( Express );
#endif /*EXPRESS_H*/
+14
View File
@@ -0,0 +1,14 @@
#ifndef INFO_H
#define INFO_H
#include "sc_export.h"
/** \file info.h
* informative functions that were in express.c/express.h
*/
extern SC_EXPRESS_EXPORT char * EXPRESSversion( void );
/** print usage message, then exit if _exit is non-zero */
extern SC_EXPRESS_EXPORT void EXPRESSusage( int _exit );
#endif /* INFO_H */
+1 -1
View File
@@ -58,7 +58,7 @@ typedef struct Scan_Buffer {
#endif
char * savedPos;
FILE * file;
char * filename;
const char * filename;
bool readEof;
int lineno;
int bol;
+2
View File
@@ -129,6 +129,8 @@ extern SC_EXPRESS_EXPORT void LISTinitialize PROTO( ( void ) );
extern SC_EXPRESS_EXPORT void LISTcleanup PROTO( ( void ) );
extern SC_EXPRESS_EXPORT Linked_List LISTcreate PROTO( ( void ) );
extern SC_EXPRESS_EXPORT Linked_List LISTcopy PROTO( ( Linked_List ) );
extern SC_EXPRESS_EXPORT void LISTsort PROTO( ( Linked_List, int (*comp)(void*, void*) ) );
extern SC_EXPRESS_EXPORT void LISTswap PROTO( ( Link, Link ) );
extern SC_EXPRESS_EXPORT Generic LISTadd_first PROTO( ( Linked_List, Generic ) );
extern SC_EXPRESS_EXPORT Generic LISTadd_last PROTO( ( Linked_List, Generic ) );
extern SC_EXPRESS_EXPORT Generic LISTadd_after PROTO( ( Linked_List, Link, Generic ) );
+2 -2
View File
@@ -59,7 +59,7 @@ typedef struct Symbol_ Symbol;
struct Symbol_ {
char * name;
char * filename;
const char * filename;
int line;
char resolved;
};
@@ -89,6 +89,6 @@ extern SC_EXPRESS_EXPORT struct freelist_head SYMBOL_fl;
/***********************/
extern SC_EXPRESS_EXPORT void SYMBOLinitialize PROTO( ( void ) );
SC_EXPRESS_EXPORT Symbol * SYMBOLcreate( char * name, int line, char * filename );
SC_EXPRESS_EXPORT Symbol * SYMBOLcreate( char * name, int line, const char * filename );
#endif /* SYMBOL_H */
+1
View File
@@ -164,6 +164,7 @@ struct TypeBody_ {
* element = expression [ ':' repetition ] .
* TODO exp2cxx and exp2py do not use this! Are all use cases handled by libexppp?
*/
unsigned var : 1; /** denotes variable marked 'VAR' - i.e. one where changes are propagated back to the caller */
unsigned encoded : 1; /**< encoded string */
} flags;
Type base; /**< underlying base type if any can also contain true type if this type is a type reference */
+3 -2
View File
@@ -76,10 +76,11 @@ typedef struct Variable_ * Variable;
/***************************/
struct Variable_ {
Expression name; /**< Symbol is inside of 'name' */
Expression name; /**< Symbol is inside of 'name' */
Type type;
Expression initializer; /**< or 'derived' */
int offset;
int offset; /**< used for attr order in Entitys, and for decl order in LOCAL vars. these two uses should never conflict! */
int idx; /**< used in exp2cxx to simplify calculation of attrDescriptor names in generated code */
struct {
unsigned int optional : 1; /**< OPTIONAL keyword */
+37 -29
View File
@@ -1,15 +1,15 @@
# lcov.cmake
# `ctest -S lcov.cmake`
if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
message( FATAL_ERROR "LCOV is Linux-only" )
endif( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(FATAL_ERROR "LCOV is Linux-only")
endif(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set( CTEST_SOURCE_DIRECTORY . )
set( CTEST_BINARY_DIRECTORY build_lcov )
set( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
set( CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind )
set( CTEST_INITIAL_CACHE "
set(CTEST_SOURCE_DIRECTORY .)
set(CTEST_BINARY_DIRECTORY build_lcov)
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind)
set(CTEST_INITIAL_CACHE "
SITE:STRING=${CTEST_SITE}
BUILDNAME:STRING=${CTEST_BUILD_NAME}
SC_ENABLE_TESTING:BOOL=ON
@@ -18,42 +18,50 @@ SC_BUILD_SCHEMAS:STRING=ALL
SC_BUILD_TYPE:STRING=Debug
")
set( LCOV_OUT "${CTEST_BINARY_DIRECTORY}/lcov_html" )
set(LCOV_OUT "${CTEST_BINARY_DIRECTORY}/lcov_html")
ctest_start(lcov)
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
message("configuring...")
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS "-DSC_BUILD_SCHEMAS=ALL;-DSC_ENABLE_COVERAGE=ON;-SC_PYTHON_GENERATOR=OFF" )
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS "-DSC_BUILD_SCHEMAS=ALL;-DSC_ENABLE_COVERAGE=ON;-SC_PYTHON_GENERATOR=OFF")
message("lcov: resetting counters...")
execute_process( COMMAND lcov -z -d .
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} OUTPUT_QUIET )
execute_process(COMMAND lcov -z -d .
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} OUTPUT_QUIET)
# copy files so lcov won't complain
execute_process( COMMAND ${CMAKE_COMMAND} -E copy src/express/expparse.y ${CTEST_BINARY_DIRECTORY}/src/express/CMakeFiles/express.dir )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy src/express/expscan.l ${CTEST_BINARY_DIRECTORY}/src/express/CMakeFiles/express.dir )
execute_process(COMMAND ${CMAKE_COMMAND} -E copy src/express/expparse.y ${CTEST_BINARY_DIRECTORY}/src/express/CMakeFiles/express.dir)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy src/express/expscan.l ${CTEST_BINARY_DIRECTORY}/src/express/CMakeFiles/express.dir)
message("building...")
ctest_build( BUILD "${CTEST_BINARY_DIRECTORY}" )
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}")
message("running tests...")
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 1 )
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 1)
message( "analyzing profiling data using lcov..." )
execute_process( COMMAND lcov -c -d . -o stepcode.lcov
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} OUTPUT_QUIET ERROR_QUIET )
message("analyzing profiling data using lcov...")
execute_process(COMMAND lcov -c -d . -o stepcode.lcov
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} OUTPUT_QUIET ERROR_QUIET)
message("removing system headers...")
execute_process( COMMAND lcov -r stepcode.lcov "/usr/include/*" -o stepcode_no_usr.lcov
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} OUTPUT_QUIET ERROR_QUIET )
execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${LCOV_OUT} )
execute_process(COMMAND lcov -r stepcode.lcov "/usr/include/*" -o stepcode_no_usr.lcov
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} OUTPUT_QUIET ERROR_QUIET)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${LCOV_OUT})
message( "creating html files..." )
execute_process( COMMAND genhtml ../stepcode_no_usr.lcov
WORKING_DIRECTORY ${LCOV_OUT} OUTPUT_QUIET ERROR_QUIET )
message("creating html files...")
execute_process(COMMAND genhtml ../stepcode_no_usr.lcov
WORKING_DIRECTORY ${LCOV_OUT} OUTPUT_QUIET ERROR_QUIET)
message( "html files are located in ${LCOV_OUT}" )
execute_process( COMMAND ${CMAKE_COMMAND} -E tar czf ${LCOV_OUT}.tgz ${LCOV_OUT} WORKING_DIRECTORY ${CTEST_SOURCE_DIRECTORY} )
message("html files are located in ${LCOV_OUT}")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar czf ${LCOV_OUT}.tgz ${LCOV_OUT} WORKING_DIRECTORY ${CTEST_SOURCE_DIRECTORY})
message( "tarball at ${LCOV_OUT}.tgz" )
message("tarball at ${LCOV_OUT}.tgz")
message("================================================ Success! ================================================")
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
message( "================================================ Success! ================================================" )
+66 -58
View File
@@ -1,11 +1,11 @@
# run_ctest.cmake
# `ctest -S run_ctest.cmake`
set( CTEST_SOURCE_DIRECTORY . )
set( CTEST_BINARY_DIRECTORY build_ctest )
set( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
set( CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind )
set( CTEST_INITIAL_CACHE "
set(CTEST_SOURCE_DIRECTORY .)
set(CTEST_BINARY_DIRECTORY build_ctest)
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind)
set(CTEST_INITIAL_CACHE "
SITE:STRING=${CTEST_SITE}
BUILDNAME:STRING=${CTEST_BUILD_NAME}
SC_ENABLE_TESTING:BOOL=ON
@@ -14,11 +14,11 @@ SC_BUILD_TYPE:STRING=Debug
if( EXISTS "../.SC_CTEST_PREFS.cmake" )
include( "../.SC_CTEST_PREFS.cmake" )
if(EXISTS "../.SC_CTEST_PREFS.cmake")
include("../.SC_CTEST_PREFS.cmake")
else()
message( WARNING "Did not find ../.SC_CTEST_PREFS.cmake, containing config variables - result submission disabled" )
set( SKIP_SUBMISSION TRUE )
message(WARNING "Did not find ../.SC_CTEST_PREFS.cmake, containing config variables - result submission disabled")
set(SKIP_SUBMISSION TRUE)
endif()
######################################################
@@ -26,8 +26,8 @@ endif()
# use config variables such as these in
# ../.SC_CTEST_PREFS.cmake
#
#set( CTEST_SITE "username")
#set( CTEST_BUILD_NAME "build type, os, arch")
#set(CTEST_SITE "username")
#set(CTEST_BUILD_NAME "build type, os, arch")
#
#
# setting any of these to true causes that set of tests
@@ -44,11 +44,11 @@ endif()
######################################################
function( SUBMIT_TEST part )
if( NOT SKIP_SUBMISSION )
ctest_submit( PARTS ${part} )
endif()
endfunction( SUBMIT_TEST part )
function(SUBMIT_TEST part)
if(NOT SKIP_SUBMISSION)
ctest_submit(PARTS ${part})
endif()
endfunction(SUBMIT_TEST part)
######################################################
##### To disable reporting of a set of tests, comment
@@ -56,65 +56,73 @@ endfunction( SUBMIT_TEST part )
##### the set you wish to disable.
#####
##### To do this for all tests:
##### set( SKIP_SUBMISSION TRUE )
##### set(SKIP_SUBMISSION TRUE)
######################################################
ctest_start(Experimental)
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
file(WRITE "${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake" "
set( CTEST_CUSTOM_ERROR_EXCEPTION \"{standard input}:[0-9][0-9]*: WARNING: \")
set(CTEST_CUSTOM_ERROR_EXCEPTION \"{standard input}:[0-9][0-9]*: WARNING: \")
")
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND OPTIONS -DSC_ENABLE_TESTING=ON )
SUBMIT_TEST( Configure )
ctest_build( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND )
SUBMIT_TEST( Build )
# ctest_memcheck( BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res )
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND OPTIONS -DSC_ENABLE_TESTING=ON)
SUBMIT_TEST(Configure)
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
SUBMIT_TEST(Build)
# ctest_memcheck(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
if(NOT SKIP_TEST_UNITARY_SCHEMAS )
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "unitary_schemas" )
SUBMIT_TEST( Test )
if(NOT SKIP_TEST_UNITARY_SCHEMAS)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "unitary_schemas")
SUBMIT_TEST(Test)
endif()
if(NOT SKIP_CPP_TEST_SCHEMA_GEN )
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_gen" )
SUBMIT_TEST( Test )
if(NOT SKIP_CPP_TEST_SCHEMA_BUILD )
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_build" )
SUBMIT_TEST( Test )
if(NOT SKIP_CPP_TEST_SCHEMA_RW )
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_rw" )
SUBMIT_TEST( Test )
endif()
if(NOT SKIP_CPP_TEST_SCHEMA_GEN)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_gen")
SUBMIT_TEST(Test)
if(NOT SKIP_CPP_TEST_SCHEMA_BUILD)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_build")
SUBMIT_TEST(Test)
if(NOT SKIP_CPP_TEST_SCHEMA_RW)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_rw")
SUBMIT_TEST(Test)
endif()
endif()
endif()
if(NOT SKIP_TEST_EXCHANGE_FILE )
if( SKIP_CPP_TEST_SCHEMA_BUILD )
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE "build_cpp_sdai_AP214E3_2010" )
SUBMIT_TEST( Test )
endif()
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "exchange_file" )
SUBMIT_TEST( Test )
if(NOT SKIP_TEST_EXCHANGE_FILE)
if(SKIP_CPP_TEST_SCHEMA_BUILD)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE "build_cpp_sdai_AP214E3_2010")
SUBMIT_TEST(Test)
endif()
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "exchange_file")
SUBMIT_TEST(Test)
endif()
if(NOT SKIP_TEST_CPP_SCHEMA_SPECIFIC )
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_specific" )
SUBMIT_TEST( Test )
if(NOT SKIP_TEST_CPP_SCHEMA_SPECIFIC)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_schema_specific")
SUBMIT_TEST(Test)
endif()
if(NOT SKIP_TEST_CPP_UNIT )
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_unit_....*" )
SUBMIT_TEST( Test )
if(NOT SKIP_TEST_CPP_UNIT)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
INCLUDE_LABEL "cpp_unit_....*")
SUBMIT_TEST(Test)
endif()
# ctest_coverage( )
# ctest_coverage()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+37 -27
View File
@@ -1,45 +1,55 @@
set(SC_BASE_SOURCES
sc_memmgr.cc
sc_trace_fprintf.c
sc_getopt.cc
sc_benchmark.cc
)
sc_memmgr.cc
sc_trace_fprintf.c
sc_getopt.cc
sc_benchmark.cc
sc_mkdir.c
)
set(SC_BASE_HDRS
sc_benchmark.h
sc_memmgr.h
sc_getopt.h
sc_trace_fprintf.h
sc_stdbool.h
)
sc_benchmark.h
sc_memmgr.h
sc_getopt.h
sc_trace_fprintf.h
sc_stdbool.h
sc_mkdir.h
)
if(MINGW OR MSVC OR BORLAND)
add_definitions( -DSC_BASE_DLL_EXPORTS )
add_definitions(-DSC_BASE_DLL_EXPORTS)
endif()
if (${SC_MEMMGR_ENABLE_CHECKS})
add_definitions( -DSC_MEMMGR_ENABLE_CHECKS )
add_definitions(-DSC_MEMMGR_ENABLE_CHECKS)
endif()
SC_ADDLIB(base "${SC_BASE_SOURCES}" "")
if(MINGW OR MSVC OR BORLAND)
target_link_libraries(base psapi.lib)
target_link_libraries(base psapi.lib)
endif()
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src" )
message( "Judy array source code not found. Downloading (don't sweat, it's public domain)..." )
file( DOWNLOAD "http://github.com/mpictor/judy-template/archive/master.tar.gz"
"${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz" SHOW_PROGRESS )
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
)
file( RENAME judy-template-master judy )
file( REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz" )
message( "Judy array source code extracted." )
endif(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src" )
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src")
message("Judy array source code not found. Downloading (don't sweat, it's public domain)...")
file(DOWNLOAD "http://github.com/mpictor/judy-template/archive/master.tar.gz"
"${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz" SHOW_PROGRESS)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
)
file(RENAME judy-template-master judy)
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz")
message("Judy array source code extracted.")
endif(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src")
install(FILES ${SC_BASE_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/base)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/base)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+42 -34
View File
@@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 2.8)
project( JudyTemplates )
if( NOT DEFINED CMAKE_BUILD_TYPE )
# set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) #optimize, but include debug info
set( CMAKE_BUILD_TYPE "Release" )
# set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) #optimize, but include debug info
set( CMAKE_BUILD_TYPE "Release" )
endif( NOT DEFINED CMAKE_BUILD_TYPE )
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
@@ -12,29 +12,29 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
if( NOT DEFINED JUDY_OPTIMIZE_FLAGS )
if( CMAKE_COMPILER_IS_GNUCC )
set( JUDY_OPTIMIZE_FLAGS "-march=native" )
if( CMAKE_COMPILER_IS_GNUCC )
set( JUDY_OPTIMIZE_FLAGS "-march=native" )
#test for LTO; this uses an internal variable so it may break
if( DEFINED CMAKE_C_COMPILER_VERSION )
if( ${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 4.7.0 )
set( JUDY_OPTIMIZE_FLAGS "${JUDY_OPTIMIZE_FLAGS} -flto" )
message( " -- GCC version: ${CMAKE_C_COMPILER_VERSION}. Enabling link-time optimization." )
endif( ${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 4.7.0 )
endif( DEFINED CMAKE_C_COMPILER_VERSION )
#test for LTO; this uses an internal variable so it may break
if( DEFINED CMAKE_C_COMPILER_VERSION )
if( ${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 4.7.0 )
set( JUDY_OPTIMIZE_FLAGS "${JUDY_OPTIMIZE_FLAGS} -flto" )
message( " -- GCC version: ${CMAKE_C_COMPILER_VERSION}. Enabling link-time optimization." )
endif( ${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 4.7.0 )
endif( DEFINED CMAKE_C_COMPILER_VERSION )
#elseif( MSVC )
# set( JUDY_OPTIMIZE_FLAGS "..." ) # <--- set MSVC flags here <---
else()
message( "Unrecognized compiler - no optimization flags set. Edit CMakeLists.txt or set JUDY_OPTIMIZE_FLAGS." )
set( JUDY_OPTIMIZE_FLAGS "" )
endif( CMAKE_COMPILER_IS_GNUCC )
else()
message( "Unrecognized compiler - no optimization flags set. Edit CMakeLists.txt or set JUDY_OPTIMIZE_FLAGS." )
set( JUDY_OPTIMIZE_FLAGS "" )
endif( CMAKE_COMPILER_IS_GNUCC )
endif( NOT DEFINED JUDY_OPTIMIZE_FLAGS )
add_definitions( ${JUDY_OPTIMIZE_FLAGS} )
set( JUDYS_SOURCES src/judy.c src/judy.h )
if( CMAKE_COMPILER_IS_GNUCC )
add_definitions( -pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long )
add_definitions( -pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long )
endif( CMAKE_COMPILER_IS_GNUCC )
add_library( judy_lib STATIC ${JUDYS_SOURCES} )
@@ -42,29 +42,37 @@ add_library( judy_lib STATIC ${JUDYS_SOURCES} )
include_directories( src )
if( ENABLE_TESTING )
include( CTest )
include_directories( test )
enable_testing()
include( CTest )
include_directories( test )
enable_testing()
add_executable( pennysort test/pennySort.c test/sort.c ${JUDYS_SOURCES} )
add_executable( hexsort test/hexSort.c test/sort.c ${JUDYS_SOURCES} )
set_target_properties( pennysort hexsort PROPERTIES COMPILE_FLAGS "-DSTANDALONE" )
add_executable( pennysort test/pennySort.c test/sort.c ${JUDYS_SOURCES} )
add_executable( hexsort test/hexSort.c test/sort.c ${JUDYS_SOURCES} )
set_target_properties( pennysort hexsort PROPERTIES COMPILE_FLAGS "-DSTANDALONE" )
add_executable( judyLtest test/judyLtest.cc )
target_link_libraries( judyLtest judy_lib )
add_test( judyLtest judyLtest )
add_executable( judyLtest test/judyLtest.cc )
target_link_libraries( judyLtest judy_lib )
add_test( judyLtest judyLtest )
add_executable( judyL2test test/judyL2test.cc )
target_link_libraries( judyL2test judy_lib )
add_test( judyL2test judyL2test )
add_executable( judyL2test test/judyL2test.cc )
target_link_libraries( judyL2test judy_lib )
add_test( judyL2test judyL2test )
add_executable( judyStest test/judyStest.cc )
target_link_libraries( judyStest judy_lib )
add_test( judyStest judyStest )
add_executable( judyStest test/judyStest.cc )
target_link_libraries( judyStest judy_lib )
add_test( judyStest judyStest )
add_executable( judyS2test test/judyS2test.cc )
target_link_libraries( judyS2test judy_lib )
add_test( judyS2test judyS2test )
add_executable( judyS2test test/judyS2test.cc )
target_link_libraries( judyS2test judy_lib )
add_test( judyS2test judyS2test )
endif( ENABLE_TESTING )
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+2 -1
View File
@@ -903,8 +903,9 @@ JudySlot * judy_last( Judy * judy, JudySlot next, unsigned int off, unsigned int
JudySlot * judy_end( Judy * judy ) {
judy->level = 0;
return judy_last( judy, *judy->root, 0, 0 );
} // judy_nxt: return next entry
}
// judy_nxt: return next entry
JudySlot * judy_nxt( Judy * judy ) {
JudySlot * table, *inner;
int slot, size, cnt;
+12 -8
View File
@@ -29,14 +29,16 @@ struct judylKVpair {
*/
template< typename JudyKey, typename JudyValue >
class judyLArray {
public:
typedef judylKVpair< JudyKey, JudyValue > pair;
protected:
Judy * _judyarray;
unsigned int _maxLevels, _depth;
JudyValue * _lastSlot;
JudyKey _buff[1];
bool _success;
pair _kv;
public:
typedef judylKVpair< JudyKey, JudyValue > pair;
judyLArray(): _maxLevels( sizeof( JudyKey ) ), _depth( 1 ), _lastSlot( 0 ), _success( true ) {
assert( sizeof( JudyKey ) == JUDY_key_size && "JudyKey *must* be the same size as a pointer!" );
assert( sizeof( JudyValue ) == JUDY_key_size && "JudyValue *must* be the same size as a pointer!" );
@@ -55,9 +57,12 @@ class judyLArray {
judy_close( _judyarray );
}
void clear() {
void clear( bool deleteContents = false ) {
JudyKey key = 0;
while( 0 != ( _lastSlot = ( JudyValue * ) judy_strt( _judyarray, ( const unsigned char * ) &key, 0 ) ) ) {
if( deleteContents ) {
delete *_lastSlot;
}
judy_del( _judyarray );
}
}
@@ -112,18 +117,17 @@ class judyLArray {
}
/// retrieve the key-value pair for the most recent judy query.
inline const pair mostRecentPair() {
pair kv;
inline const pair & mostRecentPair() {
judy_key( _judyarray, ( unsigned char * ) _buff, _depth * JUDY_key_size );
if( _lastSlot ) {
kv.value = *_lastSlot;
_kv.value = *_lastSlot;
_success = true;
} else {
kv.value = ( JudyValue ) 0;
_kv.value = ( JudyValue ) 0;
_success = false;
}
kv.key = _buff[0];
return kv;
_kv.key = _buff[0];
return _kv;
}
/// retrieve the first key-value pair in the array
+1
View File
@@ -18,6 +18,7 @@
#include <iomanip>
#include <string>
#include <sstream>
#include <ios>
/// mem values in kb, times in ms (granularity may be higher than 1ms)
benchVals getMemAndTime( ) {
-5
View File
@@ -38,11 +38,6 @@ extern "C" {
* depends on getMemAndTime() above - may not work on all platforms.
*/
#ifdef _WIN32
template class SC_BASE_EXPORT std::allocator<char>;
template class SC_BASE_EXPORT std::basic_string<char, std::char_traits<char>, std::allocator<char> >;
#endif
class SC_BASE_EXPORT benchmark {
protected:
benchVals initialVals, laterVals;
+32
View File
@@ -0,0 +1,32 @@
#include "sc_mkdir.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#ifdef _WIN32
# include <direct.h>
#endif /* _WIN32 */
/* cross-platform mkdir */
int sc_mkdir( const char * path ) {
#ifdef _WIN32
return mkdir( path );
#else
return mkdir( path, 0777 );
#endif /* _WIN32 */
}
/* return -1 if error, 0 if created, 1 if dir existed already */
int mkDirIfNone( const char * path ) {
struct stat s;
if( stat( path, &s ) != 0 ) {
if( errno == ENOENT ) {
return sc_mkdir( path );
}
} else if( s.st_mode & S_IFDIR ) {
return 1;
}
/* either stat returned an error other than ENOENT, or 'path' exists but isn't a dir */
return -1;
}
+15
View File
@@ -0,0 +1,15 @@
#ifndef SC_MKDIR
#define SC_MKDIR
#include <sc_export.h>
/** cross-platform mkdir() */
SC_BASE_EXPORT int sc_mkdir( const char * path );
/** create a dir 'path' if 'path' doesn't exist
* \return -1 if error, 0 if created, 1 if dir existed already
* if it returns -1, check errno
*/
SC_BASE_EXPORT int mkDirIfNone( const char * path );
#endif /* SC_MKDIR */
+11
View File
@@ -0,0 +1,11 @@
#ifndef SC_STRTOULL_H
#define SC_STRTOULL_H
#include <limits.h>
#ifdef _WIN32
# define strtoull _strtoui64
# define ULLONG_MAX _UI64_MAX
#endif
#endif /* SC_STRTOULL_H */
+38 -30
View File
@@ -1,40 +1,48 @@
set(LIBSTEPDAI_SRCS
sdaiApplication_instance_set.cc
sdaiBinary.cc
sdaiDaObject.cc
sdaiEntity_extent.cc
sdaiEntity_extent_set.cc
sdaiEnum.cc
sdaiModel_contents.cc
sdaiModel_contents_list.cc
sdaiObject.cc
sdaiSession_instance.cc
sdaiString.cc
)
sdaiApplication_instance_set.cc
sdaiBinary.cc
sdaiDaObject.cc
sdaiEntity_extent.cc
sdaiEntity_extent_set.cc
sdaiEnum.cc
sdaiModel_contents.cc
sdaiModel_contents_list.cc
sdaiObject.cc
sdaiSession_instance.cc
sdaiString.cc
)
SET(SC_CLDAI_HDRS
sdaiApplication_instance_set.h
sdaiBinary.h
sdaiDaObject.h
sdaiEntity_extent.h
sdaiEntity_extent_set.h
sdaiEnum.h
sdaiModel_contents.h
sdaiModel_contents_list.h
sdaiObject.h
sdaiSession_instance.h
sdaiString.h
)
sdaiApplication_instance_set.h
sdaiBinary.h
sdaiDaObject.h
sdaiEntity_extent.h
sdaiEntity_extent_set.h
sdaiEnum.h
sdaiModel_contents.h
sdaiModel_contents_list.h
sdaiObject.h
sdaiSession_instance.h
sdaiString.h
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
)
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
)
SC_ADDLIB(stepdai "${LIBSTEPDAI_SRCS}" "steputils;base")
install(FILES ${SC_CLDAI_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cldai)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cldai)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+31 -23
View File
@@ -1,33 +1,41 @@
set(LIBSTEPEDITOR_SRCS
STEPfile.cc
STEPfile.inline.cc
cmdmgr.cc
SdaiHeaderSchema.cc
SdaiHeaderSchemaAll.cc
SdaiHeaderSchemaInit.cc
SdaiSchemaInit.cc
)
STEPfile.cc
STEPfile.inline.cc
cmdmgr.cc
SdaiHeaderSchema.cc
SdaiHeaderSchemaAll.cc
SdaiHeaderSchemaInit.cc
SdaiSchemaInit.cc
)
SET(SC_CLEDITOR_HDRS
STEPfile.h
cmdmgr.h
editordefines.h
SdaiHeaderSchema.h
SdaiHeaderSchemaClasses.h
SdaiSchemaInit.h
seeinfodefault.h
)
STEPfile.h
cmdmgr.h
editordefines.h
SdaiHeaderSchema.h
SdaiHeaderSchemaClasses.h
SdaiSchemaInit.h
seeinfodefault.h
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
)
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
)
SC_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" "stepcore;stepdai;steputils;base")
install(FILES ${SC_CLEDITOR_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cleditor)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cleditor)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+40 -29
View File
@@ -1,41 +1,52 @@
set( clLazyFile_SRCS
lazyDataSectionReader.cc
lazyFileReader.cc
lazyInstMgr.cc
p21HeaderSectionReader.cc
sectionReader.cc
lazyP21DataSectionReader.cc
../base/judy/src/judy.c
../base/judy/src/judyLArray.h
../base/judy/src/judySArray.h
)
lazyDataSectionReader.cc
lazyFileReader.cc
lazyInstMgr.cc
p21HeaderSectionReader.cc
sectionReader.cc
lazyP21DataSectionReader.cc
../base/judy/src/judy.c
../base/judy/src/judyLArray.h
../base/judy/src/judySArray.h
)
set( SC_CLLAZYFILE_HDRS
headerSectionReader.h
lazyFileReader.h
lazyP21DataSectionReader.h
p21HeaderSectionReader.h
lazyDataSectionReader.h
lazyInstMgr.h
lazyTypes.h
sectionReader.h
instMgrHelper.h
)
headerSectionReader.h
lazyFileReader.h
lazyP21DataSectionReader.h
p21HeaderSectionReader.h
lazyDataSectionReader.h
lazyInstMgr.h
lazyTypes.h
sectionReader.h
instMgrHelper.h
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/base/judy/src
)
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/base/judy/src
)
SC_ADDLIB(steplazyfile "${clLazyFile_SRCS};${clLazyFile_HDRS}" "stepcore;stepdai;steputils;base")
SC_ADDEXEC(lazy_test "lazy_test.cc" "steplazyfile;stepeditor" )
set_target_properties(lazy_test PROPERTIES COMPILE_FLAGS "-DNO_REGISTRY" )
if(TARGET lazy_test-static)
set_target_properties(lazy_test-static PROPERTIES COMPILE_FLAGS "-DNO_REGISTRY" )
endif(TARGET lazy_test-static)
install(FILES ${SC_CLLAZYFILE_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cllazyfile)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cllazyfile)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+1 -1
View File
@@ -27,7 +27,7 @@ class SC_LAZYFILE_EXPORT headerSectionReader: public sectionReader {
return _headerInstances;
}
~headerSectionReader() {
virtual ~headerSectionReader() {
//FIXME delete each instance?! maybe add to clear, since it iterates over everything already
//enum clearHow { rawData, deletePointers }
_headerInstances->clear();
+6 -5
View File
@@ -14,7 +14,7 @@
* This class is used when creating SDAI_Application_instance's and using a lazyInstMgr. It is returned
* by instMgrAdapter. SDAI_Application_instance only uses the GetSTEPentity function.
*/
class mgrNodeHelper: protected MgrNode {
class mgrNodeHelper: public MgrNodeBase {
protected:
lazyInstMgr * _lim;
instanceID _id;
@@ -22,13 +22,13 @@ class mgrNodeHelper: protected MgrNode {
mgrNodeHelper( lazyInstMgr * lim ) {
_lim = lim;
_id = 0;
prev = next = 0;
}
inline void setInstance( instanceID id ) {
_id = id;
}
inline SDAI_Application_instance * GetSTEPentity() {
// unsigned int c = _lim->countDataSections();
return _lim->loadInstance( _id );
return _lim->loadInstance( _id, true );
}
};
@@ -40,13 +40,14 @@ class mgrNodeHelper: protected MgrNode {
* when an instance is looked up, this uses lazyInstMgr to load it, and then returns a pointer to it.
*/
class instMgrAdapter: public InstMgr {
class instMgrAdapter: public InstMgrBase {
protected:
mgrNodeHelper _mn;
public:
instMgrAdapter( lazyInstMgr * lim ): InstMgr( 0 ), _mn( lim ) {}
instMgrAdapter( lazyInstMgr * lim ): InstMgrBase(), _mn( lim ) {}
inline mgrNodeHelper * FindFileId( int fileId ) {
//TODO check if fileId exists. if not, return null
_mn.setInstance( fileId );
return &_mn;
}
+65 -9
View File
@@ -1,8 +1,10 @@
#include "lazyTypes.h"
#include "lazyInstMgr.h"
#include "Registry.h"
#include <SubSuperIterators.h>
#include "SdaiSchemaInit.h"
#include "instMgrHelper.h"
#include "lazyRefs.h"
lazyInstMgr::lazyInstMgr() {
_headerRegistry = new Registry( HeaderSchemaInit );
@@ -10,6 +12,7 @@ lazyInstMgr::lazyInstMgr() {
_lazyInstanceCount = 0;
_loadedInstanceCount = 0;
_longestTypeNameLen = 0;
_mainRegistry = 0;
_errors = new ErrorDescriptor();
_ima = new instMgrAdapter( this );
}
@@ -38,7 +41,7 @@ sectionID lazyInstMgr::registerDataSection( lazyDataSectionReader * sreader ) {
void lazyInstMgr::addLazyInstance( namedLazyInstance inst ) {
_lazyInstanceCount++;
assert( inst.loc.begin > 0 && inst.loc.instance > 0 && inst.loc.section >= 0 );
assert( inst.loc.begin > 0 && inst.loc.instance > 0 );
int len = strlen( inst.name );
if( len > _longestTypeNameLen ) {
_longestTypeNameLen = len;
@@ -46,8 +49,12 @@ void lazyInstMgr::addLazyInstance( namedLazyInstance inst ) {
}
_instanceTypes->insert( inst.name, inst.loc.instance );
/* store 16 bits of section id and 48 of instance offset into one 64-bit int
* TODO: check and warn if anything is lost (in calling code?)
* does 32bit need anything special?
** TODO: check and warn if anything is lost (in calling code?)
** does 32bit need anything special?
**
** create conversion class?
** could then initialize conversion object with number of bits
** also a good place to check for data loss
*/
positionAndSection ps = inst.loc.section;
ps <<= 48;
@@ -85,18 +92,29 @@ unsigned long lazyInstMgr::getNumTypes() const {
}
void lazyInstMgr::openFile( std::string fname ) {
_files.push_back( new lazyFileReader( fname, this, _files.size() ) );
//don't want to hold a lock for the entire time we're reading the file.
//create a place in the vector and remember its location, then free lock
///FIXME begin atomic op
size_t i = _files.size();
_files.push_back( (lazyFileReader * ) 0 );
///FIXME end atomic op
lazyFileReader * lfr = new lazyFileReader( fname, this, i );
_files[i] = lfr;
/// TODO resolve inverse attr references
//between instances, or eDesc --> inst????
}
SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id ) {
SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id, bool reSeek ) {
assert( _mainRegistry && "Main registry has not been initialized. Do so with initRegistry() or setRegistry()." );
SDAI_Application_instance * inst = 0;
std::streampos oldPos;
positionAndSection ps;
sectionID sid;
inst = _instancesLoaded.find( id );
SDAI_Application_instance * inst = _instancesLoaded.find( id );
if( inst ) {
return inst;
}
instanceStreamPos_t::cvector * cv;
if( !inst && 0 != ( cv = _instanceStreamPos.find( id ) ) ) {
//FIXME _instanceStreamPos.find( id ) can return nonzero for nonexistent key?!
if( 0 != ( cv = _instanceStreamPos.find( id ) ) ) {
switch( cv->size() ) {
case 0:
std::cerr << "Instance #" << id << " not found in any section." << std::endl;
@@ -107,7 +125,13 @@ SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id ) {
off = ps & 0xFFFFFFFFFFFFULL;
sid = ps >> 48;
assert( _dataSections.size() > sid );
if( reSeek ) {
oldPos = _dataSections[sid]->tellg();
}
inst = _dataSections[sid]->getRealInstance( _mainRegistry, off, id );
if( reSeek ) {
_dataSections[sid]->seekg( oldPos );
}
break;
default:
std::cerr << "Instance #" << id << " exists in multiple sections. This is not yet supported." << std::endl;
@@ -116,6 +140,8 @@ SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id ) {
if( ( inst ) && ( inst != & NilSTEPentity ) ) {
_instancesLoaded.insert( id, inst );
_loadedInstanceCount++;
lazyRefs lr( this, inst );
lazyRefs::referentInstances_t insts = lr.result();
} else {
std::cerr << "Error loading instance #" << id << "." << std::endl;
}
@@ -125,3 +151,33 @@ SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id ) {
return inst;
}
instanceSet * lazyInstMgr::instanceDependencies( instanceID id ) {
instanceSet * checkedDependencies = new instanceSet();
instanceRefs dependencies; //Acts as queue for checking duplicated dependency
instanceRefs_t * _fwdRefs = getFwdRefs();
instanceRefs_t::cvector * _fwdRefsVec = _fwdRefs->find( id );
//Initially populating direct dependencies of id into the queue
if( _fwdRefsVec != 0 ) {
dependencies.insert( dependencies.end(), _fwdRefsVec->begin(), _fwdRefsVec->end() );
}
size_t curPos = 0;
while( curPos < dependencies.size() ) {
bool isNewElement = ( checkedDependencies->insert( dependencies.at( curPos ) ) ).second;
if( isNewElement ) {
_fwdRefsVec = _fwdRefs->find( dependencies.at( curPos ) );
if( _fwdRefsVec != 0 ) {
dependencies.insert( dependencies.end(), _fwdRefsVec->begin(), _fwdRefsVec->end() );
}
}
curPos++;
}
return checkedDependencies;
}
+60 -17
View File
@@ -22,11 +22,11 @@ class instMgrAdapter;
class lazyInstMgr {
protected:
/** map from instance number to instances that it refers to
/** multimap from instance number to instances that it refers to
* \sa instanceRefs_pair
*/
instanceRefs_t _fwdInstanceRefs;
/** map from instance number to instances that refer to it
/** multimap from instance number to instances that refer to it - the majority of these will not be inverse references!
* \sa instanceRefs_pair
*/
instanceRefs_t _revInstanceRefs;
@@ -39,11 +39,15 @@ class lazyInstMgr {
/** map from instance number to instance pointer (loaded instances only)
* \sa instancesLoaded_pair
*
* TODO should be multimap to allow use of instances in multiple data sections?
* a unique instance ID (containing sectionID and instanceID) would also work
*/
instancesLoaded_t _instancesLoaded;
/** map from instance number to beginning and end positions and the data section
* \sa instanceStreamPos_pair
*
* FIXME to save memory, modify judyL2Array to not use a vector until there are several
* instances with the same instanceID. This will help elsewhere as well.
*/
@@ -65,7 +69,6 @@ class lazyInstMgr {
public:
lazyInstMgr();
~lazyInstMgr();
void addSchema( void ( *initFn )() ); //?
void openFile( std::string fname );
void addLazyInstance( namedLazyInstance inst );
@@ -80,8 +83,14 @@ class lazyInstMgr {
instanceRefs_t * getRevRefs() {
return & _revInstanceRefs;
}
/// returns two iterators delimiting the instances that match `type`
instanceTypes_t::cvector * getInstances( std::string type ) { /*const*/
/// returns a vector containing the instances that match `type`
instanceTypes_t::cvector * getInstances( std::string type, bool caseSensitive = false ) { /*const*/
if( !caseSensitive ) {
std::string::iterator it = type.begin();
for( ; it != type.end(); ++it ) {
*it = toupper( *it );
}
}
return _instanceTypes->find( type.c_str() );
}
/// get the number of instances of a certain type
@@ -140,28 +149,62 @@ class lazyInstMgr {
unsigned long getNumTypes() const;
sectionID registerDataSection( lazyDataSectionReader * sreader );
fileID registerLazyFile( lazyFileReader * freader );
ErrorDescriptor * getErrorDesc() {
return _errors;
}
SDAI_Application_instance * loadInstance( instanceID id );
/** returns a pointer to an instance, loading it if necessary.
* \param id the instance number to look for
* \param reSeek if true, reset file position to current position when done. only necessary when loading an instance with dependencies; excessive use will cause a performance hit
*/
SDAI_Application_instance * loadInstance( instanceID id, bool reSeek = false );
//list all instances that one instance depends on (recursive)
instanceSet * instanceDependencies( instanceID id );
bool isLoaded( instanceID id ) {
_instancesLoaded.find( id );
return _instancesLoaded.success();
}
const char * typeFromFile( instanceID id ) {
instanceStreamPos_t::cvector * cv;
cv = _instanceStreamPos.find( id );
if( cv ) {
if( cv->size() != 1 ) {
std::cerr << "Error at " << __FILE__ << ":" << __LINE__ << " - multiple instances (" << cv->size() << ") with one instanceID (" << id << ") not supported yet." << std::endl;
return 0;
}
positionAndSection ps = cv->at( 0 );
//extract p, s, call
long int off = ps & 0xFFFFFFFFFFFFULL;
sectionID sid = ps >> 48;
return _dataSections[sid]->getType( off );
}
std::cerr << "Error at " << __FILE__ << ":" << __LINE__ << " - instanceID " << id << " not found." << std::endl;
return 0;
}
// TODO implement these
//list all instances that one instance depends on (recursive)
//std::vector<instanceID> instanceDependencies( instanceID id ); //set is faster?
/* * the opposite of instanceDependencies() - all instances that are *not* dependencies of one particular instance
// add another schema to registry
//void addSchema( void ( *initFn )() );
//list all instances that one instance depends on (recursive)
//std::vector<instanceID> instanceDependencies( instanceID id ); //set is faster?
/* * the opposite of instanceDependencies() - all instances that are *not* dependencies of one particular instance
same as above, but with list of instances */
//std::vector<instanceID> notDependencies(...)
//std::vector<instanceID> notDependencies(...)
//renumber instances so that they are numbered 1..N where N is the total number of instances
//void normalizeInstanceIds();
//find data that is repeated and eliminate, if possible
//void eliminateDuplicates();
//tell instMgr to use instances from this section
//void useDataSection( sectionID id );
//renumber instances so that they are numbered 1..N where N is the total number of instances
//void normalizeInstanceIds();
//find data that is repeated and eliminate, if possible
//void eliminateDuplicates();
//tell instMgr to use instances from this section
//void useDataSection( sectionID id );
// TODO support references from one file to another
};
+10 -1
View File
@@ -11,6 +11,15 @@ lazyP21DataSectionReader::lazyP21DataSectionReader( lazyFileReader * parent, std
while( nl = nextInstance(), ( ( nl.loc.begin > 0 ) && ( nl.name != 0 ) ) ) {
parent->getInstMgr()->addLazyInstance( nl );
}
if( sectionReader::_error->severity() <= SEVERITY_WARNING ) {
sectionReader::_error->PrintContents( std::cerr );
if( sectionReader::_error->severity() <= SEVERITY_INPUT_ERROR ) {
_error = true;
return;
}
}
if( !_file.good() ) {
_error = true;
return;
@@ -34,6 +43,7 @@ lazyP21DataSectionReader::lazyP21DataSectionReader( lazyFileReader * parent, std
}
// part of readdata1
//if this changes, probably need to change sectionReader::getType()
const namedLazyInstance lazyP21DataSectionReader::nextInstance() {
std::streampos end = -1;
namedLazyInstance i;
@@ -44,7 +54,6 @@ const namedLazyInstance lazyP21DataSectionReader::nextInstance() {
if( ( _file.good() ) && ( i.loc.instance > 0 ) ) {
skipWS();
i.loc.section = _sectionID;
skipWS();
i.name = getDelimitedKeyword( ";( /\\" );
if( _file.good() ) {
end = seekInstanceEnd( & i.refs );
+290
View File
@@ -0,0 +1,290 @@
#ifndef LAZYREFS_H
#define LAZYREFS_H
#include <string>
#include <set>
#include <utility>
#include <vector>
#include "lazyTypes.h"
#include "lazyInstMgr.h"
#include "ExpDict.h"
#include "sdaiApplication_instance.h"
#include "SubSuperIterators.h"
#include <STEPattribute.h>
#include <STEPaggregate.h>
/*
* given inverted attr ia:
* attr method value
* ----------- -----
* ia->Name() isdefinedby
* ia->inverted_attr_id_() relatedobjects
* ia->inverted_entity_id_() reldefinesbytype
*
* 1. for the instance in question, find inverse attrs with recursion
* 2. look up references to the current instance (_r)
* a. for each item in _r, look up its type and add mapping (instanceID -> char* typestring) to _refMap
* 3. for each ia,
* a. entity name is returned by ia->inverted_entity_id_()
* b. add this entity and its children to a list ( edL )
* c. compare the type of each item in _refMap with types in edL; for types in both, remember the instance number ( _referentInstances )
* d. load each instance in _referentInstances
* e. check if the relevant inverted attr of instances loaded from _referentInstances reference the instance in step 1; if not, unload **IF** the instance hadn't been loaded
* --> if it was loaded, this implies that it is used elsewhere
* f. (optional / TODO ) for performance, cache list edL - it may be useful in the future
* -- best to store such that the most recently (frequently?) used lists are retained and others are discarded
*/
/* ****
* ALTERNATE for 2a, 3c:
* for each type t in edL, use lim->getInstances( t ) to get a list of instances of that type, Lt
* for each instance i in Lt, check if it is in _r
* if so, load it
* BENEFIT: no need to write lazyInstMgr::getTypeStr() (however, it might be necessary in the future regardless)
*/
//TODO screen out intances that appear to be possible inverse refs but aren't actually
// note - doing this well will require major changes, since each inst automatically loads every instance that it references
//TODO what about complex instances? scanning each on disk could be a bitch; should the compositional types be scanned during lazy loading?
//TODO/FIXME in generated code, store ia data in map and eliminate data members that are currently used. modify accessors to use map.
class lazyRefs {
public:
typedef std::set< instanceID > referentInstances_t;
protected:
typedef std::set< const Inverse_attribute * > iaList_t;
typedef judyLArray< instanceID, std::string * > refMap_t;
typedef std::set< const EntityDescriptor * > edList_t;
iaList_t _iaList;
lazyInstMgr * _lim;
instanceID _id;
refMap_t _refMap;
referentInstances_t _referentInstances;
SDAI_Application_instance * _inst;
void checkAnInvAttr( const Inverse_attribute * ia ) {
const EntityDescriptor * ed;
const Registry * reg = _lim->getMainRegistry();
ed = reg->FindEntity( ia->_inverted_entity_id );
subtypesIterator subtypeIter( ed );
edList_t edL;
edL.insert( ed );
// 3b - use subtypeIter to add to edL
for( ; !subtypeIter.empty(); ++subtypeIter ) {
edL.insert( *subtypeIter );
}
//3c - for each item in both _refMap and edL, add it to _referentInstances
potentialReferentInsts( edL );
//3d - load each inst
iAstruct ias = invAttr( _inst, ia );
referentInstances_t::iterator insts = _referentInstances.begin();
for( ; insts != _referentInstances.end(); ++insts ) {
loadInstIFFreferent( *insts, ias, ia );
}
//3f - cache edL - TODO
}
void loadInstIFFreferent( instanceID inst, iAstruct ias, const Inverse_attribute * ia ) {
bool prevLoaded = _lim->isLoaded( inst );
SDAI_Application_instance * rinst = _lim->loadInstance( inst );
bool ref = refersToCurrentInst( ia, rinst );
if( ref ) {
if( ia->inverted_attr_()->IsAggrType() ) {
if( !ias.a ) {
ias.a = new EntityAggregate;
_inst->setInvAttr( ia, ias );
assert( invAttr( _inst, ia ).a == ias.a );
}
EntityAggregate * ea = ias.a;
//TODO check if duplicate
ea->AddNode( new EntityNode( rinst ) );
} else {
SDAI_Application_instance * ai = ias.i;
if( !ai ) {
ias.i = rinst;
_inst->setInvAttr( ia, ias );
} else if( ai->GetFileId() != inst ) {
std::cerr << "ERROR: two instances (" << rinst << ", #" << rinst->GetFileId() << "=" << rinst->getEDesc()->Name();
std::cerr << " and " << ai << ", #" << ai->GetFileId() <<"=" << ai->getEDesc()->Name() << ") refer to inst ";
std::cerr << _inst->GetFileId() << ", but its inverse attribute is not an aggregation type!" << std::endl;
// TODO _error->GreaterSeverity( SEVERITY_INPUT_ERROR );
}
}
} else {
if( !prevLoaded ) {
//TODO _lim->unload( inst ); //this should keep the inst loaded for now, but put it in a list of ones that can be unloaded if not accessed
}
}
}
///3e - check if actually inverse ref
bool refersToCurrentInst( const Inverse_attribute * ia, SDAI_Application_instance * referrer ) {
//find the attr
int rindex = attrIndex( referrer, ia->_inverted_attr_id, ia->_inverted_entity_id );
STEPattribute sa = referrer->attributes[ rindex ];
assert( sa.getADesc()->BaseType() == ENTITY_TYPE );
bool found = false;
if( sa.getADesc()->IsAggrType() ) {
//aggregate - search for current inst id
EntityAggregate * aggr = dynamic_cast< EntityAggregate * >( sa.Aggregate());
assert( aggr );
EntityNode * en = ( EntityNode * ) aggr->GetHead();
while( en ) {
if( en->node == _inst ) {
found = true;
break;
}
en = ( EntityNode * ) en->NextNode();
}
} else {
//single instance
assert( sa.getADesc()->NonRefType() == ENTITY_TYPE );
if( sa.Entity() == _inst ) {
found = true;
}
}
if( !found ) {
std::cerr << "inst #" << _inst->FileId() << " not found in #" << referrer->FileId();
std::cerr << ", attr #" << rindex << " [contents: ";
referrer->STEPwrite( std::cerr );
std::cerr << "]" << std::endl;
}
return found;
}
int attrIndex( SDAI_Application_instance * inst, const char * name, const char * entity ) {
for( int i = 0; i < inst->attributes.list_length(); i++ ) {
// std::cout << "attr " << i << " name " << inst->attributes[i].Name() << ", entity " << inst->EntityName() << std::endl;
if( ( strcasecmp( name, inst->attributes[i].Name() ) == 0 ) &&
( strcasecmp( entity, inst->attributes[i].getADesc()->Owner().Name() ) == 0 ) ) {
return i;
}
}
return -1;
}
iAstruct invAttr( SDAI_Application_instance * inst, const Inverse_attribute * ia /*, iaList_t & iaList */ ) {
SDAI_Application_instance::iAMap_t map = inst->getInvAttrs();
SDAI_Application_instance::iAMap_t::iterator iai = map.begin();
while( iai != map.end() ) {
if( iai->first == ia ) {
return iai->second;
}
++iai;
}
std::cerr << "Error! inverse attr " << ia->Name() << " (" << ia << ") not found in iAMap for entity " << inst->getEDesc()->Name() << std::endl;
abort();
iAstruct nil;
return nil;
}
/** 3c. compare the type of each item in R with types in A
* for items that match, remember the instance number (list C)
*/
void potentialReferentInsts( edList_t & edL ) {
refMap_t::pair kv = _refMap.begin();
while( kv.value != 0 ) {
std::set< const EntityDescriptor * >::iterator edi = edL.begin();
for( ; edi != edL.end(); ++edi ) {
if( 0 == strcasecmp( kv.value->c_str(), ( *edi )->Name() ) ) {
_referentInstances.insert( kv.key );
break;
}
}
kv = _refMap.next();
}
}
///find any inverse attributes, put in `iaList`
/// attrs not necessarily in order!
void getInverseAttrs( const EntityDescriptor * ed, iaList_t & iaList ) {
iaList.clear();
supertypesIterator supersIter( ed );
const Inverse_attribute * iAttr;
for( ; !supersIter.empty(); ++supersIter ) {
//look at attrs of *si
InverseAItr iai( &( ( *supersIter )->InverseAttr() ) );
while( 0 != ( iAttr = iai.NextInverse_attribute() ) ) {
iaList.insert( iAttr );
}
}
// look at our own attrs
InverseAItr invAttrIter( &( ed->InverseAttr() ) );
while( 0 != ( iAttr = invAttrIter.NextInverse_attribute() ) ) {
iaList.insert( iAttr );
}
}
// 2. find reverse refs
//2a. convert to map where K=instanceID and V=char*
// rather than keeping each V in memory or trying to free non-unique ones, look up each type in the Registry and use that pointer
bool mapRefsToTypes() {
_refMap.clear( true ); // true -> use delete on pointers
instanceRefs_t::cvector * refs = _lim->getRevRefs()->find( _id );
if( !refs || refs->empty() ) {
return false;
}
instanceRefs_t::cvector::const_iterator it;
for( it = refs->begin(); it != refs->end(); ++it ) {
const char * type = _lim->typeFromFile( *it );
_refMap.insert( *it, new std::string( type ) );
}
return true;
}
public:
lazyRefs( lazyInstMgr * lmgr ): _lim( lmgr ), _id( 0 ) {
_iaList.clear();
}
lazyRefs( lazyInstMgr * lmgr, SDAI_Application_instance * ai ): _lim( lmgr ), _id( 0 ) {
_iaList.clear();
init( 0, ai );
}
lazyRefs( lazyInstMgr * lmgr, instanceID iid ): _lim( lmgr ) {
_iaList.clear();
init( iid, 0 );
}
~lazyRefs() {
// delete strings in refMap
_refMap.clear( true );
}
/// initialize with the given instance; will use ai if given, else loads instance iid
void init( instanceID iid, SDAI_Application_instance * ai = 0 ) {
if( iid == 0 && ai == 0 ) {
std::cerr << "Error at " << __FILE__ << ":" << __LINE__ << " - both args are null" << std::endl;
return;
}
if( !ai ) {
_inst = _lim->loadInstance( iid );
_id = iid;
} else {
_inst = ai;
_id = _inst->GetFileId();
}
_refMap.clear( true );
// 1. find inverse attrs with recursion
getInverseAttrs( ai->getEDesc(), _iaList );
//2. find reverse refs, map id to type (stop if there are no inverse attrs or no refs)
if( _iaList.size() == 0 || !mapRefsToTypes() ) {
return;
}
iaList_t::iterator iai = _iaList.begin();
for( ; iai != _iaList.end(); ++iai ) {
// 3. for each IA, ...
checkAnInvAttr( *iai );
}
}
referentInstances_t result() {
return _referentInstances;
}
};
#endif //LAZYREFS_H
+74
View File
@@ -0,0 +1,74 @@
for inverse attrs, we have the attr name and the type of the instance
--load instance, find inverse attr(s)
--for each inverse attr:
--find all instance types that inherit from the inverted attr's owner (list A)
--look up instances that reference the one in question (list B) - use memoization
--find instances that match both lists, put in list C
--load instances in list C
--for list C, check that the relevant attr references the original instance - if not, unload (?)
--
--when done with this inverse attr, cache list A
EXAMPLE
*******
information model
-----------------
ENTITY Object;
ObjectType : OPTIONAL STRING;
INVERSE
IsDefinedBy : SET [0:?] OF RelDefinesByType FOR RelatedObjects;
END_ENTITY;
ENTITY RelDefinesByType;
RelatedObjects : SET [1:?] OF Object;
END_ENTITY;
ENTITY Window
SUBTYPE OF (Object);
Description : OPTIONAL string;
END_ENTITY;
data file
---------
#1=OBJECT('one');
#2=RELDEFINESBYTYPE((#1));
#3=RELDEFINESBYTYPE((#4));
#4=WINDOW('two','blah');
#1 and #4 have an inverse attr, but this is not visible in the data file
#2 and #3 have #1 and #4, respectively, in an aggregate (thus the parenthesis around the instance); in this case, a SET called RelatedObjects
RelatedObjects is the inverted attr that the inverse attr IsDefinedBy links to
looking at the entity descriptor for WINDOW, it is not apparent that there is an inverse attr; its parents must be examined
given inverted attr ia:
attr method value
----------- -----
ia->Name() isdefinedby
ia->inverted_attr_id_() relatedobjects
ia->inverted_entity_id_() reldefinesbytype
1. for the instance in question, find inverse attrs with recursion
2. for each ia,
a. entity name is returned by ia->inverted_entity_id_()
b. add this entity and its children to a list (list A)
c. look up references to the current instance (list B)
d. for each item in B, look up its type; if its type is present in A, remember the instance number (list C)
e. load each instance in C
f. (optional) check if the relevant inverted attr of instances loaded from list C reference the instance in step 1; if not, unload **IF** the instance hadn't been loaded
--> if it was loaded, this implies that it is used elsewhere
g. cache list A, since it may be useful in the future
-- best to store such that the most recently (frequently?) used lists are retained and others are discarded
NEED TO DO
----------
make it possible to access inverse attrs without knowing their names
probably best to do this much like explicit attrs - creating an array. each element should have a pointer to the inverted attr desc, a pointer to the setter, and a pointer to the getter
+4 -1
View File
@@ -3,6 +3,7 @@
#include <iostream>
#include <vector>
#include <set>
#include <stdint.h>
#include "judyLArray.h"
@@ -35,6 +36,8 @@ typedef uint64_t positionAndSection;
typedef std::vector< instanceID > instanceRefs;
typedef std::set< instanceID > instanceSet;
//TODO: create a "unique instance id" from the sectionID and instanceID, and use it everywhere?
/** This struct contains all the information necessary to locate an instance. It is primarily
@@ -42,7 +45,7 @@ typedef std::vector< instanceID > instanceRefs;
* situations, so the information should be kept up-to-date.
*/
typedef struct {
long begin;
long begin; ///< this is the result of tellg() before reading the instanceID; there may be whitespace or comments, but nothing else.
instanceID instance;
sectionID section;
/* bool modified; */ /* this will be useful when writing instances - if an instance is
+55 -14
View File
@@ -71,21 +71,60 @@ instanceID printRefs( lazyInstMgr & mgr ) {
return id;
}
/// prints dependencies of an instance
void printDeps( lazyInstMgr & mgr ) {
const int displayInstances = 10;
instanceRefs_t * refs = mgr.getFwdRefs();
instanceRefs_t::cpair p = refs->end();
instanceID id = p.key;
instanceSet * dependencies = mgr.instanceDependencies( id );
std::cout << std::endl <<"Dependencies" << std::endl << "==============" << std::endl;
instanceSet::const_iterator it( dependencies->begin() ), end( dependencies->end() );
std::cout << "Example: Instance #" << id << " is recursively dependent on " << dependencies->size() << " instances: ";
int i;
for(i = 0; it != end && i < displayInstances; it++, i++ ) {
std::cout << *it << " ";
}
if( dependencies->size() > displayInstances ) {
std::cout << ".... (Displaying only " << displayInstances << " instances) ";
}
std::cout << std::endl;
std::cout << std::endl;
delete dependencies;
}
///prints info about a complex instance
void dumpComplexInst( STEPcomplex * c, unsigned int depth ) {
void dumpComplexInst( STEPcomplex * c ) {
int depth = 0;
if( c ) {
std::cout << "attr list size: " << c->_attr_data_list.size() << ", depth " << depth << std::endl;
STEPcomplex_attr_data_list::iterator it;
for( it = c->_attr_data_list.begin(); it != c->_attr_data_list.end(); it++ ) {
std::cout << "*** Not printing complex instance attribute info - many eDesc pointers are invalid. ***" << std::endl; //FIXME!
// std::cout << "attr list size: " << c->_attr_data_list.size() << ", depth " << depth << std::endl;
// STEPcomplex_attr_data_list::iterator it;
// for( it = c->_attr_data_list.begin(); it != c->_attr_data_list.end(); it++ ) {
// std::cout << "*** Not printing complex instance attribute info - many eDesc pointers are invalid. ***" << std::endl; //FIXME!
// SDAI_Application_instance * attr = ( SDAI_Application_instance * ) *it;
// if( attr->IsComplex() ) {
// dumpComplexInst( dynamic_cast<STEPcomplex *>( attr ), depth + 1 );
// } else if( attr->eDesc > ( void * ) 0xFF ) { //arbitrary number - invalid ones are usually 0x51
// std::cout << "attr " << attr->eDesc->Name() << std::endl;
// } else {
// std::cout << "attr has eDesc with pointer " << attr->eDesc << std::endl;
// }
STEPcomplex * complex = c->head;
while( complex ) {
if( complex->IsComplex() ) {
std::cout << "Complex component " << complex->getEDesc()->Name() << " at depth " << depth << " with attr list size ";
std::cout << complex->_attr_data_list.size() << std::endl;
// dumpComplexInst( complex, depth + 1 );
} else {
//probably won't ever get here...
SDAI_Application_instance * ai = dynamic_cast< SDAI_Application_instance * >( complex );
if( ai ) {
std::cout << "non-complex component at depth " << depth << ", " << ai->getEDesc()->Name() << std::endl;
} else {
std::cout << "unknown component at depth " << depth << ": " << complex << std::endl;
}
}
complex = complex->sc;
depth++;
}
}
}
@@ -115,6 +154,7 @@ int main( int argc, char ** argv ) {
std::cout << ( float )( scanStats.physMemKB * 1000 ) / instances << " bytes per instance)" << std::endl << std::endl;
fileInfo( *mgr, 0 );
//these are just common types
countTypeInstances( *mgr, "CARTESIAN_POINT" );
countTypeInstances( *mgr, "POSITIVE_LENGTH_MEASURE" );
countTypeInstances( *mgr, "VERTEX_POINT" );
@@ -127,6 +167,7 @@ int main( int argc, char ** argv ) {
// std::cout << "Total types: " << mgr->getNumTypes() << std::endl;
instWithRef = printRefs( *mgr );
printDeps( *mgr );
#ifndef NO_REGISTRY
if( instWithRef ) {
@@ -139,9 +180,9 @@ int main( int argc, char ** argv ) {
instanceTypes_t::cvector * complexInsts = mgr->getInstances( "" );
if( complexInsts && complexInsts->size() > 0 ) {
std::cout << "loading lazy instance #" << complexInsts->at( 0 ) << "." << std::endl;
std::cout << "loading complex instance #" << complexInsts->at( 0 ) << "." << std::endl;
STEPcomplex * c = dynamic_cast<STEPcomplex *>( mgr->loadInstance( complexInsts->at( 0 ) ) );
dumpComplexInst( c, 0 );
dumpComplexInst( c );
std::cout << "Number of instances loaded now: " << mgr->loadedInstanceCount() << std::endl;
}
#else
+52 -13
View File
@@ -7,6 +7,7 @@
#include <assert.h>
#include "Registry.h"
#include "sc_strtoull.h"
#include "sdaiApplication_instance.h"
#include "read_func.h"
#include "SdaiSchemaInit.h"
@@ -23,6 +24,7 @@
sectionReader::sectionReader( lazyFileReader * parent, std::ifstream & file, std::streampos start, sectionID sid ):
_lazyFile( parent ), _file( file ), _sectionStart( start ), _sectionID( sid ) {
_fileID = _lazyFile->ID();
_error = new ErrorDescriptor();
}
@@ -80,6 +82,7 @@ std::streampos sectionReader::findNormalString( const std::string & str, bool se
//NOTE different behavior than const char * GetKeyword( istream & in, const char * delims, ErrorDescriptor & err ) in read_func.cc
// returns pointer to the contents of a static std::string
const char * sectionReader::getDelimitedKeyword( const char * delimiters ) {
static std::string str;
char c;
@@ -174,9 +177,8 @@ void sectionReader::locateAllInstances() {
}
instanceID sectionReader::readInstanceNumber() {
std::streampos start, end;
char c;
int digits = 0;
size_t digits = 0;
instanceID id = 0;
//find instance number ("# nnnn ="), where ' ' is any whitespace found by isspace()
@@ -193,35 +195,67 @@ instanceID sectionReader::readInstanceNumber() {
return 0;
}
skipWS();
start = _file.tellg();
// The largest instance ID yet supported is the maximum value of unsigned long long int
assert( std::numeric_limits<instanceID>::max() <= std::numeric_limits<unsigned long long int>::max() );
size_t instanceIDLength = std::numeric_limits<instanceID>::digits10 + 1;
char * buffer = new char( instanceIDLength + 1 ); // +1 for the terminating character
std::stringstream errorMsg;
do {
c = _file.get();
if( isdigit( c ) ) {
buffer[ digits ] = c; //copy the charcter into the buffer
digits++;
} else {
_file.unget();
break;
}
if( digits > instanceIDLength ) {
errorMsg << "A very large instance ID of string length greater then " << instanceIDLength << " found. Skipping data section " << _sectionID << ".";
_error->GreaterSeverity( SEVERITY_INPUT_ERROR );
_error->UserMsg( "A very large instance ID encountered" );
_error->DetailMsg( errorMsg.str() );
delete buffer;
return 0;
}
} while( _file.good() );
buffer[ digits ] = '\0'; //Append the terminating character
skipWS();
if( _file.good() && ( digits > 0 ) && ( _file.get() == '=' ) ) {
end = _file.tellg();
_file.seekg( start );
_file >> id;
_file.seekg( end );
id = strtoull( buffer, NULL, 10);
if( id == std::numeric_limits<instanceID>::max() ) {
//Handling those cases where although the number of digits is equal, but the id value is greater then equal to the maximum allowed value.
errorMsg << "A very large instance ID caused an overflow. Skipping data section " << _sectionID << ".";
_error->GreaterSeverity( SEVERITY_INPUT_ERROR );
_error->UserMsg( "A very large instance ID encountered" );
_error->DetailMsg( errorMsg.str() );
}
assert( id > 0 );
}
delete buffer;
return id;
}
//TODO: most of the rest of readdata1, all of readdata2
/** load an instance and return a pointer to it.
* side effect: recursively loads any instances the specified instance depends upon
*/
SDAI_Application_instance * sectionReader::getRealInstance( const Registry * reg, long int begin, instanceID instance,
const std::string & typeName, const std::string & schName, bool header ) {
char c;
const char * tName = 0, * sName = 0; //these are necessary since typeName and schName are const
std::string comment;
Severity sev;
Severity sev = SEVERITY_NULL;
SDAI_Application_instance * inst = 0;
tName = typeName.c_str();
@@ -274,12 +308,13 @@ SDAI_Application_instance * sectionReader::getRealInstance( const Registry * reg
if( !comment.empty() ) {
inst->AddP21Comment( comment );
}
assert( inst->eDesc );
assert( inst->getEDesc() );
_file.seekg( begin );
findNormalString( "(" );
_file.unget();
//TODO do something with 'sev'
sev = inst->STEPread( instance, 0, _lazyFile->getInstMgr()->getAdapter(), _file, sName, true, false );
//TODO do something with 'sev'
inst->InitIAttrs();
}
return inst;
}
@@ -289,8 +324,9 @@ STEPcomplex * sectionReader::CreateSubSuperInstance( const Registry * reg, insta
ErrorDescriptor err;
std::vector<std::string *> typeNames;
_file.get(); //move past the first '('
skipWS();
while( _file.good() && ( _file.peek() != ')' ) ) {
typeNames.push_back( new std::string( getDelimitedKeyword( ";( /\\" ) ) );
typeNames.push_back( new std::string( getDelimitedKeyword( ";( /\\\n" ) ) );
if( typeNames.back()->empty() ) {
delete typeNames.back();
typeNames.pop_back();
@@ -312,6 +348,9 @@ STEPcomplex * sectionReader::CreateSubSuperInstance( const Registry * reg, insta
names[ i ] = typeNames[i]->c_str();
}
//TODO still need the schema name
return new STEPcomplex( ( const_cast<Registry *>( reg ) ), ( const char ** ) names, ( int ) fileid /*, schnm*/ );
STEPcomplex * sc = new STEPcomplex( ( const_cast<Registry *>( reg ) ), names, ( int ) fileid /*, schnm*/ );
delete[] names;
//TODO also delete contents of typeNames!
return sc;
}
+20
View File
@@ -81,7 +81,27 @@ class SC_LAZYFILE_EXPORT sectionReader {
virtual const namedLazyInstance nextInstance() = 0;
/** returns the type string for an instance, read straight from the file
* if this function changes, probably need to change nextInstance() as well
* don't check errors - they would have been encountered during the initial file scan, and the file is still open so it can't have been modified */
const char * getType( long int offset ) {
if( offset <= 0 ) {
return 0;
}
_file.seekg( offset );
readInstanceNumber();
skipWS();
return getDelimitedKeyword( ";( /\\" );
}
instanceID readInstanceNumber();
void seekg( std::streampos pos ) {
_file.seekg( pos );
}
std::streampos tellg() {
return _file.tellg();
}
};
#endif //SECTIONREADER_H
+78 -68
View File
@@ -1,78 +1,88 @@
set(LIBSTEPCORE_SRCS
sdaiApplication_instance.cc
STEPcomplex.cc
STEPattribute.cc
STEPattribute.inline.cc
sdai.cc
sdaiSelect.cc
STEPaggregate.cc
STEPundefined.cc
STEPattributeList.cc
SingleLinkList.cc
SingleLinkList.inline.cc
Registry.inline.cc
ExpDict.cc
ExpDict.inline.cc
read_func.cc
collect.cc
complexlist.cc
entlist.cc
multlist.cc
orlist.cc
entnode.cc
non-ors.cc
match-ors.cc
trynext.cc
print.cc
instmgr.cc
mgrnode.cc
mgrnodearray.cc
mgrnodelist.cc
dispnode.cc
dispnodelist.cc
needFunc.cc
)
sdaiApplication_instance.cc
STEPcomplex.cc
STEPaggregate.cc
STEPattribute.cc
STEPattribute.inline.cc
STEPattributeList.cc
STEPinvAttrList.cc
STEPundefined.cc
sdai.cc
sdaiSelect.cc
SingleLinkList.cc
SingleLinkList.inline.cc
Registry.inline.cc
ExpDict.cc
ExpDict.inline.cc
read_func.cc
collect.cc
complexlist.cc
entlist.cc
multlist.cc
orlist.cc
entnode.cc
non-ors.cc
match-ors.cc
trynext.cc
print.cc
instmgr.cc
mgrnode.cc
mgrnodearray.cc
mgrnodelist.cc
dispnode.cc
dispnodelist.cc
needFunc.cc
)
SET(SC_CLSTEPCORE_HDRS
baseType.h
complexSupport.h
dictdefs.h
ExpDict.h
read_func.h
Registry.h
sdaiApplication_instance.h
sdai.h
sdaiSelect.h
SingleLinkList.h
STEPaggregate.h
STEPattribute.h
STEPattributeList.h
STEPcomplex.h
STEPundefined.h
instmgr.h
mgrnode.h
mgrnodearray.h
mgrnodelist.h
dispnode.h
dispnodelist.h
needFunc.h
SubSuperIterators.h
)
set(SC_CLSTEPCORE_HDRS
baseType.h
complexSupport.h
dictdefs.h
ExpDict.h
read_func.h
Registry.h
sdaiApplication_instance.h
sdai.h
sdaiSelect.h
SingleLinkList.h
STEPaggregate.h
STEPattribute.h
STEPattributeList.h
STEPinvAttrList.h
STEPcomplex.h
STEPundefined.h
instmgr.h
mgrnode.h
mgrnodearray.h
mgrnodelist.h
dispnode.h
dispnodelist.h
needFunc.h
SubSuperIterators.h
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/clutils
)
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/clutils
)
SC_ADDLIB(stepcore "${LIBSTEPCORE_SRCS}" "steputils;stepdai;base")
install(FILES ${SC_CLSTEPCORE_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/clstepcore)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/clstepcore)
if(SC_ENABLE_TESTING)
add_subdirectory(test)
endif(SC_ENABLE_TESTING)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
IF(SC_ENABLE_TESTING)
ADD_SUBDIRECTORY( test )
ENDIF(SC_ENABLE_TESTING)
+48 -6
View File
@@ -18,8 +18,9 @@
#include <ExpDict.h>
#include <STEPaggregate.h>
#include <Registry.h>
#include "sc_memmgr.h"
#include <SubSuperIterators.h>
Explicit_item_id__set::Explicit_item_id__set( int defaultSize ) {
_bufsize = defaultSize;
@@ -536,9 +537,9 @@ IntAggregate * create_IntAggregate() {
return new IntAggregate;
}
const EntityDescriptor * EntityDescItr::NextEntityDesc() {
EntityDescriptor * EntityDescItr::NextEntityDesc_nc() {
if( cur ) {
const EntityDescriptor * ed = cur->EntityDesc();
EntityDescriptor * ed = cur->EntityDesc();
cur = ( EntityDescLinkNode * )( cur->NextNode() );
return ed;
}
@@ -554,9 +555,9 @@ const AttrDescriptor * AttrDescItr::NextAttrDesc() {
return 0;
}
const Inverse_attribute * InverseAItr::NextInverse_attribute() {
Inverse_attribute * InverseAItr::NextInverse_attribute() {
if( cur ) {
const Inverse_attribute * ia = cur->Inverse_attr();
Inverse_attribute * ia = cur->Inverse_attr();
cur = ( Inverse_attributeLinkNode * )( cur->NextNode() );
return ia;
}
@@ -811,6 +812,47 @@ EntityDescriptor::~EntityDescriptor() {
delete _uniqueness_rules;
}
// initialize one inverse attr; used in InitIAttrs, below
void initIAttr( Inverse_attribute * ia, Registry & reg, const char * schNm, const char * name ) {
const AttrDescriptor * ad;
const char * aid = ia->inverted_attr_id_();
const char * eid = ia->inverted_entity_id_();
const EntityDescriptor * e = reg.FindEntity( eid, schNm );
AttrDescItr adl( e->ExplicitAttr() );
while( 0 != ( ad = adl.NextAttrDesc() ) ) {
if( !strcmp( aid, ad->Name() ) ) {
ia->inverted_attr_( ad );
return;
}
}
supertypesIterator sit(e);
for( ; !sit.empty(); ++sit ) {
AttrDescItr adi( sit.current()->ExplicitAttr() );
while( 0 != ( ad = adi.NextAttrDesc() ) ) {
if( !strcmp( aid, ad->Name() ) ) {
ia->inverted_attr_( ad );
return;
}
}
}
std::cerr << "Inverse attr " << ia->Name() << " for " << name << ": cannot find AttrDescriptor " << aid << " for entity " << eid << "." << std::endl;
//FIXME should we abort? or is there a sensible recovery path?
abort();
}
/** initialize inverse attrs
* call once per eDesc (once per EXPRESS entity type)
* must be called _after_ init_Sdai* functions for any ia->inverted_entity_id_'s
*
*/
void EntityDescriptor::InitIAttrs( Registry & reg, const char * schNm ) {
InverseAItr iai( &( InverseAttr() ) );
Inverse_attribute * ia;
while( 0 != ( ia = iai.NextInverse_attribute() ) ) {
initIAttr( ia, reg, schNm, _name );
}
}
const char * EntityDescriptor::GenerateExpress( std::string & buf ) const {
std::string sstr;
int count;
@@ -878,7 +920,7 @@ const char * EntityDescriptor::GenerateExpress( std::string & buf ) const {
}
/////////
InverseAItr iai( _inverseAttr );
InverseAItr iai( &_inverseAttr );
iai.ResetItr();
const Inverse_attribute * ia = iai.NextInverse_attribute();
+98 -45
View File
@@ -172,7 +172,11 @@ class SC_CORE_EXPORT EntityDescItr {
cur = ( EntityDescLinkNode * )( edl.GetHead() );
}
const EntityDescriptor * NextEntityDesc();
inline const EntityDescriptor * NextEntityDesc() {
return NextEntityDesc_nc();
}
EntityDescriptor * NextEntityDesc_nc();
};
@@ -664,6 +668,7 @@ class SC_CORE_EXPORT Schema : public Dictionary_instance {
protected:
const char * _name;
EntityDescriptorList _entList; // list of entities in the schema
EntityDescriptorList _entsWithInverseAttrs;
TypeDescriptorList _typeList; // list of types in the schema
TypeDescriptorList _unnamed_typeList; // list of unnamed types in the schema (for cleanup)
Interface_spec _interface; // list of USE and REF interfaces (SDAI)
@@ -729,15 +734,43 @@ class SC_CORE_EXPORT Schema : public Dictionary_instance {
EntityDescLinkNode * AddEntity( EntityDescriptor * ed ) {
return _entList.AddNode( ed );
}
/// must be called in addition to AddEntity()
EntityDescLinkNode * AddEntityWInverse( EntityDescriptor * ed ) {
return _entsWithInverseAttrs.AddNode( ed );
}
TypeDescLinkNode * AddType( TypeDescriptor * td ) {
return _typeList.AddNode( td );
}
TypeDescLinkNode * AddUnnamedType( TypeDescriptor * td ) {
return _unnamed_typeList.AddNode( td );
}
const EntityDescriptorList * Entities() const {
return & _entList;
}
const EntityDescriptorList * EntsWInverse() const {
return & _entsWithInverseAttrs;
}
const TypeDescriptorList * Types() const {
return & _typeList;
}
const TypeDescriptorList * UnnamedTypes() const {
return & _unnamed_typeList;
}
EntityDescriptorList * Entities() {
return & _entList;
}
EntityDescriptorList * EntsWInverse() {
return & _entsWithInverseAttrs;
}
TypeDescriptorList * Types() {
return & _typeList;
}
TypeDescriptorList * UnnamedTypes() {
return & _unnamed_typeList;
}
// the whole schema
void GenerateExpress( ostream & out ) const;
@@ -811,7 +844,7 @@ class SC_CORE_EXPORT Inverse_attributeLinkNode : public SingleLinkNode {
Inverse_attributeLinkNode();
virtual ~Inverse_attributeLinkNode();
const Inverse_attribute * Inverse_attr() const {
Inverse_attribute * Inverse_attr() const {
return _invAttr;
}
void Inverse_attr( Inverse_attribute * ia ) {
@@ -822,30 +855,32 @@ class SC_CORE_EXPORT Inverse_attributeLinkNode : public SingleLinkNode {
class SC_CORE_EXPORT Inverse_attributeList : public SingleLinkList {
private:
protected:
public:
Inverse_attributeList();
virtual ~Inverse_attributeList();
virtual SingleLinkNode * NewNode() {
return new Inverse_attributeLinkNode;
}
public:
Inverse_attributeList();
virtual ~Inverse_attributeList();
Inverse_attributeLinkNode * AddNode( Inverse_attribute * ia );
};
class SC_CORE_EXPORT InverseAItr {
protected:
const Inverse_attributeList & ial;
const Inverse_attributeList * ial;
const Inverse_attributeLinkNode * cur;
public:
InverseAItr( const Inverse_attributeList & iaList );
InverseAItr( const Inverse_attributeList * iaList );
virtual ~InverseAItr();
void ResetItr() {
cur = ( Inverse_attributeLinkNode * )( ial.GetHead() );
void ResetItr( const Inverse_attributeList * iaList = 0 ) {
if( iaList ) {
ial = iaList;
}
cur = ( Inverse_attributeLinkNode * )( ial->GetHead() );
}
const Inverse_attribute * NextInverse_attribute();
Inverse_attribute * NextInverse_attribute();
};
/**
@@ -889,34 +924,44 @@ class SC_CORE_EXPORT AttrDescriptor {
_name = n;
}
// BaseType() is the underlying type of this attribute.
// NonRefType() is the first non REFERENCE_TYPE type
// e.g. Given attributes of each of the following types
// TYPE count = INTEGER;
// TYPE ref_count = count;
// TYPE count_set = SET OF ref_count;
// BaseType() will return INTEGER_TYPE for an attr of each type.
// BaseTypeDescriptor() returns the TypeDescriptor for Integer
// NonRefType() will return INTEGER_TYPE for the first two. For an
// attribute of type count_set NonRefType() would return
// AGGREGATE_TYPE
// NonRefTypeDescriptor() returns the TypeDescriptor for Integer
// for the first two and a TypeDescriptor for an
// aggregate for the last.
/** BaseType() is the underlying type of this attribute.
* NonRefType() is the first non REFERENCE_TYPE type
* e.g. Given attributes of each of the following types
* TYPE count = INTEGER;
* TYPE ref_count = count;
* TYPE count_set = SET OF ref_count;
* BaseType() will return INTEGER_TYPE for an attr of each type.
* BaseTypeDescriptor() returns the TypeDescriptor for Integer
* NonRefType() will return INTEGER_TYPE for the first two. For an
* attribute of type count_set NonRefType() would return
* AGGREGATE_TYPE
* NonRefTypeDescriptor() returns the TypeDescriptor for Integer
* for the first two and a TypeDescriptor for an
* aggregate for the last.
*
* \sa NonRefType()
* \sa NonRefTypeDescriptor()
*/
///@{
PrimitiveType BaseType() const;
const TypeDescriptor * BaseTypeDescriptor() const;
///@}
// the first PrimitiveType that is not REFERENCE_TYPE (the first
// TypeDescriptor *_referentType that does not have REFERENCE_TYPE
// for it's fundamentalType variable). This would return the same
// as BaseType() for fundamental types. An aggregate type
// would return AGGREGATE_TYPE then you could find out the type of
// an element by calling AggrElemType(). Select types
// would work the same?
/**
* the first PrimitiveType that is not REFERENCE_TYPE (the first
* TypeDescriptor *_referentType that does not have REFERENCE_TYPE
* for it's fundamentalType variable). This would return the same
* as BaseType() for fundamental types. An aggregate type
* would return AGGREGATE_TYPE then you could find out the type of
* an element by calling AggrElemType(). Select types
* would work the same?
*
* \sa BaseType()
*/
///@{
PrimitiveType NonRefType() const;
const TypeDescriptor * NonRefTypeDescriptor() const;
///@}
int IsAggrType() const;
PrimitiveType AggrElemType() const;
@@ -1063,7 +1108,7 @@ class SC_CORE_EXPORT Inverse_attribute : public AttrDescriptor {
const char * _inverted_attr_id;
const char * _inverted_entity_id;
protected:
AttrDescriptor * _inverted_attr; // not implemented
const AttrDescriptor * _inverted_attr; // not implemented (?!) (perhaps this means "not used"?)
public:
Inverse_attribute(
@@ -1098,22 +1143,23 @@ class SC_CORE_EXPORT Inverse_attribute : public AttrDescriptor {
_inverted_entity_id = iei;
}
/// FIXME not implemented
class AttrDescriptor * inverted_attr_() {
/// FIXME not implemented (?!) (perhaps this means "not set"?)
//set _inverted_attr in an extra init step in generated code? any other way to ensure pointers are valid?
const class AttrDescriptor * inverted_attr_() const {
return _inverted_attr;
}
void inverted_attr_( AttrDescriptor * ia ) {
void inverted_attr_( const AttrDescriptor * ia ) {
_inverted_attr = ia;
}
// below are obsolete (and not implemented anyway)
class AttrDescriptor * InverseAttribute() {
return _inverted_attr;
}
void InverseOf( AttrDescriptor * invAttr ) {
_inverted_attr = invAttr;
}
// class AttrDescriptor * InverseAttribute() {
// return _inverted_attr;
// }
// void InverseOf( AttrDescriptor * invAttr ) {
// _inverted_attr = invAttr;
// }
};
/** \class SchRename
@@ -1464,9 +1510,14 @@ class SC_CORE_EXPORT EnumTypeDescriptor : public TypeDescriptor {
* will be building the same thing but using the new schema info.
* nodes (i.e. EntityDesc nodes) for each entity.
*/
class Registry;
class SC_CORE_EXPORT EntityDescriptor : public TypeDescriptor {
protected:
//used in InitIAttrs so we don't have to #include registry.h
SDAI_LOGICAL _abstractEntity;
SDAI_LOGICAL _extMapping;
// does external mapping have to be used to create an instance of
@@ -1493,6 +1544,8 @@ class SC_CORE_EXPORT EntityDescriptor : public TypeDescriptor {
virtual ~EntityDescriptor();
void InitIAttrs( Registry & reg, const char * schNm );
const char * GenerateExpress( std::string & buf ) const;
const char * QualifiedName( std::string & s ) const;
+2 -2
View File
@@ -162,9 +162,9 @@ Inverse_attributeLinkNode * Inverse_attributeList::AddNode( Inverse_attribute *
return node;
}
InverseAItr::InverseAItr( const Inverse_attributeList & iaList )
InverseAItr::InverseAItr( const Inverse_attributeList * iaList )
: ial( iaList ) {
cur = ( Inverse_attributeLinkNode * )( ial.GetHead() );
cur = ( Inverse_attributeLinkNode * )( ial->GetHead() );
}
InverseAItr::~InverseAItr() {
+1 -1
View File
@@ -324,7 +324,7 @@ SDAI_Application_instance * Registry::ObjCreate( const char * nm, const char * s
se->Error().severity( SEVERITY_WARNING );
se->Error().UserMsg( "ENTITY requires external mapping" );
}
se->eDesc = entd;
se->setEDesc( entd );
return se;
} else {
return ENTITY_NULL;
+15 -15
View File
@@ -58,7 +58,7 @@ STEPaggregate & STEPaggregate::ShallowCopy( const STEPaggregate & a ) {
/// do not require exchange file format
Severity STEPaggregate::AggrValidLevel( const char * value, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int optional, char * tokenList, int addFileId,
int clearError ) {
std::string buf;
@@ -78,7 +78,7 @@ Severity STEPaggregate::AggrValidLevel( const char * value, ErrorDescriptor * er
/// require exchange file format
Severity STEPaggregate::AggrValidLevel( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int optional, char * tokenList, int addFileId,
int clearError ) {
std::string buf;
@@ -97,7 +97,7 @@ Severity STEPaggregate::AggrValidLevel( istream & in, ErrorDescriptor * err,
/// if exchangeFileFormat == 1 then paren delims are required.
Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int addFileId, int assignVal, int exchangeFileFormat,
const char * ) {
(void) insts; //not used in ReadValue() for this class
@@ -203,7 +203,7 @@ Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
}
Severity STEPaggregate::StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int addFileId ) {
istringstream in( ( char * )s );
return ReadValue( in, err, elem_type, insts, addFileId, 1, 0 );
@@ -212,7 +212,7 @@ Severity STEPaggregate::StrToVal( const char * s, ErrorDescriptor * err,
///////////////////////////////////////////////////////////////////////////////
Severity STEPaggregate::STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int addFileId, const char * currSch ) {
return ReadValue( in, err, elem_type, insts, addFileId, 1, 1, currSch );
}
@@ -476,7 +476,7 @@ EntityAggregate::~EntityAggregate() {
/// if exchangeFileFormat == 1 then delims are required.
Severity EntityAggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int addFileId, int assignVal,
int exchangeFileFormat, const char * ) {
ErrorDescriptor errdesc;
@@ -618,7 +618,7 @@ SingleLinkNode * EntityNode::NewNode() {
Severity EntityNode::StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
InstMgrBase * insts, int addFileId ) {
SDAI_Application_instance * se = ReadEntityRef( s, err, ",)", insts,
addFileId );
if( se != S_ENTITY_NULL ) {
@@ -639,20 +639,20 @@ Severity EntityNode::StrToVal( const char * s, ErrorDescriptor * err,
Severity EntityNode::StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
InstMgrBase * insts, int addFileId ) {
return STEPread( in, err, elem_type, insts, addFileId );
}
Severity EntityNode::STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
InstMgrBase * insts, int addFileId ) {
istringstream in( ( char * )s );
return STEPread( in, err, elem_type, insts, addFileId );
}
Severity EntityNode::STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
InstMgrBase * insts, int addFileId ) {
SDAI_Application_instance * se = ReadEntityRef( in, err, ",)", insts,
addFileId );
if( se != S_ENTITY_NULL ) {
@@ -714,7 +714,7 @@ SelectAggregate::~SelectAggregate() {
/// if exchangeFileFormat == 1 then delims are required.
Severity SelectAggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int addFileId, int assignVal,
int exchangeFileFormat, const char * currSch ) {
ErrorDescriptor errdesc;
@@ -858,7 +858,7 @@ SingleLinkNode * SelectNode::NewNode() {
Severity SelectNode::StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
InstMgrBase * insts, int addFileId ) {
(void) elem_type; //unused
(void) addFileId; //unused
istringstream in( ( char * )s );
@@ -870,20 +870,20 @@ Severity SelectNode::StrToVal( const char * s, ErrorDescriptor * err,
Severity SelectNode::StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId, const char * currSch ) {
InstMgrBase * insts, int addFileId, const char * currSch ) {
return STEPread( in, err, elem_type, insts, addFileId, currSch );
}
Severity SelectNode::STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
InstMgrBase * insts, int addFileId ) {
istringstream in( ( char * )s );
return STEPread( in, err, elem_type, insts, addFileId );
}
Severity SelectNode::STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId, const char * currSch ) {
InstMgrBase * insts, int addFileId, const char * currSch ) {
(void) elem_type; //unused
if( !node ) {
cerr << "Internal error: " << __FILE__ << ": " << __LINE__ << "\n"
+56 -45
View File
@@ -12,7 +12,7 @@
* and is not subject to copyright.
*/
class InstMgr;
class InstMgrBase;
class STEPaggregate;
class TypeDescriptor;
@@ -42,7 +42,7 @@ class SC_CORE_EXPORT STEPaggregate : public SingleLinkList {
virtual Severity ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0,
InstMgrBase * insts, int addFileId = 0,
int assignVal = 1, int ExchangeFileFormat = 1,
const char * currSch = 0 );
public:
@@ -52,22 +52,22 @@ class SC_CORE_EXPORT STEPaggregate : public SingleLinkList {
}
virtual Severity AggrValidLevel( const char * value, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int optional, char * tokenList, int addFileId = 0,
int clearError = 0 );
virtual Severity AggrValidLevel( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
const TypeDescriptor * elem_type, InstMgrBase * insts,
int optional, char * tokenList, int addFileId = 0,
int clearError = 0 );
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err = 0,
const TypeDescriptor * elem_type = 0,
InstMgr * insts = 0, int addFileId = 0 );
InstMgrBase * insts = 0, int addFileId = 0 );
virtual Severity STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type = 0,
InstMgr * insts = 0, int addFileId = 0,
InstMgrBase * insts = 0, int addFileId = 0,
const char * currSch = 0 );
// OUTPUT
virtual const char * asStr( std::string & s ) const;
@@ -88,6 +88,7 @@ class SC_CORE_EXPORT STEPaggregate : public SingleLinkList {
** \class GenericAggregate
** This class supports LIST OF:
** SELECT_TYPE, BINARY_TYPE, GENERIC_TYPE, ENUM_TYPE, UNKNOWN_TYPE type
** FIXME this class, as well as SelectAggregate, for SELECTs?!
******************************************************************/
class SC_CORE_EXPORT GenericAggregate : public STEPaggregate {
public:
@@ -97,9 +98,10 @@ class SC_CORE_EXPORT GenericAggregate : public STEPaggregate {
GenericAggregate();
virtual ~GenericAggregate();
};
typedef GenericAggregate * GenericAggregateH;
typedef GenericAggregate * GenericAggregate_ptr;
typedef GenericAggregate_ptr GenericAggregate_var;
typedef GenericAggregate * GenericAggregateH;
typedef GenericAggregate * GenericAggregate_ptr;
typedef const GenericAggregate * GenericAggregate_ptr_c;
typedef GenericAggregate_ptr GenericAggregate_var;
/******************************************************************************
**
@@ -109,7 +111,7 @@ class SC_CORE_EXPORT EntityAggregate : public STEPaggregate {
public:
virtual Severity ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0,
InstMgrBase * insts, int addFileId = 0,
int assignVal = 1, int ExchangeFileFormat = 1,
const char * currSch = 0 );
@@ -119,9 +121,10 @@ class SC_CORE_EXPORT EntityAggregate : public STEPaggregate {
EntityAggregate();
virtual ~EntityAggregate();
};
typedef EntityAggregate * EntityAggregateH;
typedef EntityAggregate * EntityAggregate_ptr;
typedef EntityAggregate_ptr EntityAggregate_var;
typedef EntityAggregate * EntityAggregateH;
typedef EntityAggregate * EntityAggregate_ptr;
typedef const EntityAggregate * EntityAggregate_ptr_c;
typedef EntityAggregate_ptr EntityAggregate_var;
/****************************************************************//**
** \class SelectAggregate
@@ -131,7 +134,7 @@ class SC_CORE_EXPORT SelectAggregate : public STEPaggregate {
public:
virtual Severity ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0,
InstMgrBase * insts, int addFileId = 0,
int assignVal = 1, int ExchangeFileFormat = 1,
const char * currSch = 0 );
@@ -141,9 +144,10 @@ class SC_CORE_EXPORT SelectAggregate : public STEPaggregate {
SelectAggregate();
virtual ~SelectAggregate();
};
typedef SelectAggregate * SelectAggregateH;
typedef SelectAggregate * SelectAggregate_ptr;
typedef SelectAggregate_ptr SelectAggregate_var;
typedef SelectAggregate * SelectAggregateH;
typedef SelectAggregate * SelectAggregate_ptr;
typedef const SelectAggregate * SelectAggregate_ptr_c;
typedef SelectAggregate_ptr SelectAggregate_var;
/****************************************************************//**
** \class StringAggregate
@@ -157,9 +161,10 @@ class SC_CORE_EXPORT StringAggregate : public STEPaggregate {
StringAggregate();
virtual ~StringAggregate();
};
typedef StringAggregate * StringAggregateH;
typedef StringAggregate * StringAggregate_ptr;
typedef StringAggregate_ptr StringAggregate_var;
typedef StringAggregate * StringAggregateH;
typedef StringAggregate * StringAggregate_ptr;
typedef const StringAggregate * StringAggregate_ptr_c;
typedef StringAggregate_ptr StringAggregate_var;
/****************************************************************//**
@@ -174,9 +179,10 @@ class SC_CORE_EXPORT BinaryAggregate : public STEPaggregate {
BinaryAggregate();
virtual ~BinaryAggregate();
};
typedef BinaryAggregate * BinaryAggregateH;
typedef BinaryAggregate * BinaryAggregate_ptr;
typedef BinaryAggregate_ptr BinaryAggregate_var;
typedef BinaryAggregate * BinaryAggregateH;
typedef BinaryAggregate * BinaryAggregate_ptr;
typedef const BinaryAggregate * BinaryAggregate_ptr_c;
typedef BinaryAggregate_ptr BinaryAggregate_var;
/**************************************************************//**
** \class EnumAggregate
@@ -190,9 +196,10 @@ class SC_CORE_EXPORT EnumAggregate : public STEPaggregate {
EnumAggregate();
virtual ~EnumAggregate();
};
typedef EnumAggregate * EnumAggregateH;
typedef EnumAggregate * EnumAggregate_ptr;
typedef EnumAggregate_ptr EnumAggregate_var;
typedef EnumAggregate * EnumAggregateH;
typedef EnumAggregate * EnumAggregate_ptr;
typedef const EnumAggregate * EnumAggregate_ptr_c;
typedef EnumAggregate_ptr EnumAggregate_var;
class SC_CORE_EXPORT LOGICALS : public EnumAggregate {
public:
@@ -201,9 +208,10 @@ class SC_CORE_EXPORT LOGICALS : public EnumAggregate {
LOGICALS();
virtual ~LOGICALS();
};
typedef LOGICALS * LogicalsH;
typedef LOGICALS * LOGICALS_ptr;
typedef LOGICALS_ptr LOGICALS_var;
typedef LOGICALS * LogicalsH;
typedef LOGICALS * LOGICALS_ptr;
typedef const LOGICALS * LOGICALS_ptr_c;
typedef LOGICALS_ptr LOGICALS_var;
SC_CORE_EXPORT LOGICALS * create_LOGICALS();
@@ -215,8 +223,9 @@ class SC_CORE_EXPORT BOOLEANS : public EnumAggregate {
virtual ~BOOLEANS();
};
typedef BOOLEANS * BOOLEANS_ptr;
typedef BOOLEANS_ptr BOOLEANS_var;
typedef BOOLEANS * BOOLEANS_ptr;
typedef const BOOLEANS * BOOLEANS_ptr_c;
typedef BOOLEANS_ptr BOOLEANS_var;
SC_CORE_EXPORT BOOLEANS * create_BOOLEANS();
@@ -229,9 +238,10 @@ class SC_CORE_EXPORT RealAggregate : public STEPaggregate {
RealAggregate();
virtual ~RealAggregate();
};
typedef RealAggregate * RealAggregateH;
typedef RealAggregate * RealAggregate_ptr;
typedef RealAggregate_ptr RealAggregate_var;
typedef RealAggregate * RealAggregateH;
typedef RealAggregate * RealAggregate_ptr;
typedef const RealAggregate * RealAggregate_ptr_c;
typedef RealAggregate_ptr RealAggregate_var;
class SC_CORE_EXPORT IntAggregate : public STEPaggregate {
@@ -242,9 +252,10 @@ class SC_CORE_EXPORT IntAggregate : public STEPaggregate {
IntAggregate();
virtual ~IntAggregate();
};
typedef IntAggregate * IntAggregateH;
typedef IntAggregate * IntAggregate_ptr;
typedef IntAggregate_ptr IntAggregate_var;
typedef IntAggregate * IntAggregateH;
typedef IntAggregate * IntAggregate_ptr;
typedef const IntAggregate * IntAggregate_ptr_c;
typedef IntAggregate_ptr IntAggregate_var;
///////////////////////////////////////////////////////////////////////////////
@@ -311,17 +322,17 @@ class SC_CORE_EXPORT EntityNode : public STEPnode {
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
InstMgrBase * insts, int addFileId = 0 );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
InstMgrBase * insts, int addFileId = 0 );
virtual Severity STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
InstMgrBase * insts, int addFileId = 0 );
virtual Severity STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
InstMgrBase * insts, int addFileId = 0 );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
@@ -370,18 +381,18 @@ class SC_CORE_EXPORT SelectNode : public STEPnode {
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
InstMgrBase * insts, int addFileId = 0 );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0,
InstMgrBase * insts, int addFileId = 0,
const char * currSch = 0 );
virtual Severity STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
InstMgrBase * insts, int addFileId = 0 );
virtual Severity STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0,
InstMgrBase * insts, int addFileId = 0,
const char * currSch = 0 );
// OUTPUT
virtual const char * asStr( std::string & s );
+17 -13
View File
@@ -46,7 +46,7 @@ const int Real_Num_Precision = REAL_NUM_PRECISION;
///////////////////////////////////////////////////////////////////////////////
/// the value of the attribute is assigned from the supplied string
Severity STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFileId ) {
Severity STEPattribute::StrToVal( const char * s, InstMgrBase * instances, int addFileId ) {
if( _redefAttr ) {
return _redefAttr->StrToVal( s, instances, addFileId );
}
@@ -194,7 +194,7 @@ Severity STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFi
** value >= SEVERITY_WARNING means program can continue parsing input,
** value <= SEVERITY_INPUT_ERROR is fatal read error
******************************************************************/
Severity STEPattribute::STEPread( istream & in, InstMgr * instances, int addFileId,
Severity STEPattribute::STEPread( istream & in, InstMgrBase * instances, int addFileId,
const char * currSch, bool strict ) {
// The attribute has been redefined by the attribute pointed
@@ -750,22 +750,18 @@ Severity STEPattribute::set_null() {
case REFERENCE_TYPE:
case GENERIC_TYPE:
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
cerr << "Internal error: " << __FILE__ << ":" << __LINE__ << "\n" << _POC_ "\n";
return SEVERITY_BUG;
case UNKNOWN_TYPE:
default: {
default:
ptr.u -> set_null();
char errStr[BUFSIZ];
errStr[0] = '\0';
sprintf( errStr, " Warning: attribute '%s : %s : %d' - %s.\n",
Name(), TypeName(), Type(),
"Don't know how to make attribute NULL" );
_error.AppendToDetailMsg( errStr );
std::stringstream err;
err << " Warning: attribute '" << Name() << " : " << TypeName() << " : ";
err << Type() << "' - " << "Don't know how to make attribute NULL" << std::endl;
_error.AppendToDetailMsg( err.str() );
_error.GreaterSeverity( SEVERITY_WARNING );
return SEVERITY_WARNING;
}
}
if( Nullable() ) {
return SEVERITY_NULL;
@@ -1052,6 +1048,14 @@ bool operator == ( const STEPattribute & a1, const STEPattribute & a2 ) {
return false;
}
/** evaluate the equality of two attributes
* ignores _error and refCount, since those are ancillary
* \return true if not equal
*/
bool operator != ( const STEPattribute & a1, const STEPattribute & a2 ) {
return !( a1 == a2 );
}
/// return true if the attr descriptor is identical
bool sameADesc( const STEPattribute & a1, const STEPattribute & a2 ) {
return a1.aDesc == a2.aDesc;
@@ -1065,7 +1069,7 @@ bool sameADesc( const STEPattribute & a1, const STEPattribute & a2 ) {
* *note* for string values - (attrValue = 0) => string value does not exist,
* attrValue exists it is valid.
******************************************************************/
Severity STEPattribute::ValidLevel( const char * attrValue, ErrorDescriptor * error, InstMgr * im, bool clearError ) {
Severity STEPattribute::ValidLevel( const char * attrValue, ErrorDescriptor * error, InstMgrBase * im, bool clearError ) {
if( clearError ) {
ClearErrorMsg();
}
+14 -26
View File
@@ -28,7 +28,7 @@
typedef double real;
class InstMgr;
class InstMgrBase;
class SDAI_Application_instance;
class STEPaggregate;
class SCLundefined;
@@ -42,10 +42,10 @@ class EntityDescriptor;
extern SC_CORE_EXPORT int SetErrOnNull( const char * attrValue, ErrorDescriptor * error );
extern SC_CORE_EXPORT SDAI_Application_instance * ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId );
InstMgrBase * instances, int addFileId );
extern SC_CORE_EXPORT SDAI_Application_instance * ReadEntityRef( const char * s, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId );
InstMgrBase * instances, int addFileId );
extern SC_CORE_EXPORT Severity EntityValidLevel( SDAI_Application_instance * se,
const TypeDescriptor * ed, ///< entity type that entity se needs to match. (this must be an EntityDescriptor)
@@ -55,13 +55,13 @@ extern SC_CORE_EXPORT Severity EntityValidLevel( const char * attrValue, ///< st
const TypeDescriptor * ed, /**< entity type that entity in attrValue (if it exists) needs
* to match. (this must be an EntityDescriptor)
*/
ErrorDescriptor * err, InstMgr * im, int clearError );
ErrorDescriptor * err, InstMgrBase * im, int clearError );
////////////////////
////////////////////
extern SC_CORE_EXPORT SDAI_Application_instance * STEPread_reference( const char * s, ErrorDescriptor * err,
InstMgr * instances, int addFileId );
InstMgrBase * instances, int addFileId );
////////////////////
extern SC_CORE_EXPORT int QuoteInString( istream & in );
@@ -132,9 +132,9 @@ class SC_CORE_EXPORT STEPattribute {
///////////// Read, Write, Assign attr value
Severity StrToVal( const char * s, InstMgr * instances = 0,
Severity StrToVal( const char * s, InstMgrBase * instances = 0,
int addFileId = 0 );
Severity STEPread( istream & in = cin, InstMgr * instances = 0,
Severity STEPread( istream & in = cin, InstMgrBase * instances = 0,
int addFileId = 0, const char * currSch = NULL, bool strict = true );
/// return the attr value as a string
@@ -146,19 +146,7 @@ class SC_CORE_EXPORT STEPattribute {
Severity set_null();
/** \fn Integer()
* \fn Real()
* \fn Number()
* \fn String()
* \fn Binary()
* \fn Entity()
* \fn Aggregate()
* \fn Enum()
* \fn Logical()
* \fn Boolean()
* \fn Select()
* \fn Undefined()
*
/**
* These functions verify that the attribute contains the requested type and
* returns a pointer. The pointer is null if the requested type does not match.
*
@@ -166,6 +154,7 @@ class SC_CORE_EXPORT STEPattribute {
* \sa NonRefType()
* \sa is_null()
*/
///@{
SDAI_Integer * Integer();
SDAI_Real * Real();
SDAI_Real * Number();
@@ -178,6 +167,7 @@ class SC_CORE_EXPORT STEPattribute {
SDAI_BOOLEAN * Boolean();
SDAI_Select * Select();
SCLundefined * Undefined();
///@}
/// allows direct access to the union containing attr data (dangerous!)
attrUnion * Raw() {
@@ -232,7 +222,7 @@ class SC_CORE_EXPORT STEPattribute {
_error.ClearErrorMsg();
}
Severity ValidLevel( const char* attrValue, ErrorDescriptor* error, InstMgr* im, bool clearError = true );
Severity ValidLevel( const char* attrValue, ErrorDescriptor* error, InstMgrBase * im, bool clearError = true );
////////////////// Constructors
@@ -262,13 +252,11 @@ class SC_CORE_EXPORT STEPattribute {
STEPattribute( const class AttrDescriptor & d, SCLundefined * p );
/// return true if attr types and values match
friend bool operator == ( const STEPattribute & a1, const STEPattribute & a2 );
friend bool operator != ( const STEPattribute & a1, const STEPattribute & a2 ) {
return !( a1 == a2 );
}
SC_CORE_EXPORT friend bool operator == ( const STEPattribute & a1, const STEPattribute & a2 );
SC_CORE_EXPORT friend bool operator != ( const STEPattribute & a1, const STEPattribute & a2 );
/// return true if aDesc's match (behavior of old operator==)
friend bool sameADesc ( const STEPattribute & a1, const STEPattribute & a2 );
SC_CORE_EXPORT friend bool sameADesc ( const STEPattribute & a1, const STEPattribute & a2 );
};
#endif
+25 -27
View File
@@ -12,13 +12,13 @@ ReadStdKeyword( istream & in, std::string & buf, int skipInitWS );
STEPcomplex::STEPcomplex( Registry * registry, int fileid )
: SDAI_Application_instance( fileid, 1 ), sc( 0 ), _registry( registry ), visited( 0 ) {
: SDAI_Application_instance( fileid, true ), sc( 0 ), _registry( registry ), visited( 0 ) {
head = this;
}
STEPcomplex::STEPcomplex( Registry * registry, const std::string ** names,
int fileid, const char * schnm )
: SDAI_Application_instance( fileid, 1 ), sc( 0 ), _registry( registry ), visited( 0 ) {
: SDAI_Application_instance( fileid, true ), sc( 0 ), _registry( registry ), visited( 0 ) {
char * nms[BUFSIZ];
int j, k;
@@ -38,7 +38,7 @@ STEPcomplex::STEPcomplex( Registry * registry, const std::string ** names,
STEPcomplex::STEPcomplex( Registry * registry, const char ** names, int fileid,
const char * schnm )
: SDAI_Application_instance( fileid, 1 ), sc( 0 ), _registry( registry ), visited( 0 ) {
: SDAI_Application_instance( fileid, true ), sc( 0 ), _registry( registry ), visited( 0 ) {
head = this;
Initialize( names, schnm );
@@ -204,17 +204,14 @@ void STEPcomplex::AssignDerives() {
}
}
/** \fn STEPcomplex::AddEntityPart
** this function should only be called for the head entity
** in the list of entity parts.
*/
/** this function should only be called for the head entity in the list of entity parts. */
void STEPcomplex::AddEntityPart( const char * name ) {
STEPcomplex * scomplex;
if( name ) {
scomplex = new STEPcomplex( _registry, STEPfile_id );
scomplex->BuildAttrs( name );
if( scomplex->eDesc ) {
scomplex->InitIAttrs();
scomplex->head = this;
AppendEntity( scomplex );
} else {
@@ -231,9 +228,10 @@ STEPcomplex * STEPcomplex::EntityPart( const char * name, const char * currSch )
if( scomp->eDesc->CurrName( name, currSch ) ) {
return scomp;
}
} else
} else {
cout << "Bug in STEPcomplex::EntityPart(): entity part has "
<< "no EntityDescriptor\n";
}
scomp = scomp->sc;
}
return 0;
@@ -258,7 +256,7 @@ const EntityDescriptor * STEPcomplex::IsA( const EntityDescriptor * ed ) const {
}
}
Severity STEPcomplex::ValidLevel( ErrorDescriptor * error, InstMgr * im,
Severity STEPcomplex::ValidLevel( ErrorDescriptor * error, InstMgrBase * im,
int clearError ) {
(void) error; //unused
(void) im;
@@ -276,7 +274,7 @@ void STEPcomplex::AppendEntity( STEPcomplex * stepc ) {
}
// READ
Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgrBase * instance_set,
istream & in, const char * currSch, bool /*useTechCor*/, bool /*strict*/ ) {
char c;
std::string typeNm;
@@ -303,8 +301,7 @@ Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_
in >> ws;
c = in.peek();
if( c != '(' ) {
_error.AppendToDetailMsg(
"Missing open paren before entity attr values.\n" );
_error.AppendToDetailMsg( "Missing open paren before entity attr values.\n" );
cout << "ERROR: missing open paren\n";
_error.GreaterSeverity( SEVERITY_INPUT_ERROR );
STEPread_error( c, 0, in, currSch );
@@ -312,15 +309,12 @@ Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_
}
stepc = EntityPart( typeNm.c_str(), currSch );
if( stepc )
stepc->SDAI_Application_instance::STEPread( id, addFileId,
instance_set, in,
currSch );
else {
cout << "ERROR: complex entity part \"" << typeNm
<< "\" does not exist.\n";
_error.AppendToDetailMsg(
"Complex entity part of instance does not exist.\n" );
if( stepc ) {
//WARNING need to seek to the correct position when this is done... how?
stepc->SDAI_Application_instance::STEPread( id, addFileId, instance_set, in, currSch );
} else {
cout << "ERROR: complex entity part \"" << typeNm << "\" does not exist." << endl;;
_error.AppendToDetailMsg( "Complex entity part of instance does not exist.\n" );
_error.GreaterSeverity( SEVERITY_INPUT_ERROR );
STEPread_error( c, 0, in, currSch );
return _error.severity();
@@ -328,12 +322,16 @@ Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_
in >> ws;
c = in.peek();
}
if( c != ')' )
cout <<
"ERROR: missing ending paren for complex entity instance.\n";
else {
if( c != ')' ) {
cout << "ERROR: missing ending paren for complex entity instance." << endl;
} else {
in.get( c ); // read the closing paren
}
} else {
_error.AppendToDetailMsg( "Complex instances must begin with '('. Found '" );
_error.AppendToDetailMsg( c );
_error.AppendToDetailMsg( "' instead.\n" );
_error.GreaterSeverity( SEVERITY_INPUT_ERROR );
}
return _error.severity();
}
@@ -341,7 +339,7 @@ Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_
//FIXME delete this?
#ifdef buildwhileread
// READ
Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_set,
Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgrBase * instance_set,
istream & in, const char * currSch ) {
ClearError( 1 );
STEPfile_id = id;
+18 -3
View File
@@ -13,13 +13,28 @@
typedef std::list<void *> STEPcomplex_attr_data_list;
typedef std::list<void *>::iterator STEPcomplex_attr_data;
/** TODO add a method to ed to create iAttr structure
* either call same method in all parents, or add their iAttrs in some other way
* does not need to be ordered
*
* simply move iAttrs into eDesc? don't recall whether that data can be safely shared amongst multiple instances or not
* if it can't be shared, we'd need to enforce copy-on-write somehow - perhaps making iAttrs protected with a getter
* that requires an instance as an arg - i.e. inst->eDesc->iAttrSetup(inst)
*
* what about inheritance? should each eDesc include all iattrs, or assemble the list as necessary at runtime?
* eDesc should assemble a complete list on demand at runtime...
*
* How to initialize iAttrs for SC's? BuildIAttrs( eDesc )
*/
class SC_CORE_EXPORT STEPcomplex : public SDAI_Application_instance {
public: //TODO should this _really_ be public?!
STEPcomplex * sc;
STEPcomplex * head;
Registry * _registry;
int visited; ///< used when reading (or as you wish?)
STEPcomplex_attr_data_list _attr_data_list;
STEPcomplex_attr_data_list _attr_data_list; //< what is this for?
public:
STEPcomplex( Registry * registry, int fileid );
STEPcomplex( Registry * registry, const std::string ** names, int fileid,
@@ -34,11 +49,11 @@ class SC_CORE_EXPORT STEPcomplex : public SDAI_Application_instance {
virtual const EntityDescriptor * IsA( const EntityDescriptor * ) const;
virtual Severity ValidLevel( ErrorDescriptor * error, InstMgr * im,
virtual Severity ValidLevel( ErrorDescriptor * error, InstMgrBase * im,
int clearError = 1 );
// READ
virtual Severity STEPread( int id, int addFileId,
class InstMgr * instance_set,
class InstMgrBase * instance_set,
istream & in = cin, const char * currSch = NULL,
bool useTechCor = true, bool strict = true );
+66
View File
@@ -0,0 +1,66 @@
/** \file STEPinvAttrList.cc
* derived from STEPattributeList.cc
*/
#include <STEPinvAttrList.h>
#include <ExpDict.h>
#include "sc_memmgr.h"
invAttrListNodeI::invAttrListNodeI(Inverse_attribute* a, setterI_t s, getterI_t g): invAttrListNode(a), set( s ), get( g ) {}
invAttrListNodeA::invAttrListNodeA(Inverse_attribute* a, setterA_t s, getterA_t g): invAttrListNode(a), set( s ), get( g ) {}
invAttrListNodeI::~invAttrListNodeI() {}
invAttrListNodeA::~invAttrListNodeA() {}
STEPinvAttrList::STEPinvAttrList() {}
STEPinvAttrList::~STEPinvAttrList() {}
invAttrListNode * STEPinvAttrList::operator []( int n ) {
int x = 0;
invAttrListNode * a = ( invAttrListNode * )head;
int cnt = EntryCount();
if( n < cnt ) {
while( a && ( x < n ) ) {
a = ( invAttrListNode * )( a->next );
x++;
}
}
if( !a ) {
cerr << "\nERROR in STEP Core library: " << __FILE__ << ":"
<< __LINE__ << "\n" << _POC_ << "\n\n";
}
return a;
}
int STEPinvAttrList::list_length() {
return EntryCount();
}
void STEPinvAttrList::push( Inverse_attribute * a, setterA_t s, getterA_t g ) {
invAttrListNode * an = ( invAttrListNode * )head;
// if the attribute already exists in the list, don't push it
while( an ) {
if( a == ( an -> attr ) ) {
return;
}
an = ( invAttrListNode * )( an->next );
}
invAttrListNode * ialn = (invAttrListNode *) new invAttrListNodeA( a, s, g );
AppendNode( ialn );
}
void STEPinvAttrList::push( Inverse_attribute * a, setterI_t s, getterI_t g ) {
invAttrListNode * an = ( invAttrListNode * )head;
// if the attribute already exists in the list, don't push it
while( an ) {
if( a == ( an -> attr ) ) {
return;
}
an = ( invAttrListNode * )( an->next );
}
invAttrListNode * ialn = (invAttrListNode *) new invAttrListNodeI( a, s, g );
AppendNode( ialn );
}
+100
View File
@@ -0,0 +1,100 @@
#ifndef _STEPinvAttrList_h
#define _STEPinvAttrList_h 1
/// FIXME remove these classes? not sure there's a use for them now...
/** \file STEPinvAttrList.h
* derived from STEPattributeList.h
*
* Similar to Inverse_attributeList, but this list also contains pointers to the setter and getter.
*
* \sa Inverse_attributeList
*/
class Inverse_attribute;
#include <sc_export.h>
#include <SingleLinkList.h>
class STEPinvAttrList;
class EntityAggregate;
class SDAI_Application_instance;
/** setterI_t, getterI_t: for inverse attrs that only allow a single (Instance) reference
* setterA_t, getterA_t: for inverse attrs that allow multiple (Aggregate) refs
* @{
*/
typedef void ( *setterI_t )( SDAI_Application_instance *, const SDAI_Application_instance * );
typedef SDAI_Application_instance * ( *getterI_t )( const SDAI_Application_instance * );
typedef void ( *setterA_t )( SDAI_Application_instance *, const EntityAggregate * );
typedef EntityAggregate * ( *getterA_t )( const SDAI_Application_instance * );
/** @} */
/** invAttrListNode: base class + 2 derived classes, one for single instances and one for aggregates
* @{
*/
class SC_CORE_EXPORT invAttrListNode : public SingleLinkNode {
friend class STEPinvAttrList;
protected:
invAttrListNode( Inverse_attribute * a ) : attr( a ) {};
Inverse_attribute * attr;
public:
Inverse_attribute * inverseADesc() {
return attr;
}
virtual bool isAggregate() = 0;
};
class SC_CORE_EXPORT invAttrListNodeI : public invAttrListNode {
friend class STEPinvAttrList;
protected:
setterI_t set;
getterI_t get;
public:
invAttrListNodeI( Inverse_attribute * a, setterI_t s, getterI_t g );
virtual ~invAttrListNodeI();
setterI_t setter() {
return set;
}
getterI_t getter() {
return get;
}
virtual bool isAggregate() {
return false;
}
};
class SC_CORE_EXPORT invAttrListNodeA : public invAttrListNode {
friend class STEPinvAttrList;
protected:
setterA_t set;
getterA_t get;
public:
invAttrListNodeA( Inverse_attribute * a, setterA_t s, getterA_t g );
virtual ~invAttrListNodeA();
setterA_t setter() {
return set;
}
getterA_t getter() {
return get;
}
virtual bool isAggregate() {
return true;
}
};
/** @} */
/// Similar to Inverse_attributeList, but this list also contains pointers to the setter and getter.
class SC_CORE_EXPORT STEPinvAttrList : public SingleLinkList {
public:
STEPinvAttrList();
virtual ~STEPinvAttrList();
invAttrListNode * operator []( int n );
int list_length();
void push( Inverse_attribute * a, setterA_t s, getterA_t g );
void push( Inverse_attribute * a, setterI_t s, getterI_t g );
};
#endif
+13 -26
View File
@@ -49,7 +49,7 @@ InstMgr::PrintSortedFileIds() {
InstMgr::InstMgr( int ownsInstances )
: maxFileId( -1 ), _ownsInstances( ownsInstances ) {
master = new MgrNodeArray();
sortedMaster = new MgrNodeArraySorted();
sortedMaster = new std::map<int, MgrNode *>;
}
InstMgr::~InstMgr() {
@@ -58,7 +58,8 @@ InstMgr::~InstMgr() {
} else {
master->ClearEntries();
}
sortedMaster->ClearEntries();
sortedMaster->clear();
std::map<int, MgrNode *>::iterator iter;
delete master;
delete sortedMaster;
@@ -68,13 +69,13 @@ InstMgr::~InstMgr() {
void InstMgr::ClearInstances() {
master->ClearEntries();
sortedMaster->ClearEntries();
sortedMaster->clear();
maxFileId = -1;
}
void InstMgr::DeleteInstances() {
master->DeleteEntries();
sortedMaster->ClearEntries();
sortedMaster->clear();
maxFileId = -1;
}
@@ -164,12 +165,10 @@ InstMgr::VerifyInstances( ErrorDescriptor & err ) {
///////////////////////////////////////////////////////////////////////////////
MgrNode * InstMgr::FindFileId( int fileId ) {
int index = sortedMaster->MgrNodeIndex( fileId );
if( index >= 0 ) {
return ( MgrNode * )( *sortedMaster )[index];
} else {
return ( MgrNode * )0;
}
std::map<int, MgrNode *>::iterator it;
it=sortedMaster->find(fileId);
if (it == sortedMaster->end()) return ( MgrNode * )0;
return it->second;
}
///////////////////////////////////////////////////////////////////////////////
@@ -182,13 +181,6 @@ int InstMgr::GetIndex( MgrNode * mn ) {
///////////////////////////////////////////////////////////////////////////////
int InstMgr::GetIndex( SDAI_Application_instance * se ) {
int fileId = se->StepFileId();
return sortedMaster->MgrNodeIndex( fileId );
}
///////////////////////////////////////////////////////////////////////////////
int InstMgr::VerifyEntity( int fileId, const char * expectedType ) {
MgrNode * mn = FindFileId( fileId );
if( mn ) {
@@ -210,7 +202,6 @@ MgrNode * InstMgr::Append( SDAI_Application_instance * se, stateEnum listState )
if( debug_level > 3 ) {
cout << "#" << se->StepFileId() << " append node to InstMgr" << endl;
}
MgrNode * mn = 0;
if( se->StepFileId() == 0 ) { // no id assigned
@@ -240,8 +231,8 @@ MgrNode * InstMgr::Append( SDAI_Application_instance * se, stateEnum listState )
cout << "append to InstMgr **ERROR ** node #" << se->StepFileId() <<
" doesn't have state information" << endl;
master->Append( mn );
sortedMaster->Insert( mn );
//PrintSortedFileIds();
(*sortedMaster)[mn->GetFileId()] = mn;
//PrintSortedFileIds();
return mn;
}
@@ -251,15 +242,11 @@ void InstMgr::Delete( MgrNode * node ) {
// delete the node from its current state list
node->Remove();
int index;
// get the index of the node in the sorted master array
index = sortedMaster->MgrNodeIndex( node->GetFileId() );
// remove the node from the sorted master array
sortedMaster->Remove( index );
sortedMaster->erase( node->GetFileId() );
// get the index into the master array by ptr arithmetic
index = node->ArrayIndex();
int index = node->ArrayIndex();
master->Remove( index );
delete node;
+10 -2
View File
@@ -22,6 +22,8 @@
#include <sc_export.h>
#include <map>
// IT IS VERY IMPORTANT THAT THE ORDER OF THE FOLLOWING INCLUDE FILES
// BE PRESERVED
@@ -37,7 +39,13 @@
#include <mgrnodearray.h>
class SC_CORE_EXPORT InstMgr {
class SC_CORE_EXPORT InstMgrBase {
public:
virtual MgrNodeBase * FindFileId( int fileId ) = 0;
virtual ~InstMgrBase() {};
};
class SC_CORE_EXPORT InstMgr : public InstMgrBase {
protected:
int maxFileId;
int _ownsInstances; // if true will delete instances inside destructor
@@ -45,7 +53,7 @@ class SC_CORE_EXPORT InstMgr {
MgrNodeArray * master; // master array of all MgrNodes made up of
// complete, incomplete, new, delete MgrNodes lists
// this corresponds to the display list object by index
MgrNodeArraySorted * sortedMaster; // master array sorted by fileId
std::map<int, MgrNode *> *sortedMaster; // master array sorted by fileId
// StateList *master; // this will be an sorted array of ptrs to MgrNodes
public:
+9 -1
View File
@@ -29,13 +29,21 @@ class DisplayNode;
class InstMgr;
class SC_CORE_EXPORT MgrNodeBase : public GenericNode {
public:
virtual inline SDAI_Application_instance * GetSTEPentity() {
abort();
};
virtual ~MgrNodeBase() {};
};
//////////////////////////////////////////////////////////////////////////////
// class MgrNode
// If you delete this object, it deletes the SDAI_Application_instance it represents,
// the DisplayNode, and removes itself from any list it is in.
//////////////////////////////////////////////////////////////////////////////
class SC_CORE_EXPORT MgrNode : public GenericNode {
class SC_CORE_EXPORT MgrNode : public MgrNodeBase {
friend class GenNodeList;
friend class MgrNodeList;
friend class InstMgr;
+3 -2
View File
@@ -38,9 +38,10 @@ typedef std::string Express_id;
class TypeDescriptor;
class EntityDescriptor;
class SelectTypeDescriptor;
class InstMgr;
class InstMgrBase;
#include "STEPattributeList.h"
#include "STEPinvAttrList.h"
class STEPattributeList;
class STEPattribute;
@@ -226,7 +227,7 @@ typedef SDAI_Application_instance * STEPentityH;
extern SC_CORE_EXPORT SDAI_Application_instance *
ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId );
InstMgrBase * instances, int addFileId );
#define SdaiInteger SDAI_Integer
#define SdaiReal SDAI_Real
+75 -21
View File
@@ -10,13 +10,16 @@
* and is not subject to copyright.
*/
#include <map>
#include <sdai.h>
#include <instmgr.h>
#include <STEPcomplex.h>
#include <STEPattribute.h>
#include <read_func.h> //for ReadTokenSeparator, used when comments are inside entities
#include "sdaiApplication_instance.h"
#include "superInvAttrIter.h"
SDAI_Application_instance NilSTEPentity;
/**************************************************************//**
@@ -32,22 +35,22 @@ SDAI_Application_instance NilSTEPentity;
SDAI_Application_instance::SDAI_Application_instance()
: _cur( 0 ),
eDesc( NULL ),
_complex( false ),
STEPfile_id( 0 ),
p21Comment( std::string( "" ) ),
eDesc( NULL ),
headMiEntity( 0 ),
nextMiEntity( 0 ),
_complex( 0 ) {
nextMiEntity( 0 ) {
}
SDAI_Application_instance::SDAI_Application_instance( int fileid, int complex )
: _cur( 0 ),
eDesc( NULL ),
_complex( complex ),
STEPfile_id( fileid ),
p21Comment( std::string( "" ) ),
eDesc( NULL ),
headMiEntity( 0 ),
nextMiEntity( 0 ),
_complex( complex ) {
nextMiEntity( 0 ) {
}
SDAI_Application_instance::~SDAI_Application_instance() {
@@ -70,6 +73,27 @@ SDAI_Application_instance::~SDAI_Application_instance() {
}
}
/// initialize inverse attrs
/// eDesc->InitIAttrs() must have been called previously
/// call once per instance (*not* once per class)
void SDAI_Application_instance::InitIAttrs() {
assert( eDesc && "eDesc must be set; please report this bug." );
InverseAItr iai( &( eDesc->InverseAttr() ) );
const Inverse_attribute * ia;
iAstruct s;
memset( &s, 0, sizeof s );
while( 0 != ( ia = iai.NextInverse_attribute() ) ) {
iAMap.insert( iAMap_t::value_type( ia, s ) );
}
superInvAttrIter siai( eDesc );
while( !siai.empty() ) {
ia = siai.next();
assert( ia && "Null inverse attr!" );
iAMap.insert( iAMap_t::value_type( ia, s ) );
}
}
SDAI_Application_instance * SDAI_Application_instance::Replicate() {
char errStr[BUFSIZ];
if( IsComplex() ) {
@@ -251,7 +275,7 @@ const EntityDescriptor * SDAI_Application_instance::IsA( const EntityDescriptor
/**
* Checks the validity of the current attribute values for the entity
*/
Severity SDAI_Application_instance::ValidLevel( ErrorDescriptor * error, InstMgr * im,
Severity SDAI_Application_instance::ValidLevel( ErrorDescriptor * error, InstMgrBase * im,
int clearError ) {
ErrorDescriptor err;
if( clearError ) {
@@ -477,7 +501,7 @@ void SDAI_Application_instance::STEPread_error( char c, int i, istream & in, con
** Status:
******************************************************************/
Severity SDAI_Application_instance::STEPread( int id, int idIncr,
InstMgr * instance_set, istream & in,
InstMgrBase * instance_set, istream & in,
const char * currSch, bool useTechCor, bool strict ) {
STEPfile_id = id;
char c = '\0';
@@ -631,7 +655,7 @@ Severity SDAI_Application_instance::STEPread( int id, int idIncr,
/// read an entity reference and return a pointer to the SDAI_Application_instance
SDAI_Application_instance * ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId ) {
InstMgrBase * instances, int addFileId ) {
char c;
char errStr[BUFSIZ];
errStr[0] = '\0';
@@ -640,8 +664,7 @@ SDAI_Application_instance * ReadEntityRef( istream & in, ErrorDescriptor * err,
in >> c;
switch( c ) {
case '@':
err->AppendToDetailMsg(
"Use of @ instead of # to identify entity.\n" );
err->AppendToDetailMsg( "Use of @ instead of # to identify entity.\n" );
err->GreaterSeverity( SEVERITY_WARNING );
// no break statement here on purpose
case '#': {
@@ -675,7 +698,7 @@ SDAI_Application_instance * ReadEntityRef( istream & in, ErrorDescriptor * err,
// lookup which object has id as its instance id
SDAI_Application_instance * inst;
/* If there is a ManagerNode it should have a SDAI_Application_instance */
MgrNode * mn = 0;
MgrNodeBase * mn = 0;
mn = instances->FindFileId( id );
if( mn ) {
inst = mn->GetSTEPentity() ;
@@ -715,7 +738,7 @@ SDAI_Application_instance * ReadEntityRef( istream & in, ErrorDescriptor * err,
/// read an entity reference and return a pointer to the SDAI_Application_instance
SDAI_Application_instance * ReadEntityRef( const char * s, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId ) {
InstMgrBase * instances, int addFileId ) {
istringstream in( ( char * )s );
return ReadEntityRef( in, err, tokenList, instances, addFileId );
}
@@ -736,7 +759,7 @@ Severity EntityValidLevel( SDAI_Application_instance * se,
"missing or invalid EntityDescriptor\n" );
err->AppendToUserMsg( messageBuf );
err->AppendToDetailMsg( messageBuf );
cerr << "Internal error: " << __FILE__ << __LINE__
cerr << "Internal error: " << __FILE__ << ":" << __LINE__
<< "\n" << _POC_ "\n";
return SEVERITY_BUG;
}
@@ -747,7 +770,7 @@ Severity EntityValidLevel( SDAI_Application_instance * se,
"for SDAI_Application_instance argument." );
err->AppendToUserMsg( messageBuf );
err->AppendToDetailMsg( messageBuf );
cerr << "Internal error: " << __FILE__ << __LINE__
cerr << "Internal error: " << __FILE__ << ":" << __LINE__
<< "\n" << _POC_ "\n";
return SEVERITY_BUG;
}
@@ -755,9 +778,9 @@ Severity EntityValidLevel( SDAI_Application_instance * se,
// DAVE: Can an entity be used in an Express TYPE so that this
// EntityDescriptor would have type REFERENCE_TYPE -- it looks like NO
else if( se->eDesc ) {
else if( se->getEDesc() ) {
// is se a descendant of ed?
if( se->eDesc->IsA( ed ) ) {
if( se->getEDesc()->IsA( ed ) ) {
return SEVERITY_NULL;
} else {
if( se->IsComplex() ) {
@@ -822,7 +845,7 @@ Severity EntityValidLevel( const char * attrValue, // string contain entity ref
// attrValue (if it exists) needs
// to match. (this must be an
// EntityDescriptor)
ErrorDescriptor * err, InstMgr * im, int clearError ) {
ErrorDescriptor * err, InstMgrBase * im, int clearError ) {
char tmp [BUFSIZ];
tmp[0] = '\0';
char messageBuf [BUFSIZ];
@@ -834,7 +857,7 @@ Severity EntityValidLevel( const char * attrValue, // string contain entity ref
}
int fileId;
MgrNode * mn = 0;
MgrNodeBase * mn = 0;
// fmtstr1 contains "#%d %ns" where n is BUFSIZ-1
fmtstr1 << " #%d %" << BUFSIZ - 1 << "s ";
@@ -896,9 +919,40 @@ STEPattribute * SDAI_Application_instance::NextAttribute() {
return 0;
}
return &attributes [_cur - 1];
}
int SDAI_Application_instance::AttributeCount() {
return attributes.list_length();
}
const iAstruct SDAI_Application_instance::getInvAttr( const Inverse_attribute * const ia ) const {
iAstruct ias;
memset( &ias, 0, sizeof ias );
iAMap_t::const_iterator it = iAMap.find( ia );
if( it != iAMap.end() ) {
ias = (*it).second;
}
return ias;
}
const SDAI_Application_instance::iAMap_t::value_type SDAI_Application_instance::getInvAttr( const char * name ) const {
iAMap_t::const_iterator it = iAMap.begin();
for( ; it != iAMap.end(); ++it ) {
if( 0 == strcmp( it->first->Name(), name) ) {
return *it;
}
}
iAstruct z;
memset( &z, 0, sizeof z );
iAMap_t::value_type nil( NULL, z );
return nil;
}
void SDAI_Application_instance::setInvAttr( const Inverse_attribute * const ia, const iAstruct ias ) {
iAMap_t::iterator it = iAMap.find(ia);
if( it != iAMap.end() ) {
it->second = ias;
} else {
iAMap.insert( iAMap_t::value_type( ia, ias ) );
}
}
+47 -17
View File
@@ -13,21 +13,39 @@
*/
#include <sc_export.h>
#include <map>
#include <iostream>
///////////////////////////////////////////////////////////////////////////////
// SDAI_Application_instance used to be STEPentity
//class STEPinvAttrList;
class EntityAggregate;
class Inverse_attribute;
typedef struct {
// bool aggregate;
union {
EntityAggregate * a;
SDAI_Application_instance * i;
};
} iAstruct;
/** @class
* this used to be STEPentity
*/
class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
private:
int _cur; // provides a built-in way of accessing attributes in order.
public:
typedef std::map< const Inverse_attribute * const, iAstruct> iAMap_t;
protected:
const EntityDescriptor * eDesc;
iAMap_t iAMap;
bool _complex;
public: //TODO make these private?
STEPattributeList attributes;
int STEPfile_id;
int STEPfile_id; //TODO are neg values ever used (signalling)? if not, make unsigned?
ErrorDescriptor _error;
std::string p21Comment;
// registry additions
const EntityDescriptor * eDesc;
/**
** head entity for multiple inheritance. If it is null then this
@@ -40,18 +58,23 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
/// these form a chain of other entity parents for multiple inheritance
SDAI_Application_instance * nextMiEntity;
protected:
int _complex;
public:
SDAI_Application_instance();
SDAI_Application_instance( int fileid, int complex = 0 );
virtual ~SDAI_Application_instance();
int IsComplex() const {
bool IsComplex() const {
return _complex;
}
/// initialize inverse attribute list
void InitIAttrs();
void setEDesc( const EntityDescriptor * const ed ) {
eDesc = ed;
}
const EntityDescriptor * getEDesc() const {
return eDesc;
}
void StepFileId( int fid ) {
STEPfile_id = fid;
}
@@ -74,7 +97,7 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
virtual const EntityDescriptor * IsA( const EntityDescriptor * ) const;
virtual Severity ValidLevel( ErrorDescriptor * error, InstMgr * im,
virtual Severity ValidLevel( ErrorDescriptor * error, InstMgrBase * im,
int clearError = 1 );
ErrorDescriptor & Error() {
return _error;
@@ -92,27 +115,34 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
void ResetAttributes() {
_cur = 0;
}
// ACCESS inverse attributes
const iAstruct getInvAttr( const Inverse_attribute * const ia ) const;
const iAMap_t::value_type getInvAttr( const char * name ) const;
void setInvAttr( const Inverse_attribute * const ia, const iAstruct ias );
const iAMap_t & getInvAttrs() const {
return iAMap;
}
// READ
virtual Severity STEPread( int id, int addFileId,
class InstMgr * instance_set,
istream & in = cin, const char * currSch = NULL,
class InstMgrBase * instance_set,
std::istream & in = std::cin, const char * currSch = NULL,
bool useTechCor = true, bool strict = true );
virtual void STEPread_error( char c, int i, std::istream& in, const char * schnm );
// WRITE
virtual void STEPwrite( ostream & out = cout, const char * currSch = NULL,
virtual void STEPwrite( std::ostream & out = std::cout, const char * currSch = NULL,
int writeComments = 1 );
virtual const char * STEPwrite( std::string & buf, const char * currSch = NULL );
void WriteValuePairs( ostream & out, const char * currSch = NULL,
void WriteValuePairs( std::ostream & out, const char * currSch = NULL,
int writeComments = 1, int mixedCase = 1 );
void STEPwrite_reference( ostream & out = cout );
void STEPwrite_reference( std::ostream & out = std::cout );
const char * STEPwrite_reference( std::string & buf );
void beginSTEPwrite( ostream & out = cout ); ///< writes out the SCOPE section
void endSTEPwrite( ostream & out = cout );
void beginSTEPwrite( std::ostream & out = std::cout ); ///< writes out the SCOPE section
void endSTEPwrite( std::ostream & out = std::cout );
// MULTIPLE INHERITANCE
int MultipleInheritance() {
+23 -3
View File
@@ -33,9 +33,29 @@ SDAI_Select::SDAI_Select( const SelectTypeDescriptor * s,
#endif
}
SDAI_Select::SDAI_Select( const SDAI_Select & other ) {
underlying_type = other.underlying_type;
base_type = other.base_type;
_type = other._type;
#ifdef SC_LOGGING
*logStream << "Exiting SDAI_Select constructor." << endl;
#endif
}
SDAI_Select::~SDAI_Select() {
}
SDAI_Select & SDAI_Select::operator=( const SDAI_Select & other ) {
if( &other != this ) {
_error = other._error;
_type = other._type;
base_type = other.base_type;
underlying_type = other.underlying_type;
val = other.val;
}
return *this;
}
Severity SDAI_Select::severity() const {
return _error.severity();
}
@@ -135,7 +155,7 @@ void SDAI_Select::nullify() {
}
Severity SDAI_Select::SelectValidLevel( const char * attrValue, ErrorDescriptor * err,
InstMgr * im ) {
InstMgrBase * im ) {
SDAI_Select * tmp = NewSelect();
Severity s = SEVERITY_NULL;
@@ -146,7 +166,7 @@ Severity SDAI_Select::SelectValidLevel( const char * attrValue, ErrorDescriptor
}
Severity SDAI_Select::StrToVal( const char * Val, const char * selectType,
ErrorDescriptor * err, InstMgr * instances ) {
ErrorDescriptor * err, InstMgrBase * instances ) {
severity( SEVERITY_NULL );
if( SetUnderlyingType( CanBe( selectType ) ) )
@@ -208,7 +228,7 @@ Severity SDAI_Select::StrToVal( const char * Val, const char * selectType,
* This function does the following:
*/
Severity SDAI_Select::STEPread( istream & in, ErrorDescriptor * err,
InstMgr * instances, const char * utype,
InstMgrBase * instances, const char * utype,
int addFileId, const char * currSch ) {
char c = '\0';
std::string tmp;
+9 -6
View File
@@ -52,6 +52,7 @@ class SC_CORE_EXPORT SDAI_Select {
// constructors
SDAI_Select( const SelectTypeDescriptor * s = 0,
const TypeDescriptor * td = 0 );
SDAI_Select( const SDAI_Select & other );
virtual ~SDAI_Select();
// from SDAI binding
@@ -61,7 +62,7 @@ class SC_CORE_EXPORT SDAI_Select {
void nullify();
Severity SelectValidLevel( const char * attrValue, ErrorDescriptor * err,
InstMgr * im );
InstMgrBase * im );
// reading and writing
const char * STEPwrite( std::string & s, const char * currSch = 0 ) const;
@@ -75,22 +76,24 @@ class SC_CORE_EXPORT SDAI_Select {
Severity StrToVal( const char * val, const char * selectType,
ErrorDescriptor * err, InstMgr * instances = 0 );
ErrorDescriptor * err, InstMgrBase * instances = 0 );
virtual Severity StrToVal_content( const char *,
InstMgr * instances = 0 ) = 0;
InstMgrBase * instances = 0 ) = 0;
Severity STEPread( istream & in, ErrorDescriptor * err,
InstMgr * instances = 0, const char * utype = 0,
InstMgrBase * instances = 0, const char * utype = 0,
int addFileId = 0, const char * = NULL );
// abstract function
virtual Severity STEPread_content( istream & in = cin,
InstMgr * instances = 0,
InstMgrBase * instances = 0,
const char * utype = 0,
int addFileId = 0,
const char * currSch = 0 ) = 0;
virtual SDAI_Select & operator =( const SDAI_Select & ) = 0;
//windows complains if operator= is pure virtual, perhaps because the impl is not in the lib with the definition
//linux has a regression if the pure virtual operator= is commented out
virtual SDAI_Select & operator =( const SDAI_Select & other );
int set_null();
int is_null();
+72
View File
@@ -0,0 +1,72 @@
#ifndef SUPERINVATTRITER_H
#define SUPERINVATTRITER_H
#include "SubSuperIterators.h"
#include "ExpDict.h"
/**
* this class implements an iterator for inverse attributes in an EntityDescriptor's supertypes
* makes use of supertypesIterator and InverseAItr
*
* TODO verify that this iterates correctly!
*/
class superInvAttrIter {
protected:
supertypesIterator sit;
InverseAItr * invIter;
const Inverse_attribute * nextInv;
bool isempty; ///< if true, don't try to access invIter - it is not initialized
public:
/// WARNING this will not iterate over the ia's in the first ed, only in its supertypes! change that?
superInvAttrIter( const EntityDescriptor * ed ): sit( ed ), invIter(0), nextInv( 0 ), isempty( false ) {
reset();
}
void reset( const EntityDescriptor * ed = 0 ) {
sit.reset( ed );
if( invIter ) {
delete invIter;
invIter = 0;
}
if( sit.empty() ) {
isempty = true;
} else {
invIter = new InverseAItr( &( sit.current()->InverseAttr() ) );
nextInv = invIter->NextInverse_attribute();
if( !nextInv ) {
next();
}
}
}
~superInvAttrIter() {
if( invIter ) {
delete invIter;
invIter = 0;
}
}
const EntityDescriptor * currentEDesc() {
if( isempty ) {
return NULL;
}
return sit.current();
}
bool empty() {
if( isempty ) {
return true;
}
return ( !sit.hasNext() && !nextInv );
}
const Inverse_attribute * next() {
if( isempty ) {
return NULL;
}
const Inverse_attribute * ia = nextInv;
/* if we're on the last inverse attr for the current super, go to the next super
* keep going until we find an ia or run out of supers */
while( ( 0 == ( nextInv = invIter->NextInverse_attribute() ) ) && sit.hasNext() ) {
invIter->ResetItr( &( sit.next()->InverseAttr() ) );
}
return ia;
}
};
#endif //SUPERINVATTRITER_H
+26 -15
View File
@@ -1,22 +1,33 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#c++ tests for clstepcore
INCLUDE_DIRECTORIES( ${SC_SOURCE_DIR}/src/cldai ${SC_SOURCE_DIR}/src/cleditor ${SC_SOURCE_DIR}/src/clutils
${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/base )
include_directories(
${SC_SOURCE_DIR}/src/cldai ${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/clstepcore
)
function(add_stepcore_test name libs)
SC_ADDEXEC( tst_${name} test_${name}.cc "${libs}" "TESTABLE" )
add_test( NAME build_cpp_${name}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target tst_${name}
--config $<CONFIGURATION> )
add_test( NAME test_${name}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND $<TARGET_FILE:tst_${name}> )
set_tests_properties( build_cpp_${name} PROPERTIES LABELS cpp_unit_stepcore DEPENDS stepcore )
set_tests_properties( test_${name} PROPERTIES LABELS cpp_unit_stepcore DEPENDS build_cpp_${name} )
SC_ADDEXEC(tst_${name} test_${name}.cc "${libs}" "TESTABLE")
add_test(NAME build_cpp_${name}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} --build .
--target tst_${name}
--config $<CONFIGURATION>)
add_test(NAME test_${name}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND $<TARGET_FILE:tst_${name}>)
set_tests_properties(build_cpp_${name} PROPERTIES LABELS cpp_unit_stepcore DEPENDS stepcore)
set_tests_properties(test_${name} PROPERTIES LABELS cpp_unit_stepcore DEPENDS build_cpp_${name})
endfunction(add_stepcore_test name libs)
add_stepcore_test( "SupertypesIterator" "stepcore;steputils;stepeditor;stepdai;base" ) #all these libs are necessary?
add_stepcore_test( "operators_STEPattribute" "stepcore;steputils;stepeditor;stepdai;base" )
add_stepcore_test("SupertypesIterator" "stepcore;steputils;stepeditor;stepdai;base") #all these libs are necessary?
add_stepcore_test("operators_STEPattribute" "stepcore;steputils;stepeditor;stepdai;base")
add_stepcore_test("operators_SDAI_Select" "stepcore;steputils;stepeditor;stepdai;base")
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
@@ -0,0 +1,84 @@
/** \file test_operators_SDAI_Select.cc
* tests for SDAI_Select operators
* currently only implements a test for operator=
* TODO implement others
*/
#include <iostream>
#include "ExpDict.h"
#include "baseType.h"
#include "sdaiSelect.h"
using namespace std;
class TestSdaiSelect: public SDAI_Select {
public:
TestSdaiSelect( SelectTypeDescriptor * s, TypeDescriptor * t, BASE_TYPE b, SDAI_String v, ErrorDescriptor e ):
SDAI_Select( s, t ) {
base_type = b;
val = v;
_error = e;
}
TestSdaiSelect(): SDAI_Select() {}
TestSdaiSelect & operator=( const TestSdaiSelect & other ) {
SDAI_Select::operator=( other );
return *this;
}
SDAI_Select& operator=( const SDAI_Select& other ) {
SDAI_Select::operator=( other );
return *this;
}
/// \return true for match
bool compare( SelectTypeDescriptor * s, TypeDescriptor * t, BASE_TYPE b, SDAI_String * v, ErrorDescriptor * e ) {
bool pass = _type == s;
pass &= underlying_type == t;
pass &= base_type == b;
pass &= val == v->c_str();
pass &= ( _error.severity() == e->severity() ) && ( _error.debug_level() == e->debug_level() );
return pass;
}
// dummy implementations of pure virtual funcs
const TypeDescriptor* AssignEntity( SDAI_Application_instance * /*i*/ ) { return (TypeDescriptor *)0; }
SDAI_Select* NewSelect(){ return (SDAI_Select *)0; }
BASE_TYPE ValueType() const { return sdaiBOOLEAN; }
void STEPwrite_content( std::ostream& /*o*/, const char* /*a*/ ) const {}
Severity StrToVal_content( const char* /*a*/, InstMgrBase* /*m*/ ) { return SEVERITY_NULL; }
Severity STEPread_content(std::istream& i, InstMgrBase* m, const char* c, int n, const char* d) {
(void)i; (void)m; (void)c; (void)n; (void)d; return SEVERITY_NULL;
}
};
/// \return true for success
bool testOperatorEq() {
Schema * sch = 0;
SelectTypeDescriptor s( 5, "a", sdaiBOOLEAN, sch, "b" );
TypeDescriptor t;
BASE_TYPE b = sdaiAGGR;
SDAI_String v( "test string" );
ErrorDescriptor e( SEVERITY_MAX, 99 );
TestSdaiSelect s1( &s, &t, b, v, e );
TestSdaiSelect s2;
s2 = s1;
if( s2.compare( &s, &t, b, &v, &e ) ) {
return true;
} else {
cerr << __FILE__ << ":" << __LINE__ << " - error: test for SDAI_Select::operator= failed" << endl;
return false;
}
}
int main( int /*argc*/, char ** /*argv*/ ) {
bool pass = true;
pass &= testOperatorEq();
//TODO test other operators
cerr << "FIXME this test is incomplete!" << endl;
if( pass ) {
exit( EXIT_SUCCESS );
} else {
exit( EXIT_FAILURE );
}
}
+33 -25
View File
@@ -1,35 +1,43 @@
set(LIBSTEPUTILS_SRCS
Str.cc
dirobj.cc
gennode.cc
gennodelist.cc
gennodearray.cc
sc_hash.cc
errordesc.cc
)
Str.cc
dirobj.cc
gennode.cc
gennodelist.cc
gennodearray.cc
sc_hash.cc
errordesc.cc
)
SET(SC_CLUTILS_HDRS
dirobj.h
errordesc.h
gennodearray.h
gennode.h
gennodelist.h
sc_hash.h
Str.h
)
set(SC_CLUTILS_HDRS
dirobj.h
errordesc.h
gennodearray.h
gennode.h
gennodelist.h
sc_hash.h
Str.h
)
include_directories(
${SC_SOURCE_DIR}/src/base
${SC_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}
)
${SC_SOURCE_DIR}/src/base
${SC_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}
)
SC_ADDLIB(steputils "${LIBSTEPUTILS_SRCS}" "base")
IF(MINGW OR MSVC OR BORLAND)
TARGET_LINK_LIBRARIES(steputils shlwapi.lib)
ENDIF()
if(MINGW OR MSVC OR BORLAND)
target_link_libraries(steputils shlwapi.lib)
endif()
install(FILES ${SC_CLUTILS_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/clutils)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/clutils)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

Some files were not shown because too many files have changed in this diff Show More