Prof A Olowofoyeku (The African Chief) a écrit:
Ok folks, nearly there. How does one translate this to GPC? (I would hate to have to do it manually - but I am not sure how one can initialise an array of records on declaration like this):
struct hershey_word demo_word[NUM_DEMO_WORDS] = { {"Invitation", "HersheyScript-Bold", { 1., 0., 0., 1., -3125., 3980. }, 'l' }, {"ECONOMY", "HersheySans", { 1., 0., 0., 1., -3125., 3340. }, 'l'}, {"CARTOGRAPHY", "HersheySans", { CART, 0., 0., CART, -3125., 2700. }, 'l'}, {"Gramma", "HersheySerifSymbol", { 1., 0., 0., 1., -3125., 2060. }, 'l'}, {"\347\322\301\306\311\313\301", "HersheyCyrillic", { 1., 0., 0., 1., -3125., 1420. }, 'l'},
{"COMMUNICATION", "HersheySans-Bold", { 1., 0., 0., 1., 0., 3980. }, 'c'}, {"VERSATILITY", "HersheySerif-Italic", { 1., 0., 0., 1., 0., 3340. }, 'c'}, {"Standardization", "HersheySerif", { 1., 0., 0., 1., 0., 2700. }, 'c'}, {"Sumbolon", "HersheySerifSymbol", { INDEXICAL, 0., 0., INDEXICAL, 0., 2060. }, 'c'}, {"\363\354\357\366\356\357\363\364\370", "HersheyCyrillic", { 1., 0., 0., 1., 0., 1420. }, 'c'}, };
BTW: this is the declaration of the struct; struct hershey_word { char *word; char *fontname; double m[6]; char just; };
The following compiles ----------------------------------------------------------------------- program translate;
const NUM_DEMO_WORDS=10; CART = 1.0; {guessed} INDEXICAL=2.0; {dito}
type hershey_word = record word: CString; fontname: CString; m: array [0..5] of double; just: char; end;
var demo_word : array [0..NUM_DEMO_WORDS-1] of hershey_word = ( ('Invitation', 'HersheyScript-Bold', ( 1.0, 0.0, 0.0, 1.0, -3125.0, 3980.0 ), 'l' ), ('ECONOMY', 'HersheySans', ( 1.0, 0.0, 0.0, 1.0, -3125.0, 3340.0 ), 'l'), ('CARTOGRAPHY', 'HersheySans', ( CART, 0.0, 0.0, CART, -3125.0, 2700.0 ), 'l'), ('Gramma', 'HersheySerifSymbol', ( 1.0, 0.0, 0.0, 1.0, -3125.0, 2060.0 ), 'l'), (chr(8#347)+chr(8#322)+chr(8#301)+chr(8#306)+chr(8#311)+chr(8#313)+chr(8#301), 'HersheyCyrillic', ( 1.0, 0.0, 0.0, 1.0, -3125.0, 1420.0 ), 'l'), ('COMMUNICATION', 'HersheySans-Bold', ( 1.0, 0.0, 0.0, 1.0, 0.0, 3980.0 ), 'c'), ('VERSATILITY', 'HersheySerif-Italic', ( 1.0, 0.0, 0.0, 1.0, 0.0, 3340.0 ), 'c'), ('Standardization', 'HersheySerif', ( 1.0, 0.0, 0.0, 1.0, 0.0, 2700.0 ), 'c'), ('Sumbolon', 'HersheySerifSymbol', ( INDEXICAL, 0.0, 0.0, INDEXICAL, 0.0, 2060.0 ), 'c'), (chr(8#363)+chr(8#354)+chr(8#357)+chr(8#366)+chr(8#356)+chr(8#357)+chr(8#363)+chr(8#364)+chr(8#370), 'HersheyCyrillic', ( 1.0, 0.0, 0.0, 1.0, 0.0, 1420.0 ), 'c') );
begin end. -------------------------------------------------------------------- Obtained basically with some search and replace in my editor (regex aware). The only tricky part is the replacement of octal numbers.
Maurice