Compare commits

..

111 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
326 changed files with 105661 additions and 99715 deletions

View file

@ -1,169 +0,0 @@
version: '{build}'
# for Appveyor CI (windows)
os: Windows Server 2012 R2
clone_folder: c:\projects\STEPcode
#grab zip instead of git clone
shallow_clone: true
platform: x64
configuration: Debug
# errors or couldn't be found by cmake
# - GENERATOR: "Visual Studio 9 2008"
# ARCH: 32
# - GENERATOR: "Visual Studio 10"
# ARCH: 32
#no point in these without artifact support...
# - GENERATOR: "Visual Studio 11"
#ARCH: 32
#- GENERATOR: "Visual Studio 12"
#ARCH: 32
environment:
matrix:
- GENERATOR: "Visual Studio 12 Win64"
ARCH: 64
# build:
# parallel: true
# project: ALL_BUILD.vcxproj
#appveyor limits compile/test to 30 minutes
# to reduce time, only test schemas with files: ifc2x3, ap214e3, ap209
build_script:
- ps: |
cd c:\projects\STEPcode
mkdir build
cd build
cmake -version
grep --version
cmake .. -DSC_ENABLE_TESTING=ON -G"$env:GENERATOR" -DSC_BUILD_SCHEMAS="ifc2x3"
cmake --build . --config Debug --target tst_inverse_attr3
#msbuld seems to provide no benefits, and I can't filter its output...
#msbuild SC.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Debug /p:Platform=x64
# /toolsversion:14.0 /p:PlatformToolset=v140
test_script:
- cmd: echo inverse_attr3 test 100x
- cmd: cd c:\projects\STEPcode\build
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 10
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 20
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 30
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 40
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 50
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 60
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 70
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 80
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 90
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
- cmd: echo 100
- cmd: echo done
# - cmd: grep -niB20 "Test Failed" Testing/Temporary/LastTest.log
# we could upload a compiled zip somewhere (see Appveyor artifact documentation)

3
.gitignore vendored
View file

@ -1,3 +0,0 @@
/build
*.kdev4
.kdev_include_paths

View file

@ -1,8 +1,12 @@
sudo: false
language: cpp
compiler:
- clang
script: mkdir build && cd build && cmake .. -DSC_ENABLE_TESTING=ON && make -j3 && ctest -j2 --output-on-failure
os:
- linux
- osx
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

View file

@ -5,26 +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)
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)

View file

