Commit Graph

5 Commits

Author SHA1 Message Date
Jose E. Marchesi
2515b13700 a68: support for Algol 68 code in libga68 and initial transput
Most of the standard prelude is implemented in a combination of code
lowered by the front-end (standard operators, contants, etc) and
functions provided by the libga68 run-time library, to which the
former libcalls.  Until now, all the support routines in libga68 were
written in C.  However, many of the transput facilities are better
implemented in Algol 68.

The Revised Report includes a reference implementation (code listing)
of many of the standard routines.  This implementation, however, makes
use of an "extended" program notation in order to denote certain
notions to avoid repetitive code.  Therefore this commit includes
sppp, a build-time pre-processor written in awk that is only intended
to be used internally by the libga68 run-time library.  This
preprocessor allows us to write code like:

    proc subwhole = (Number v, int width) string:
       case v in
          {iter L {short short} {short} {} {long}    {long long}}
          {iter S {LENG LENG}   {LENG}  {} {SHORTEN} {SHORTEN SHORTEN}}
          ({L} int x):
             begin string s, {L} int n := x;
                   while dig_char ({S} (n MOD {L} 10)) +=: s;
                         n %:= {L} 10; n /= {L} 0
                   do ~ od;
                   (UPB s > width | width * errorchar | s)
             end
          {reti {,}}
       esac;

Resulting in cases for short short int, short int, int, long int and
long long int being macro-expanded in the routine's conformance
clause.

This commit also adds the necessary infrastructure for writing Algol
68 code in the libga68 library, including the ability of having
modules exported by libga68.  An implementation of some of the
transput routines is also provided in standard.a68: whole, fixed,
float, string_to_L_real, char_in_string, L_int_width, L_real_width and
L_exp_with.

The build system changes include the backport of the Automake Algol 68
support, which is in a released version of Automake but not in the
version used for GCC, to libga68/m4/autoconf.m4.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>

ChangeLog

	* Makefile.def (flags_to_pass): Rename GA68, GA68FLAGS,
	GA68_FOR_TARGET, GA68FLAGS_FOR_TARGET to A68, A68FLAGS,
	A68_FOR_TARGET and A68FLAGS_FOR_TARGET.
	* Makefile.tpl: Use A68, A68FLAGS, A68_FOR_BUILD and
	A68_FOR_TARGET rather than GA68, GA68FLAGS, GA68_FOR_BUILD and
	GA68_FOR_TARGET.
	* Makefile.in: Regenerate.
	* configure.ac: Set A68_FOR_BUILD rather than GA68_FOR_BUILD, and
	invoke ACX_PROG_A68 rather than ACX_PROG_GA68.
	Subst A68_FOR_BUILD rather than GA68_FOR_BUILD.
	Subst A68 and A68FLAGS rather than GA68 and GA68FLAGS.
	Set A68_FOR_TARGET rather than GA68_FOR_TARGET.
	* configure: Regenerate.
	* config-ml.in: Handle A68FLAGS and define A68 in sub-configures.

config/ChangeLog

	* acx.m4: Define ACX_PROG_A68 rather than ACX_PROG_GA68.
	(ACX_PROG_A68): Set A68 rather than GA68.

gcc/algol68/ChangeLog

	* a68-lang.cc (a68_init_options): Add an entry to A68_MODULE_FILES
	to map module Transput to the basename ga68.

gcc/testsuite/ChangeLog

	* algol68/execute/char-in-string-1.a68: New test.

libga68/ChangeLog

	* m4/autoconf.m4: New file.
	* configure.ac: Expand AC_PROG_A68.
	* configure: Regenerate.
	* Makefile.am: Add rules to build Algol 68 sources and to
	build the transput module.
	* Makefile.in: Regenerate.
	* acinclude.m4: Include m4/autoconf.m4.
	* sppp.awk: New file.
	* transput.a68.in: Likewise.
2025-12-30 22:45:51 +01:00
Pietro Monteiro
896073b66d libga68: Hide internal functions
Test if the target supports the visibility attribute and apply it to
internal functions.

libga68/ChangeLog:

	* acinclude.m4: New file. Add visibility attribute test.
	* configure.ac: Use the new test.
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.h.in: Likewise.
	* configure: Likewise.
	* ga68.h (GA68_HIDDEN): New macro.
	(_libga68_abort): Add visibility hidden attribute.
	(_libga68_init_heap): Likewise.
	(_libga68_malloc_internal): Likewise.
	(_libga68_realloc): Likewise.
	(_libga68_realloc_unchecked): Likewise.
	(_libga68_free_internal): Likewise.
	(_libga68_u8_uctomb): Likewise.
	(_libga68_u8_mbtouc): Likewise.
	(_libga68_u32_to_u8): Likewise.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2025-12-30 16:42:09 -05:00
Pietro Monteiro
f426587cf9 libga68: Add symbol versions to exports
libga68/ChangeLog:

	* configure.ac: New test to determine if symbol versioning is
	supported.
	* Makefile.am: Use result of above test to add appropriate linker
	flags.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* ga68.map: New file.
	* libtool-version: New file.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2025-12-29 12:53:20 -05:00
Jose E. Marchesi
4aa120ce5e a68: libga68: build system (generated files)
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>

ChangeLog

	* libga68/config.h.in: Regenerate.
	* libga68/configure: Likewise.
	* libga68/Makefile.in: Likewise.
	* libga68/aclocal.m4: Likewise.
2025-11-30 01:52:20 +01:00
Jose E. Marchesi
18518d2843 a68: libga68: build system
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>

ChangeLog

	* libga68/Makefile.am: New file.
	* libga68/configure.ac: Likewise.
	* libga68/Makefile.in: Generate.
	* libga68/aclocal.m4: Likewise.
2025-11-30 01:52:20 +01:00