[Openmcl-devel] More CLIM Issues

Rainer Joswig joswig at lisp.de
Thu Aug 4 15:52:56 PDT 2016


From a quick look at the CLIM code, I see only one place where the symbol compile-file  gets passed as an environment:

ptypes1.lisp   (defmacro define-presentation-type (name parameters ...)

...

                                         ;; Can't just put the environment here, since macro
                                         ;; expansion environments have dynamic extent
                                         ',(and (compile-file-environment-p environment)
						#-(and allegro (version>= 7 0)) 'compile-file
						#+(and allegro (version>= 7 0))
						(sys:augment-environment environment))))
...

Since Clozure CL has CCL:AUGMENT-ENVIRONMENT, you might want to try to use that for CCL.
Looks like the Allegro CL version creates a new environment, based on the existing one.
From the comment it seems also that it needs a new one.
Passing compile-file means that the environment will be looked up, for example by some dynamic variable.

Options:

1) maybe  CCL:AUGMENT-ENVIRONMENT  works

2) maybe there is a way to get the current environment?
    Similar to the old   ccl::*fcomp-compilation-environment*   

3)  maybe  one can have a custom  CCL  function to fully copy an environment, as a replacement for (CCL:AUGMENT-ENVIRONMENT ...). 



Regards,

Rainer Joswig




> Am 05.08.2016 um 00:05 schrieb Craig Lanning <craig.t.lanning at gmail.com <mailto:craig.t.lanning at gmail.com>>:
> 
> On Thu, 2016-08-04 at 22:09 +0200, Rainer Joswig wrote:
>> If you look at the function   find-presentation-type-class   , it
>> gets called with an environment  compile-file (a symbol).
>> That kind of environment is not in standard Common Lisp.
>> The code calls FIND-CLASS with this environment then, where it then
>> fails.
>> 
>> As you can see, there is code for allegro, which changes the
>> environment, first:
>> 
>> #+allegro (setq environment (compile-file-environment-p environment))
> 
> I arranged for the code to call ccl::compile-file-environment-p, but
> that function expects the environment to be a #<CCL::LEXICAL-
> ENVIRONMENT> object.  Somehow the environment that is coming in is the
> symbol COMPILE-FILE.  CLIM Utils defines a function COMPILE-FILE-
> ENVIRONMENT-P which returns T when it sees COMPILE-FILE.  T doesn't
> work either.
> 
> The question now is: How do I get the compile time environment when it
> was not passed in?  The symbol COMPILE-FILE was passed instead.  The
> only global variable which includes the word ENVIRONMENT in its name is
> ccl::*fcomp-load-forms-environment*, but that one doesn't seem to help.
> 
> Does CCL pass the symbol COMPILE-FILE as the environment at any time?
> Or should I be looking in the CLIM code for something that passes
> 'COMPILE-FILE
> 
>> I would guess that all ANSI CL implementation would need to do that,
>> given a useful implementation of  the function compile-file-
>> environment-p.
>> 
>> What you want:  FIND-CLASS should find the right class object in the
>> right environment.  The symbol  COMPILE-FILE  is not an
>> environment  for Clozure CL, so you need to call (setq environment
>> (compile-file-environment-p environment))   to set it to a useful
>> value.
>> 
>> Regards,
>> 
>> Rainer
>> 
>> 
>> (defun find-presentation-type-class (name &optional (errorp t)
>> environment)
>>   #+Genera (declare (inline compile-file-environment-p))
>>   #+allegro (setq environment (compile-file-environment-p
>> environment))
>>   (macrolet ((not-found (name)
>>                `(if (gethash name *presentation-type-abbreviation-
>> table*)
>>                     (error "~S is a presentation type abbreviation,
>> not the name of a presentation type" ,name)
>>                     (error "~S is not the name of a presentation
>> type" ,name))))
>>     (typecase name
>>       (symbol
>>         (let ((compile-file-environment-p (compile-file-environment-p 
>> environment)))
>>           (or (and (eq name (first *presentation-type-being-
>> defined*))
>>                    (second *presentation-type-being-defined*))
>>               (if compile-file-environment-p
>>                   (compile-time-property name 'presentation-type-
>> class)
>>                   (gethash name *presentation-type-class-table*))
>>               (let ((class (find-class name nil
>> environment)))                                ;  <- fails probably
>> here
>>                 (and (acceptable-presentation-type-class class)
>>                      class))
>>               (when compile-file-environment-p
>>                 ;; compile-file environment inherits from the run-
>> time environment
>>                 (or (gethash name *presentation-type-class-table*)
>>                     (let ((class (find-class name nil nil)))
>>                       (and (acceptable-presentation-type-class class)
>>                            class))))
>>               (and errorp (not-found name)))))
>>       ((satisfies acceptable-presentation-type-class)
>>        name)
>>       (otherwise        ;a type error should complain even if errorp
>> is nil
>>         (not-found name)))))
>> 
>> 
>> Regards.
>> 
>> Rainer
>> 
>> 
>> 
>> 
>>> 
>>> Am 04.08.2016 um 21:19 schrieb Craig Lanning <craig.t.lanning at gmail
>>> .com>:
>>> 
>>> I'm making a little progress (I think).
>>> 
>>> When I compile the CLIM Silica system, I see complaints about
>>> undefined
>>> functions.  Some of these are slot accessor functions that don't
>>> get
>>> defined until CLIM Standalone is compiled.
>>> 
>>> Anyway, I compile and load CLIM Utils, CLIM Silica, and then CLIM
>>> Standalone.
>>> 
>>> While compiling CLIM Standalone, it runs into the following error:
>>> 
>>> ;; Compiling clim:clim;accept-values.lisp.newest
>>> ;Compiler warnings for "clim:clim;accept-values.lisp.newest" :
>>> ;   In (PROMPT-FOR-ACCEPT (ACCEPT-VALUES-STREAM T T)) inside an
>>> anonymous lambda form: Unused lexical variable ACCEPT-ARGS
>>>> 
>>>> Error: The value COMPILE-FILE is not of the expected type
>>> CCL::LEXICAL-ENVIRONMENT.
>>>> 
>>>> While executing: CCL::DEFINITION-ENVIRONMENT, in process
>>>> listener(1).
>>>> Type :POP to abort, :R for a list of available restarts.
>>>> Type :? for other options.
>>> 1 > :b
>>> 
>>> Attached is the entire output from doing the compiles and the
>>> output of
>>> the :b command.
>>> 
>>> The problem here is that I'm not even sure where to look for the
>>> real
>>> problem.  In CLIM Utils, there were a few things that touched on
>>> the
>>> environment.  I think I added the appropriate #+/#- things to that
>>> code.
>>> 
>>> Can anyone tell me anything that might help me figure out what the
>>> real
>>> problem is?
>>> 
>>> Craig
>>> <output.txt>_______________________________________________
>>> Openmcl-devel mailing list
>>> Openmcl-devel at clozure.com <mailto:Openmcl-devel at clozure.com>
>>> https://lists.clozure.com/mailman/listinfo/openmcl-devel
>> 
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com <mailto:Openmcl-devel at clozure.com>
>> https://lists.clozure.com/mailman/listinfo/openmcl-devel
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com <mailto:Openmcl-devel at clozure.com>
> https://lists.clozure.com/mailman/listinfo/openmcl-devel <https://lists.clozure.com/mailman/listinfo/openmcl-devel>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20160805/1bfc1351/attachment.htm>


More information about the Openmcl-devel mailing list