@ -62,11 +62,11 @@ 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")
if(NOT SC_IS_SUBBUILD)
if(NOT IS_SUBBUILD)
set(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
else(NOT SC_IS_SUBBUILD)
else(NOT IS_SUBBUILD)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
endif(NOT SC_IS_SUBBUILD)
endif(NOT IS_SUBBUILD)
# testing and compilation options, build output dirs, install dirs, uninstall, package creation, etc
include(${SC_CMAKE_DIR}/SC_Build_opts.cmake)
@ -95,12 +95,10 @@ if(NOT DEFINED SC_BUILD_SCHEMAS)
set(SC_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built")
endif(NOT DEFINED SC_BUILD_SCHEMAS)
if(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)
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)
@ -116,9 +114,6 @@ elseif(BORLAND)
add_definitions(-D__BORLAND__ -D__WIN32__)
else()
add_definitions(-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long)
if(HAVE_NULLPTR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif(HAVE_NULLPTR)
endif()
include_directories(
@ -135,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)
@ -150,7 +147,7 @@ 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:

View file

@ -1,45 +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.
* Make your changes and push them to your GitHub repo
* Once your branch is pushed, submit a pull request.
* We'll look at the PR and either merge 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/

22
NEWS
View file

@ -1,26 +1,4 @@
STEPcode -- http://github.com/stepcode/stepcode -- http://stepcode.org
************************************************************************
Release 0.8 (December, 2014)
New since v0.7:
* handle diamond inheritance, derived Attributes
* rename fedex_python, fedex_plus to exp2py, exp2cxx
* many changes to the pretty printer, due to use in reformatting draft
and IS schemas (Thanks Tom!)
* parser was also changed due to errors caught while pretty printing
- we can be much more confident that the parser is correct now
* fix incorrect quoting of timestamp in p21 header
* fix various copy constructors and ShallowCopy() members
* split generated code into many small files
- far easier to open generated code in editors
- support more compilers
- small files are combined (via #include statements) into a few
large files for faster "unitary" builds, if the compiler can handle it
- unitary builds are faster than the previous builds
* most compiler warnings fixed
* performance fixes and other changes from BRL-CAD
* finally, all tests pass!
************************************************************************
Release 0.7 (April, 2013)

View file

@ -1,10 +1,5 @@
Travis-CI | AppVeyor CI
:-------------:|:---------------:
Linux, OSX (LLVM) | Windows (MSVC)
[![Build Status](https://travis-ci.org/stepcode/stepcode.svg?branch=master)](https://travis-ci.org/stepcode/stepcode) | [![Build status](https://ci.appveyor.com/api/projects/status/3fbr9t9gfa812oqu?svg=true)](https://ci.appveyor.com/project/mpictor/stepcode)
***********************************************************************
STEPcode v0.8 -- stepcode.org, 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
@ -37,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)
@ -61,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.

View file

@ -1 +1 @@
0.8
0.7

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

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,158 +47,21 @@
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
mark_as_advanced(LEMON_EXECUTABLE)
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
# look for the template in share
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
set (LEMON_TEMPLATE "${DATA_DIR}/lemon/lempar.c")
elseif (EXISTS "share/lemon/lempar.c")
set (LEMON_TEMPLATE "share/lemon/lempar.c")
elseif (EXISTS "/usr/share/lemon/lempar.c")
set (LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
endif (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
endif (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
# look for the template in bin dir
if(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
get_filename_component(lemon_path ${LEMON_EXECUTABLE} PATH)
if (lemon_path)
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)
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)
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
# fallback
set (LEMON_TEMPLATE "lempar.c")
if (NOT EXISTS ${LEMON_TEMPLATE})
message(WARNING "Lemon's lempar.c template file could not be found automatically, set LEMON_TEMPLATE")
endif (NOT EXISTS ${LEMON_TEMPLATE})
endif (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
mark_as_advanced(LEMON_TEMPLATE)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEMON DEFAULT_MSG LEMON_EXECUTABLE LEMON_TEMPLATE)
# Define 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})
# ====================================================================
include(CMakeParseArguments)
if(NOT COMMAND LEMON_TARGET)
macro(LEMON_TARGET Name Input)
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
set(LVAR_PREFIX ${Name}_${IN_FILE_WE})
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${LVAR_PREFIX} "" "OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR;EXTRA_ARGS" "" ${ARGN})
endif(${ARGC} GREATER 3)
# Need a working directory
if("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
set(${LVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LVAR_PREFIX}")
endif("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
file(MAKE_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR})
# Output source file
if ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
set(${LVAR_PREFIX}_OUT_SRC_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
else ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
get_filename_component(specified_out_dir ${${LVAR_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(${LVAR_PREFIX}_OUT_SRC_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${${LVAR_PREFIX}_OUT_SRC_FILE})
endif ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
# Output header file
if ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
set(${LVAR_PREFIX}_OUT_HDR_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
else ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
get_filename_component(specified_out_dir ${${LVAR_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(${LVAR_PREFIX}_OUT_HDR_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${${LVAR_PREFIX}_OUT_HDR_FILE})
endif ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
# input file
get_filename_component(in_full ${Input} ABSOLUTE)
if("${in_full}" STREQUAL "${Input}")
set(lemon_in_file ${Input})
else("${in_full}" STREQUAL "${Input}")
set(lemon_in_file "${CMAKE_CURRENT_SOURCE_DIR}/${Input}")
endif("${in_full}" STREQUAL "${Input}")
# names of lemon output files will be based on the name of the input file
set(LEMON_GEN_SOURCE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
set(LEMON_GEN_HEADER ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
set(LEMON_GEN_OUT ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.out)
# copy input to bin directory and run lemon
get_filename_component(INPUT_NAME ${Input} NAME)
add_custom_command(
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
COMMAND ${CMAKE_COMMAND} -E copy ${lemon_in_file} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
DEPENDS ${Input} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR}
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
)
# rename generated outputs
if(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${${LVAR_PREFIX}_OUT_SRC_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_SRC_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
if(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_HDR_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${${LVAR_PREFIX}_OUT_HDR_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_HDR_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
set(LEMON_${Name}_OUTPUTS ${LEMON_${Name}_OUTPUTS} ${LEMON_GEN_OUT})
# make sure we clean up generated output and copied input
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}")
# macro ran successfully
set(LEMON_${Name}_DEFINED TRUE)
set(LEMON_${Name}_SRC ${${LVAR_PREFIX}_OUT_SRC_FILE})
set(LEMON_${Name}_HDR ${${LVAR_PREFIX}_OUT_HDR_FILE})
set(LEMON_${Name}_INCLUDE_DIR ${${LVAR_PREFIX}_WORKING_DIR})
endmacro(LEMON_TARGET)
endif(NOT COMMAND LEMON_TARGET)
mark_as_advanced(LEMON_TEMPLATE)
#============================================================
# FindLEMON.cmake ends here

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,187 +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})
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 LEMON_${LemonTarget}_HDR)
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
endif()
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_SRC}
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_HDR})
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
endif(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
#============================================================
# FindPERPLEX.cmake ends here

View file

@ -9,137 +9,10 @@ mark_as_advanced(RE2C_EXECUTABLE)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)
# 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)
#============================================================
#
# TODO - rework this macro to make use of CMakeParseArguments, see
# http://www.cmake.org/pipermail/cmake/2012-July/051309.html
if(NOT COMMAND RE2C_TARGET)
macro(RE2C_TARGET Name Input Output)
set(RE2C_TARGET_usage "RE2C_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
if(${ARGC} GREATER 3)
if(${ARGC} EQUAL 5)
if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
set(RE2C_EXECUTABLE_opts "${ARGV4}")
SEPARATE_ARGUMENTS(RE2C_EXECUTABLE_opts)
else()
message(SEND_ERROR ${RE2C_TARGET_usage})
endif()
else()
message(SEND_ERROR ${RE2C_TARGET_usage})
endif()
endif()
add_custom_command(OUTPUT ${Output}
COMMAND ${RE2C_EXECUTABLE}
ARGS ${RE2C_EXECUTABLE_opts} -o${Output} ${Input}
DEPENDS ${Input} ${RE2C_EXECUTABLE_TARGET}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set(RE2C_${Name}_DEFINED TRUE)
set(RE2C_${Name}_OUTPUTS ${Output})
set(RE2C_${Name}_INPUT ${Input})
set(RE2C_${Name}_COMPILE_FLAGS ${RE2C_EXECUTABLE_opts})
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${Output}")
endmacro(RE2C_TARGET)
endif(NOT COMMAND RE2C_TARGET)
#============================================================
#============================================================
# ADD_RE2C_LEMON_DEPENDENCY (public macro)
#============================================================
#
if(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
macro(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}_HDR)
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
endif()
set_source_files_properties(${RE2C_${RE2CTarget}_OUTPUTS}
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_HDR})
endmacro(ADD_RE2C_LEMON_DEPENDENCY)
endif(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
#============================================================
# RE2C_Util.cmake ends here
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

View file

@ -32,7 +32,7 @@ macro(VERIFY_FILES filelist warn resultvar)
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")
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}")
@ -59,6 +59,20 @@ macro(WRITE_MD5_SUMS filelist outfile)
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

146
cmake/LEMON_Util.cmake Normal file
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
cmake/PERPLEX_Util.cmake Normal file
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

View file

@ -1,12 +1,3 @@
# BIN and LIB directories
if(NOT DEFINED BIN_DIR)
set(BIN_DIR bin)
endif(NOT DEFINED BIN_DIR)
if(NOT DEFINED LIB_DIR)
set(LIB_DIR lib)
endif(NOT DEFINED LIB_DIR)
# testing and compilation options, build output dirs, install dirs, etc
# included by root CMakeLists
@ -51,12 +42,6 @@ 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)
# Should we use C++11?
OPTION_WITH_DEFAULT(SC_ENABLE_CXX11 "Build with C++ 11 features" ON)
# Get version from git
OPTION_WITH_DEFAULT(SC_GIT_VERSION "Build using version from git" ON)
option(SC_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
mark_as_advanced(SC_BUILD_EXPRESS_ONLY)
@ -86,13 +71,6 @@ if(SC_ENABLE_TESTING)
ENABLE_TESTING()
endif(SC_ENABLE_TESTING)
#---------------------------------------------------------------------
# Executable install option
OPTION_WITH_DEFAULT(SC_SKIP_EXEC_INSTALL "Skip installing executables" OFF)
if(SC_SKIP_EXEC_INSTALL)
set(SC_EXEC_NOINSTALL "NO_INSTALL")
endif(SC_SKIP_EXEC_INSTALL)
#---------------------------------------------------------------------
# The following logic is what allows binaries to run successfully in
# the build directory AND install directory. Thanks to plplot for

View file

@ -29,9 +29,15 @@ macro(SCHEMA_EXES)
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
SC_ADDEXEC(p21read_${PROJECT_NAME} "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" "${PROJECT_NAME};stepdai;stepcore;stepeditor;steputils;base" "TESTABLE")
#add_dependencies(p21read_${PROJECT_NAME} version_string)
if(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)
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
@ -65,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)
@ -99,6 +105,10 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
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()
P21_TESTS(${expFile})

View file

@ -44,53 +44,25 @@ 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()
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()
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)
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)
@ -103,23 +75,14 @@ configure_file(${CONFIG_H_FILE} ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h)
# 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.
if(SC_GIT_VERSION)
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
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
else(SC_GIT_VERSION)
set(VER_HDR "
#ifndef SC_VERSION_STRING
#define SC_VERSION_STRING
static char sc_version[512] = {\"${SC_VERSION}\"};
#endif"
)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h "${VER_HDR}")
endif(SC_GIT_VERSION)
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 )

View file

@ -40,6 +40,12 @@ if(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
get_filename_component(PERPLEX_TEMPLATE "${CMAKE_BINARY_DIR}/${PERPLEX_TEMPLATE}" ABSOLUTE)
endif(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
if(NOT COMMAND LEMON_TARGET)
include(${SC_CMAKE_DIR}/LEMON_Util.cmake)
endif(NOT COMMAND LEMON_TARGET)
if(NOT COMMAND PERPLEX_TARGET)
include(${SC_CMAKE_DIR}/PERPLEX_Util.cmake)
endif(NOT COMMAND PERPLEX_TARGET)
set(SC_GENERATE_LP_SOURCES 1)
message(".. Found perplex, re2c, and lemon - can regenerate lexer/parser if necessary")
else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)

View file

@ -10,86 +10,108 @@ macro(DEFINE_DLL_EXPORTS libname)
string(TOUPPER ${LOWERCORE} UPPER_CORE)
set(export "SC_${UPPER_CORE}_DLL_EXPORTS")
endif()
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_DEFINITIONS "${export}")
get_target_property(defs ${libname} COMPILE_DEFINITIONS)
if(defs) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false
set(defs "${defs};${export}")
else(defs)
set(defs "${export}")
endif(defs)
set_target_properties(${libname} PROPERTIES COMPILE_DEFINITIONS "${defs}")
endif(MSVC OR BORLAND)
endmacro(DEFINE_DLL_EXPORTS libname)
# set compile definitions for dll imports on windows
macro(DEFINE_DLL_IMPORTS tgt libs)
if(MSVC OR BORLAND)
set(imports "")
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 imports "SC_${UPPER_CORE}_DLL_IMPORTS")
list(APPEND defs "SC_${UPPER_CORE}_DLL_IMPORTS")
endforeach(lib ${libs})
set_property(TARGET ${tgt} APPEND PROPERTY COMPILE_DEFINITIONS "${imports}")
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)
#SC_ADDEXEC(execname "source files" "linked libs" ["TESTABLE"] ["NO_INSTALL"])
#EXCLUDE_OR_INSTALL(target destination ARGV3)
# installs ${target} in ${destination} unless testing is enabled AND ${arg_3} == "TESTABLE",
# in which case the EXCLUDE_FROM_ALL property is set for testing.
# EXCLUDE_FROM_ALL cannot be set on targets that are to be installed,
# so either test the target or install it - but not both
macro(EXCLUDE_OR_INSTALL target dest arg_3)
if(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
INSTALL(TARGETS ${target} DESTINATION ${dest})
else(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON)
endif(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
endmacro(EXCLUDE_OR_INSTALL target dest arg_3)
#SC_ADDEXEC(execname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
# optional args can also be used by MSVC-specific code, but it looks like these two uses
# will not conflict because the MSVC args must contain "STRICT"
macro(SC_ADDEXEC execname srcslist libslist)
string(TOUPPER "${execname}" EXECNAME_UPPER)
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${EXECNAME_UPPER} "NO_INSTALL;TESTABLE" "" "" ${ARGN})
endif(${ARGC} GREATER 3)
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
if(NOT ${EXECNAME_UPPER}_NO_INSTALL AND NOT ${EXECNAME_UPPER}_TESTABLE)
install(TARGETS ${execname}
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR}
)
endif(NOT ${EXECNAME_UPPER}_NO_INSTALL AND NOT ${EXECNAME_UPPER}_TESTABLE)
if(NOT SC_ENABLE_TESTING AND ${EXECNAME_UPPER}_TESTABLE)
set_target_properties( ${execname} PROPERTIES EXCLUDE_FROM_ALL ON )
endif(NOT SC_ENABLE_TESTING AND ${EXECNAME_UPPER}_TESTABLE)
# 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)
if(SC_BUILD_SHARED_LIBS)
add_executable(${execname} ${srcslist})
target_link_libraries(${execname} ${libslist})
DEFINE_DLL_IMPORTS(${execname} "${libslist}") #add import definitions for all libs that the executable is linked to
EXCLUDE_OR_INSTALL(${execname} "bin" "${ARGV3}")
# Enable extra compiler flags if local executables and/or global options dictate
set(LOCAL_COMPILE_FLAGS "")
foreach(extraarg ${ARGN})
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
endforeach(extraarg ${ARGN})
if(LOCAL_COMPILE_FLAGS)
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
endif(LOCAL_COMPILE_FLAGS)
endif(SC_BUILD_SHARED_LIBS)
if(SC_BUILD_STATIC_LIBS)
if(NOT SC_BUILD_SHARED_LIBS)
set(staticexecname "${execname}")
else()
set(staticexecname "${execname}-static")
endif(NOT SC_BUILD_SHARED_LIBS)
add_executable(${staticexecname} ${srcslist})
target_link_libraries(${staticexecname} ${libslist})
EXCLUDE_OR_INSTALL(${staticexecname} "bin" "${ARGV3}")
# Enable extra compiler flags if local executables and/or global options dictate
set(LOCAL_COMPILE_FLAGS "")
foreach(extraarg ${ARGN})
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
endforeach(extraarg ${ARGN})
if(LOCAL_COMPILE_FLAGS)
set_target_properties(${staticexecname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
endif(LOCAL_COMPILE_FLAGS)
endif(SC_BUILD_STATIC_LIBS)
endmacro(SC_ADDEXEC execname srcslist libslist)
#SC_ADDLIB(libname "source files" "linked libs" ["TESTABLE"] ["NO_INSTALL"] ["SO_SRCS ..."] ["STATIC_SRCS ..."])
#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(TOUPPER "${libname}" LIBNAME_UPPER)
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${LIBNAME_UPPER} "NO_INSTALL;TESTABLE" "" "SO_SRCS;STATIC_SRCS" ${ARGN})
endif(${ARGC} GREATER 3)
string(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}")
if(SC_BUILD_SHARED_LIBS)
add_library(${libname} SHARED ${srcslist} ${${LIBNAME_UPPER}_SO_SRCS})
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})
if(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
install(TARGETS ${libname}
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR}
)
endif(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
if(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
set_target_properties( ${libname} PROPERTIES EXCLUDE_FROM_ALL ON )
endif(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
EXCLUDE_OR_INSTALL(${libname} "lib" "${ARGV3}")
if(APPLE)
set_target_properties(${libname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
@ -100,7 +122,7 @@ macro(SC_ADDLIB libname srcslist libslist)
else()
set(staticlibname "${libname}-static")
endif(NOT SC_BUILD_SHARED_LIBS)
add_library(${staticlibname} STATIC ${srcslist} ${${LIBNAME_UPPER}_STATIC_SRCS})
add_library(${staticlibname} STATIC ${srcslist})
DEFINE_DLL_EXPORTS(${staticlibname})
if(NOT ${libs} MATCHES "NONE")
target_link_libraries(${staticlibname} "${libslist}")
@ -115,16 +137,7 @@ macro(SC_ADDLIB libname srcslist libslist)
# 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)
if(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
install(TARGETS ${libname}-static
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR}
)
endif(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
if(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
set_target_properties( ${libname}-static PROPERTIES EXCLUDE_FROM_ALL ON )
endif(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
EXCLUDE_OR_INSTALL(${staticlibname} "lib" "${ARGV3}")
if(APPLE)
set_target_properties(${staticlibname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)

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

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

View file

@ -1,35 +0,0 @@
# Inherit the parent CMake setting
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)
set(CURRENT_BINARY_DIR @CMAKE_CURRENT_BINARY_DIR@)
# 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 MD5 sums for current files.
#
# 2. 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")
file(WRITE ${new_info_file} "# Autogenerated verification information\n")
# Handle input files
set(input_files "@MD5_FILELIST@")
WRITE_MD5_SUMS("${input_files}" "${new_info_file}")
message("New verification file created: ${new_info_file}")
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

View file

@ -1,30 +0,0 @@
# 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
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 "@MD5_FILELIST@")
VERIFY_FILES("${filelist}" 1 srcs_pass)
if(NOT srcs_pass)
if(NOT DEBUGGING_GENERATED_SOURCES)
message(FATAL_ERROR "Sources have been modified and md5 sums have not been updated. This generally indicates either\n a) an input file has been modified but generated files have not been updated, or\n b) genenerated files have been edited directly.\nTo clear the error:\n a) Copy the new generated sources from the build directory to the generated/ sources directory, use the <target>_md5gen build target to create a new verifictation_info.cmake file, and copy verfication_info.cmake to generated/ as well.\n b) install Perplex/Re2C/LEMON and make the changes to the input file rather than the generated file.\nNote:\n If this is a debugging situation where multiple sequential tests must be conducted, temporarily set the variable DEBUGGING_GENERATED_SOURCES to ON during the CMake configure to disable this check.\nThis measure is necessary to ensure that compilations using either Perplex/Re2C/LEMON generation or the cached outputs of those tools produce consistent results.")
else(NOT DEBUGGING_GENERATED_SOURCES)
message(WARNING "Note: Sources have been modified and md5 sums have not been updated - build failure condition temporarily overridden by DEBUGGING_GENERATED_SOURCES setting.")
endif(NOT DEBUGGING_GENERATED_SOURCES)
endif(NOT srcs_pass)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

View file

@ -1,16 +1,11 @@
# creates sc_version_string.h, which defines sc_version()
# sc_version() returns a pretty commit description and a build timestamp.
# only update the file if the git commit has changed, because whenever the file is updated files including the header must rebuild
# parallel rebuilds can result in race conditions and failures, particularly when running ctest in parallel
# http://stackoverflow.com/questions/3780667
# http://www.cmake.org/pipermail/cmake/2009-February/027014.html
set(SC_IS_SUBBUILD "@SC_IS_SUBBUILD@")
set(SC_VERSION_HEADER "${BINARY_DIR}/include/sc_version_string.h")
#---------- find commit id ------------------
#use git for a pretty commit id
#uses 'git describe --tags', so tags are required in the repo
@ -47,25 +42,38 @@ string(REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID})
#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"
"*/\n\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}\"\n"
" \"git commit id: ${GIT_COMMIT_ID}, build timestamp ${date_time_string}\"\n"
"}\;\n\n"
"#endif\n"
)
#don't update the file unless somethig changed
string(RANDOM tmpsuffix)
file(WRITE ${SC_VERSION_HEADER}.${tmpsuffix} ${header_string})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SC_VERSION_HEADER}.${tmpsuffix} ${SC_VERSION_HEADER})
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${SC_VERSION_HEADER}.${tmpsuffix})
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)

View file

@ -12,15 +12,15 @@
# this makes compilation faster, but sometimes runs into compiler limitations
if(NOT DEFINED SC_UNITY_BUILD)
if(BORLAND)
message( STATUS "Will not do unity build for this compiler. (SC_UNITY_BUILD=FALSE)")
message(".. Will not do unity build for this compiler.")
set(SC_UNITY_BUILD FALSE)
else()
message( STATUS "Assuming compiler is capable of unity build. (SC_UNITY_BUILD=TRUE)")
message(".. Assuming compiler is capable of unity build.")
set(SC_UNITY_BUILD TRUE)
endif(BORLAND)
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.")
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)
@ -47,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})
@ -72,7 +72,7 @@ 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)

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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),(

View file

@ -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),

View file

@ -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),

View file

@ -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,

View file

@ -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),(

View file

@ -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),(

View file

@ -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.)),(

View file

@ -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.)),(

View file

@ -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.)),(

View file

@ -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.),

