 }
 #endc
 
-
--- -- | Loading signatures
--- -- the c-function is:
--- -- rs_result rs_loadsig_file(FILE *, rs_signature_t **, rs_stats_t *);
--- {#fun unsafe rs_loadsig_file as cRSLoadSigFile
---       { id      `Ptr CFile'
---       , alloca- `SignaturePtr' peek*
---       , alloca- `StatsPtr'
---       } -> `Result' cIntToEnum
---  #}
-
 --------------------------------------------------------------------------------
 -- | Delta
 
-
-cGenDelta :: Handle -> FilePath -> Handle -> IO (Handle, Result)
+-- | Given a handle refering to the sginature, in (at least) binary Read mode,
+-- positioned at the beginning of the file, a file path to a file, and a handle
+-- in binary read write mode. Compute the delta, and write the result to the
+-- file indicated by the second handle. The handle is repositioned to the
+-- beginning of the file. The result of this function is a Maybe String
+-- indicating any error messages. Nothing means the operation succeeded.
+cGenDelta :: Handle -> FilePath -> Handle -> IO (Maybe String)
 cGenDelta sigHandle p deltaHandle = undefined
 
 

#c
// generate a delta, based on the implementation of rdiff
rs_result genDelta(int sigFd, char* filePath, int deltaFd) {
    FILE*           sigFile, f, deltaFile;
    rs_result       result;
    rs_signature_t* sumset;
    rs_stats_t      stats;

    sigFile   = fdopen(sigFd, "rb");
    f         = rs_open_file(filePath, "rb");
    deltaFile = fdopen(deltaFd, "wb");

    result = rs_loadsig_file(sigFile, &sumset, &stats);

-- call
#c
rs_result genSig(char* filePath, int fd) {
    FILE*      f;
    FILE*      sigFile;
    rs_stats_t stats;
    rs_result  result;

    f       = fopen(filePath, "rb");
    sigFile = fdopen(fd, "wb");

    result = rs_sig_file(f, sigFile,
                         RS_DEFAULT_BLOCK_LEN, RS_DEFAULT_STRONG_LEN, &stats);
    rs_file_close(f);

    // Note that we leave the sigfile open
