<commit_before>#include <stdio.h>
#include <stdlib.h>

#include "cc3.h"
#include "jpeglib.h"


static void capture_current_jpeg(FILE *f);
static void init_jpeg(void);
static void destroy_jpeg(void);

int main(void) {
  int i;
  FILE *f;

  // setup system    
  cc3_system_setup ();
  cc3_uart_init (0, 
		 CC3_UART_RATE_115200,
		 CC3_UART_MODE_8N1,
		 CC3_UART_BINMODE_TEXT);

  cc3_camera_init ();

  cc3_filesystem_init();

  //cc3_set_colorspace(CC3_YCRCB);
  cc3_set_resolution(CC3_HIGH_RES);
  // cc3_pixbuf_set_subsample (CC3_NEAREST, 2, 2);
  cc3_wait_ms(1000);

  // init jpeg
  init_jpeg();

  cc3_set_led(1);
  i = 0;
  while(true) {
    char filename[16];
    cc3_clr_led(1);
    while(!cc3_read_button());
    cc3_set_led(1);
  
   // Check if files exist, if they do then skip over them 
    do { 
      //    	snprintf(filename, 16, "c:/img%.5d.jpg", i);
    	// For virtual camera use this path...
        snprintf(filename, 16, "img%.5d.jpg", i);
        f = fopen(filename, "r");
    	if(f!=NULL ) { 
		printf( "%s already exists...\n",filename ); 
		i++; 
		fclose(f);
		}
    } while(f!=NULL);

    // print file that you are going to write to stderr
    fprintf(stderr,"%s\r\n", filename);
    f = fopen(filename, "w");
    if(f==NULL || i>200 )
    {
	cc3_set_led(3);
	printf( "Error: Can't open file\r\n" );
	while(1);<commit_msg>virt<commit_after>#include <stdio.h>
#include <stdlib.h>

#include "cc3.h"
#include "jpeglib.h"


static void capture_current_jpeg(FILE *f);
static void init_jpeg(void);
static void destroy_jpeg(void);

int main(void) {
  int i;
  FILE *f;

  // setup system    
  cc3_system_setup ();
  cc3_uart_init (0, 
		 CC3_UART_RATE_115200,
		 CC3_UART_MODE_8N1,
		 CC3_UART_BINMODE_TEXT);

  cc3_camera_init ();

  cc3_filesystem_init();

  //cc3_set_colorspace(CC3_YCRCB);
  cc3_set_resolution(CC3_HIGH_RES);
  // cc3_pixbuf_set_subsample (CC3_NEAREST, 2, 2);
  cc3_wait_ms(1000);

  // init jpeg
  init_jpeg();

  cc3_set_led(1);
  i = 0;
  while(true) {
    char filename[16];
    cc3_clr_led(1);
    while(!cc3_read_button());
    cc3_set_led(1);
  
   // Check if files exist, if they do then skip over them 
    do { 
#ifdef VIRTUAL_CAM
        snprintf(filename, 16, "img%.5d.jpg", i);
#else
	snprintf(filename, 16, "c:/img%.5d.jpg", i);
#endif
        f = fopen(filename, "r");
    	if(f!=NULL ) { 
		printf( "%s already exists...\n",filename ); 
		i++; 
		fclose(f);
		}
    } while(f!=NULL);

    // print file that you are going to write to stderr
    fprintf(stderr,"%s\r\n", filename);
    f = fopen(filename, "w");
    if(f==NULL || i>200 )
    {
	cc3_set_led(3);
	printf( "Error: Can't open file\r\n" );
	while(1);
{'fraction_non_alphanumeric': 0.15626168224299064, 'fraction_numerical': 0.0388785046728972, 'mean_word_length': 3.18125, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '7024601', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1095, 'n_words': 225}