View file

@ -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.),

View file

@ -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.),

View file

@ -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),

View file

@ -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),

View file

@ -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,

View file

@ -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.),

View file

@ -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.),

View file

@ -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.),

View file

@ -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),

View file

@ -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),

View file

@ -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

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

View file

@ -1,80 +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 2.8)
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/libbase.a
${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/libbase.lib
${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/base
${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

View file

@ -1,29 +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}
-DSC_BUILD_TYPE=Debug
-DSC_BUILD_SCHEMAS=ap203/ap203.exp
-DSC_BUILD_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} )
# SC CMake does not honor -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
# Consequently, force Debug so it installs in ../sc-install directory
# instead of /usr/local/lib.
#
# SC's own programs fail to build with -DSC_BUILD_SHARED_LIBS=OFF

View file

@ -76,11 +76,10 @@ typedef struct Variable_ * Variable;
/***************************/
struct Variable_ {
Expression name; /**< Symbol is inside of 'name' */
Expression name; /**< Symbol is inside of 'name' */
Type type;
Expression initializer; /**< or 'derived' */
int offset; /**< used for attr order in Entitys, and for decl order in LOCAL vars. these two uses should never conflict! */
int idx; /**< used in exp2cxx to simplify calculation of attrDescriptor names in generated code */
int offset; /**< used for attr order in Entitys, and for decl order in LOCAL vars. these two uses should never conflict! */
struct {
unsigned int optional : 1; /**< OPTIONAL keyword */

View file

@ -24,7 +24,5 @@
#cmakedefine HAVE_SSIZE_T 1
#cmakedefine HAVE_STD_THREAD 1
#cmakedefine HAVE_STD_CHRONO 1
#cmakedefine HAVE_NULLPTR 1
#endif /* SCL_CF_H */

View file

@ -34,7 +34,7 @@ typedef int _Bool;
* and version 15.00.30729.01, which comes with Visual C++ 2008, do not
* define _Bool.
*/
#if defined(_MSC_VER) && _MSC_VER<1800
#if defined(_MSC_VER)
typedef int _Bool;
#endif

View file

@ -1,330 +0,0 @@
//summarize MSVC errors from an appveyor log
// compile with 'go build summarize-appveyor-log.go'
// takes 0 or 1 args; with 0, gets log from latest
// build. with 1, uses that file as raw json-like log
package main
import (
"bufio"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"regexp"
"sort"
"strings"
)
const (
headerKey = "Authorization"
headerVal = "Bearer %s"
projUrl = "https://ci.appveyor.com/api/projects/mpictor/stepcode"
//"https://ci.appveyor.com/api/buildjobs/2rjxdv1rnb8jcg8y/log"
logUrl = "https://ci.appveyor.com/api/buildjobs/%s/log"
consoleUrl = "https://ci.appveyor.com/api/buildjobs/%s/console"
)
func main() {
var rawlog io.ReadCloser
var build string
var err error
if len(os.Args) == 2 {
rawlog, build, err = processArgv()
} else {
rawlog, build, err = getLog()
}
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
return
}
defer rawlog.Close()
log := decodeConsole(rawlog)
warns, errs := countMessages(log)
fi, err := os.Create(fmt.Sprintf("appveyor-%s.smy", build))
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
return
}
printMessages("error", errs, fi)
printMessages("warning", warns, fi)
fmt.Printf("done\n")
}
/* categorizes warnings and errors based upon the MSVC message number (i.e. C4244)
* the regex will match lines like
c:\projects\stepcode\src\base\sc_benchmark.h(45): warning C4251: 'benchmark::descr' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'benchmark' [C:\projects\STEPcode\build\src\base\base.vcxproj]
[00:03:48] C:\projects\STEPcode\src\base\sc_benchmark.cc(61): warning C4244: '=' : conversion from 'SIZE_T' to 'long', possible loss of data [C:\projects\STEPcode\build\src\base\base.vcxproj]*
*/
func countMessages(log []string) (warns, errs map[string][]string) {
warns = make(map[string][]string)
errs = make(map[string][]string)
fname := " *(.*)" // $1
fline := `(?:\((\d+)\)| ): ` // $2 - either line number in parenthesis or a space, followed by a colon
msgNr := `([A-Z]+\d+): ` // $3 - C4251, LNK2005, etc
msgTxt := `([^\[]*) ` // $4
tail := `\[[^\[\]]*\]`
warnRe := regexp.MustCompile(fname + fline + `warning ` + msgNr + msgTxt + tail)
errRe := regexp.MustCompile(fname + fline + `(?:fatal )?error ` + msgNr + msgTxt + tail)
for _, line := range log {
if warnRe.MatchString(line) {
key := warnRe.ReplaceAllString(line, "$3")
path := strings.ToLower(warnRe.ReplaceAllString(line, "$1:$2"))
arr := warns[key]
if arr == nil {
arr = make([]string, 5)
//detailed text as first string in array
text := warnRe.ReplaceAllString(line, "$4")
arr[0] = fmt.Sprintf("%s", text)
}
//eliminate duplicates
match := false
for _, l := range arr {
if l == path {
match = true
}
}
if !match {
warns[key] = append(arr, path)
}
} else if errRe.MatchString(line) {
key := errRe.ReplaceAllString(line, "$3")
path := strings.ToLower(errRe.ReplaceAllString(line, "$1:$2"))
arr := errs[key]
if arr == nil {
arr = make([]string, 5)
//detailed text as first string in array
text := errRe.ReplaceAllString(line, "$4")
arr[0] = fmt.Sprintf("%s", text)
}
//eliminate duplicates
match := false
for _, l := range arr {
if l == path {
match = true
}
}
if !match {
errs[key] = append(arr, path)
}
}
}
return
}
func printMessages(typ string, m map[string][]string, w io.Writer) {
//sort keys
keys := make([]string, 0, len(m))
for key := range m {
keys = append(keys, key)
}
sort.Strings(keys)
for _, k := range keys {
for i, l := range m[k] {
//first string is an example, not a location
if i == 0 {
fmt.Fprintf(w, "%s %s (i.e. \"%s\")\n", typ, k, l)
} else if len(l) > 1 { //not sure where blank lines are coming from...
fmt.Fprintf(w, " >> %s\n", l)
}
}
}
}
//structs from http://json2struct.mervine.net/
//{"values":[{"i":0,"t":"Specify a project or solution file. The directory does not contain a project or solution file.\r\n","dt":"00:00:04","bg":12,"fg":15}]}
type AppVeyorConsoleLines struct {
Values []struct {
I int `json:"i"`
Text string `json:"t"`
DateTime string `json:"dt"`
BgColor int `json:"bg"`
FgColor int `json:"fg"`
}
}
type AppVeyorBuild struct {
Build struct {
/*BuildNumber int `json:"buildNumber"`*/
Version string `json:"version"`
Jobs []struct {
JobID string `json:"jobId"`
} `json:"jobs"`
} `json:"build"`
}
func splitAppend(log *[]string, blob string) {
//blob = strings.Replace(blob,"\r\n", "\n",-1)
blob = strings.Replace(blob, "\\", "/", -1)
r := strings.NewReader(blob)
unwrapScanner := bufio.NewScanner(r)
for unwrapScanner.Scan() {
txt := unwrapScanner.Text()
//fmt.Printf("%s\n", txt)
*log = append(*log, txt)
}
}
//calculate length of string without escape chars
// func escapeLen(s string)(l int) {
// //s = strings.Replace(s,"\\\\", "/",-1)
// s = strings.Replace(s,"\\\"", "",-1)
// s = strings.Replace(s,"\r\n", "RN",-1)
// return len(s)
// }
//decode the almost-JSON console data from appveyor
func decodeConsole(r io.Reader) (log []string) {
wrapper := Wrap(r)
dec := json.NewDecoder(wrapper)
var consoleLines AppVeyorConsoleLines
var err error
var txtBlob string
err = dec.Decode(&consoleLines)
if err == io.EOF {
err = nil
}
if err == nil {
for _, l := range consoleLines.Values {
txtBlob += l.Text
//el := escapeLen(l.Text)
//something inserts newlines at 229 chars (+\n\r == 231) (found in CMake output)
lenTwoThreeOne := len(l.Text) == 231
if lenTwoThreeOne {
txtBlob = strings.TrimSuffix(txtBlob, "\r\n")
}
//something else starts new log lines at 1024 chars without inserting newlines (found in CTest error output)
if len(l.Text) != 1024 && !lenTwoThreeOne {
//fmt.Printf("sa for l %d, el %d\n", len(l.Text),el)
splitAppend(&log, txtBlob)
txtBlob = ""
}
}
} else {
fmt.Printf("decode err %s\n", err)
}
if len(txtBlob) > 0 {
splitAppend(&log, txtBlob)
}
return
}
func processArgv() (log io.ReadCloser, build string, err error) {
fname := os.Args[1]
if len(fname) < 14 {
err = fmt.Errorf("Name arg '%s' too short. Run as '%s appveyor-NNN.log'", fname, os.Args[0])
return
}
buildRe := regexp.MustCompile(`appveyor-(.+).log`)
build = buildRe.ReplaceAllString(fname, "$1")
if len(build) == 0 {
err = fmt.Errorf("No build id in %s", fname)
return
}
log, err = os.Open(fname)
return
}
func getLog() (log io.ReadCloser, build string, err error) {
client := &http.Client{}
req, err := http.NewRequest("GET", projUrl, nil)
if err != nil {
return
}
apikey := os.Getenv("APPVEYOR_API_KEY")
//api key isn't necessary for read-only queries on public projects
if len(apikey) > 0 {
req.Header.Add(headerKey, fmt.Sprintf(headerVal, apikey))
} //else {
// fmt.Printf("Env var APPVEYOR_API_KEY is not set.")
//}
resp, err := client.Do(req)
if err != nil {
return
}
build, job := decodeProjInfo(resp.Body)
fmt.Printf("build #%s, jobId %s\n", build, job)
resp, err = http.Get(fmt.Sprintf(consoleUrl, job))
if err != nil {
return
}
logName := fmt.Sprintf("appveyor-%s.log", build)
fi, err := os.Create(logName)
if err != nil {
return
}
_, err = io.Copy(fi, resp.Body)
if err != nil {
return
}
log, err = os.Open(logName)
if err != nil {
log = nil
}
return
}
func decodeProjInfo(r io.Reader) (vers string, job string) {
dec := json.NewDecoder(r)
var av AppVeyorBuild
err := dec.Decode(&av)
if err != io.EOF && err != nil {
fmt.Printf("err %s\n", err)
return
}
if len(av.Build.Jobs) != 1 {
return
}
vers = av.Build.Version
job = av.Build.Jobs[0].JobID
return
}
//wrap a reader, modifying content to make the json decoder happy
//only tested with data from appveyor console
type jsonWrapper struct {
source io.Reader
begin bool
end bool
}
func Wrap(r io.Reader) *jsonWrapper {
return &jsonWrapper{
source: r,
begin: true,
}
}
// func nonNeg(n int) (int) {
// if n < 0 {
// return 0
// }
// return n
// }
func (w *jsonWrapper) Read(p []byte) (n int, err error) {
if w.end {
return 0, io.EOF
}
if w.begin {
w.begin = false
n = copy(p, []byte(`{"values":[`))
}
m, err := w.source.Read(p[n:])
n += m
if err == io.EOF {
w.end = true
if n < len(p) {
n = copy(p, []byte(`{"dummy":"data"}]}`))
} else {
err = fmt.Errorf("No room to terminate JSON struct with '}'\n")
}
}
return
}
// kate: indent-width 8; space-indent off; replace-tabs off; replace-tabs-save off; replace-trailing-space-save on; remove-trailing-space on; tab-intent on; tab-width 8; show-tabs off;

View file

