Conditional layer generation support

This commit is contained in:
Naohiko Shimizu 2020-03-07 02:27:48 +09:00
parent 93cd988d07
commit d4a6f0f2ff
5 changed files with 176 additions and 3 deletions

View File

@ -2,6 +2,7 @@ lib_LTLIBRARIES = libVrd.la
include_HEADERS = vrd.h
libVrd_la_SOURCES = drucompi_l.l drucompi_y.y \
defdefin.c defdefin.h defexclu.c defexclu.h definclu.c definclu.h definter.c \
defminmax.h defminmax.c \
definter.h defresiz.c defresiz.h deftools.c deftools.h defunion.c defunion.h \
drucgral.c druchier.c druchier.h drucmin.c drucmin.h drucompi.c \
drucompi.h drucring.c drucring.h drucutil.c drucutil.h vmcaract.c vmcaract.h \

View File

@ -126,6 +126,21 @@ DrucViewString ("\n");
\*/
break;
}
case DRUC_MESURE_LARGEUR_MIN:
case DRUC_MESURE_LARGEUR_MAX:
case DRUC_MESURE_LONGUEUR_MIN:
case DRUC_MESURE_LONGUEUR_MAX:
{
// printf("DRUC_OPERATION_%d\n", DrucInstructionCourante->OP_COMPOSE );
DrucDefineMinMax ( DrucFigureRds,
DrucRdsWindow,
DrucInstructionCourante
);
break;
}
defualt:
DRUC_EXIT( DRUC_ERROR_UNDEFINED );
}/* switch */
DrucComputeEquiLayer ( DrucFigureRds ,

View File

@ -0,0 +1,131 @@
/*------------------------------------------------------------\
| |
| Tool : DRUC |
| |
| File : DEFMINMAX.C |
| |
| Authors : Naohiko Shimizu |
| |
| Date : 04/03/20 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "mph.h"
#include "mut.h"
#include "rds.h"
#include "rwi.h"
#include "rut.h"
#include "rtl.h"
#include "rfm.h"
#include "rpr.h"
#include "drucutil.h"
#include "vmctools.h"
#include "deftools.h"
#include "defresiz.h"
/*------------------------------------------------------------\
| |
| DefMinMax Fonctions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| DrucDefineUnion |
| Definit un layer temporaire caracterise par l'union |
| des deux layers source |
| range le resultat dans le tableau des layers user defini par|
| l'instruction |
\------------------------------------------------------------*/
void DrucDefineMinMax ( DrucFigureRds,
DrucRdsWindow ,
DrucInstructionCourante
)
rdsfig_list *DrucFigureRds;
rdswindow *DrucRdsWindow;
DrucTypeStructInstruction *DrucInstructionCourante;
{
int TmpLayerDest;
int TmpLayerSource1;
register rdsrec_list *TmpRectangleSource;
register rdsrec_list *TmpRectangleDest;
long MesureMax, MesureMin;
long Value;
TmpLayerDest = DrucInstructionCourante->LAYER_DEST;
TmpLayerSource1 = DrucInstructionCourante->LAYER_1;
Value = DrucInstructionCourante->DEF_VALEUR;
/*\
* modifier tous les rectangles du layer source 1
\*/
for ( TmpRectangleSource = DrucFigureRds->LAYERTAB[ TmpLayerSource1 ];
TmpRectangleSource != (rdsrec_list *)NULL;
TmpRectangleSource = TmpRectangleSource->NEXT
)
{
/*\
* modif des dimensions X
\*/
MesureMax = ( TmpRectangleSource->DX > TmpRectangleSource->DY ?
TmpRectangleSource->DX :
TmpRectangleSource->DY
);
MesureMin = ( TmpRectangleSource->DX < TmpRectangleSource->DY ?
TmpRectangleSource->DX :
TmpRectangleSource->DY
);
switch ( DrucInstructionCourante->OP_COMPOSE )
{
case DRUC_MESURE_LARGEUR_MIN:
if(! (MesureMin > Value)) continue;
break;
case DRUC_MESURE_LARGEUR_MAX:
if(! (MesureMin < Value)) continue;
break;
case DRUC_MESURE_LONGUEUR_MIN:
if(! (MesureMax > Value)) continue;
break;
case DRUC_MESURE_LONGUEUR_MAX:
if(! (MesureMax < Value)) continue;
break;
defualt:
DRUC_EXIT( DRUC_ERROR_UNDEFINED );
}
// printf("\n1:X,Y=%d,%d, DX,DY = %d,%dM:V=%d:%d, %s\n",TmpRectangleSource->X, TmpRectangleSource->Y,TmpRectangleSource->DX, TmpRectangleSource->DY, MesureMin, Value, TmpRectangleSource->NAME);
TmpRectangleDest = allocrdsrec ( sizeof ( DrucTypeStructPlusRect ));
TmpRectangleDest->NEXT = ( rdsrec_list *)NULL;
TmpRectangleDest->USER = (rdsrec_list *)NULL;
TmpRectangleDest->NAME = TmpRectangleSource->NAME;
TmpRectangleDest->X = TmpRectangleSource->X ;
TmpRectangleDest->Y = TmpRectangleSource->Y ;
TmpRectangleDest->DX = TmpRectangleSource->DX ;
TmpRectangleDest->DY = TmpRectangleSource->DY ;
SetRdsLayer ( TmpRectangleDest ,
TmpLayerDest
);
MACRO_NEXT_EQUI ( TmpRectangleDest ) = (rdsrec_list *)NULL;
DrucChaineCompose ( TmpRectangleDest ,
TmpRectangleSource,
TmpLayerSource1
);
addrdsrecwindow ( TmpRectangleDest ,
DrucRdsWindow
);
DrucAddRecFigure ( TmpRectangleDest ,
DrucFigureRds ,
TmpLayerDest
);
}
}

View File

@ -0,0 +1,25 @@
/*------------------------------------------------------------\
| |
| Tool : DRUC |
| |
| File : DEFMINMAX.H |
| |
| Authors : Naohiko Shimizu |
| |
| Date : 04/03/20 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| DefMinMax Fonctions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| DrucDefineResize |
| Definit un layer temporaire caracterise par la modification |
| des dimensions des rectangles par valeur positive ou negative
| range le resultat dans le tableau des layers user defini par|
| l'instruction |
\------------------------------------------------------------*/
extern void DrucDefineMinMax ();

View File

@ -124,7 +124,6 @@ bloc : define { DrucLoadInstructionDefine () ;}
define : DRUC_DEFINE
DRUC_NOM { DrucInitDefineLayerA ( DrucInputChaine ) ;}
','
resiz
DRUC_DESTINATION
DRUC_NOM { DrucInitDefineLayerDest ( DrucInputChaine ) ;}
@ -133,8 +132,10 @@ define : DRUC_DEFINE
resiz : valresiz
defmodif
defoper
| DRUC_NOM { DrucInitDefineLayerB ( DrucInputChaine ) ;}
| mesure_rel
valresiz { DrucStructDefineOpCompose ( $1 ) ; }
| ','
DRUC_NOM { DrucInitDefineLayerB ( DrucInputChaine ) ;}
compose
;