Like LU RD said the tomes of delphi covers this algorithm.
You'll have to buy the book, here's a link: http://www.lulu.com/shop/julian-bucknall/the-tomes-of-delphi-algorithms-and-data-structures/paperback/product-488272.html;jsessionid=5CCED10CCFDCB82897E853208BA6460A
However the sourcecode that accompanies the book is freely available; you can download the sourcecode here: http://www.boyet.com/Code/ToDADS_source.zip
Shannon-Fano is not implemented, but the closely related huffman code is see: TDHuffmn.pas.
Here's an implementation of Shannon-Fano in C: http://cppgm.blogspot.com/2008/01/shano-fano-code.html
You simple translate the code from C into Delphi.
Starting with:
{$APPTYPE CONSOLE}
{$R *.res}
uses SysUtils;
type
node = record
sym: array[0..9] of char
pro: real;
arr: array[0..19] of integer;
top: integer;
end;
var
s: array[0..19] of node;
procedure prints(l,h: integer; s: array of node);
var
i: integer;
output: string;
begin
for i:= l to h do begin
output:= format('\n%s\t%f',s[i].sym,s[i].pro);
writeln(output);
end; {for i}
end;
procedure shannon(l,h: integer; s: array of node);
var
pack1,pack2, diff1, diff2: real;
i,d,k,j: integer;
begin
pack1=0; pack2=0; diff1=0; diff2=0;
if (((l+1)=h) or (l=h) or (l>h)) then begin
if ((l=h) or (l>h)) then
and continuing from there.
It's a pretty straightforward translation.