Measurement of the gluon fragmentation function and a comparison of the scaling violation in gluon and quark jets