1. null as a valid data

Robert, can you introduce null as a valid data, so that the following would
work?:

-- program
sequence string, test

global procedure testchars
atom nulltestchar
 if ( string[24] = 'f' ) then 
  test = dosomething(string[22]) 
 end if
 test = dosomething(atom)
end procedure -- testchars

function dosomething(sequence data)
  if ( data != null ) then puts(1,data&CRLF) end if
end function -- dosomething

string = "this is 21 chars long"
testchars
-- end program

Kat

new topic     » topic index » view message » categorize

2. Re: null as a valid data

Just create your own atom null and set it equal to 0.  If you are reading =
bytes from an input stream or a binary file, C-style strings are standardly=
 terminated with #00.

>>> gertie at PELL.NET 02/09/01 01:50PM >>>
Robert, can you introduce null as a valid data, so that the following =
would work?:

-- program
sequence string, test

global procedure testchars
atom nulltestchar
 if ( string[24] =3D 'f' ) then=20
  test =3D dosomething(string[22])=20
 end if
 test =3D dosomething(atom)
end procedure -- testchars

function dosomething(sequence data)
  if ( data !=3D null ) then puts(1,data&CRLF) end if
end function -- dosomething

string =3D "this is 21 chars long"
testchars
-- end program

Kat

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

3. Re: null as a valid data

On 9 Feb 2001, at 11:31, Michael  Sabal wrote:

> Just create your own atom null and set it equal to 0.  If you are reading
> bytes from an
> input stream or a binary file, C-style strings are standardly terminated with
> #00.

And how will that solve the examples i gave?

Kat

> >>> gertie at PELL.NET 02/09/01 01:50PM >>>
> Robert, can you introduce null as a valid data, so that the following would
> work?:
> 
> -- program
> sequence string, test
> 
> global procedure testchars
> atom nulltestchar
>  if ( string[24] = 'f' ) then 
>   test = dosomething(string[22]) 
>  end if
>  test = dosomething(atom)
> end procedure -- testchars
> 
> function dosomething(sequence data)
>   if ( data != null ) then puts(1,data&CRLF) end if
> end function -- dosomething
> 
> string = "this is 21 chars long"
> testchars
> -- end program
> 
> Kat
> 
> 
> 
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu