diff mbox

guile: Remove (gdb init) module, and include 'init.scm'.

Message ID 87tx7fl1ch.fsf@gnu.org
State New
Headers show

Commit Message

Ludovic Courtès June 20, 2014, 9:26 p.m. UTC
This patch is a prerequisite for the following (compiling Scheme
files).  It removes the (gdb init), which had a top-level circular
dependency with (gdb), thereby preventing compilation.

Thanks,
Ludo’.

gdb/
2014-06-20  Ludovic Courtès  <ludo@gnu.org>

	* guile/guile.c: (gdbscm_init_module_name): Change to "gdb".
	* guile/lib/gdb.scm: Remove 'use-modules' form and include
	gdb/init.scm.  Change 're-export' to 'export'.  Export
	'*pretty-printers*' and '%assert-type'.
	* guile/lib/gdb/init.scm: Remove 'define-module' form.
	(%exception-print-style): Remove.
	* guile/lib/gdb/boot.scm: Change (gdb init) to (gdb).
	* guile/lib/gdb/experimental.scm: Remove use of (gdb init).
	* guile/lib/gdb/types.scm: Likewise.
	* guile/lib/gdb/printing.scm: Add '%assert-type', 'SCM_ARG1', and
	'*pretty-printers*' to the selection.
---
 gdb/guile/guile.c                  | 2 +-
 gdb/guile/lib/gdb.scm              | 6 ++++--
 gdb/guile/lib/gdb/boot.scm         | 2 +-
 gdb/guile/lib/gdb/experimental.scm | 3 +--
 gdb/guile/lib/gdb/init.scm         | 6 +-----
 gdb/guile/lib/gdb/printing.scm     | 6 +++---
 gdb/guile/lib/gdb/types.scm        | 1 -
 7 files changed, 11 insertions(+), 15 deletions(-)

Comments

Doug Evans July 12, 2014, 4:38 a.m. UTC | #1
ludo@gnu.org (Ludovic Courtès) writes:

> This patch is a prerequisite for the following (compiling Scheme
> files).  It removes the (gdb init), which had a top-level circular
> dependency with (gdb), thereby preventing compilation.
>
> Thanks,
> Ludo’.
>
> gdb/
> 2014-06-20  Ludovic Courtès  <ludo@gnu.org>
>
> 	* guile/guile.c: (gdbscm_init_module_name): Change to "gdb".
> 	* guile/lib/gdb.scm: Remove 'use-modules' form and include
> 	gdb/init.scm.  Change 're-export' to 'export'.  Export
> 	'*pretty-printers*' and '%assert-type'.
> 	* guile/lib/gdb/init.scm: Remove 'define-module' form.
> 	(%exception-print-style): Remove.
> 	* guile/lib/gdb/boot.scm: Change (gdb init) to (gdb).
> 	* guile/lib/gdb/experimental.scm: Remove use of (gdb init).
> 	* guile/lib/gdb/types.scm: Likewise.
> 	* guile/lib/gdb/printing.scm: Add '%assert-type', 'SCM_ARG1', and
> 	'*pretty-printers*' to the selection.

Hi.

IWBN to not export %assert-type.
I was also thinking IWBN to not export *pretty-printers* and instead
export a function that returns the value.  WDYT?

btw, is (include ...) documented anywhere?
Ludovic Courtès July 12, 2014, 12:36 p.m. UTC | #2
Hi, Doug,

