Re: eGui idea: Iup Pre-Installed with Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message
_tom said...

I have uploaded twelve demo programs. These are IUP examples, originally written in C that come with the IUP source-code, converted to Euphoria. (oE4.1 required.)

Here is another example converted from one of Jeremy Cowgar's EuIUP examples.

-- 
-- Copyright (C) 2008-2010 by Jeremy Cowgar <jeremy@cowgar.com> 
-- 
-- This file is part of EuIup. 
-- 
-- EuIup is free software: you can redistribute it and/or modify 
-- it under the terms of the GNU Lesser General Public License as 
-- published by the Free Software Foundation, either version 3 of 
-- the License, or (at your option) any later version. 
-- 
-- EuIup is distributed in the hope that it will be useful, 
-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
-- GNU General Public License for more details. 
-- 
-- You should have received a copy of the GNU Lesser General Public 
-- License along with EuIup.  If not, see <http://www.gnu.org/licenses/>. 
-- 
 
include std/sequence.e 
include std/iup.e 
 
procedure main( sequence cmd = command_line() ) 
 
  sequence argv = cmd[3..$] 
  integer argc = length( argv ) 
 
  IupOpen( argc, argv ) 
  sequence greetings = { "Hello", "Goodbye", "What's Up?", "Cya" } 
 
  -- an empty string to pad memory 
  sequence empty = repeat( 0, 255 ) 
 
  sequence fields = { 
    "Greeting: %o|Hello|Goodbye|What's Up?|Cya|", 
    "Name: %s", 
    "Times: %i" 
  } 
 
  sequence params = { 
    allocate_data( 4, 1 ), 
    allocate_string( empty, 1 ), 
    allocate_data( 4, 1 ) 
  } 
 
  sequence text = "World" 
 
  poke4( params[1], 0 ) 
  poke(  params[2], text ) 
  poke4( params[3], 5 ) 
 
  atom result = IupGetParam( "Say Hello", NULL, NULL, 
    stdseq:join(fields, "\n"), length(fields), 0, params ) 
 
  if result = 0 then 
    -- user cancelled 
    return 
  end if 
 
  atom num, nb 
  num   = peek4u( params[1] ) 
  text  = peek_string( params[2] ) 
  nb    = peek4u( params[3] ) 
 
  for i = 1 to nb do 
    printf(1, "%s, %s!\n", { greetings[num + 1], text }) 
  end for 
 
  IupClose() 
 
end procedure 
 
main() 

Jean-Marc

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu