ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* ConTeXt + MetaUML
@ 2006-05-02 14:55 Renaud AUBIN
  2006-05-02 22:11 ` nico
  2006-05-03 19:52 ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Renaud AUBIN @ 2006-05-02 14:55 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1446 bytes --]


Hi all,

Some times ago, I have discovered MetaUML via the MetaPost ML. As  a
consequence, I have tried to use it with ConTeXt... Here is the result:

Considering a VERY simple example:

\starttext
\startuseMPgraphic{xx}
input metauml;
Class.A("A")()();
drawObject(A);
\stopuseMPgraphic

\placefigure[here][fig:xx]{xx}{\useMPgraphic{xx}}
\stoptext

The compilation failed with:

>> clearboxes
! Isolated expression.
<to be read again>
                   ;
<scantokens> ...nsidefigure := false ; clearboxes;

<to be read again>
                   ;
endfig->scantokens.extra_endfig;
                                shipit;endgroup
l.125 endfig
            ;

Apparently, MetaUML is based on boxes.mp

(temp-mpgraph.mp (/usr/share/texmf-tetex/metapost/metauml/metauml.mp
HERE ====> (/usr/share/texmf-tetex/metapost/base/boxes.mp)
(/usr/share/texmf-tetex/metapost/metauml/util_infrastructure.mp
(/usr/share/texmf-tetex/metapost/metauml/util_log.mp))
....
....

It have already tried to use boxes.mp in ConTeXt in the past, but
switched for metaobj because:
1. metaobj is more suitable to my needs
2. boxes.mp causes troubles when used with ConTeXT

I'll keep searching a solution but if one of yours has already dealt
with this kind of problems and succeeded in using boxes or, best, MetaUML...

(I have to precise that I don't want to include a ps or pdf file
generated by metapost only. I would embed the code in my document)

Cheers,

Renaud





[-- Attachment #1.2: Type: text/html, Size: 2384 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ConTeXt + MetaUML
  2006-05-02 14:55 ConTeXt + MetaUML Renaud AUBIN
@ 2006-05-02 22:11 ` nico
  2006-05-03 19:52 ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: nico @ 2006-05-02 22:11 UTC (permalink / raw)


On Tue, 02 May 2006 16:55:45 +0200, Renaud AUBIN <aubin@nibua-r.org> wrote:

