<commit_before>/* 
 * jcom.ramp
 * External for Jamoma: ramp values using Jamoma's RampLib library
 * By <NAME>, Copyright  2006
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "Jamoma.h"

enum outlets{
	k_outlet_value = 0,
	k_outlet_dumpout,
	num_outlets
};


typedef struct _ramp{
	t_object	 ob;
	void		*obex;
	void		*outlets[num_outlets];
	t_symbol	*attr_rampunit;			///< name of the current rampunit
	rampunit	*my_ramp;				///< instance of the current rampunit
} t_ramp;


// Prototypes
void*		ramp_new(t_symbol *s, long argc, t_atom *argv);
void		ramp_free(t_ramp *x);
void		ramp_assist(t_ramp *x, void *b, long msg, long arg, char *dst);
t_max_err 	ramp_setrampunit(t_ramp *x, void *attr, long argc, t_atom *argv);
void		ramp_setFunction(t_ramp *x, t_symbol *functionName);
void		ramp_int(t_ramp *x, long n);
void		ramp_float(t_ramp *x, double f);
void		ramp_set(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);
void		ramp_list(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);
void		ramp_callback(void *v, short numvalues, double *values);
void 		ramp_attrset(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);
void 		ramp_attrget(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);


// Globals
t_class		*ramp_class;				// Required: Global pointer for our class


/************************************************************************************/
// Class Definition

int main(void)				// main recieves a copy of the Max function macros table
{
	t_class *c;
	
	jamoma_init();

	// Define our class
	c = class_new("jcom.ramp",(method)ramp_new, (method)ramp_free, (short)sizeof(t_ramp), (method)0L, A_GIMME, 0);
	class_obexoffset_set(c, calcoffset(t_ramp, obex));
	
	// Make methods accessible for our class:
	class_addmethod(c, (method)ramp_int,				"int",			A_DEFLONG,	0);
	class_addmethod(c, (method)ramp_float,				"float",		A_DEFFLOAT,	0);
 	class_addmethod(c, (method)ramp_list,				"list",			A_GIMME,	0);
	class_addmethod(c, (method)ramp_set,				"set",			A_GIMME,	0);
	class_addmethod(c, (method)ramp_attrset,			"attrset",		A_GIMME, 	0);
	class_addmethod(c, (method)ramp_attrget,			"attrget",		A_GIMME,	0);
	class_addmethod(c, (method)ramp_setFunction,		"setFunction",	A_SYM,		0);
	class_addmethod(c, (method)ramp_assist,				"assist",		A_CANT,		0); 
    class_addmethod(c, (method)object_obex_dumpout,		"dumpout",		A_CANT,		0);  
    class_addmethod(c, (method)object_obex_quickref,	"quickref",		A_CANT,		0);

	// ATTRIBUTE: rampunit
	class_addattr(c, 
		attr_offset_new("rampunit", _sym_symbol, 0,
		(method)0, (method)ramp_setrampunit, calcoffset(t_ramp, attr_rampunit)));

	// Finalize our class
	class_register(CLASS_BOX, c);
	ramp_class = c;
	
	return 0;
}


/************************************************************************************/
// Object Life

