<commit_before>#include <stdio.h>
#include "spectrometer.h"
#include "spectroscopy.h"

int noOfMeasurementsLeft = 1000;
char * filename;

static void callback(sSpectrometerStruct * config);

int main(int argc, char *argv[])
{
	int status = 0;
	sSpectrometerStruct config;
	filename = argv[1];

	if (argc != 4) {
		printf("usage: spectrometer-cli <outputfile> <number of scans> <exposure time in ms>\n");
		return 1;
	}
	noOfMeasurementsLeft = strtol(argv[2], NULL, 10) + 1;
	config.integration_time_micros = strtol(argv[3], NULL, 10) * 1000;

	/* init */
	status = spectrometer_init(&config);
	if(status){
		printf("init spectrometer failed\n");
		return 1;
	}

	/* start callback loop */
	callback(&config);

	while(noOfMeasurementsLeft){
		sleepMs(100);
	}

	return 0;
}

static void callback(sSpectrometerStruct * config)
{
	int status;
	int i;
	FILE * pFile;

	printf("left %i \n", noOfMeasurementsLeft);

	noOfMeasurementsLeft--;
	if(noOfMeasurementsLeft) {
		spectrometer_trigger(config, callback);
	} else {
		printf("spectrum is %i long\n", config->spectrum_length);
		pFile = fopen(filename, "wt");
		if (pFile){
			printf("write to %s\n", filename);
			for(i=0; i < config->spectrum_length; i++){
				fprintf(pFile, "%f %f \n", config->lastSpectrum[i], config->wavelengths[i]);
			}
		}
		else{
			printf("Something wrong writing to File.\n");
		}

		/* uninit */
		status = spectrometer_uninit(config);
		if(status){
			printf("uninit failed");
		}
	}
	printf("done callback\n");
}<commit_msg>cleanup<commit_after>#include <stdio.h>
#include "spectrometer.h"
#include "spectroscopy.h"

int noOfMeasurementsLeft = 1000;
char * filename;

static void callback(sSpectrometerStruct * config);

int main(int argc, char *argv[])
{
	int status = 0;
	sSpectrometerStruct config;
	filename = argv[1];

	if (argc != 4) {
		printf("usage: spectrometer-cli <outputfile> <number of scans> <exposure time in ms>\n");
		return 1;
	}
	noOfMeasurementsLeft = strtol(argv[2], NULL, 10) + 1;
	config.integration_time_micros = strtol(argv[3], NULL, 10) * 1000;

	/* init */
	status = spectrometer_init(&config);
	if(status){
		printf("init spectrometer failed\n");
		return 1;
	}

	/* start callback loop */
	callback(&config);

	while(noOfMeasurementsLeft){
		sleepMs(100);
	}

	/* uninit */
	status = spectrometer_uninit(&config);
	if(status){
		printf("uninit failed");
	}

	return 0;
}

static void callback(sSpectrometerStruct * config)
{
	int status;
	int i;
	FILE * pFile;

	printf("left %i \n", noOfMeasurementsLeft);

	noOfMeasurementsLeft--;
	if(noOfMeasurementsLeft) {
		spectrometer_trigger(config, callback);
	} else {
		printf("spectrum is %i long\n", config->spectrum_length);
		pFile = fopen(filename, "wt");
		if (pFile){
			printf("write to %s\n", filename);
			for(i=0; i < config->spectrum_length; i++){
				fprintf(pFile, "%f %f \n", config->lastSpectrum[i], config->wavelengths[i]);
			}
		}
		else{
			printf("Something wrong writing to File.\n");
		}
	}
	printf("done callback\n");
}
{'fraction_non_alphanumeric': 0.15777184789859908, 'fraction_numerical': 0.01667778519012675, 'mean_word_length': 4.452727272727273, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '4105887', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1061, 'n_words': 252}