@ -5,8 +5,6 @@ set(SC_BASE_SOURCES
sc_getopt.cc
sc_benchmark.cc
sc_mkdir.c
path2str.c
judy/src/judy.c
)
set(SC_BASE_HDRS
@ -14,21 +12,10 @@ set(SC_BASE_HDRS
sc_memmgr.h
sc_getopt.h
sc_trace_fprintf.h
sc_stdbool.h
sc_mkdir.h
sc_nullptr.h
path2str.h
judy/src/judy.h
judy/src/judyLArray.h
judy/src/judyL2Array.h
judy/src/judySArray.h
judy/src/judyS2Array.h
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/judy/src
)
if(MINGW OR MSVC OR BORLAND)
add_definitions(-DSC_BASE_DLL_EXPORTS)
endif()

View file

@ -62,11 +62,10 @@
#include "judy.h"
#if defined(STANDALONE) || defined(ASKITIS)
#include <string.h>
#include <stdio.h>
#if defined(STANDALONE) || defined(ASKITIS)
extern unsigned int MaxMem;
// void judy_abort (char *msg) __attribute__ ((noreturn)); // Tell static analyser that this function will not return
@ -904,9 +903,8 @@ JudySlot * judy_last( Judy * judy, JudySlot next, unsigned int off, unsigned int
JudySlot * judy_end( Judy * judy ) {
judy->level = 0;
return judy_last( judy, *judy->root, 0, 0 );
}
} // judy_nxt: return next entry
// judy_nxt: return next entry
JudySlot * judy_nxt( Judy * judy ) {
JudySlot * table, *inner;
int slot, size, cnt;

View file

@ -166,7 +166,7 @@ class judyL2Array {
kv.value = *_lastSlot;
_success = true;
} else {
kv.value = NULL;
kv.value = ( JudyValue ) 0;
_success = false;
}
kv.key = _buff[0];

View file

@ -29,16 +29,14 @@ struct judylKVpair {
*/
template< typename JudyKey, typename JudyValue >
class judyLArray {
public:
typedef judylKVpair< JudyKey, JudyValue > pair;
protected:
Judy * _judyarray;
unsigned int _maxLevels, _depth;
JudyValue * _lastSlot;
JudyKey _buff[1];
bool _success;
pair _kv;
public:
typedef judylKVpair< JudyKey, JudyValue > pair;
judyLArray(): _maxLevels( sizeof( JudyKey ) ), _depth( 1 ), _lastSlot( 0 ), _success( true ) {
assert( sizeof( JudyKey ) == JUDY_key_size && "JudyKey *must* be the same size as a pointer!" );
assert( sizeof( JudyValue ) == JUDY_key_size && "JudyValue *must* be the same size as a pointer!" );
@ -57,12 +55,9 @@ class judyLArray {
judy_close( _judyarray );
}
void clear( bool deleteContents = false ) {
void clear() {
JudyKey key = 0;
while( 0 != ( _lastSlot = ( JudyValue * ) judy_strt( _judyarray, ( const unsigned char * ) &key, 0 ) ) ) {
if( deleteContents ) {
delete *_lastSlot;
}
judy_del( _judyarray );
}
}
@ -117,17 +112,18 @@ class judyLArray {
}
/// retrieve the key-value pair for the most recent judy query.
inline const pair & mostRecentPair() {
inline const pair mostRecentPair() {
pair kv;
judy_key( _judyarray, ( unsigned char * ) _buff, _depth * JUDY_key_size );
if( _lastSlot ) {
_kv.value = *_lastSlot;
kv.value = *_lastSlot;
_success = true;
} else {
_kv.value = ( JudyValue ) 0;
kv.value = ( JudyValue ) 0;
_success = false;
}
_kv.key = _buff[0];
return _kv;
kv.key = _buff[0];
return kv;
}
/// retrieve the first key-value pair in the array

View file

@ -191,7 +191,7 @@ class judyS2Array {
kv.value = *_lastSlot;
_success = true;
} else {
kv.value = NULL;
kv.value = ( JudyValue ) 0;
_success = false;
}
kv.key = _buff;

View file

@ -1,29 +0,0 @@
#include "path2str.h"
#include "sc_memmgr.h"
#include <string.h>
/* for windows, rewrite backslashes in paths
* that will be written to generated code
*/
const char * path2str_fn( const char * fileMacro ) {
static char * result = 0;
static size_t rlen = 0;
char * p;
if( rlen < strlen( fileMacro ) ) {
if( result ) {
sc_free( result );
}
rlen = strlen( fileMacro );
result = ( char * )sc_malloc( rlen * sizeof( char ) + 1 );
}
strcpy( result, fileMacro );
p = result;
while( *p ) {
if( *p == '\\' ) {
*p = '/';
}
p++;
}
return result;
}

View file

@ -1,20 +0,0 @@
#ifndef PATH2STR_H
#define PATH2STR_H
#include <sc_export.h>
/** windows only: rewrite backslashes in paths as forward slashes
* call as path2str(__FILE__) to take advantage of macro
*
* silence "unknown escape sequence" warning when contents of __FILE__
* are fprintf'd into string in generated code
*/
SC_BASE_EXPORT const char * path2str_fn( const char * fileMacro );
#if defined( _WIN32 ) || defined ( __WIN32__ )
# define path2str(path) path2str_fn(path)
#else
# define path2str(path) path
#endif /* defined( _WIN32 ) || defined ( __WIN32__ ) */
#endif /* PATH2STR_H */

View file

@ -6,7 +6,6 @@
#ifdef __cplusplus
#include <iostream>
#include <iosfwd>
#include <string>
#include "sc_memmgr.h"

View file

@ -51,8 +51,8 @@
// SYNOPSIS
// int sc_getopt(int argc, char *argv[], char *optstring)
//
// extern char *sc_optarg;
// extern int sc_optind;
// extern char *optarg;
// extern int optind;
//
// DESCRIPTION
// The sc_getopt() function parses the command line arguments. Its
@ -67,21 +67,21 @@
//
// optstring is a string of recognized option letters; if a letter
// is followed by a colon, the option is expected to have an argument
// that may or may not be separated from it by white space. sc_optarg
// that may or may not be separated from it by white space. optarg
// is set to point to the start of the option argument on return from
// sc_getopt.
//
// Option letters may be combined, e.g., "-ab" is equivalent to
// "-a -b". Option letters are case sensitive.
//
// sc_getopt places in the external variable sc_optind the argv index
// of the next argument to be processed. sc_optind is initialized
// sc_getopt places in the external variable optind the argv index
// of the next argument to be processed. optind is initialized
// to 0 before the first call to sc_getopt.
//
// When all options have been processed (i.e., up to the first
// non-option argument), sc_getopt returns EOF, sc_optarg will point
// to the argument, and sc_optind will be set to the argv index of
// the argument. If there are no non-option arguments, sc_optarg
// non-option argument), sc_getopt returns EOF, optarg will point
// to the argument, and optind will be set to the argv index of
// the argument. If there are no non-option arguments, optarg
// will be set to NULL.
//
// The special option "--" may be used to delimit the end of the
@ -127,14 +127,14 @@
// break;
//
// case _T('n'):
// TRACE(_T("option n: value=%d\n"), atoi(sc_optarg));
// TRACE(_T("option n: value=%d\n"), atoi(optarg));
// //
// // do something with value here
// //
// break;
//
// case _T('?'):
// TRACE(_T("ERROR: illegal option %s\n"), argv[sc_optind-1]);
// TRACE(_T("ERROR: illegal option %s\n"), argv[optind-1]);
// return FALSE;
// break;
//
@ -152,42 +152,42 @@
//
///////////////////////////////////////////////////////////////////////////////
char * sc_optarg; // global argument pointer
int sc_optind = 0; // global argv index
char * optarg; // global argument pointer
int optind = 0; // global argv index
int sc_getopt( int argc, char * argv[], char * optstring ) {
static char * next = NULL;
if( sc_optind == 0 ) {
if( optind == 0 ) {
next = NULL;
}
sc_optarg = NULL;
optarg = NULL;
if( next == NULL || *next == '\0' ) {
if( sc_optind == 0 ) {
sc_optind++;
if( optind == 0 ) {
optind++;
}
if( sc_optind >= argc || argv[sc_optind][0] != '-' || argv[sc_optind][1] == '\0' ) {
sc_optarg = NULL;
if( sc_optind < argc ) {
sc_optarg = argv[sc_optind];
if( optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0' ) {
optarg = NULL;
if( optind < argc ) {
optarg = argv[optind];
}
return EOF;
}
if( strcmp( argv[sc_optind], "--" ) == 0 ) {
sc_optind++;
sc_optarg = NULL;
if( sc_optind < argc ) {
sc_optarg = argv[sc_optind];
if( strcmp( argv[optind], "--" ) == 0 ) {
optind++;
optarg = NULL;
if( optind < argc ) {
optarg = argv[optind];
}
return EOF;
}
next = argv[sc_optind];
next = argv[optind];
next++; // skip past -
sc_optind++;
optind++;
}
char c = *next++;
@ -200,11 +200,11 @@ int sc_getopt( int argc, char * argv[], char * optstring ) {
cp++;
if( *cp == ':' ) {
if( *next != '\0' ) {
sc_optarg = next;
optarg = next;
next = NULL;
} else if( sc_optind < argc ) {
sc_optarg = argv[sc_optind];
sc_optind++;
} else if( optind < argc ) {
optarg = argv[optind];
optind++;
} else {
return '?';
}

View file

@ -20,8 +20,8 @@
extern "C" {
#endif
extern SC_BASE_EXPORT int sc_optind, sc_opterr;
extern SC_BASE_EXPORT char * sc_optarg;
extern SC_BASE_EXPORT int optind, opterr;
extern SC_BASE_EXPORT char * optarg;
int SC_BASE_EXPORT sc_getopt( int argc, char * argv[], char * optstring );

View file

@ -168,7 +168,7 @@ sc_memmgr::~sc_memmgr( void ) {
// Check if total allocated equals total deallocated
if( _allocated_total != _deallocated_total ) {
// todo: generate warning for possible memory leaks, enable full memory leak checking
fprintf( stderr, "sc_memmgr warning: Possible memory leaks detected (%d of %d bytes)\n", _allocated_total - _deallocated_total, _allocated_total );
printf( "sc_memmgr warning: Possible memory leaks detected (%d of %d bytes)\n", _allocated_total - _deallocated_total, _allocated_total );
}
// Compact leaks into an error list to prevent same leak being reported multiple times.
@ -193,7 +193,7 @@ sc_memmgr::~sc_memmgr( void ) {
ierror != errors.end();
ierror ++ ) {
// todo: generate error for memory leak
fprintf( stderr, "sc_memmgr warning: Possible memory leak in %s line %d\n", ierror->getsrcfile().c_str(), ierror->getsrcline() );
printf( "sc_memmgr warning: Possible memory leak in %s line %d\n", ierror->getsrcfile().c_str(), ierror->getsrcline() );
}
// Clear remaining records
@ -211,7 +211,7 @@ void * sc_memmgr::allocate( size_t size, const char * file, const int line ) {
addr = malloc( size );
if( addr == NULL ) {
// todo: error allocation failed
fprintf( stderr, "sc_memmgr error: Memory allocation failed in %s line %d\n", file, line );
printf( "sc_memmgr error: Memory allocation failed in %s line %d\n", file, line );
}
// Some stl implementations (for example debian gcc) use the new operator to construct
@ -246,7 +246,7 @@ void * sc_memmgr::reallocate( void * addr, size_t size, const char * file, const
record = _records.find( sc_memmgr_record( addr ) );
if( record == _records.end() ) {
// todo: error reallocating memory not allocated?
fprintf( stderr, "sc_memmgr warning: Reallocation of not allocated memory at %s line %d\n", file, line );
printf( "sc_memmgr warning: Reallocation of not allocated memory at %s line %d\n", file, line );
} else {
// Update stats
_allocated -= record->getsize();
@ -264,7 +264,7 @@ void * sc_memmgr::reallocate( void * addr, size_t size, const char * file, const
addr = realloc( addr, size );
if( addr == NULL ) {
// todo: error reallocation failed
fprintf( stderr, "sc_memmgr error: Reallocation failed at %s line %d\n", file, line );
printf( "sc_memmgr error: Reallocation failed at %s line %d\n", file, line );
}
#ifdef SC_MEMMGR_ENABLE_CHECKS
@ -296,7 +296,7 @@ void sc_memmgr::deallocate( void * addr, const char * file, const int line ) {
record = _records.find( sc_memmgr_record( addr ) );
if( record == _records.end() ) {
// todo: error free called for not allocated memory?
fprintf( stderr, "sc_memmgr warning: Deallocate of not allocated memory at %s line %d\n", file, line );
printf( "sc_memmgr warning: Deallocate of not allocated memory at %s line %d\n", file, line );
} else {
// Update stats
_allocated -= record->getsize();

View file

@ -1,13 +0,0 @@
#ifndef NULLPTR_H
#define NULLPTR_H
#include <sc_cf.h>
#ifdef HAVE_NULLPTR
#include <cstddef>
#else
# define nullptr_t void*
# define nullptr NULL
#endif //HAVE_NULLPTR
#endif //NULLPTR_H

12
src/base/sc_stdbool.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef SC_STDBOOL_H
#define SC_STDBOOL_H
#ifdef _WIN32
typedef int bool;
# define false 0
# define true 1
#else
# include <stdbool.h>
#endif
#endif /* SC_STDBOOL_H */

View file

@ -9,17 +9,17 @@
*
* This header must be included *after* all other headers, otherwise the compiler will
* report errors in system headers.
* \sa trace_fprintf()
* \sa trace_fprintf
**/
#include "sc_export.h"
/** used to find where generated c++ originates from in exp2cxx
* To enable, configure with 'cmake .. -DSC_TRACE_FPRINTF=ON'
*/
#ifdef __cplusplus
extern "C" {
#endif
/** Used to find where generated c++ originates from in exp2cxx.
* To enable, configure with 'cmake .. -DSC_TRACE_FPRINTF=ON'
*/
SC_BASE_EXPORT void trace_fprintf( char const * sourcefile, int line, FILE * file, const char * format, ... );
#ifdef __cplusplus
}

View file

@ -10,6 +10,7 @@ set(LIBSTEPDAI_SRCS
sdaiModel_contents_list.cc
sdaiObject.cc
sdaiSession_instance.cc
sdaiSet.cc
sdaiString.cc
)
@ -24,6 +25,7 @@ SET(SC_CLDAI_HDRS
sdaiModel_contents_list.h
sdaiObject.h
sdaiSession_instance.h
sdaiSet.h
sdaiString.h
)
@ -35,6 +37,10 @@ include_directories(
)
SC_ADDLIB(stepdai "${LIBSTEPDAI_SRCS}" "steputils;base")
if(HAVE_STD_THREAD)
list(APPEND CMAKE_CXX_FLAGS "-pthread -std=c++0x")
set_target_properties(stepdai PROPERTIES COMPILE_FLAGS "-pthread -std=c++0x -DHAVE_STD_THREAD" )
endif(HAVE_STD_THREAD)
install(FILES ${SC_CLDAI_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cldai)

View file

@ -31,8 +31,6 @@
#include <math.h>
#include "sc_memmgr.h"
#include "sdaiApplication_instance.h"
// to help ObjectCenter
#ifndef HAVE_MEMMOVE
extern "C"
@ -43,99 +41,13 @@ extern "C"
/*****************************************************************************/
SDAI_Application_instance__set::SDAI_Application_instance__set( int defaultSize ) {
_bufsize = defaultSize;
_buf = new SDAI_Application_instance_ptr[_bufsize];
_count = 0;
SDAI_Application_instance__set::SDAI_Application_instance__set( int defaultSize ) : SDAI__set( defaultSize ) {
}
SDAI_Application_instance__set::~SDAI_Application_instance__set() {
delete _buf;
}
void SDAI_Application_instance__set::Check( int index ) {
SDAI_Application_instance_ptr * newbuf;
if( index >= _bufsize ) {
_bufsize = ( index + 1 ) * 2;
newbuf = new SDAI_Application_instance_ptr[_bufsize];
memmove( newbuf, _buf, _count * sizeof( SDAI_Application_instance_ptr ) );
delete _buf;
_buf = newbuf;
}
}
void SDAI_Application_instance__set::Insert( SDAI_Application_instance_ptr v, int index ) {
SDAI_Application_instance_ptr * spot;
index = ( index < 0 ) ? _count : index;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_Application_instance_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_Application_instance__set::Append( SDAI_Application_instance_ptr v ) {
int index = _count;
SDAI_Application_instance_ptr * spot;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_Application_instance_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_Application_instance__set::Remove( int index ) {
if( 0 <= index && index < _count ) {
--_count;
SDAI_Application_instance_ptr * spot = &_buf[index];
memmove( spot, spot + 1, ( _count - index )*sizeof( SDAI_Application_instance_ptr ) );
}
}
void SDAI_Application_instance__set::Remove( SDAI_Application_instance_ptr a ) {
int index = Index( a );
if( !( index < 0 ) ) {
Remove( index );
}
}
int SDAI_Application_instance__set::Index( SDAI_Application_instance_ptr v ) {
for( int i = 0; i < _count; ++i ) {
if( _buf[i] == v ) {
return i;
}
}
return -1;
}
SDAI_Application_instance_ptr & SDAI_Application_instance__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
return ( SDAI_Application_instance_ptr & )SDAI__set::operator[]( index );
}
int
SDAI_Application_instance__set::Count() {
return _count;
}
void
SDAI_Application_instance__set::Clear() {
_count = 0;
}

View file

@ -37,26 +37,12 @@ class SDAI_Application_instance__set;
typedef SDAI_Application_instance__set * SDAI_Application_instance__set_ptr;
typedef SDAI_Application_instance__set_ptr SDAI_Application_instance__set_var;
class SC_DAI_EXPORT SDAI_Application_instance__set {
class SC_DAI_EXPORT SDAI_Application_instance__set : public SDAI__set {
public:
SDAI_Application_instance__set( int = 16 );
~SDAI_Application_instance__set();
SDAI_Application_instance *& operator[]( int index );
void Insert( SDAI_Application_instance *, int index );
void Append( SDAI_Application_instance * );
void Remove( int index );
void Remove( SDAI_Application_instance * );
int Index( SDAI_Application_instance * );
int Count();
void Clear();
private:
void Check( int index );
private:
SDAI_Application_instance ** _buf;
int _bufsize;
int _count;
};
#endif

View file

@ -78,83 +78,10 @@ SDAI_DAObject_SDAI::~SDAI_DAObject_SDAI() {
/*****************************************************************************/
SDAI_DAObject__set::SDAI_DAObject__set( int defaultSize ) {
_bufsize = defaultSize;
_buf = new SDAI_DAObject_ptr[_bufsize];
_count = 0;
SDAI_DAObject__set::SDAI_DAObject__set( int defaultSize ) : SDAI__set( defaultSize ){
}
SDAI_DAObject__set::~SDAI_DAObject__set() {
delete _buf;
}
void SDAI_DAObject__set::Check( int index ) {
SDAI_DAObject_ptr * newbuf;
if( index >= _bufsize ) {
_bufsize = ( index + 1 ) * 2;
newbuf = new SDAI_DAObject_ptr[_bufsize];
memmove( newbuf, _buf, _count * sizeof( SDAI_DAObject_ptr ) );
delete _buf;
_buf = newbuf;
}
}
void
SDAI_DAObject__set::Insert( SDAI_DAObject_ptr v, int index ) {
SDAI_DAObject_ptr * spot;
index = ( index < 0 ) ? _count : index;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_DAObject_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_DAObject__set::Append( SDAI_DAObject_ptr v ) {
int index = _count;
SDAI_DAObject_ptr * spot;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_DAObject_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_DAObject__set::Remove( int index ) {
if( 0 <= index && index < _count ) {
--_count;
SDAI_DAObject_ptr * spot = &_buf[index];
memmove( spot, spot + 1, ( _count - index )*sizeof( SDAI_DAObject_ptr ) );
}
}
int SDAI_DAObject__set::Index( SDAI_DAObject_ptr v ) {
for( int i = 0; i < _count; ++i ) {
if( _buf[i] == v ) {
return i;
}
}
return -1;
}
SDAI_DAObject_ptr
@ -163,24 +90,5 @@ SDAI_DAObject__set::retrieve( int index ) {
}
SDAI_DAObject_ptr & SDAI_DAObject__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
SDAI_DAObject__set::Count() {
return _count;
}
int
SDAI_DAObject__set::is_empty() {
return _count;
}
void
SDAI_DAObject__set::Clear() {
_count = 0;
return ( SDAI_DAObject_ptr & )SDAI__set::operator[]( index );
}

View file

@ -9,11 +9,17 @@
typedef char * SDAI_DAObjectID;
// interface PID (ISO/DIS 10303-23:1996(E) 5.3.10.1)
// Also, CORBA POS specification, Section 5.4
//
// The PID class maintains the persistent object identifier for every
// persistent object, objects of class DAObject, and objects of any class
// derived directly or indirectly from DAObject.
//
// POS: The PID identifies one or more locations within a Datastore that
// represent the persistent data of an object and generates a string
// identifier for that data. An object must have a PID in order to store
// its data persistently.
//
/*
The EXPRESS ENTITY application_instance from the SDAI_data_type_schema from
@ -23,7 +29,7 @@ typedef char * SDAI_DAObjectID;
The class DAObject is supported by the classes PID, PID_SDAI and the type
SDAI_DAObjectID as follows:
*/
/// interface PID (ISO/DIS 10303-23:1996(E) 5.3.10.1)
class SC_DAI_EXPORT SDAI_PID : public SDAI_sdaiObject {
public:
@ -61,6 +67,8 @@ typedef SDAI_PID * SDAI_PID_ptr;
typedef SDAI_PID_ptr SDAI_PID_var;
// interface PID_DA (ISO/DIS 10303-23:1996(E) 5.3.10.3)
// Also, CORBA POS specification, Direct Access Protocol, Section 5.10.1
//
// The Direct Access Protocol supports direct access to persistent data
// through typed attributes organized in data objects that are defined
@ -80,7 +88,7 @@ typedef SDAI_PID_ptr SDAI_PID_var;
// may be accessed through this extension to the CosPersistencePID
// interface.
//
/// interface PID_DA (ISO/DIS 10303-23:1996(E) 5.3.10.3)
class SC_DAI_EXPORT SDAI_PID_DA: public SDAI_PID {
public:
@ -112,11 +120,11 @@ class SC_DAI_EXPORT SDAI_PID_DA: public SDAI_PID {
typedef SDAI_PID_DA * SDAI_PID_DA_ptr;
typedef SDAI_PID_DA_ptr SDAI_PID_DA_var;
// interface PID_SDAI (ISO/DIS 10303-23:1996(E) 5.3.10.2)
//
// The PID_SDAI class maintains the persistent object identifier for
// a Model_contents object.
//
/// interface PID_SDAI (ISO/DIS 10303-23:1996(E) 5.3.10.2)
class SC_DAI_EXPORT SDAI_PID_SDAI : public SDAI_PID {
public:
SDAI_String _modelid;
@ -142,6 +150,8 @@ class SC_DAI_EXPORT SDAI_PID_SDAI : public SDAI_PID {
typedef SDAI_PID_SDAI * SDAI_PID_SDAI_ptr;
typedef SDAI_PID_SDAI_ptr SDAI_PID_SDAI_var;
// interface DAObject (ISO/DIS 10303-23:1996(E) 5.3.10.5)
// Also, CORBA POS Section 5.10.2, Direct Access Protocol.
//
// From POS: The DAObject interface provides operations that many data
// object clients need. A Datastore implementation may provide support
@ -156,7 +166,6 @@ class SDAI_DAObject;
typedef SDAI_DAObject * SDAI_DAObject_ptr;
typedef SDAI_DAObject_ptr SDAI_DAObject_var;
/// interface DAObject (ISO/DIS 10303-23:1996(E) 5.3.10.5)
class SC_DAI_EXPORT SDAI_DAObject : public SDAI_sdaiObject {
public:
@ -253,7 +262,7 @@ class SC_DAI_EXPORT SDAI_DAObject : public SDAI_sdaiObject {
void dado_free() { }
};
/**
/*
5.3.10.1 DAObject_SDAI
*/
@ -480,34 +489,13 @@ class SC_DAI_EXPORT SDAI_DAObject_SDAI : public SDAI_DAObject {
typedef SDAI_DAObject_SDAI * SDAI_DAObject_SDAI_ptr;
typedef SDAI_DAObject_SDAI_ptr SDAI_DAObject_SDAI_var;
class SC_DAI_EXPORT SDAI_DAObject__set {
class SC_DAI_EXPORT SDAI_DAObject__set : public SDAI__set {
public:
SDAI_DAObject__set( int = 16 );
~SDAI_DAObject__set();
SDAI_DAObject_ptr retrieve( int index );
int is_empty();
SDAI_DAObject_ptr & operator[]( int index );
void Insert( SDAI_DAObject_ptr, int index );
void Append( SDAI_DAObject_ptr );
void Remove( int index );
int Index( SDAI_DAObject_ptr );
void Clear();
int Count();
private:
void Check( int index );
private:
SDAI_DAObject_ptr * _buf;
int _bufsize;
int _count;
public:
};
typedef SDAI_DAObject__set * SDAI_DAObject__set_ptr;

View file

@ -114,7 +114,7 @@ SDAI_Entity_extent::AddInstance( const SDAI_DAObject_ptr & appInst ) {
void
SDAI_Entity_extent::RemoveInstance( const SDAI_DAObject_ptr & appInst ) {
_instances.Remove( _instances.Index( appInst ) );
_instances.Remove( appInst );
}
///////// END_ENTITY SDAI_Entity_extent

View file

@ -44,83 +44,10 @@ extern "C"
/*****************************************************************************/
SDAI_Entity_extent__set::SDAI_Entity_extent__set( int defaultSize ) {
_bufsize = defaultSize;
_buf = new SDAI_Entity_extent_ptr[_bufsize];
_count = 0;
SDAI_Entity_extent__set::SDAI_Entity_extent__set( int defaultSize ) : SDAI__set( defaultSize ) {
}
SDAI_Entity_extent__set::~SDAI_Entity_extent__set() {
delete _buf;
}
void SDAI_Entity_extent__set::Check( int index ) {
SDAI_Entity_extent_ptr * newbuf;
if( index >= _bufsize ) {
_bufsize = ( index + 1 ) * 2;
newbuf = new SDAI_Entity_extent_ptr[_bufsize];
memmove( newbuf, _buf, _count * sizeof( SDAI_Entity_extent_ptr ) );
delete _buf;
_buf = newbuf;
}
}
void
SDAI_Entity_extent__set::Insert( SDAI_Entity_extent_ptr v, int index ) {
SDAI_Entity_extent_ptr * spot;
index = ( index < 0 ) ? _count : index;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_Entity_extent_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_Entity_extent__set::Append( SDAI_Entity_extent_ptr v ) {
int index = _count;
SDAI_Entity_extent_ptr * spot;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_Entity_extent_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_Entity_extent__set::Remove( int index ) {
if( 0 <= index && index < _count ) {
--_count;
SDAI_Entity_extent_ptr * spot = &_buf[index];
memmove( spot, spot + 1, ( _count - index )*sizeof( SDAI_Entity_extent_ptr ) );
}
}
int SDAI_Entity_extent__set::Index( SDAI_Entity_extent_ptr v ) {
for( int i = 0; i < _count; ++i ) {
if( _buf[i] == v ) {
return i;
}
}
return -1;
}
SDAI_Entity_extent_ptr
@ -129,25 +56,7 @@ SDAI_Entity_extent__set::retrieve( int index ) {
}
SDAI_Entity_extent_ptr & SDAI_Entity_extent__set::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
SDAI_Entity_extent__set::Count() {
return _count;
}
int
SDAI_Entity_extent__set::is_empty() {
return _count;
}
void
SDAI_Entity_extent__set::Clear() {
_count = 0;
return ( SDAI_Entity_extent_ptr & )SDAI__set::operator[]( index );
}
/*****************************************************************************/

View file

@ -37,32 +37,14 @@
//#include <EntityExtent.h>
*/
class SC_DAI_EXPORT SDAI_Entity_extent__set {
class SC_DAI_EXPORT SDAI_Entity_extent__set : public SDAI__set {
public:
SDAI_Entity_extent__set( int = 16 );
~SDAI_Entity_extent__set();
SDAI_Entity_extent_ptr retrieve( int index );
int is_empty();
SDAI_Entity_extent_ptr & operator[]( int index );
void Insert( SDAI_Entity_extent_ptr, int index );
void Append( SDAI_Entity_extent_ptr );
void Remove( int index );
int Index( SDAI_Entity_extent_ptr );
void Clear();
int Count();
private:
void Check( int index );
private:
SDAI_Entity_extent_ptr * _buf;
int _bufsize;
int _count;
};
typedef SDAI_Entity_extent__set * SDAI_Entity_extent__set_ptr;

View file

@ -357,7 +357,6 @@ int SDAI_Enum::put( const char * n ) {
}
/// return 0 if unset otherwise return 1
/// WARNING it appears that exists() will return true after a call to nullify(). is this intended?
int SDAI_Enum::exists() const {
return !( v > no_elements() );
}

View file

@ -12,7 +12,6 @@
* and is not subject to copyright.
*/
#include <iostream>
#include <sc_export.h>
class SC_DAI_EXPORT SDAI_Enum {
@ -28,7 +27,7 @@ class SC_DAI_EXPORT SDAI_Enum {
public:
virtual ~SDAI_Enum() {};
void PrintContents( ostream & out = std::cout ) const {
void PrintContents( ostream & out = cout ) const {
DebugDisplay( out );
}
@ -52,7 +51,7 @@ class SC_DAI_EXPORT SDAI_Enum {
}
const char * asStr( std::string & s ) const;
void STEPwrite( ostream & out = std::cout ) const;
void STEPwrite( ostream & out = cout ) const;
const char * STEPwrite( std::string & s ) const;
Severity StrToVal( const char * s, ErrorDescriptor * err, int optional = 1 );
@ -61,8 +60,8 @@ class SC_DAI_EXPORT SDAI_Enum {
virtual int put( int val );
virtual int put( const char * n );
bool is_null() const {
return ( exists() == 0 );
int is_null() const {
return !( exists() );
}
void set_null() {
nullify();
@ -70,11 +69,9 @@ class SC_DAI_EXPORT SDAI_Enum {
SDAI_Enum & operator= ( const int );
SDAI_Enum & operator= ( const SDAI_Enum & );
/// WARNING it appears that exists() will return true after a call to nullify(). is this intended?
///FIXME need to rewrite this function, but strange implementation...
virtual int exists() const;
virtual void nullify();
void DebugDisplay( ostream & out = std::cout ) const;
void DebugDisplay( ostream & out = cout ) const;
protected:
virtual Severity ReadEnum( istream & in, ErrorDescriptor * err,

View file

@ -73,7 +73,7 @@ void SDAI_Model_contents::AddInstance( const SDAI_DAObject_SDAI_ptr & appInst )
}
void SDAI_Model_contents::RemoveInstance( SDAI_DAObject_SDAI_ptr & appInst ) {
_instances.contents_()->Remove( _instances.contents_()->Index( appInst ) );
_instances.contents_()->Remove( appInst );
}

View file

@ -36,83 +36,10 @@ extern "C"
/*****************************************************************************/
SDAI_Model_contents__list::SDAI_Model_contents__list( int defaultSize ) {
_bufsize = defaultSize;
_buf = new SDAI_Model_contents_ptr[_bufsize];
_count = 0;
SDAI_Model_contents__list::SDAI_Model_contents__list( int defaultSize ) : SDAI__set( defaultSize ){
}
SDAI_Model_contents__list::~SDAI_Model_contents__list() {
delete _buf;
}
void SDAI_Model_contents__list::Check( int index ) {
SDAI_Model_contents_ptr * newbuf;
if( index >= _bufsize ) {
_bufsize = ( index + 1 ) * 2;
newbuf = new SDAI_Model_contents_ptr[_bufsize];
memmove( newbuf, _buf, _count * sizeof( SDAI_Model_contents_ptr ) );
delete _buf;
_buf = newbuf;
}
}
void
SDAI_Model_contents__list::Insert( SDAI_Model_contents_ptr v, int index ) {
SDAI_Model_contents_ptr * spot;
index = ( index < 0 ) ? _count : index;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_Model_contents_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_Model_contents__list::Append( SDAI_Model_contents_ptr v ) {
int index = _count;
SDAI_Model_contents_ptr * spot;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_Model_contents_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
}
void SDAI_Model_contents__list::Remove( int index ) {
if( 0 <= index && index < _count ) {
--_count;
SDAI_Model_contents_ptr * spot = &_buf[index];
memmove( spot, spot + 1, ( _count - index )*sizeof( SDAI_Model_contents_ptr ) );
}
}
int SDAI_Model_contents__list::Index( SDAI_Model_contents_ptr v ) {
for( int i = 0; i < _count; ++i ) {
if( _buf[i] == v ) {
return i;
}
}
return -1;
}
SDAI_Model_contents_ptr
@ -122,25 +49,6 @@ SDAI_Model_contents__list::retrieve( int index ) {
SDAI_Model_contents_ptr &
SDAI_Model_contents__list::operator[]( int index ) {
Check( index );
// _count = max(_count, index+1);
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
return _buf[index];
}
int
SDAI_Model_contents__list::Count() {
return _count;
}
int
SDAI_Model_contents__list::is_empty() {
return _count;
}
void
SDAI_Model_contents__list::Clear() {
_count = 0;
return ( SDAI_Model_contents_ptr & )SDAI__set::operator[]( index );
}

View file

@ -3,30 +3,13 @@
#include <sc_export.h>
class SC_DAI_EXPORT SDAI_Model_contents__list {
class SC_DAI_EXPORT SDAI_Model_contents__list : public SDAI__set {
public:
SDAI_Model_contents__list( int = 16 );
~SDAI_Model_contents__list();
SDAI_Model_contents_ptr retrieve( int index );
int is_empty();
SDAI_Model_contents_ptr & operator[]( int index );
void Insert( SDAI_Model_contents_ptr, int index );
void Append( SDAI_Model_contents_ptr );
void Remove( int index );
int Index( SDAI_Model_contents_ptr );
void Clear();
int Count();
private:
void Check( int index );
private:
SDAI_Model_contents_ptr * _buf;
int _bufsize;
int _count;
};
typedef SDAI_Model_contents__list *

153
src/cldai/sdaiSet.cc Normal file
View file

@ -0,0 +1,153 @@
#include <memory.h>
#include <math.h>
#include <sdai.h>
#include "sc_memmgr.h"
#ifndef HAVE_MEMMOVE
extern "C"
{
void * memmove( void * __s1, const void * __s2, size_t __n );
}
#endif
/*****************************************************************************/
SDAI__set::SDAI__set( int defaultSize ) {
_bufsize = defaultSize;
_buf = new SDAI_ptr[_bufsize];
_count = 0;
mtxP = new sc_mutex();
}
SDAI__set::~SDAI__set() {
delete _buf;
delete mtxP;
}
void SDAI__set::Check( int index ) {
// No locking as it is a private function.
// i.e. The caller will have to take the responsibilty.
SDAI_ptr * newbuf;
if( index >= _bufsize ) {
_bufsize = ( index + 1 ) * 2;
newbuf = new SDAI_ptr[_bufsize];
memmove( newbuf, _buf, _count * sizeof( SDAI_ptr ) );
delete _buf;
_buf = newbuf;
}
}
void
SDAI__set::Insert( SDAI_ptr v, int index ) {
mtxP->lock();
SDAI_ptr * spot;
index = ( index < 0 ) ? _count : index;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
mtxP->unlock();
}
void SDAI__set::Append( SDAI_ptr v ) {
mtxP->lock();
int index = _count;
SDAI_ptr * spot;
if( index < _count ) {
Check( _count + 1 );
spot = &_buf[index];
memmove( spot + 1, spot, ( _count - index )*sizeof( SDAI_ptr ) );
} else {
Check( index );
spot = &_buf[index];
}
*spot = v;
++_count;
mtxP->unlock();
}
void SDAI__set::Remove( int index ) {
mtxP->lock();
if( 0 <= index && index < _count ) {
--_count;
SDAI_ptr * spot = &_buf[index];
memmove( spot, spot + 1, ( _count - index )*sizeof( SDAI_ptr ) );
}
mtxP->unlock();
}
// First find the index of v and then remove v.
void SDAI__set::Remove( SDAI_ptr v ) {
mtxP->lock();
for( int i = 0; i < _count; ++i ) {
if( _buf[i] == v ) {
--_count;
SDAI_ptr * spot = &_buf[i];
memmove( spot, spot + 1, ( _count - i )*sizeof( SDAI_ptr ) );
}
}
mtxP->unlock();
}
int SDAI__set::Index( SDAI_ptr v ) {
mtxP->lock();
int index = -1;
for( int i = 0; i < _count; ++i ) {
if( _buf[i] == v ) {
index = i;
break;
}
}
mtxP->unlock();
return index;
}
SDAI_ptr
SDAI__set::retrieve( int index ) {
return operator[]( index );
}
SDAI_ptr & SDAI__set::operator[]( int index ) {
mtxP->lock();
Check( index );
_count = ( ( _count > index + 1 ) ? _count : ( index + 1 ) );
SDAI_ptr & sp = _buf[index];
mtxP->unlock();
return sp;
}
int
SDAI__set::Count() {
return _count;
}
int
SDAI__set::is_empty() {
return _count;
}
void
SDAI__set::Clear() {
mtxP->lock();
_count = 0;
mtxP->unlock();
}

46
src/cldai/sdaiSet.h Normal file
View file

@ -0,0 +1,46 @@
#ifndef SDAISET_H
#define SDAISET_H 1
#include <sc_mutex.h>
#include <sc_export.h>
typedef void * SDAI_ptr;
class SC_DAI_EXPORT SDAI__set {
public:
SDAI__set( int = 16 );
~SDAI__set();
SDAI_ptr retrieve( int index );
int is_empty();
SDAI_ptr & operator[]( int index );
void Insert( SDAI_ptr, int index );
void Append( SDAI_ptr );
void Remove( int index );
void Remove( SDAI_ptr );
int Index( SDAI_ptr );
void Clear();
int Count();
private:
void Check( int index );
private:
SDAI_ptr * _buf;
int _bufsize;
int _count;
sc_mutex * mtxP;
// The above function is declared as a pointer to prevent
// 'use of deleted function' compilation error as the
// assignment operator '=' is being in the function
// 'SDAI_Entity_extent::owned_by_' for a subclass of
// SDAI__set: 'SDAI_Model_contents__list'
public:
};
#endif

View file

@ -28,6 +28,10 @@ include_directories(
)
SC_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" "stepcore;stepdai;steputils;base")
if(HAVE_STD_THREAD)
list(APPEND CMAKE_CXX_FLAGS "-pthread -std=c++0x")
set_target_properties(stepeditor PROPERTIES COMPILE_FLAGS "-pthread -std=c++0x -DHAVE_STD_THREAD" )
endif(HAVE_STD_THREAD)
install(FILES ${SC_CLEDITOR_HDRS}
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cleditor)

View file

@ -149,7 +149,7 @@ Severity STEPfile::ReadHeader( istream & in ) {
}
//get the entity keyword
keywd = GetKeyword( in, ";( /\\", _error );
FillKeyword( in, ";( /\\", _error, keywd );
ReadTokenSeparator( in, &cmtStr );
//check for "ENDSEC"
@ -198,14 +198,14 @@ Severity STEPfile::ReadHeader( istream & in ) {
} else { //not ENTITY_NULL
//read the header instance
AppendEntityErrorMsg( &( obj->Error() ) );
//check obj's Error Descriptor
objsev = AppendEntityErrorMsg( &( obj->Error() ) );
//set file_id to reflect the appropriate Header Section Entity
fileid = HeaderId( const_cast<char *>( keywd.c_str() ) );
//read the values from the istream
objsev = obj->STEPread( fileid, 0, ( InstMgr * )0, in, NULL, true, _strict );
_error.GreaterSeverity( objsev );
if( !cmtStr.empty() ) {
obj->PrependP21Comment( cmtStr );
}
@ -367,9 +367,9 @@ void STEPfile::HeaderMergeInstances( InstMgr * im ) {
//checking for _headerInstances::FILE_NAME
idnum = HeaderId( "File_Name" );
se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) );
se = _headerInstances->GetApplication_instanceFromFileId( idnum );
if( se ) {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
from = im->GetApplication_instanceFromFileId( idnum );
// name:
// time_stamp: keep the newer time_stamp
@ -379,33 +379,33 @@ void STEPfile::HeaderMergeInstances( InstMgr * im ) {
// originating_system:
// authorization:
} else { // No current File_Name instance
from = im->GetApplication_instance( im->FindFileId( idnum ) );
from = im->GetApplication_instanceFromFileId( idnum );
_headerInstances->Append( from, completeSE );
}
//checking for _headerInstances::FILE_DESCRIPTION
idnum = HeaderId( "File_Description" );
se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) );
se = _headerInstances->GetApplication_instanceFromFileId( idnum );
if( se ) {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
from = im->GetApplication_instanceFromFileId( idnum );
//description
//implementation_level
} else {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
from = im->GetApplication_instanceFromFileId( idnum );
_headerInstances->Append( from, completeSE );
}
//checking for _headerInstances::FILE_SCHEMA
idnum = HeaderId( "File_Schema" );
se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) );
se = _headerInstances->GetApplication_instanceFromFileId( idnum );
if( se ) {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
from = im->GetApplication_instanceFromFileId( idnum );
//description
//implementation_level
} else {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
from = im->GetApplication_instanceFromFileId( idnum );
_headerInstances->Append( from, completeSE );
}
@ -913,7 +913,7 @@ Severity STEPfile::CreateScopeInstances( istream & in, SDAI_Application_instance
std::vector< SDAI_Application_instance_ptr > inscope;
std::string keywd;
keywd = GetKeyword( in, " \n\t/\\#;", _error );
FillKeyword( in, " \n\t/\\#;", _error, keywd );
if( strncmp( const_cast<char *>( keywd.c_str() ), "&SCOPE", 6 ) ) {
//ERROR: "&SCOPE" expected
//TODO: should attempt to recover by reading through ENDSCOPE
@ -955,7 +955,7 @@ Severity STEPfile::CreateScopeInstances( istream & in, SDAI_Application_instance
}
//check for "ENDSCOPE"
keywd = GetKeyword( in, " \t\n/\\#;", _error );
FillKeyword( in, " \t\n/\\#;", _error, keywd );
if( strncmp( const_cast<char *>( keywd.c_str() ), "ENDSCOPE", 8 ) ) {
//ERROR: "ENDSCOPE" expected
SkipInstance( in, tmpbuf );
@ -1071,7 +1071,7 @@ Severity STEPfile::ReadScopeInstances( istream & in ) {
std::string keywd;
std::string cmtStr;
keywd = GetKeyword( in, " \n\t/\\#;", _error );
FillKeyword( in, " \n\t/\\#;", _error, keywd );
if( strncmp( const_cast<char *>( keywd.c_str() ), "&SCOPE", 6 ) ) {
//ERROR: "&SCOPE" expected
SkipInstance( in, tmpbuf );
@ -1099,7 +1099,7 @@ Severity STEPfile::ReadScopeInstances( istream & in ) {
in.putback( c );
//check for "ENDSCOPE"
keywd = GetKeyword( in, " \t\n/\\#;", _error );
FillKeyword( in, " \t\n/\\#;", _error, keywd );
if( strncmp( const_cast<char *>( keywd.c_str() ), "ENDSCOPE", 8 ) ) {
//ERROR: "ENDSCOPE" expected
SkipInstance( in, tmpbuf );
@ -1307,7 +1307,7 @@ SDAI_Application_instance * STEPfile::ReadInstance( istream & in, ostream & out,
case SEVERITY_BUG:
case SEVERITY_INCOMPLETE:
if( _fileType == VERSION_CURRENT ) {
if( ( _fileType == VERSION_CURRENT ) ) {
cerr << "ERROR in EXCHANGE FILE: incomplete instance #"
<< obj -> STEPfile_id << ".\n";
if( _fileType != WORKING_SESSION ) {
@ -1480,7 +1480,11 @@ int STEPfile::HeaderId( const char * name ) {
if( tmp == "FILE_SCHEMA" ) {
return 3;
}
return ++_headerId;
_headerIdMtx.lock();
int myHeaderId = ++_headerId;
_headerIdMtx.unlock();
return myHeaderId;
}
/***************************
@ -1494,6 +1498,7 @@ void STEPfile::WriteHeader( ostream & out ) {
// Write the rest of the header instances
SDAI_Application_instance * se;
_headerInstances->masterMtx.lock();
int n = _headerInstances->InstanceCount();
for( int i = 0; i < n; ++i ) {
se = _headerInstances->GetMgrNode( i ) ->GetApplication_instance();
@ -1505,6 +1510,7 @@ void STEPfile::WriteHeader( ostream & out ) {
WriteHeaderInstance(
_headerInstances->GetMgrNode( i )->GetApplication_instance(), out );
}
_headerInstances->masterMtx.unlock();
out << "ENDSEC;\n";
}
@ -1516,6 +1522,8 @@ void STEPfile::WriteHeaderInstance( SDAI_Application_instance * obj, ostream & o
out << obj->P21Comment();
}
out << StrToUpper( obj->EntityName(), tmp ) << "(";
obj->mtx.lock();
obj->attributes.mtxP->lock();
int n = obj->attributes.list_length();
for( int i = 0; i < n; ++i ) {
( obj->attributes[i] ).STEPwrite( out );
@ -1523,6 +1531,8 @@ void STEPfile::WriteHeaderInstance( SDAI_Application_instance * obj, ostream & o
out << ",";
}
}
obj->attributes.mtxP->unlock();
obj->mtx.unlock();
out << ");\n";
}
@ -1584,21 +1594,25 @@ void STEPfile::WriteData( ostream & out, int writeComments ) {
std::string currSch = schemaName();
out << "DATA;\n";
instances().masterMtx.lock();
int n = instances().InstanceCount();
for( int i = 0; i < n; ++i ) {
instances().GetMgrNode( i )->GetApplication_instance()->STEPwrite( out, currSch.c_str(), writeComments );
_oFileInstsWritten++;
}
instances().masterMtx.unlock();
out << "ENDSEC;\n";
}
void STEPfile::WriteValuePairsData( ostream & out, int writeComments, int mixedCase ) {
std::string currSch = schemaName();
instances().masterMtx.lock();
int n = instances().InstanceCount();
for( int i = 0; i < n; ++i ) {
instances().GetMgrNode( i )->GetApplication_instance()->WriteValuePairs( out, currSch.c_str(), writeComments, mixedCase );
}
instances().masterMtx.unlock();
}
Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
@ -1609,7 +1623,8 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
int total_insts = 0, valid_insts = 0;
ReadTokenSeparator( *in );
std::string keywd = GetKeyword( *in, "; #", _error );
std::string keywd;
FillKeyword( *in, "; #", _error, keywd );
// get the delimiter off the istream
char c;
in->get( c );
@ -1672,26 +1687,11 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
cout << errbuf;
// PASS 2
// This would be nicer if you didn't actually have to close the
// file but could just reposition the pointer back to the
// beginning of the data section. It looks like you can do this
// with the GNU File class, but that class doesn't have the
// operator >> overloaded which is used to do the rest of the
// parsing. SO we are using istreams and this works, but could
// be better.
// reset the error count so you're not counting things twice:
_errorCount = 0;
istream * in2;
if( !( ( in2 = OpenInputFile() ) && ( in2 -> good() ) ) ) {
// if the stream is not readable, there's an error
_error.AppendToUserMsg( "Cannot open file for 2nd pass -- No data read.\n" );
CloseInputFile( in2 );
return SEVERITY_INPUT_ERROR;
}
if( !FindDataSection( *in2 ) ) {
in->seekg( 0, std::ifstream::beg );
if( !FindDataSection( *in ) ) {
_error.AppendToUserMsg( "Error: Unable to find DATA section delimiter in second pass. \nData section not read. Rest of file ignored.\n" );
CloseInputFile( in2 );
return SEVERITY_INPUT_ERROR;
}
@ -1699,21 +1699,19 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
case VERSION_CURRENT:
case VERSION_UNKNOWN:
case WORKING_SESSION:
valid_insts = ReadData2( *in2, useTechCor );
valid_insts = ReadData2( *in, useTechCor );
break;
default:
_error.AppendToUserMsg( "STEPfile::AppendFile: STEP file version set to unrecognized value.\n" );
CloseInputFile( in2 );
return SEVERITY_BUG;
}
//check for "ENDSEC;"
ReadTokenSeparator( *in2 );
ReadTokenSeparator( *in );
if( total_insts != valid_insts ) {
sprintf( errbuf, "%d invalid instances in file: %s\n",
total_insts - valid_insts, ( ( FileName().compare( "-" ) == 0 ) ? "standard input" : FileName().c_str() ) );
_error.AppendToUserMsg( errbuf );
CloseInputFile( in2 );
return _error.GreaterSeverity( SEVERITY_WARNING );
}
@ -1728,25 +1726,23 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
//check for "ENDSTEP;" || "END-ISO-10303-21;"
if( in2 -> good() ) {
ReadTokenSeparator( *in2 );
keywd = GetKeyword( *in2, ";", _error );
if( in -> good() ) {
ReadTokenSeparator( *in );
FillKeyword( *in, ";", _error, keywd );
//yank the ";" from the istream
//if (';' == in2->peek()) in2->get();
//if (';' == in->peek()) in->get();
char ch;
in2->get( ch );
in->get( ch );
if( ch != ';' ) {
std::cerr << __FILE__ << ":" << __LINE__ << " - Expected ';' at Part 21 EOF, found '" << c << "'." << std::endl;
}
}
if( ( !keywd.compare( 0, keywd.size(), END_FILE_DELIM ) ) || !( in2 -> good() ) ) {
if( ( !keywd.compare( 0, keywd.size(), END_FILE_DELIM ) ) || !( in -> good() ) ) {
_error.AppendToUserMsg( END_FILE_DELIM );
_error.AppendToUserMsg( " missing at end of file.\n" );
CloseInputFile( in2 );
return _error.GreaterSeverity( SEVERITY_WARNING );
}
CloseInputFile( in2 );
cout << "Finished reading file.\n\n";
return SEVERITY_NULL;
}
@ -1790,6 +1786,8 @@ Severity STEPfile::WriteWorkingFile( const std::string filename, int clearError,
void STEPfile::WriteWorkingData( ostream & out, int writeComments ) {
std::string currSch = schemaName();
out << "DATA;\n";
instances().masterMtx.lock();
int n = instances().InstanceCount();
for( int i = 0; i < n; ++i ) {
@ -1819,6 +1817,7 @@ void STEPfile::WriteWorkingData( ostream & out, int writeComments ) {
break;
}
}
instances().masterMtx.unlock();
out << "ENDSEC;\n";
}

View file

@ -23,6 +23,7 @@
#include <time.h>
#include <read_func.h>
#include <sc_mutex.h>
//error reporting level
#define READ_COMPLETE 10
@ -36,6 +37,11 @@ enum FileTypeCode {
};
class SC_EDITOR_EXPORT STEPfile {
/// hoiji09: As this class is a parser, the locking in this class is dependent upon how it is
/// being used in a multithreaded way. Example: The variable llke _fileName restricts
/// this class to parse only one file at a time. If we want to parse more then one
/// then this will have to change.
protected:
//data members
@ -55,6 +61,7 @@ class SC_EDITOR_EXPORT STEPfile {
Registry * _headerRegistry;
int _headerId; ///< STEPfile_id given to SDAI_Application_instance from header section
sc_mutex _headerIdMtx; ///< Protects the _headerId
//file information
DirObj * _currentDir;

View file

@ -113,7 +113,9 @@ Severity STEPfile::ReadExchangeFile( const std::string filename, bool useTechCor
if( _headerInstances ) {
_headerInstances->ClearInstances();
}
_headerIdMtx.lock();
_headerId = 5;
_headerIdMtx.unlock();
Severity rval = AppendFile( in, useTechCor );
CloseInputFile( in );
return rval;
@ -262,11 +264,13 @@ int STEPfile::IncrementFileId( int fileid ) {
void STEPfile::SetFileIdIncrement() {
instances().masterMtx.lock();
if( instances().MaxFileId() < 0 ) {
_fileIdIncr = 0;
} else {
_fileIdIncr = ( int )( ( ceil( ( instances().MaxFileId() + 99.0 ) / 1000.0 ) + 1.0 ) * 1000.0 );
}
instances().masterMtx.unlock();
}
/**

View file

@ -14,15 +14,19 @@
#include "sc_memmgr.h"
ReplicateLinkNode * ReplicateList::FindNode( MgrNode * mn ) {
mtxP->lock(); //mtxP belongs to the superclass SingleLinkList
ReplicateLinkNode * rln = ( ReplicateLinkNode * )GetHead();
ReplicateLinkNode * retrln = 0;
int numEntries = EntryCount();
while( numEntries-- ) {
if( rln->ReplicateNode() == mn ) {
return rln;
retrln = rln;
break;
}
rln = ( ReplicateLinkNode * )rln->NextNode();
}
return 0;
mtxP->unlock();
return retrln;
}
bool ReplicateList::IsOnList( MgrNode * mn ) {
@ -33,28 +37,30 @@ bool ReplicateList::IsOnList( MgrNode * mn ) {
// returns true if it could delete the node
///////////////////////////////////////////////////////////////////////////////
bool ReplicateList::Remove( ReplicateLinkNode * rln ) {
mtxP->lock();
bool retval = false;
ReplicateLinkNode * rnFollow = ( ReplicateLinkNode * )GetHead();
if( !rnFollow || !rln ) {
return false;
} else {
if( rnFollow && rln ) {
if( rnFollow == rln ) {
head = rln->NextNode();
delete rln;
return true;
retval = true;
} else {
ReplicateLinkNode * rn = ( ReplicateLinkNode * )rnFollow->NextNode();
while( rn ) {
if( rn == rln ) {
rnFollow->next = ( SingleLinkNode * )rln->NextNode();
delete rln;
return true;
retval = true;
break;
}
rnFollow = rn;
rn = ( ReplicateLinkNode * )rn->NextNode();
} // end while(rn)
} // end else
} // end else
return false;
mtxP->unlock();
return retval;
}
bool ReplicateList::Remove( MgrNode * rn ) {
@ -73,9 +79,11 @@ CmdMgr::CmdMgr() {
}
void CmdMgr::ReplicateCmdList( MgrNode * mn ) {
replicateList->mtxP->lock(); // To prevent double appending of mn
if( !( replicateList->IsOnList( mn ) ) ) {
replicateList->AddNode( mn );
}
replicateList->mtxP->unlock();
}
void CmdMgr::ClearInstances() {

View file

@ -6,6 +6,9 @@ set( clLazyFile_SRCS
p21HeaderSectionReader.cc
sectionReader.cc
lazyP21DataSectionReader.cc
../base/judy/src/judy.c
../base/judy/src/judyLArray.h
../base/judy/src/judySArray.h
)
set( SC_CLLAZYFILE_HDRS
@ -30,11 +33,26 @@ include_directories(
${SC_SOURCE_DIR}/src/base/judy/src
)
SC_ADDLIB(steplazyfile "${clLazyFile_SRCS};${clLazyFile_HDRS}" "stepcore;stepdai;steputils;base;stepeditor")
SC_ADDEXEC(lazy_test "lazy_test.cc" "steplazyfile;stepeditor" NO_INSTALL)
set_property(TARGET lazy_test APPEND PROPERTY COMPILE_DEFINITIONS "NO_REGISTRY")
SC_ADDLIB(steplazyfile "${clLazyFile_SRCS};${clLazyFile_HDRS}" "stepcore;stepdai;steputils;base;")
if(HAVE_STD_THREAD)
list(APPEND CMAKE_CXX_FLAGS "-pthread -std=c++0x")
set_target_properties(steplazyfile PROPERTIES COMPILE_FLAGS "-pthread -std=c++0x -DHAVE_STD_THREAD" )
#Directory frim which lazy_thread_safety_test will get its schema.h
include_directories(
${CMAKE_BINARY_DIR}/schemas/sdai_cd209
)
SC_ADDEXEC(lazy_thread_safety_test "lazy_thread_safety_test.cc" "steplazyfile;stepeditor" )
set_target_properties(lazy_thread_safety_test PROPERTIES COMPILE_FLAGS "-pthread -std=c++0x -DHAVE_STD_THREAD -DNO_REGISTRY")
target_link_libraries(lazy_thread_safety_test sdai_cd209 "pthread" ) #sdai_cd209 in causes schema dependency
endif(HAVE_STD_THREAD)
SC_ADDEXEC(lazy_test "lazy_test.cc" "steplazyfile;stepeditor" )
set_target_properties(lazy_test PROPERTIES COMPILE_FLAGS "-DNO_REGISTRY" )
if(TARGET lazy_test-static)
set_property(TARGET lazy_test-static APPEND PROPERTY COMPILE_DEFINITIONS "NO_REGISTRY")
set_target_properties(lazy_test-static PROPERTIES COMPILE_FLAGS "-DNO_REGISTRY" )
endif(TARGET lazy_test-static)
install(FILES ${SC_CLLAZYFILE_HDRS}

View file

@ -27,7 +27,7 @@ class SC_LAZYFILE_EXPORT headerSectionReader: public sectionReader {
return _headerInstances;
}
virtual ~headerSectionReader() {
~headerSectionReader() {
//FIXME delete each instance?! maybe add to clear, since it iterates over everything already
//enum clearHow { rawData, deletePointers }
_headerInstances->clear();

View file

@ -1,11 +1,12 @@
#ifndef INSTMGRHELPER_H
#define INSTMGRHELPER_H
#include <sc_export.h>
#include <mgrnode.h>
#include <lazyInstMgr.h>
#include <instmgr.h>
#include <lazyTypes.h>
#include <sc_mutex.h>
#include <sc_thread.h>
/**
* \file instMgrHelper.h helper classes for the lazyInstMgr. Allows use of SDAI_Application_instance class
@ -17,7 +18,7 @@
* This class is used when creating SDAI_Application_instance's and using a lazyInstMgr. It is returned
* by instMgrAdapter. SDAI_Application_instance only uses the GetSTEPentity function.
*/
class SC_LAZYFILE_EXPORT mgrNodeHelper: public MgrNodeBase {
class mgrNodeHelper: protected MgrNode {
protected:
lazyInstMgr * _lim;
instanceID _id;
@ -25,14 +26,20 @@ class SC_LAZYFILE_EXPORT mgrNodeHelper: public MgrNodeBase {
mgrNodeHelper( lazyInstMgr * lim ) {
_lim = lim;
_id = 0;
prev = next = 0;
}
inline void setInstance( instanceID id ) {
_id = id;
}
inline SDAI_Application_instance * GetSTEPentity() {
return _lim->loadInstance( _id, true );
// unsigned int c = _lim->countDataSections();
return _lim->loadInstance( _id );
}
///Thread safe counterpart of GetSTEPentity()
inline SDAI_Application_instance * GetSTEPentitySafely() {
return _lim->loadInstanceSafely( _id );
}
};
@ -43,17 +50,60 @@ class SC_LAZYFILE_EXPORT mgrNodeHelper: public MgrNodeBase {
* 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 {
class instMgrAdapter: public InstMgr {
protected:
mgrNodeHelper _mn;
mgrNodeHelper _mn; //Used in single threaded operations
lazyInstMgr * _lim; //Used in multi threaded operations
//map between threadID and the thread's local copy of mgrNodeHelper. Each thread has zero or one copy
//of mgrNodeHelper assigned to it. This _map holds the pointer to that mgrNodeHelper.
idNodeMap_t _map;
sc_mutex _mapMtx;
public:
instMgrAdapter( lazyInstMgr * lim ): InstMgrBase(), _mn( lim ) {}
instMgrAdapter( lazyInstMgr * lim ): InstMgr( 0 ), _mn( lim ) {
_lim = lim;
_map.clear();
}
//In case of multiple threads an explicit destructor is needed to free each threads mgrNodeHelper copy
~instMgrAdapter() {
if( _map.empty() ) {
return;
}
for( idNodeMap_t::iterator it = _map.begin(); it != _map.end(); it++ ) {
delete it->second;
}
}
inline mgrNodeHelper * FindFileId( int fileId ) {
//TODO check if fileId exists. if not, return null
_mn.setInstance( fileId );
return &_mn;
}
///Thread-safe counterpart of FindFileId( fileId ). It protects the state of mgrNodeHelper.
inline mgrNodeHelper * FindFileIdSafely( int fileId ) {
mgrNodeHelper * _myMN;
thread_id_t tid = sc_thread::getthread_id();
_mapMtx.lock();
idNodeMap_t::iterator it = _map.find( tid );
if( it == _map.end() ) {
//thread local copy yet not made. Hence create its copy.
_myMN = new mgrNodeHelper( _lim );
_map.insert( idNodePair_t( tid, _myMN ) );
} else {
//reuse the already existing copy.
_myMN = it->second;
}
_mapMtx.unlock();
_myMN->setInstance( fileId );
return _myMN;
}
};

View file

@ -13,7 +13,7 @@
* \sa lazyP21DataSectionReader
* \sa lazyP28DataSectionReader
*/
class SC_LAZYFILE_EXPORT lazyDataSectionReader: public sectionReader {
class lazyDataSectionReader: public sectionReader {
protected:
bool _error, _completelyLoaded;
std::string _sectionIdentifier;

View file

@ -11,13 +11,14 @@ void lazyFileReader::initP21() {
for( ;; ) {
lazyDataSectionReader * r;
r = new lazyP21DataSectionReader( this, _file, _file.tellg(), _parent->countDataSections() );
sectionID sid = _parent->reserveDataSection();
r = new lazyP21DataSectionReader( this, _file, _file.tellg(), sid );
if( !r->success() ) {
delete r; //last read attempt failed
std::cerr << "Corrupted data section" << std::endl;
break;
}
_parent->registerDataSection( r );
_parent->registerDataSection( r, sid );
//check for new data section (DATA) or end of file (END-ISO-10303-21;)
while( isspace( _file.peek() ) && _file.good() ) {
@ -50,7 +51,7 @@ instancesLoaded_t * lazyFileReader::getHeaderInstances() {
}
lazyFileReader::lazyFileReader( std::string fname, lazyInstMgr * i, fileID fid ): _fileName( fname ), _parent( i ), _fileID( fid ) {
_file.open( _fileName.c_str(), std::ios::binary );
_file.open( _fileName.c_str() );
_file.imbue( std::locale::classic() );
_file.unsetf( std::ios_base::skipws );
assert( _file.is_open() && _file.good() );

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