patch for +G +L updates

Jskud at jskud.com Jskud at jskud.com
Fri Dec 9 22:53:36 EST 2005


This is a follow up to a hugs bug submitted last night.

The following patch updates the man page and the option processing to
reflect the changes in f +G and +L argument processing for ffihugs.

After applying the patch, 

    ffihugs will behave as follows:

	$ HUGSDIR=hugsdir src/ffihugs +G +L"silly" ~/Technical/queen.hs
	ERROR: +G is no longer needed for ffihugs and is no longer supported - ignoring it.
	ERROR: +L is no longer supported for ffihugs - put the argument (without +L) *after* the module - ignoring it.
	$ 

    the manpage will read (in part):

       ffihugs [ options ] module [ compiler_argument ] ...

	...

       Additional  arguments  for  the  C
       compiler  may be supplied via compiler_arguments.  For example, suppose
       you have some C functions in test.c and some FFI declarations for those
       functions  in  Test.hs and the code in test.c needs to be compiled with
       -lm.  Then you would compile the module with the command

              ffihugs Test.hs test.c -lm

       which generates an object file Test.so.  Then when hugs loads  Test.hs,
       it will also load Test.so.

	...

       Updated  for  the  March
       2005 ffihugs changes by Joseph P. Skudlarek.

                                 December 2005                         HUGS(1)


I hope you find the patch useful, and will apply it.  
Questions to me.  /Jskud

Here's the patch.

[Jskud at briareus src]$ diff -u hugs_via_cvs/hugs98/src/opts.c hugs98-20051105/src/opts.c 
--- hugs_via_cvs/hugs98/src/opts.c	2005-09-02 06:56:09.000000000 -0700
+++ hugs98-20051105/src/opts.c	2005-12-09 19:35:05.000000000 -0800
@@ -503,6 +503,20 @@
 			       cutoff = cutcand;
 		       }
 		       return TRUE;
+
+		/*
+		 * FYI: We are unable to use #ifdef defined (FFI_COMPILER) to make this processing conditional
+		 * since this file is shared, and it is never compiled with FFI_COMPILER specified.
+		 * Since we only expect ffihugs users to encounter this error, always checking is acceptable.
+		 * FYI: We need to return TRUE so that ffihugs will process and see all the arguments.
+		 */
+
+	    case 'G' : Printf("ERROR: +G is no longer needed for ffihugs and is no longer supported - ignoring it.\n");
+		       return TRUE;
+
+	    case 'L' : Printf("ERROR: +L is no longer supported for ffihugs - put the argument (without +L) *after* the module - ignoring it.\n");
+		       return TRUE;
+
         default  :
 #if !HASKELL_98_ONLY
 	           if (strcmp("98",s)==0) {
[Jskud at briareus src]$ diff -u {hugs_via_cvs/hugs98,hugs98-20051105}/docs/hugs.1.in 
--- hugs_via_cvs/hugs98/docs/hugs.1.in	2003-10-12 06:12:18.000000000 -0700
+++ hugs98-20051105/docs/hugs.1.in	2005-12-09 18:52:01.000000000 -0800
@@ -1,5 +1,5 @@
 .\" @configure_input@
-.TH HUGS 1 "September 2003" "" ""
+.TH HUGS 1 "December 2005" "" ""
 .ds LB @HUGSDIR@
 .ds BN @BINDIR@
 .ds HP @HUGSPATH@
@@ -26,14 +26,13 @@
 ]
 .br
 .B ffihugs
-.B +G
 [
 .I options
 ]
+.I module
 [
-.BI +L arg
+.BI compiler_argument
 ] ...
-.I module
 .SH DESCRIPTION
 Hugs is an interpreter for Haskell, a standard non-strict functional
 programming language.  Hugs implements almost all of the
@@ -279,19 +278,15 @@
 .B foreign
 declarations must be compiled using the
 .I ffihugs
-command with the
-.B +G
-option.
-Additional arguments for the C compiler may be supplied with 
-.B +L
-options.
+command.
+Additional arguments for the C compiler may be supplied via \fBcompiler_argument\fPs.
 For example,
 suppose you have some C functions in \fBtest.c\fP and some FFI declarations
 for those functions in \fBTest.hs\fP and the code in \fBtest.c\fP needs to be
 compiled with \fB\-lm\fP.
 Then you would compile the module with the command
 .IP
-\fBffihugs +G +L"test.c" +L"\-lm" Test.hs\fP
+\fBffihugs Test.hs test.c \-lm \fP
 .LP
 which generates an object file \fBTest.so\fP.
 Then when \fIhugs\fP loads \fBTest.hs\fP, it will also load \fBTest.so\fP.
@@ -347,3 +342,4 @@
 Manual page: Jonathan Bowen, modified by Gary Leavens, and then
 (with apologies to the original authors) by Mark Jones.
 Updated for Hugs 98 by Antti-Juhani Kaijanaho and Ross Paterson.
+Updated for the March 2005 ffihugs changes by Joseph P. Skudlarek.


More information about the Cvs-hugs mailing list