1. Conversions
- Posted by Vic <cybrgod at IBM.NET> Feb 17, 1997
- 1075 views
- Last edited Feb 18, 1997
Hello, I'm trying to write a program and wanted to know a little more about TYPE as in: type page_number(integer p) --from image.e return p >= 0 and p <= 7 end type Can anyone convert this from Turbo Pascal: ***************** TYPE Rat = Record x,y,z:integer; End; location = Record x,y:integer; End; ***************** Or this from C ***************** struct Rat { int x; int y; int z; } struct location { int x; int y; } **************** And after this how can convert this TP statement to Euphoria? **************** VAR Rats : Array [1..400] of Rat; Clean : Array [1..2,1..400] of location; **************** Thanks, /ViC./ ______________________________________________________________________ | http://www.geocities.com/SiliconValley/Heights/8858/home.htm | | Veni vidi, vici. Fiat lux. | |______________________________________________________________________|
2. Re: Conversions
- Posted by David Gay <moggie at INTERLOG.COM> Feb 17, 1997
- 1037 views
- Last edited Feb 18, 1997
> > Hello, > I'm trying to write a program and wanted to know a little more about > TYPE as in: Type allows you to create a user defined variable type. I don't think it is used to create structures. However, one could argue successfully that the sequence is in fact already a record structure. For example, look at this example code: const x = 1 const y = 2 const z = 3 sequence rat atom field_x, field_y, field_z rat = {{100,100,100}, {200,200,200}, {300,300,300}} field_x = rat[1][x] field_y = rat[1][y] field_z = rat[1][z] This example code treats sequence rat just like a record, with constants being used to define the fields. Notice that record 1's fields are being accessed. Hope this helps :) David Gay http://www.interlog.com/~moggie/Euphoria "A Beginner's Guide To Euphoria"