void *ramp_new(t_symbol *s, long argc, t_atom *argv)
{
	t_ramp	*x = (t_ramp *)object_alloc(ramp_class);
	t_atom	a;

	if(x){
		x->outlets[k_outlet_dumpout] = outlet_new(x, 0L);
		x->outlets[k_outlet_value]   = outlet_new(x, 0L);
		object_obex_store((void *)x, _sym_dumpout, (t_object *)x->outlets[k_outlet_dumpout]);

		x->my_ramp = NULL;
		x->attr_rampunit = _sym_nothing;		
		attr_args_process(x, argc, argv);	// handle attribute args
		
		if(x->attr_rampunit == _sym_nothing){
			atom_setsym(&a, gensym("scheduler"));
			object_attr_setvalueof(x, gensym("rampunit"), 1, &a);
		}
	}
	return (x);		// return the pointer to our new instantiation
}
<commit_msg>"Magnify the most difficult details"<commit_after>/* 
 * jcom.ramp
 * External for Jamoma: ramp values using Jamoma's RampLib library
 * By <NAME>, Copyright  2006
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "Jamoma.h"

enum outlets{
	k_outlet_value = 0,
	k_outlet_dumpout,
	num_outlets
};


typedef struct _ramp{
	t_object	 ob;
	void		*obex;
	void		*outlets[num_outlets];
	t_symbol	*attr_rampunit;			///< name of the current rampunit
	rampunit	*my_ramp;				///< instance of the current rampunit
} t_ramp;


// Prototypes
void*		ramp_new(t_symbol *s, long argc, t_atom *argv);
void		ramp_free(t_ramp *x);
void		ramp_assist(t_ramp *x, void *b, long msg, long arg, char *dst);
t_max_err 	ramp_setrampunit(t_ramp *x, void *attr, long argc, t_atom *argv);
void		ramp_setFunction(t_ramp *x, t_symbol *functionName);
void		ramp_int(t_ramp *x, long n);
void		ramp_float(t_ramp *x, double f);
void		ramp_set(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);
void		ramp_list(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);
void		ramp_callback(void *v, short numvalues, double *values);
void 		ramp_attrset(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);
void 		ramp_attrget(t_ramp *x, t_symbol *msg, long argc, t_atom *argv);


// Globals
t_class		*ramp_class;				// Required: Global pointer for our class


/************************************************************************************/
// Class Definition

int main(void)				// main recieves a copy of the Max function macros table
{
	t_class *c;
	
	jamoma_init();

	// Define our class
	c = class_new("jcom.ramp",(method)ramp_new, (method)ramp_free, (short)sizeof(t_ramp), (method)0L, A_GIMME, 0);
	class_obexoffset_set(c, calcoffset(t_ramp, obex));
	
	// Make methods accessible for our class:
	class_addmethod(c, (method)ramp_int,				"int",			A_DEFLONG,	0);
	class_addmethod(c, (method)ramp_float,				"float",		A_DEFFLOAT,	0);
 	class_addmethod(c, (method)ramp_list,				"list",			A_GIMME,	0);
	class_addmethod(c, (method)ramp_set,				"set",			A_GIMME,	0);
	class_addmethod(c, (method)ramp_attrset,			"attrset",		A_GIMME, 	0);
	class_addmethod(c, (method)ramp_attrget,			"attrget",		A_GIMME,	0);
	class_addmethod(c, (method)ramp_setFunction,		"setFunction",	A_SYM,		0);
	class_addmethod(c, (method)ramp_assist,				"assist",		A_CANT,		0); 
    class_addmethod(c, (method)object_obex_dumpout,		"dumpout",		A_CANT,		0);  
    class_addmethod(c, (method)object_obex_quickref,	"quickref",		A_CANT,		0);

	// ATTRIBUTE: rampunit
	class_addattr(c, 
		attr_offset_new("rampunit", _sym_symbol, 0,
		(method)0, (method)ramp_setrampunit, calcoffset(t_ramp, attr_rampunit)));

	// Finalize our class
	class_register(CLASS_BOX, c);
	ramp_class = c;
	
	return 0;
}


/************************************************************************************/
// Object Life

void *ramp_new(t_symbol *s, long argc, t_atom *argv)
{
	t_ramp	*x = (t_ramp *)object_alloc(ramp_class);
	t_atom	a;

	if(x){
		x->outlets[k_outlet_dumpout] = outlet_new(x, 0L);
		x->outlets[k_outlet_value]   = outlet_new(x, 0L);
		object_obex_store((void *)x, _sym_dumpout, (t_object *)x->outlets[k_outlet_dumpout]);

		x->my_ramp = NULL;
		x->attr_rampunit = _sym_nothing;		
		attr_args_process(x, argc, argv);	// handle attribute args

		if(x->attr_rampunit == _sym_nothing){
			atom_setsym(&a, gensym("scheduler"));
			object_attr_setvalueof(x, gensym("rampunit"), 1, &a);
		}
	}
	return (x);		// return the pointer to our new instantiation
}

{'fraction_non_alphanumeric': 0.17739425661338237, 'fraction_numerical': 0.006507285330315462, 'mean_word_length': 4.956192080876159, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4772862', 'n_tokens_mistral': 3102, 'n_tokens_neox': 2914, 'n_words': 638}