Dear developers, I have amended CMakeLists and added the samples singleton.cls and usesingleton.rex in the necessary places.
I have also made changes to singleton.cls and usesingleton.rex to make them comply with the other samples, please have a look and check that everything is ok. Here is the commit info, for some reason I can not post to oorexx-svn yet, unclear why (I did subscribe to it twice). If you disagree with the changes please just go ahead und undo them. Hälsningar/Regards/Grüsse, P.O. Jonsson oor...@jonases.se > Anfang der weitergeleiteten Nachricht: > > Von: oorexx-svn-ow...@lists.sourceforge.net > Betreff: SF.net SVN: oorexx-code-0:[12016] main/trunk > Datum: 27. März 2020 um 21:17:56 MEZ > An: perolovjons...@users.sf.net > > Your message has been rejected, probably because you are not > subscribed to the mailing list and the list's policy is to prohibit > non-members from posting to it. If you think that your messages are > being rejected in error, contact the mailing list owner at > oorexx-svn-ow...@lists.sourceforge.net. > > > Von: perolovjons...@users.sf.net > Betreff: SF.net SVN: oorexx-code-0:[12016] main/trunk > Datum: 27. März 2020 um 21:17:54 MEZ > An: oorexx-...@lists.sourceforge.net > > > Revision: 12016 > http://sourceforge.net/p/oorexx/code-0/12016 > Author: perolovjonsson > Date: 2020-03-27 20:17:54 +0000 (Fri, 27 Mar 2020) > Log Message: > ----------- > adding usesingleton.rex and singleton.cls to CMakeLists.txt; adding License > and description info for usesingleton.rex and singleton.cls > > Modified Paths: > -------------- > main/trunk/CMakeLists.txt > main/trunk/samples/singleton.cls > main/trunk/samples/usesingleton.rex > > Modified: main/trunk/CMakeLists.txt > =================================================================== > --- main/trunk/CMakeLists.txt 2020-03-27 19:11:31 UTC (rev 12015) > +++ main/trunk/CMakeLists.txt 2020-03-27 20:17:54 UTC (rev 12016) > @@ -1732,6 +1732,7 @@ > configure_build_file(synchronousConcurrency.rex ${build_samples_dir}) > configure_build_file(treeTraversal.rex ${build_samples_dir}) > configure_build_file(usetree.rex ${build_samples_dir}) > +configure_build_file(usesingleton.rex ${build_samples_dir}) > > add_custom_target(class_files ALL DEPENDS > ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rxregexp.cls > @@ -1801,11 +1802,14 @@ > install(PROGRAMS ${CMAKE_SAMPLES_OUTPUT_DIRECTORY}/synchronousConcurrency.rex > COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}) > install(PROGRAMS ${CMAKE_SAMPLES_OUTPUT_DIRECTORY}/treeTraversal.rex > COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}) > install(PROGRAMS ${CMAKE_SAMPLES_OUTPUT_DIRECTORY}/usetree.rex COMPONENT > Samples DESTINATION ${INSTALL_SAMPLES_DIR}) > +install(PROGRAMS ${CMAKE_SAMPLES_OUTPUT_DIRECTORY}/usesingleton.rex > COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}) > > install(PROGRAMS ${SAMPLES_SOURCE}/complex.cls COMPONENT Samples DESTINATION > ${INSTALL_SAMPLES_DIR}) > install(PROGRAMS ${SAMPLES_SOURCE}/pipe.cls COMPONENT Samples DESTINATION > ${INSTALL_SAMPLES_DIR}) > install(PROGRAMS ${SAMPLES_SOURCE}/semcls.cls COMPONENT Samples DESTINATION > ${INSTALL_SAMPLES_DIR}) > install(PROGRAMS ${SAMPLES_SOURCE}/treeDirectory.cls COMPONENT Samples > DESTINATION ${INSTALL_SAMPLES_DIR}) > +install(PROGRAMS ${SAMPLES_SOURCE}/singleton.cls COMPONENT Samples > DESTINATION ${INSTALL_SAMPLES_DIR}) > + > install(FILES ${SAMPLES_SOURCE}/jabberwocky.txt COMPONENT Samples DESTINATION > ${INSTALL_SAMPLES_DIR}) > > if (NOT WIN32) > > Modified: main/trunk/samples/singleton.cls > =================================================================== > --- main/trunk/samples/singleton.cls 2020-03-27 19:11:31 UTC (rev 12015) > +++ main/trunk/samples/singleton.cls 2020-03-27 20:17:54 UTC (rev 12016) > @@ -1,4 +1,53 @@ > -/* singleton.cls */ > +#!@OOREXX_SHEBANG_PROGRAM@ > +/*----------------------------------------------------------------------------*/ > +/* > */ > +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. > */ > +/* Copyright (c) 2005-2020 Rexx Language Association. All rights reserved. > */ > +/* > */ > +/* This program and the accompanying materials are made available under > */ > +/* the terms of the Common Public License v1.0 which accompanies this > */ > +/* distribution. A copy is also available at the following address: > */ > +/* http://www.oorexx.org/license.html > */ > +/* > */ > +/* 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. > */ > +/* > */ > +/* Neither the name of Rexx Language Association nor the names > */ > +/* of its contributors may 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 > */ > +/* OWNER 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. > */ > +/* > */ > +/*----------------------------------------------------------------------------*/ > +/******************************************************************************/ > +/* Description: > */ > +/* singleton.cls (see also usesingleton.rex) > */ > +/* a singleton class is a class that can have only one object (an instance > */ > +/* of the class) at any point in time. > */ > +/* A singleton class solves problems like: > */ > +/* How can it be ensured that a class has only one instance? > */ > +/* How can the sole instance of a class be accessed easily? > */ > +/* How can a class control its instantiation? > */ > +/* How can the number of instances of a class be restricted? > */ > +/******************************************************************************/ > + > /* define a singleton metaclass; a "metaclass" is always a subclass of > "class" */ > ::class singleton subclass class public > ::method init /* constructor method */ > > Modified: main/trunk/samples/usesingleton.rex > =================================================================== > --- main/trunk/samples/usesingleton.rex 2020-03-27 19:11:31 UTC (rev > 12015) > +++ main/trunk/samples/usesingleton.rex 2020-03-27 20:17:54 UTC (rev > 12016) > @@ -1,8 +1,50 @@ > -/* use_singleton.rex */ > -o1=.singletonExample~new /* create an instance */ > +#!@OOREXX_SHEBANG_PROGRAM@ > +/*----------------------------------------------------------------------------*/ > +/* > */ > +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. > */ > +/* Copyright (c) 2005-2020 Rexx Language Association. All rights reserved. > */ > +/* > */ > +/* This program and the accompanying materials are made available under > */ > +/* the terms of the Common Public License v1.0 which accompanies this > */ > +/* distribution. A copy is also available at the following address: > */ > +/* http://www.oorexx.org/license.html > */ > +/* > */ > +/* 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. > */ > +/* > */ > +/* Neither the name of Rexx Language Association nor the names > */ > +/* of its contributors may 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 > */ > +/* OWNER 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. > */ > +/* > */ > +/*----------------------------------------------------------------------------*/ > +/******************************************************************************/ > +/* Description: > */ > +/* usesingleton.rex demonstrates how to use the singleton class > */ > +/******************************************************************************/ > + > +o1=.singletonExample~new /* create an instance > */ > say "o1~createtime:" o1~createtime "o1~identityHash:" o1~identityHash > > -call syssleep .1 /* make sure 1/10 second passes by */ > +call syssleep .1 /* make sure 1/10 second passes by > */ > o2=.singletonExample~new /* create another instance */ > > say "o2~createtime:" o2~createtime "o2~identityHash:" o2~identityHash > @@ -10,14 +52,14 @@ > > ::requires "singleton.cls" /* get access to the public metaclass singleton > */ > > -/* =================================== */ > +/* > ========================================================================== */ > ::class singletonExample metaclass singleton /* use the singleton metaclass > */ > -/* =================================== */ > +/* > ========================================================================== */ > /* instance methods to verify it works */ > -/* =================================== */ > +/* > ========================================================================== */ > ::attribute createtime > -/* ----------------------------------- */ > -::method init /* constructor method */ > +/* > -------------------------------------------------------------------------- */ > +::method init /* constructor method > */ > expose createTime > createTime=.dateTime~new > say "init running at" createTime "for new object:" self~identityHash > > > >
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel