<commit_before>#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include "helper.h"
#include <chipmunk.h>

MODULE = Chipmunk::PolyShape	PACKAGE = Chipmunk::PolyShape	PREFIX = cppoly_
PROTOTYPES: ENABLE

cpShape*
cppoly_new(CLASS, body, verts, ...)
		char *CLASS
		cpBody *body
		SV *verts
	PREINIT:
	CODE:
		cpVect *offset;
		if (items > 3) {
			offset = sv_to_vect(ST(3));
		} else {
			Newx(offset, 1, cpVect);
			*offset = cpv((cpFloat)0.0, (cpFloat)0.0);
		}
		cpVect *_verts = sv_to_vect_array(verts);
		int num_verts = av_len((AV *)SvRV(verts)) + 1;
		if (!cpPolyValidate(_verts, num_verts)) {
			croak("Vertices not clockwise and convex");
		}
		RETVAL = cpPolyShapeNew(body, num_verts, _verts, *offset);
		Safefree(_verts);
		Safefree(offset);
	OUTPUT:
		RETVAL

int
cppoly_get_num_verts(shape)
		cpShape *shape
	CODE:
		RETVAL = cpPolyShapeGetNumVerts(shape);
	OUTPUT:<commit_msg>Remove unused preinit section<commit_after>#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include "helper.h"
#include <chipmunk.h>

MODULE = Chipmunk::PolyShape	PACKAGE = Chipmunk::PolyShape	PREFIX = cppoly_
PROTOTYPES: ENABLE

cpShape*
cppoly_new(CLASS, body, verts, ...)
		char *CLASS
		cpBody *body
		SV *verts
	CODE:
		cpVect *offset;
		if (items > 3) {
			offset = sv_to_vect(ST(3));
		} else {
			Newx(offset, 1, cpVect);
			*offset = cpv((cpFloat)0.0, (cpFloat)0.0);
		}
		cpVect *_verts = sv_to_vect_array(verts);
		int num_verts = av_len((AV *)SvRV(verts)) + 1;
		if (!cpPolyValidate(_verts, num_verts)) {
			croak("Vertices not clockwise and convex");
		}
		RETVAL = cpPolyShapeNew(body, num_verts, _verts, *offset);
		Safefree(_verts);
		Safefree(offset);
	OUTPUT:
		RETVAL

int
cppoly_get_num_verts(shape)
		cpShape *shape
	CODE:
		RETVAL = cpPolyShapeGetNumVerts(shape);
	OUTPUT:
{'fraction_non_alphanumeric': 0.1441784548422198, 'fraction_numerical': 0.008705114254624592, 'mean_word_length': 4.675925925925926, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5970103', 'n_tokens_mistral': 824, 'n_tokens_neox': 753, 'n_words': 159}