#include #include #include #include #include /* TODO */ #if 0 #define dpf(x) printf x #else #define dpf(x) (void)0 #endif #define dp dpf int X, Y; char * banner = "-----------------------------------------------------------------------------"; char f[128][128] = { "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*********************************************-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*******************************************************************************************************************************", "*********************************************+******************************************************************************+**", "*******************************************************************************************************************************", "********************************-**********+*-******************************************************************************+**", "********************************.*************.********************************************************************************", "********************************/**************/********************************************x***************************x******", "********************************0***************0******************************************************************************", "********************************1****************1*****************************************************************************", "********************************2*****************2****************************************************************************", "********************************3******************3***************************************************************************", "********************************4*******************4**************************************************************************", "********************************5********************5*************************************************************************", "********************************6*********************6************************************************************************", "********************************7**********************7***********************************************************************", "********************************8***********************8**********************************************************************", "********************************9************************9*********************************************************************", "********************************:*************************:********************************************************************", "********************************;**************************;*******************************************************************", "********************************<***************************<******************************************************************", "********************************=****************************=*****************************************************************", "********************************>*****************************>****************************************************************", "********************************?******************************?***************************************************************", "********************************@*******************************@**************************************************************", "********************************A********************************A*************************************************************", "********************************B*********************************B************************************************************", "********************************C**********************************C***********************************************************", "********************************D***********************************D**********************************************************", "********************************E************************************E*********************************************************", "********************************F*************************************F********************************************************", "********************************G**************************************G*******************************************************", "********************************H***************************************H******************************************************", "********************************I****************************************I*****************************************************", "********************************J*****************************************J****************************************************", "********************************K******************************************K***************************************************", "********************************L*******************************************L**************************************************", "********************************M********************************************M*************************************************", "********************************N*********************************************N************************************************", "********************************O**********************************************O***********************************************", "********************************P***********************************************P**********************************************", "********************************Q************************************************Q*********************************************", "********************************R*************************************************R********************************************", "********************************S**************************************************S*******************************************", "********************************T***************************************************T******************************************", "********************************U****************************************************U*****************************************", "********************************V*****************************************************V****************************************", "********************************W******************************************************W***************************************", "********************************X*******************************************************X**************************************", "********************************Y********************************************************Y*************************************", "********************************Z*********************************************************Z************************************", "********************************[**********************************************************[***********************************", "********************************\\**************x********************************************\\***************************x******", "********************************]************************************************************]*********************************", "********************************^*************************************************************^********************************", "********************************_**************************************************************_*******************************", "********************************`***************************************************************`******************************", "********************************a****************************************************************a*****************************", "********************************b*****************************************************************b****************************", "********************************c******************************************************************c***************************", "********************************d*******************************************************************d**************************", "********************************e********************************************************************e*************************", "********************************f*********************************************************************f************************", "********************************g**********************************************************************g***********************", "********************************h***********************************************************************h**********************", "********************************i************************************************************************i*********************", "********************************j*************************************************************************j********************", "********************************k**************************************************************************k*******************", "********************************l***************************************************************************l******************", "********************************m****************************************************************************m*****************", "********************************n*****************************************************************************n****************", "********************************o******************************************************************************o***************", "********************************p*******************************************************************************p**************", "********************************q********************************************************************************q*************", "********************************r*********************************************************************************r************", "********************************s**********************************************************************************s***********", "********************************t***********************************************************************************t**********", "********************************u************************************************************************************u*********", "********************************v*************************************************************************************v********", "********************************w**************************************************************************************w*******", "********************************x**************x********************************************x***************************x******", "********************************y****************************************************************************************y*****", "********************************z*****************************************************************************************z****", "********************************{******************************************************************************************{***", "********************************|**********+*+******************************************************************************|**", "********************************}********************************************************************************************}*", "********************************~*********************************************************************************************~", }; char scratch[100][100]; #define order(x,y,t) (x < y) ? 0:swap(x,y,t) #define swap(x,y,t) (t = x, x = y, y = t) #define combine(x,y,c) scratch[y][x] = f[(int)(unsigned char)scratch[y][x]][(int)(unsigned char)c] #define fori(i,j,k) for (i = j; i <= k; i++) #define guji int i void point(int x, int y) { combine(x,y,'o'); } void clear(int x1, int y1, int x2, int y2) { guji; order(x1,x2,i); order(y1,y2,i); fori(i,y1,y2) { memset(scratch[i] + x1,' ',x2-x1 + 1); } } void text(int x, int y, char *text) { while (*text && x <= X) { combine(x,y,*text++); x++; } } void verline(int x, int y1, int y2) { guji; order(y1,y2,i); fori(i,y1,y2) { combine(x,i,'|'); } } void horline(int x1, int x2, int y) { guji; order(x1,x2,i); fori(i,x1,x2) { combine(i,y,'-'); } } void downline(int x1, int x2, int y) { guji; fori(i,x1,x2) { combine(i,y + i - x1,'\\'); } } void upline(int x1, int x2, int y) { guji; fori(i,x1,x2) { combine(i,y - i + x1,'/'); } } void line(int x1, int y1, int x2, int y2) { if (x1 == x2) { verline(x1,y1,y2); } else if (y1 == y2) { horline(x1,x2,y1); } else if (x1 < x2) { if (y1 < y2) { downline(x1,x2,y1); } else upline(x1,x2,y1); } else { guji; swap(x1,x2,i); swap(y1,y2,i); if (y1 < y2) { downline(x1,x2,y1); } else upline(x1,x2,y1); } } void out(void) { int i; printf("+%.*s+\n",X,banner); fori(i,1,Y) printf("|%s|\n",scratch[i]+1); printf("+%.*s+\n\n",X,banner); } int main(void) { int x1, y1, x2, y2; char cmd[1000]; while (1) { scanf("%d%d",&X,&Y); if (X == 0 && Y == 0) break; fori(y1,1,Y) { memset(scratch[y1],' ',X+1); scratch[y1][X+1] = 0; } while (1) { scanf("%s",cmd); dp(("before %s\n",cmd)); /*out();*/ switch (*cmd) { case 'T': scanf("%d %d %[^\n]\n",&x1,&y1,cmd); text(x1,y1,cmd); break; case 'C': scanf("%d %d %d %d\n",&x1,&y1,&x2,&y2); clear(x1,y1,x2,y2); break; case 'L': scanf("%d %d %d %d\n",&x1,&y1,&x2,&y2); line(x1,y1,x2,y2); break; case 'P': if (cmd[1] == 'R') goto pri; scanf("%d %d\n",&x1,&x2); point(x1,x2); break; } } pri: printf("+%.*s+\n",X,banner); fori(y1,1,Y) printf("|%s|\n",scratch[y1]+1); printf("+%.*s+\n\n",X,banner); } return 0; }