1. Structures?

Has everyone lost there intrest in structures?
The following code works but is yet to be completed.
I won't complete it if I don't see any intrest in it.

    Lucius L. Hilley III

--Program name is "struct.ex"
--without type_check
--with trace

--trace(1)

sequence s_names, s_fields, s_data, s_var
sequence s_var_struct
s_names = {}
s_fields = {}
s_data = {}
s_var = {}
s_var_struct = {}

----function "Lucius L. Hilley III"()
global procedure struct(sequence structure, sequence fields)
  sequence msg

  if find(structure, s_names) then
    msg = "Attempt to redefine struct: " & structure & 10
    msg = msg & "\t for detailed information view ex.err"
    machine_proc(37, msg)
    ? 1/0
  else
    s_names = append(s_names, structure)
    s_fields = append(s_fields, fields)
  end if
end procedure
-------------------------------------------------------
global procedure assign(sequence var, object data)
  integer f, name, field

  f = find('.', var)
  if f then
    name = find(var[1..f-1], s_var)
    field = find(var[f+1..length(var)], s_fields[s_var_struct[name]])
    s_data[name][field] = data
  else
    name = find(var, s_var)
    s_data[name][1..length(s_data[name])] = data
  end if
end procedure
-------------------------------------------------------
global function value_of(sequence var)
  integer f, name, field

  f = find('.', var)
  if f then
    name = find(var[1..f-1], s_var)
    field = find(var[f+1..length(var)], s_fields[s_var_struct[name]])
    return s_data[name][field]
  else
    name = find(var, s_var)
    return s_data[name]
  end if
end function
-------------------------------------------------------
global procedure init_var(sequence var, sequence structure)
  integer f
  sequence msg

  if find(var, s_var) then
    msg = "Attempt to redefine var: " & var & 10
    msg = msg & "\t for detailed information view ex.err"
    machine_proc(37, msg)
    ? 1/0
  else
    f = find(structure, s_names)
    if f = 0 then
      msg = "Structure " & structure & " not defined." & 10
      msg = msg & "\t for detailed information view ex.err"
      machine_proc(37, msg)
      ? 1/0
    end if
    s_var = append(s_var, var)
    s_var_struct = append(s_var_struct, find(structure, s_names))
    s_data = append(s_data, repeat(0, length(s_fields[f])))
  end if
end procedure
-------------------------------------------------------
global procedure del_var(sequence var)
  integer f, l

  f = find(var, s_var)
  if f then
    l = length(s_var)
    s_var = s_var[1..f-1] & s_var[f+1..l]
    s_data = s_data[1..f-1] & s_data[f+1..l]
    s_var_struct = s_var_struct[1..f-1] & s_var_struct[f+1..l]
  end if
end procedure
-------------------------------------------------------

struct("employee", {"name", "wage"})
struct("animal", {"name", "birthyear", "sex"})

init_var("cat", "animal")
init_var("dog", "animal")
assign("cat", {"Ki Ki", 1998, "male"})

assign("dog.name", "Sierra")
assign("dog.birthyear", 0)
assign("dog.sex", "female")

puts(1, value_of("cat.name")) puts(1, 10)
? value_of("cat.birthyear")
puts(1, value_of("cat.sex")) puts(1, {10, 10})

puts(1, value_of("dog.name")) puts(1, 10)
? value_of("dog.birthyear")
puts(1, value_of("dog.sex")) puts(1, {10, 10})

? value_of("cat")

new topic     » topic index » view message » categorize

2. Re: Structures?

Don't you think that this solution would be a little slow to do in
real-time?
I mean, if one had a 3D-object defined by a structure:

struct d3point {
int X
int Y
int Z
}

(hope you understand C...)


Then you would have to call the assign and value_of routines in
real-time, wich I think would take way to much time to get any nice and
smooth graphics.
I must admit that it could be easier (or it would look better anyway) to
use your struct routines instead of something like this:

sequence point
point=repeat(0,3)
constant X=1
constant Y=2
constant Z=3

and then refer to the three space-coordinates as point[X], point[Y] and
point[Z]. But this "standard" solution would certainly be faster.

But then ofcourse, maybe your routines weren't ment to be used for
things like that...(?)



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Structures?

On Tue, 19 Jan 1999 04:06:17 PST, stab master <stabmaster_ at HOTMAIL.COM>
wrote:

>Don't you think that this solution would be a little slow to do in
>real-time?

Yes.  I wrote these incomplete routines for the ease of use of
structures where structures maybe used quite frequently such as
Windows programming.  I wrote them simply to make the programming
look more elegant.  I am aware that they do suffer major speed
problems.  However, I have had intentions that IF I complete these
routines the following features will also be included.  A great
Speed increase for both assign() and value_of().  Type checking
of values that are stored within the structure.

IE: It will be possible to create a structure that contains an
atom or user defined number as the first element of a
structure/sequence and a sequence as the element of the second
structure.  Granted this part is already possible but one would be
capable of ensuring that a sequence is never written to the first
element.

>I mean, if one had a 3D-object defined by a structure:
>
>struct d3point {
>int X
>int Y
>int Z
>}
>
>(hope you understand C...)
>
>
>Then you would have to call the assign and value_of routines in
>real-time, wich I think would take way to much time to get any nice and
>smooth graphics.

I see you look to possibly make use of it in a high graphics medium,
possibly a game.  I will and do currently warn that these routines
are dreadfully slow and should not be used in areas where speed is
crucial/critical.  I do plan to make the routines faster than they
currently sit, If i finish it, But they aren't built-in as they should
be and therefore can never be near fast enough for what is required
for programming that relies heavily on high-speed.  Built-in routines
are definately the end result hoped for here.

  If enough people want these routines to exist then they will be
completed.  Also they, once completed, will be sent to Robert so that
he can keep track of just how much these routines are wanted.  If they
are truely desired amongst many programmers then I feel it is possible
for them to become built-in routines that would be fast enough for use
with high-speed graphics.

>I must admit that it could be easier (or it would look better anyway) to
>use your struct routines instead of something like this:
>
>sequence point
>point=repeat(0,3)
>constant X=1
>constant Y=2
>constant Z=3
>
>and then refer to the three space-coordinates as point[X], point[Y] and
>point[Z]. But this "standard" solution would certainly be faster.
>
>But then ofcourse, maybe your routines weren't ment to be used for
>things like that...(?)
>
>
    PS: Sorry about the novel above.
        Lucius L. Hilley III

Dead Western Digital drive was Manufactured in August 98 and no
longer functions.  *UPDATE* is being replaced under warranty by
Western Digital.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Structures?

I don't know if one person counts for much, but I'm intrerested.

Bret Belgarde

Lucius Hilley III wrote:

> Has everyone lost there intrest in structures?
> The following code works but is yet to be completed.
> I won't complete it if I don't see any intrest in it.
>
>     Lucius L. Hilley III
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: Structures?

I'll second that.

-----Original Message-----
From: Euphoria Programming for MS-DOS
[mailto:EUPHORIA at LISTSERV.MUOHIO.EDU]On Behalf Of Bret Belgarde
Sent: Tuesday, January 19, 1999 10:31 AM
To: EUPHORIA at LISTSERV.MUOHIO.EDU
Subject: Re: Structures?


I don't know if one person counts for much, but I'm intrerested.

Bret Belgarde

Lucius Hilley III wrote:

> Has everyone lost there intrest in structures?
> The following code works but is yet to be completed.
> I won't complete it if I don't see any intrest in it.
>
>     Lucius L. Hilley III
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu