modelist.pas 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Program ModeList;
  2. { ***********************************************************************
  3. * This is example shows how to use p96AllocModeListTagList()
  4. *
  5. * tabt (Sat Dec 28 03:44:35 1996)
  6. *********************************************************************** }
  7. {
  8. Translated to fpc pascal.
  9. 2 Mars 2001.
  10. Updated for fpc 1.0.7
  11. 08 Jan 2003.
  12. [email protected]
  13. }
  14. uses exec, amigados, picasso96api, utility;
  15. Const
  16. template : pchar = 'Width=W/N,Height=H/N,Depth=D/N';
  17. vecarray : Array[0..2] of long = (0,0,0);
  18. Var
  19. ml : pList;
  20. width,
  21. height,
  22. depth : longint;
  23. rda : pRDArgs;
  24. mn : pP96Mode;
  25. Begin
  26. width:=640;
  27. height:=480;
  28. depth:=8;
  29. rda:=ReadArgs (template,@vecarray,Nil);
  30. If rda<>Nil Then Begin
  31. If vecarray[0] <> 0 then width := long(@vecarray[0]);
  32. If vecarray[1] <> 0 then height := long(@vecarray[1]);
  33. If vecarray[2] <> 0 then depth := long(@vecarray[2]);
  34. FreeArgs(rda);
  35. End;
  36. ml:=p96AllocModeListTags([P96MA_MinWidth, width,
  37. P96MA_MinHeight, height,
  38. P96MA_MinDepth, depth,
  39. TAG_DONE]);
  40. If ml<>Nil Then Begin
  41. mn := pointer(ml^.lh_Head);
  42. If mn <> Nil Then Begin
  43. While mn^.Node.ln_Succ <> Nil Do Begin
  44. Writeln (mn^.Description);
  45. mn := pointer(mn^.Node.ln_Succ);
  46. End;
  47. End;
  48. p96FreeModeList(ml);
  49. End Else
  50. Writeln ('Unable to allocate list.');
  51. End.