Doug Evans <xdje42@gmail.com> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> This patch is a prerequisite for the following (compiling Scheme
>> files).  It removes the (gdb init), which had a top-level circular
>> dependency with (gdb), thereby preventing compilation.
>>
>> Thanks,
>> Ludo’.
>>
>> gdb/
>> 2014-06-20  Ludovic Courtès  <ludo@gnu.org>
>>
>> 	* guile/guile.c: (gdbscm_init_module_name): Change to "gdb".
>> 	* guile/lib/gdb.scm: Remove 'use-modules' form and include
>> 	gdb/init.scm.  Change 're-export' to 'export'.  Export
>> 	'*pretty-printers*' and '%assert-type'.
>> 	* guile/lib/gdb/init.scm: Remove 'define-module' form.
>> 	(%exception-print-style): Remove.
>> 	* guile/lib/gdb/boot.scm: Change (gdb init) to (gdb).
>> 	* guile/lib/gdb/experimental.scm: Remove use of (gdb init).
>> 	* guile/lib/gdb/types.scm: Likewise.
>> 	* guile/lib/gdb/printing.scm: Add '%assert-type', 'SCM_ARG1', and
>> 	'*pretty-printers*' to the selection.
>
> Hi.
>
> IWBN to not export %assert-type.
> I was also thinking IWBN to not export *pretty-printers* and instead
> export a function that returns the value.  WDYT?

I agree, but that was needed for gdb/printing.scm.

That said, we may be able to access them from there using ‘@@’.  Perhaps
that’d be preferable.  I can try that if you want.  WDYT?

> btw, is (include ...) documented anywhere?

Yes (info "(guile) Local Inclusion").

Thanks,
Ludo’.
Doug Evans July 12, 2014, 2:54 p.m. UTC | #3
ludo@gnu.org (Ludovic Courtès) writes:

> Hi, Doug,
>
> Doug Evans <xdje42@gmail.com> skribis:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
>>
>>> This patch is a prerequisite for the following (compiling Scheme
>>> files).  It removes the (gdb init), which had a top-level circular
>>> dependency with (gdb), thereby preventing compilation.
>>>
>>> Thanks,
>>> Ludo’.
>>>
>>> gdb/
>>> 2014-06-20  Ludovic Courtès  <ludo@gnu.org>
>>>
>>> 	* guile/guile.c: (gdbscm_init_module_name): Change to "gdb".
>>> 	* guile/lib/gdb.scm: Remove 'use-modules' form and include
>>> 	gdb/init.scm.  Change 're-export' to 'export'.  Export
>>> 	'*pretty-printers*' and '%assert-type'.
>>> 	* guile/lib/gdb/init.scm: Remove 'define-module' form.
>>> 	(%exception-print-style): Remove.
>>> 	* guile/lib/gdb/boot.scm: Change (gdb init) to (gdb).
>>> 	* guile/lib/gdb/experimental.scm: Remove use of (gdb init).
>>> 	* guile/lib/gdb/types.scm: Likewise.
>>> 	* guile/lib/gdb/printing.scm: Add '%assert-type', 'SCM_ARG1', and
>>> 	'*pretty-printers*' to the selection.
>>
>> Hi.
>>
>> IWBN to not export %assert-type.
>> I was also thinking IWBN to not export *pretty-printers* and instead
>> export a function that returns the value.  WDYT?
>
> I agree, but that was needed for gdb/printing.scm.

Ah.
Can we put it in (gdb utils) or some such?

> That said, we may be able to access them from there using ‘@@’.  Perhaps
> that’d be preferable.  I can try that if you want.  WDYT?
>
>> btw, is (include ...) documented anywhere?
>
> Yes (info "(guile) Local Inclusion").

Thanks.
It's too bad manual entries don't include the parens.
grepping for "(include" didn't find it, and I gave up looking through
the results of grepping "include". :-)
diff mbox

Patch

diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 00d7b06..b77cbf1 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -105,7 +105,7 @@  static SCM to_string_keyword;
 
 /* The name of the various modules (without the surrounding parens).  */
 const char gdbscm_module_name[] = "gdb";
-const char gdbscm_init_module_name[] = "gdb init";
+const char gdbscm_init_module_name[] = "gdb";
 
 /* The name of the bootstrap file.  */
 static const char boot_scm_filename[] = "boot.scm";
diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm
index d628f00..8072860 100644
--- a/gdb/guile/lib/gdb.scm
+++ b/gdb/guile/lib/gdb.scm
@@ -313,6 +313,7 @@ 
 
  ;; scm-pretty-print.c
 
+ *pretty-printers*
  make-pretty-printer
  pretty-printer?
  pretty-printer-enabled?
