(defun fix-f2c ()
  "Fixup C code converted from Fortran by f2c."
  (interactive)
  (replace-string "doublereal" "float" t (point-min) (point-max))
  (replace-string "real" "float" t (point-min) (point-max))
  (replace-string "cuthi" "CUTHI" t (point-min) (point-max))
  (replace-string "cutlo" "CUTLO" t (point-min) (point-max))
  (replace-string "zero" "ZERO" t (point-min) (point-max))
  (replace-string "two" "TWO" t (point-min) (point-max))
  (replace-string "one" "ONE" t (point-min) (point-max))
  (replace-string "alog1p_" "alog1p" t (point-min) (point-max))
  (replace-string "(float)" "" nil (point-min) (point-max))

  (goto-char (point-min))
  (while (re-search-forward "[^0-9][.][0-9]+\\(e[-+][0-9]+\\)?" nil t)
    (goto-char (1+ (match-beginning 0)))
    (insert "0"))

  (goto-char (point-min))
  (while (re-search-forward "[0-9]+[.][^0-9]" nil t)
    (goto-char (1- (match-end 0)))
    (insert "0"))

  (goto-char (point-min))
  (while (re-search-forward "[.][0-9]+\\(e[-+][0-9]+\\)?" nil t)
    (insert "F"))
  (goto-char (point-min)))

