Below is a simplified version of the main procedure in hodgepack2. It first computes the Poincare polynomial, then picks out the needed coefficients and stuffs them into a list which is returned as the value of WH( W, d ).
# WH( W, d ) = Hodge numbers of
WH := proc( W, d )
# Local variables
# q+1 = order of pole for rational differential
# n = dimension of variety
# POP = Poincare polynomial
# HL = list of Hodge numbers
# k = degree in Jacobian ring = degree of term in Poincare polynomial
# vdeg = weight of volume form in numerator
local q, n, POP, HL, k, vdeg, kk;
vdeg := sumlist(W);
POP := pj(W,d);
HL := [];
for q from 0 to n do
k := (q+1)*d - vdeg;
HL := [ op(HL), coeff( POP, t, k) ];
od;
HL;
end: