fork download
  1. type
  2. users_t = (tarasB, superhackkiller1997, other_shit);
  3. say_ptr_t = procedure(str: PChar);
  4. const
  5. users: array[users_t] of PChar = ('tarasB', 'superhackkiller1997', 'other_shit');
  6.  
  7. procedure say(str: PChar; usr: users_t);
  8. begin
  9. Writeln(ErrOutput, users[usr] + ': ' + str)
  10. end;
  11. procedure say_tarasB(str: PChar);
  12. begin
  13. say(str, tarasB)
  14. end;
  15. procedure say_superhackkiller1997(str: PChar);
  16. begin
  17. say(str, superhackkiller1997)
  18. end;
  19. procedure say_other_shit(str: PChar);
  20. begin
  21. say(str, other_shit)
  22. end;
  23.  
  24. function bind(usr: users_t): say_ptr_t;
  25. begin
  26. case usr of
  27. tarasB:
  28. bind := @say_tarasB;
  29. superhackkiller1997:
  30. bind := @say_superhackkiller1997;
  31. other_shit:
  32. bind := @say_other_shit;
  33. else
  34. bind := @say_other_shit;
  35. end;
  36. end;
  37.  
  38. var
  39. p: say_ptr_t;
  40. begin
  41. p := bind(tarasB);
  42. p('shit');
  43. p := bind(superhackkiller1997);
  44. p('i''m god');
  45. p := bind(other_shit);
  46. p('ko-ko-ko');
  47. halt(0)
  48. end.
stdin
Standard input is empty
stdout
Standard output is empty
stderr
tarasB: shit
superhackkiller1997: i'm god
other_shit: ko-ko-ko