@@ -496,13 +497,14 @@ 
 (add-to-load-path
  (string-append (data-directory) file-name-separator-string "guile"))
 
-(use-modules ((gdb init)))
+(include "gdb/init.scm")
 
 ;; These come from other files, but they're really part of this module.
 
-(re-export
+(export
 
  ;; init.scm
+ %assert-type
  orig-input-port
  orig-output-port
  orig-error-port
diff --git a/gdb/guile/lib/gdb/boot.scm b/gdb/guile/lib/gdb/boot.scm
index cf7d305..0d775d4 100644
--- a/gdb/guile/lib/gdb/boot.scm
+++ b/gdb/guile/lib/gdb/boot.scm
@@ -27,5 +27,5 @@ 
        file-name-separator-string "gdb.scm"))
 
 ;; Now that the Scheme side support is loaded, initialize it.
-(let ((init-proc (@@ (gdb init) %initialize!)))
+(let ((init-proc (@@ (gdb) %initialize!)))
   (init-proc))
diff --git a/gdb/guile/lib/gdb/experimental.scm b/gdb/guile/lib/gdb/experimental.scm
index ffded84..9e5a53e 100644
--- a/gdb/guile/lib/gdb/experimental.scm
+++ b/gdb/guile/lib/gdb/experimental.scm
@@ -22,8 +22,7 @@ 
 ;; E.g., (gdb experimental ports), etc.
 
 (define-module (gdb experimental)
-  #:use-module (gdb)
-  #:use-module (gdb init))
+  #:use-module (gdb))
 
 ;; These are defined in C.
 (define-public with-gdb-output-to-port (@@ (gdb) %with-gdb-output-to-port))
diff --git a/gdb/guile/lib/gdb/init.scm b/gdb/guile/lib/gdb/init.scm
index 1e90790..d4145e5 100644
--- a/gdb/guile/lib/gdb/init.scm
+++ b/gdb/guile/lib/gdb/init.scm
@@ -17,8 +17,7 @@ 
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-(define-module (gdb init)
-  #:use-module (gdb))
+;; This file is included by (gdb).
 
 (define-public SCM_ARG1 1)
 (define-public SCM_ARG2 2)
@@ -28,9 +27,6 @@ 
 (define %orig-output-port #f)
 (define %orig-error-port #f)
 
-;; %exception-print-style is exported as "private" by gdb.
-(define %exception-print-style (@@ (gdb) %exception-print-style))
-
 ;; Keys for GDB-generated exceptions.
 ;; gdb:with-stack is handled separately.
 
diff --git a/gdb/guile/lib/gdb/printing.scm b/gdb/guile/lib/gdb/printing.scm
index eac9417..f3d2ad5 100644
--- a/gdb/guile/lib/gdb/printing.scm
+++ b/gdb/guile/lib/gdb/printing.scm
@@ -19,10 +19,10 @@ 
 
 (define-module (gdb printing)
   #:use-module ((gdb) #:select
-		(*pretty-printers* pretty-printer? objfile? progspace?
+		(%assert-type SCM_ARG1
+                 *pretty-printers* pretty-printer? objfile? progspace?
 		 objfile-pretty-printers set-objfile-pretty-printers!
-		 progspace-pretty-printers set-progspace-pretty-printers!))
-  #:use-module (gdb init))
+		 progspace-pretty-printers set-progspace-pretty-printers!)))
 
 (define-public (prepend-pretty-printer! obj matcher)
   "Add MATCHER to the beginning of the pretty-printer list for OBJ.
diff --git a/gdb/guile/lib/gdb/types.scm b/gdb/guile/lib/gdb/types.scm
index 31ea192..d27be2f 100644
--- a/gdb/guile/lib/gdb/types.scm
+++ b/gdb/guile/lib/gdb/types.scm
@@ -16,7 +16,6 @@ 
 
 (define-module (gdb types)
   #:use-module (gdb)
-  #:use-module (gdb init)
   #:use-module (gdb iterator))
 
 (define-public (type-has-field-deep? type field-name)
-- 
1.8.4