Compare commits

..
Author SHA1 Message Date
Mark Pictor ba74c53ca0 for std::thread, change reference args to pointers
I ran into an error "...error: no type named 'type' in class std::result_of..."
Google led me to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57716
and I eliminated the error by changing references to pointers as described at
http://stackoverflow.com/questions/15235885/invalid-initialization-of-non-const-reference-with-c11-thread
2014-08-21 20:27:36 -04:00
hoiji09 5dc00ba03f Merge remote-tracking branch 'origin/master' into hj/thread-safety
Conflicts:
	src/clstepcore/instmgr.cc
2014-08-18 19:37:13 +05:30
hoiji09 1265e0c110 Added exit(success/fail) in thread-safety test 2014-08-18 17:45:31 +05:30
hoiji09 e73ad4df1c instMgrAdapter took dependency on sc_thread
lazyTypes.h was also modified. HAVE_STD_THREAD macros were removed from cllazyfile library *.cc and *.h since classes sc_thread and sc_mutex internally handles the macros.
2014-08-18 17:28:30 +05:30
hoiji09 f0fdfd706f Added class sc_thread in sc_thread.h 2014-08-18 17:25:58 +05:30
hoiji09 bac1435936 Added sc_thread.h in clutils
This acts like a wrapper to some of the thread functionalities (like get_id()) which is being used in stepcode. If the compiler does not supports thread functionalities then this class provides dummy types and functionalities.
2014-08-18 17:00:01 +05:30
hoiji09 54457e567a Utilized sc_mutex in cllazyfile
Earlier std::mutex was being used. It was replaces with sc_mutex which acts like a wrapper to std::mutex
2014-08-18 16:56:06 +05:30
hoiji09 2aa936b601 Corrected a coment sc_mutex.h 2014-08-18 14:08:18 +05:30
hoiji09 85a248a50a Added NO_REGISTRY Macro to lazy_thread_safety_test
lazy_thread_safety_test had 2 checks which were schema dependent. These checks are now wrapped in NO_REGISTRY macro.
2014-08-18 11:57:17 +05:30
hoiji09 03981d27e0 One more subclass of SDAI__set
Adding the Remove( SDAI_ptr ) API to SDAI__set made SDAI_Application_instance__set a candidate for inheriting common logic from SDAI__set.
Note: This class was already made thread safe in one of the previous commits. This commit only removes the now apparent duplicate code.
2014-08-15 23:25:32 +05:30
hoiji09 f26cb0457d Added SDAI__set::Remove( SDAI_ptr ) function
The semantics of this function would be similar to SDAI__set::Remove( SDAI__set::Index( SDAI_ptr ) ). The only difference would be that in the new function both the operations are done under a single lock.
Wherever the old Remove( Index( SDAI_ptr ) ) code snippet was found, it was replaced by the new Remove( SDAI_ptr ) function.
2014-08-15 22:56:49 +05:30
hoiji09 42d71188fc Made SDAI__set thread safe
This was done by introducing a mutex in the SDAI__set class.
2014-08-15 22:20:09 +05:30
hoiji09 40c3a1c33b Made use of sdaiSet
The classes in cldai which were chosen to inherit from sdaiSet were: SDAI_DAObject__set, SDAI_Entity_extent__set and SDAI_Model_contents__list.
2014-08-15 21:46:48 +05:30
hoiji09 fa75e8cedd Added class sdaiSet in cldai library
This class will act as a superclass of few other classes in the same library, hence will contain the common logic of its subclasses.
2014-08-15 21:41:50 +05:30
hoiji09 b17bcbdaf0 Removed warning from SDAI_instance__set commit 2014-08-15 20:41:30 +05:30
hoiji09 731673f827 Thread safety in SDAI_Application_instance__set
Done by introducing a recursive_mutex in the SDAI_Application_instance__set class.
2014-08-13 21:06:26 +05:30
hoiji09 e941244617 Added a comment about thread safety in STEPfile 2014-08-13 11:15:41 +05:30
hoiji09 91efe7c0e5 Safe attributes iteration in STEPfile 2014-08-13 10:55:12 +05:30
hoiji09 02b41416fb Safe InstMgr iteration in STEPfile
Variables of class InstMgr were being iterated upon in class STEPfile through the variables _instances (including its get function instances()) and _headerInstances. The mtx defined in InstMgr was invoked to make them safe.
2014-08-13 10:44:34 +05:30
hoiji09 9cbe6d1dd9 GetApplication_instanceFromFileId in InstMgr class
The SDAI_Application_instance * GetApplication_instance( MgrNode * ) and MgrNode * FindFileId( int ) methods of class InstMgr were often being used together in the class STEPfile. Hence a special function was created in class InstMgr of the form SDAI_Application_instance * GetApplication_instanceFromFileId( int ) which would take care of locking and consistency issues. This function was then used in STEPfile.
2014-08-13 10:19:24 +05:30
hoiji09 a3ce139347 Protected _headerId in STEPfile (cleditor)
_headerId is a counter used in STEPfile class. Its value can change in ReadHeader and ReadExchangeFile methods. Hence a mutex was introduced in order to protect it.
2014-08-13 10:07:32 +05:30
hoiji09 e3fbc14282 Removed istream *in2 from STEPfile::AppendFile
Originally For the second pass a new istream (in2) was being created and the .step file was being opened again. This was prevented by directing the original istream (in) to the beggining of the .step file.
2014-08-10 22:44:11 +05:30
hoiji09 9f24e3ef64 Optimized ReadReal
Replaced calls to input stream peek & get with judicious use of get.
2014-08-08 20:10:05 +05:30
hoiji09 7f653188c4 Converted GetKeyword to FillKeyword
In the original function a static string was being used. The dependency on the static string was removed by passing a string as a parameter from the caller to callee, so that the function could operate without worrying about thread safety.
The function name change mimics the change in the semantics of the function.
2014-08-08 11:04:21 +05:30
hoiji09 3c616f1455 Made DirObj of clutils thread safe
This was achieved introducing a mutex in the DirObj class. Course-Level (fat) Locking was done only in publically accessed function.
2014-08-06 20:36:25 +05:30
hoiji09 376dc4a482 Thread safety in CmdMgr of cleditor 2014-08-06 20:32:52 +05:30
hoiji09 0fe8bc3a91 Made ReplicateList in cleditor thread safe
Used mtxP of the superclass SingleLinkList to ensure thread safety
2014-08-06 20:31:25 +05:30
hoiji09 dc5a00f0ea Thread Safety in ComplexCollect
A mutex was introduced to proctect the counter and the pointer to clists.
The insert and remove functions were tricky to make thread safe as clists may or may-not have been initialized. Hand-over-hand locking was used.
2014-08-03 00:51:47 +05:30
hoiji09 27f781477c Thread safety in ComplexList
Like the classes before, used sharedMtxP to protect the EntNode list whenver it was being iterated upon.
Also added a public mutex to protect the public next pointer. Resposibilty of using it will fall to the class which is using next pointer (ComplexCollect)
2014-08-03 00:19:22 +05:30
hoiji09 1095f7346d Thread safety in OrList
Similar to AndList. However the mutex belonging to the superclass EntList was used to protect various counters (choiceCount, choice) used by OrList
2014-08-03 00:10:18 +05:30
hoiji09 3c848a5d2b Thread safety in Join-, And-, AndOr- List
sharedMtxP of EntNode class was invoked to keep the list of EntNode consistent whenever the EntNode list was being used multiple times in a function
2014-08-02 23:36:36 +05:30
hoiji09 79c9901662 Thread safety in MultList
The mutex defined in the superclass EntList was used in the function appendList.
2014-08-02 23:23:54 +05:30
hoiji09 07448b77d6 Thread Safety in SimpleList
Used sharedMtxP defined in EntNode class to protect EntNode list structure which was being accessed in functions of SimpleList class
2014-08-02 23:01:21 +05:30
hoiji09 0a45ce2aa5 Thread safety in EntList.
Under the assumptions that an EntList object cannot be inserted in between two EntList objects and cannot be removed from a list of EntList objects, making this class thread safe became trivially easy.
One mutex per EntList object was introduced to support appending of EntList objects. As this feature would be used by its subclass (MultList)
2014-08-02 22:32:00 +05:30
hoiji09 3fdbe460f1 Made STEPcomplex thread safe
The assumption used was that STEPcomplex class wont in future provide an API through which threads can remove / insert a STEPcomplex node.
Three already declared mutexes were used in for this purpose:
(1) A recursive mutex for each STEPcomplex node (borrowed from the superclass SDAI_Application_instance)
(2) A recursive mutex belonging to AttrDescriptorList class (originally defined in SingleLinkList class)
(3) A recursive shared mutex belonging to EntNode class.

