mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
Branches: main
Put all Mercury-generated Java classes into the package `jmercury' and
runtime classes into `jmercury.runtime'. The Mercury module hierarchy is
not reflected in the package name. We name sub-module classes using
their fully-qualified module names with `__' between components, e.g.
`bit_buffer.read' produces `class bit_buffer__read'.
As all generated Java code is in the same package we don't need to package
qualify identifiers, and we don't need the hack to avoid clashing package
and class names. It also makes it easier to write Java foreign code because
generated Java class names are easier to predict from Mercury module names.
The package names are not `mercury' and `mercury.runtime' because on
case-insensitive file systems we may end up with a `mercury' directory
that could be confused with the `Mercury' directory.
compiler/java_names.m:
Delete code related to mangling package names.
Remove the extra `mercury' prefix added to standard library module
names, as it is redundant with `jmercury'.
Change runtime package name.
compiler/mlds_to_java.m:
Make generated code follow the new packaging scheme.
Don't automatically import all runtime classes. It doesn't seem
necessary.
Update for new packaging scheme.
compiler/file_names.m:
Fix Java file paths for the new packaging scheme.
compiler/module_cmds.m:
compiler/rtti.m:
library/array.m:
library/backjump.m:
library/benchmarking.m:
library/bitmap.m:
library/builtin.m:
library/exception.m:
library/io.m:
library/library.m:
library/mutvar.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.m:
library/time.m:
library/type_desc.m:
java/runtime/*.java:
Rename package names.
Delete unnecessary package qualification.
compiler/mlds.m:
Add some XXXs to be fixed later.
library/Mmakefile:
Update for new packaging scheme.
Let mmake --use-mmc-make work in this directory.
53 lines
1.3 KiB
Java
53 lines
1.3 KiB
Java
//
|
|
// Copyright (C) 2001-2003 The University of Melbourne.
|
|
// This file may only be copied under the terms of the GNU Library General
|
|
// Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
//
|
|
|
|
package jmercury.runtime;
|
|
|
|
public class TypeLayout {
|
|
// This should hold a value of one of the types
|
|
// accessible by the access functions that follow.
|
|
public java.lang.Object layout_init;
|
|
|
|
//
|
|
// In runtime/mercury_type_info.h:
|
|
// typedef MR_DuPtagLayout *MR_DuTypeLayout;
|
|
// so here we just use DuPtagLayout[]
|
|
//
|
|
public DuPtagLayout[] layout_du() {
|
|
return (DuPtagLayout[]) layout_init;
|
|
}
|
|
|
|
//
|
|
// In runtime/mercury_type_info.h:
|
|
// typedef MR_EnumFunctorDesc **EnumTypeLayout;
|
|
// so here we just use EnumFunctorDesc[][]
|
|
//
|
|
public EnumFunctorDesc[] layout_enum() {
|
|
return (EnumFunctorDesc[]) layout_init;
|
|
}
|
|
|
|
//
|
|
// In runtime/mercury_type_info.h:
|
|
// typedef MR_NotagFunctorDesc *MR_NotagTypeLayout;
|
|
// so here we just us NotagFunctorDesc[]
|
|
//
|
|
public NotagFunctorDesc[] layout_notag() {
|
|
return (NotagFunctorDesc[]) layout_init;
|
|
}
|
|
//
|
|
// In runtime/mercury_type_info.h:
|
|
// typedef MR_PseudoTypeInfo MR_EquivType;
|
|
// so here we just use MR_PseudoTypeInfo
|
|
//
|
|
public PseudoTypeInfo layout_equiv() {
|
|
return (PseudoTypeInfo) layout_init;
|
|
}
|
|
|
|
public TypeLayout(java.lang.Object init) {
|
|
layout_init = init;
|
|
}
|
|
}
|