Commit Graph

88 Commits

Author SHA1 Message Date
Zoltan Somogyi
47e867b5e0 Delete redundant module qualifiers. 2023-02-21 00:40:31 +11:00
Julien Fischer
e7d28ff90f Update copyright notices in stdlib.
library/*.m:
    As above.
2022-06-07 21:51:03 +10:00
Zoltan Somogyi
0d7c8a7654 Specify pred or func for all pragmas.
*/*.m:
    As above.

configure.ac:
    Require the installed compiler to support this capability.
2021-06-16 15:23:58 +10:00
Peter Wang
0d3fcbaae3 Delete Erlang code from library/mdbcomp/browser directories.
library/*.m:
    Delete Erlang foreign code and foreign types.

    Delete documentation specific to Erlang targets.

library/deconstruct.m:
    Add pragma no_determinism_warning to allow functor_number_cc/3
    to compile for now.

library/Mercury.options:
    Delete workaround only needed when targetting Erlang.

browser/listing.m:
mdbcomp/rtti_access.m:
    Delete Erlang foreign code and foreign types.
2020-10-28 14:10:56 +11:00
Zoltan Somogyi
85f20002c5 Move the domain_error type to exception.m.
library/math.m:
library/exception.m:
    Move the domain_error type from math.m to exception.m.

NEWS:
    Announce the change as a potentially breaking change.

deep_profiler/query.m:
library/float.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/integer.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
    Replace all references to math.domain_error with just domain_error.
    Delete imports of math.m where this was the only reason for the import.
2020-05-01 18:57:43 +10:00
Zoltan Somogyi
a39e8adea1 Add a missing foreign_import_module.
library/math.m:
    Since code in math.m uses C macros defined in a foreign_decl in float.m,
    math.m needs a foreign_import_module for float, but it did not have one.
    This caused compilation of math.c to math.o to fail *except* with
    intermodule optimization, which gave math.m the required access to
    float.m's internals anyway. The reason we didn't notice is that
    intermodule optimization is the default.
2020-02-27 18:12:32 +11:00
Peter Wang
864a23ee91 Use conventional formatting.
library/float.m:
library/math.m:
    As above.
2020-01-08 17:01:46 +11:00
AlaskanEmily
fcdaa69680 Use function-like macros for the float/double verisons of the math.h functions
library/float.m:
library/math.m:
    As above.
2020-01-08 17:00:53 +11:00
AlaskanEmily
bf7aaef2b2 Use float versions of math.h functions when MR_USE_SINGLE_PREC_FLOAT is defined
library/float.m:
library/math.m:
    As above.
2020-01-08 17:00:53 +11:00
Julien Fischer
d823ae860a Add a note about FusedMultiplyAdd in .NET core 3.0.
library/math.m:
    As above.
2019-10-14 16:46:14 +11:00
Zoltan Somogyi
c7f8ebbe2f Avoid warnings from --warn-non-contiguous-{clauses,foreign-procs}.
browser/collect_lib.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
compiler/make.util.m:
compiler/pickle.m:
compiler/process_util.m:
compiler/prog_event.m:
library/array.m:
library/benchmarking.m:
library/bit_buffer.m:
library/builtin.m:
library/char.m:
library/deconstruct.m:
library/dir.m:
library/erlang_rtti_implementation.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/io.m:
library/math.m:
library/mutvar.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.format.m:
library/string.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
ssdb/ssdb.m:
    As above. This mostly involved two things.

    The first was grouping foreign_procs by predicate instead of by language.
    In a few cases, this revealed that some predicates *had* no foreign_proc
    for a language, while related predicates did have one that just aborted
    if called. This diff adds similar aborting foreign_procs to predicate/
    language combinations that were missing them, when this seemed obviously
    the right thing to do.

    The second was moving pragmas about a predicate from the middle of the
    block of clauses of that predicate to the start of that block.
2018-10-19 11:01:33 +11:00
Julien Fischer
74cc14425f Fix the behaviour of math.round/1 in the Java grade.
library/math.m:
    Implement the documented behaviour for infinities with
    math.round/1 in the Java grade.
2018-09-06 13:11:19 +00:00
Julien Fischer
ada4e79bdc Document how "next integer" operations handle infinite values.
Fix a test case failure in spf grades.

library/math.m:
     Document how the "next integer" operations handle arguments of infinite
     magnitude.

tests/general/float_test.m:
    s/ceil/ceiling/ in a spot.

    Test next integer operations with +/-infinity (and zero).

    In the erlang grades, avoid running parts of these tests that
    rely on library functionality that is NYI.

    Document what the expected outputs correspond to.

tests/general/float_test.exp:
    Update this expected output.

tests/general/float_test.exp2:
    Replace the contents of this file: previously it contained output for
    some ancient version of MSVC; it now contains the spf version of the
    output.

tests/general/float_test.exp3:
    A new expected output for the erlang grades.
2018-09-05 02:19:01 +00:00
Zoltan Somogyi
a12692a0de Replace /* */ comments with // in the library.
Keep the old style comments where they do not go to the end of the line,
or where it is important that the comment line not have a // on it.
2018-06-21 18:55:08 +02:00
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00
Julien Fischer
e514b2d79c Add note about fused multiply-add in Java.
library/math.m:
     As above.
