On Thu, 2010-05-27 at 18:45 +0100, Peter Clifton wrote: > You forget all the development work which has not yet been merged, which > will now be presented with huge (and unnecessary) conflicts. I didn't know that it was a significant amount. Now I do :) > If you had an automated script for performing the conversions, it might > mitigate that. Sure. Find it attached. Sequence of application: 1. Apply stdbool-include.patch to add the stdbool.h include and remove the typedef. 2. Run rename-bool.sh with the pcb source as the working dir. This replaces switches all .c and .h files over to using bool, true, and false. It then goes to work on the .y and .l files. My sed fu is weak, so it only does the replacement in the top and bottom sections of those files. There is not much to change in the middle sections, and step 3 sorts it out. 3. Apply parse_y.y-finish-bool-conv.patch -- This does the remaining (small amount) of conversion required. The reason I haven't extended the script to work on the middle sections of the .y and .l files is that I don't think the amount of work involved in parsing them is necessary. If someone does have some huge changes queued to the .y or .l files (and I suspect they don't) then we can work that out. Cheers, Rob
From 1fe097f0ad591332b8bb3804630a9db607c91bdf Mon Sep 17 00:00:00 2001 From: Robert Spanton <rspanton@xxxxxxxxxx> Date: Thu, 27 May 2010 21:26:25 +0100 Subject: [PATCH 1/3] Remove Boolean typedef and include stdbool.h --- src/global.h | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/src/global.h b/src/global.h index 1082dd1..d099d42 100644 --- a/src/global.h +++ b/src/global.h @@ -49,6 +49,7 @@ #include <math.h> #include <ctype.h> #include <sys/types.h> +#include <stdbool.h> /* Forward declarations for structures the HIDs need. */ typedef struct BoxType BoxType, *BoxTypePtr; @@ -68,7 +69,6 @@ typedef int BDimension; /* big dimension */ #ifndef XtSpecificationRelease typedef unsigned int Cardinal; -typedef char Boolean; /*typedef unsigned int Pixel;*/ typedef char *String; typedef short Position; @@ -76,9 +76,6 @@ typedef short Dimension; #endif typedef unsigned char BYTE; -#define True 1 -#define False 0 - /* Nobody should know about the internals of this except the macros in macros.h that access it. This structure must be simple-assignable for now. */ -- 1.7.0.1
From 9d74f050560b51d30de4fbcb8704a95c2745c8df Mon Sep 17 00:00:00 2001 From: Robert Spanton <rspanton@xxxxxxxxxx> Date: Thu, 27 May 2010 21:30:43 +0100 Subject: [PATCH 3/3] Convert parse_y.y True and False over to C99 true and false. --- src/parse_y.y | 42 +++++++++++++++++++++--------------------- 1 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/parse_y.y b/src/parse_y.y index 22265f6..aad3baf 100644 --- a/src/parse_y.y +++ b/src/parse_y.y @@ -151,7 +151,7 @@ parsepcb YYABORT; } for (i = 0; i < MAX_LAYER + 2; i++) - LayerFlag[i] = False; + LayerFlag[i] = false; yyFont = &yyPCB->Font; yyData = yyPCB->Data; yyData->pcb = (void *)yyPCB; @@ -196,8 +196,8 @@ parsepcb | { PreLoadElementPCB (); layer_group_string = NULL; } element - { LayerFlag[0] = True; - LayerFlag[1] = True; + { LayerFlag[0] = true; + LayerFlag[1] = true; yyData->LayerN = 2; PostLoadElementPCB (); } @@ -216,7 +216,7 @@ parsedata YYABORT; } for (i = 0; i < MAX_LAYER + 2; i++) - LayerFlag[i] = False; + LayerFlag[i] = false; yyData->LayerN = 0; } pcbdata @@ -238,13 +238,13 @@ parsefont Message("illegal fileformat\n"); YYABORT; } - yyFont->Valid = False; + yyFont->Valid = false; for (i = 0; i <= MAX_FONTPOSITION; i++) - yyFont->Symbol[i].Valid = False; + yyFont->Symbol[i].Valid = false; } symbols { - yyFont->Valid = True; + yyFont->Valid = true; SetFontInfo(yyFont); } ; @@ -363,9 +363,9 @@ pcbgridnew yyPCB->GridOffsetX = $4*100; yyPCB->GridOffsetY = $5*100; if ($6) - Settings.DrawGrid = True; + Settings.DrawGrid = true; else - Settings.DrawGrid = False; + Settings.DrawGrid = false; } ; @@ -376,9 +376,9 @@ pcb2grid yyPCB->GridOffsetX = $4*100; yyPCB->GridOffsetY = $5*100; if ($6) - Settings.DrawGrid = True; + Settings.DrawGrid = true; else - Settings.DrawGrid = False; + Settings.DrawGrid = false; } ; pcbhigrid @@ -388,9 +388,9 @@ pcbhigrid yyPCB->GridOffsetX = $4; yyPCB->GridOffsetY = $5; if ($6) - Settings.DrawGrid = True; + Settings.DrawGrid = true; else - Settings.DrawGrid = False; + Settings.DrawGrid = false; } ; @@ -861,7 +861,7 @@ layer /* memory for name is already allocated */ Layer->Name = $4; - LayerFlag[$3-1] = True; + LayerFlag[$3-1] = true; if (yyData->LayerN + 2 < $3) yyData->LayerN = $3 - 2; } @@ -1222,7 +1222,7 @@ element_oldformat : T_ELEMENT '(' STRING STRING NUMBER NUMBER NUMBER ')' '(' { yyElement = CreateNewElement(yyData, yyElement, yyFont, NoFlags(), - $3, $4, NULL, $5*100, $6*100, $7, 100, NoFlags(), False); + $3, $4, NULL, $5*100, $6*100, $7, 100, NoFlags(), false); SaveFree($3); SaveFree($4); pin_num = 1; @@ -1240,7 +1240,7 @@ element_1.3.4_format : T_ELEMENT '(' NUMBER STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER ')' '(' { yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3), - $4, $5, NULL, $6*100, $7*100, $8, $9, OldFlags($10), False); + $4, $5, NULL, $6*100, $7*100, $8, $9, OldFlags($10), false); SaveFree($4); SaveFree($5); pin_num = 1; @@ -1258,7 +1258,7 @@ element_newformat : T_ELEMENT '(' NUMBER STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER ')' '(' { yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3), - $4, $5, $6, $7*100, $8*100, $9, $10, OldFlags($11), False); + $4, $5, $6, $7*100, $8*100, $9, $10, OldFlags($11), false); SaveFree($4); SaveFree($5); SaveFree($6); @@ -1278,7 +1278,7 @@ element_1.7_format NUMBER NUMBER NUMBER NUMBER NUMBER ')' '(' { yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3), - $4, $5, $6, ($7+$9)*100, ($8+$10)*100, $11, $12, OldFlags($13), False); + $4, $5, $6, ($7+$9)*100, ($8+$10)*100, $11, $12, OldFlags($13), false); yyElement->MarkX = $7*100; yyElement->MarkY = $8*100; SaveFree($4); @@ -1299,7 +1299,7 @@ element_hi_format NUMBER NUMBER NUMBER NUMBER flags ']' '(' { yyElement = CreateNewElement(yyData, yyElement, yyFont, $3, - $4, $5, $6, ($7+$9), ($8+$10), $11, $12, $13, False); + $4, $5, $6, ($7+$9), ($8+$10), $11, $12, $13, false); yyElement->MarkX = $7; yyElement->MarkY = $8; SaveFree($4); @@ -1690,7 +1690,7 @@ symbol yyerror("symbol ID used twice"); YYABORT; } - Symbol->Valid = True; + Symbol->Valid = true; Symbol->Delta = $4; } symboldata ')' @@ -1707,7 +1707,7 @@ symbol yyerror("symbol ID used twice"); YYABORT; } - Symbol->Valid = True; + Symbol->Valid = true; Symbol->Delta = $4*100; } symboldata ')' -- 1.7.0.1
Attachment:
rename-bool.sh
Description: application/shellscript
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ geda-user mailing list geda-user@xxxxxxxxxxxxxx http://www.seul.org/cgi-bin/mailman/listinfo/geda-user