slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] SLANG functions within a C program help needed.


Ok, I am NOT sure how to phrase this question so that it makes perfect
sense, but here I goes .......

Inside of my SLAG modules, which are written in C, I need to be able to
perform a S-Lang function in a "call back" fashion. i.e.:

routine.sl\

import ("SlagModule", "Global" ) ;


variable datainput ;

define my_cute_routine ()
{
  do some processing here .....
  usually would be some sort of
  quick menu options ...
}

define paint_screen_one ()
{
   Paint the first screen ...
   Calls various SLAG screen routines ...
}

initSlag () ;      % C Routine to Init SLAG
paint_screen_one () ;

while (some sort of loop)
{
  datainput = slaginput ( ...parameters ..., "F4", @my_cute_routine ) ;
}

% Program End

In this Case, "F4" would represent to the positional parameter list the
function key that would trigger the C program to go back in and
execute within the S-lang program,  my_cute_routine. This is so that the
"C" program would never break out of the entry loop unless an end/enter key
was pressed, but allow certain function keys to do special functions, such
as "quick menu" selections. An example is of an order entry clerk
entering an order and a customer call comes in requesting stock availability,
so you, the programmer, have set up "quick menus" tied to function keys
so when the press F4, a "quick program selection" comes up. They choose "check
stock", the check stock program runs, and when you are finished, your current
screen gets 'restored' and you pick back off where you where. The stated "quick"
functions are all handled by the "my_cute_routine".

Can such a thing be done with S-Lang and C? Is there better or more efficient ways
to do this?

Thanks ....


--
Ben Duncan   - VersAccounting Software LLC 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
       - Hanlon's Razor


_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]