type
stringclasses
5 values
content
stringlengths
9
163k
functions
void avro_resolved_record_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); if (riface->field_offsets != NULL) { avro_free(riface->field_offsets, riface->field_count * sizeof(size_t)); }
functions
int avro_resolved_record_reader_init(const avro_resolved_reader_t *iface, void *vself) { int rval; const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; /* Initialize each field */ size_t i; for (i = 0; i < riface->field_count; i++) { if (riface->field_resolvers[i] != NULL) { check(rval, avro_resolved_reader_init (riface->field_resolvers[i], avro_resolved_record_field(riface, self, i))); }
functions
void avro_resolved_record_reader_done(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; /* Finalize each field */ size_t i; for (i = 0; i < riface->field_count; i++) { if (riface->field_resolvers[i] != NULL) { avro_resolved_reader_done (riface->field_resolvers[i], avro_resolved_record_field(riface, self, i)); }
functions
int avro_resolved_record_reader_reset(const avro_resolved_reader_t *iface, void *vself) { int rval; const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; /* Reset each field */ size_t i; for (i = 0; i < riface->field_count; i++) { if (riface->field_resolvers[i] != NULL) { check(rval, avro_resolved_reader_reset_wrappers (riface->field_resolvers[i], avro_resolved_record_field(riface, self, i))); }
functions
int avro_resolved_record_reader_get_size(const avro_value_iface_t *viface, const void *vself, size_t *size) { AVRO_UNUSED(vself); const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); *size = riface->field_count; return 0; }
functions
int avro_resolved_record_reader_get_by_index(const avro_value_iface_t *viface, const void *vself, size_t index, avro_value_t *child, const char **name) { const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); const avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; AVRO_DEBUG("Getting reader field %" PRIsz " from record %p", index, self->wrapped.self); if (riface->field_resolvers[index] == NULL) { /* * TODO: Return the default value if the writer record * doesn't contain this field. */ AVRO_DEBUG("Writer doesn't have field"); avro_set_error("NIY: Default values"); return EINVAL; }
functions
int avro_resolved_record_reader_get_by_name(const avro_value_iface_t *viface, const void *vself, const char *name, avro_value_t *child, size_t *index) { const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); int ri = avro_schema_record_field_get_index(iface->rschema, name); if (ri == -1) { avro_set_error("Record doesn't have field named %s", name); return EINVAL; }
functions
void avro_resolved_wunion_reader_calculate_size(avro_resolved_reader_t *iface) { avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); size_t i; size_t max_branch_size = 0; for (i = 0; i < uiface->branch_count; i++) { if (uiface->branch_resolvers[i] == NULL) { AVRO_DEBUG("No match for writer union branch %" PRIsz, i); }
functions
void avro_resolved_wunion_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); if (uiface->branch_resolvers != NULL) { size_t i; for (i = 0; i < uiface->branch_count; i++) { if (uiface->branch_resolvers[i] != NULL) { free_resolver(uiface->branch_resolvers[i], freeing); }
functions
int avro_resolved_wunion_reader_init(const avro_resolved_reader_t *iface, void *vself) { AVRO_UNUSED(iface); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; self->discriminant = -1; return 0; }
functions
void avro_resolved_wunion_reader_done(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; if (self->discriminant >= 0) { avro_resolved_reader_done (uiface->branch_resolvers[self->discriminant], avro_resolved_wunion_branch(self)); self->discriminant = -1; }
functions
int avro_resolved_wunion_reader_reset(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; /* Keep the same branch selected, for the common case that we're * about to reuse it. */ if (self->discriminant >= 0) { return avro_resolved_reader_reset_wrappers (uiface->branch_resolvers[self->discriminant], avro_resolved_wunion_branch(self)); }
functions
int avro_resolved_wunion_get_real_src(const avro_value_iface_t *viface, const void *vself, avro_value_t *real_src) { int rval; const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; int writer_disc; check(rval, avro_value_get_discriminant(&self->wrapped, &writer_disc)); AVRO_DEBUG("Writer is branch %d", writer_disc); if (uiface->branch_resolvers[writer_disc] == NULL) { avro_set_error("Reader isn't compatible with writer branch %d", writer_disc); return EINVAL; }
functions
int avro_resolved_wunion_reader_get_boolean(const avro_value_iface_t *viface, const void *vself, int *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_boolean(&src, out); }
functions
int avro_resolved_wunion_reader_get_bytes(const avro_value_iface_t *viface, const void *vself, const void **buf, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_bytes(&src, buf, size); }
functions
int avro_resolved_wunion_reader_grab_bytes(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_grab_bytes(&src, dest); }
functions
int avro_resolved_wunion_reader_get_double(const avro_value_iface_t *viface, const void *vself, double *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_double(&src, out); }
functions
int avro_resolved_wunion_reader_get_float(const avro_value_iface_t *viface, const void *vself, float *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_float(&src, out); }
functions
int avro_resolved_wunion_reader_get_int(const avro_value_iface_t *viface, const void *vself, int32_t *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_int(&src, out); }
functions
int avro_resolved_wunion_reader_get_long(const avro_value_iface_t *viface, const void *vself, int64_t *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_long(&src, out); }
functions
int avro_resolved_wunion_reader_get_null(const avro_value_iface_t *viface, const void *vself) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_null(&src); }
functions
int avro_resolved_wunion_reader_get_string(const avro_value_iface_t *viface, const void *vself, const char **str, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_string(&src, str, size); }
functions
int avro_resolved_wunion_reader_grab_string(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_grab_string(&src, dest); }
functions
int avro_resolved_wunion_reader_get_enum(const avro_value_iface_t *viface, const void *vself, int *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_enum(&src, out); }
functions
int avro_resolved_wunion_reader_get_fixed(const avro_value_iface_t *viface, const void *vself, const void **buf, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_fixed(&src, buf, size); }
functions
int avro_resolved_wunion_reader_grab_fixed(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_grab_fixed(&src, dest); }
functions
int avro_resolved_wunion_reader_set_boolean(const avro_value_iface_t *viface, void *vself, int val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_boolean(&src, val); }
functions
int avro_resolved_wunion_reader_set_bytes(const avro_value_iface_t *viface, void *vself, void *buf, size_t size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_bytes(&src, buf, size); }
functions
int avro_resolved_wunion_reader_give_bytes(const avro_value_iface_t *viface, void *vself, avro_wrapped_buffer_t *buf) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_give_bytes(&src, buf); }
functions
int avro_resolved_wunion_reader_set_double(const avro_value_iface_t *viface, void *vself, double val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_double(&src, val); }
functions
int avro_resolved_wunion_reader_set_float(const avro_value_iface_t *viface, void *vself, float val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_float(&src, val); }
functions
int avro_resolved_wunion_reader_set_int(const avro_value_iface_t *viface, void *vself, int32_t val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_int(&src, val); }
functions
int avro_resolved_wunion_reader_set_long(const avro_value_iface_t *viface, void *vself, int64_t val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_long(&src, val); }
functions
int avro_resolved_wunion_reader_set_null(const avro_value_iface_t *viface, void *vself) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_null(&src); }
functions
int avro_resolved_wunion_reader_set_string(const avro_value_iface_t *viface, void *vself, const char *str) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_string(&src, str); }
functions
int avro_resolved_wunion_reader_set_string_len(const avro_value_iface_t *viface, void *vself, const char *str, size_t size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_string_len(&src, str, size); }
functions
int avro_resolved_wunion_reader_give_string_len(const avro_value_iface_t *viface, void *vself, avro_wrapped_buffer_t *buf) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_give_string_len(&src, buf); }
functions
int avro_resolved_wunion_reader_set_enum(const avro_value_iface_t *viface, void *vself, int val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_enum(&src, val); }
functions
int avro_resolved_wunion_reader_set_fixed(const avro_value_iface_t *viface, void *vself, void *buf, size_t size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_fixed(&src, buf, size); }
functions
int avro_resolved_wunion_reader_give_fixed(const avro_value_iface_t *viface, void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_give_fixed(&src, dest); }
functions
int avro_resolved_wunion_reader_get_size(const avro_value_iface_t *viface, const void *vself, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_size(&src, size); }
functions
int avro_resolved_wunion_reader_get_by_index(const avro_value_iface_t *viface, const void *vself, size_t index, avro_value_t *child, const char **name) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_by_index(&src, index, child, name); }
functions
int avro_resolved_wunion_reader_get_by_name(const avro_value_iface_t *viface, const void *vself, const char *name, avro_value_t *child, size_t *index) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_by_name(&src, name, child, index); }
functions
int avro_resolved_wunion_reader_get_discriminant(const avro_value_iface_t *viface, const void *vself, int *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_discriminant(&src, out); }
functions
int avro_resolved_wunion_reader_get_current_branch(const avro_value_iface_t *viface, const void *vself, avro_value_t *branch) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_current_branch(&src, branch); }
functions
int avro_resolved_wunion_reader_append(const avro_value_iface_t *viface, void *vself, avro_value_t *child_out, size_t *new_index) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_append(&src, child_out, new_index); }
functions
int avro_resolved_wunion_reader_add(const avro_value_iface_t *viface, void *vself, const char *key, avro_value_t *child, size_t *index, int *is_new) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_add(&src, key, child, index, is_new); }
functions
int avro_resolved_wunion_reader_set_branch(const avro_value_iface_t *viface, void *vself, int discriminant, avro_value_t *branch) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_branch(&src, discriminant, branch); }
functions
void avro_resolved_runion_reader_calculate_size(avro_resolved_reader_t *iface) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); avro_resolved_reader_calculate_size(uiface->branch_resolver); iface->instance_size = uiface->branch_resolver->instance_size; }
functions
void avro_resolved_runion_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); if (uiface->branch_resolver != NULL) { free_resolver(uiface->branch_resolver, freeing); }
functions
int avro_resolved_runion_reader_init(const avro_resolved_reader_t *iface, void *vself) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); return avro_resolved_reader_init(uiface->branch_resolver, vself); }
functions
void avro_resolved_runion_reader_done(const avro_resolved_reader_t *iface, void *vself) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); avro_resolved_reader_done(uiface->branch_resolver, vself); }
functions
int avro_resolved_runion_reader_reset(const avro_resolved_reader_t *iface, void *vself) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); return avro_resolved_reader_reset_wrappers(uiface->branch_resolver, vself); }
functions
int avro_resolved_runion_reader_get_discriminant(const avro_value_iface_t *viface, const void *vself, int *out) { AVRO_UNUSED(vself); const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); AVRO_DEBUG("Reader union is branch %" PRIsz, uiface->active_branch); *out = uiface->active_branch; return 0; }
functions
int avro_resolved_runion_reader_get_current_branch(const avro_value_iface_t *viface, const void *vself, avro_value_t *branch) { const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); AVRO_DEBUG("Getting reader branch %" PRIsz " for union %p", uiface->active_branch, vself); branch->iface = &uiface->branch_resolver->parent; branch->self = (void *) vself; return 0; }
includes
#include <stdio.h>
includes
#include <signal.h>
includes
#include <getopt.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <unistd.h>
includes
#include <linux/videodev2.h>
includes
#include <sys/stat.h>
defines
#define DEFAULT_WAIT_TIME 5
defines
#define SHOULD_STOP(v) (stop = v)
defines
#define IS_STOPPED() (stop)
defines
#define COUNT_LIMIT 9
functions
void write_to_disk(const unsigned char *data, size_t size) { FILE *f; char *filename = create_debug_filename(); f = fopen(filename, "w"); if (f) { fwrite(data, size, 1, f); fclose(f); fprintf(stderr, "DEBUG: Frame written to file '%s'\n", filename); }
functions
void print_usage_and_exit(const char *name) { if (name) { printf("Usage: %s [OPTIONS] <app name> <username> <password>\n" "Options:\n" " -w secs Sleep this amount of seconds between shots\n" " -d Display debug messages\n" " -s Take one single shot and exit\n" " -j Convert frames to JPEG\n" " -S Stream as fast as possible\n", name); }
functions
void sighandler(int s) { char *signame; switch (s) { case SIGINT: signame = "SIGINT"; break; case SIGQUIT: signame = "SIGQUIT"; break; case SIGTERM: signame = "SIGTERM"; break; case SIGABRT: signame = "SIGABRT"; break; case SIGTRAP: signame = "SIGTRAP"; break; default: signame = NULL; break; }
functions
void do_stream(struct appbase *ab, bool jpeg) { struct camera *c; c = uvc_open(); if (!c) fatal("Could not find any camera for capturing pictures"); c->frame = uvc_alloc_frame(320, 240, V4L2_PIX_FMT_YUYV); if (!c->frame) fatal("Could not allocate enough memory for frames"); if (!uvc_init(c)) fatal("Could not start camera for streaming"); while (!IS_STOPPED() && uvc_capture_frame(c)) { if (jpeg) frame_convert_yuyv_to_jpeg(c->frame); if (!appbase_push_frame(ab, c->frame->frame_data, c->frame->frame_bytes_used, &c->frame->capture_time)) { fprintf(stderr, "ERROR: Could not capture frame\n"); break; }
functions
void do_capture(struct appbase *ab, unsigned int wait_time, bool oneshot, bool jpeg, bool debug) { struct camera *c; struct frame *f; while (!IS_STOPPED()) { c = uvc_open(); if (!c) fatal("Could not find any camera for capturing pictures"); c->frame = uvc_alloc_frame(320, 240, V4L2_PIX_FMT_YUYV); if (!c->frame) fatal("Could not allocate enough memory for frames"); if (!uvc_init(c)) fatal("Could not start camera for streaming"); if (uvc_capture_frame(c)) { f = c->frame; if (jpeg) frame_convert_yuyv_to_jpeg(f); if (!appbase_push_frame(ab, f->frame_data, f->frame_bytes_used, &f->capture_time)) fprintf(stderr, "ERROR: Could not send frame\n"); if (debug) write_to_disk(f->frame_data, f->frame_bytes_used); memset(f->frame_data, 0, f->frame_size); f->frame_bytes_used = 0; }
main
int main(int argc, char **argv) { int opt; char *endptr; long int wait_time = DEFAULT_WAIT_TIME; bool debug = false, oneshot = false, stream = false, jpeg = false; struct sigaction sig; struct appbase *ab; /* Parse command-line options */ while ((opt = getopt(argc, argv, "w:dsSj")) != -1) { switch (opt) { case 'w': wait_time = strtol(optarg, &endptr, 10); if (*endptr || wait_time < 0) print_usage_and_exit(argv[0]); break; case 'd': debug = true; break; case 's': oneshot = true; break; case 'S': stream = true; break; case 'j': jpeg = true; break; default: print_usage_and_exit(argv[0]); break; }
functions
6671 while(n-- > 0){ 6672 if(*s1 != *s2) 6673 return *s1 - *s2; 6674 s1++, s2++; 6675 }
functions
6688 if(s < d && s + n > d){ 6689 s += n; 6690 d += n; 6691 while(n-- > 0) 6692 *--d = *--s; 6693 }
includes
#include<stdio.h>
includes
#include<math.h>
includes
#include<conio.h>
includes
#include<ctype.h>
functions
void main(){ int round; char e; //game intro printf("\t\t\tWelcome to Roullette\n\n"); //game instruction printf("Game Instructions:\n\n"); printf("Diamond(d)=%c Hearts(h)=%c Clubs(c)=%c Spades(s)=%c Jack(j)=%c Bull's Eye=%c \n",4,3,5,6,2,15); printf("\n-The game starts with $100 \n-You chooses how many rounds to play \n-Then bet with cash on Suits,Jack and Null spaces of the wheel on which the dice will hit \n-A dice is thrown \n-If the dice hits the betting suit then you earn the betting cash.\n"); printf("-If the dice hits suits other than the betting one then you lose $10\n"); printf("-If it hits any of the Null spaces which is not bet then you lose bet cash \n"); printf("-If it hits the Jack which is bet then you earn the beting cash + $100 otherwise you earn only the bet cash \n"); printf("-Your cash is doubled if you hit the Bull's Eye \n"); printf("\n\n"); printf("Press Enter to Start Game"); scanf("%c",&e); if(e=='\n'){ printf("\nThe Roullette Wheel: \n\n"); wheel(); printf("\n\nYour Cash: $%d",cash); printf("\n\nHow many rounds you want to play: "); scanf("%d",&round); printf("\n\nYour Cash : $%d \n",cash); game(round); printf("\n\n"); printf("\t %d rounds completed!! \n\n\tYou Earned Total $%d !!\n\n",round,cash); }
functions
void game(int r){ int count; for(count=1;count<=r;count++){ int suit,ca,hit,dice; fflush(stdin); suit=suit_bet(); ca=cash_bet(); hit=roll_wheel(); dice=roll_dice(); wheel_count(ca,hit,suit); dice_count(dice,hit); printf("\n"); wheel(); printf("\n\nCash: $%d \nSuit Bet: %c \nCash Bet: $%d \nWheel Hit: %c \nDice: %d\n\n\n",cash,suit,ca,hit,dice); }
functions
void wheel(){ for(i=0;i<9;i++){ for(j=0;j<9;j++){ printf("%c ",w[i][j]); }
functions
int suit_bet(){ char s; int k; printf("Suit Bet: "); s=getchar(); s=tolower(s); switch(s){ case 'h': k=3; break; case 'd': k=4; break; case 'c': k=5; break; case 's': k=6; break; case 'j': k=2; break; case 'n': k=32; break; default: k=0; }
functions
int cash_bet(){ int c; printf("Cash Bet: $"); scanf("%d",&c); return c; }
functions
int roll_wheel(){ float m,n; int wh1,wh2,res; m=rand()/32768.0; n=rand()/32768.0; wh1=(int) (m*9); wh2=(int) (n*9); res=w[wh1][wh2]; w[wh1][wh2]=249; return res; }
functions
int roll_dice(){ float d; int res; d=rand()/32768.0; res=(int) (d*6)+1; return res; }
functions
void wheel_count(int c,int h,int s){ if(h==s){ if(h==2){ cash=cash+c+100; }
functions
else if(h==3 || h==4 || h==5 || h==6){ cash=cash-10; }
functions
else if(h==32){ cash=cash-c; }
functions
else if(h==2){ cash=cash+c; }
functions
void dice_count(int d,int h){ if(h==3 || h==4 || h==5 || h==6){ if(d==6){ cash=cash+20; }
functions
else if(h==15){ cash=2*cash; }
functions
else if(h==249){ if(d==6){ cash=cash+20; }
includes
#include <limits.h>
includes
#include <linux/netfilter_ipv4.h>
includes
#include <net/if.h>
defines
#define LUA_TCPD_CONNECTION_TYPE "<tcpd.connect>"
defines
#define LUA_TCPD_SERVER_TYPE "<tcpd.bind %s %d>"
defines
#define LUA_TCPD_ACCEPT_TYPE "<tcpd.accept %s %d>"
defines
#define VERIFY_DEPTH 5