Skip to content

Commit

Permalink
Merge branch 'develop' into feature/276_FixedLengthUtil_param_checking
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnich committed Dec 16, 2015
2 parents 15057c1 + 2f1dcf3 commit 32a093f
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 38 deletions.
8 changes: 4 additions & 4 deletions doxygen/lang/Doxyfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ GENERATE_QHP = YES
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.

QCH_FILE = ../qore_c_lang_reference.qch
QCH_FILE =

# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
Expand All @@ -1087,14 +1087,14 @@ QHP_VIRTUAL_FOLDER = qore-lang
# add. For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters

QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_NAME = Qore Language

# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
# Qt Help Project / Custom Filters</a>.

QHP_CUST_FILTER_ATTRS =
QHP_CUST_FILTER_ATTRS = qore-lang

# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's
Expand All @@ -1109,7 +1109,7 @@ QHP_SECT_FILTER_ATTRS =
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.

QHG_LOCATION = qhelpgenerator
QHG_LOCATION =

# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
# will be generated, which together with the HTML files, form an Eclipse help
Expand Down
10 changes: 5 additions & 5 deletions doxygen/lib/Doxyfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.

PROJECT_NAME = "Qore Programming Language"
PROJECT_NAME = "Qore Programming Language - C/C++ Library"

# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
Expand Down Expand Up @@ -952,7 +952,7 @@ GENERATE_QHP = YES
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.

QCH_FILE = ../qore_c_library_reference.qch
QCH_FILE =

# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
Expand All @@ -970,14 +970,14 @@ QHP_VIRTUAL_FOLDER = qore-c-library
# add. For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters

QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_NAME = Qore C/C++ Development

# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
# Qt Help Project / Custom Filters</a>.

QHP_CUST_FILTER_ATTRS =
QHP_CUST_FILTER_ATTRS = qore-c-development

# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's
Expand All @@ -992,7 +992,7 @@ QHP_SECT_FILTER_ATTRS =
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.

QHG_LOCATION = qhelpgenerator
QHG_LOCATION =

# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
# will be generated, which together with the HTML files, form an Eclipse help
Expand Down
5 changes: 5 additions & 0 deletions doxygen/pdox
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ while [ -n "$1" ]; do
grep -e __[0-9]_ -e zzz "$1"/*.html "$1"/*.js "$1"/*.qhp 2>/dev/null |cut -f1 -d:|uniq|while read a; do
echo processing $a
sed $OPT -e 's/__7_ /*/g' -e 's/"Qore::zzz8([a-z]+)zzz9"/"<\1>"/g' -e 's/>([^<>]*)Qore::zzz8([a-z]+)zzz9([^<>]*)<\//\>\1\&lt;\2\&gt;\3<\//g' -e 's/>([^<>]*)zzz8([a-z]+)zzz9([^<>]*)<\//\>\1\&lt;\2\&gt;\3<\//g' -e 's/for Qore::zzz8([a-z]+)zzz9:/for Qore::\&lt;\1\&gt;:/g' -e "s/'Qore::zzz8([a-z]+)zzz9'/'\&lt;\1\&gt;'/g" -e 's/"zzz8([a-z]+)zzz9"/"<\1>"/g' -e "s/'Qore::zzz8([a-z]+)zzz9::([^']+)\(([^\)]*)\)'/'Qore::\&lt;\1\&gt;::\2(\3)'/g" -e "s/'zzz8([a-z]+)zzz9'/'\1'/g" $a > t; mv t $a
# titles in index.qhp xml tags need some special handlings
if [[ $a == *"index.qhp" ]]
then
sed $OPT -e 's/\"</\"\&lt;/g' -e 's/>\"/\&gt;\"/g' $a > t; mv t $a
fi
done
fi
shift
Expand Down
8 changes: 4 additions & 4 deletions doxygen/qlib/Doxyfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ GENERATE_QHP = YES
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.

QCH_FILE = ../qore_{module}_reference.qch
QCH_FILE =

# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
Expand All @@ -966,14 +966,14 @@ QHP_VIRTUAL_FOLDER = {module}
# add. For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters

QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_NAME = Qore Language

# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
# Qt Help Project / Custom Filters</a>.

QHP_CUST_FILTER_ATTRS =
QHP_CUST_FILTER_ATTRS = qore-lang

# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's
Expand All @@ -988,7 +988,7 @@ QHP_SECT_FILTER_ATTRS =
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.

QHG_LOCATION = qhelpgenerator
QHG_LOCATION =

# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
# will be generated, which together with the HTML files, form an Eclipse help
Expand Down
2 changes: 1 addition & 1 deletion examples/test/qore/operators/unary_plus_minus.qtest
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class UnaryPlusMinusTest inherits QUnit::Test {
assertEq(0-4, -4);
assertEq(0-4.3, -4.3);
assertEq(0-4.1234567890123456789n, -4.1234567890123456789n);
# assertEq(0s-1s, -1s); broken - see issue #243
assertEq(0s-1s, -1s);
assertEq(0, -"string");
assertEq(0, -False);
assertEq(0, -hash());
Expand Down
44 changes: 22 additions & 22 deletions examples/test/qore/threads/thread-resources.qtest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class TR1 inherits AbstractThreadResource {
cleanup() {
throw "TR1";
throw "TR1";
}
}

Expand All @@ -34,7 +34,7 @@ class TRS inherits AbstractThreadResource {

synchronized start() {
cnt.inc();
set_thread_resource(self);
set_thread_resource(self);
on_error {
cnt.dec();
remove_thread_resource(self);
Expand Down Expand Up @@ -76,28 +76,28 @@ class ThreadResourcesTest inherits QUnit::Test {
}

threadResourcesTests() {
TR1 tr1();
TR1 tr1();

set_thread_resource(tr1);
testAssertion("cleanup-1", \throw_thread_resource_exceptions(), NOTHING, new TestResultExceptionType("TR1"));
testAssertionValue("remove-1", remove_thread_resource(tr1), False);
set_thread_resource(tr1);
testAssertion("cleanup-1", \throw_thread_resource_exceptions(), NOTHING, new TestResultExceptionType("TR1"));
testAssertionValue("remove-1", remove_thread_resource(tr1), False);

set_thread_resource(tr1);
mark_thread_resources();
testAssertionValue("cleanup-to-mark-neg-1", throw_thread_resource_exceptions_to_mark(), True);
testAssertionValue("remove-2", remove_thread_resource(tr1), True);
set_thread_resource(tr1);
mark_thread_resources();
testAssertionValue("cleanup-to-mark-neg-1", throw_thread_resource_exceptions_to_mark(), True);
testAssertionValue("remove-2", remove_thread_resource(tr1), True);

mark_thread_resources();
testAssertion("auto-cleanup-1", \doCleanup(), NOTHING, new TestResultExceptionType("TR1"));
mark_thread_resources();
testAssertion("auto-cleanup-1", \doCleanup(), NOTHING, new TestResultExceptionType("TR1"));

testAssertionValue("cleanup-to-mark-neg-2", throw_thread_resource_exceptions_to_mark(), True);
testAssertionValue("cleanup-to-mark-neg-2", throw_thread_resource_exceptions_to_mark(), True);

testAssertion("auto-cleanup-2", \doCleanup(), NOTHING, new TestResultExceptionType("TR1"));
testAssertion("auto-cleanup-2", \doCleanup(), NOTHING, new TestResultExceptionType("TR1"));

# throw_thread_resource_exceptions() here just stops the background thread,
# but since TRS::cleanup() does not throw an exception, neither does throw_thread_resource_exceptions()
# despite the name
TRS trs();
TRS trs();
testNullAssertion("no-exception-1", \throw_thread_resource_exceptions());

our TRS otrs();
Expand Down Expand Up @@ -132,17 +132,17 @@ class ThreadResourcesTest inherits QUnit::Test {
}

threadResourceSandboxingTests() {
Program p(PO_NEW_STYLE | PO_NO_THREAD_CONTROL);
p.importClass("TR1");
Program p(PO_NEW_STYLE | PO_NO_THREAD_CONTROL);
p.importClass("TR1");

# test sandbox violation
testAssertion("sandboxing-1", \p.parse(), ("sub t() {TR1 tr1(); set_thread_resource(tr1);}", "test-1"), new TestResultExceptionRegexp("PARSE-EXCEPTION", "set_thread_resource"));
testAssertion("sandboxing-2", \p.parse(), ("sub t() {TR1 tr1(); remove_thread_resource(tr1);}", "test-2"), new TestResultExceptionRegexp("PARSE-EXCEPTION", "remove_thread_resource"));
# test sandbox violation
testAssertion("sandboxing-1", \p.parse(), ("sub t() {TR1 tr1(); set_thread_resource(tr1);}", "test-1"), new TestResultExceptionRegexp("PARSE-EXCEPTION", "set_thread_resource"));
testAssertion("sandboxing-2", \p.parse(), ("sub t() {TR1 tr1(); remove_thread_resource(tr1);}", "test-2"), new TestResultExceptionRegexp("PARSE-EXCEPTION", "remove_thread_resource"));
}

doCleanup() {
TR1 tr1();
TR1 tr1();

set_thread_resource(tr1);
set_thread_resource(tr1);
}
}
7 changes: 6 additions & 1 deletion qlib/FixedLengthUtil.qm
Original file line number Diff line number Diff line change
Expand Up @@ -681,12 +681,17 @@ public class FixedLengthUtil::FixedLengthAbstractWriter {
- \c "type": a string giving the record type (must be defined in @ref fixedlengthspec given in the constructor)
- \c "record": a hash giving the input record to be rendered (with keys as defined in the @ref fixedlengthspecrecordhash for the record identified by the \a type argument)

@throw INVALID-LINE-DATA line argument missing either \a type or \a record keys
@throw INVALID-RECORD record name (\a type key in the record hash) not recognized
@throw FIELD-INPUT-ERROR the input value is too large to render into the output field
@throw RECORD-TRANSITION-ERROR a record transition error occurred; an invalid record sequence was given in the input data
*/
string formatLine(hash line) {
string type = line{"type"};
if (!line.type)
throw "INVALID-LINE-DATA", sprintf("invalid line data; missing \"type\" key; got keys: %y", line.keys());
if (!line.record)
throw "INVALID-LINE-DATA", sprintf("invalid line data; missing \"record\" key; got keys: %y", line.keys());
string type = line.type;
if (!m_specs{type})
throw "INVALID-RECORD", sprintf("unknown record type %y; valid records: %y", type, m_specs.keys());

Expand Down
9 changes: 8 additions & 1 deletion qlib/FreetdsSqlUtil.qm
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,14 @@ order by

#! processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh) {
throw "UNIMPLEMENTED", "limit not yet implemented";
if (!qh.limit)
return;

# this rule is broken here with reason:
# In a SELECT statement, always use an ORDER BY clause with the TOP clause.
# This is the only way to predictably indicate which rows are affected by TOP
sql = regex_subst(sql, "^select ", sprintf("select top %d ", qh.limit));
args += qh.limit;
}

#! processes a string for use in SQL select statements when there is an "order by" and "offset" argument
Expand Down

0 comments on commit 32a093f

Please sign in to comment.