<commit_before>/* 
   (c) COPYRIGHT URI/MIT 1997-98
   Please read the full copyright statement in the file COPYRIGHT.
   Authors: reza (<NAME>)
*/

#include "config_ff.h"

static char rcsid[] not_used ={"$Id$"};

#include <freeform.h>

#include "debug.h"

/** Read from a file/database using the FreeForm API. Data values are read
    using an input file descriptor and written using an output format 
    description.
    @param dataset The name of the file/database to read from
    @param if_file The input format descriptor
    @param o_format The output format description
    @param o_buffer Value-result parameter for the data
    @param bsize Size of the buffer in bytes */
long
read_ff(const char *dataset, const char *if_file, const char *o_format, 
        char *o_buffer, unsigned long bsize)
{
#if 0
    int error = 0;
#endif
    FF_BUFSIZE_PTR newform_log = NULL;
    FF_BUFSIZE_PTR bufsz = NULL;
    FF_STD_ARGS_PTR std_args = NULL;
  
    std_args = ff_create_std_args();
    if (!std_args) {
#if 0
	error = ERR_MEM_LACK;
#endif
	goto main_exit;
    }

    /* set the std_arg structure values - cast away const for dataset, if_file,
     * and o_format.*/
    std_args->error_prompt = FALSE;
    std_args->user.is_stdin_redirected = 0;
    std_args->input_file = (char*)(dataset);
    std_args->input_format_file = (char*)(if_file);
    std_args->output_file = NULL;
    std_args->output_format_buffer = (char*)(o_format);
    std_args->log_file = "/dev/null"; 
    /* Define DBG (as per dap/debug.h) to get a log file from FreeForm. 9/8/98
       jhrg */
    DBG(std_args->log_file = "/tmp/ffdods.log"); 

    bufsz = (FF_BUFSIZE_PTR)memMalloc(sizeof(FF_BUFSIZE), "bufsz");
    if (!bufsz) {
#if 0
	error = ERR_MEM_LACK;
#endif	goto main_exit;
    }
    
    bufsz->usage = 1;
    bufsz->buffer = o_buffer;
    bufsz->total_bytes = (FF_BSS_t)bsize;
    bufsz->bytes_used = (FF_BSS_t)0;
    std_args->output_bufsize = bufsz; 
  
    newform_log = ff_create_bufsize(SCRATCH_QUANTA);
    if (!newform_log) {
#if 0
	error = ERR_MEM_LACK;
#endif<commit_msg>Fixed edit snafu.<commit_after>/* 
   (c) COPYRIGHT URI/MIT 1997-98
   Please read the full copyright statement in the file COPYRIGHT.
   Authors: reza (<NAME>)
*/

#include "config_ff.h"

static char rcsid[] not_used ={"$Id$"};

#include <freeform.h>

#include "debug.h"

/** Read from a file/database using the FreeForm API. Data values are read
    using an input file descriptor and written using an output format 
    description.
    @param dataset The name of the file/database to read from
    @param if_file The input format descriptor
    @param o_format The output format description
    @param o_buffer Value-result parameter for the data
    @param bsize Size of the buffer in bytes */
long
read_ff(const char *dataset, const char *if_file, const char *o_format, 
        char *o_buffer, unsigned long bsize)
{
#if 0
    int error = 0;
#endif
    FF_BUFSIZE_PTR newform_log = NULL;
    FF_BUFSIZE_PTR bufsz = NULL;
    FF_STD_ARGS_PTR std_args = NULL;
  
    std_args = ff_create_std_args();
    if (!std_args) {
#if 0
	error = ERR_MEM_LACK;
#endif
	goto main_exit;
    }

    /* set the std_arg structure values - cast away const for dataset, if_file,
     * and o_format.*/
    std_args->error_prompt = FALSE;
    std_args->user.is_stdin_redirected = 0;
    std_args->input_file = (char*)(dataset);
    std_args->input_format_file = (char*)(if_file);
    std_args->output_file = NULL;
    std_args->output_format_buffer = (char*)(o_format);
    std_args->log_file = "/dev/null"; 
    /* Define DBG (as per dap/debug.h) to get a log file from FreeForm. 9/8/98
       jhrg */
    DBG(std_args->log_file = "/tmp/ffdods.log"); 

    bufsz = (FF_BUFSIZE_PTR)memMalloc(sizeof(FF_BUFSIZE), "bufsz");
    if (!bufsz) {
#if 0
	error = ERR_MEM_LACK;
#endif	
        goto main_exit;
    }
    
    bufsz->usage = 1;
    bufsz->buffer = o_buffer;
    bufsz->total_bytes = (FF_BSS_t)bsize;
    bufsz->bytes_used = (FF_BSS_t)0;
    std_args->output_bufsize = bufsz; 
  
    newform_log = ff_create_bufsize(SCRATCH_QUANTA);
    if (!newform_log) {
#if 0
	error = ERR_MEM_LACK;
#endif
{'fraction_non_alphanumeric': 0.10859619552130989, 'fraction_numerical': 0.008668432458463762, 'mean_word_length': 3.278063851699279, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1390464', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1476, 'n_words': 411}