> Hi all,
>
> Some times ago, I have discovered MetaUML via the MetaPost ML. As  a
> consequence, I have tried to use it with ConTeXt... Here is the result:
>
> Considering a VERY simple example: [...]
>
> Apparently, MetaUML is based on boxes.mp
>
> (temp-mpgraph.mp (/usr/share/texmf-tetex/metapost/metauml/metauml.mp
> HERE ====> (/usr/share/texmf-tetex/metapost/base/boxes.mp)
> (/usr/share/texmf-tetex/metapost/metauml/util_infrastructure.mp
> (/usr/share/texmf-tetex/metapost/metauml/util_log.mp))
> ....
> ....
>
> It have already tried to use boxes.mp in ConTeXt in the past, but
> switched for metaobj because:
> 1. metaobj is more suitable to my needs
> 2. boxes.mp causes troubles when used with ConTeXT
>
> I'll keep searching a solution but if one of yours has already dealt
> with this kind of problems and succeeded in using boxes or, best,  
> MetaUML...

I remember I had such troubles when including boxes. It makes a mess when  
included in a graphic. Inluding it via \startMPinclusions makes your  
example work.

\starttext
\startMPinclusions
input metauml.mp;
\stopMPinclusions
\startuseMPgraphic{xx}
Class.A("A")()();
drawObject(A);
\stopuseMPgraphic

\placefigure[here][fig:xx]{xx}{\useMPgraphic{xx}}
\stoptext

Regards,
BG

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ConTeXt + MetaUML
  2006-05-02 14:55 ConTeXt + MetaUML Renaud AUBIN
  2006-05-02 22:11 ` nico
@ 2006-05-03 19:52 ` Hans Hagen
  2006-05-03 20:55   ` Renaud AUBIN
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2006-05-03 19:52 UTC (permalink / raw)


Renaud AUBIN wrote:
>
> >> clearboxes
> ! Isolated expression.
can you grep your metapost tree for 'clearboxes'? where is it defined? 

Hans 
 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ConTeXt + MetaUML
  2006-05-03 19:52 ` Hans Hagen
@ 2006-05-03 20:55   ` Renaud AUBIN
  2006-05-05 10:36     ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Renaud AUBIN @ 2006-05-03 20:55 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 2359 bytes --]


Hi Hans,

The example with clearboxes's crash:

\setupoutput[pdftex]

\starttext
\startuseMPgraphic{my_uml_figure}
input metauml;

Class.A("Point")
       ("+x: int",
        "+y: int") ();

Class.B("Circle")
       ("radius: int")
       ("+getRadius(): int",
        "+setRadius(r: int):void");

topToBottom(45)(A, B);

drawObjects(A, B);

clink(aggregationUni)(A, B);
\stopuseMPgraphic

\placefigure[here]{none}{\useMPgraphic{my_uml_figure}}

\stoptext

The resulting pdf looks good... strange...

I use teTeX on debian + metapost 0.901
renaud@rescue:/usr/share/texmf-tetex/metapost/base$ grep clearboxes *
boxes.mp:  expandafter def expandafter clearboxes expandafter =
boxes.mp:    clearboxes cl($);
boxes.mp:  & "boxjoin();save pic_,sproc_,pproc_;def clearboxes=enddef;";
boxes.mp:extra_endfig := extra_endfig & "clearboxes;";

Now, I have solved my problem with this (horrible!?) hack:

\startuseMPgraphic{my_uml_figure}
input metauml;
beginfig(1);
Class.A("Point")
       ("+x: int",
        "+y: int") ();

Class.B("Circle")
       ("radius: int")
       ("+getRadius(): int",
        "+setRadius(r: int):void");

topToBottom(45)(A, B);

drawObjects(A, B);

clink(aggregationUni)(A, B);
endfig;
\stopuseMPgraphic

I don't want to put "input metauml;" within MPinclusions because for my
PhD thesis, I have a lot of MPgraphic (without MetaUML) and:
1. I don't want to load metauml for each metapost run
2. I use MetaObj... (MetaUML and MetaObj interfere to each other)

Cheers,

Renaud

Hans Hagen a écrit :

>Renaud AUBIN wrote:
>  
>
>>>>clearboxes
>>>>        
>>>>
>>! Isolated expression.
>>    
>>
>can you grep your metapost tree for 'clearboxes'? where is it defined? 
>
>Hans 
> 
>
>-----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>                                             | www.pragma-pod.nl
>-----------------------------------------------------------------
>
>_______________________________________________
>ntg-context mailing list
>ntg-context@ntg.nl
>http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
>  
>


[-- Attachment #1.2: Type: text/html, Size: 3715 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ConTeXt + MetaUML
  2006-05-03 20:55   ` Renaud AUBIN
@ 2006-05-05 10:36     ` Hans Hagen
  2006-05-06 10:33       ` Renaud AUBIN
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2006-05-05 10:36 UTC (permalink / raw)


Renaud AUBIN wrote:
>
> Hi Hans,
>
> The example with clearboxes's crash:
this is probably due to the fact that clearboxes hooks into endfig


\setupoutput[pdftex]

\starttext

\startMPinclusions
 input boxes;
\stopMPinclusions

\startuseMPgraphic{my_uml_figure}
input metauml;

Class.A("Point")
       ("+x: int",
        "+y: int") ();

Class.B("Circle")
       ("radius: int")
       ("+getRadius(): int",
        "+setRadius(r: int):void");

topToBottom(45)(A, B);

drawObjects(A, B);

clink(aggregationUni)(A, B);
\stopuseMPgraphic

\placefigure[here]{none}{\useMPgraphic{my_uml_figure}}

\stoptext

this only works when in boxes.mp, we have:

extra_beginfig := extra_beginfig
  & "boxjoin();save pic_,sproc_,pproc_;def clearboxes=enddef;";
extra_endfig := extra_endfig & " clearboxes";

(space added before clearboxes in string)

(maybe i should clean up boxes.mp and preload that in metafun if only i 
know what it's meant for)

i suggest that you contact the author of metauml:

- rename the util_* files into metauml_util_* in order to prevent 
clashes with other util_* files
- load all files into the main file, so that you get rid of the 
redundant file reads (loading  quits when the files are already 
loaded,but best do some testing before they are input)
- provide a metauml_preload.mp file that preloads e.g. boxes.mp so that 
you can do

\startMPinclusions
 input metauml_preload;
\stopMPinclusions

\startuseMPgraphic{my_uml_figure}
input metauml;
\stopuseMPgraphic

- provide "load_metauml" that loads once only, so that you can do

\startMPinclusions
 input metauml_preload;
\stopMPinclusions

\startuseMPgraphic{my_uml_figure}
load_metauml;
\stopuseMPgraphic

\startuseMPgraphic{my_second_uml_figure}
load_metauml;
\stopuseMPgraphic

and get only one load when you collect graphics instead of runtime 
processing

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ConTeXt + MetaUML
  2006-05-05 10:36     ` Hans Hagen
@ 2006-05-06 10:33       ` Renaud AUBIN
  0 siblings, 0 replies; 6+ messages in thread
From: Renaud AUBIN @ 2006-05-06 10:33 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 2934 bytes --]

Hi all,

Ovidiu Gheorghies has sent to me an intermediate-release yesterday, I'll
test it and if same problems occur I'll try to modify the metauml
structure by myself in interaction with Ovidiu (according th Hans's advice).

I'll do that as soon as I have the time... ;)

Cheers,

Renaud


Hans Hagen a écrit :

>Renaud AUBIN wrote:
>  
>
>>Hi Hans,
>>
>>The example with clearboxes's crash:
>>    
>>
>this is probably due to the fact that clearboxes hooks into endfig
>
>
>\setupoutput[pdftex]
>
>\starttext
>
>\startMPinclusions
> input boxes;
>\stopMPinclusions
>
>\startuseMPgraphic{my_uml_figure}
>input metauml;
>
>Class.A("Point")
>       ("+x: int",
>        "+y: int") ();
>
>Class.B("Circle")
>       ("radius: int")
>       ("+getRadius(): int",
>        "+setRadius(r: int):void");
>
>topToBottom(45)(A, B);
>
>drawObjects(A, B);
>
>clink(aggregationUni)(A, B);
>\stopuseMPgraphic
>
>\placefigure[here]{none}{\useMPgraphic{my_uml_figure}}
>
>\stoptext
>
>this only works when in boxes.mp, we have:
>
>extra_beginfig := extra_beginfig
>  & "boxjoin();save pic_,sproc_,pproc_;def clearboxes=enddef;";
>extra_endfig := extra_endfig & " clearboxes";
>
>(space added before clearboxes in string)
>
>(maybe i should clean up boxes.mp and preload that in metafun if only i 
>know what it's meant for)
>
>i suggest that you contact the author of metauml:
>
>- rename the util_* files into metauml_util_* in order to prevent 
>clashes with other util_* files
>- load all files into the main file, so that you get rid of the 
>redundant file reads (loading  quits when the files are already 
>loaded,but best do some testing before they are input)
>- provide a metauml_preload.mp file that preloads e.g. boxes.mp so that 
>you can do
>
>\startMPinclusions
> input metauml_preload;
>\stopMPinclusions
>
>\startuseMPgraphic{my_uml_figure}
>input metauml;
>\stopuseMPgraphic
>
>- provide "load_metauml" that loads once only, so that you can do
>
>\startMPinclusions
> input metauml_preload;
>\stopMPinclusions
>
>\startuseMPgraphic{my_uml_figure}
>load_metauml;
>\stopuseMPgraphic
>
>\startuseMPgraphic{my_second_uml_figure}
>load_metauml;
>\stopuseMPgraphic
>
>and get only one load when you collect graphics instead of runtime 
>processing
>
>Hans
>
>
>-----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>                                             | www.pragma-pod.nl
>-----------------------------------------------------------------
>
>_______________________________________________
>ntg-context mailing list
>ntg-context@ntg.nl
>http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
>  
>


[-- Attachment #1.2: Type: text/html, Size: 3496 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-05-06 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-02 14:55 ConTeXt + MetaUML Renaud AUBIN
2006-05-02 22:11 ` nico
2006-05-03 19:52 ` Hans Hagen
2006-05-03 20:55   ` Renaud AUBIN
2006-05-05 10:36     ` Hans Hagen
2006-05-06 10:33       ` Renaud AUBIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).