The fixed order between the locks was: (2) > (1). (3) was independent.
2014-07-24 23:06:21 +05:30
hoiji09 2cabefa944 Minor STEPcomplex optimization
Collapsed an if condition into a while condition without changing the semantics
2014-07-24 22:47:23 +05:30
hoiji09 7233d604a1 Fixed locking in sdaiApplication_instance.cc
The STEPattributeList data was being iterated and modiefied by the SDAI_Application_instance class without invoking the mutex of the STEPattribute class. This was fixed in this commit.
2014-07-24 22:31:26 +05:30
hoiji09 06b7ee5823 Made sdaiSelect::CanBe( BASE_TYPE ) thread safe. 2014-07-22 11:03:32 +05:30
hoiji09 36d4876333 Locking in ExpDict.cc
There were some functions in ExpDict.cc that were not properly locked before. Locking was done in them
2014-07-22 10:54:10 +05:30
hoiji09 cdede9ee27 Made SDAI_Application_instance thread safe.
This was done by introducing a mutex for each SDAI_Application_instance.
AppendMultInstance was made thread safe by doing hand to hand locking.
GetMiEntity was made thread safe acquiring locks in increasing order and releasing locks in decreasing order.
The checks in sdaiApplication_instance_thread_safety_test now pass.
2014-07-18 20:49:02 +05:30
hoiji09 66999c76aa Internal changes in sdaiApplication_instance.cc
These changes have been done to facitilate the use of mutexes to make the SDAI_Application_instance class thread safe. (No mutex has been used introduced yet)
2014-07-18 16:02:12 +05:30
hoiji09 62761ceba8 Added test for checking thread safety
This test would check thread safety for AppendMultInstance & GetMiEntity functions in class SDAI_Application_instance. The tests failed for both.
Rest of the functions were not checked since the locking in them was trivial.
2014-07-18 15:00:28 +05:30
hoiji09 1aa1ed110f Redefined GetMiEntity API
GetMiEntity function is a part of SDAI_Application_instance class. The function now accepts const char * (instead of char *) as parameter.
2014-07-18 14:54:19 +05:30
hoiji09 10f041c779 Made STEPattributeList thread safe
Couple of functions were identified as vulnerable. The mutex defined in the superclass SingleLinkList was used.
2014-07-18 14:46:45 +05:30
hoiji09 25081dfa0e Removed the infinite recursion bug in STEPattribute
The bug would surface if a STEPattribute instance which has been redefined, has its ShallowCopy function invoked.
2014-07-18 14:35:31 +05:30
hoiji09 ca7594bd75 Removed garbage characters 2014-07-13 22:43:40 +05:30
hoiji09 b7cc806a57 Made EntNode of complexSupport.h thread safe
Since EntNode had no covering list counterpart, a shared recursive mutex was introduced. The pointer to this mutex would be with every node.
2014-07-12 18:55:33 +05:30
hoiji09 cb1f402b15 Made STEPaggregrate thread safe.
This was done by relying on the mtx used by its superclass: SingleLinkList.
2014-07-12 16:40:46 +05:30
hoiji09 25ec194b33 Modified add_schema_dependent_test module
Some of the unit tests were failing due to assertions failures inside mutexes.
Ultimately the CMakeFiles were changed and all the tests except of 'test_inverse_attr3' are passing
2014-07-12 13:52:33 +05:30
hoiji09 832154ae44 Made SubSuperIterators.h thread safe
This was done by introducing a recursive mutex meant to protect the std::deque 'q' and unsigned integer 'position'
2014-07-10 17:04:37 +05:30
hoiji09 6e5475e37d Removed duplicated code in SubSuperIterators.cc 2014-07-10 16:33:23 +05:30
hoiji09 529d3a0ca0 Duplicate code was removed in STEPaggregrate
STEPaggregrate and its superclass SingleLinkList.cc had the same destructor.
2014-07-10 11:18:38 +05:30
hoiji09 d169a58ec5 Changes in cmake to build lazy tests
Some changes in cmakefiles had caused the test associated with lazy_test to stop building. Those changes were reviewed and corrected.
2014-07-09 22:02:34 +05:30
hoiji09 e951c2c71a Corrected SingleLinkedList mtx bug
The mtx is converted into sc_recursive_mtx deleted in the destructor
2014-07-09 21:12:16 +05:30
hoiji09 077633aa77 Made Registry Schema and Type operations thread safe
All the checks in Registry_thread_safety_test now pass
2014-06-25 22:26:17 +05:30
hoiji09 58ca507d13 Made the Registry entity operation thread safe
The checks related entity operations in Registry_thread_safety_test now pass.
2014-06-25 22:15:00 +05:30
hoiji09 738d1820df Added test to check thread safety of Registry class
The Entity, Schema and Type operations are tested. For each, there are 3 checks: Add-Add, Remove-Remove, Add-Remove.
For every check the two operation are done first serially and then parallely. Their results are then compared.
2014-06-25 12:05:20 +05:30
hoiji09 391180bc2d Made Schema thread safe by using 3 mutexes.
The 3 mutexes were used to protect the _function_list, _procedure_list & _global_rules data structures.
The first two are vectors. The last is already a thread safe structure, however its being lazy-initilized hence a mutex is needed.
2014-06-25 11:56:11 +05:30
hoiji09 fe33e5d5cb Made Global_rule thread safe by using a mutex.
Even though its superclass i.e Dictionary_instance__set was made thread safe, thread safety in functions 'entities_' and 'where_rules_' was being violated
2014-06-25 11:51:09 +05:30
hoiji09 cf9a203988 Made Dictionary_instance__set thread safe. 2014-06-25 11:45:08 +05:30
hoiji09 6b97cbe906 Made SingleLinkList class thread safe
This was done by adding a mutex. Also a cmake file was modified inorder to compile the above changes.
2014-06-25 11:37:10 +05:30
hoiji09 643da31f92 Added a missing return statement 2014-06-23 17:26:34 +05:30
hoiji09 e02ce60f9d Made Where_rule__list a subclass.
The superclass was Dictionary_instance__set
2014-06-22 22:11:31 +05:30
hoiji09 3db2ab29c0 Took Dependency on Dictionary_instance__set
Explicit_item_id__set, Implicit_item_id__set, Interface_spec__set, Global_rule__set and Uniqueness_rule__set became subclass of Dictionary_instance__set.
Lot of Duplicated code was removed this way
2014-06-22 21:56:39 +05:30
hoiji09 dc8e00b794 Added Dictionary_instance__set
This class is intended to be a superclass of all the *__set classes. This will help to removve duplicate code
2014-06-22 21:52:15 +05:30
hoiji09 2a4d42e596 Added std_recursive_mutex in GenNodeArray.
Also modified classes which inherit the above accordingly
2014-06-18 22:43:31 +05:30
hoiji09 29ec4e33e1 Minor refractoring in MgrNodeArray
This will be helpful when we introduce a mutex in GenNodeArray.
2014-06-18 22:34:02 +05:30
hoiji09 d0e9aa9dfb Added GetGenNode function in GenNodeArray.
This function is a safer couterpart to [] function.
Replaced call to the [] function with calls to GetGenNode function. Was feasable since the former is only used for getting GenericNode pointers.
2014-06-18 22:26:42 +05:30
hoiji09 d6c133f805 Introduced recursive_mutex in gennodelist
mgrnodelist which inherits gennodelist was also changed
2014-06-18 22:08:39 +05:30
hoiji09 ad6752a80f Used containingList to remove duplicate code. 2014-06-18 22:00:48 +05:30
hoiji09 f89e3c4999 Modified the insert function in gen/mgr/disp lists.
The new insert function checks whether the existing node belongs to the same list or not. If it doesn't it does nothing and returns false.
This will be very helpful when introducing thread safety in list structures.
2014-06-18 21:51:28 +05:30
hoiji09 17c720206a Added another occurance of containingList 2014-06-18 21:49:32 +05:30
hoiji09 05360da87c Added containingList pointer in GenericNode
This pointer will point to the list of which the node is part of. Also moved some code between files.
2014-06-18 21:41:39 +05:30
hoiji09 d6ad56ee6c Locked more potentially thread-unsafe functions. 2014-06-18 11:51:18 +05:30
hoiji09 79f9473d01 Added sc_recursive_mutex
This will be used to handle situtations where there are 2 public apis. Both modify an internal data structure, hence lock it.
However one API depends on other. Thereby it will have to-reobtain the lock.
2014-06-18 11:44:54 +05:30
hoiji09 f6b92019b1 Corrected locking in getApplication_Instance 2014-06-18 11:41:26 +05:30
hoiji09 65f767aa7b Increasing the number of iterations.
A print statement is also corrected.
2014-06-18 11:30:41 +05:30
hoiji09 164c0651e1 Made Append / Delete in instmgr thread safe.
The InstMgr_thread_safety_test passes. Had to a change file in cmake directory in order to compile the changes.
2014-06-15 14:40:41 +05:30
hoiji09 485fad46ca Removed duplicate code 2014-06-15 14:34:23 +05:30
hoiji09 d990137d1b Modified CMakeLists.txt to include HAVE_STD_THREAD defs.
The cmake files of cldai, cleditor & clstepcore libraries have been changed.
2014-06-15 14:27:23 +05:30
hoiji09 5cba5e6a8a Added a test for checking thread safety in instmgr
The test tries to insert and delete instances simultaneosly, sequentially and parallely and later compares there results for any disparity.
2014-06-15 14:21:16 +05:30
hoiji09 e67a5f51d1 Added sc_mutex.h to src/clutils
It is wrapper to std::mutex. It does nothing if HAVE_STD_MUTEX is not defined.
2014-06-15 13:32:17 +05:30
hoiji09 7981d8835b Function comments 2014-06-08 11:23:09 +05:30
hoiji09 0972caa573 Function comments made to follow conventions 2014-06-08 11:21:23 +05:30
hoiji09 313e99c7f3 Finer grain locking in loadInstance
Also doing double checking in the thread safe version for better performance in case of many threads.
2014-06-02 23:03:01 +05:30
hoiji09 b20c9860a3 Added openFileSafely( fname ) functionality
Plenty of mutexes were used for this purpose. Fine grain locking addInstance in function.
The code passes the test for thread safety in opening multiple files.
2014-06-02 22:52:28 +05:30
hoiji09 5558c7f0b1 lazyInstMgr::registerDataSection semantics changed
Keeping in mind the thread safety, registring a data section is now a two step process. In first step an entry is reserved, by filling it with a null value, and getting its index. In the second step the null value is replaced with the new value.
The destructor has been changed keeping in mind that a _dataSection entry might also be a null. Destroying _instanceTypes data structure in the destructor
2014-06-02 22:37:31 +05:30
hoiji09 1700288489 Removed static variable nextFreeInstance
This was done my making the static variable an object variable. Hence now it is possible that different threads give header instances present in different file, same instanceID
2014-06-02 22:23:28 +05:30
hoiji09 0e2ab604e9 Removed static variable (string str) in sectionReader.cc
The function sectionReader::getDelimitedKeyword( delims ) was changed to sectionReader::fillDelimitedKeyword( delims, string& ).
This was done to make reading from the file stream thread safe.
2014-06-02 22:17:08 +05:30
hoiji09 22a6b9014f Added a compatible wrapper for mutex lock / unlock
This wrapper will invoke the corresponding lock or unlock function std::thread is supported or a dummy function if not.
Hence the wrapper can be easily be used by functions irrespective of whether std::mutex is supported or not.
2014-06-02 22:08:33 +05:30
hoiji09 b865666b55 Added test for opening multiple files in parallel
The test fails with a string error
2014-06-02 22:01:25 +05:30
hoiji09 343c9c54e2 Added FindFileIdSafely and GetSTEPentitySafely functions
A new typedef in lazyTypes had to be introduced mapping threadId to a pointer to a mgrNodeHelper instance.
The test for thread safety was passed by the code.
2014-05-28 21:02:04 +05:30
hoiji09 21aa179953 Added test checking thread safety of getSTEPentity()
The test was created by modifying the test for checking thread safety of loadInstance. The test failed due to a abort from lazy parser
2014-05-28 20:54:45 +05:30
hoiji09 80d021e4cb Added thread safe loadInstanceSafely( instanceID )
It passes the test added earlier
2014-05-28 20:49:58 +05:30
hoiji09 5f38d1bd93 Added test for checking thread safety of loadInstance
The check fails with a abort comming from the parser as loadInstance is not thread safe
2014-05-28 20:46:47 +05:30
hoiji09 c6800fc9b4 Initializing _mainRegistry to 0 in lazyInstMgr constructor
This was needed to prevent the assert in setRegistry from failing under the following workload
lazyInstMgr * mgr = new lazyInstMgr;
mgr->initRegistry( SchemaInit );
mgr->openFile( fileName );
delete mgr;
lazyInstMgr * mgr = new lazyInstMgr;
mgr->initRegistry( SchemaInit );
2014-05-28 20:31:56 +05:30
hoiji09 4bd2682b51 Fixed an appearance of a warning in loadInstance(id)
Earlier even if the instance 'id' had already been loaded before, the function would display a warning that the instance 'id' was not found in any section
2014-05-28 20:17:02 +05:30
hoiji09 e357da8a75 Fixed lazy parser not handling newlines in step files
This bug was first noticed when trying to lazy-load instance: 637538274 in data/cd209/ATS1-out.stp.
The parser now stores the first whitespace character and skips the following whitespaces. It then compares the first whitespace character and the character in the current position with the set of provided delimeters to determine whether correct delimeter has been reached.
2014-05-28 20:09:26 +05:30
hoiji09 97e6b9b3c6 Explicit HAVE_STD_THREAD decleration through CMake 2014-05-28 19:34:00 +05:30
hoiji09 14107427b9 Added thread-safe instance dependencies counterpart 2014-05-27 22:13:16 +05:30
hoiji09 c2aecfb649 Added HAVE_STD_THREAD on mutex declerations also. 2014-05-27 19:22:58 +05:30
hoiji09 f511696c5d Used the HAVE_STD_THREAD macro
HAVE_STD_THREAD macro was used in src/cllazyfile/CMakeLists.txt and various *.cc and *.h files. The *safely functions have clubbed together in this commit
2014-05-27 18:45:38 +05:30
hoiji09 705483d0ab Catered to unsigned-signed overflow 2014-05-27 17:28:54 +05:30
hoiji09 ab3c2d4717 Commented on which step file was used in the test 2014-05-23 11:27:03 +05:30
hoiji09 88545df537 Added thread safe count and getInstances function
The functions are countInstancesSafely( string type ) and getInstancesSafely( string type )
2014-05-23 11:18:48 +05:30
hoiji09 cc3c4ec705 Added test for checking thread safety.
The test checks for thread safety in retrieving the list of instances of a particular type.
2014-05-23 11:04:17 +05:30
hoiji09 8a528de01c Removed Redundant Code and better formatting. 2014-05-23 10:44:52 +05:30
hoiji09 c0e26cda16 Added getFwdRefsSafely() and getRevRefsSafely()
These functions are thread safe counterparts to getFwdRefs() and getRevRefs() respectively. The CMakeFiles have been modified to make this test run. They will be restored in the later commits.
2014-05-19 19:08:50 +05:30
hoiji09 a47447a7f9 Improved thread safety test
Moved mgr->getFwdRefs() inside the thread workload
2014-05-19 10:18:22 +05:30
hoiji09 8b8cde064f Added Test for checking thread safety
Currently it only checks whether concurrent read accesses to _fwdInstanceRefs & _revInstanceRefs are thread safe our not.
2014-05-19 09:33:05 +05:30
hoiji09 025ffba8fd Removed signed-unsigned comparison warning 2014-05-13 17:53:42 +05:30
596 changed files with 122850 additions and 219882 deletions
-286
View File
@@ -1,286 +0,0 @@
name: STEPCODE
on:
workflow_dispatch:
pull_request:
jobs:
windows:
name: Windows Latest MSVC
runs-on: windows-latest
strategy:
fail-fast: true
steps:
- name: Setup - CMake
uses: lukka/get-cmake@latest
- name: Setup - Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Checkout
uses: actions/checkout@v2
- name: Add github workspace to path
# https://github.community/t/deprecated-add-path/136621
run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Add cl.exe to PATH
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
run: |
cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DSC_ENABLE_TESTING=ON
# We do the following in order to help ensure files are "flushed"
# to disk before compilation is attempted
# https://superuser.com/a/1553374/1286142
powershell Write-VolumeCache C
powershell Write-VolumeCache D
- name: Build
run: cd build && ninja -j1 -v
- name: Test
run: |
cd build && ctest --verbose -j1 .
linux:
name: Ubuntu Latest GCC
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Setup - CMake
uses: lukka/get-cmake@latest
- name: Setup - Ninja
uses: seanmiddleditch/gha-setup-ninja@master
# TODO - we will want this when the new parser work comes in,
# as we won't need perplex and the system tools should suffice
# to exercise the generator logic:
#
# - name: Setup - System
# env:
# DEBIAN_FRONTEND: noninteractive
# run: |
# sudo apt-get update
# # Install dev tools
# sudo apt-get install re2c lemon
# sudo apt-get clean
- name: Checkout
uses: actions/checkout@v2
- name: Configure
run: |
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D CMAKE_BUILD_TYPE=Release -DSC_ENABLE_TESTING=ON
- name: Build
run: |
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
cmake --build build --config Release
- name: Test
run: |
cd build && ctest --verbose -j1 . -C Release
linux_clang:
name: Ubuntu Latest Clang
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Setup - CMake
uses: lukka/get-cmake@latest
- name: Setup - Ninja
uses: seanmiddleditch/gha-setup-ninja@master
# TODO - we will want this when the new parser work comes in,
# as we won't need perplex and the system tools should suffice
# to exercise the generator logic:
#
# - name: Setup - System
# env:
# DEBIAN_FRONTEND: noninteractive
# run: |
# sudo apt-get update
# # Install dev tools
# sudo apt-get install re2c lemon
# sudo apt-get clean
- name: Checkout
uses: actions/checkout@v2
- name: Configure
run: |
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
CC=clang CXX=clang++ cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D CMAKE_BUILD_TYPE=Release -DSC_ENABLE_TESTING=ON
- name: Build
run: |
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
CC=clang CXX=clang++ cmake --build build --config Release
- name: Test
run: |
cd build && ctest --verbose -j1 . -C Release
osx:
name: macOS Latest Clang
runs-on: macos-latest
strategy:
fail-fast: true
steps:
- name: Setup - CMake
uses: lukka/get-cmake@latest
- name: Setup - Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Checkout
uses: actions/checkout@v2
- name: Configure
run: |
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
export CC=clang
export CXX=clang++
cmake -S . -G Ninja -B build -D CMAKE_BUILD_TYPE=Release -DSC_ENABLE_TESTING=ON
- name: Build
run: |
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
cd build && ninja -j1
- name: Test
run: |
cd build && ctest --verbose -j1 . -C Release
brlcad_linux:
name: BRL-CAD Linux step-g Test
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Setup - CMake
uses: lukka/get-cmake@latest
- name: Setup - System
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install re2c astyle xsltproc libxml2-utils
sudo apt-get install xserver-xorg-dev libx11-dev libxi-dev libxext-dev libglu1-mesa-dev libfontconfig-dev
sudo apt-get install zlib1g-dev libpng-dev libjpeg-dev libtiff-dev libeigen3-dev libgdal-dev libassimp-dev libopencv-dev
sudo apt-get clean
- name: Clone bext
run: |
git clone https://github.com/BRL-CAD/bext.git
cd bext/stepcode
cmake -E rm -r stepcode
git clone --depth 1 https://github.com/stepcode/stepcode.git -b develop
cd ../..
- name: Build bext
run: |
cmake -E make_directory bext_build
cmake -S bext -B bext_build -DCMAKE_BUILD_TYPE=Release -DUSE_GDAL=OFF -DUSE_TCL=OFF -DUSE_QT=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\bext_output
cmake --build bext_build --config Release -j2
# We only need the build ouputs (bext_output) after this point, so
# clean up to save space for the main BRL-CAD build.
cmake -E rm -rf bext
cmake -E rm -rf bext_build
- name: Checkout
run: |
git clone --depth 1 https://github.com/BRL-CAD/brlcad.git -b main
- name: Configure
run: |
cmake -E make_directory brlcad_build
cd brlcad_build
cmake -S ../brlcad -DBRLCAD_EXT_DIR=${{ github.workspace }}\bext_output -DBRLCAD_ENABLE_GDAL=OFF -DBRLCAD_ENABLE_TCL=OFF -DBRLCAD_ENABLE_QT=OFF -G Ninja
cd ..
- name: Build
run: |
cd brlcad_build
cmake --build . --target step-g
cd ..
- name: Test
run: |
cd brlcad_build
./bin/step-g ../brlcad/db/nist/NIST_MBE_PMI_3.stp -o nist3.g
cd ..
brlcad_windows:
name: BRL-CAD Windows step-g Test
runs-on: windows-latest
strategy:
fail-fast: true
steps:
- name: Setup - CMake
uses: lukka/get-cmake@latest
- name: Add github workspace to path
# https://github.community/t/deprecated-add-path/136621
run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Add cl.exe to PATH
uses: ilammy/msvc-dev-cmd@v1
- name: Clone bext
run: |
git clone https://github.com/BRL-CAD/bext.git
cd bext/stepcode
cmake -E rm -r stepcode
git clone --depth 1 https://github.com/stepcode/stepcode.git -b develop
cd ../..
- name: Build bext
shell: powershell
run: |
cmake -E make_directory bext_build
cmake -S bext -B bext_build -DCMAKE_BUILD_TYPE=Release -DUSE_GDAL=OFF -DUSE_TCL=OFF -DUSE_QT=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\bext_output
cmake --build bext_build --config Release -j2
# We only need the build ouputs (bext_output) after this point, so
# clean up to save space for the main BRL-CAD build.
cmake -E rm -rf bext
cmake -E rm -rf bext_build
- name: Checkout
run: |
git clone --depth 1 https://github.com/BRL-CAD/brlcad.git -b main
- name: Configure
run: |
cmake -E make_directory brlcad_build
cmake -S brlcad -B brlcad_build -DCMAKE_BUILD_TYPE=Release -DBRLCAD_EXT_DIR=${{ github.workspace }}\bext_output -DBRLCAD_ENABLE_GDAL=OFF -DBRLCAD_ENABLE_TCL=OFF -DBRLCAD_ENABLE_QT=OFF -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe"
- name: Build
run: |
cd brlcad_build
cmake --build . --config Release --target step-g
cd ..
- name: Test
run: |
cd brlcad_build
./bin/step-g.exe ../brlcad/db/nist/NIST_MBE_PMI_3.stp -o nist3.g
cd ..
-25
View File
@@ -1,25 +0,0 @@
# Common build directories used in the source tree
/build
/build-*
/.build
# Temporary files
*~
\#*\#
.\#*
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
**/__pycache__/
# OS specific files
.DS_Store
.DS_Store?
# Tool specific patterns
*.kdev4
.kdev_include_paths
# Parser generator intermediate files
*.out
+12
View File
@@ -0,0 +1,12 @@
language: cpp
compiler:
- clang
script: mkdir build && cd build && cmake .. -DSC_ENABLE_TESTING=ON && make -j2 && make -j2 test
branches:
only:
- master
notifications:
irc: "chat.freenode.net#stepcode"
email: scl-dev@groups.google.com
on_success: change
on_failure: always
+1 -7
View File
@@ -5,27 +5,21 @@ 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, keshashah)
Sparks, Devon (devonsparks)
Shah, Kesha (kesha)
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)
+53 -243
View File
@@ -40,263 +40,79 @@
project(SC)
# Minimum required version of CMake
cmake_minimum_required(VERSION 3.12)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 OLD)
endif (POLICY CMP0077)
# SC version
set(SC_VERSION_MAJOR 0)
set(SC_VERSION_MINOR 9)
set(SC_VERSION_PATCH 1)
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH})
set(SC_VERSION_MINOR 7-dev)
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
# Set language standards
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# 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)
# Minimum required version of CMake
cmake_minimum_required(VERSION 2.8.7)
if(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
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")
list(APPEND CMAKE_MODULE_PATH "${SC_CMAKE_DIR}")
if(NOT IS_SUBBUILD)
set(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
else(NOT IS_SUBBUILD)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
endif(NOT IS_SUBBUILD)
# OpenBSD has its own naming conventions. Set a platform variable based on
# the OS name so we can test for it succinctly.
if ("${CMAKE_SYSTEM}" MATCHES ".*OpenBSD.*")
set(OPENBSD ON)
endif ("${CMAKE_SYSTEM}" MATCHES ".*OpenBSD.*")
#---------------------------------------------------------------------
# Set up various relative path variables and build output directories
include(Path_Setup)
#---------------------------------------------------------------------
# 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
if(NOT DEFINED CMAKE_SKIP_BUILD_RPATH)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
endif()
# when building, don't use the install RPATH already
# (but later on when installing)
if(NOT DEFINED CMAKE_BUILD_WITH_INSTALL_RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
endif()
# the RPATH/INSTALL_NAME_DIR to be used when installing
if (NOT APPLE)
if(NOT DEFINED CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
endif()
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
if(NOT DEFINED CMAKE_INSTALL_NAME_DIR)
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
endif()
# add the automatically determined parts of the RPATH which point to
# directories outside the build tree to the install RPATH
if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
#---------------------------------------------------------------------
# Build options
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(BUILD_STATIC_LIBS "Build static libraries" OFF)
option(SC_PYTHON_GENERATOR "Compile exp2python" ON)
option(SC_CPP_GENERATOR "Compile exp2cxx" ON)
option(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
option(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
if (SC_ENABLE_COVERAGE AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
set(CMAKE_CXX_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)
endif (SC_ENABLE_COVERAGE AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
option(SC_ENABLE_ADDRESS_SANITIZER "Enable AddressSanitizer instrumentation" OFF)
option(SC_ENABLE_UNDEFINED_SANITIZER "Enable UndefinedBehaviorSanitizer instrumentation" OFF)
option(SC_ENABLE_THREAD_SANITIZER "Enable ThreadSanitizer instrumentation" OFF)
if(SC_ENABLE_THREAD_SANITIZER AND
(SC_ENABLE_ADDRESS_SANITIZER OR SC_ENABLE_UNDEFINED_SANITIZER))
message(FATAL_ERROR
"SC_ENABLE_THREAD_SANITIZER must use a separate build from "
"AddressSanitizer and UndefinedBehaviorSanitizer"
)
endif()
option(SC_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
mark_as_advanced(SC_BUILD_EXPRESS_ONLY)
option(SC_ENABLE_TESTING "Enable unittesting framework" OFF)
if(SC_ENABLE_TESTING)
if(NOT "${SC_BUILD_EXPRESS_ONLY}" AND NOT DEFINED SC_BUILD_SCHEMAS)
set(SC_BUILD_SCHEMAS "ALL") #test all schemas, unless otherwise specified
endif()
include(CTest)
endif(SC_ENABLE_TESTING)
# testing and compilation options, build output dirs, install dirs, uninstall, package creation, etc
include(${SC_CMAKE_DIR}/SC_Build_opts.cmake)
# SC_ADDEXEC and SC_ADDLIB macros, dllimport/export, etc
include(SC_Targets)
include(${SC_CMAKE_DIR}/SC_Targets.cmake)
# Macros related to paths
include(SC_Paths)
include(${SC_CMAKE_DIR}/SC_Paths.cmake)
# locale stuff
include(SC_Locale)
include(${SC_CMAKE_DIR}/SC_Locale.cmake)
# logic related to regenerating the lexer and parser source code
include(SC_Regenerate)
# create config.h header
include(SC_Config_Headers)
# Apply sanitizer instrumentation after configure-time feature tests so their
# try-compile executables do not depend on sanitizer runtime behavior. Keep
# link flags explicit for CMake 3.12 compatibility (add_link_options was added
# in CMake 3.13).
if(SC_ENABLE_ADDRESS_SANITIZER OR
SC_ENABLE_UNDEFINED_SANITIZER OR
SC_ENABLE_THREAD_SANITIZER)
if(MSVC)
message(FATAL_ERROR "STEPcode sanitizer builds are not yet supported with MSVC")
endif()
include(CMakePushCheckState)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
set(_sc_sanitizer_compile_options)
set(_sc_sanitizer_link_options)
function(sc_require_sanitizer FLAG RESULT_PREFIX)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${FLAG}")
check_c_source_compiles("int main(void) { return 0; }" ${RESULT_PREFIX}_C_SUPPORTED)
check_cxx_source_compiles("int main() { return 0; }" ${RESULT_PREFIX}_CXX_SUPPORTED)
cmake_pop_check_state()
if(NOT ${RESULT_PREFIX}_C_SUPPORTED OR NOT ${RESULT_PREFIX}_CXX_SUPPORTED)
message(FATAL_ERROR
"STEPcode sanitizer mode was requested, but the C/C++ compiler and "
"linker do not support ${FLAG}"
)
endif()
endfunction()
if(SC_ENABLE_ADDRESS_SANITIZER)
sc_require_sanitizer("-fsanitize=address" SC_ASAN)
list(APPEND _sc_sanitizer_compile_options -fsanitize=address)
list(APPEND _sc_sanitizer_link_options -fsanitize=address)
# exp2cxx is executed during the build to generate schema bindings. It
# remains address-instrumented, but leak checking a short-lived build
# tool is both outside the test scope and unsupported under common build
# tracers/sandboxes. Limit this environment to schema generation; CTest
# and installed tools retain the user's normal ASan settings.
set(SC_SCHEMA_GENERATOR_ENVIRONMENT "ASAN_OPTIONS=detect_leaks=0")
endif()
if(SC_ENABLE_UNDEFINED_SANITIZER)
sc_require_sanitizer("-fsanitize=undefined" SC_UBSAN)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "-fsanitize=undefined")
list(APPEND CMAKE_REQUIRED_LIBRARIES "-fsanitize=undefined")
check_c_compiler_flag(
"-fno-sanitize-recover=undefined"
SC_UBSAN_C_NO_RECOVER_SUPPORTED
)
check_cxx_compiler_flag(
"-fno-sanitize-recover=undefined"
SC_UBSAN_CXX_NO_RECOVER_SUPPORTED
)
cmake_pop_check_state()
if(NOT SC_UBSAN_C_NO_RECOVER_SUPPORTED OR
NOT SC_UBSAN_CXX_NO_RECOVER_SUPPORTED)
message(FATAL_ERROR
"STEPcode's fail-fast UndefinedBehaviorSanitizer mode was requested, "
"but the C/C++ compiler does not support "
"-fno-sanitize-recover=undefined"
)
endif()
list(APPEND _sc_sanitizer_compile_options
-fsanitize=undefined
-fno-sanitize-recover=undefined
)
list(APPEND _sc_sanitizer_link_options -fsanitize=undefined)
endif()
if(SC_ENABLE_THREAD_SANITIZER)
sc_require_sanitizer("-fsanitize=thread" SC_TSAN)
list(APPEND _sc_sanitizer_compile_options -fsanitize=thread)
list(APPEND _sc_sanitizer_link_options -fsanitize=thread)
endif()
check_c_compiler_flag("-fno-omit-frame-pointer" SC_SANITIZER_C_FRAME_POINTER_SUPPORTED)
check_cxx_compiler_flag("-fno-omit-frame-pointer" SC_SANITIZER_CXX_FRAME_POINTER_SUPPORTED)
if(SC_SANITIZER_C_FRAME_POINTER_SUPPORTED)
list(APPEND _sc_sanitizer_compile_options
$<$<COMPILE_LANGUAGE:C>:-fno-omit-frame-pointer>
)
endif()
if(SC_SANITIZER_CXX_FRAME_POINTER_SUPPORTED)
list(APPEND _sc_sanitizer_compile_options
$<$<COMPILE_LANGUAGE:CXX>:-fno-omit-frame-pointer>
)
endif()
add_compile_options(${_sc_sanitizer_compile_options})
string(JOIN " " _sc_sanitizer_link_flags ${_sc_sanitizer_link_options})
foreach(_sc_link_type EXE SHARED MODULE)
set(
CMAKE_${_sc_link_type}_LINKER_FLAGS
"${CMAKE_${_sc_link_type}_LINKER_FLAGS} ${_sc_sanitizer_link_flags}"
)
endforeach()
endif()
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 "${SC_BUILD_EXPRESS_ONLY}" AND NOT DEFINED SC_BUILD_SCHEMAS)
if(NOT DEFINED SC_BUILD_SCHEMAS)
list(APPEND CONFIG_END_MESSAGES
"** Note: CMake variable SC_BUILD_SCHEMAS was not set - defaults to building ALL 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()
"** 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)
if(NOT SC_IS_SUBBUILD)
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.")
endif(NOT SC_IS_SUBBUILD)
################
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)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
elseif(BORLAND)
add_definitions(-D__BORLAND__ -D__WIN32__)
else()
add_definitions(-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long)
endif()
@@ -305,6 +121,7 @@ include_directories(
${SC_BINARY_DIR}/include
)
add_subdirectory(src/base)
add_subdirectory(src/express)
add_subdirectory(src/exppp)
add_subdirectory(src/exp2cxx)
@@ -313,7 +130,9 @@ add_subdirectory(src/clstepcore)
add_subdirectory(src/cleditor)
add_subdirectory(src/cldai)
add_subdirectory(src/clutils)
add_subdirectory(src/cllazyfile)
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)
@@ -321,24 +140,14 @@ if(SC_ENABLE_TESTING)
endif(SC_ENABLE_TESTING)
add_subdirectory(doc)
if(NOT SC_IS_SUBBUILD)
#-----------------------------------------------------------------------------
# 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)
endif(NOT SC_IS_SUBBUILD)
# 'make core' builds everything that isn't generated. for devs.
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(STATUS "${_msg}")
message("${_msg}")
endforeach(_msg ${CONFIG_END_MESSAGES})
# Local Variables:
@@ -347,3 +156,4 @@ endforeach(_msg ${CONFIG_END_MESSAGES})
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-48
View File
@@ -1,48 +0,0 @@
# How to contribute
We love contributions!
## Getting started
* Create a github account if you haven't already, and fork the project
* Create a new branch, using a branch name that gives an idea of what the changes are about
* One topic per commit; a number of small commits are better than one big one
* Do not introduce whitespace changes! (**Windows users:** `git config --global core.autocrlf true`)
* Encouraged but not enforced: each commit should stand alone, in the sense that the code should compile and run at that point.
* One major topic per pull request. Commits that fix small things (typos, formatting) are perfectly acceptable in a PR fixing a bug or adding a feature.
* Tests are good. Tests are required unless you're fixing something simple or that was obviously broken.
* Do not change EXPRESS schema definition without reference to an upstream change.
* Make your changes and push them to your GitHub repo
* Once your branch is pushed, submit a pull request.
- enable github option on each PR 'Allow edits from maintainers', refer to github help if necessary
* We'll look at the PR and either merge (possibly after rebase) or add feedback.
- If there isn't any activity within several days send a message to the mailing list - `scl-dev` AT `groups.google.com`.
## Coding Standards
SC's source has been reformatted with astyle. When making changes, try
to match the current formatting. The main points are:
- compact (java-style) brackets:
```C
if( a == 3 ) {
c = 5;
function( a, b );
} else {
somefunc();
}
```
- indents are 4 spaces
- no tab characters
- line endings are LF (linux), not CRLF (windows)
- brackets around single-line conditionals
- spaces inside parentheses and around operators
- return type on the same line as the function name, unless that's
too long
- doxygen-style comments
(see http://www.stack.nl/~dimitri/doxygen/docblocks.html)
If in doubt about a large patch, run astyle with the config file
misc/astyle.cfg.
Download astyle from http://sourceforge.net/projects/astyle/files/astyle/
+97 -36
View File
@@ -1,47 +1,108 @@
STEPcode is provided as a collective work under the 3-clause BSD
license. As some portions are not subject to copyright in some
jurisdictions, see INTENT.md for additional details regarding intent
and history. See the AUTHORS file for a list of contributors and
copyright holders.
Code generated by STEPcode containing substantial parts of STEPcode
complex enough to have copyright protection are subject to the terms
of this license.
STEPcode acknowledgement and/or attribution is appreciated regardless
of license or copyright status.
Modifications to the original NIST code are (C)opyright by their
respective authors. Unless otherwise specified, they are copyright
on the date those changes were committed to whichever repository
they were committed to first (i.e. BRL-CAD on SourceForge.net,
mpictor/StepClassLibrary or stepcode/stepcode on github).
Modifications which were first commited to the repository on github
are licensed under the 3-clause BSD license below. Changes committed
to BRL-CAD either contain license information mentioning BRL-CAD
near the top of the file, or are licensed under the same terms that
NIST used.
********************************************************************
3-Clause BSD License
********************************************************************
3-clause BSD license:
Copyright (c) 2009-2019 STEPcode AUTHORS
Copyright (c) <date committed>, <copyright holder>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
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.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************
2. 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.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
********************************************************************
ORIGINAL NIST TEXT FOLLOWS
********************************************************************
This software was produced by the National Institute of Standards and
Technology (NIST), an agency of the U.S. government, and by statute is
not subject to copyright in the United States. Recipients of this
software assume all responsibility associated with its operation,
modification, maintenance, and subsequent redistribution.
Acknowledgements:
The STEP Class Library (SCL) was developed by the Manufacturing
Systems Integration Division at NIST to support testing of the
Standard for the Exchange of Product Model Data (a.k.a STEP) and
validation of STEP's emerging implementation specifications. Funding
for the project has come from the Department of Commerce and the
Department of Defense agencies including the Office of the Defense
CALS (Continuous Acquisition and Life-Cycle Support) Executive and
the Defense Advanced Research Projects Agency (DARPA). Recent
enhancements were sponsored by the National Information Infrastructure
Protocols Consortium and NIST's Systems Integration for Manufacturing
Applications (SIMA) program.
/* ********************************************************************
* D I S C L A I M E R
* (February 6, 1992)
*
* There is no warranty for the NIST PDES Toolkit.
* If the NIST PDES Toolkit
* is modified by someone else and passed on, NIST wants
* the Toolkit's recipients to know that what they have is not what NIST
* distributed.
*
* Policies
*
* 1. Anyone may copy and distribute verbatim copies of the NIST PDES Toolkit
* source code as received in any medium.
*
* 2. Anyone may modify your copy or copies of the NIST PDES Toolkit source
* code or any portion of it, and copy and distribute such modifications
* provided that all modifications are clearly associated with the entity
* that performs the modifications.
*
* NO WARRANTY
* ===========
*
* NIST PROVIDES ABSOLUTELY NO WARRANTY. THE NIST PDES TOOLKIT
* IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS
* WITH YOU. SHOULD ANY PORTION OF THE NIST PDES TOOLKIT PROVE DEFECTIVE,
* YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
*
* IN NO EVENT WILL NIST BE LIABLE FOR DAMAGES,
* INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL,
* INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
* INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
* BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
* FAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
* NIST) THE PROGRAMS, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
*/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+1 -1
View File
@@ -5,7 +5,7 @@ This repo was moved and renamed in May 2012. Previously, it was at
http://github.com/mpictor/StepClassLibrary
Some are duplicates of changes recorded in the BRL-CAD repo:
https://github.com/BRL-CAD/brlcad/tree/158beae4556d94821938368951546384cba53107/src/other/ext/stepcode
http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/src/other/step/?view=log
Pre-BRL-CAD changes:
************************************************************************
+1 -7
View File
@@ -51,13 +51,7 @@ Installation
-DSC_BUILD_SCHEMAS=ALL
- Added to make use of ctest easier. If SC_BUILD_SCHEMAS == ALL,
then CMake adds each *.exp file found in data/.
-DSC_EXP2CXX_API_VERSION=2
- opts in to compact descriptor-driven SELECTs and dependency-bounded
entity headers in the generated C++ API.
- clients include the entity headers they use (for example,
entity/SdaiProduct.h); schema.h no longer expands every entity class.
- version 1 remains the default for source compatibility.
-DCMAKE_BUILD_TYPE=Release
-DSC_BUILD_TYPE=Release
- this causes binaries to be built without debugging information
- without this, cmake defaults to a Debug build
-102
View File
@@ -1,102 +0,0 @@
## Licensing Intent
The intent is that this software and documentation ("Project") should
be treated as if it is licensed under the license(s) associated with
the Project ("License") in the `COPYING` file. However, because some
contributors work for the United States (U.S.) Federal Government, it
is not that simple.
The portions of this Project written by United States (U.S.) federal
government employees within the scope of their federal employment are
ineligible for copyright protection in the U.S.; this is generally
understood to mean that these portions of the Project are placed in
the public domain.
In countries where copyright protection is available (which does not
include the U.S.), contributions made by U.S. Federal government
employees are released under the License. Merged contributions from
private contributors are released under the License.
## Background History
STEPcode was originally developed as the STEP Class Libraries (SCL) by
the U.S. National Institute of Standards and Technology (NIST). Prior
to 2009, the U.S. Army Research Laboratory and members of the BRL-CAD
open source community researched freely available open source options
for ISO 10303 STEP support. Development had ceased, no open source
community existed, the code was out of date in many regards, and
additional work was needed to become production-ready, but SCL was
found to be a usable reference implementation.
Consulting with NIST and others circa 2009, the BRL-CAD community
began efforts to take over SCL development, modernization, and code
enhancements. The BRL-CAD community purchased licenses for the ISO
10303 standard and began working to bring SCL up-to-date with the
latest specification. By 2011, significant progress had been made,
the project had garnered attention from others, and STEPcode was
establishd as an independent project.
## Original NIST License Text
This software was [originally] produced by the National Institute of
Standards and Technology (NIST), an agency of the U.S. government, and
by statute is not subject to copyright in the United
States. Recipients of this software assume all responsibility
associated with its operation, modification, maintenance, and
subsequent redistribution.
Acknowledgements:
The STEP Class Library (SCL) was developed by the Manufacturing
Systems Integration Division at NIST to support testing of the
Standard for the Exchange of Product Model Data (a.k.a STEP) and
validation of STEP's emerging implementation specifications. Funding
for the project has come from the Department of Commerce and the
Department of Defense agencies including the Office of the Defense
CALS (Continuous Acquisition and Life-Cycle Support) Executive and
the Defense Advanced Research Projects Agency (DARPA). Recent
enhancements [circa 1992] were sponsored by the National Information Infrastructure
Protocols Consortium and NIST's Systems Integration for Manufacturing
Applications (SIMA) program.
~~~~
/* ********************************************************************
* D I S C L A I M E R
* (February 6, 1992)
*
* There is no warranty for the NIST PDES Toolkit.
* If the NIST PDES Toolkit
* is modified by someone else and passed on, NIST wants
* the Toolkit's recipients to know that what they have is not what NIST
* distributed.
*
* Policies
*
* 1. Anyone may copy and distribute verbatim copies of the NIST PDES Toolkit
* source code as received in any medium.
*
* 2. Anyone may modify your copy or copies of the NIST PDES Toolkit source
* code or any portion of it, and copy and distribute such modifications
* provided that all modifications are clearly associated with the entity
* that performs the modifications.
*
* NO WARRANTY
* ===========
*
* NIST PROVIDES ABSOLUTELY NO WARRANTY. THE NIST PDES TOOLKIT
* IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS
* WITH YOU. SHOULD ANY PORTION OF THE NIST PDES TOOLKIT PROVE DEFECTIVE,
* YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
*
* IN NO EVENT WILL NIST BE LIABLE FOR DAMAGES,
* INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL,
* INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
* INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
* BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
* FAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
* NIST) THE PROGRAMS, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
*/
~~~~
+5 -30
View File
@@ -1,29 +1,4 @@
************************************************************************
STEPcode
http://github.com/stepcode/stepcode
************************************************************************
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
* performance fixes and other changes from BRL-CAD
* finally, all tests pass!
STEPcode -- http://github.com/stepcode/stepcode -- http://stepcode.org
************************************************************************
Release 0.7 (April, 2013)
@@ -179,7 +154,7 @@ There were also some issues with the configure script and some
makefiles which are addressed, as well as a new macro that is at
least required for gcc.
Remaining problem: The p21 file scanner of SCL currently
Remaing problem: The p21 file scanner of SCL currently
does not allow for comments within the parameter list of
data records. Only comments outside of data records are
accepted.
@@ -255,7 +230,7 @@ the TD for label.
- Fixed the casting operator for the class representing EXPRESS
enumeration types. It was returning the last element of the enum type
as the default when the enum was unset. This choice predated enums
as the the default when the enum was unset. This choice predated enums
having an unset enum value. It now returns <enum_name>_unset as the
default when the enum is unset.
@@ -797,7 +772,7 @@ When this case of multiple inheritance is encountered attributes are
duplicated. This case of multiple inheritance may possibly be
avoided by modifying the EXPRESS schema by breaking some links in the
inheritance hierarchy. This will not have an adverse affect on the
implementation. The user may choose to use the current or previous
implemementation. The user may choose to use the current or previous
method of handling multiple inheritance. The current method is the
default behavior. The previous method is obtained by supplying the
-s (or -S) option with the exp2cxx code generator or the mkProbe
@@ -990,7 +965,7 @@ the attribute value field in the entity editor.
If there wasn't a value in the attribute previously, then the field will
contain just the type specifier, e.g., Str1() if Str1 is the type selected.
If a value exists in the field, it is modified to accommodate the new
If a value exists in the field, it is modified to accomodate the new
specifier. This means the following:
o If the value in the field starts with a single-quote ('), it is
assumed to be a string literal, and is completely wrapped in the new
+8 -12
View File
@@ -1,7 +1,5 @@
![Build Status](https://github.com/stepcode/stepcode/actions/workflows/build.yml/badge.svg?branch=develop)
***********************************************************************
STEPcode v0.8 -- github.com/stepcode/stepcode
STEPcode v0.7 -- 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
@@ -34,14 +32,12 @@ SC's source has been reformatted with astyle. When making changes, try
to match the current formatting. The main points are:
- compact (java-style) brackets:
```C
if( a == 3 ) {
c = 5;
function( a, b );
} else {
somefunc( );
}
```
if( a == 3 ) {
c = 5;
function( a, b );
} else {
somefunc( );
}
- indents are 4 spaces
- no tab characters
- line endings are LF (linux), not CRLF (windows)
@@ -58,4 +54,4 @@ Download astyle from http://sourceforge.net/projects/astyle/files/astyle/
***********************************************************************
For more info, see the wiki.
For more info, see the wiki.
+1
View File
@@ -0,0 +1 @@
0.7
+91
View File
@@ -0,0 +1,91 @@
# - Check if the given C source code compiles and runs.
# CHECK_C_SOURCE_RUNS(<code> <var>)
# <code> - source code to try to compile
# <var> - variable to store the result
# (1 for success, empty for failure)
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (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
"-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)
message(STATUS "Performing Test ${VAR}")
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR}
${SOURCE}
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 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")
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)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+15 -130
View File
@@ -10,7 +10,7 @@
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2016 United States Government as represented by
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
@@ -47,136 +47,21 @@
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
mark_as_advanced(LEMON_EXECUTABLE)
if (LEMON_EXECUTABLE)
if(NOT LEMON_TEMPLATE)
# look for the template, if we've not already been told where it is
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
find_file(LEMON_TEMPLATE lempar.c
PATHS "${DATA_DIR}/lemon/lempar.c"
NO_DEFAULT_PATH)
endif ()
# If the above did not succeed, check standard locations
get_filename_component(lemon_dir ${LEMON_EXECUTABLE} DIRECTORY)
find_file(LEMON_TEMPLATE lempar.c
PATHS "${lemon_dir}" "/usr/share/lemon"
NO_DEFAULT_PATH)
mark_as_advanced(LEMON_TEMPLATE)
endif()
# We need a template to be able to use lemon correctly
if(NOT LEMON_TEMPLATE)
message(FATAL_ERROR "Failed to find lemon template file (lempar.c) - need to set LEMON_TEMPLATE")
endif()
# Define the function
# LEMON_TARGET(<Name> <LemonInput> <LemonSource> <LemonHeader>
# [<ArgString>])
# which will create a custom rule to generate a parser. <LemonInput> is
# the path to a lemon file. <LemonSource> is the desired name for the
# generated source file. <LemonHeader> is the desired name for the
# generated header which contains the token list. Anything in the optional
# <ArgString> parameter is appended to the lemon command line.
#
# ====================================================================
# Example:
#
# find_package(LEMON)
# LEMON_TARGET(MyParser parser.y parser.c parser.h)
# add_executable(Foo main.cpp ${LEMON_MyParser_OUTPUTS})
# ====================================================================
include(CMakeParseArguments)
if(NOT COMMAND LEMON_TARGET)
function(LEMON_TARGET Name LemonInput LemonOutput)
set(LT_ARGS DEFINES_FILE COMPILE_FLAGS)
cmake_parse_arguments(LEMON_TARGET_ARG "" "${LT_ARGS}" "" ${ARGN})
if(NOT "${LEMON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
set(LEMON_EXECUTABLE_opts "${LEMON_TARGET_ARG_COMPILE_FLAGS}")
separate_arguments(LEMON_EXECUTABLE_opts)
else()
set(LEMON_EXECUTABLE_opts "")
endif()
# check for LemonOutput
get_filename_component(_basename ${LemonOutput} NAME_WE)
get_filename_component(_out_src_file ${LemonOutput} NAME)
get_filename_component(_out_dir ${LemonOutput} PATH)
if(NOT "${_out_dir}" STREQUAL "")
message(WARNING "Full path specified for LemonOutput - should be filename only")
endif()
# set report file
set(_out_rpt_file "${_basename}.out")
# check for DEFINES_FILE
if ("${LEMON_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
set(_out_hdr_file "${_basename}.h")
else()
get_filename_component(_out_dir ${LEMON_TARGET_ARG_DEFINES_FILE} PATH)
get_filename_component(_out_hdr_file ${LEMON_TARGET_ARG_DEFINES_FILE} NAME)
if(NOT "${_out_dir}" STREQUAL "")
message(WARNING "Full path specified for DEFINES_FILE - should be filename only")
endif()
endif()
# input file
get_filename_component(_in_y_path ${LemonInput} ABSOLUTE)
get_filename_component(_in_y_file ${LemonInput} NAME)
# Stage the source file in the binary directory for lemon. We need to make
# sure it's fully copied, so use a sentinel guard
add_custom_command(
OUTPUT ${_in_y_file}
COMMAND ${CMAKE_COMMAND} -E copy ${_in_y_path} ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}.sentinel
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}.sentinel
DEPENDS ${_in_y_file}
)
add_custom_target(${Name}_input_cpy DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}.sentinel)
# execute lemon
add_custom_command(
OUTPUT ${_out_src_file} ${_basename}.h
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_opts} ${_in_y_file}
DEPENDS ${Name}_input_cpy
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
)
# rename the header
add_custom_command(
OUTPUT ${_out_hdr_file}
COMMAND ${CMAKE_COMMAND} ARGS -E rename ${_basename}.h ${_out_hdr_file}
DEPENDS ${_out_src_file} ${_basename}.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
# set the return values
# TODO: for generated sources even headers should be target dependencies
set(LEMON_${Name}_DEFINED TRUE PARENT_SCOPE)
set(LEMON_${Name}_OUTPUT_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${_out_hdr_file}" PARENT_SCOPE)
set(LEMON_${Name}_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE)
set(LEMON_${Name}_OUTPUTS "${_out_src_file}" PARENT_SCOPE)
# TODO - remove once perplex goes away...
add_custom_target(${Name} DEPENDS ${_out_hdr_file})
# make sure we clean up generated output and copied input
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_out_src_file}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}")
endfunction(LEMON_TARGET)
endif(NOT COMMAND LEMON_TARGET)
endif(LEMON_EXECUTABLE)
if(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
get_filename_component(lemon_path ${LEMON_EXECUTABLE} PATH)
if(lemon_path)
set(LEMON_TEMPLATE "")
if(EXISTS ${lemon_path}/lempar.c)
set(LEMON_TEMPLATE "${lemon_path}/lempar.c")
endif(EXISTS ${lemon_path}/lempar.c)
if(EXISTS /usr/share/lemon/lempar.c)
set(LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
endif(EXISTS /usr/share/lemon/lempar.c)
endif(lemon_path)
endif(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LEMON REQUIRED_VARS LEMON_EXECUTABLE LEMON_TEMPLATE)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEMON DEFAULT_MSG LEMON_EXECUTABLE LEMON_TEMPLATE)
mark_as_advanced(LEMON_TEMPLATE)
#============================================================
# FindLEMON.cmake ends here
+1 -190
View File
@@ -10,7 +10,7 @@
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2016 United States Government as represented by
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
@@ -68,195 +68,6 @@ include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PERPLEX DEFAULT_MSG PERPLEX_EXECUTABLE PERPLEX_TEMPLATE)
mark_as_advanced(PERPLEX_TEMPLATE)
# Defines two macros - PERPLEX_TARGET, which takes perplex inputs 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.
#
# #====================================================================
# Example:
#
# find_package(LEMON)
# find_package(RE2C)
# find_package(PERPLEX)
#
# LEMON_TARGET(MyParser parser.y "${CMAKE_CURRENT_BINARY_DIR}/parser.cpp")
# PERPLEX_TARGET(MyScanner scanner.re "${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp" "${CMAKE_CURRENT_BINARY_DIR}/scanner_header.hpp")
# ADD_PERPLEX_LEMON_DEPENDENCY(MyScanner MyParser)
#
# include_directories("${CMAKE_CURRENT_BINARY_DIR}")
# add_executable(Foo
# Foo.cc
# ${LEMON_MyParser_OUTPUTS}
# ${PERPLEX_MyScanner_OUTPUTS}
# )
# ====================================================================
#
#=============================================================================
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2016 United States Government as represented by
# the U.S. Army Research Laboratory.
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#============================================================
# PERPLEX_TARGET (public macro)
#============================================================
include(CMakeParseArguments)
if(NOT COMMAND PERPLEX_TARGET)
macro(PERPLEX_TARGET Name Input)
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
set(PVAR_PREFIX ${Name}_${IN_FILE_WE})
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${PVAR_PREFIX} "" "TEMPLATE;OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR" "" ${ARGN})
endif(${ARGC} GREATER 3)
# Need a working directory
if("${${PVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
set(${PVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${PVAR_PREFIX}")
endif("${${PVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
file(MAKE_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR})
# Set up intermediate and final output names
# Output source file
if ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
set(${PVAR_PREFIX}_OUT_SRC_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
else ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
get_filename_component(specified_out_dir ${${PVAR_PREFIX}_OUT_SRC_FILE} PATH)
if(NOT "${specified_out_dir}" STREQUAL "")
message(FATAL_ERROR "\nFull path specified for OUT_SRC_FILE - should be filename only.\n")
endif(NOT "${specified_out_dir}" STREQUAL "")
set(${PVAR_PREFIX}_OUT_SRC_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${${PVAR_PREFIX}_OUT_SRC_FILE})
endif ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
# Output header file
if ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
set(${PVAR_PREFIX}_OUT_HDR_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
else ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
get_filename_component(specified_out_dir ${${PVAR_PREFIX}_OUT_HDR_FILE} PATH)
if(NOT "${specified_out_dir}" STREQUAL "")
message(FATAL_ERROR "\nFull path specified for OUT_HDR_FILE - should be filename only.\n")
endif(NOT "${specified_out_dir}" STREQUAL "")
set(${PVAR_PREFIX}_OUT_HDR_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${${PVAR_PREFIX}_OUT_HDR_FILE})
endif ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
# input file
get_filename_component(in_full ${Input} ABSOLUTE)
if("${in_full}" STREQUAL "${Input}")
set(perplex_in_file ${Input})
else("${in_full}" STREQUAL "${Input}")
set(perplex_in_file "${CMAKE_CURRENT_SOURCE_DIR}/${Input}")
endif("${in_full}" STREQUAL "${Input}")
# Intermediate file
set(re2c_src "${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.re")
# Make sure we have a template
if ("${${PVAR_PREFIX}_TEMPLATE}" STREQUAL "")
if(PERPLEX_TEMPLATE)
set(${PVAR_PREFIX}_TEMPLATE ${PERPLEX_TEMPLATE})
else(PERPLEX_TEMPLATE)
message(FATAL_ERROR "\nNo Perplex template file specified - please specify the file using the PERPLEX_TEMPLATE variable:\ncmake .. -DPERPLEX_TEMPLATE=/path/to/template_file.c\n")
endif(PERPLEX_TEMPLATE)
endif ("${${PVAR_PREFIX}_TEMPLATE}" STREQUAL "")
get_filename_component(IN_FILE ${Input} NAME)
add_custom_command(
OUTPUT ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${perplex_in_file} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${${PVAR_PREFIX}_OUT_HDR_FILE} -t ${${PVAR_PREFIX}_TEMPLATE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
DEPENDS ${Input} ${${PVAR_PREFIX}_TEMPLATE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
)
if(NOT DEBUGGING_GENERATED_SOURCES)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
else(NOT DEBUGGING_GENERATED_SOURCES)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
endif(NOT DEBUGGING_GENERATED_SOURCES)
set(PERPLEX_${Name}_DEFINED TRUE)
set(PERPLEX_${Name}_SRC ${${PVAR_PREFIX}_OUT_SRC_FILE})
set(PERPLEX_${Name}_HDR ${${PVAR_PREFIX}_OUT_HDR_FILE})
set(PERPLEX_${Name}_INCLUDE_DIR ${${PVAR_PREFIX}_WORKING_DIR})
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_WORKING_DIR}/${Name}.sentinel
COMMAND ${CMAKE_COMMAND} -E touch ${${PVAR_PREFIX}_WORKING_DIR}/${Name}.sentinel
DEPENDS ${${PVAR_PREFIX}_OUT_SRC_FILE} ${${PVAR_PREFIX}_OUT_HDR_FILE}
)
add_custom_target(${Name} DEPENDS ${${PVAR_PREFIX}_WORKING_DIR}/${Name}.sentinel)
endmacro(PERPLEX_TARGET)
endif(NOT COMMAND PERPLEX_TARGET)
#============================================================
# ADD_PERPLEX_LEMON_DEPENDENCY (public macro)
#============================================================
if(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
macro(ADD_PERPLEX_LEMON_DEPENDENCY PERPLEXTarget LemonTarget)
if(NOT PERPLEX_${PERPLEXTarget}_SRC)
message(SEND_ERROR "PERPLEX target `${PERPLEXTarget}' does not exists.")
endif()
if(NOT TARGET ${LemonTarget})
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
endif()
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_SRC}
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_OUTPUT_HEADER})
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
endif(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
#============================================================
# FindPERPLEX.cmake ends here
+2 -158
View File
@@ -6,165 +6,8 @@
find_program(RE2C_EXECUTABLE re2c DOC "path to the re2c executable")
mark_as_advanced(RE2C_EXECUTABLE)
if(RE2C_EXECUTABLE)
execute_process(COMMAND ${RE2C_EXECUTABLE} -v
OUTPUT_VARIABLE RE2C_version_output
ERROR_VARIABLE RE2C_version_error
RESULT_VARIABLE RE2C_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ${RE2C_version_result} EQUAL 0)
message(SEND_ERROR
"Command \"${RE2C_EXECUTABLE} -v\" failed with output:\n${RE2C_version_output}\n${RE2C_version_error}")
else()
string(REGEX REPLACE "^re2c ([0-9]+[^ ]*)( .*)?$" "\\1" RE2C_VERSION "${RE2C_version_output}")
endif()
# Provide a macro to generate custom build rules:
# RE2C_TARGET(Name RE2CInput RE2COutput [COMPILE_FLAGS <string>])
# which creates a custom command to generate the <RE2COutput> file from
# the <RE2CInput> file. If COMPILE_FLAGS option is specified, the next
# parameter is added to the re2c command line. Name is an alias used to
# get details of this custom command.
# This module also defines a macro:
# ADD_RE2C_LEMON_DEPENDENCY(RE2CTarget LemonTarget)
# which adds the required dependency between a scanner and a parser
# where <RE2CTarget> and <LemonTarget> are the first parameters of
# respectively RE2C_TARGET and LEMON_TARGET macros.
#
# ====================================================================
# Example:
#
# find_package(LEMON)
# find_package(RE2C)
#
# LEMON_TARGET(MyParser parser.y "${CMAKE_CURRENT_BINARY_DIR}/parser.cpp")
# RE2C_TARGET(MyScanner scanner.re "${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp")
# ADD_RE2C_LEMON_DEPENDENCY(MyScanner MyParser)
#
# include_directories("${CMAKE_CURRENT_BINARY_DIR}")
# add_executable(Foo
# Foo.cc
# ${LEMON_MyParser_OUTPUTS}
# ${RE2C_MyScanner_OUTPUTS}
# )
# ====================================================================
#
#=============================================================================
# Copyright (c) 2010-2016 United States Government as represented by
# the U.S. Army Research Laboratory.
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#============================================================
# RE2C_TARGET (public macro)
#============================================================
#
if(NOT COMMAND RE2C_TARGET)
function(RE2C_TARGET Name RE2CInput RE2COutput)
set(_re2c_args COMPILE_FLAGS DEFINES_FILE)
cmake_parse_arguments(RE2C_TARGET_ARG "" "${_re2c_args}" "" ${ARGN})
if(NOT "${RE2C_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(SEND_ERROR "RE2C_TARGET(<Name> <RE2CInput> <RE2COutput>
[COMPILE_FLAGS <string>]
[DEFINES_FILE <string>])")
else()
if(NOT "${RE2C_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
set(RE2C_EXECUTABLE_opts "${RE2C_TARGET_ARG_COMPILE_FLAGS}")
separate_arguments(RE2C_EXECUTABLE_opts)
else()
set(RE2C_EXECUTABLE_opts "")
endif()
if(NOT "${RE2C_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
list(APPEND RE2C_EXECUTABLE_opts -t ${RE2C_TARGET_ARG_DEFINES_FILE})
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RE2COutput}
COMMAND ${RE2C_EXECUTABLE}
ARGS ${RE2C_EXECUTABLE_opts} -o ${RE2COutput} ${CMAKE_CURRENT_SOURCE_DIR}/${RE2CInput}
DEPENDS ${RE2CInput}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
# TODO: check, for generated sources headers should be included in outputs
set(RE2C_${Name}_DEFINED TRUE PARENT_SCOPE)
set(RE2C_${Name}_OUTPUTS ${RE2COutput} PARENT_SCOPE)
if("${RE2C_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
set(RE2C_${Name}_OUTPUT_HEADER "" PARENT_SCOPE)
else()
set(RE2C_${Name}_OUTPUT_HEADER "${RE2C_TARGET_ARG_DEFINES_FILE}" PARENT_SCOPE)
endif()
set(RE2C_${Name}_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE)
endif()
endfunction(RE2C_TARGET)
endif(NOT COMMAND RE2C_TARGET)
#============================================================
#============================================================
# ADD_RE2C_LEMON_DEPENDENCY (public macro)
#============================================================
#
if(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
function(ADD_RE2C_LEMON_DEPENDENCY RE2CTarget LemonTarget)
if(NOT RE2C_${RE2CTarget}_OUTPUTS)
message(SEND_ERROR "RE2C target `${RE2CTarget}' does not exists.")
endif()
if(NOT LEMON_${LemonTarget}_OUTPUT_HEADER)
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
endif()
set_source_files_properties(${RE2C_${RE2CTarget}_OUTPUTS}
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_OUTPUT_HEADER})
endfunction(ADD_RE2C_LEMON_DEPENDENCY)
endif(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
#============================================================
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(RE2C REQUIRED_VARS RE2C_EXECUTABLE
VERSION_VAR RE2C_VERSION)
# RE2C_Util.cmake ends here
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)
# Local Variables:
# tab-width: 8
@@ -172,3 +15,4 @@ find_package_handle_standard_args(RE2C REQUIRED_VARS RE2C_EXECUTABLE
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+81
View File
@@ -0,0 +1,81 @@
# Utility routines for managing generated files with CMake
macro(MD5 filename md5sum)
file(READ "${filename}" RAW_MD5_FILE)
string(REGEX REPLACE "\r" "" STRIPPED_MD5_FILE "${RAW_MD5_FILE}")
string(MD5 ${md5sum} "${STRIPPED_MD5_FILE}")
endmacro(MD5)
macro(FILEVAR filename var)
string(REGEX REPLACE "[^a-zA-Z0-9]" "_" ${var} ${filename})
endmacro(FILEVAR)
macro(VERIFY_FILES filelist warn resultvar)
set(${resultvar} 1)
foreach(fileitem ${filelist})
# Deal with absolute and relative paths a bit differently
get_filename_component(ITEM_ABS_PATH "${fileitem}" ABSOLUTE)
if("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${fileitem}")
else("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${CURRENT_SOURCE_DIR}/${fileitem}")
endif("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
get_filename_component(filename "${fileitem}" NAME)
# Got filename components sorted - proceed
if(NOT EXISTS ${filefullname})
message(FATAL_ERROR "Attempted to verify non-existant file ${filefullname}")
endif(NOT EXISTS ${filefullname})
FILEVAR(${filename} filevar)
if(NOT baseline_${filevar}_md5)
message(FATAL_ERROR "No baseline MD5 available for ${filename} - baseline_${filevar}_md5 is not defined")
endif(NOT baseline_${filevar}_md5)
MD5(${filefullname} ${filevar}_md5)
if(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
if("${warn}" STREQUAL "1")
message("\n${filename} differs from baseline: baseline md5 hash is ${baseline_${filevar}_md5} and current hash is ${${filevar}_md5}\n")
endif("${warn}" STREQUAL "1")
set(${resultvar} 0)
endif(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
endforeach(fileitem ${filelist})
endmacro(VERIFY_FILES filelist resultvar)
macro(WRITE_MD5_SUMS filelist outfile)
foreach(fileitem ${filelist})
# Deal with absolute and relative paths a bit differently
get_filename_component(ITEM_ABS_PATH "${fileitem}" ABSOLUTE)
if("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${fileitem}")
else("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${CURRENT_SOURCE_DIR}/${fileitem}")
endif("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
get_filename_component(filename "${fileitem}" NAME)
# Got filename components sorted - proceed
if(NOT EXISTS ${filefullname})
message(FATAL_ERROR "Attempted to get MD5 sum of non-existant file ${filefullname}")
endif(NOT EXISTS ${filefullname})
FILEVAR(${filename} filevar)
MD5(${filefullname} ${filevar}_md5)
file(APPEND ${outfile} "set(baseline_${filevar}_md5 ${${filevar}_md5})\n")
endforeach(fileitem ${filelist})
endmacro(WRITE_MD5_SUMS)
macro(GET_GENERATOR_EXEC_VERSIONS)
# Read lemon version
execute_process(COMMAND ${LEMON_EXECUTABLE} -x OUTPUT_VARIABLE lemon_version)
string(REPLACE "Lemon version " "" lemon_version "${lemon_version}")
string(STRIP "${lemon_version}" lemon_version)
# Read re2c version
execute_process(COMMAND ${RE2C_EXECUTABLE} -V OUTPUT_VARIABLE re2c_version)
string(STRIP "${re2c_version}" re2c_version)
# Read perplex version
execute_process(COMMAND ${PERPLEX_EXECUTABLE} -v OUTPUT_VARIABLE perplex_version)
string(STRIP "${perplex_version}" perplex_version)
endmacro(GET_GENERATOR_EXEC_VERSIONS)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+146
View File
@@ -0,0 +1,146 @@
# Defines the macro
# LEMON_TARGET(<Name> <LemonInput> <LemonSource> <LemonHeader>
# [<ArgString>])
# which will create a custom rule to generate a parser. <LemonInput> is
# the path to a lemon file. <LemonSource> is the desired name for the
# generated source file. <LemonHeader> is the desired name for the
# generated header which contains the token list. Anything in the optional
# <ArgString> parameter is appended to the lemon command line.
#
# ====================================================================
# Example:
#
# find_package(LEMON)
# LEMON_TARGET(MyParser parser.y parser.c parser.h)
# add_executable(Foo main.cpp ${LEMON_MyParser_OUTPUTS})
# ====================================================================
#
#=============================================================================
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#============================================================
# LEMON_TARGET (public macro)
#============================================================
#
macro(LEMON_TARGET Name LemonInput LemonSource LemonHeader)
if(NOT ${ARGC} EQUAL 4 AND NOT ${ARGC} EQUAL 5)
message(SEND_ERROR "Usage")
else()
get_filename_component(LemonInputFull ${LemonInput} ABSOLUTE)
get_filename_component(LemonSourceFull ${LemonSource} ABSOLUTE)
get_filename_component(LemonHeaderFull ${LemonHeader} ABSOLUTE)
if(NOT ${LemonInput} STREQUAL ${LemonInputFull})
set(LEMON_${Name}_INPUT "${CMAKE_CURRENT_BINARY_DIR}/${LemonInput}")
else(NOT ${LemonInput} STREQUAL ${LemonInputFull})
set(LEMON_${Name}_INPUT "${LemonInput}")
endif(NOT ${LemonInput} STREQUAL ${LemonInputFull})
if(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
set(LEMON_${Name}_OUTPUT_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${LemonSource}")
else(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
set(LEMON_${Name}_OUTPUT_SOURCE "${LemonSource}")
endif(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
if(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
set(LEMON_${Name}_OUTPUT_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${LemonHeader}")
else(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
set(LEMON_${Name}_OUTPUT_HEADER "${LemonHeader}")
endif(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
set(LEMON_${Name}_EXTRA_ARGS "${ARGV4}")
# get input name minus path
get_filename_component(INPUT_NAME "${LemonInput}" NAME)
set(LEMON_BIN_INPUT ${CMAKE_CURRENT_BINARY_DIR}/${INPUT_NAME})
# names of lemon output files will be based on the name of the input file
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.c" LEMON_GEN_SOURCE "${INPUT_NAME}")
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.h" LEMON_GEN_HEADER "${INPUT_NAME}")
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.out" LEMON_GEN_OUT "${INPUT_NAME}")
# copy input to bin directory and run lemon
add_custom_command(
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${LemonInput} ${LEMON_BIN_INPUT}
COMMAND ${LEMON_EXECUTABLE} ${INPUT_NAME} ${LEMON_${Name}_EXTRA_ARGS}
DEPENDS ${LemonInput} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
)
# rename generated outputs
if(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
add_custom_command(
OUTPUT ${LemonSource}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${LemonSource}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
)
set(LEMON_${Name}_OUTPUTS ${LemonSource} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
if(NOT "${LemonHeader}" STREQUAL "${LEMON_GEN_HEADER}")
add_custom_command(
OUTPUT ${LemonHeader}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${LemonHeader}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
)
set(LEMON_${Name}_OUTPUTS ${LemonHeader} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${LemonHeader}" STREQUAL "${LEMON_GEN_HEADER}")
set(LEMON_${Name}_OUTPUTS ${LEMON_GEN_OUT} ${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}")
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}")
# macro ran successfully
set(LEMON_${Name}_DEFINED TRUE)
endif(NOT ${ARGC} EQUAL 4 AND NOT ${ARGC} EQUAL 5)
endmacro(LEMON_TARGET)
#
#============================================================
# LEMON_Utils.cmake ends here
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+134
View File
@@ -0,0 +1,134 @@
# Defines two macros - PERPLEX_TARGET, which takes perplex inputs 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.
#
# #====================================================================
# Example:
#
# find_package(LEMON)
# find_package(RE2C)
# find_package(PERPLEX)
#
# LEMON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
# PERPLEX_TARGET(MyScanner scanner.re ${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp ${CMAKE_CURRENT_BINARY_DIR}/scanner_header.hpp)
# ADD_PERPLEX_LEMON_DEPENDENCY(MyScanner MyParser)
#
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
# add_executable(Foo
# Foo.cc
# ${LEMON_MyParser_OUTPUTS}
# ${PERPLEX_MyScanner_OUTPUTS}
# )
# ====================================================================
#
#=============================================================================
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#============================================================
# PERPLEX_TARGET (public macro)
#============================================================
macro(PERPLEX_TARGET Name Input OutputSrc OutputHeader)
if(${ARGC} GREATER 4)
set(Template ${ARGV4})
else(${ARGC} GREATER 4)
if(PERPLEX_TEMPLATE)
set(Template ${PERPLEX_TEMPLATE})
else(PERPLEX_TEMPLATE)
message(FATAL_ERROR "\nNo Perplex template file specifed - please specify the file using the PERPLEX_TEMPLATE variable:\ncmake .. -DPERPLEX_TEMPLATE=/path/to/template_file.c\n")
endif(PERPLEX_TEMPLATE)
endif(${ARGC} GREATER 4)
get_filename_component(OutputName ${OutputSrc} NAME)
set(re2c_src "${CMAKE_CURRENT_BINARY_DIR}/${OutputName}.re")
add_custom_command(
OUTPUT ${re2c_src} ${OutputHeader}
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${OutputHeader} -t ${Template} ${Input}
DEPENDS ${Input} ${Template} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
)
if(NOT DEBUGGING_GENERATED_SOURCES)
add_custom_command(
OUTPUT ${OutputSrc}
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${OutputSrc} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${OutputHeader} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
else(NOT DEBUGGING_GENERATED_SOURCES)
add_custom_command(
OUTPUT ${OutputSrc}
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${OutputSrc} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${OutputHeader} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
endif(NOT DEBUGGING_GENERATED_SOURCES)
set(PERPLEX_${Name}_DEFINED TRUE)
set(PERPLEX_${Name}_OUTPUTS ${OutputSrc})
set(PERPLEX_${Name}_INPUT ${Input})
endmacro(PERPLEX_TARGET)
#============================================================
# ADD_PERPLEX_LEMON_DEPENDENCY (public macro)
#============================================================
macro(ADD_PERPLEX_LEMON_DEPENDENCY PERPLEXTarget LemonTarget)
if(NOT PERPLEX_${PERPLEXTarget}_OUTPUTS)
message(SEND_ERROR "PERPLEX target `${PERPLEXTarget}' does not exists.")
endif()
if(NOT LEMON_${LemonTarget}_OUTPUT_HEADER)
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
endif()
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_OUTPUTS}
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_OUTPUT_HEADER})
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
#============================================================
# PERPLEX_Utils.cmake ends here
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-164
View File
@@ -1,164 +0,0 @@
# Copyright (c) 2010-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. 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.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#---------------------------------------------------------------------
# Define relative install locations. Don't set these if they have already
# been set by some other means (like a higher level CMakeLists.txt file
# including this one).
# The location in which to install BRL-CAD executables.
if(NOT BIN_DIR)
set(BIN_DIR bin)
endif(NOT BIN_DIR)
# Define a relative path that will "reset" a path back to
# the point before BIN_DIR was appended. This is primarily
# useful when working with generator expressions
unset(RBIN_DIR CACHE)
set(LBIN_DIR "${BIN_DIR}")
while (NOT "${LBIN_DIR}" STREQUAL "")
get_filename_component(LBDIR "${LBIN_DIR}" DIRECTORY)
set(LBIN_DIR "${LBDIR}")
if ("${RBIN_DIR}" STREQUAL "")
set(RBIN_DIR "..")
else ("${RBIN_DIR}" STREQUAL "")
set(RBIN_DIR "../${RBIN_DIR}")
endif ("${RBIN_DIR}" STREQUAL "")
endwhile (NOT "${LBIN_DIR}" STREQUAL "")
# The location in which to install BRL-CAD libraries.
if(NOT LIB_DIR)
set(LIB_DIR lib)
endif(NOT LIB_DIR)
if(NOT LIBEXEC_DIR)
set(LIBEXEC_DIR libexec)
endif(NOT LIBEXEC_DIR)
# The location in which to install BRL-CAD header files.
if(NOT INCLUDE_DIR)
set(INCLUDE_DIR include)
endif(NOT INCLUDE_DIR)
# The location in which to install BRL-CAD data files
if(NOT DATA_DIR)
set(DATA_DIR share)
endif(NOT DATA_DIR)
# The location in which to install BRL-CAD documentation files
if(NOT DOC_DIR)
set(DOC_DIR ${DATA_DIR}/doc)
endif(NOT DOC_DIR)
# The location in which to install BRL-CAD Manual pages
if(NOT MAN_DIR)
set(MAN_DIR ${DATA_DIR}/man)
endif(NOT MAN_DIR)
# Make sure no absolute paths have been supplied to these variables
set(INSTALL_DIRS BIN INCLUDE LIB LIBEXEC DATA MAN DOC)
foreach(instdir ${INSTALL_DIRS})
get_filename_component(instdir_full ${${instdir}_DIR} ABSOLUTE)
if("${${instdir}_DIR}" STREQUAL "${instdir_full}")
message(FATAL_ERROR "Error - absolute path supplied for ${instdir}_DIR. This path must be relative - e.g. \"bin\" instead of \"/usr/bin\"")
set(HAVE_INSTALL_DIR_FULL_PATH 1)
endif("${${instdir}_DIR}" STREQUAL "${instdir_full}")
endforeach(instdir ${INSTALL_DIRS})
#---------------------------------------------------------------------
# Output directories - this is where built library and executable
# files will be placed after building but prior to install. The
# necessary variables change between single and multi configuration
# build systems, so it is necessary to handle both cases on a
# conditional basis.
if(NOT CMAKE_CONFIGURATION_TYPES)
# If we're not doing multi-configuration, just set the three main
# variables to the correct values.
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}/${LIB_DIR} 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 ${${PROJECT_NAME}_BINARY_DIR}/${LIB_DIR} 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 ${${PROJECT_NAME}_BINARY_DIR}/${BIN_DIR} CACHE INTERNAL "Single output directory for building all executables.")
endif(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
else(NOT CMAKE_CONFIGURATION_TYPES)
# Multi-configuration is more difficult. Not only do we need to
# properly set the output directories, but we also need to
# identify the "toplevel" directory for each configuration so
# we can place files, documentation, etc. in the correct
# relative positions. Because files may be placed by CMake
# without a build target to put them in their proper relative build
# directory position using these paths, we must fully qualify them
# without using CMAKE_CFG_INTDIR.
#
# We define directories that may not be quite "standard"
# for a particular build tool - for example, native VS2010 projects use
# another directory to denote CPU type being compiled for - but CMake only
# supports multi-configuration setups having multiple configurations,
# not multiple compilers.
#
# One additional wrinkle we must watch for here is the case where
# a multi-configuration setup uses "." for its internal directory -
# if that's the case, we need to just set the various config output
# directories to the same value.
set(CFG_ROOT ${${PROJECT_NAME}_BINARY_DIR})
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
set(CFG_ROOT ${${PROJECT_NAME}_BINARY_DIR}/${CFG_TYPE})
endif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
set("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${LIB_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} libraries.")
endif(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
if(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
set("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${LIB_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} archives.")
endif(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
set("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${BIN_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} executables.")
endif(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
if(NOT DEFINED CMAKE_BINARY_DIR_${CFG_TYPE_UPPER})
set("CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}" ${CFG_ROOT} CACHE INTERNAL "Toplevel binary dir for ${CFG_TYPE} building.")
endif(NOT DEFINED CMAKE_BINARY_DIR_${CFG_TYPE_UPPER})
if(NOT DEFINED ${PROJECT_NAME}_BINARY_DIR_${CFG_TYPE_UPPER})
set("${PROJECT_NAME}_BINARY_DIR_${CFG_TYPE_UPPER}" ${CFG_ROOT} CACHE INTERNAL "Toplevel binary dir for ${CFG_TYPE} building.")
endif(NOT DEFINED ${PROJECT_NAME}_BINARY_DIR_${CFG_TYPE_UPPER})
endforeach()
endif(NOT CMAKE_CONFIGURATION_TYPES)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+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
+25 -66
View File
@@ -27,29 +27,26 @@ 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)
if(BUILD_SHARED_LIBS)
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc;${RELATIVE_PATH_COMPONENT}/src/test/p21read/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
elseif(BUILD_STATIC_LIBS)
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc;${RELATIVE_PATH_COMPONENT}/src/test/p21read/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME}-static stepeditor-static stepcore-static stepdai-static steputils-static TESTABLE)
endif()
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(HAVE_STD_THREAD)
set_target_properties(p21read_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-pthread -std=c++0x -DHAVE_STD_THREAD")
endif(HAVE_STD_THREAD)
if(NOT WIN32)
if(BUILD_SHARED_LIBS)
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc;${RELATIVE_PATH_COMPONENT}/src/cllazyfile/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} steplazyfile stepdai stepcore stepeditor steputils TESTABLE)
elseif(BUILD_STATIC_LIBS)
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc;${RELATIVE_PATH_COMPONENT}/src/cllazyfile/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME}-static steplazyfile-static stepeditor-static stepcore-static stepdai-static steputils-static TESTABLE)
endif()
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)
if(HAVE_STD_THREAD)
set_target_properties(lazy_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-pthread -std=c++0x -DHAVE_STD_THREAD")
endif(HAVE_STD_THREAD)
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)
if(BUILD_SHARED_LIBS)
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
elseif(BUILD_STATIC_LIBS)
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME}-static stepcore-static stepdai-static stepeditor-static steputils-static TESTABLE)
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}")
endif()
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
ENDMACRO(SCHEMA_EXES)
@@ -74,7 +71,7 @@ macro(SCHEMA_TESTS)
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)
set_tests_properties(build_lazy_cpp_${PROJECT_NAME} PROPERTIES DEPENDS generate_cpp_${PROJECT_NAME} LABELS cpp_schema_build)
endif(NOT WIN32)
endmacro(SCHEMA_TESTS)
@@ -89,67 +86,28 @@ 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}.")
set(_schema_generated_files)
foreach(_schema_source ${sourceFiles})
list(APPEND _schema_generated_files "${CMAKE_CURRENT_SOURCE_DIR}/${_schema_source}")
endforeach()
add_custom_target(generate_cpp_${PROJECT_NAME} DEPENDS exp2cxx ${expFile} ${_schema_generated_files} SOURCES ${_schema_generated_files})
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 ${_schema_generated_files}
add_custom_command(OUTPUT ${sourceFiles}
COMMAND ${CMAKE_COMMAND} -DEXE=\"$<TARGET_FILE:exp2cxx>\" -DEXP=\"${expFile}\"
-DONESHOT=\"${SC_GENERATE_CXX_ONESHOT}\" -DSDIR=\"${CMAKE_CURRENT_LIST_DIR}\"
-DCHUNK_SIZE=\"${SC_EXP2CXX_CHUNK_SIZE}\"
-DAPI_VERSION=\"${SC_EXP2CXX_API_VERSION}\"
-DLATE_BOUND=\"${SC_EXP2CXX_LATE_BOUND}\"
-DCOMPAT_NAMES=\"${SC_EXP2CXX_COMPAT_NAMES}\"
-DMETADATA_PROFILE=\"${SC_EXP2CXX_METADATA}\"
-DGENERATOR_ENVIRONMENT=\"${SC_SCHEMA_GENERATOR_ENVIRONMENT}\"
-P ${SC_CMAKE_DIR}/SC_Run_exp2cxx.cmake
DEPENDS exp2cxx ${expFile}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMENT "[exp2cxx] Generating ${${PROJECT_NAME}_file_count} C++ files for ${PROJECT_NAME}."
)
set(_schema_include_dirs
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/cllazyfile
${SC_SOURCE_DIR}/src/cllazyfile/judy/src
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/base/judy/src
)
# Schema libraries should be installed by default
if(BUILD_SHARED_LIBS)
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${_schema_generated_files} LINK_LIBRARIES stepdai stepcore stepeditor steputils)
add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${_schema_include_dirs})
if(${PROJECT_NAME}_unity_build)
target_compile_definitions(${PROJECT_NAME} PRIVATE SC_SDAI_UNITY_BUILD)
endif()
if(WIN32)
target_compile_definitions("${PROJECT_NAME}" PRIVATE SC_SCHEMA_DLL_EXPORTS)
if(MSVC)
target_compile_options("${PROJECT_NAME}" PRIVATE "/bigobj")
endif()
endif()
# TODO - ideally we would avoid generating code that triggers this warning, but figuring out
# how to do so is a non-trivial exercise. In the meantime, suppress the (very verbose) warnings
# we get due to this issue so it doesn't mask other problems.
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
target_compile_options("${PROJECT_NAME}" PRIVATE "-Wno-ignored-qualifiers")
endif()
endif()
if(BUILD_STATIC_LIBS)
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${_schema_generated_files} LINK_LIBRARIES stepcore-static stepdai-static stepeditor-static steputils-static)
add_dependencies(${PROJECT_NAME}-static generate_cpp_${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}-static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${_schema_include_dirs})
target_compile_definitions("${PROJECT_NAME}-static" PRIVATE SC_STATIC)
if(${PROJECT_NAME}_unity_build)
target_compile_definitions(${PROJECT_NAME}-static PRIVATE SC_SDAI_UNITY_BUILD)
endif()
if(MSVC)
target_compile_options("${PROJECT_NAME}-static" PRIVATE "/bigobj")
endif()
endif()
# 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})
if(HAVE_STD_THREAD)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-pthread -std=c++0x -DHAVE_STD_THREAD")
endif(HAVE_STD_THREAD)
SCHEMA_EXES()
SCHEMA_TESTS()
@@ -164,3 +122,4 @@ endmacro(SCHEMA_TARGETS expFile schemaName sourceFiles)
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+58 -52
View File
@@ -1,11 +1,29 @@
# create config.h
# 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(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckTypeSize)
include(CMakePushCheckState)
include(CheckCSourceCompiles)
include(CheckCXXSourceRuns)
CHECK_INCLUDE_FILE(ndir.h HAVE_NDIR_H)
@@ -19,67 +37,55 @@ CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
CHECK_INCLUDE_FILE(process.h HAVE_PROCESS_H)
CHECK_INCLUDE_FILE(io.h HAVE_IO_H)
# ensure macro functions are captured
CHECK_SYMBOL_EXISTS(abs "stdlib.h" HAVE_ABS)
CHECK_SYMBOL_EXISTS(memcpy "string.h" HAVE_MEMCPY)
CHECK_SYMBOL_EXISTS(memmove "string.h" HAVE_MEMMOVE)
CHECK_SYMBOL_EXISTS(getopt "getopt.h" HAVE_GETOPT)
CHECK_SYMBOL_EXISTS(snprintf "stdio.h" HAVE_SNPRINTF)
CHECK_SYMBOL_EXISTS(vsnprintf "stdio.h" HAVE_VSNPRINTF)
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)
if(SC_ENABLE_CXX11)
set( TEST_STD_THREAD "
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()
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++11" )
set( CMAKE_REQUIRED_FLAGS "-pthread -std=c++0x" )
else( UNIX )
# vars probably need set for embarcadero, etc
# 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()
cmake_pop_check_state()
set( TEST_STD_CHRONO "
#include <iostream>
#include <chrono>
int main() {
std::chrono::seconds sec(1);
std::cout << \"1s is \"<< std::chrono::duration_cast<std::chrono::milliseconds>(sec).count() << \" ms\" << std::endl;
}
" )
cmake_push_check_state()
if( UNIX )
set( CMAKE_REQUIRED_FLAGS "-std=c++11" )
else( UNIX )
# vars probably need set for embarcadero, etc
endif( UNIX )
CHECK_CXX_SOURCE_RUNS( "${TEST_STD_CHRONO}" HAVE_STD_CHRONO ) #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)
set( TEST_NULLPTR "
#include <cstddef>
std::nullptr_t f() {return nullptr;}
int main() {return !(f() == f());}
" )
cmake_push_check_state()
if( UNIX )
set( CMAKE_REQUIRED_FLAGS "-std=c++11" )
else( UNIX )
# vars probably need set for embarcadero, etc
endif( UNIX )
CHECK_CXX_SOURCE_RUNS( "${TEST_NULLPTR}" HAVE_NULLPTR ) #quotes are *required*!
cmake_pop_check_state()
endif(SC_ENABLE_CXX11)
# ------------------------
# Now that all the tests are done, configure the config.h file:
configure_file(${CMAKE_SOURCE_DIR}/include/config.h.in ${SC_BINARY_DIR}/${INCLUDE_DIR}/config.h.gen)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SC_BINARY_DIR}/${INCLUDE_DIR}/config.h.gen ${SC_BINARY_DIR}/${INCLUDE_DIR}/config.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
+31 -18
View File
@@ -1,4 +1,4 @@
# The Express parser uses the tools RE2C and Lemon to generate code
# 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.
@@ -10,38 +10,51 @@
# 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.
set(_valid_gen_states AUTO ON OFF)
set(_verbosity "QUIET")
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE
STRING "Use Perplex, RE2C and Lemon to generate C source code.")
set_property(CACHE SC_GENERATE_LEXER_PARSER PROPERTY STRINGS ${_valid_gen_states})
string(TOUPPER "${SC_GENERATE_LEXER_PARSER}" SC_GENERATE_LEXER_PARSER)
if(NOT "${SC_GENERATE_LEXER_PARSER}" IN_LIST _valid_gen_states)
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()
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")
# NOTE: lemon doesn't have a stable versioning system (it's always 1)
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(LEMON_FOUND AND RE2C_FOUND)
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 re2c, and lemon - can regenerate lexer/parser if necessary")
else()
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 couldn't find lemon/re2c")
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()
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")
+2 -17
View File
@@ -1,26 +1,10 @@
# if oneshot is true, don't run exp2cxx if source files exist. if schema.cc exists, assume others do
if(NOT DEFINED API_VERSION OR "${API_VERSION}" STREQUAL "")
set(API_VERSION 1)
endif()
if(NOT DEFINED METADATA_PROFILE OR "${METADATA_PROFILE}" STREQUAL "")
set(METADATA_PROFILE full)
endif()
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()
set(_exp2cxx_mode_args)
if(LATE_BOUND)
list(APPEND _exp2cxx_mode_args --late-bound)
endif()
if(COMPAT_NAMES)
list(APPEND _exp2cxx_mode_args --compat-names)
endif()
list(APPEND _exp2cxx_mode_args --metadata ${METADATA_PROFILE})
execute_process(COMMAND ${CMAKE_COMMAND} -E env ${GENERATOR_ENVIRONMENT}
${EXE} -k ${CHUNK_SIZE} -V ${API_VERSION} ${_exp2cxx_mode_args} ${EXP}
execute_process(COMMAND ${EXE} ${EXP}
WORKING_DIRECTORY ${SDIR}
RESULT_VARIABLE _res
OUTPUT_FILE exp2cxx_stdout.txt
@@ -38,3 +22,4 @@ endif()
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+154 -89
View File
@@ -1,99 +1,163 @@
macro(SC_ADDEXEC execname)
set(_addexec_opts NO_INSTALL TESTABLE)
set(_addexec_multikw SOURCES LINK_LIBRARIES)
string(TOUPPER "SC_ADDEXEC_${execname}_ARG" _arg_prefix)
cmake_parse_arguments(${_arg_prefix} "${_addexec_opts}" "" "${_addexec_multikw}" ${ARGN})
if(NOT DEFINED "${_arg_prefix}_SOURCES")
message(SEND_ERROR "SC_ADDEXEC usage error!")
endif()
# 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)
add_executable(${execname} ${${_arg_prefix}_SOURCES})
# 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)
if(BUILD_STATIC_LIBS)
target_compile_definitions(${execname} PRIVATE SC_STATIC)
endif()
#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)
if(DEFINED "${_arg_prefix}_LINK_LIBRARIES")
foreach(_lib ${${_arg_prefix}_LINK_LIBRARIES})
if($CACHE{SC_STATIC_UTILS})
get_property(_lib_type TARGET ${_lib} PROPERTY TYPE)
if(NOT _lib_type STREQUAL "STATIC_LIBRARY")
message(SEND_ERROR "SC_ADDEXEC usage error - expected STATIC LINK_LIBRARIES targets (${_lib})")
endif()
endif()
# Executables consume their dependencies but do not publish an
# interface to downstream targets.
target_link_libraries(${execname} PRIVATE ${_lib})
endforeach()
target_link_libraries(${execname} PRIVATE ${${_arg_prefix}_LINK_LIBRARIES})
endif()
#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)
if(NOT ${_arg_prefix}_NO_INSTALL AND NOT ${_arg_prefix}_TESTABLE)
install(TARGETS ${execname}
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR}
)
endif()
if(NOT SC_ENABLE_TESTING AND ${_arg_prefix}_TESTABLE)
set_target_properties(${execname} PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
endmacro()
macro(SC_ADDLIB _addlib_target)
set(_addlib_opts SHARED STATIC NO_INSTALL TESTABLE)
set(_addlib_multikw SOURCES LINK_LIBRARIES)
string(TOUPPER "SC_ADDLIB_${_addlib_target}_ARG" _arg_prefix)
cmake_parse_arguments(${_arg_prefix} "${_addlib_opts}" "" "${_addlib_multikw}" ${ARGN})
if(NOT DEFINED ${_arg_prefix}_SOURCES)
message(SEND_ERROR "SC_ADDLIB usage error!")
endif()
if(${_arg_prefix}_SHARED)
add_library(${_addlib_target} SHARED ${${_arg_prefix}_SOURCES})
if(OPENBSD)
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
else(OPENBSD)
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_VERSION} SOVERSION ${SC_VERSION_MAJOR})
endif(OPENBSD)
#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(${_addlib_target} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
set_target_properties(${libname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
elseif(${_arg_prefix}_STATIC)
add_library(${_addlib_target} STATIC ${${_arg_prefix}_SOURCES})
target_compile_definitions(${_addlib_target} PRIVATE SC_STATIC)
else()
message(SEND_ERROR "SC_ADDLIB usage error!")
endif()
if(DEFINED ${_arg_prefix}_LINK_LIBRARIES)
foreach(_lib ${${_arg_prefix}_LINK_LIBRARIES})
if(${_arg_prefix}_STATIC AND TARGET ${_lib})
get_property(_libtype TARGET ${_lib} PROPERTY TYPE)
if(NOT ${_libtype} STREQUAL "STATIC_LIBRARY")
message(SEND_ERROR "SC_ADDLIB usage error - expected (static) LINK_LIBRARIES targets (${_lib})")
endif()
endif()
# Schema libraries are consumed directly by generated test programs.
# Publish their link requirements explicitly; the legacy unscoped
# signature does not reliably provide a transitive interface with
# current CMake versions.
target_link_libraries(${_addlib_target} PUBLIC ${_lib})
endforeach()
target_link_libraries(${_addlib_target} ${_lib})
endif()
if(NOT ${_arg_prefix}_NO_INSTALL AND NOT ${_arg_prefix}_TESTABLE)
install(TARGETS ${_addlib_target}
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR}
)
endif()
endmacro()
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
@@ -101,3 +165,4 @@ endmacro()
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+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
+102
View File
@@ -0,0 +1,102 @@
# Inherit the parent CMake setting
set(CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(LEMON_EXECUTABLE "@LEMON_EXECUTABLE@")
set(RE2C_EXECUTABLE "@RE2C_EXECUTABLE@")
set(PERPLEX_EXECUTABLE "@PERPLEX_EXECUTABLE@")
set(SYNC_SCRIPT "@SYNC_SCRIPT@")
set(SYNC_TARGET_NAME "@SYNC_TARGET_NAME@")
set(DEBUGGING_GENERATED_SOURCES "@DEBUGGING_GENERATED_SOURCES@")
if(NOT DEBUGGING_GENERATED_SOURCES)
# Include the file the provides the baseline against which
# current files will be compared
include("@BASELINE_INFORMATION_FILE@")
# Define a variety of convenience routines
include("@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake")
# The following need to be checked:
#
# 1. baseline input MD5 hashes against the current input
# hashes. If the cached sources were generated using
# inputs other than the current inputs, note they are
# out of sync but don't stop. Templates used by perplex
# and lemon are part of this group.
#
# 2. baseline cached source MD5 hashes against current
# cached source MD5 hashes. Making sure no changes
# have been made to the generated sources. If the
# cached sources need to be updated (see #1, for example)
# their MD5 hashes need to be updated at the same time.
#
# 3. MD5 hashes of output generated by the tools against
# the MD5 hashes of the equalivent cached sources, if
# a) the tool versions are the same b) the input MD5
# hash comparisions were the same and c) the baseline
# test from #2 passed. This is done to detect platform
# differences in output sources, but is only valid if
# the input files are in their "pristine" state and the
# toolchain is equalivent to that used for the baseline.
# Individually verify all of the files in question.
set(input_files "@INPUT_FILELIST@")
VERIFY_FILES("${input_files}" 0 input_unchanged)
set(template_files "@TEMPLATE_FILELIST@")
VERIFY_FILES("${template_files}" 1 templates_unchanged)
set(cached_files "@CACHED_FILELIST@")
VERIFY_FILES("${cached_files}" 1 cached_unchanged)
if(cached_unchanged)
message( "Cached generated source code has not been modified.")
else()
message(FATAL_ERROR "Cached generated sources do not match the MD5 hashes present in /home/mark/step/sc/src/express/generated/verification_info.cmake - if updating cached sources, remember that the build enforces the requirement that associated MD5 hashes in /home/mark/step/sc/src/express/generated/verification_info.cmake are current as well. Cached generated sources should not be directly edited.")
endif(cached_unchanged)
GET_GENERATOR_EXEC_VERSIONS()
if("${lemon_version}" VERSION_EQUAL "${baseline_lemon_version}" AND "${perplex_version}" VERSION_EQUAL "${baseline_perplex_version}" AND "${re2c_version}" VERSION_EQUAL "${baseline_re2c_version}")
set(tool_versions_equal 1)
else()
set(tool_versions_equal 0)
endif()
if(NOT input_unchanged)
if(templates_unchanged AND tool_versions_equal)
message("Input files changed - syncing cached outputs")
execute_process(COMMAND ${CMAKE_COMMAND} -P ${SYNC_SCRIPT} OUTPUT_VARIABLE output)
else(templates_unchanged AND tool_versions_equal)
if(NOT templates_unchanged AND NOT tool_versions_equal)
message("Input files have been updated, but templates and current tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
else(NOT templates_unchanged AND NOT tool_versions_equal)
if(NOT templates_unchanged)
message("Input files have been updated, but templates do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
endif(NOT templates_unchanged)
if(NOT tool_versions_equal)
message("Input files have been updated, but tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
endif(NOT tool_versions_equal)
endif(NOT templates_unchanged AND NOT tool_versions_equal)
endif(templates_unchanged AND tool_versions_equal)
else(NOT input_unchanged)
if(templates_unchanged AND cached_unchanged AND tool_versions_equal)
# Under these conditions, the uncached generated output should be equal to the cached files.
# Check if it is - a difference here may indicate a platform-specific behavior in one of the
# generators.
set(build_files "@BUILD_OUTPUT_FILELIST@")
VERIFY_FILES("${build_files}" 1 platform_unchanged)
if(NOT platform_unchanged)
message("Note: give these build inputs and tools, source files should be identical to generated files. Differences were still observed - possible indiciation of platform-specific generator behavior.")
endif(NOT platform_unchanged)
endif(templates_unchanged AND cached_unchanged AND tool_versions_equal)
endif(NOT input_unchanged)
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)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+87
View File
@@ -0,0 +1,87 @@
# creates sc_version_string.h, which defines sc_version()
# sc_version() returns a pretty commit description and a build timestamp.
# 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 ------------------
#use git for a pretty commit id
#uses 'git describe --tags', so tags are required in the repo
#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)
if(NOT SC_IS_SUBBUILD)
message(WARNING "Git not found. Build will contain revision info from ${VERS_FILE}.")
endif(NOT SC_IS_SUBBUILD)
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)
endif()
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)
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)
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"
)
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)
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
+11 -9
View File
@@ -1,5 +1,5 @@
project(SC_SUBPROJECT_SCHEMA_SCANNER)
cmake_minimum_required(VERSION 3.12)
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}")
@@ -16,12 +16,12 @@ 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/alloc.c
${SC_ROOT}/src/express/caseitem.c
${SC_ROOT}/src/express/dict.c
${SC_ROOT}/src/express/entity.c
@@ -29,7 +29,6 @@ set(schema_scanner_src
${SC_ROOT}/src/express/exp_kw.c
${SC_ROOT}/src/express/expr.c
${SC_ROOT}/src/express/express.c
${SC_ROOT}/src/express/factory.c
${SC_ROOT}/src/express/hash.c
${SC_ROOT}/src/express/lexact.c
${SC_ROOT}/src/express/linklist.c
@@ -37,7 +36,6 @@ set(schema_scanner_src
${SC_ROOT}/src/express/object.c
${SC_ROOT}/src/express/info.c
${SC_ROOT}/src/express/resolve.c
${SC_ROOT}/src/express/resolve2.c
${SC_ROOT}/src/express/schema.c
${SC_ROOT}/src/express/scope.c
${SC_ROOT}/src/express/stmt.c
@@ -51,20 +49,24 @@ 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
)
add_executable(schema_scanner ${schema_scanner_src})
if(MSVC)
add_definitions(-D__MSVC__ -D__WIN32__)
# Disable warning for preferred usage of secure functions (example strcpy should be strcpy_s, ...)
target_compile_definitions(schema_scanner PUBLIC _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
elseif(BORLAND)
add_definitions(-D__BORLAND__ -D__WIN32__)
else()
target_compile_options(schema_scanner PUBLIC -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()
target_compile_definitions(schema_scanner PUBLIC SC_STATIC SCHEMA_SCANNER)
add_definitions(-DSCHEMA_SCANNER)
add_executable(schema_scanner ${schema_scanner_src})
# Local Variables:
# tab-width: 8
+29 -122
View File
@@ -14,28 +14,22 @@
*/
extern "C" {
#define _XOPEN_SOURCE /* for S_IFDIR */
# include "expparse.h"
# include "expscan.h"
# include "express/scope.h"
# include "genCxxFilenames.h"
# include "sc_mkdir.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
# include <string.h>
#include "expparse.h"
#include "expscan.h"
#include "express/scope.h"
#include "genCxxFilenames.h"
#include <string.h>
#ifdef _WIN32
# include <direct.h>
# define getcwd _getcwd
#else
# include <unistd.h>
#endif
# if defined( _WIN32 ) || defined ( __WIN32__ )
# include <direct.h>
# define getcwd _getcwd
# else
# include <unistd.h>
# endif
}
#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
@@ -51,35 +45,6 @@ using std::ofstream;
using std::cerr;
using std::cout;
static unsigned long entityChunkSize = 256;
static unsigned long typeChunkSize = 256;
static bool
parseChunkSizes( const char * value )
{
if( !value || !value[0] ) {
return false;
}
char * end = 0;
const unsigned long entities = strtoul( value, &end, 10 );
if( !end || entities == 0 ) {
return false;
}
unsigned long types = entities;
if( *end == ':' ) {
char * typeEnd = 0;
types = strtoul( end + 1, &typeEnd, 10 );
if( !end[1] || !typeEnd || *typeEnd || types == 0 ) {
return false;
}
} else if( *end ) {
return false;
}
entityChunkSize = entities;
typeChunkSize = types;
return true;
}
/** \return true for types that exp2cxx won't generate code for */
bool notGenerated( const Type t ) {
switch( TYPEget_body( t )->type ) {
@@ -160,30 +125,6 @@ string makeShortName( const char * longName ) {
return filename;
}
/* 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 */
static 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;
}
/** 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 ) {
@@ -216,34 +157,20 @@ void writeLists( const char * schemaName, stringstream & eh, stringstream & ei,
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;
const int entityChunks = std::max( 1, ( ecount + static_cast<int>( entityChunkSize ) - 1 ) / static_cast<int>( entityChunkSize ) );
const int typeChunks = std::max( 1, ( tcount + static_cast<int>( typeChunkSize ) - 1 ) / static_cast<int>( typeChunkSize ) );
cmLists << "if(SC_EXP2CXX_LATE_BOUND)" << endl;
cmLists << " set(" << shortName << "_file_count 10)" << endl;
cmLists << "else()" << endl;
cmLists << " set(" << shortName << "_file_count " <<
( ecount + tcount ) * 2 + entityChunks + typeChunks + 14 << ")" << endl;
cmLists << "endif()" << endl << 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 << "if(SC_EXP2CXX_LATE_BOUND)" << endl;
cmLists << " set(" << shortName << "_entity_hdrs)" << endl;
cmLists << "else()" << endl;
cmLists << " set(" << shortName << "_entity_hdrs" << endl;
cmLists << "set(" << shortName << "_entity_hdrs" << endl;
cmLists << eh.str();
cmLists << " )" << endl;
cmLists << "endif()" << endl << endl;
cmLists << " )" << endl << endl;
cmLists << "if(SC_EXP2CXX_LATE_BOUND)" << endl;
cmLists << " set(" << shortName << "_type_hdrs)" << endl;
cmLists << "else()" << endl;
cmLists << " set(" << shortName << "_type_hdrs" << endl;
cmLists << "set(" << shortName << "_type_hdrs" << endl;
cmLists << th.str();
cmLists << " )" << endl;
cmLists << "endif()" << endl << endl;
cmLists << " )" << endl << endl;
cmLists << "set(" << shortName << "_misc_hdrs" << endl;
cmLists << " Sdaiclasses.h schema.h" << endl;
@@ -268,26 +195,11 @@ void writeLists( const char * schemaName, stringstream & eh, stringstream & ei,
cmLists << "# unity build: #include small .cc files to reduce the number" << endl;
cmLists << "# of translation units that must be compiled" << endl;
cmLists << "if(SC_EXP2CXX_LATE_BOUND)" << endl;
cmLists << " set(" << shortName << "_unity_build FALSE)" << endl;
cmLists << " set(" << shortName << "_entity_impls)" << endl;
cmLists << " set(" << shortName << "_type_impls)" << endl;
cmLists << "elseif(SC_UNITY_BUILD)" << endl;
cmLists << " # bounded compact chunks; definitions are target-local" << endl;
cmLists << " set(" << shortName << "_unity_build TRUE)" << endl;
cmLists << " set(" << shortName << "_entity_impls" << endl;
for( int chunk = 1; chunk <= entityChunks; ++chunk ) {
cmLists << " Sdai" << schema_upper << "_unity_entities_" <<
std::setfill( '0' ) << std::setw( 4 ) << chunk << ".cc" << endl;
}
cmLists << " )" << endl;
cmLists << " set(" << shortName << "_type_impls" << endl;
for( int chunk = 1; chunk <= typeChunks; ++chunk ) {
cmLists << " Sdai" << schema_upper << "_unity_types_" <<
std::setfill( '0' ) << std::setw( 4 ) << chunk << ".cc" << endl;
}
cmLists << " )" << endl;
cmLists << "else()" << 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;
@@ -295,13 +207,12 @@ void writeLists( const char * schemaName, stringstream & eh, stringstream & ei,
cmLists << " set(" << shortName << "_type_impls" << endl;
cmLists << ti.str();
cmLists << " )" << endl;
cmLists << "endif()" << endl << 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;
cmLists << " Sdai" << schema_upper << ".sources.cmake )" << endl << 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;
@@ -309,7 +220,7 @@ void writeLists( const char * schemaName, stringstream & eh, stringstream & ei,
cmLists.close();
char pwd[BUFSIZ+1] = {0};
char pwd[BUFSIZ] = {0};
if( getcwd( pwd, BUFSIZ ) ) {
cout << pwd << "/" << shortName << endl;
} else {
@@ -333,7 +244,7 @@ void printSchemaFilenames( Schema sch ){
int ecount = 0, tcount = 0;
DictionaryEntry de;
void *x;
Generic x;
filenames_t fn;
DICTdo_init( sch->symbol_table, &de );
while( 0 != ( x = DICTdo( &de ) ) ) {
@@ -390,18 +301,14 @@ int main( int argc, char ** argv ) {
DictionaryEntry de;
/* copied from fedex.c */
Express model;
if( ( argc != 2 && argc != 3 ) || ( strlen( argv[1] ) < 1 ) ) {
fprintf( stderr, "\nUsage: %s file.exp [entity-chunk-size[:type-chunk-size]]\nOutput: a CMakeLists.txt to build the schema,", argv[0] );
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];
if( argc == 3 && !parseChunkSizes( argv[2] ) ) {
fprintf( stderr, "chunk sizes must be positive integers in N or N:N form\n" );
exit( EXIT_FAILURE );
}
EXPRESSinitialize();
+15 -58
View File
@@ -11,51 +11,18 @@
# 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)
message( STATUS "Assuming compiler is capable of unity build. (SC_UNITY_BUILD=TRUE)")
set(SC_UNITY_BUILD TRUE)
message( STATUS "Override by setting SC_UNITY_BUILD; TRUE will result in faster build times but *huge* translation units and higher memory use in compilation.")
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( STATUS "Respecting user-defined SC_UNITY_BUILD value of ${SC_UNITY_BUILD}.")
message(".. Respecting user-defined SC_UNITY_BUILD value of ${SC_UNITY_BUILD}.")
endif(NOT DEFINED SC_UNITY_BUILD)
if(NOT DEFINED SC_EXP2CXX_CHUNK_SIZE)
set(SC_EXP2CXX_CHUNK_SIZE "64:8" CACHE STRING "Maximum entity:type objects in generated unity translation units")
endif()
if(NOT DEFINED SC_EXP2CXX_API_VERSION)
set(SC_EXP2CXX_API_VERSION "1")
endif()
set(SC_EXP2CXX_API_VERSION "${SC_EXP2CXX_API_VERSION}" CACHE STRING "Generated C++ API version (1 or 2)")
set_property(CACHE SC_EXP2CXX_API_VERSION PROPERTY STRINGS 1 2)
if(NOT SC_EXP2CXX_API_VERSION MATCHES "^[12]$")
message(FATAL_ERROR "SC_EXP2CXX_API_VERSION must be 1 or 2")
endif()
option(SC_EXP2CXX_LATE_BOUND "Generate descriptor-backed entities without early-bound C++ entity classes" OFF)
if(SC_EXP2CXX_LATE_BOUND AND NOT SC_EXP2CXX_API_VERSION STREQUAL "2")
message(FATAL_ERROR "SC_EXP2CXX_LATE_BOUND requires SC_EXP2CXX_API_VERSION=2")
endif()
option(SC_EXP2CXX_COMPAT_NAMES "Retain generated entity aliases in late-bound output" OFF)
if(SC_EXP2CXX_COMPAT_NAMES AND NOT SC_EXP2CXX_LATE_BOUND)
message(FATAL_ERROR "SC_EXP2CXX_COMPAT_NAMES requires SC_EXP2CXX_LATE_BOUND=ON")
endif()
if(NOT DEFINED SC_EXP2CXX_METADATA)
set(SC_EXP2CXX_METADATA "full")
endif()
set(SC_EXP2CXX_METADATA "${SC_EXP2CXX_METADATA}" CACHE STRING
"Generated schema metadata profile (full or structural)")
set_property(CACHE SC_EXP2CXX_METADATA PROPERTY STRINGS full structural)
if(NOT SC_EXP2CXX_METADATA MATCHES "^(full|structural)$")
message(FATAL_ERROR "SC_EXP2CXX_METADATA must be full or structural")
endif()
if(SC_EXP2CXX_METADATA STREQUAL "structural" AND
NOT SC_EXP2CXX_LATE_BOUND)
message(FATAL_ERROR
"SC_EXP2CXX_METADATA=structural requires SC_EXP2CXX_LATE_BOUND=ON")
endif()
# --- variables ---
# SC_ROOT: SC root dir
@@ -80,7 +47,7 @@ set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\" CACHE STRING \"compiler\")
set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\" CACHE STRING \"compiler\")
")
message( STATUS "Compiling schema scanner...")
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})
@@ -105,13 +72,13 @@ 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( STATUS "Schema scanner built. Running it...")
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_DIR})
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner.exe DESTINATION ${BIN_INSTALL_DIR})
else(WIN32)
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner DESTINATION ${BIN_DIR})
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner DESTINATION ${BIN_INSTALL_DIR})
endif(WIN32)
# macro SCHEMA_CMLIST
@@ -120,7 +87,7 @@ endif(WIN32)
# 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} ${SC_EXP2CXX_CHUNK_SIZE}
execute_process(COMMAND ${SCANNER_OUT_DIR}/schema_scanner ${SCHEMA_FILE}
WORKING_DIRECTORY ${SC_BINARY_DIR}/schemas
RESULT_VARIABLE _ss_stat
OUTPUT_VARIABLE _ss_out
@@ -135,19 +102,9 @@ macro(SCHEMA_CMLIST SCHEMA_FILE)
string(STRIP "${_ss_out}" _ss_stripped)
string(REGEX REPLACE "\\\n" ";" _list ${_ss_stripped})
foreach(_dir ${_list})
get_property(_already_added GLOBAL PROPERTY _SC_SCHEMA_DIRS)
list(FIND _already_added "${_dir}" _idx)
if(${_idx} EQUAL -1)
set_property(GLOBAL APPEND PROPERTY _SC_SCHEMA_DIRS "${_dir}")
# Keep generated targets under the top-level binary tree. Passing the
# absolute generated-source path as both arguments creates absolute
# make target names with newer CMake.
get_filename_component(_schema_dir_name "${_dir}" NAME)
add_subdirectory("${_dir}" "${SC_BINARY_DIR}/schema-targets/${_schema_dir_name}")
endif()
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.
# 2e6ee669 removed _schema, does this still work?
configure_file(${SCHEMA_FILE} ${SCANNER_BUILD_DIR}/${_schema})
endmacro(SCHEMA_CMLIST SCHEMA_FILE)
+83
View File
@@ -0,0 +1,83 @@
# Inherit the parent CMake setting
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)
set(CURRENT_BINARY_DIR @CMAKE_CURRENT_BINARY_DIR@)
set(CACHED_FILES_DIR @CACHED_FILES_DIR@)
set(LEMON_EXECUTABLE @LEMON_EXECUTABLE@)
set(RE2C_EXECUTABLE @RE2C_EXECUTABLE@)
set(PERPLEX_EXECUTABLE @PERPLEX_EXECUTABLE@)
set(LOCKED_SOURCE_DIR @LOCKED_SOURCE_DIR@)
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
if(NOT DEBUGGING_GENERATED_SOURCES)
# Define a variety of convenience routines
include(@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake)
# The following steps are executed to sync generated sources:
#
# 1. Create a new verification_info.cmake file and populate
# it with the current versions of perplex, re2c and lemon.
# Also add the MD5 sums for current template files.
#
# 2. For all files that need to be updated in the cache,
# calculate new MD5 sums and add them to the new
# verification_info.cmake - this is usually the input
# files and the generated outputs.
#
# 3. Overwrite the original cached verification_info.cmake
# and generated files with the new ones. If LOCKED_SOURCE_DIR
# is ON, this step will not be carried out - instead, an
# informational message with manual updating instructions
# will be printed.
set(new_info_file "${CURRENT_BINARY_DIR}/verification_info.cmake.new")
file(WRITE ${new_info_file} "# Autogenerated verification information\n")
# Handle generator version numbers
GET_GENERATOR_EXEC_VERSIONS()
file(APPEND ${new_info_file} "set(baseline_lemon_version \"${lemon_version}\")\n")
file(APPEND ${new_info_file} "set(baseline_re2c_version \"${re2c_version}\")\n")
file(APPEND ${new_info_file} "set(baseline_perplex_version \"${perplex_version}\")\n")
# Handle template files
set(template_files "@TEMPLATE_FILELIST@")
WRITE_MD5_SUMS("${template_files}" "${new_info_file}")
# Handle input files
set(input_files "@INPUT_FILELIST@")
WRITE_MD5_SUMS("${input_files}" "${new_info_file}")
# Handle generated files
set(output_files "@BUILD_OUTPUT_FILELIST@")
WRITE_MD5_SUMS("${output_files}" "${new_info_file}")
# Copy files into their final locations
if(NOT LOCKED_SOURCE_DIR)
configure_file(${new_info_file} "${CACHED_FILES_DIR}/verification_info.cmake" COPYONLY)
foreach(outf ${output_files})
get_filename_component(filecorename ${outf} NAME)
message("copying ${outf} to ${CACHED_FILES_DIR}/${filecorename}")
configure_file(${outf} "${CACHED_FILES_DIR}/${filecorename}" COPYONLY)
endforeach(outf ${output_files})
else(NOT LOCKED_SOURCE_DIR)
message("Source directory writing is locked - LOCKED_SOURCE_DIR is set.")
message("To update the generated files, manually copy the following to ${CACHED_FILES_DIR}:")
message(" ${new_info_file} (rename to verification_info.cmake)")
foreach(outf ${output_files})
message(" ${outf}")
endforeach(outf ${output_files})
endif(NOT LOCKED_SOURCE_DIR)
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)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+39
View File
@@ -0,0 +1,39 @@
# Inherit the parent CMake setting
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
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@")
# Define a variety of convenience routines
include("@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake")
# Individually verify all of the files in question.
set(filelist "@CACHED_FILELIST@")
VERIFY_FILES("${filelist}" 1 srcs_pass)
if( srcs_pass)
message( "Generated source code has not been modified.")
else(srcs_pass)
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
# 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@")
VERIFY_FILES("${filelist}" 0 inputs_same)
if(NOT inputs_same)
message("Note: cached generated sources are not in sync with input files.")
endif(NOT inputs_same)
endif(NOT DEBUGGING_GENERATED_SOURCES)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+1 -1
View File
@@ -9,7 +9,7 @@ set(CTEST_INITIAL_CACHE "
SITE:STRING=${CTEST_SITE}
BUILDNAME:STRING=${CTEST_BUILD_NAME}
SC_ENABLE_TESTING:BOOL=ON
CMAKE_BUILD_TYPE:STRING=Debug
SC_BUILD_TYPE:STRING=Debug
")
+2 -2
View File
@@ -10,7 +10,7 @@
# .exp file inside, which it uses. otherwise, ${path} is assumed to
# be an express file.
if(NOT "${SC_BUILD_EXPRESS_ONLY}" AND NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
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)
@@ -25,7 +25,7 @@ if(NOT "${SC_BUILD_EXPRESS_ONLY}" AND NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
LOCATE_SCHEMA(${FILE} abspath)
SCHEMA_CMLIST(${abspath})
endforeach()
endif()
endif(NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
# Local Variables:
# tab-width: 8
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -3891,11 +3891,11 @@ ENTITY grooving_turning_operation
WR3: (verify_optional_action_property (SELF, 'allowance')) AND
(verify_length_measure_action_property (SELF, 'allowance'));
-- allowance property required for roughing
-- allowance propery required for roughing
WR4: NOT (SELF.description = 'roughing') OR
(verify_required_action_property (SELF, 'allowance'));
-- allowance property forbidden for cutting in
-- allowance propery forbidden for cutting in
WR5: NOT (SELF.description = 'cutting in') OR
(0 = SIZEOF (get_action_property (SELF, 'allowance')));
END_ENTITY; -- 10303-238: integrated_cnc_schema
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-62
View File
@@ -1,62 +0,0 @@
# AP242 TREAT Schema File
This directory contains an altered version of the AP242 (ISO 10303-242) schema.
It is corrected to avoid the non-standard parsing requirement of the original
by using explicit TREAT expression for type narrowing
## The Difference
Both files are identical except for a single line at line 34149 in the `styled_item` entity WHERE rule WR3:
**Original (242_mim_lf.exp)**:
```express
QUERY(it <* item | ...)
```
**TREAT version (242_mim_lf_treat.exp)**:
```express
QUERY(it <* TREAT(item AS set_representation_item) | ...)
```
### Historical Context
The original AP242 schema contains a WHERE rule that:
1. Checks if `item` (a SELECT type) is a `SET_REPRESENTATION_ITEM`
2. Then tries to iterate over `item` in a QUERY expression
This pattern requires implicit type narrowing, which is not part of the ISO 10303-11 standard.
### STEPcode's Solution
STEPcode implements **flow-sensitive type narrowing** as an extension:
- Recognizes TYPEOF guard patterns like `'Type' IN TYPEOF(var)` in AND expressions
- Automatically narrows the type for subsequent uses
- Makes the original schema parse successfully
### Standards-Compliant Alternative
The TREAT version uses the ISO 10303-11 TREAT expression:
- `TREAT(item AS set_representation_item)` explicitly narrows the type
- No implicit narrowing needed
- Works in any compliant EXPRESS parser
## Testing
Both versions parse successfully and produce identical output:
```bash
# Run comparison test
./test/compare_ap242_versions.sh
```
Expected output:
```
✓ Both versions parse successfully
✓ Both versions generate the same number of files
```
For detailed comparison, see `doc/ap242-comparison.md`.
## Related Documentation
- `doc/ap242-comparison.md` - Detailed comparison and analysis
- `doc/express-type-unwrapping.md` - TREAT and narrowing documentation
- `src/express/test/README_AP242_BASELINE.md` - Historical PE056 error info
@@ -217,7 +217,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538433= FEA_PARAMETRIC_POINT('',(1.,0.,0.));
#637538435= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_CURVE.CROD',((
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_CURVE.CROD',((
ENUMERATED_CURVE_ELEMENT_PURPOSE(.AXIAL.)),(
ENUMERATED_CURVE_ELEMENT_PURPOSE(.TORSION.))));
#637538443= CURVE_3D_ELEMENT_PROPERTY('PROD.1','',(#637538445),(
@@ -784,7 +784,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
);
#637539490= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539494= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_WEDGE.CPENTA',
#637539494= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_WEDGE.CPENTA',
(ENUMERATED_VOLUME_ELEMENT_PURPOSE(.STRESS_DISPLACEMENT.)),.WEDGE.);
#637539496= VOLUME_3D_ELEMENT_REPRESENTATION('367',(#637539489),
#637539490,(#637539284,#637539280,#637539252,#637539424,#637539420,
@@ -1074,7 +1074,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539781= VOLUME_3D_ELEMENT_REPRESENTATION('272',(#637539489),
#637539490,(#637538832,#637538864,#637539000,#637538976),#637538282,
#637539784,#637539460);
#637539784= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637539784= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637539786= VOLUME_3D_ELEMENT_REPRESENTATION('271',(#637539489),
@@ -1797,7 +1797,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637540503= VOLUME_3D_ELEMENT_REPRESENTATION('32',(#637539489),
#637539490,(#637538500,#637538504,#637538524,#637538520,#637538560,
#637538564,#637538584,#637538580),#637538282,#637540506,#637539460);
#637540506= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637540506= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637540508= VOLUME_3D_ELEMENT_REPRESENTATION('31',(#637539489),
@@ -784,7 +784,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
);
#637539488= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539492= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_WEDGE.CPENTA',
#637539492= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_WEDGE.CPENTA',
(ENUMERATED_VOLUME_ELEMENT_PURPOSE(.STRESS_DISPLACEMENT.)),.WEDGE.);
#637539494= VOLUME_3D_ELEMENT_REPRESENTATION('367',(#637539487),
#637539488,(#637539282,#637539278,#637539250,#637539422,#637539418,
@@ -1074,7 +1074,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539779= VOLUME_3D_ELEMENT_REPRESENTATION('272',(#637539487),
#637539488,(#637538830,#637538862,#637538998,#637538974),#637538280,
#637539782,#637539458);
#637539782= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637539782= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637539784= VOLUME_3D_ELEMENT_REPRESENTATION('271',(#637539487),
@@ -1797,7 +1797,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637540501= VOLUME_3D_ELEMENT_REPRESENTATION('32',(#637539487),
#637539488,(#637538498,#637538502,#637538522,#637538518,#637538558,
#637538562,#637538582,#637538578),#637538280,#637540504,#637539458);
#637540504= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637540504= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637540506= VOLUME_3D_ELEMENT_REPRESENTATION('31',(#637539487),
@@ -784,7 +784,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
);
#637539490= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539494= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_WEDGE.CPENTA',
#637539494= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_WEDGE.CPENTA',
(ENUMERATED_VOLUME_ELEMENT_PURPOSE(.STRESS_DISPLACEMENT.)),.WEDGE.);
#637539496= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637539497,
#637539487,.F.,(#637539499,#637539504,#637539509,#637539514,#637539519,
@@ -5698,7 +5698,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((3.419102,7.558704,4.948215,-9.982081,
#637542876= VOLUME_3D_ELEMENT_REPRESENTATION('272',(#637539489),
#637539490,(#637538832,#637538864,#637539000,#637538976),#637538282,
#637542879,#637539460);
#637542879= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637542879= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637542881= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637539497,
@@ -15071,7 +15071,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((167.411,-189.9718,-234.8069,113.0858,
#637549373= VOLUME_3D_ELEMENT_REPRESENTATION('32',(#637539489),
#637539490,(#637538500,#637538504,#637538524,#637538520,#637538560,
#637538564,#637538584,#637538580),#637538282,#637549376,#637539460);
#637549376= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637549376= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637549378= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637539497,
@@ -217,7 +217,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538431= FEA_PARAMETRIC_POINT('',(1.,0.,0.));
#637538433= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538437= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_CURVE.CROD',((
#637538437= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_CURVE.CROD',((
ENUMERATED_CURVE_ELEMENT_PURPOSE(.AXIAL.)),(
ENUMERATED_CURVE_ELEMENT_PURPOSE(.TORSION.))));
#637538441= CURVE_3D_ELEMENT_PROPERTY('PROD.1','',(#637538443),(
@@ -217,7 +217,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538433= FEA_PARAMETRIC_POINT('',(1.,0.,0.));
#637538435= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_CURVE.CROD',((
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_CURVE.CROD',((
ENUMERATED_CURVE_ELEMENT_PURPOSE(.AXIAL.)),(
ENUMERATED_CURVE_ELEMENT_PURPOSE(.TORSION.))));
#637538443= CURVE_3D_ELEMENT_PROPERTY('PROD.1','',(#637538445),(
@@ -217,7 +217,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538433= FEA_PARAMETRIC_POINT('',(1.,0.,0.));
#637538435= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_CURVE.CBAR*',((
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_CURVE.CBAR*',((
ENUMERATED_CURVE_ELEMENT_PURPOSE(.AXIAL.)),(
ENUMERATED_CURVE_ELEMENT_PURPOSE(.Y_Y_BENDING.),
ENUMERATED_CURVE_ELEMENT_PURPOSE(.Z_Z_BENDING.)),(
@@ -217,7 +217,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538431= FEA_PARAMETRIC_POINT('',(1.,0.,0.));
#637538433= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538437= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_CURVE.CBAR*',((
#637538437= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_CURVE.CBAR*',((
ENUMERATED_CURVE_ELEMENT_PURPOSE(.AXIAL.)),(
ENUMERATED_CURVE_ELEMENT_PURPOSE(.Y_Y_BENDING.),
ENUMERATED_CURVE_ELEMENT_PURPOSE(.Z_Z_BENDING.)),(
@@ -217,7 +217,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538433= FEA_PARAMETRIC_POINT('',(1.,0.,0.));
#637538435= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_CURVE.CBAR*',((
#637538439= CURVE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_CURVE.CBAR*',((
ENUMERATED_CURVE_ELEMENT_PURPOSE(.AXIAL.)),(
ENUMERATED_CURVE_ELEMENT_PURPOSE(.Y_Y_BENDING.),
ENUMERATED_CURVE_ELEMENT_PURPOSE(.Z_Z_BENDING.)),(
@@ -346,7 +346,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538689= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637538690= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538694= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637538694= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TRIANGLE.CTRIA3',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -503,7 +503,7 @@ UNSPECIFIED_VALUE(.UNSPECIFIED.),UNSPECIFIED_VALUE(.UNSPECIFIED.));
#637538690,(#637538456,#637538460,#637538504,#637538500),#637538282,
#637538847,#637538699,#637538660);
#637538845= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637538847= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637538847= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_QUADRILATERAL.CQUAD4',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -346,7 +346,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538687= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637538688= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538692= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637538692= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TRIANGLE.CTRIA3',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -503,7 +503,7 @@ UNSPECIFIED_VALUE(.UNSPECIFIED.),UNSPECIFIED_VALUE(.UNSPECIFIED.));
#637538688,(#637538454,#637538458,#637538502,#637538498),#637538280,
#637538845,#637538697,#637538658);
#637538843= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637538845= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637538845= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_QUADRILATERAL.CQUAD4',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -346,7 +346,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637538689= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637538690= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637538694= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637538694= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TRIANGLE.CTRIA3',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -1375,7 +1375,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((-500.0138,-127.7892,0.,25.74217,0.,0.)
#637538690,(#637538456,#637538460,#637538504,#637538500),#637538282,
#637539434,#637538699,#637538660);
#637539432= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637539434= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637539434= SURFACE_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_QUADRILATERAL.CQUAD4',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -719,7 +719,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
);
#637539370= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539374= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_WEDGE.CPENTA',
#637539374= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_WEDGE.CPENTA',
(ENUMERATED_VOLUME_ELEMENT_PURPOSE(.STRESS_DISPLACEMENT.)),.WEDGE.);
#637539376= VOLUME_3D_ELEMENT_REPRESENTATION('367',(#637539369),
#637539370,(#637538804,#637539184,#637539160,#637538924,#637539304,
@@ -1009,7 +1009,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539661= VOLUME_3D_ELEMENT_REPRESENTATION('272',(#637539369),
#637539370,(#637538800,#637538548,#637538944,#637538572),#637538282,
#637539664,#637539340);
#637539664= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637539664= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637539666= VOLUME_3D_ELEMENT_REPRESENTATION('271',(#637539369),
@@ -1732,7 +1732,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637540383= VOLUME_3D_ELEMENT_REPRESENTATION('32',(#637539369),
#637539370,(#637538500,#637538504,#637538524,#637538520,#637538560,
#637538564,#637538584,#637538580),#637538282,#637540386,#637539340);
#637540386= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637540386= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637540388= VOLUME_3D_ELEMENT_REPRESENTATION('31',(#637539369),
@@ -719,7 +719,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
);
#637539368= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539372= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_WEDGE.CPENTA',
#637539372= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_WEDGE.CPENTA',
(ENUMERATED_VOLUME_ELEMENT_PURPOSE(.STRESS_DISPLACEMENT.)),.WEDGE.);
#637539374= VOLUME_3D_ELEMENT_REPRESENTATION('367',(#637539367),
#637539368,(#637538802,#637539182,#637539158,#637538922,#637539302,
@@ -1009,7 +1009,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539659= VOLUME_3D_ELEMENT_REPRESENTATION('272',(#637539367),
#637539368,(#637538798,#637538546,#637538942,#637538570),#637538280,
#637539662,#637539338);
#637539662= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637539662= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637539664= VOLUME_3D_ELEMENT_REPRESENTATION('271',(#637539367),
@@ -1732,7 +1732,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637540381= VOLUME_3D_ELEMENT_REPRESENTATION('32',(#637539367),
#637539368,(#637538498,#637538502,#637538522,#637538518,#637538558,
#637538562,#637538582,#637538578),#637538280,#637540384,#637539338);
#637540384= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637540384= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637540386= VOLUME_3D_ELEMENT_REPRESENTATION('31',(#637539367),
@@ -719,7 +719,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
);
#637539370= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539374= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,'LINEAR_WEDGE.CPENTA',
#637539374= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,'LINEAR_WEDGE.CPENTA',
(ENUMERATED_VOLUME_ELEMENT_PURPOSE(.STRESS_DISPLACEMENT.)),.WEDGE.);
#637539376= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637539377,
#637539367,.F.,(#637539379,#637539384,#637539389,#637539394,#637539399,
@@ -5633,7 +5633,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((3.419102,7.558704,4.948215,-9.982081,
#637542756= VOLUME_3D_ELEMENT_REPRESENTATION('272',(#637539369),
#637539370,(#637538800,#637538548,#637538944,#637538572),#637538282,
#637542759,#637539340);
#637542759= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637542759= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637542761= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637539377,
@@ -15006,7 +15006,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((167.411,-189.9718,-234.8069,113.0858,
#637549253= VOLUME_3D_ELEMENT_REPRESENTATION('32',(#637539369),
#637539370,(#637538500,#637538504,#637538524,#637538520,#637538560,
#637538564,#637538584,#637538580),#637538282,#637549256,#637539340);
#637549256= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR_ORDER.,
#637549256= VOLUME_3D_ELEMENT_DESCRIPTOR(.LINEAR.,
'LINEAR_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637549258= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637539377,
@@ -687,7 +687,7 @@ SI_UNIT($,.DEGREE_CELSIUS.)THERMODYNAMIC_TEMPERATURE_UNIT());
#637539350= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637539351= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539355= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637539355= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_QUADRILATERAL.CQUAD8',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -896,7 +896,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539351,(#637538532,#637538372,#637538328,#637539004,#637538744,
#637539008),#637538282,#637539515,#637539360,#637539363);
#637539513= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637539515= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637539515= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_TRIANGLE.CTRIA6',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -687,7 +687,7 @@ SI_UNIT($,.DEGREE_CELSIUS.)THERMODYNAMIC_TEMPERATURE_UNIT());
#637539348= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637539349= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539353= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637539353= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_QUADRILATERAL.CQUAD8',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -896,7 +896,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539349,(#637538530,#637538370,#637538326,#637539002,#637538742,
#637539006),#637538280,#637539513,#637539358,#637539361);
#637539511= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637539513= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637539513= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_TRIANGLE.CTRIA6',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -687,7 +687,7 @@ SI_UNIT($,.DEGREE_CELSIUS.)THERMODYNAMIC_TEMPERATURE_UNIT());
#637539350= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637539351= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637539355= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637539355= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_QUADRILATERAL.CQUAD8',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -3640,7 +3640,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((-783.8278,3524.98,0.,-750.8163,0.,0.))
#637539351,(#637538532,#637538372,#637538328,#637539004,#637538744,
#637539008),#637538282,#637541306,#637539360,#637539363);
#637541304= PARAMETRIC_SURFACE_3D_ELEMENT_COORDINATE_SYSTEM('',1,0.);
#637541306= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637541306= SURFACE_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_TRIANGLE.CTRIA6',((ENUMERATED_SURFACE_ELEMENT_PURPOSE(
.MEMBRANE_DIRECT.),ENUMERATED_SURFACE_ELEMENT_PURPOSE(.MEMBRANE_SHEAR.))
,(ENUMERATED_SURFACE_ELEMENT_PURPOSE(.BENDING_DIRECT.),
@@ -2587,7 +2587,7 @@ SI_UNIT($,.DEGREE_CELSIUS.)THERMODYNAMIC_TEMPERATURE_UNIT());
);
#637542839= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637542843= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637542843= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_WEDGE.CPENTA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.WEDGE.);
#637542845= ELEMENT_MATERIAL('MAT1.1','Fea Material',(#637542847,
@@ -3104,7 +3104,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539964,#637539780,#637539832,#637539836,#637539820,#637539928,
#637539980,#637539984,#637539968,#637542834,#637542834,#637542834,
#637542834,#637542834,#637542834),#637538282,#637543160,#637542845);
#637543160= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637543160= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637543162= VOLUME_3D_ELEMENT_REPRESENTATION('31',(#637542838),
@@ -3301,7 +3301,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637542839,(#637538588,#637538612,#637538708,#637538592,#637540000,
#637540004,#637540008,#637539988,#637539992,#637539996),#637538282,
#637543262,#637542845);
#637543262= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637543262= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637543264= VOLUME_3D_ELEMENT_REPRESENTATION('34',(#637542838),
@@ -2587,7 +2587,7 @@ SI_UNIT($,.DEGREE_CELSIUS.)THERMODYNAMIC_TEMPERATURE_UNIT());
);
#637542837= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637542841= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637542841= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_WEDGE.CPENTA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.WEDGE.);
#637542843= ELEMENT_MATERIAL('MAT1.1','Fea Material',(#637542845,
@@ -3104,7 +3104,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637539962,#637539778,#637539830,#637539834,#637539818,#637539926,
#637539978,#637539982,#637539966,#637542832,#637542832,#637542832,
#637542832,#637542832,#637542832),#637538280,#637543158,#637542843);
#637543158= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637543158= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637543160= VOLUME_3D_ELEMENT_REPRESENTATION('31',(#637542836),
@@ -3301,7 +3301,7 @@ ISOTROPIC_SYMMETRIC_TENSOR2_3D(0.));
#637542837,(#637538586,#637538610,#637538706,#637538590,#637539998,
#637540002,#637540006,#637539986,#637539990,#637539994),#637538280,
#637543260,#637542843);
#637543260= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637543260= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637543262= VOLUME_3D_ELEMENT_REPRESENTATION('34',(#637542836),
@@ -2587,7 +2587,7 @@ SI_UNIT($,.DEGREE_CELSIUS.)THERMODYNAMIC_TEMPERATURE_UNIT());
);
#637542839= PARAMETRIC_REPRESENTATION_CONTEXT(
'parametric_representation_context','parametric');
#637542843= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637542843= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_WEDGE.CPENTA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.WEDGE.);
#637542845= ELEMENT_MATERIAL('MAT1.1','Fea Material',(#637542847,
@@ -7728,7 +7728,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((-11.57079,-8.150762,34.35221,-7.068575
#637539964,#637539780,#637539832,#637539836,#637539820,#637539928,
#637539980,#637539984,#637539968,#637542834,#637542834,#637542834,
#637542834,#637542834,#637542834),#637538282,#637546255,#637542845);
#637546255= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637546255= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_HEXAHEDRON.CHEXA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.HEXAHEDRON.);
#637546257= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637542873,
@@ -9927,7 +9927,7 @@ ANISOTROPIC_SYMMETRIC_TENSOR2_3D((-2814.943,159.5768,445.0004,-196.6884,
#637542839,(#637538588,#637538612,#637538708,#637538592,#637540000,
#637540004,#637540008,#637539988,#637539992,#637539996),#637538282,
#637547664,#637542845);
#637547664= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC_ORDER.,
#637547664= VOLUME_3D_ELEMENT_DESCRIPTOR(.QUADRATIC.,
'QUADRATIC_TETRAHEDRON.CTETRA',(ENUMERATED_VOLUME_ELEMENT_PURPOSE(
.STRESS_DISPLACEMENT.)),.TETRAHEDRON.);
#637547666= VOLUME_3D_ELEMENT_LOCATION_POINT_VARIABLE_VALUES(#637542873,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+50 -116
View File
@@ -1,4 +1,4 @@
# Doxyfile 1.7.6.1
# Doxyfile 1.7.4
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
@@ -22,23 +22,22 @@
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or sequence of words) that should
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = SC
PROJECT_NAME = scl
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 0.8
PROJECT_NUMBER = 3.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
# a quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = STEPcode
PROJECT_BRIEF = "STEPcode"
# With the PROJECT_LOGO tag one can specify an logo or icon that is
# included in the documentation. The maximum height of the logo should not
@@ -52,7 +51,7 @@ PROJECT_LOGO =
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = /mnt/raid/mark/sc-doxygen
OUTPUT_DIRECTORY = .
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -205,13 +204,6 @@ TAB_SIZE = 8
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding
# "class=itcl::class" will allow you to use the command class in the
# itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
# sources only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
@@ -301,15 +293,6 @@ SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
# unions with only public data fields will be shown inline in the documentation
# of the scope in which they are defined (i.e. file, namespace, or group
# documentation), provided this scope is documented. If set to NO (the default),
# structs, classes, and unions are shown on a separate page (for HTML and Man
# pages) or section (for LaTeX and RTF).
INLINE_SIMPLE_STRUCTS = NO
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
@@ -332,21 +315,10 @@ TYPEDEF_HIDES_STRUCT = NO
# a logarithmic scale so increasing the size by one will roughly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
# corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
# their name and scope. Since this can be an expensive process and often the
# same symbol appear multiple times in the code, doxygen keeps a cache of
# pre-resolved symbols. If the cache is too small doxygen will become slower.
# If the cache is too large, memory is wasted. The cache size is given by this
# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@@ -366,7 +338,7 @@ EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = YES
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
@@ -587,16 +559,6 @@ FILE_VERSION_FILTER =
LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files
# containing the references data. This must be a list of .bib files. The
# .bib extension is automatically appended if omitted. Using this command
# requires the bibtex tool to be installed. See also
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
# feature you need bibtex and perl available in the search path.
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
@@ -659,8 +621,7 @@ WARN_LOGFILE =
INPUT = src \
include \
build/src/express \
build/include
build/src/express
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -716,16 +677,13 @@ FILE_PATTERNS = *.c \
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should be
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
# Note that relative paths are relative to the directory from which doxygen is
# run.
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = .git \
cmake/
EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
# from the input.
@@ -815,7 +773,7 @@ FILTER_SOURCE_PATTERNS =
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = YES
SOURCE_BROWSER = NO
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
@@ -907,13 +865,13 @@ HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header. Note that when using a custom header you are responsible
# standard header. Note that when using a custom header you are responsible
# for the proper inclusion of any scripts and style sheets that doxygen
# needs, which is dependent on the configuration options used.
# It is advised to generate a default header using "doxygen -w html
# It is adviced to generate a default header using "doxygen -w html
# header.html footer.html stylesheet.css YourConfigFile" and then modify
# that header. Note that the header is subject to change so you typically
# have to redo this when upgrading to a newer version of doxygen or when
# have to redo this when upgrading to a newer version of doxygen or when
# changing the value of configuration settings such as GENERATE_TREEVIEW!
HTML_HEADER =
@@ -929,7 +887,7 @@ HTML_FOOTER =
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# style sheet in the HTML output directory as well, or it will be erased!
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET =
@@ -943,7 +901,7 @@ HTML_STYLESHEET =
HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the style sheet and background images
# Doxygen will adjust the colors in the stylesheet and background images
# according to this color. Hue is specified as an angle on a colorwheel,
# see http://en.wikipedia.org/wiki/Hue for more information.
# For instance the value 0 represents red, 60 is yellow, 120 is green,
@@ -1138,26 +1096,12 @@ GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
# at top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. Since the tabs have the same information as the
# navigation tree you can set this option to NO if you already set
# GENERATE_TREEVIEW to YES.
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
# Windows users are probably better off using the HTML help feature.
# Since the tree basically has the same information as the tab index you
# could consider to set DISABLE_INDEX to NO when enabling this option.
GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
# (range [0,1..20]) that doxygen will group on one line in the generated HTML
# documentation. Note that a value of 0 will completely suppress the enum
@@ -1165,6 +1109,16 @@ GENERATE_TREEVIEW = YES
ENUM_VALUES_PER_LINE = 4
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = YES
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list.
@@ -1217,11 +1171,6 @@ USE_MATHJAX = NO
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
# names that should be enabled during MathJax rendering.
MATHJAX_EXTENSIONS =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
@@ -1230,7 +1179,7 @@ MATHJAX_EXTENSIONS =
# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = YES
SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
@@ -1335,12 +1284,6 @@ LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
# http://en.wikipedia.org/wiki/BibTeX for more info.
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -1372,7 +1315,7 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
# Load style sheet definitions from file. Syntax is similar to doxygen's
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
@@ -1642,30 +1585,32 @@ HAVE_DOT = YES
DOT_NUM_THREADS = 0
# By default doxygen will use the Helvetica font for all dot files that
# doxygen generates. When you want a differently looking font you can specify
# the font name using DOT_FONTNAME. You need to make sure dot is able to find
# the font, which can be done by putting it in a standard location or by setting
# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
# directory containing the font.
# By default doxygen will write a font called Helvetica to the output
# directory and reference it in all dot files that doxygen generates.
# When you want a differently looking font you can specify the font name
# using DOT_FONTNAME. You need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
DOT_FONTNAME = Roboto
DOT_FONTNAME = FreeSans
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the Helvetica font.
# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
# set the path where dot can find it.
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
# can find it using this tag.
DOT_FONTPATH =
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# CLASS_DIAGRAMS tag to NO.
# the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES
@@ -1736,21 +1681,10 @@ DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. Possible values are svg, png, jpg, or gif.
# If left blank png will be used. If you choose svg you need to set
# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible in IE 9+ (other browsers do not have this requirement).
# If left blank png will be used.
DOT_IMAGE_FORMAT = png
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
# Note that this requires a modern browser other than Internet Explorer.
# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible. Older versions of IE do not have SVG support.
INTERACTIVE_SVG = NO
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
@@ -1801,7 +1735,7 @@ DOT_TRANSPARENT = NO
# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = YES
DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
-165
View File
@@ -1,165 +0,0 @@
# AP242 Schema Comparison: Flow-Sensitive Narrowing vs TREAT Expression
## Overview
This document compares two versions of the AP242 schema to demonstrate the difference between STEPcode's non-standard flow-sensitive narrowing extension and the ISO 10303-11 compliant TREAT expression.
## Schema Versions
### 1. Original Version (`242_mim_lf.exp`)
- **Status**: Uses implicit flow-sensitive narrowing (non-standard extension)
- **Location**: `data/ap242/242_mim_lf.exp`
- **Size**: 54,756 lines
- **Problematic code**: Line 34149 in `styled_item` entity, WR3 WHERE rule
### 2. TREAT Version (`242_mim_lf_treat.exp`)
- **Status**: Standards-compliant using TREAT expression
- **Location**: `data/ap242/242_mim_lf_treat.exp`
- **Size**: 54,756 lines
- **Fix applied**: Line 34149 - explicit TREAT expression
## The Problem
In the `styled_item` entity at line ~34148, the WHERE rule WR3 contains:
```express
WR3: ('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.MAPPED_ITEM' IN TYPEOF(item)) OR
('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.GEOMETRIC_REPRESENTATION_ITEM' IN TYPEOF(item)) OR
(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.SET_REPRESENTATION_ITEM' IN TYPEOF(item)) AND
(SIZEOF(QUERY(it <* item | ...)) = 0));
```
### Issue
- `item` is of type `styled_item_target`, which is a SELECT type
- The SELECT contains `set_representation_item` (which is an aggregate type)
- The code checks `'SET_REPRESENTATION_ITEM' IN TYPEOF(item)` (a TYPEOF guard)
- Then tries to iterate over `item` in a QUERY: `QUERY(it <* item | ...)`
### Why This Was Problematic
According to strict ISO 10303-11 standards, you cannot iterate over a SELECT type directly in a QUERY expression, even if there's a preceding TYPEOF guard. The guard and the QUERY are separate expressions in an AND clause.
## The Solutions
### Solution 1: Flow-Sensitive Narrowing (Non-Standard Extension)
STEPcode implements a **flow-sensitive type narrowing** extension that:
1. Recognizes the pattern `'TypeName' IN TYPEOF(var)` in AND expressions
2. Automatically narrows the type of `var` to `TypeName` for subsequent expressions in the AND
3. Allows `QUERY(it <* item | ...)` to work because `item` is implicitly narrowed to `set_representation_item`
**Code (original, line 34149)**:
```express
QUERY(it <* item | ...)
```
**How it works**:
- The AND expression LHS has the guard: `'SET_REPRESENTATION_ITEM' IN TYPEOF(item)`
- The RHS has the QUERY: `SIZEOF(QUERY(it <* item | ...)) = 0`
- STEPcode's narrowing recognizes the pattern and narrows `item` to `set_representation_item`
- The QUERY can now iterate over the narrowed type
### Solution 2: TREAT Expression (Standards-Compliant)
The ISO 10303-11 standard provides the TREAT expression for explicit type narrowing:
**Code (TREAT version, line 34149)**:
```express
QUERY(it <* TREAT(item AS set_representation_item) | ...)
```
**How it works**:
- `TREAT(item AS set_representation_item)` explicitly narrows the SELECT type to the member type
- The QUERY can iterate over the result of TREAT, which is guaranteed to be `set_representation_item`
- No implicit narrowing needed - the intent is explicit in the code
## The Exact Difference
```diff
--- data/ap242/242_mim_lf.exp
+++ data/ap242/242_mim_lf_treat.exp
@@ -34146,7 +34146,7 @@
('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.GEOMETRIC_REPRESENTATION_ITEM' IN TYPEOF(item)) OR
(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.SET_REPRESENTATION_ITEM' IN TYPEOF(item)) AND
(SIZEOF(QUERY(it
- <* item
+ <* TREAT(item AS set_representation_item)
| NOT (('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.MAPPED_ITEM' IN TYPEOF(it)) OR
('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.GEOMETRIC_REPRESENTATION_ITEM' IN
TYPEOF(it))))) =
```
**Change**: Single line change from `<* item` to `<* TREAT(item AS set_representation_item)`
## Testing Results
### Original Version (with Flow-Sensitive Narrowing)
```bash
./build/bin/exp2cxx data/ap242/242_mim_lf.exp /tmp/ap242_original_test
```
**Result**: ✅ Parses successfully, generates 5,626 C++ files
### TREAT Version (Standards-Compliant)
```bash
./build/bin/exp2cxx data/ap242/242_mim_lf_treat.exp /tmp/ap242_treat_test
```
**Result**: ✅ Parses successfully, generates 5,626 C++ files
### Output Comparison
Both versions generate identical output:
- Same number of entities
- Same entity relationships
- Same multiple inheritance warnings
- Identical "Finished writing files" status
## Verification
To verify both versions produce consistent output:
```bash
# Parse original version
mkdir -p /tmp/ap242_original
./build/bin/exp2cxx data/ap242/242_mim_lf.exp /tmp/ap242_original
# Parse TREAT version
mkdir -p /tmp/ap242_treat
./build/bin/exp2cxx data/ap242/242_mim_lf_treat.exp /tmp/ap242_treat
# Compare generated headers (should be identical except for file references)
diff /tmp/ap242_original/SdaiAP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.h \
/tmp/ap242_treat/SdaiAP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.h
```
## Implications
### For STEPcode Users
- **Current**: Both versions work due to flow-sensitive narrowing extension
- **Future**: TREAT version is more portable if other EXPRESS parsers are used
- **Recommended**: Use TREAT for new schemas to ensure standards compliance
### For STEPcode Development
- Flow-sensitive narrowing is a valuable usability extension
- TREAT expression provides standards-compliant alternative
- Both should continue to be supported for compatibility
### For Standards Compliance
- Original AP242 schema uses pattern that requires extension
- TREAT version is fully ISO 10303-11 compliant
- TREAT makes intent explicit and improves code clarity
## Related Documentation
- `doc/express-type-unwrapping.md` - Full documentation of TREAT and narrowing features
- `src/express/test/README_AP242_BASELINE.md` - Historical PE056 error documentation
- Test schemas:
- `test/unitary_schemas/flow_narrowing_test.exp` - Flow-sensitive narrowing examples
- `test/unitary_schemas/minimal_treat_test.exp` - TREAT expression examples
## Conclusion
This comparison demonstrates:
1. ✅ STEPcode's flow-sensitive narrowing successfully handles the original AP242 schema
2. ✅ TREAT expression provides the standards-compliant alternative
3. ✅ Both approaches produce identical, correct output
4. ✅ The single-line change makes the code more explicit and portable
The availability of both approaches gives users flexibility while maintaining standards compliance when needed.
-251
View File
@@ -1,251 +0,0 @@
# AP242 API v2 Output Benchmarks
This file records comparable measurements for the staged API v2 output
work. It is intended to make changes in generated output cost visible in
the commits which introduce them.
## Method
The measurements were made on 2026-08-02 with GCC 13.3.0 and C++11.
The schema under test was BRL-CAD's `ap242e4.exp` conversion schema.
The real exchange-file workload was the NIST STC 09 ASME AP242 edition
4 sample, `nist_stc_09_asme1_ap242-e4.stp`.
The generator used `--late-bound`, the default 64-entity and 8-type chunk
limits, and a release STEPcode build. Compilation used `-O2 -fPIC` and two
concurrent compiler processes. Generated-output counts include `.cc`, `.h`,
and `.cmake` files through directory depth two. The baseline is commit
`fa2758c5` before recommendations 1--4.
## Results
| Measurement | Baseline | Recommendations 1--4 | Change |
|---|---:|---:|---:|
| Generated files | 5,719 | 905 | -84.2% |
| Generated lines | 254,220 | 123,552 | -51.4% |
| Generated bytes | 13,942,523 | 9,804,680 | -29.7% |
| Entity leaf files | 4,814 | 0 | -100.0% |
| Generation wall time | 2.74 s | 0.56 s | -79.6% |
| Generation peak RSS | 109,024 KiB | 109,280 KiB | +0.2% |
| Compile/link wall time | 157.68 s | 37.02 s | -76.5% |
| Compile/link user time | 277.75 s | 66.32 s | -76.1% |
| Compile/link peak RSS | 593,320 KiB | 199,156 KiB | -66.4% |
| Schema shared library | 9,956,640 B | 7,716,096 B | -22.5% |
| ELF relocations | 28,843 | 39,719 | +37.7% |
| Function symbols | 15,641 | 13,542 | -13.4% |
| Read/write wall time | 0.26 s | 0.25 s | -3.8% |
| Read/write peak RSS | 88,732 KiB | 85,040 KiB | -4.2% |
The relocation increase is caused by the stable module-ID tables referring
to descriptor slots. It is recorded here because the packed schema image
stage is expected to remove most of that cost.
## Recommendations 1--4
This stage adds stable entity, type, and attribute IDs through `SchemaModule`,
makes compatibility entity names opt-in for late-bound output, moves schema
rules and complex-entity support to runtime-consumed tables, and writes late
entity metadata directly to bounded chunks instead of creating 4,814 leaf
files.
The real AP242 exchange-file check created and validated 10,609 instances
with zero errors and zero warnings. Its 949,685-byte rewritten Part 21 file
matched the baseline apart from the expected `FILE_NAME` timestamp.
## Recommendation 5
This stage resolves each late-bound entity's flattened attribute layout once
after schema initialization. Instance construction then follows descriptor
and index records directly instead of recursively walking supertypes and
repeating attribute-name searches. The cache is external to
`EntityDescriptor`, so its object layout and the API v1 ABI are unchanged.
The construction benchmark uses the 1,531 `DIRECTION` instances in the real
exchange file and repeats that population 1,000 times. This isolates the
work changed by this stage while retaining a type and frequency from the
AP242 workload. Results are the median of three runs.
| Measurement | Recommendations 1--4 | Recommendation 5 | Change |
|---|---:|---:|---:|
| 1,531,000 entity constructions | 0.84 s | 0.63 s | -25.0% |
| Construction user time | 0.82 s | 0.61 s | -25.6% |
| Construction peak RSS | 68,956 KiB | 69,600 KiB | +0.9% |
| 20 full read/write runs | 4.90 s | 4.91 s | no measurable change |
| Full read/write peak RSS | 85,164 KiB | 85,732 KiB | +0.7% |
| `libstepcore` size | 640,936 B | 651,312 B | +1.6% |
The complete exchange-file check still created and validated 10,609
instances with zero errors and zero warnings. Its rewritten file remained
949,685 bytes and differed from the previous stage only in the expected
`FILE_NAME` timestamp. Generated schema file counts, source size, and the
schema shared library are unchanged because this is a shared-runtime change.
## Recommendation 6
This stage replaces the generated `SchemaModuleSlot` pointer arrays with a
16-byte, relocation-free `SchemaModuleImage`. Shared initialization helpers
capture descriptor pointers in stable generated-ID order and transfer those
vectors to `SchemaModule` after initialization. The older slot-based entry
point remains available for existing generated API v2 code.
Source and binary measurements compare recommendation 5 with the packed
image. Compile times use matching clean CMake builds with two compiler
processes. Read/write times are medians from paired 20-run batches.
| Measurement | Recommendation 5 | Recommendation 6 | Change |
|---|---:|---:|---:|
| Generated files | 905 | 905 | unchanged |
| Generated lines | 123,552 | 117,046 | -5.3% |
| Generated bytes | 9,804,680 | 9,060,249 | -7.6% |
| Schema module source | 808,907 B | 64,367 B | -92.0% |
| Schema module source lines | 7,280 | 773 | -89.4% |
| Compile/link wall time | 41.38 s | 41.49 s | no measurable change |
| Compile/link peak RSS | 208,312 KiB | 208,188 KiB | -0.1% |
| Schema shared library | 7,728,384 B | 7,470,304 B | -3.3% |
| ELF relocations | 39,719 | 33,221 | -16.4% |
| 20 full read/write runs | 5.10 s | 5.07 s | -0.6% |
| Full read/write peak RSS | 85,736 KiB | 85,572 KiB | -0.2% |
| `libstepcore` size | 651,312 B | 661,088 B | +1.5% |
The image removes 6,498 per-descriptor pointer relocations. The shared
runtime grows by 9,776 bytes once, while each AP242 schema library is 258,080
bytes smaller. Generated API v1 output and the conventional public entity
classes remain unchanged.
The complete exchange-file check again created and validated 10,609
instances with zero errors and zero warnings. Its 949,685-byte rewrite
differed from recommendation 5 only in the expected `FILE_NAME` timestamp.
## Recommendation 7
This stage replaces the remaining generated descriptor procedures with one
bounded, offset-based schema image. The shared loader validates every array,
string, range, descriptor reference, schema binding, and complex-entity tree
before it changes the registry. It then constructs the descriptor graph with
an explicit per-load context; the process-global capture path remains only for
older generated API v2 code. Complex-entity metadata uses the same packed
representation and validation model.
Source and binary measurements compare recommendation 6 with the complete
descriptor image. Compile times use clean CMake builds with two compiler
processes. Read/write times use matching 20-run batches.
| Measurement | Recommendation 6 | Recommendation 7 | Change |
|---|---:|---:|---:|
| Generated files | 905 | 865 | -4.4% |
| Generated lines | 117,046 | 86,400 | -26.2% |
| Generated bytes | 9,060,249 | 4,865,657 | -46.3% |
| Entity initialization chunks | 38 | 0 | -100.0% |
| Compile/link wall time | 41.49 s | 18.71 s | -54.9% |
| Compile/link peak RSS | 208,188 KiB | 208,528 KiB | +0.2% |
| Schema shared library | 7,470,304 B | 3,503,352 B | -53.1% |
| ELF relocations | 33,221 | 9,620 | -71.0% |
| 20 full read/write runs | 5.07 s | 4.97 s | -2.0% |
| Full read/write peak RSS | 85,572 KiB | 82,916 KiB | -3.1% |
The image removes the 2,407 generated entity initialization functions and
23,601 additional relocations. The generated schema library is 3,966,952
bytes smaller, while its existing typed SELECT and enumeration factories
remain available for this transitional stage.
The complete exchange-file check created and validated 10,609 instances with
zero errors and zero warnings. Its 949,685-byte rewrite retained the same
semantic result as recommendation 6.
## Recommendations 8 and 9
This stage makes the compact late-bound output independent of generated type
classes. Shared descriptor-driven implementations now construct SELECT,
enumeration, and aggregate values, including nested values and BOOLEAN or
LOGICAL aliases. Enumeration elements and renamed USE or REFERENCE items are
retained in the packed image. The conventional early-bound API v1 and API v2
paths still emit their schema-specific type classes.
The generated schema header is now a dependency-bounded consumer interface.
It contains stable entity, type, and attribute IDs plus `SchemaModule` lookup
functions, and includes only `schemaModule.h`. Runtime and model-construction
declarations remain in the internal `schema.h` umbrella.
| Measurement | Recommendation 7 | Recommendations 8--9 | Change |
|---|---:|---:|---:|
| Generated files | 865 | 10 | -98.8% |
| Generated lines | 86,400 | 54,839 | -36.5% |
| Generated bytes | 4,865,657 | 3,303,993 | -32.1% |
| Type leaf files | 802 | 0 | -100.0% |
| Type initialization chunks | 51 | 0 | -100.0% |
| Compile/link wall time | 18.71 s | 1.21 s | -93.5% |
| Compile/link peak RSS | 208,528 KiB | 126,580 KiB | -39.3% |
| Schema shared library | 3,503,352 B | 2,178,296 B | -37.8% |
| ELF relocations | 9,620 | 49 | -99.5% |
| Exported function symbols | 4,647 | 8 | -99.8% |
| Public header preprocessed bytes | 2,384,191 | 635,945 | -73.3% |
| 20 full read/write runs | 4.97 s | 4.91 s | -1.2% |
| Full read/write peak RSS | 82,916 KiB | 82,304 KiB | -0.7% |
The complete exchange-file check again created and validated 10,609
instances with zero errors and zero warnings, and wrote the same 949,685-byte
semantic result. Runtime unit coverage separately exercises generic SELECT,
enumeration, aggregate, malformed-image, and packed rename behavior.
## Recommendation 10
This stage adds an opt-in `structural` metadata profile for late-bound API
version 2. The default `full` profile is unchanged. Structural images keep
the descriptor graph needed to construct, read, write, and inspect entity,
attribute, type, aggregate, enumeration, SELECT, inverse, and renamed values.
They omit EXPRESS descriptions, WHERE and UNIQUE rules, schema rule and
algorithm text, supertype statements, derived expressions, and symbolic
aggregate-bound text.
The source and library measurements below compare matching fresh output from
the two profiles. Compile times use clean CMake builds with one compiler
process; read/write times use matching 20-run batches.
| Measurement | Full metadata | Structural metadata | Change |
|---|---:|---:|---:|
| Generated files | 10 | 10 | unchanged |
| Generated lines | 54,839 | 29,993 | -45.3% |
| Generated bytes | 3,304,007 | 1,525,897 | -53.8% |
| Packed schema source | 2,612,413 B | 834,303 B | -68.1% |
| Generation wall time | 0.48 s | 0.41 s | -14.6% |
| Compile/link wall time | 2.08 s | 2.03 s | -2.4% |
| Compile/link peak RSS | 126,784 KiB | 118,220 KiB | -6.8% |
| Schema shared library | 2,178,296 B | 720,120 B | -66.9% |
| ELF relocations | 49 | 49 | unchanged |
| 20 full read/write runs | 4.76 s | 4.71 s | -1.1% |
| Full read/write peak RSS | 82,276 KiB | 78,900 KiB | -4.1% |
The structural profile created and validated all 10,609 instances in the
real exchange file with zero errors and zero warnings. It wrote the same
949,685-byte semantic result as the full profile.
## Recommendation 11
This stage writes each generated file to a sibling temporary file and replaces
the destination only when its content changes. A compact generated-file
manifest supports safe cleanup when an option change makes old entity, type,
or unity files obsolete; files not named by the previous manifest are left
alone. The manifest itself is also content-stable.
The deterministic-output audit also found that nonliteral aggregate bounds
were being read through the integer member of the expression union. Packed
images now emit those bounds as expression records, eliminating process-address
values from generated AP242 source as well as correcting the metadata kind.
| Measurement after identical AP242 generation | Rewrite all | Stable output | Change |
|---|---:|---:|---:|
| Changed schema source/header timestamps | 10 of 10 | 0 of 10 | -100.0% |
| Changed manifest timestamps | n/a | 0 of 1 | stable |
| Generation wall time | 0.41 s | 0.40 s | no overhead |
| Following CMake build wall time | 2.01 s | 0.06 s | -97.0% |
| Following build peak RSS | 118,108 KiB | 18,432 KiB | -84.4% |
The AP242 manifest is 390 bytes. Switching the focused regression schema
from early-bound API version 2 to compact late-bound output removes all stale
entity, type, and unity files and their empty directories while preserving an
unrelated file in the output directory.
The real exchange-file check still created and validated all 10,609 instances
with zero errors and zero warnings. Its rewritten result remained 949,685
bytes.
+1 -1
View File
@@ -36,7 +36,7 @@
<!-- This is a single string setting. When writing this out to the doxyfile,
it will be quoted and treated as a whole. -->
<string name="OUTPUT_LANGUAGE">English</string>
<!-- A list setting contains multiple elements, separated by whitespace. Each
<!-- A list setting contains multiple elements, seperated by whitespace. Each
individual item will be quoted and treated as a whole for Doxygen. By
default a list replaces the existing setting. If the append attribute is
set to true, then the items will be added to the existing set. -->
-367
View File
@@ -1,367 +0,0 @@
# EXPRESS Type Unwrapping and Narrowing
## Overview
This document describes the type unwrapping and narrowing features implemented in STEPcode's EXPRESS compiler. These features enable proper type checking and semantic analysis for aggregate types and SELECT type narrowing.
**Note:** Some features described here are extensions beyond the ISO 10303-11 standard and are explicitly marked as such.
## Deep Aggregate Unwrapping
### Background
In EXPRESS, aggregate types (ARRAY, LIST, SET, BAG) can be nested and wrapped in type definitions. For semantic analysis and type checking, the compiler often needs to "unwrap" these layers to access the underlying element type.
### Shallow vs Deep Type Checking
#### Shallow Aggregate Check: `TYPEis_aggregate`
The macro `TYPEis_aggregate(t)` performs a **shallow** check by testing if `t->u.type->body->base` is non-NULL. This indicates the type has a base type, which is characteristic of aggregate types.
```c
#define TYPEis_aggregate(t) ((t)->u.type->body->base)
```
**Important:** This is a shallow check and does not follow type definition chains. It returns true if the immediate type structure has a base type.
**Use when:**
- You need a quick check if a type is directly an aggregate
- You're working with the immediate type structure
- Performance is critical and deep unwrapping isn't needed
#### Deep Aggregate Unwrapping: `TYPEget_nonaggregate_base_type`
The function `TYPEget_nonaggregate_base_type(Type t)` performs **deep unwrapping** by iteratively following the chain of aggregate base types until reaching a non-aggregate type.
```express
TYPE int_list = LIST OF INTEGER;
TYPE named_int_list = int_list; -- typedef chain
TYPE set_of_lists = SET OF named_int_list;
```
For `set_of_lists`:
- `TYPEis_aggregate()` → true (immediate check)
- `TYPEget_nonaggregate_base_type()` → INTEGER (unwraps through SET → LIST → INTEGER)
**Use when:**
- Comparing element types across different aggregate wrappers
- Type resolution requires the ultimate element type
- Semantic checking needs to validate deep type compatibility
### Deep Unwrapping Implementation
```c
Type TYPEget_nonaggregate_base_type( Type t ) {
while( TYPEis_aggregate( t ) ) {
t = t->u.type->body->base;
}
return t;
}
```
This function safely handles:
- Nested aggregates (SET OF LIST OF ...)
- Type definition chains
- Mixed aggregate types
### Aggregate Type Comparison: `TYPE_retrieve_aggregate`
For SELECT types containing multiple aggregate members, `TYPE_retrieve_aggregate()` validates that all aggregate members share the same element type.
```express
TYPE item_a = SET OF INTEGER;
TYPE item_b = LIST OF INTEGER;
TYPE my_select = SELECT(item_a, item_b); -- Valid: both have INTEGER elements
```
The function:
1. Iterates through SELECT members
2. Identifies which are aggregates
3. Unwraps typedef chains to find element types
4. Returns common element type or NULL if incompatible
## TREAT Expression Semantics
### ISO 10303-11 Standard Syntax
The TREAT expression is defined in ISO 10303-11 as:
```express
TREAT(expression AS type_identifier)
```
**Purpose:** Explicitly narrow a SELECT type to one of its member types.
### STEPcode Implementation
STEPcode implements TREAT as specified in ISO 10303-11 with the following semantics:
#### Type Resolution
1. **Operand Resolution:** The expression being narrowed is resolved first
```c
EXPresolve( e->e.op1, s, Type_Dont_Care );
operand_type = e->e.op1->return_type;
```
2. **Target Type Lookup:** The target type identifier is resolved via scope lookup
```c
target_type = (Type)SCOPEfind( s, e->symbol.name, SCOPE_FIND_TYPE );
```
3. **Type Compatibility:** The implementation validates that narrowing is semantically valid
- For SELECT operands: Verifies target is a member type
- For other types: Allows permissively (may emit warnings)
4. **Return Type:** The expression's return type becomes the target type
```c
return target_type; /* Not Type_Generic */
```
#### Error Handling
**Clear errors with location information:**
- **Missing operand:** `SYNTAX` error - "TREAT expression missing operand"
- **Missing target type:** `SYNTAX` error - "TREAT expression missing target type"
- **Undefined type:** `UNDEFINED_TYPE` error with the type name
- **Type mismatch:** Currently permissive (no error, future: may warn)
All errors use `ERRORreport_with_symbol()` which provides:
- File name and line number
- Symbol context
- Descriptive error message
#### Example Usage
```express
TYPE attachment = SELECT(nail, screw);
END_TYPE;
FUNCTION get_length(item : attachment) : REAL;
LOCAL
n : nail;
END_LOCAL;
IF ('EXAMPLE.NAIL' IN TYPEOF(item)) THEN
n := TREAT(item AS nail); -- Narrows SELECT to nail
RETURN n.length;
END_IF;
RETURN 0.0;
END_FUNCTION;
```
### Grammar Integration
The TREAT syntax is integrated into the EXPRESS parser grammar as a unary expression:
```yacc
unary_expression ::= TOK_TREAT TOK_LEFT_PAREN expression TOK_AS
TOK_IDENTIFIER TOK_RIGHT_PAREN
```
Key points:
- `TOK_TREAT`: Recognized as a keyword
- Creates unary expression with `OP_TREAT` operator
- Operand stored in `op1`
- Target type name stored in `symbol` field
## Flow-Sensitive SELECT Narrowing
**Extension Status:** This is a **non-standard extension** that enhances type safety for SELECT types.
### Background
EXPRESS WHERE clauses often use TYPEOF guards to check SELECT types before accessing member-specific attributes. Flow-sensitive narrowing automatically narrows SELECT types within the scope of such guards.
### Pattern Recognition
The narrowing system recognizes this pattern:
```express
'TypeName' IN TYPEOF(variable)
```
When this pattern appears in an AND conjunction, the variable is narrowed to `TypeName` for subsequent expressions in the conjunction.
### Implementation Architecture
#### Refinement Context
A **refinement context** tracks active type narrowings during expression resolution:
```c
typedef struct RefinementContext_ {
Refinement refinements; /* Linked list of variable → type mappings */
struct RefinementContext_ *previous; /* Stack of contexts */
} *RefinementContext;
RefinementContext active_refinements = NULL; /* Thread-local global */
```
#### Pattern Matching
The function `match_typeof_guard()` identifies guard patterns:
1. Expression is `IN` operator
2. Left operand is string literal (type name)
3. Right operand is `TYPEOF(identifier)`
4. Identifier resolves to a variable
#### Refinement Collection
The function `collect_refinements_from_conjunction()` recursively walks AND expressions:
1. Recursively descends into AND nodes
2. Matches TYPEOF guard patterns at leaves
3. Validates narrowing is semantically correct:
- Variable must have SELECT type
- Target type must be SELECT member (validated via `is_select_member()`)
4. Returns linked list of valid refinements
#### Application
In `EXPresolve_op_and()`:
```c
Type EXPresolve_op_and(Expression e, Scope s) {
EXPresolve(e->e.op1, s, Type_Dont_Care); /* Resolve LHS normally */
Refinement refs = collect_refinements_from_conjunction(e->e.op1, s);
if (refs) {
/* Create temporary context */
struct RefinementContext_ ctx;
ctx.refinements = refs;
ctx.previous = active_refinements;
active_refinements = &ctx;
EXPresolve(e->e.op2, s, Type_Dont_Care); /* Resolve RHS with narrowing */
/* Restore previous context */
active_refinements = ctx.previous;
free_refinements(refs);
} else {
EXPresolve(e->e.op2, s, Type_Dont_Care);
}
return Type_Logical;
}
```
### Behavior Scope
**What is narrowed:**
- Variables with SELECT type
- Within RHS of AND expressions
- Where LHS contains TYPEOF guard
**What is NOT narrowed:**
- OR expressions (conservative - doesn't extract from disjunction)
- NOT expressions (conservative - doesn't extract from negation)
- Other boolean operators
- Variables not guarded by TYPEOF
**Rationale:** Conservative approach prevents false narrowing in cases where the guard may not hold.
### Limitations
1. **Single-level context:** Only immediate AND RHS is narrowed, not deeply nested scopes
2. **No cross-statement narrowing:** Limited to expression-level scope
3. **AND-only:** Does not propagate through OR/NOT (conservative)
4. **Pattern-based:** Only recognizes exact `'Type' IN TYPEOF(var)` pattern
### Example
```express
ENTITY test_entity;
item : target; -- target is SELECT(set_representation_item, simple_int)
WHERE
wr1: ('SCHEMA.SET_REPRESENTATION_ITEM' IN TYPEOF(item)) AND
(SIZEOF(item) > 0); -- item narrowed to set_representation_item
END_ENTITY;
```
Without narrowing, `SIZEOF(item)` would fail (can't take SIZEOF of SELECT). With narrowing, `item` is known to be an aggregate, so `SIZEOF` is valid.
## Memory Management
### Refinement Lifecycle
1. **Collection:** `collect_refinements_from_conjunction()` allocates refinement nodes
2. **Usage:** Active during RHS expression resolution only
3. **Cleanup:** `free_refinements()` called after RHS resolution completes
### Context Stack Model
The implementation uses a **stack-based context model** rather than deep copying:
- `RefinementContext` has `previous` pointer forming a stack
- New contexts pushed onto stack with `active_refinements = &ctx`
- Restored with `active_refinements = ctx.previous`
- No deep copying of refinement data
**Memory safety:**
- Refinement nodes allocated individually
- Freed immediately after use
- No dangling pointers (stack-local contexts)
- No memory leaks (verified by code inspection)
## Testing
### Test Coverage
**TREAT expression tests:**
- `test/unitary_schemas/minimal_treat_test.exp` - Basic TREAT usage
- `test/unitary_schemas/test_treat_real.exp` - Nested SELECT types
- `test/unitary_schemas/treat_expression.exp` - TREAT in WHERE clauses
**Flow-sensitive narrowing tests:**
- `test/unitary_schemas/flow_narrowing_test.exp` - AND-based narrowing
- `test/unitary_schemas/select_aggregate_test.exp` - SELECT of aggregates
**Production schema comparison:**
- `data/ap242/242_mim_lf.exp` - Original AP242 with flow-sensitive narrowing
- `data/ap242/242_mim_lf_treat.exp` - TREAT-based standards-compliant version
- `test/compare_ap242_versions.sh` - Automated comparison script
See `doc/ap242-comparison.md` for detailed analysis of the AP242 schema comparison.
### AP242 Compatibility
The implementation is validated against the AP242 schema, ensuring:
- Large-scale schema parsing succeeds
- Complex type hierarchies handled correctly
- Production schema compatibility
**AP242 Schema Versions:**
- `data/ap242/242_mim_lf.exp` - Original schema using flow-sensitive narrowing extension
- `data/ap242/242_mim_lf_treat.exp` - Standards-compliant version using TREAT expression
Both versions parse successfully and produce identical output. See `doc/ap242-comparison.md` for detailed analysis.
## Standards Compliance Notes
### ISO 10303-11 Compliance
**Fully compliant:**
- TREAT expression syntax and semantics
- Aggregate type definitions
- SELECT type definitions
- Standard type resolution rules
**Extensions (non-standard):**
- Flow-sensitive type narrowing in AND expressions
- Permissive TREAT type checking (warns vs errors)
### Extension Philosophy
STEPcode's extensions follow these principles:
1. **Conservative:** Only apply when semantically safe
2. **Permissive:** Prefer warnings over errors where reasonable
3. **Explicit:** Document extensions clearly
4. **Compatible:** Don't break standard-compliant schemas
Extensions are designed to enhance usability while maintaining backward compatibility with ISO 10303-11 compliant EXPRESS schemas.
+2 -34
View File
@@ -5,7 +5,7 @@
.\" $Id: exp2cxx.1,v 2.1.0.2 1998/02/27 23:54:30 sauderd Exp $
.TH FEDEX_PLUS 1 "19 November 1997"
.SH NAME
exp2cxx - EXPRESS compiler and translator
exp2cxx - EXPRESS compiler and translater
.SH SYNOPSIS
exp2cxx [ options ] [ express-file ]
.nf
@@ -45,11 +45,6 @@ EXPRESS code into C++ source code. The C++ source code is generated
in files in the directory in which exp2cxx was run. The files are
named according to the schema names in the input EXPRESS file.
Generated files are replaced only when their content changes. exp2cxx records
the files it owns in `.exp2cxx-manifest`; a later run removes obsolete files
from that manifest while leaving unrelated files in the output directory
untouched.
.SH OPTIONS
.TP
.B -s|S
@@ -62,34 +57,6 @@ Generates C++ classes for use with CORBA (Orbix).
.B -l|L
Prints logging code in the generated C++ classes.
.TP
.B -k entity-chunk-size[:type-chunk-size]
Limits the number of generated schema objects in each deterministic unity
translation unit. A single value applies to both entity and type chunks.
.TP
.B -V 1|2, --api-version 1|2
Selects the generated C++ API. Version 1 is the source-compatible default.
Version 2 emits compact SELECT classes, table-driven schema initialization, and
dependency-bounded entity headers backed by shared runtime code. Version 2
clients include the individual entity headers they use; schema.h does not
include every entity class definition.
.TP
.B -T, --late-bound
Selects API version 2 and omits generated early-bound C++ entity classes.
Entity instances are constructed at runtime from schema descriptors. This mode
is intended for conversion and inspection applications which do not require the
conventional generated entity API.
.TP
.B --compat-names
Retains the generated entity-name aliases in late-bound output. Normal
late-bound API v2 output uses schema module IDs instead and omits these aliases.
.TP
.B --metadata full|structural
Selects the generated schema metadata profile. Full is the default and
retains EXPRESS descriptions, constraints, and executable schema text.
Structural is available with late-bound API version 2; it retains the entity,
attribute, type, aggregate, enumeration, SELECT, inverse, and rename graph
needed by conversion tools while omitting descriptive and constraint text.
.TP
.B -v
Produces a version description.
.TP
@@ -194,3 +161,4 @@ appropriate file to download).
.SH BUGS
See fedex(1).
+12 -6
View File
@@ -6,7 +6,7 @@
# for the use of this file.
#
project(AP203Minimum)
cmake_minimum_required(VERSION 3.12)
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)
@@ -14,14 +14,14 @@ if(NOT DEFINED STEPCODE_ROOT_DIR)
endif(NOT DEFINED STEPCODE_ROOT_DIR)
# STEPCODE_ROOT_DIR is relative or absolute path?
if(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/src/express/express.c")
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}/src/express/express.c")
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}/src/express/express.c")
endif(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/src/express/express.c")
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.
@@ -31,6 +31,7 @@ set(SC_IS_SUBBUILD TRUE)
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")
@@ -50,13 +51,18 @@ endif(NOT EXISTS ${SCHEMA_FILE})
get_filename_component(SCHEMA_SN ${SCHEMA_FILE} NAME)
string(REGEX REPLACE "\(.*\).[Ee][Xx][Pp]" "sdai_\\1" SCHEMA_LINK_NAME ${SCHEMA_SN})
set(STEPCODE_LIBRARIES stepcore stepeditor stepdai steputils ${SCHEMA_LINK_NAME})
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)
# 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}
@@ -1,77 +0,0 @@
#
# CMakeLists.txt for AP203 Minimum
#
# This file is released to the public domain. Any part of this file may be
# 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 3.12)
INCLUDE( ExternalProject )
set(CMAKE_MODULE_PATH ${AP203Minimum_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
INCLUDE( External_STEPCode )
#####
# Variables ideally set by FindSTEPCode.cmake
IF(NOT WIN32)
set( STEPCODE_LIBRARIES
${STEPCODE_INSTALL_DIR}/lib/libstepcore.a
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.a
${STEPCODE_INSTALL_DIR}/lib/libstepdai.a
${STEPCODE_INSTALL_DIR}/lib/libsteputils.a
${STEPCODE_INSTALL_DIR}/lib/libsdai_ap203.a
)
ELSE()
set( STEPCODE_LIBRARIES
${STEPCODE_INSTALL_DIR}/lib/libstepcore.lib
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.lib
${STEPCODE_INSTALL_DIR}/lib/libstepdai.lib
${STEPCODE_INSTALL_DIR}/lib/libsteputils.lib
${STEPCODE_INSTALL_DIR}/lib/libsdai_ap203.lib
${STEPCODE_INSTALL_DIR}/lib/libexpress.lib
${STEPCODE_INSTALL_DIR}/lib/libexppp.lib
shlwapi.lib
)
ENDIF()
MESSAGE( STATUS "STEPCODE_INSTALL_DIR: " ${STEPCODE_INSTALL_DIR} )
set( STEPCODE_INCLUDE_DIR
${STEPCODE_INSTALL_DIR}/include/stepcode
${STEPCODE_INSTALL_DIR}/include/stepcode/clstepcore
${STEPCODE_INSTALL_DIR}/include/stepcode/cldai
${STEPCODE_INSTALL_DIR}/include/stepcode/clutils
${STEPCODE_INSTALL_DIR}/include/stepcode/cleditor
${STEPCODE_INSTALL_DIR}/include/schemas/sdai_ap203
)
# End of variables ideally set by FindSTEPCode.cmake
######
include_directories(
${STEPCODE_INCLUDE_DIR}
)
set(SRCS ../ap203min.cpp)
set(HDRS )
add_executable( ${PROJECT_NAME} ${SRCS} ${HDRS})
add_dependencies( ${PROJECT_NAME} STEPCODE )
target_link_libraries( ${PROJECT_NAME}
${STEPCODE_LIBRARIES}
)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
@@ -1,24 +0,0 @@
ExternalProject_Add( STEPCODE
URL ${CMAKE_CURRENT_SOURCE_DIR}/../../..
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_BUILD_TYPE=Debug
-DSC_BUILD_SCHEMAS=ap203/ap203.exp
-DBUILD_STATIC_LIBS=ON
-DSC_PYTHON_GENERATOR=OFF
-DSC_INSTALL_PREFIX:PATH=<INSTALL_DIR>
)
ExternalProject_Get_Property( STEPCODE SOURCE_DIR )
ExternalProject_Get_Property( STEPCODE BINARY_DIR )
ExternalProject_Get_Property( STEPCODE INSTALL_DIR )
IF( NOT WIN32 )
SET( STEPCODE_INSTALL_DIR ${SOURCE_DIR}/../sc-install )
ELSE()
SET( STEPCODE_INSTALL_DIR ${INSTALL_DIR} )
ENDIF()
SET( STEPCODE_BINARY_DIR ${BINARY_DIR} )
+8 -8
View File
@@ -49,15 +49,15 @@
// $./AP203Minimum
// AP203Minimum outfile.stp
#include <cleditor/STEPfile.h>
#include <clstepcore/sdai.h>
#include <clstepcore/STEPattribute.h>
#include <clstepcore/ExpDict.h>
#include <clstepcore/Registry.h>
#include <clutils/errordesc.h>
#include <STEPfile.h>
#include <sdai.h>
#include <STEPattribute.h>
#include <ExpDict.h>
#include <Registry.h>
#include <errordesc.h>
#include <clstepcore/STEPcomplex.h>
#include <cleditor/SdaiHeaderSchema.h>
#include <STEPcomplex.h>
#include <SdaiHeaderSchema.h>
#include "schema.h"
-31
View File
@@ -1,31 +0,0 @@
#ifndef SCL_CF_H
#define SCL_CF_H
/**** Define statements for CMake ****/
#cmakedefine SC_VERSION "@SC_VERSION@"
#cmakedefine HAVE_NDIR_H 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_SYS_STAT_H 1
#cmakedefine HAVE_SYS_PARAM_H 1
#cmakedefine HAVE_SYSENT_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE_DIRENT_H 1
#cmakedefine HAVE_STDBOOL_H 1
#cmakedefine HAVE_PROCESS_H 1
#cmakedefine HAVE_IO_H 1
#cmakedefine SC_TRACE_FPRINTF 1
#cmakedefine HAVE_ABS 1
#cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1
#cmakedefine HAVE_GETOPT 1
#cmakedefine HAVE_VSNPRINTF 1
#cmakedefine HAVE_SSIZE_T 1
#cmakedefine HAVE_STD_THREAD 1
#cmakedefine HAVE_STD_CHRONO 1
#cmakedefine HAVE_NULLPTR 1
#endif /* SCL_CF_H */
+7 -11
View File
@@ -22,26 +22,22 @@ set(express_HDRS
express/variable.h
)
install(FILES ${express_HDRS}
DESTINATION ${INCLUDE_DIR}/stepcode/express)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/express)
set(exppp_HDRS
exppp/exppp.h
)
install(FILES ${exppp_HDRS}
DESTINATION ${INCLUDE_DIR}/stepcode/exppp)
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/exppp)
install(FILES ordered_attrs.h
sc_export.h
DESTINATION ${INCLUDE_DIR}/stepcode)
sc_stdbool.h
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
install(FILES ${SC_BINARY_DIR}/${INCLUDE_DIR}/config.h
DESTINATION ${INCLUDE_DIR}/stepcode)
add_subdirectory(cldai)
add_subdirectory(cleditor)
add_subdirectory(cllazyfile)
add_subdirectory(clstepcore)
add_subdirectory(clutils)
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)
# Local Variables:
# tab-width: 8
-24
View File
@@ -1,24 +0,0 @@
set(DAI_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
)
install(FILES ${DAI_HDRS}
DESTINATION ${INCLUDE_DIR}/stepcode/cldai)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-20
View File
@@ -1,20 +0,0 @@
set(EDITOR_HDRS
STEPfile.h
cmdmgr.h
editordefines.h
SdaiHeaderSchema.h
SdaiHeaderSchemaClasses.h
SdaiSchemaInit.h
seeinfodefault.h
)
install(FILES ${EDITOR_HDRS}
DESTINATION ${INCLUDE_DIR}/stepcode/cleditor)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-27
View File
@@ -1,27 +0,0 @@
set(LAZY_HDRS
headerSectionReader.h
lazyFileReader.h
lazyP21DataSectionReader.h
p21HeaderSectionReader.h
lazyDataSectionReader.h
lazyInstMgr.h
lazySupport.h
lazyTypes.h
sectionReader.h
instMgrHelper.h
judy.h
judyL2Array.h
judyLArray.h
judyS2Array.h
judySArray.h
)
install(FILES ${LAZY_HDRS}
DESTINATION ${INCLUDE_DIR}/stepcode/cllazyfile)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-62
View File
@@ -1,62 +0,0 @@
#ifndef INSTMGRHELPER_H
#define INSTMGRHELPER_H
#include <sc_export.h>
#include "clstepcore/mgrnode.h"
#include "cllazyfile/lazyInstMgr.h"
#include "clstepcore/instmgr.h"
/**
* \file instMgrHelper.h helper classes for the lazyInstMgr. Allows use of SDAI_Application_instance class
* without modification.
*/
/**
* 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 SC_LAZYFILE_EXPORT mgrNodeHelper: public MgrNodeBase {
protected:
lazyInstMgr * _lim;
instanceID _id;
public:
mgrNodeHelper( lazyInstMgr * lim ) {
_lim = lim;
_id = 0;
prev = next = 0;
}
inline void setInstance( instanceID id ) {
_id = id;
}
inline SDAI_Application_instance * GetSTEPentity() {
/* Attribute resolution must not convert a batch-owned cache hit
* into a process-lifetime retained instance. */
return _lim->loadInstance( _id, true, false );
}
};
/**
* This class is used when creating SDAI_Application_instance's and using a lazyInstMgr.
*
* Instances need an InstMgr to look up the instances they refer to. This class pretends to be a normal InstMgr;
* when an instance is looked up, this uses lazyInstMgr to load it, and then returns a pointer to it.
*/
class SC_LAZYFILE_EXPORT instMgrAdapter: public InstMgrBase {
protected:
mgrNodeHelper _mn;
public:
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;
}
};
#endif //INSTMGRHELPER_H
-330
View File
@@ -1,330 +0,0 @@
#ifndef LAZYINSTMGR_H
#define LAZYINSTMGR_H
#include <cctype>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <assert.h>
#include "cllazyfile/lazyDataSectionReader.h"
#include "cllazyfile/lazyFileReader.h"
#include "cllazyfile/lazyTypes.h"
#include "cllazyfile/lazySupport.h"
#include "clstepcore/Registry.h"
#include "sc_export.h"
#include "judyLArray.h"
#include "judySArray.h"
#include "judyL2Array.h"
#include "judyS2Array.h"
class Registry;
class instMgrAdapter;
class lazyRefs;
class SC_LAZYFILE_EXPORT lazyInstMgr {
protected:
/** multimap from instance number to instances that it refers to
* \sa instanceRefs_pair
*/
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4251 )
#endif
instanceRefs_t _fwdInstanceRefs;
/** 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;
/** multimap from instance type to instance number
* \sa instanceType_pair
* \sa instanceType_range
*/
instanceTypes_t * _instanceTypes;
/** 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.
*/
instanceStreamPos_t _instanceStreamPos;
dataSectionReaderVec_t _dataSections;
lazyFileReaderVec_t _files;
/** All indexed DATA instance IDs in deterministic file order. */
instanceRefs _allInstances;
Registry * _headerRegistry, * _mainRegistry;
bool _ownsMainRegistry;
ErrorDescriptor * _errors;
unsigned long _lazyInstanceCount, _loadedInstanceCount;
uint64_t _cacheHighWater, _cacheHits, _cacheMisses, _materializations, _evictions;
uint64_t _activeBatches;
uint64_t _residentSourceBytes, _sourceBytesHighWater;
int _longestTypeNameLen;
std::string _longestTypeName;
std::map<instanceID, size_t> _pinCounts;
std::map<instanceID, uint64_t> _instanceSourceBytes;
std::map<instanceID, std::vector<std::string> > _instanceComponentTypes;
std::map<std::string, std::string> _materializationTypeAliases;
std::set<instanceID> _batchOwnedInstances;
std::set<instanceID> _permanentlyLoadedInstances;
std::set<instanceID> _instancesLoading;
std::set<instanceID> _deferredInverseInstances;
size_t _batchLoadDepth;
LazyProgressCallback _progressCallback;
LazyCancellationCallback _cancellationCallback;
LazyDiagnosticCallback _diagnosticCallback;
std::map<std::string, uint64_t> _diagnosticCounts;
bool _cancelled;
instMgrAdapter * _ima;
friend class LazyInstanceBatch;
friend class lazyRefs;
void releaseBatch( const std::vector<instanceID> & instances );
void resolveDeferredInverses();
bool isMaterializing( instanceID id ) const {
return _instancesLoading.count( id ) != 0;
}
void deferInverseResolution( instanceID id ) {
_deferredInverseInstances.insert( id );
}
SDAI_Application_instance * cachedInstance( instanceID id );
std::vector<instanceID> dependencyClosure( const std::vector<instanceID> & roots );
#ifdef _MSC_VER
#pragma warning( pop )
#endif
public:
lazyInstMgr();
~lazyInstMgr();
bool openFile( std::string fname );
void addLazyInstance( namedLazyInstance inst );
InstMgrBase * getAdapter() {
return ( InstMgrBase * ) _ima;
}
/** Register an explicit source-keyword substitution used only when
* materializing an SDAI object. The lazy type index retains the
* original Part 21 keyword. This is intended for known,
* attribute-compatible exporter aliases, not arbitrary recovery. */
void setMaterializationTypeAlias( std::string source, const std::string & target ) {
for( std::string::iterator c = source.begin(); c != source.end(); ++c ) {
*c = static_cast<char>( toupper( static_cast<unsigned char>( *c ) ) );
}
_materializationTypeAliases[source] = target;
}
std::string materializationType( std::string source ) const {
std::string key = source;
for( std::string::iterator c = key.begin(); c != key.end(); ++c ) {
*c = static_cast<char>( toupper( static_cast<unsigned char>( *c ) ) );
}
std::map<std::string, std::string>::const_iterator alias =
_materializationTypeAliases.find( key );
return alias == _materializationTypeAliases.end() ? source : alias->second;
}
instanceRefs_t * getFwdRefs() {
return & _fwdInstanceRefs;
}
instanceRefs_t * getRevRefs() {
return & _revInstanceRefs;
}
LazyInstanceIdView instancesByType( std::string type, bool caseSensitive = false );
LazyInstanceIdView allInstances() const {
return LazyInstanceIdView( &_allInstances );
}
LazyInstanceIdView forwardReferences( instanceID id );
LazyInstanceIdView reverseReferences( instanceID id );
/** Copy the exact indexed source record for an instance. Returns an
* empty string when the ID is missing or ambiguous. */
std::string sourceRecord( instanceID id );
/** Return the Part 21 component keywords of a complex instance in
* source order. Ordinary and unknown instances return an empty
* vector. */
const std::vector<std::string> & componentTypes( instanceID id ) 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 = static_cast<char>( toupper( static_cast<unsigned char>( *it ) ) );
}
}
return _instanceTypes->find( type.c_str() );
}
/// get the number of instances of a certain type
unsigned int countInstances( std::string type, bool caseSensitive = false ) {
instanceTypes_t::cvector * v = getInstances( type, caseSensitive );
if( !v ) {
return 0;
}
return v->size();
}
instancesLoaded_t * getHeaderInstances( fileID file ) {
return _files[file]->getHeaderInstances();
}
/// get the number of instances that have been found in the open files.
unsigned long totalInstanceCount() const {
return _lazyInstanceCount;
}
/// get the number of instances that are loaded.
unsigned long loadedInstanceCount() const {
return _loadedInstanceCount;
}
LazyCacheStatistics cacheStatistics() const;
void setProgressCallback( const LazyProgressCallback & callback ) {
_progressCallback = callback;
}
void setCancellationCallback( const LazyCancellationCallback & callback ) {
_cancellationCallback = callback;
}
void setDiagnosticCallback( const LazyDiagnosticCallback & callback ) {
_diagnosticCallback = callback;
}
bool cancelled() const {
return _cancelled;
}
void observeScan( fileID file, lazyFileOffset offset, lazyFileOffset fileSize );
void emitDiagnostic( LazyDiagnostic diagnostic );
uint64_t diagnosticCount( const std::string & key ) const;
const std::map<std::string, uint64_t> & diagnosticCounts() const {
return _diagnosticCounts;
}
void validateReferences();
/// get the number of data sections that have been identified
unsigned int countDataSections() {
return _dataSections.size();
}
///builds the registry using the given initFunct
const Registry * initRegistry( CF_init initFunct ) {
assert( _mainRegistry == 0 );
_mainRegistry = new Registry( initFunct );
_ownsMainRegistry = true;
return _mainRegistry;
}
/// set the registry to one already initialized
void setRegistry( Registry * reg ) {
assert( _mainRegistry == 0 );
_mainRegistry = reg;
_ownsMainRegistry = false;
}
const Registry * getHeaderRegistry() const {
return _headerRegistry;
}
const Registry * getMainRegistry() const {
return _mainRegistry;
}
/// get the longest type name
const std::string & getLongestTypeName() const {
return _longestTypeName;
}
/// get the number of types of instances.
unsigned long getNumTypes() const;
sectionID registerDataSection( lazyDataSectionReader * sreader );
ErrorDescriptor * getErrorDesc() {
return _errors;
}
/** 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
* \param promoteCached if true, a cached instance requested outside a batch is retained for legacy callers
*/
SDAI_Application_instance * loadInstance( instanceID id, bool reSeek = false, bool promoteCached = true );
LazyInstanceBatch loadBatch( instanceID root );
LazyInstanceBatch loadBatch( const std::vector<instanceID> & roots );
//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;
}
instancePosition pos = cv->at( 0 );
//a data section indexes its instances from its own constructor and is
//registered only afterwards, and only if it succeeded - so an instance
//can name a section that was never registered. Same test sourceRecord()
//already makes.
if( pos.section >= _dataSections.size() || !_dataSections[pos.section] ) {
std::cerr << "Error at " << __FILE__ << ":" << __LINE__ << " - instanceID " << id << " names data section " << pos.section << ", which failed to index." << std::endl;
return 0;
}
return _dataSections[pos.section]->getType( pos.begin );
}
std::cerr << "Error at " << __FILE__ << ":" << __LINE__ << " - instanceID " << id << " not found." << std::endl;
return 0;
}
// TODO implement these
// 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(...)
//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
};
#endif //LAZYINSTMGR_H
-131
View File
@@ -1,131 +0,0 @@
#ifndef LAZYSUPPORT_H
#define LAZYSUPPORT_H
#include <cstddef>
#include <functional>
#include <iosfwd>
#include <string>
#include <vector>
#include "cllazyfile/lazyTypes.h"
#include "sc_export.h"
class lazyInstMgr;
class SDAI_Application_instance;
enum LazyDiagnosticSeverity {
LAZY_DIAGNOSTIC_INFO,
LAZY_DIAGNOSTIC_WARNING,
LAZY_DIAGNOSTIC_ERROR,
LAZY_DIAGNOSTIC_FATAL
};
struct SC_LAZYFILE_EXPORT LazyDiagnostic {
LazyDiagnosticSeverity severity;
instanceID entity;
std::string type;
lazyFileOffset offset;
uint64_t line;
std::string attribute;
std::string message;
uint64_t occurrences;
LazyDiagnostic(): severity( LAZY_DIAGNOSTIC_INFO ), entity( 0 ), offset( 0 ),
line( 0 ), occurrences( 1 ) {}
};
struct SC_LAZYFILE_EXPORT LazyScanProgress {
fileID file;
lazyFileOffset offset;
lazyFileOffset fileSize;
uint64_t instancesScanned;
LazyScanProgress(): file( 0 ), offset( 0 ), fileSize( 0 ), instancesScanned( 0 ) {}
};
struct SC_LAZYFILE_EXPORT LazyCacheStatistics {
uint64_t instancesScanned;
uint64_t instancesLoaded;
uint64_t instancesPinned;
uint64_t cacheHighWater;
uint64_t cacheHits;
uint64_t cacheMisses;
uint64_t materializations;
uint64_t evictions;
uint64_t activeBatches;
uint64_t dataSections;
uint64_t residentSourceBytes;
uint64_t sourceBytesHighWater;
bool cancelled;
LazyCacheStatistics(): instancesScanned( 0 ), instancesLoaded( 0 ), instancesPinned( 0 ),
cacheHighWater( 0 ), cacheHits( 0 ), cacheMisses( 0 ), materializations( 0 ),
evictions( 0 ), activeBatches( 0 ), dataSections( 0 ), residentSourceBytes( 0 ),
sourceBytesHighWater( 0 ), cancelled( false ) {}
};
typedef std::function<void ( const LazyScanProgress & )> LazyProgressCallback;
typedef std::function<bool ()> LazyCancellationCallback;
typedef std::function<void ( const LazyDiagnostic & )> LazyDiagnosticCallback;
/** A non-owning, zero-copy view of an indexed instance-ID vector.
* The view remains valid until another file is scanned by the manager.
*/
class SC_LAZYFILE_EXPORT LazyInstanceIdView {
public:
typedef instanceRefs::const_iterator const_iterator;
LazyInstanceIdView(): _ids( 0 ) {}
explicit LazyInstanceIdView( const instanceRefs * ids ): _ids( ids ) {}
const_iterator begin() const;
const_iterator end() const;
size_t size() const;
bool empty() const;
instanceID operator[]( size_t index ) const;
private:
const instanceRefs * _ids;
};
/** A dependency closure materialized and pinned for a bounded operation.
* STEPcode parsing remains single-threaded. Detach immutable conversion data
* before releasing the batch or passing work to another thread.
*/
class SC_LAZYFILE_EXPORT LazyInstanceBatch {
public:
LazyInstanceBatch();
~LazyInstanceBatch();
LazyInstanceBatch( LazyInstanceBatch && other );
LazyInstanceBatch & operator=( LazyInstanceBatch && other );
LazyInstanceBatch( const LazyInstanceBatch & ) = delete;
LazyInstanceBatch & operator=( const LazyInstanceBatch & ) = delete;
bool valid() const;
void release();
const std::vector<instanceID> & roots() const;
const std::vector<instanceID> & instances() const;
SDAI_Application_instance * get( instanceID id ) const;
private:
friend class lazyInstMgr;
LazyInstanceBatch( lazyInstMgr * manager, const std::vector<instanceID> & roots,
const std::vector<instanceID> & instances );
lazyInstMgr * _manager;
std::vector<instanceID> _roots;
std::vector<instanceID> _instances;
};
/** Adapter preserving a stream-oriented diagnostic presentation. */
class SC_LAZYFILE_EXPORT LazyTextDiagnosticAdapter {
public:
explicit LazyTextDiagnosticAdapter( std::ostream & stream );
void operator()( const LazyDiagnostic & diagnostic ) const;
private:
std::ostream * _stream;
};
#endif // LAZYSUPPORT_H
-141
View File
@@ -1,141 +0,0 @@
#ifndef SECTIONREADER_H
#define SECTIONREADER_H
#include <fstream>
#include <set>
#include "cllazyfile/lazyTypes.h"
#include "sc_export.h"
#include "clutils/errordesc.h"
#include "clstepcore/STEPcomplex.h"
class SDAI_Application_instance;
class lazyFileReader;
class ErrorDescriptor;
class Registry;
class SC_LAZYFILE_EXPORT sectionReader {
protected:
//protected data members
lazyFileReader * _lazyFile;
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4251 )
#endif
std::ifstream & _file;
std::streampos _sectionStart, ///< the start of this section as reported by tellg()
_sectionEnd; ///< the end of this section as reported by tellg()
#ifdef _MSC_VER
#pragma warning( pop )
#endif
unsigned long _totalInstances;
ErrorDescriptor * _error;
sectionID _sectionID;
fileID _fileID;
// protected member functions
sectionReader( lazyFileReader * parent, std::ifstream & file, std::streampos start, sectionID sid );
~sectionReader();
/** Find a string, ignoring occurrences in comments or Part 21 strings (i.e. 'string with \S\' control directive' )
* \param str string to find
* \param semicolon if true, 'str' must be followed by a semicolon, possibly preceded by whitespace.
* \returns the position of the end of the found string
*/
std::streampos findNormalString( const std::string & str, bool semicolon = false );
/** Skip from immediately after a comment's opening slash and star
* through its closing star and slash. Part 21 comments are opaque:
* apostrophes and string-control text inside them have no syntax.
*/
bool skipComment();
/** Skip whitespace and Part 21 comments, leaving the next syntactic
* token unread. */
bool skipTokenSeparators();
/** Skip an Edition 1 SCOPE construct, including nested scopes and its
* optional export list. The stream must initially point at '&' and
* is left at the owning entity's record. */
bool skipScope();
/** Skip an optional scope export list at the current stream
* position. */
bool skipScopeExportList();
/** Get a keyword ending with one of delimiters.
*/
const char * getDelimitedKeyword( const char * delimiters );
/** Seek to the end of the current instance */
std::streampos seekInstanceEnd( instanceRefs ** refs, std::vector<std::string> * componentTypes = 0 );
/// operator>> is very slow?!
inline void skipWS() {
while( isspace( _file.peek() ) && _file.good() ) {
_file.ignore( 1 );
}
}
STEPcomplex * CreateSubSuperInstance( const Registry * reg, instanceID fileid, Severity & sev );
public:
SDAI_Application_instance * getRealInstance( const Registry * reg, lazyFileOffset begin, instanceID instance,
const std::string & typeName = "", const std::string & schName = "", bool header = false );
/** Return one indexed source record without materializing it. The
* stream position is restored before returning. This is intended
* for lightweight adapters which can detach scalar/reference data
* directly from Part 21 source. */
std::string sourceRecord( lazyFileOffset begin, uint64_t length );
sectionID ID() const {
return _sectionID;
}
virtual void findSectionStart() = 0;
void findSectionEnd() {
_sectionEnd = findNormalString( "ENDSEC", true );
}
std::streampos sectionStart() const {
return _sectionStart;
}
std::streampos sectionEnd() const {
return _sectionEnd;
}
void locateAllInstances(); /**< find instances in section, and add lazyInstance's to lazyInstMgr */
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( lazyFileOffset offset ) {
if( offset <= 0 ) {
return 0;
}
_file.seekg( static_cast<std::streamoff>( offset ) );
readInstanceNumber();
if( !skipTokenSeparators() ) return 0;
if( _file.peek() == '&' && !skipScope() ) return 0;
if( !skipTokenSeparators() ) return 0;
return getDelimitedKeyword( ";( /\\" );
}
instanceID readInstanceNumber();
void seekg( std::streampos pos ) {
_file.seekg( pos );
}
std::streampos tellg() {
return _file.tellg();
}
};
#endif //SECTIONREADER_H
-72
View File
@@ -1,72 +0,0 @@
set(CORE_HDRS
aggrTypeDescriptor.h
attrDescriptor.h
attrDescriptorList.h
baseType.h
complexSupport.h
create_Aggr.h
derivedAttribute.h
dictSchema.h
dictdefs.h
dictionaryInstance.h
dispnode.h
dispnodelist.h
entityDescriptor.h
entityDescriptorList.h
enumTypeDescriptor.h
ExpDict.h
explicitItemId.h
globalRule.h
implicitItemId.h
instmgr.h
interfaceSpec.h
interfacedItem.h
inverseAttribute.h
inverseAttributeList.h
mgrnode.h
mgrnodearray.h
mgrnodelist.h
needFunc.h
read_func.h
realTypeDescriptor.h
Registry.h
schRename.h
schemaInit.h
schemaModule.h
sdai.h
sdaiApplication_instance.h
sdaiSelect.h
selectTypeDescriptor.h
SingleLinkList.h
STEPaggregate.h
STEPaggrBinary.h
STEPaggrEntity.h
STEPaggrEnum.h
STEPaggrGeneric.h
STEPaggrInt.h
STEPaggrReal.h
STEPaggrSelect.h
STEPaggrString.h
STEPattribute.h
STEPattributeList.h
STEPcomplex.h
STEPinvAttrList.h
STEPundefined.h
stringTypeDescriptor.h
SubSuperIterators.h
typeDescriptor.h
typeDescriptorList.h
typeOrRuleVar.h
uniquenessRule.h
whereRule.h
)
install(FILES ${CORE_HDRS}
DESTINATION ${INCLUDE_DIR}/stepcode/clstepcore)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-64
View File
@@ -1,64 +0,0 @@
#ifndef EXPDICT_H
#define EXPDICT_H
/**
* \file clstepcore/ExpDict.h
* NIST STEP Core Class Library
* April, 1997
* K. C. Morris
* David Sauder
*
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*
* As with Expdict.cc, this file has been split into many smaller files - see includes.
*/
#include <sc_export.h>
#include "clstepcore/sdai.h"
#include <vector>
#include <string>
#include <assert.h>
#include "clstepcore/SingleLinkList.h"
#include "clstepcore/baseType.h"
#include "clstepcore/dictdefs.h"
#include "clutils/Str.h"
// each of these contains linked list, list node, iterator
#include "clstepcore/attrDescriptorList.h"
#include "inverseAttributeList.h"
#include "typeDescriptorList.h"
#include "entityDescriptorList.h"
#include "typeDescriptor.h"
#include "entityDescriptor.h"
#include "enumTypeDescriptor.h"
#include "clstepcore/attrDescriptor.h"
#include "clstepcore/derivedAttribute.h"
#include "inverseAttribute.h"
#include "clstepcore/create_Aggr.h"
#include "clstepcore/dictionaryInstance.h"
#include "uniquenessRule.h"
#include "whereRule.h"
#include "interfacedItem.h"
#include "explicitItemId.h"
#include "implicitItemId.h"
#include "interfaceSpec.h"
#include "typeOrRuleVar.h"
#include "globalRule.h"
#include "clstepcore/dictSchema.h"
#include "schRename.h"
#include "clstepcore/aggrTypeDescriptor.h"
#include "selectTypeDescriptor.h"
#include "stringTypeDescriptor.h"
#include "realTypeDescriptor.h"
#endif
-57
View File
@@ -1,57 +0,0 @@
#ifndef STEPAGGRBINARY_H
#define STEPAGGRBINARY_H
#include "clstepcore/STEPaggregate.h"
#include <sc_export.h>
/** \file STEPaggrBinary.h
* classes BinaryAggregate, BinaryNode
*/
/**
* * \class BinaryAggregate
** This class supports LIST OF BINARY type
*/
class SC_CORE_EXPORT BinaryAggregate : public STEPaggregate {
public:
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
BinaryAggregate();
virtual ~BinaryAggregate();
};
typedef BinaryAggregate * BinaryAggregateH;
typedef BinaryAggregate * BinaryAggregate_ptr;
typedef const BinaryAggregate * BinaryAggregate_ptr_c;
typedef BinaryAggregate_ptr BinaryAggregate_var;
/**
* * \class BinaryNode
** This class is for the Nodes of BinaryAggregates
*/
class SC_CORE_EXPORT BinaryNode : public STEPnode {
public:
SDAI_Binary value;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
BinaryNode( BinaryNode & bn );
BinaryNode( const char * sStr );
BinaryNode();
~BinaryNode();
virtual SingleLinkNode * NewNode();
};
#endif //STEPAGGRBINARY_H
-84
View File
@@ -1,84 +0,0 @@
#ifndef STEPAGGRENTITY_H
#define STEPAGGRENTITY_H
/** \file STEPaggrEntity.h
* classes EntityAggregate, EntityNode
*/
#include "clstepcore/STEPaggregate.h"
#include <sc_export.h>
class SC_CORE_EXPORT EntityAggregate : public STEPaggregate {
public:
virtual Severity ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0,
int assignVal = 1, int ExchangeFileFormat = 1,
const char * currSch = 0 );
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
EntityAggregate();
virtual ~EntityAggregate();
};
typedef EntityAggregate * EntityAggregateH;
typedef EntityAggregate * EntityAggregate_ptr;
typedef const EntityAggregate * EntityAggregate_ptr_c;
typedef EntityAggregate_ptr EntityAggregate_var;
class SC_CORE_EXPORT EntityNode : public STEPnode {
public:
SDAI_Application_instance * node;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0 );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0 );
virtual Severity STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0 );
virtual Severity STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0 );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
EntityNode( SDAI_Application_instance * e );
EntityNode();
~EntityNode();
virtual SingleLinkNode * NewNode();
// Calling these functions is an error.
Severity StrToVal( const char * s, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal( s, err, 0, 0, 0 );
}
Severity StrToVal( istream & in, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal( in, err, 0, 0, 0 );
}
Severity STEPread( const char * s, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread( s, err, 0, 0, 0 );
}
Severity STEPread( istream & in, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread( in, err, 0, 0, 0 );
}
};
#endif //STEPAGGRENTITY_H
-84
View File
@@ -1,84 +0,0 @@
#ifndef STEPAGGRENUM_H
#define STEPAGGRENUM_H
#include "clstepcore/STEPaggregate.h"
#include "sc_export.h"
/** \file StepaggrEnum.h
* classes EnumAggregate, LOGICALS, BOOLEANS, EnumNode
*/
/**
* \class EnumAggregate
* This is a minimal representation for a collection of SDAI_Enum
*/
class SC_CORE_EXPORT EnumAggregate : public STEPaggregate {
public:
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
EnumAggregate();
virtual ~EnumAggregate();
};
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:
virtual SingleLinkNode * NewNode();
LOGICALS();
virtual ~LOGICALS();
};
typedef LOGICALS * LogicalsH;
typedef LOGICALS * LOGICALS_ptr;
typedef const LOGICALS * LOGICALS_ptr_c;
typedef LOGICALS_ptr LOGICALS_var;
SC_CORE_EXPORT LOGICALS * create_LOGICALS();
class SC_CORE_EXPORT BOOLEANS : public EnumAggregate {
public:
virtual SingleLinkNode * NewNode();
BOOLEANS();
virtual ~BOOLEANS();
};
typedef BOOLEANS * BOOLEANS_ptr;
typedef const BOOLEANS * BOOLEANS_ptr_c;
typedef BOOLEANS_ptr BOOLEANS_var;
SC_CORE_EXPORT BOOLEANS * create_BOOLEANS();
/**
* * \class EnumNode
** This is a minimal representation for node in lists of SDAI_Enum
*/
class SC_CORE_EXPORT EnumNode : public STEPnode {
public:
SDAI_Enum * node;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
EnumNode( SDAI_Enum * e );
EnumNode();
~EnumNode();
virtual SingleLinkNode * NewNode();
};
#endif //STEPAGGRENUM_H
-57
View File
@@ -1,57 +0,0 @@
#ifndef STEPAGGRGENERIC_H
#define STEPAGGRGENERIC_H
#include "clstepcore/STEPaggregate.h"
#include <sc_export.h>
/** \file STEPaggrGeneric.h
* classes GenericAggregate, GenericAggrNode
*/
/**
* 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:
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
GenericAggregate();
virtual ~GenericAggregate();
};
typedef GenericAggregate * GenericAggregateH;
typedef GenericAggregate * GenericAggregate_ptr;
typedef const GenericAggregate * GenericAggregate_ptr_c;
typedef GenericAggregate_ptr GenericAggregate_var;
/**
* This class is for the Nodes of GenericAggregates
*/
class SC_CORE_EXPORT GenericAggrNode : public STEPnode {
public:
SCLundefined value;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
GenericAggrNode( const char * str );
GenericAggrNode( GenericAggrNode & gan );
GenericAggrNode();
~GenericAggrNode();
virtual SingleLinkNode * NewNode();
};
#endif //STEPAGGRGENERIC_H
-46
View File
@@ -1,46 +0,0 @@
#ifndef STEPAGGRINT_H
#define STEPAGGRINT_H
#include "clstepcore/STEPaggregate.h"
#include <sc_export.h>
class SC_CORE_EXPORT IntAggregate : public STEPaggregate {
public:
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
IntAggregate();
virtual ~IntAggregate();
};
typedef IntAggregate * IntAggregateH;
typedef IntAggregate * IntAggregate_ptr;
typedef const IntAggregate * IntAggregate_ptr_c;
typedef IntAggregate_ptr IntAggregate_var;
class SC_CORE_EXPORT IntNode : public STEPnode {
public:
SDAI_Integer value; // long int
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
IntNode( SDAI_Integer v );
IntNode();
~IntNode();
virtual SingleLinkNode * NewNode();
};
#endif //STEPAGGRINT_H
-46
View File
@@ -1,46 +0,0 @@
#ifndef STEPAGGRREAL_H
#define STEPAGGRREAL_H
#include "clstepcore/STEPaggregate.h"
#include <sc_export.h>
class SC_CORE_EXPORT RealAggregate : public STEPaggregate {
public:
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
RealAggregate();
virtual ~RealAggregate();
};
typedef RealAggregate * RealAggregateH;
typedef RealAggregate * RealAggregate_ptr;
typedef const RealAggregate * RealAggregate_ptr_c;
typedef RealAggregate_ptr RealAggregate_var;
class SC_CORE_EXPORT RealNode : public STEPnode {
public:
SDAI_Real value; // double
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
RealNode( SDAI_Real v );
RealNode();
~RealNode();
virtual SingleLinkNode * NewNode();
};
#endif //STEPAGGRREAL_H
-101
View File
@@ -1,101 +0,0 @@
#ifndef STEPAGGRSELECT_H
#define STEPAGGRSELECT_H
#include "clstepcore/STEPaggregate.h"
#include <sc_export.h>
class SelectTypeDescriptor;
/** \file STEPaggrSelect.h
* classes SelectAggregate, SelectNode
*/
/**
* * \class SelectAggregate
** This is a minimal representation for a collection of SDAI_Select
*/
class SC_CORE_EXPORT SelectAggregate : public STEPaggregate {
protected:
const SelectTypeDescriptor * _select_type;
public:
virtual Severity ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0,
int assignVal = 1, int ExchangeFileFormat = 1,
const char * currSch = 0 );
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
explicit SelectAggregate( const SelectTypeDescriptor * select_type = 0 );
virtual ~SelectAggregate();
};
typedef SelectAggregate * SelectAggregateH;
typedef SelectAggregate * SelectAggregate_ptr;
typedef const SelectAggregate * SelectAggregate_ptr_c;
typedef SelectAggregate_ptr SelectAggregate_var;
/**
* * \class SelectNode
** This is a minimal representation for node in lists of SDAI_Select
*/
class SC_CORE_EXPORT SelectNode : public STEPnode {
public:
SDAI_Select * node;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0 );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0,
const char * currSch = 0 );
virtual Severity STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0 );
virtual Severity STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0,
const char * currSch = 0 );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
SelectNode( SDAI_Select * s );
SelectNode();
~SelectNode();
virtual SingleLinkNode * NewNode();
// Calling these functions is an error.
Severity StrToVal( const char * s, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal( s, err, 0, 0, 0 );
}
Severity StrToVal( istream & in, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return StrToVal( in, err, 0, 0, 0 );
}
Severity STEPread( const char * s, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread( s, err, 0, 0, 0 );
}
Severity STEPread( istream & in, ErrorDescriptor * err ) {
cerr << "Internal error: " << __FILE__ << __LINE__
<< "\n" << _POC_ "\n";
return STEPread( in, err, 0, 0, 0 );
}
};
#endif //STEPAGGRSELECT_H
-56
View File
@@ -1,56 +0,0 @@
#ifndef STEPAGGRSTRING_H
#define STEPAGGRSTRING_H
#include "clstepcore/STEPaggregate.h"
#include <sc_export.h>
/** \file STEPaggrString.h
* classes StringAggregate, StringNode
*/
/**
* * \class StringAggregate
** This class supports LIST OF STRING type
*/
class SC_CORE_EXPORT StringAggregate : public STEPaggregate {
public:
virtual SingleLinkNode * NewNode();
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
StringAggregate();
virtual ~StringAggregate();
};
typedef StringAggregate * StringAggregateH;
typedef StringAggregate * StringAggregate_ptr;
typedef const StringAggregate * StringAggregate_ptr_c;
typedef StringAggregate_ptr StringAggregate_var;
/**
* * \class StringNode
** This class is for the Nodes of StringAggregates
*/
class SC_CORE_EXPORT StringNode : public STEPnode {
public:
SDAI_String value;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
StringNode( StringNode & sn );
StringNode( const char * sStr );
StringNode();
~StringNode();
virtual SingleLinkNode * NewNode();
};
#endif //STEPAGGRSTRING_H
-155
View File
@@ -1,155 +0,0 @@
#ifndef STEPAGGREGATE_H
#define STEPAGGREGATE_H
/*
* NIST STEP Core Class Library
* clstepcore/STEPaggregate.h
* April 1997
* K. C. Morris
* David Sauder
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
class InstMgrBase;
class STEPaggregate;
class TypeDescriptor;
#include <sc_export.h>
#include "clutils/errordesc.h"
#include "clstepcore/SingleLinkList.h"
#include "clstepcore/baseType.h"
#include "clstepcore/sdai.h"
#include "clstepcore/STEPundefined.h"
#include <string>
#define AGGR_NULL &NilSTEPaggregate
extern STEPaggregate NilSTEPaggregate;
class SingleLinkNode;
typedef STEPaggregate * STEPaggregateH;
typedef STEPaggregate * STEPaggregate_ptr;
typedef STEPaggregate_ptr STEPaggregate_var;
class SC_CORE_EXPORT STEPaggregate : public SingleLinkList {
protected:
bool _null;
protected:
virtual Severity ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgrBase * insts, int addFileId = 0,
int assignVal = 1, int ExchangeFileFormat = 1,
const char * currSch = 0 );
public:
bool is_null() {
return _null;
}
virtual Severity AggrValidLevel( const char * value, ErrorDescriptor * err,
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, 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,
InstMgrBase * insts = 0, int addFileId = 0 );
virtual Severity STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type = 0,
InstMgrBase * insts = 0, int addFileId = 0,
const char * currSch = 0 );
// OUTPUT
virtual const char * asStr( std::string & s ) const;
virtual void STEPwrite( ostream & out = cout, const char * = 0 ) const;
virtual SingleLinkNode * NewNode();
void AddNode( SingleLinkNode * );
void Empty();
STEPaggregate();
virtual ~STEPaggregate();
// COPY - defined in subtypes
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
};
class SC_CORE_EXPORT STEPnode : public SingleLinkNode {
protected:
int _null;
/// nodes must start out null; several StrToVal/STEPread paths leave
/// _null untouched on failure and would otherwise read uninitialised.
STEPnode() : _null( 1 ) {
}
public:
int is_null() {
return _null;
}
void set_null() {
_null = 1;
}
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
};
typedef STEPnode * STEPnodeH;
#include "clstepcore/STEPaggrGeneric.h"
#include "clstepcore/STEPaggrEntity.h"
#include "clstepcore/STEPaggrSelect.h"
#include "clstepcore/STEPaggrString.h"
#include "clstepcore/STEPaggrBinary.h"
#include "clstepcore/STEPaggrEnum.h"
#include "clstepcore/STEPaggrReal.h"
#include "clstepcore/STEPaggrInt.h"
/******************************************************************
** FIXME The following classes are currently stubs
**
**/
/*
class Array : public STEPaggregate {
public:
int lowerBound;
int upperBound;
};
class Bag : public STEPaggregate {
public:
int min_ele;
int max_ele;
};
class List : public STEPaggregate {
int min_ele;
int max_ele;
List *prev;
};
class Set :
public STEPaggregate {
int cnt;
};
*/
#endif
-100
View File
@@ -1,100 +0,0 @@
#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 "clstepcore/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
-227
View File
@@ -1,227 +0,0 @@
#ifndef AGGRTYPEDESCRIPTOR_H
#define AGGRTYPEDESCRIPTOR_H
#include "typeDescriptor.h"
#include "clstepcore/create_Aggr.h"
#include "assert.h"
enum AggrBoundTypeEnum {
bound_unset = 0,
bound_constant,
bound_runtime,
bound_funcall
};
/**
* \class AggrTypeDescriptor
* I think we decided on a simplistic representation of aggr. types for now?
* i.e. just have one AggrTypeDesc for Array of [list of] [set of] someType
* the inherited variable _referentType will point to the TypeDesc for someType
* So I don't believe this class was necessary. If we were to retain
* info for each of the [aggr of]'s in the example above then there would be
* one of these for each [aggr of] above and they would be strung
* together by the _aggrDomainType variables. If you can make this
* work then go for it.
*/
class SC_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
protected:
SDAI_Integer _bound1, _bound2;
SDAI_LOGICAL _uniqueElements;
TypeDescriptor * _aggrDomainType;
AggregateCreator CreateNewAggr;
AggrBoundTypeEnum _bound1_type, _bound2_type;
boundCallbackFn _bound1_callback, _bound2_callback;
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4251 )
#endif
std::string _bound1_str, _bound2_str;
#ifdef _MSC_VER
#pragma warning( pop )
#endif
public:
void AssignAggrCreator( AggregateCreator f = 0 );
STEPaggregate * CreateAggregate() const;
AggrTypeDescriptor( );
AggrTypeDescriptor( SDAI_Integer b1, SDAI_Integer b2,
Logical uniqElem,
TypeDescriptor * aggrDomType );
AggrTypeDescriptor( const char * nm, PrimitiveType ft,
Schema * origSchema, const char * d,
AggregateCreator f = 0 )
: TypeDescriptor( nm, ft, origSchema, d ), _bound1( 0 ), _bound2( 0 ), _uniqueElements( 0 ), _aggrDomainType( NULL ), CreateNewAggr( f ), _bound1_type( bound_unset ), _bound2_type( bound_unset ), _bound1_callback( NULL ), _bound2_callback( NULL ) { }
virtual ~AggrTypeDescriptor();
/// find bound type
AggrBoundTypeEnum Bound1Type() const {
return _bound1_type;
}
/// get a constant bound
SDAI_Integer Bound1( ) const {
assert( _bound1_type == bound_constant );
return _bound1;
}
/// get a runtime bound using an object's 'this' pointer
SDAI_Integer Bound1Runtime( SDAI_Application_instance * this_ptr ) const {
assert( this_ptr && ( _bound1_type == bound_runtime ) );
return _bound1_callback( this_ptr ) ;
}
/// get a bound's EXPRESS function call string
std::string Bound1Funcall() const {
return _bound1_str;
}
/// set bound to a constant
void SetBound1( SDAI_Integer b1 ) {
_bound1 = b1;
_bound1_type = bound_constant;
}
///set bound's callback fn. only for bounds dependent on an attribute
void SetBound1FromMemberAccessor( boundCallbackFn callback ) {
_bound1_callback = callback;
_bound1_type = bound_runtime;
}
///set bound from express function call. currently, this only stores the function call as a string.
void SetBound1FromExpressFuncall( std::string s ) {
_bound1_str = s;
_bound1_type = bound_funcall;
}
/// find bound type
AggrBoundTypeEnum Bound2Type() const {
return _bound2_type;
}
/// get a constant bound
SDAI_Integer Bound2( ) const {
assert( _bound2_type == bound_constant );
return _bound2;
}
/// get a runtime bound using an object's 'this' pointer
SDAI_Integer Bound2Runtime( SDAI_Application_instance * this_ptr ) const {
assert( this_ptr && ( _bound2_type == bound_runtime ) );
return _bound2_callback( this_ptr ) ;
}
/// get a bound's EXPRESS function call string
std::string Bound2Funcall() const {
return _bound2_str;
}
/// set bound to a constant
void SetBound2( SDAI_Integer b2 ) {
_bound2 = b2;
_bound2_type = bound_constant;
}
///set bound's callback fn
void SetBound2FromMemberAccessor( boundCallbackFn callback ) {
_bound2_callback = callback;
_bound2_type = bound_runtime;
}
///set bound from express function call. currently, this only stores the function call as a string.
void SetBound2FromExpressFuncall( std::string s ) {
_bound2_str = s;
_bound2_type = bound_funcall;
}
SDAI_LOGICAL & UniqueElements() {
return _uniqueElements;
}
void UniqueElements( SDAI_LOGICAL & ue ) {
_uniqueElements.put( ue.asInt() );
}
void UniqueElements( Logical ue ) {
_uniqueElements.put( ue );
}
void UniqueElements( const char * ue ) {
_uniqueElements.put( ue );
}
class TypeDescriptor * AggrDomainType() {
return _aggrDomainType;
}
void AggrDomainType( TypeDescriptor * adt ) {
_aggrDomainType = adt;
}
};
class SC_CORE_EXPORT ArrayTypeDescriptor : public AggrTypeDescriptor {
protected:
SDAI_LOGICAL _optionalElements;
public:
ArrayTypeDescriptor( ) : _optionalElements( "UNKNOWN_TYPE" ) { }
ArrayTypeDescriptor( Logical optElem ) : _optionalElements( optElem )
{ }
ArrayTypeDescriptor( const char * nm, PrimitiveType ft,
Schema * origSchema, const char * d,
AggregateCreator f = 0 )
: AggrTypeDescriptor( nm, ft, origSchema, d, f ),
_optionalElements( "UNKNOWN_TYPE" )
{ }
virtual ~ArrayTypeDescriptor() {}
SDAI_LOGICAL & OptionalElements() {
return _optionalElements;
}
void OptionalElements( SDAI_LOGICAL & oe ) {
_optionalElements.put( oe.asInt() );
}
void OptionalElements( Logical oe ) {
_optionalElements.put( oe );
}
void OptionalElements( const char * oe ) {
_optionalElements.put( oe );
}
};
class SC_CORE_EXPORT ListTypeDescriptor : public AggrTypeDescriptor {
protected:
public:
ListTypeDescriptor( ) { }
ListTypeDescriptor( const char * nm, PrimitiveType ft,
Schema * origSchema, const char * d,
AggregateCreator f = 0 )
: AggrTypeDescriptor( nm, ft, origSchema, d, f ) { }
virtual ~ListTypeDescriptor() { }
};
class SC_CORE_EXPORT SetTypeDescriptor : public AggrTypeDescriptor {
protected:
public:
SetTypeDescriptor( ) { }
SetTypeDescriptor( const char * nm, PrimitiveType ft,
Schema * origSchema, const char * d,
AggregateCreator f = 0 )
: AggrTypeDescriptor( nm, ft, origSchema, d, f ) { }
virtual ~SetTypeDescriptor() { }
};
class SC_CORE_EXPORT BagTypeDescriptor : public AggrTypeDescriptor {
protected:
public:
BagTypeDescriptor( ) { }
BagTypeDescriptor( const char * nm, PrimitiveType ft,
Schema * origSchema, const char * d,
AggregateCreator f = 0 )
: AggrTypeDescriptor( nm, ft, origSchema, d, f ) { }
virtual ~BagTypeDescriptor() { }
};
#endif //AGGRTYPEDESCRIPTOR_H
-206
View File
@@ -1,206 +0,0 @@
#ifndef ATTRDESCRIPTOR_H
#define ATTRDESCRIPTOR_H
#include "typeDescriptor.h"
#include "cldai/sdaiEnum.h"
#include "sc_export.h"
enum AttrType_Enum {
AttrType_Explicit = 0,
AttrType_Inverse,
AttrType_Deriving,
AttrType_Redefining
};
class EntityDescriptor;
/** AttrDescriptor
* An instance of this class will be generated for each attribute for
* an Entity. They will be pointed to by the EntityTypeDescriptors.
*/
class SC_CORE_EXPORT AttrDescriptor {
protected:
const char * _name; // the attributes name
// this defines the domain of the attribute
const TypeDescriptor * _domainType;
SDAI_LOGICAL _optional;
SDAI_LOGICAL _unique;
AttrType_Enum _attrType; // former attribute _derived
const EntityDescriptor & _owner; // the owning entityDescriptor
public:
AttrDescriptor(
const char * name, // i.e. char *
const TypeDescriptor * domainType,
Logical optional, // i.e. F U or T
Logical unique, // i.e. F U or T
AttrType_Enum at,// AttrType_Explicit, AttrType_Inverse,
// AttrType_Deriving,AttrType_Redefining
const EntityDescriptor & owner
);
virtual ~AttrDescriptor();
const char * GenerateExpress( std::string & buf ) const;
// the attribute Express def
virtual const char * AttrExprDefStr( std::string & s ) const;
// left side of attr def
const char * Name() const {
return _name;
}
void Name( const char * n ) {
_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.
*
* \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?
*
* \sa BaseType()
*/
///@{
PrimitiveType NonRefType() const;
const TypeDescriptor * NonRefTypeDescriptor() const;
///@}
int IsAggrType() const;
PrimitiveType AggrElemType() const;
const TypeDescriptor * AggrElemTypeDescriptor() const;
/// The type of the attributes TypeDescriptor
PrimitiveType Type() const;
/// right side of attr def
const std::string TypeName() const;
/// an expanded right side of attr def
const char * ExpandedTypeName( std::string & s ) const;
int RefersToType() const {
return !( _domainType == 0 );
}
const TypeDescriptor * ReferentType() const {
return _domainType;
}
const TypeDescriptor * DomainType() const {
return _domainType;
}
void DomainType( const TypeDescriptor * td ) {
_domainType = td;
}
void ReferentType( const TypeDescriptor * td ) {
_domainType = td;
}
const SDAI_LOGICAL & Optional() const {
return _optional;
}
void Optional( SDAI_LOGICAL & opt ) {
_optional.put( opt.asInt() );
}
void Optional( Logical opt ) {
_optional.put( opt );
}
void Optional( const char * opt ) {
_optional.put( opt );
}
const SDAI_LOGICAL & Unique() const {
return _unique;
}
void Unique( SDAI_LOGICAL uniq ) {
_unique.put( uniq.asInt() );
}
void Unique( Logical uniq ) {
_unique.put( uniq );
}
void Unique( const char * uniq ) {
_unique.put( uniq );
}
void AttrType( enum AttrType_Enum ate ) {
_attrType = ate;
}
enum AttrType_Enum AttrType() const {
return _attrType;
}
Logical Explicit() const;
Logical Inverse() const;
Logical Redefining() const;
Logical Deriving() const;
//outdated functions, use AttrType func above, new support of redefined
Logical Derived() const {
return Deriving();
}
void Derived( Logical x ); // outdated DAS
void Derived( SDAI_LOGICAL x ); // outdated DAS
void Derived( const char * x ); // outdated DAS
const SDAI_LOGICAL & Optionality() const {
return _optional;
}
void Optionality( SDAI_LOGICAL & opt ) {
_optional.put( opt.asInt() );
}
void Optionality( Logical opt ) {
_optional.put( opt );
}
void Optionality( const char * opt ) {
_optional.put( opt );
}
const SDAI_LOGICAL & Uniqueness() const {
return _unique;
}
void Uniqueness( SDAI_LOGICAL uniq ) {
_unique.put( uniq.asInt() );
}
void Uniqueness( Logical uniq ) {
_unique.put( uniq );
}
void Uniqueness( const char * uniq ) {
_unique.put( uniq );
}
const EntityDescriptor & Owner() const {
return _owner;
}
};
#endif //ATTRDESCRIPTOR_H
-58
View File
@@ -1,58 +0,0 @@
#ifndef ATTRDESCRIPTORLIST_H
#define ATTRDESCRIPTORLIST_H
///header for list, node, and iterator
#include "SingleLinkList.h"
#include "sc_export.h"
class AttrDescriptor;
class SC_CORE_EXPORT AttrDescLinkNode : public SingleLinkNode {
private:
protected:
AttrDescriptor * _attrDesc;
public:
AttrDescLinkNode();
virtual ~AttrDescLinkNode();
const AttrDescriptor * AttrDesc() const {
return _attrDesc;
}
void AttrDesc( AttrDescriptor * ad ) {
_attrDesc = ad;
}
};
class SC_CORE_EXPORT AttrDescriptorList : public SingleLinkList {
private:
protected:
public:
AttrDescriptorList();
virtual ~AttrDescriptorList();
virtual SingleLinkNode * NewNode() {
return new AttrDescLinkNode;
}
AttrDescLinkNode * AddNode( AttrDescriptor * ad );
};
class SC_CORE_EXPORT AttrDescItr {
protected:
const AttrDescriptorList & adl;
const AttrDescLinkNode * cur;
public:
AttrDescItr( const AttrDescriptorList & adList );
virtual ~AttrDescItr();
void ResetItr() {
cur = ( AttrDescLinkNode * )( adl.GetHead() );
}
const AttrDescriptor * NextAttrDesc();
};
#endif //ATTRDESCRIPTORLIST_H

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