2018-01-03 21:52:22 -05:00
Julien Fischer
4e00d4e9fc Use Java's log10 method.
library/math.m:
    Implement unchecked_log10/1 using Java's Math.log10 method.
    (Which has been available since Java 1.5.)
2017-11-09 23:49:27 -05:00
Julien Fischer
24579e4f73 Minor cleanup for the math module.
library/math.m:
    Remove more unnecessary module qualification.

    Add missing "will_not_call_mercury" attributes to foreign_procs.

    Fix spacing in header comment.

    Update the copyright notice.
2017-11-09 23:41:48 -05:00
Zoltan Somogyi
22eefb3c88 Shut up determinism warnings for "sorry" fallback clauses.
Many predicates that do their jobs via foreign_procs in C have a fallback
Mercury clause for non-C backends, which usually throws an exception.
When compiled in non-C grades, these often get a warning that their
determinism declaration could have been tigther, e.g. erroneous instead of det.

*.m:
    Add no_determinism_warnings pragmas before such fallback clauses.

library/dir.m:
    As above, but also remove the unnecessary "dir." prefix on many predicate
    declarations and clause heads.
2017-08-10 18:02:42 +02:00
Julien Fischer
46bfc2e549 Do not module qualify clause heads in library modules.
library/*.m:
    As above.

library/tree234.m:
    Fix spelling.

    Use spaces instead of tabs in some spots.
2016-08-10 11:55:55 +10:00
Zoltan Somogyi
44f9f1f405 Convert (C->T;E) to (if C then T else E). 2015-12-01 07:58:07 +11:00
Julien Fischer
bed96b93ff Avoid module qualification in library interfaces where possible.
NOTE: this change does not affect the io module -- I've left that for a
separate change.

library/*.m:
	As per the recent change to the coding standard, avoid module
	qualification in library interfaces where possible.

	Reformat declarations and descriptive comments to better utilise
	any space freed up by the above.
2014-10-10 15:08:24 +11:00
Julien Fischer
fb35005cde Add the fused multiply-add operation to the math module.
Support the fused multiply-add operation in C grades, where the underlying math
library provides it.  Add a predicate that allows program to test for the
presence of this operation.
(The non-C target languages do not currently provide this operation.)

library/math.m:
	Add the function fma/3.

	Add the predicate have_fma/0 which can be used to test for the
	presence of fma operation in the current grade / platform.

configure.ac:
runtime/mercury_conf.h.in:
	Check whether the C99 fma() function is available.

NEWS:
	Announce the above.
2014-07-21 15:04:26 +10:00
Julien Fischer
2aaf347ede Define sinh, cosh and tanh as foreign_procs in Java grade.
Use foreign_procs to define the hyperbolic operations in the Java grade.
Java has provided these since version 1.5 and since that is the minimum
version required by Mercury we can rely on them being present.

library/math.m:
	As above.
2014-06-25 17:27:15 +10:00
Julien Fischer
0e34ca9e9c Fix a typo.
Branches: main

library/math.m:
	Fix a typo.
2012-03-05 02:01:32 +00:00
Julien Fischer
79b885cc6b Add unchecked versions of all the operations in this module
Branches: main

library/math.m:
	Add unchecked versions of all the operations in this module
	that don't already have them.

	Delete the stuff in the header comment about
	ML_OMIT_MATH_DOMAIN_CHECKS; with the unchecked versions
	available recompiling the library to omit the domain
	checks is no longer necessary.

NEWS:
	Announce the above additions.
2012-03-04 15:01:03 +00:00
Julien Fischer
913b6bab86 Add an unchecked version of math.sqrt/1 to the library.
Branches: main, 11.07

Add an unchecked version of math.sqrt/1 to the library.

library/math.m:
	Add unchecked_sqrt/1.

NEWS:
	Announce the addition.
2011-11-30 03:12:54 +00:00
Peter Wang
c053f90088 Allow inlining of Java foreign_procs.
Branches: main, 10.04

Allow inlining of Java foreign_procs.

This revealed a problem with directly using the `succeeded' flag directly as
the success indicator in Java foreign_procs.  When the code of the foreign_proc
becomes a nested function, and after nested functions are eliminated, there may
not be a variable called `succeeded' in that context; it is moved into
environment struct, and the transformation is not able to update handwritten
code to reflect that.  The solution is to declare a local variable for the
foreign_proc, let the handwritten code assign that, then assign its final
value to the `succeeded' flag with an MLDS statement.

We take the opportunity to name the local variable `SUCCESS_INDICATOR', in
line with other backends.

compiler/inlining.m:
        Allow inlining of Java foreign_procs.

compiler/ml_foreign_proc_gen.m:
        In the code generated for semidet Java foreign_procs, declare a local
        `SUCCESS_INDICATOR' variable and assign its value to the `succeeded'
        flag afterwards.

        Add braces to give the foreign_proc variables a limited scope.

compiler/make_hlds_warn.m:
        Conform to renaming.

doc/reference_manual.texi:
        Update documentation for the renaming of the `succeeded' variable.

library/array.m:
library/bitmap.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/dir.m:
library/exception.m:
library/float.m:
library/int.m:
library/io.m:
library/math.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/string.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/version_array.m:
        Conform to renaming.

        Fix problems with Java foreign_procs that may now be copied into other
        modules when intermodule optimisation is enabled, some by disallowing
        the procedures from being duplicated, some by making referenced
        classes/fields `public'.

        [Some of the `may_not_duplicate' attributes may not indicate actual
        problems, just that it seems not worthwhile inlining calls to the
        procedure.]

extras/solver_types/library/any_array.m:
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/external_unification_pred.m:
tests/hard_coded/java_test.m:
tests/hard_coded/redoip_clobber.m:
tests/hard_coded/user_compare.m:
tests/valid/exported_foreign_type2.m:
tests/warnings/warn_succ_ind.m:
tests/warnings/warn_succ_ind.exp3:
        Conform to renaming.
2010-05-07 03:12:27 +00:00
Peter Wang
dd53891e9f Assorted library fixes and stubs for the Java backend.
Branches: main

java/runtime/ForeignEnumFunctorDesc.java:
java/runtime/TypeCtorInfo_Struct.java:
java/runtime/TypeFunctors.java:
library/backjump.m:
library/builtin.m:
library/io.m:
library/math.m:
library/mutvar.m:
library/par_builtin.m:
library/private_builtin.m:
library/region_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.m:
library/thread.semaphore.m:
library/time.m:
library/type_desc.m:
        Assorted library fixes and stubs for the Java backend.
2009-04-22 03:03:17 +00:00
Peter Wang
8fb83bcfb1 Fix incorrect result type on new_buffer_2.
Estimated hours taken: 0.2
Branches: main

library/bit_buffer.m:
	Fix incorrect result type on new_buffer_2.

library/math.m:
	Fix Erlang implementation of math.round/1.

library/profiling_builtin.m:
library/table_builtin.m:
	Add Erlang stubs for :- external procedures for deep profiling and
	tabling.
2007-05-31 03:03:37 +00:00
Peter Ross
e3f8bbf9aa Implement the TypeCtorInfo RTTI so that generic compare
Estimated hours taken: 16
Branches: main

Implement the TypeCtorInfo RTTI so that generic compare
and unify work via rtti_implementation.

However after discussion with zs, this current design of
RTTI has to be adapted to become more erlang specific, due
to the different data representation on the erlang backend.
The current code will serve as a template for this new design
though, which is why it is being checked in.

Add various erlang library implementations which are
needed to run useful programs when testing the erlang backend.

compiler/elds.m:
	Add a type_info_id.

compiler/elds_to_erlang.m:
	We now generate type_ctor_info's so call them.

compiler/erl_rtti.m:
	After discussions with zs, type_info and pseudo_type_infos
	should never occur on the erlang backend as they are needed
	for gc and the debugger so throw an exception for them.
	Add an implementation of creating a static type_info, but which
	isn't used in case we need it again later.
	Create type_ctor_info with all the fields except the
	TypeFunctors, the TypeLayout and the FunctorNumberMap

compiler/special_pred.m:
	Make sure we generate RTTI for the builtin types.

library/builtin.m:
library/char.m:
library/exception.m:
library/float.m:
library/int.m:
library/io.m:
library/lexer.m:
library/math.m:
library/mutvar.m:
library/ops.m:
library/par_builtin.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/solutions.m:
library/store.m:
library/string.m:
library/table_builtin.m:
library/thread.semaphore.m:
library/time.m:
library/type_desc.m:
	Erlang implementations of std library functions.
2007-05-30 08:16:09 +00:00
Zoltan Somogyi
7b7dabb89a Extend this optimization to handle temporaries being both defined in
Estimated hours taken: 12
Branches: main

compiler/use_local_vars.m:
	Extend this optimization to handle temporaries being both defined in
	and used by foreign_proc_code instructions. This should eliminate
	unnecessary accesses to the MR_fake_reg array, and thus speed up
	programs that use foreign code a lot, including typeclass- and
	tabling-intensive programs, since those features are implemented using
	inline foreign code. I/O intensive should also benefit, but not much,
	since the cost of the I/O itself overwhelms the cost of the
	MR_fake_reg accesses.

	Group together the LLDS instructions that are handled similarly.
	Factor out some common code.

compiler/opt_util.m:
	Allow for the fact that foreign_proc_codes can now refer to
	temporaries.

compiler/opt_debug.m:
	Print more useful information about foreign_proc_code components.

compiler/prog_data.m:
	Rename the types and function symbols of the recently added
	foreign_proc attributes to avoid clashing with the keywords
	representing them in source code.

	Add a new foreign_proc attribute, proc_may_duplicate that governs
	whether the body of foreign code is allowed to be duplicated.

compiler/table_gen.m:
	Include does_not_affect_liveness among the annotations for the
	foreign_proc calls generated by this module. Some of these procedures
	affect memory beyond their arguments, but that memory is in tables,
	not in unlisted registers.

	Allow some of the smaller code fragments generated by this module
	to be duplicated.

compiler/inlining.m:
	Respect the may_not_duplicate foreign_proc attribute.

compiler/pragma_c_gen.m:
	Transmit any annotations about liveness from the HLDS to the LLDS,
	since without does_not_affect_liveness annotations use_local_vars.m
	cannot optimize foreign_proc_codes.

	Transmit any annotations about may_duplicate from the HLDS to the LLDS,
	since with them jumpopt can do a better job.

compiler/llds.m:
	Use the new foreign_proc attribute instead of a boolean to represent
	whether a foreign code fragment may be duplicated.

compiler/simplify.m:
	Generate an error message if a may_duplicate or may_not_duplicate
	attribute on a foreign_proc conflicts with a no_inline or inline pragma
	(respectively) on the predicate it belongs to.

compiler/hlds_pred.m:
	Fix some comment rot.

compiler/jumpopt.m:
compiler/livemap.m:
compiler/proc_gen.m:
compiler/trace_gen.m:
	Conform to the changes above.

doc/reference_manual.texi:
	Document the new foreign_proc attribute.

library/array.m:
library/builtin.m:
library/char.m:
library/dir.m:
library/float.m:
library/int.m:
library/io.m:
library/lexer.m:
library/math.m:
library/private_builtin.m:
library/string.m:
library/version_array.m:
	Add does_not_affect_liveness annotations to the C foreign_procs that
	deserve them.

configure.in:
	Require the installed compiler to support does_not_affect_liveness.

tests/invalid/test_may_duplicate.{m,err_exp}:
	Add a new test case to test the error checking code in simplify.m.

tests/invalid/Mmakefile:
	Enable the new test case.
2007-01-15 02:24:04 +00:00
Zoltan Somogyi
c06e22e3ba Instead of printing each error message immediately, pass them back to
Estimated hours taken: 1
Branches: main

compiler/table_gen.m:
compiler/unused_args.m:
	Instead of printing each error message immediately, pass them back to
	mercury_compile.m to print them all at once.

compiler/mercury_compile.m:
	Do the printing.

compiler/hlds_goal.m:
compiler/inst_graph.m:
library/float.m:
library/int.m:
library/math.m:
	Rename some predicates to avoid ambiguity.

compiler/*.m:
	Conform to the changes above.
2006-12-27 03:18:04 +00:00
Julien Fischer
e0f5ac47db Make it easier for vi to jump past the initial comments
Estimated hours taken: 0.1
Branches: main

library/*.m:
	Make it easier for vi to jump past the initial comments
	at the head of a module.
2006-04-19 05:18:00 +00:00
Julien Fischer
5e92224eec Improve the library reference manual by formatting the beginning of
Estimated hours taken: 0.2
Branches: main, release

library/*.m:
	Improve the library reference manual by formatting the beginning of
	library modules consistently.

library/integer.m:
	Fix some bad indentation.
2006-04-13 06:08:05 +00:00
Zoltan Somogyi
b293bd999d Replace __ with . as the module qualifier everywhere.
Estimated hours taken: 1
Branches: main

library/*.m:
	Replace __ with . as the module qualifier everywhere.

tests/hard_coded/test_injection.exp:
	Replace __ with . as the module qualifier in expected exceptions.
2006-03-07 22:23:58 +00:00
Julien Fischer
7a8681f774 Annotate foreign_procs with trail usage information throughout most of
Estimated hours taken: 0.5
Branches: main

library/*.m:
	Annotate foreign_procs with trail usage information throughout most of
	the standard library.

	Fix an out of date comment in string.m.

	Fix some minor formatting problems.
2005-12-14 10:33:56 +00:00
Zoltan Somogyi
57b8f436eb Convert to four-space indentation most of the library modules that
Estimated hours taken: 4
Branches: main

library/*.m:
	Convert to four-space indentation most of the library modules that
	weren't already indented that way. Use predmode syntax where possible.
	In some modules, shorten long lines by deleting module name prefixes.
	Fix departures from our coding standards.

	In some modules, simplify code, mostly using field names and/or state
	variables.

	There are no changes in algorithms, except for neg_list in integer.m.
2005-10-17 11:35:22 +00:00
Zoltan Somogyi
88c7539230 Import only one module per line, as we already do in the compiler
Estimated hours taken: 0.3
Branches: main

library/*.m:
	Import only one module per line, as we already do in the compiler
	directory.
2005-06-16 04:08:07 +00:00
Ralph Becket
d0bd460b8f Minor reformatting; added some renamed preds and funcs to improve
Estimated hours taken: 3
Branches: main, version-0_12-branch

library/array.m:
library/array2d.m:
library/assoc_list.m:
library/bag.m:
library/benchmarking.m:
library/bimap.m:
library/bintree_set.m:
library/bitmap.m:
library/bool.m:
library/builtin.m:
library/cord.m:
library/float.m:
library/graph.m:
library/group.m:
library/hash_table.m:
library/int.m:
library/lexer.m:
library/list.m:
library/map.m:
library/math.m:
library/multi_map.m:
library/ops.m:
library/parser.m:
library/rbtree.m:
library/set.m:
library/stack.m:
library/store.m:
library/string.m:
library/time.m:
	Minor reformatting; added some renamed preds and funcs to improve
	consistency of naming in the library; removed some preds and types that
	have been marked obsolete since 0.11.
2005-02-02 04:28:50 +00:00
Zoltan Somogyi
6909674f14 Bring these modules up to date with our current style guidelines.
Estimated hours taken: 8
Branches: main

library/*.m:
	Bring these modules up to date with our current style guidelines.
	Use predmode declarations where appropriate. Use state variable syntax
	where appropriate. Reorder arguments where this makes it possible to
	to use state variable syntax. Standardize format of predicate
	description comments. Standardize indentation.
2004-03-15 23:49:36 +00:00
James Goddard
e62c7da10c Bug fix for math library.
Estimated hours taken: 0.25
Branches: main

Bug fix for math library.

library/math.m:
	Changed the order of the parameters for the mercury implementation of
		math__log_2/2

	The old version is incorrect with respect to the library documentation.
	'math__log(B, X) = Log' is supposed to return Log as the logarithm to
	base B of X.  After doing domain checks, this predicate calls
	math__log_2(B, X), which is defined correctly for the C and C#
	implementations, but had the parameters the wrong way around for the
	(default) mercury implementation, so it in fact returned Log as the
	logarithm to base X of B (in other words the reciprocal of what was
	intended).
2003-12-11 03:05:39 +00:00
James Goddard
2236f4c991 Implement some library procedures for the Java back-end.
Estimated hours taken: 4
Branches: main

Implement some library procedures for the Java back-end.
Tested with a modified form of /tests/general/float_test (had to take out some
	tests involving predicates from string and float which are not
	yet implemented)

library/math.m:
	Added the ML_FLOAT_LN2 constant for Java:
	Implement the following predicates for Java:
		domain_checks/0
		math__pi/1
		math__e/1
		math__ceiling/2
		math__floor/2
		math__round/2
		math__sqrt_2/2
		math__pow_2/3
		math__exp/2     <-- also fixed a typo here
		math__ln_2/2
		math__log2_2/2
		math__sin/2
		math__cos/2
		math__tan/2
		math__asin_2/2
		math__acos_2/2
		math__atan/2
		math__atan2/3
	Implement the following predicates in Mercury:
		math__sinh/2
		math__cosh/2
		math__tanh/2
2003-12-10 04:35:23 +00:00
Peter Ross
d28ac0ec53 Begin porting the the library just to use C# as its foreign_proc
Estimated hours taken: 2
Branches: main

Begin porting the the library just to use C# as its foreign_proc
language.

library/array.m:
library/char.m:
library/exception.m:
library/float.m:
library/int.m:
library/math.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/std_util.m:
	Trivial changes to convert MC++ to C#.

library/table_builtin.m:
	Delete some unused MC++ functions.
2003-11-07 16:51:36 +00:00
Julien Fischer
0361ac54fa Fix some spelling errors in documentation/comments.
Estimated hours taken: 0.1
Branches: main

library/array.m:
library/bt_array.m:
library/io.m:
library/math.m:
library/store.m:
	Fix some spelling errors in documentation/comments.
2003-08-28 06:56:51 +00:00
Fergus Henderson
8e9c813e37 Various fixes to make the Java back-end work better.
Estimated hours taken: 24
Branches: main

Various fixes to make the Java back-end work better.

compiler/ml_code_gen.m:
	Make sure that no module in the generated MLDS
	tries to import itself.

	Also, add some XXX comments about the handling of
	model_semi foreign_procs for Java and IL.

compiler/ml_code_util.m:
	Fix a bug with the handling of `top_unused' modes with `--det-copy-out'.

compiler/mlds_to_java.m:
	Add an XXX comment about the problem with type names clashing
	with constructor names.
	Add an XXX comment about ignoring `pragma foreign_import'
	and `pragma export' for Java.

	Fix the code so that we handle `foreign_decl' and `foreign_code'
	for Java properly -- previously, we were generating code for
	`foreign_decl' in the wrong place, and `foreign_code' was just
	ignored.

	Handle procedures defined as `external' by calling `extern_Foo',
	rather than generating a declaration with no body, because
	Java syntax doesn't allow that.

	Fix a bug where some names weren't getting mangled properly.

	Fix some bugs where it was not generating correct package
	names or module qualifiers for modules in the Mercury
	standard library.

library/Mmakefile:
	Add support for the `java' grade.
	This involved adding new targets `javas' and `classes',
	and making the main `library' target depend on these if
	the grade is `java'.

library/builtin.m:
	Add (stub) Java implementations of various builtins:
	- the type_ctor_infos for the builtin types int, string, character
	- builtin.unify/2 and builtin.compare/3
library/private_builtin.m:
	Add (stub) Java implementations of various builtins:
	- the type_ctor_info for private_builtin.type_info/1
	- builtin_compare_int/3, builtin_compare_string/3,
	  builtin_strcmp/3

library/math.m:
	- Fix a couple of bugs in the Mercury code for "log" and "log2".

library/std_util.m:
	Provide a Java implementation for cc_multi_equal/2.
	Avoid a compiler warning for the Mercury implementation
	of semidet_succeed and semidet_fail.

library/store.m:
	Rename the constructor for the `store/1' type,
	to work around a bug in the Java back-end.

library/string.m:
	Fix bugs in the Mercury implementation of string__contains_char
	and string__split.
	Provide a Java implementation of string__length.

library/type_desc.m:
	Provide Java implementations of type_of/1 and has_type/2.
	Provide (stub) implementations of the builtin types type_desc/0
	and type_ctor_desc/0.
2003-05-14 14:38:48 +00:00
Fergus Henderson
9338352410 Delete Mercury clauses that just call sorry/1.
Estimated hours taken: 4
Branches: main

library/*.m:
	Delete Mercury clauses that just call sorry/1.
	I applied this change to all files except the following:
	rtti_implementation.m (because in that case, there is no C
	implementation) and profiling_builtin.m and table_builtin.m
	(because new back-ends needn't support profiling or tabling;
	the warnings with `--warn-stubs' for those would be just noise.)

library/array.m:
	Provide C# code for the (in, array_uo) mode of array__copy/2,
	by copying the code for the (array_ui, array_uo) mode.

library/math.m:
	Provide Mercury implementations of some of the math functions.
2003-02-22 11:17:36 +00:00
Peter Ross
5f118f4a81 The tag bootstrap_20020613_intermod can be used to get a compiler which
Estimated hours taken: 20
Branches: main

The tag bootstrap_20020613_intermod can be used to get a compiler which
compiles this change.

configure.in:
	Test that the option --bug-intermod-2002-06-13 exists.  This signifies
	that the a bug in intermodule optimization for predicates which are
	defined as both mercury and foreign code clauses.

library/array.m:
library/benchmarking.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/deconstruct.m:
library/float.m:
library/gc.m:
library/int.m:
library/io.m:
library/library.m:
library/math.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/sparse_bitset.m:
library/std_util.m:
library/store.m:
library/table_builtin.m:
library/time.m:
library/type_desc.m:
	Define a mercury version of every pragma foreign_proc.
	Remove any foreign_procs which are not implemented yet.
2002-06-14 10:18:55 +00:00
Simon Taylor
a529a380e2 Back out Pete's unreviewed change from yesterday.
Estimated hours taken: 0.2
Branches: main

library/*.m
	Back out Pete's unreviewed change from yesterday.
	It doesn't compile without a recent bug fix, but no
	CVS tag was added.
2002-06-12 06:46:46 +00:00
Peter Ross
a86cd4342c Define a mercury version of every pragma foreign_proc, and remove any
Estimated hours taken: 16
Branches: main

Define a mercury version of every pragma foreign_proc, and remove any
foreign_procs which just throw an exception that the code is not implemented.

library/array.m:
library/benchmarking.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/deconstruct.m:
library/exception.m:
library/float.m:
library/gc.m:
library/int.m:
library/io.m:
library/library.m:
library/math.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/sparse_bitset.m:
library/std_util.m:
library/store.m:
library/string.m:
library/table_builtin.m:
library/time.m:
library/type_desc.m:
	Define a mercury version of every pragma foreign_proc, and remove any
	foreign_procs which just throw an exception that the code is not
	implemented.
2002-06-11 11:03:19 +00:00