static void dump_log_data( int fd, struct service_config *scp, int tab_level ) { struct log *lp = SC_LOG( scp ) ; struct filelog *flp ; int i ; switch ( LOG_GET_TYPE( lp ) ) { case L_NONE: tabprint( fd, tab_level, "No logging\n" ) ; return ; case L_COMMON_FILE: tabprint( fd, tab_level, "Logging to common log file\n" ) ; break ; case L_FILE: flp = LOG_GET_FILELOG( lp ) ; tabprint( fd, tab_level, "Logging to file: %s", flp->fl_filename ) ; if ( FILELOG_SIZE_CONTROL( flp ) ) Sprint( fd, " (soft=%d hard=%d)\n", flp->fl_soft_limit, flp->fl_hard_limit ) ; else Sprint( fd, " (no limits)\n" ) ; break ; case L_SYSLOG: tabprint( fd, tab_level, "Logging to syslog. Facility = %s, level = %s\n", nv_get_name( syslog_facilities, lp->l_sl.sl_facility ), nv_get_name( syslog_levels, lp->l_sl.sl_level ) ) ; break ; } tabprint( fd, tab_level, "Log_on_success flags =" ) ; for ( i = 0 ; success_log_options[ i ].name != NULL ; i++ ) if ( M_IS_SET( SC_LOG_ON_SUCCESS(scp), success_log_options[ i ].value ) ) Sprint( fd, " %s", success_log_options[ i ].name ) ; Sputchar( fd, '\n' ) ; tabprint( fd, tab_level, "Log_on_failure flags =" ) ; for ( i = 0 ; failure_log_options[ i ].name != NULL ; i++ ) if ( M_IS_SET( SC_LOG_ON_FAILURE(scp), failure_log_options[ i ].value ) ) Sprint( fd, " %s", failure_log_options[ i ].name ) ; Sputchar( fd, '\n' ) ; }
void CNPC_Zombine::ReleaseGrenade( Vector vPhysgunPos ) { if ( HasGrenade() == false ) return; Vector vDir = vPhysgunPos - m_hGrenade->GetAbsOrigin(); VectorNormalize( vDir ); Activity aActivity; Vector vForward, vRight; GetVectors( &vForward, &vRight, NULL ); float flDotForward = DotProduct( vForward, vDir ); float flDotRight = DotProduct( vRight, vDir ); bool bNegativeForward = false; bool bNegativeRight = false; if ( flDotForward < 0.0f ) { bNegativeForward = true; flDotForward = flDotForward * -1; } if ( flDotRight < 0.0f ) { bNegativeRight = true; flDotRight = flDotRight * -1; } if ( flDotRight > flDotForward ) { if ( bNegativeRight == true ) aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_WEST; else aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_EAST; } else { if ( bNegativeForward == true ) aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_BACK; else aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_FRONT; } AddGesture( aActivity ); DropGrenade( vec3_origin ); if ( IsSprinting() ) { StopSprint(); } else { Sprint(); } }
void CNPC_Zombine::RunTask( const Task_t *pTask ) { switch ( pTask->iTask ) { case TASK_WAIT_FOR_MOVEMENT_STEP: case TASK_WAIT_FOR_MOVEMENT: { BaseClass::RunTask( pTask ); if ( IsOnFire() && IsSprinting() ) { StopSprint(); } //Only do this if I have an enemy if ( GetEnemy() ) { if ( AllowedToSprint() == true ) { Sprint( ( GetHealth() <= GetMaxHealth() * 0.5f ) ); return; } if ( HasGrenade() ) { if ( IsSprinting() ) { GetNavigator()->SetMovementActivity( (Activity)ACT_ZOMBINE_GRENADE_RUN ); } else { GetNavigator()->SetMovementActivity( (Activity)ACT_ZOMBINE_GRENADE_WALK ); } return; } if ( GetNavigator()->GetMovementActivity() != ACT_WALK ) { if ( IsSprinting() == false ) { GetNavigator()->SetMovementActivity( ACT_WALK ); } } } else { GetNavigator()->SetMovementActivity( ACT_WALK ); } break; } default: { BaseClass::RunTask( pTask ); break; } } }
void MM_Dump(t_Handle h_MM, void *buff) { t_MM *p_MM = (t_MM *)h_MM; t_FreeBlock *p_FreeB; t_BusyBlock *p_BusyB; int i; p_BusyB = p_MM->busyBlocks; Sprint(buff, "List of busy blocks:\n"); while (p_BusyB) { Sprint(buff, "\t0x%p: (%s: b=0x%lx, e=0x%lx)\n", p_BusyB, p_BusyB->name, p_BusyB->base, p_BusyB->end ); p_BusyB = p_BusyB->p_Next; } Sprint(buff, "\nLists of free blocks according to alignment:\n"); for (i=0; i <= MM_MAX_ALIGNMENT; i++) { Sprint(buff, "%d alignment:\n", (0x1 << i)); p_FreeB = p_MM->freeBlocks[i]; while (p_FreeB) { Sprint(buff, "\t0x%p: (b=0x%lx, e=0x%lx)\n", p_FreeB, p_FreeB->base, p_FreeB->end); p_FreeB = p_FreeB->p_Next; } Sprint(buff, "\n"); } }
static void dump_services( int fd ) { unsigned u ; /* * Dump the current configuration (services + defaults) */ Sprint( fd, "Services + defaults:\n" ) ; sc_dump( DEFAULTS( ps ), fd, 0, TRUE ) ; for ( u = 0 ; u < pset_count( SERVICES( ps ) ) ; u++ ) svc_dump( SP( pset_pointer( SERVICES( ps ), u ) ), fd ) ; }
void ti_dump( pset_h iset, int fd ) { unsigned u ; for ( u = 0 ; u < pset_count( iset ) ; u++ ) { struct time_interval *tip = TIP( pset_pointer( iset, u ) ) ; Sprint( fd, " %02d:%02d-%02d:%02d", tip->min_start / 60, tip->min_start % 60, tip->min_end / 60, tip->min_end % 60 ) ; } }
void display() { glClear(GL_COLOR_BUFFER_BIT); if(begin) { glClearColor(a[0][0],a[0][1],a[0][2],a[0][3]); drawGround(0.6,30,60,0,500); drawCircle(bw[1],false,250,250,240); drawPitch(0.5,0.7,0.0,200,300,300,200,400,400,100,100,bail); drawCircle(rgb[0],true,kb.x,kb.y,4); if(inlin) Sprint(80.0,250.0,"PITCHED IN LINE"); if(outline) Sprint(80.0,250.0,"PITCHED OUTSIDE"); } else if(start) { glClearColor(a[1][0],a[1][1],a[1][2],a[1][3]); glColor3fv(rgb[0]); Sprint(170.0,450.0,"INSTRUCTIONS"); glColor3f(0.5,0.1,0.8); Sprin(80.0,350.0,"PRESS O TO BOWL OVER THE WICKET"); Sprin(80.0,300.0,"PRESS A TO BOWL AROUND THE WICKET"); Sprin(80.0,250.0,"CLICK THE LEFT MOUSE BUTTON TO START THE BALL MOVEMENT"); Sprin(80.0,200.0,"CLICK THE RIGHT BUTTON OF THE MOUSE TO PITCH THE BALL"); Sprin(80.0,150.0,"PRESS R TO REBOWL"); Sprin(80.0,100.0,"PRESS ESC TO EXIT FROM THE PROGRAM"); } else { glClearColor(a[2][0],a[2][1],a[2][2],a[2][3]); glColor3fv(rgb[2]); Sprint(145.0,450,"SIMULATION OF A HAWK EYE"); glColor3f(0.0,0.5,0.5); Sprin(160.0,400,"PROJECT TEAM MEMBERS"); glColor3f(0.6,0.5,0.0); Sprint(120.0,350,"Aditya Chandrashekhar--USN:1DS08CS144"); Sprint(120.0,300,"Ramdas.R--USN:1DS08CS080"); Sprint(120.0,250,"Ranganath K Ingalagi--USN:1DS08CS082"); Sprint(120.0,200,"Vivek Padmanabhan--USN:1DS09CS417"); } glFlush(); glutSwapBuffers(); }
void dump_internal_state(void) { int dump_fd ; const char *dump_file = DUMP_FILE ; time_t current_time ; int fd ; unsigned u ; const char *func = "dump_internal_state" ; if ( debug.on ) msg( LOG_DEBUG, func, "Dumping State" ) ; dump_fd = open( dump_file, O_WRONLY | O_CREAT | O_APPEND, DUMP_FILE_MODE); if ( dump_fd == -1 ) { msg( LOG_ERR, func, "failed to open %s: %m", dump_file ) ; return ; } if (Sbuftype( dump_fd, SIO_LINEBUF ) == SIO_ERR ) { /* * If the above function failed, Sprint will most likely * fail, too. Output a message for troubleshooting and quit. */ msg( LOG_ERR, func, "failed setting up sio buffering: %m" ) ; return; } /* * Print the program name, version, and timestamp. * Note that the program_version variable contains the program name. */ (void) time( ¤t_time ) ; Sprint( dump_fd, "INTERNAL STATE DUMP: %s\n", program_version ) ; Sprint( dump_fd, "Current time: %s\n", ctime( ¤t_time ) ) ; dump_services( dump_fd ) ; /* * Dump the server table */ Sprint( dump_fd, "Server table dump:\n" ) ; for ( u = 0 ; u < pset_count( SERVERS( ps ) ) ; u++ ) server_dump( SERP( pset_pointer( SERVERS( ps ), u ) ), dump_fd ) ; Sputchar( dump_fd, '\n' ) ; /* * Dump the retry_table */ Sprint( dump_fd, "Retry table dump:\n" ) ; for ( u = 0 ; u < pset_count( RETRIES( ps ) ) ; u++ ) server_dump( SERP( pset_pointer( RETRIES( ps ), u ) ), dump_fd ) ; Sputchar( dump_fd, '\n' ) ; /* * Dump the socket mask */ Sprint( dump_fd, "Socket mask:" ) ; for ( fd = 0 ; fd < ps.ros.max_descriptors ; fd++ ) if ( FD_ISSET( fd, &ps.rws.socket_mask ) ) Sprint( dump_fd, " %d", fd ) ; Sputchar( dump_fd, '\n' ) ; Sprint( dump_fd, "mask_max = %d\n", ps.rws.mask_max ) ; /* * Dump the descriptors that are open and are *not* in the socket mask */ Sprint( dump_fd, "Open descriptors (not in socket mask):" ) ; for ( fd = 0 ; fd < ps.ros.max_descriptors ; fd++ ) { struct stat st ; if ( FD_ISSET( fd, &ps.rws.socket_mask ) ) continue ; if ( fstat( fd, &st ) == -1 ) continue ; Sprint( dump_fd, " %d", fd ) ; } Sputchar( dump_fd, '\n' ) ; Sputchar( dump_fd, '\n' ) ; Sprint( dump_fd, "active_services = %d\n", ps.rws.active_services ) ; Sprint( dump_fd, "available_services = %d\n", ps.rws.available_services ) ; Sprint( dump_fd, "descriptors_free = %d\n", ps.rws.descriptors_free ) ; Sprint( dump_fd, "running_servers = %d\n", pset_count( SERVERS( ps ) ) ) ; Sprint( dump_fd, "Logging service = %s\n", LOG_SERVICE( ps ) != NULL ? "enabled" : "not enabled" ) ; Sputchar( dump_fd, '\n' ) ; Sprint( dump_fd, "max_descriptors = %d\n", (int)ps.ros.max_descriptors ) ; Sprint( dump_fd, "process_limit = %d\n", (int)ps.ros.process_limit ) ; Sprint( dump_fd, "config_file = %s\n", ps.ros.config_file ) ; if ( debug.on ) Sprint( dump_fd, "debug_fd = %d\n", debug.fd ) ; Sputchar( dump_fd, '\n' ) ; Sprint( dump_fd, "END OF DUMP\n\n" ) ; Sclose( dump_fd ); msg( LOG_INFO, func, "generated state dump in file %s", dump_file ) ; }
// Draw our world void display(void) { int ix, iy; int i; int j; glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear the screen glMatrixMode (GL_PROJECTION); // Tell opengl that we are doing project matrix work glLoadIdentity(); // Clear the matrix glOrtho(-9.0, 9.0, -9.0, 9.0, 0.0, 30.0); // Setup an Ortho view glMatrixMode(GL_MODELVIEW); // Tell opengl that we are doing model matrix work. (drawing) glLoadIdentity(); // Clear the model matrix glDisable(GL_COLOR_MATERIAL); glDisable(GL_LIGHTING); glColor3f(1.0, 0.0, 0.0); if ( start_game == 0 ) { Sprint(-2, 1, "\nTIC TAC TOE"); Sprint(-2, -2, "To Start press"); Sprint(-2, -3, "right button for X's"); Sprint(-2, -4, "and left for O's"); } if (win == 1) Sprint( -2, 1, "\nYou win "); if (win == -1) Sprint( -2, 1, "\n\n\nComputer win "); if (win == 2) Sprint( -2, 1, "\nTie"); // Setup view, and print view state on screen if (view_state == 1) { glColor3f( 0.0, 0.0, 1.0); Sprint(-3, 8, "Perspective view"); glMatrixMode (GL_PROJECTION); glLoadIdentity(); gluPerspective(60, 1, 1, 30); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } else { glColor3f( 0.0, 0.0, 1.0); // Sprint(-2, 8, "Ortho view"); } // Lighting on/off if (light_state == 1) { glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); }else { glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); } gluLookAt( 0, 0, 20, 0, 0, 0, 0, 1, 0); // Draw Grid for( ix = 0; ix < 4; ix++) { glPushMatrix(); glColor3f(1,1,1); glBegin(GL_LINES); glVertex2i(-9 , -9 + ix * 6); glVertex2i(9 , -9 + ix * 6 ); glEnd(); glPopMatrix(); } for( iy = 0; iy < 4; iy++ ) { glPushMatrix(); glColor3f(1,1,1); glBegin(GL_LINES); glVertex2i(-9 + iy * 6, 9 ); glVertex2i(-9 + iy * 6, -9 ); glEnd(); glPopMatrix(); } glColorMaterial(GL_FRONT, GL_AMBIENT); glColor4f(0.0, 0.0, 1.0, 1.0); glColorMaterial(GL_FRONT, GL_EMISSION); glColor4f(0.1, 0.0, 0.0, 1.0 ); glColorMaterial(GL_FRONT, GL_SPECULAR); glColor4f(0.35, 0.35, 0.35, 1.0); glColorMaterial(GL_FRONT, GL_DIFFUSE); glColor4f(0.69, 0.69, 0.69, 1.0); //glDisable(GL_COLOR_MATERIAL); glColor3f( 1.0, 0.0, 1.0); // Cube color //glEnable(GL_COLOR_MATERIAL); // Draw object in box's for( i = 0; i < 9; i++) { j = 0; if (abs( win ) == 1 ) { if ( (i == box[spinboxes][0]) || (i == box[spinboxes][1]) || (i == box[spinboxes][2])) { j = spin; }else j = 0; } if(box_map[i] == 1) Draw_X( object_map[i][0], object_map[i][1], -1, j); if(box_map[i] == -1) Draw_O( object_map[i][0], object_map[i][1], -1, j); } //glDisable(GL_COLOR_MATERIAL); glutSwapBuffers(); }
//--Implementations void render() { //--Render the scene //clear the screen glClearColor(0.0, 0.0, 0.2, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(TextProgram); char* Text = new char[100]; char* Text2 = new char[100]; Text = (char*)"A=Reverse Planet Rotation S=Reverse Moon Rotation"; Text2 = (char*)"D=Reverse Planet Orbit F=Reverse Moon Orbit"; Sprint(-1.0,0.9,Text); Sprint(-1.0,0.75,Text2); Sprint(-0.8,-0.8, PlanetStatus); Sprint(0.2,-0.8, MoonStatus); //premultiply the matrix for this example mvp = projection * view * model; //enable the shader program glUseProgram(program); //upload the matrix to the shader glUniformMatrix4fv(loc_mvpmat, 1, GL_FALSE, glm::value_ptr(mvp)); //set up the Vertex Buffer Object so it can be drawn glEnableVertexAttribArray(loc_position); glEnableVertexAttribArray(loc_color); glBindBuffer(GL_ARRAY_BUFFER, vbo_geometry); //set pointers into the vbo for each of the attributes(position and color) glVertexAttribPointer( loc_position,//location of attribute 3,//number of elements GL_FLOAT,//type GL_FALSE,//normalized? sizeof(Vertex),//stride 0);//offset glVertexAttribPointer( loc_color, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex,color)); glDrawArrays(GL_TRIANGLES, 0, 36);//mode, starting index, count //clean up glDisableVertexAttribArray(loc_position); glDisableVertexAttribArray(loc_color); mvp = projection * view * Moon; //enable the shader program glUseProgram(program); //upload the matrix to the shader glUniformMatrix4fv(loc_mvpmat, 1, GL_FALSE, glm::value_ptr(mvp)); //set up the Vertex Buffer Object so it can be drawn glEnableVertexAttribArray(loc_position); glEnableVertexAttribArray(loc_color); glBindBuffer(GL_ARRAY_BUFFER, vbo_geometry); //set pointers into the vbo for each of the attributes(position and color) glVertexAttribPointer( loc_position,//location of attribute 3,//number of elements GL_FLOAT,//type GL_FALSE,//normalized? sizeof(Vertex),//stride 0);//offset glVertexAttribPointer( loc_color, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex,color)); glDrawArrays(GL_TRIANGLES, 0, 36);//mode, starting index, count //clean up glDisableVertexAttribArray(loc_position); glDisableVertexAttribArray(loc_color); //swap the buffers glutSwapBuffers(); }
void CNPC_Zombine::InputStartSprint ( inputdata_t &inputdata ) { Sprint(); }
// Draw our world void display_1(void) { char *p; glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear the screen glMatrixMode (GL_PROJECTION); // Tell opengl that we are doing project matrix work glLoadIdentity(); // Clear the matrix glOrtho(-8.0, 8.0, -8.0, 8.0, 0.0, 30.0); // Setup an Ortho view glMatrixMode(GL_MODELVIEW); // Tell opengl that we are doing model matrix work. (drawing) glLoadIdentity(); // Clear the model matrix glColor3f(1.0, 1.0, 1.0); if (shape == 0) Sprint(-3, -7 ,"Solid Cube"); if (shape == 1) Sprint(-3, -7 ,"Solid Cone"); if (shape == 2) Sprint(-3, -7 ,"Solid Sphere"); if (shape == 3) Sprint(-3, -7 ,"Solid Torus"); if (shape == 4) Sprint(-3, -7 ,"Solid Dodecahedron"); if (shape == 5) Sprint(-3, -7 ,"Solid Octahedron"); if (shape == 6) Sprint(-3, -7 ,"Solid Tetrahedron"); if (shape == 7) Sprint(-3, -7 ,"Solid Icosahedron"); if (shape == 8) Sprint(-3, -7 ,"Solid Teapot"); // Setup view, and print view state on screen if (view_state == 1) { glColor3f( 1.0, 1.0, 1.0); Sprint(-2, 4, "Perspective view"); glMatrixMode (GL_PROJECTION); glLoadIdentity(); gluPerspective(60, 1, 1, 30); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }else { glColor3f( 1.0, 1.0, 1.0); Sprint(-2, 4, "Ortho view"); } glColor3f( 0.0, 0.0, 1.0); // Cube color // Lighting on/off if (light_state == 1) { glDisable(GL_LIGHTING); // Turn off lighting glDisable(GL_COLOR_MATERIAL); // Turn off material, which needs lighting to work }else { glEnable(GL_LIGHTING); // Turn on lighting glEnable(GL_COLOR_MATERIAL); // Turn on material settings glColorMaterial(GL_FRONT, GL_AMBIENT); glColor4f(0.65, 0.65, 0.65, 0.4); glColorMaterial(GL_FRONT, GL_EMISSION); glColor4f(0.10, 0.10, 0.10, 0.0); glColorMaterial(GL_FRONT, GL_SPECULAR); glColor4f(0.5, 0.5, 0.5, 0.4); glColorMaterial(GL_FRONT, GL_DIFFUSE); glColor4f(0.85, 0.85, 0.85, 0.4); } gluLookAt( 0, 0, 20, 0, 0, 0, 0, 1, 0); //glRotatef( 45, 1.0, 1.0, 0.0); // rotate cube glRotatef( spin++, 1.0, 1.0, 1.0); // spin cube if (shape == 0) glutSolidCube(10); // Draw a cube if (shape == 1) glutSolidCone(5,10, 16,16); // Draw a Cone if (shape == 2) glutSolidSphere(5, 16,16 ); // Draw a Sphere if (shape == 3) glutSolidTorus( 2.5, 5, 16, 16); if (shape == 4) { glScalef( 3.5, 3.5, 3.5); glutSolidDodecahedron(); } if (shape == 5) { glScalef( 5.0, 5.0, 5.0); glutSolidOctahedron(); } if (shape == 6) { glScalef( 5.0, 5.0, 5.0); glutSolidTetrahedron(); } if (shape == 7) { glScalef( 5.0, 5.0, 5.0); glutSolidIcosahedron(); } if (shape == 8) glutSolidTeapot( 5 ); glutSwapBuffers(); }
/* * Print info about service scp to file descriptor fd */ void sc_dump( struct service_config *scp, int fd, int tab_level, bool_int is_defaults ) { const struct name_value *nvp ; unsigned u ; char **pp ; if ( is_defaults ) tabprint( fd, tab_level, "Service defaults\n" ) ; else tabprint( fd, tab_level, "Service configuration: %s\n", SC_NAME(scp) ) ; if ( ! is_defaults ) { tabprint( fd, tab_level+1, "id = %s\n", SC_ID(scp) ) ; if ( ! M_ARE_ALL_CLEAR( SC_XFLAGS(scp) ) ) { tabprint( fd, tab_level+1, "flags =" ) ; for ( nvp = &service_flags[ 0 ] ; nvp->name != NULL ; nvp++ ) if ( M_IS_SET( SC_XFLAGS(scp), nvp->value ) ) Sprint( fd, " %s", nvp->name ) ; Sputchar( fd, '\n' ) ; } if ( ! M_ARE_ALL_CLEAR( SC_TYPE(scp) ) ) { tabprint( fd, tab_level+1, "type =" ) ; for ( nvp = &service_types[ 0 ] ; nvp->name != NULL ; nvp++ ) if ( M_IS_SET( SC_TYPE(scp), nvp->value ) ) Sprint( fd, " %s", nvp->name ) ; Sputchar( fd, '\n' ) ; } tabprint( fd, tab_level+1, "socket_type = %s\n", nv_get_name( socket_types, SC_SOCKET_TYPE(scp) ) ) ; tabprint( fd, tab_level+1, "Protocol (name,number) = (%s,%d)\n", SC_PROTONAME(scp), SC_PROTOVAL(scp) ) ; if ( SC_SPECIFIED( scp, A_PORT ) ) tabprint( fd, tab_level+1, "port = %d\n", SC_PORT(scp) ) ; } if ( SC_SPECIFIED( scp, A_INSTANCES ) ) { if ( SC_INSTANCES(scp) == UNLIMITED ) tabprint( fd, tab_level+1, "Instances = UNLIMITED\n" ) ; else tabprint( fd, tab_level+1, "Instances = %d\n", SC_INSTANCES(scp) ) ; } if ( SC_SPECIFIED( scp, A_WAIT ) ) { if ( SC_WAIT(scp) ) tabprint( fd, tab_level+1, "wait = yes\n" ) ; else tabprint( fd, tab_level+1, "wait = no\n" ) ; } if ( SC_SPECIFIED( scp, A_USER ) ) tabprint( fd, tab_level+1, "user = %d\n", SC_UID(scp) ) ; if ( SC_SPECIFIED( scp, A_GROUP ) ) tabprint( fd, tab_level+1, "group = %d\n", SC_GID(scp) ) ; if ( SC_SPECIFIED( scp, A_GROUPS ) ) { if (SC_GROUPS(scp) == 1) tabprint( fd, tab_level+1, "Groups = yes\n" ); else tabprint( fd, tab_level+1, "Groups = no\n" ); } if ( SC_SPECIFIED( scp, A_UMASK ) ) tabprint( fd, tab_level+1, "umask = %o\n", SC_UMASK(scp) ) ; if ( SC_SPECIFIED( scp, A_NICE ) ) tabprint( fd, tab_level+1, "Nice = %d\n", SC_NICE(scp) ) ; if ( SC_SPECIFIED( scp, A_CPS ) ) tabprint( fd, tab_level+1, "CPS = max conn:%lu wait:%lu\n", SC_TIME_CONN_MAX(scp), SC_TIME_WAIT(scp) ); if ( SC_SPECIFIED( scp, A_PER_SOURCE ) ) tabprint( fd, tab_level+1, "PER_SOURCE = %d\n", SC_PER_SOURCE(scp) ); if ( SC_SPECIFIED( scp, A_BIND ) ) { if ( SC_BIND_ADDR(scp) ) { char bindname[NI_MAXHOST]; unsigned int len = 0; if( SC_BIND_ADDR(scp)->sa.sa_family == AF_INET ) len = sizeof(struct sockaddr_in); else len = sizeof(struct sockaddr_in6); memset(bindname, 0, sizeof(bindname)); if( getnameinfo(&SC_BIND_ADDR(scp)->sa, len, bindname, NI_MAXHOST, NULL, 0, 0) != 0 ) strcpy(bindname, "unknown"); tabprint( fd, tab_level+1, "Bind = %s\n", bindname ); } else if ( SC_ORIG_BIND_ADDR(scp) ) { tabprint( fd, tab_level+1, "Bind = %s\n", SC_ORIG_BIND_ADDR(scp) ); } else { /* This should NEVER happen */ msg(LOG_ERR, "sc_dump", "bad configuration for %s:", SC_NAME(scp)); } } else tabprint( fd, tab_level+1, "Bind = All addresses.\n" ); if ( ! is_defaults ) { if ( (! SC_IS_INTERNAL( scp )) && (SC_REDIR_ADDR(scp) == NULL) ) { tabprint( fd, tab_level+1, "Server = %s\n", SC_SERVER(scp) ) ; tabprint( fd, tab_level+1, "Server argv =" ) ; if ( SC_SERVER_ARGV(scp) ) { for ( pp = SC_SERVER_ARGV(scp) ; *pp ; pp++ ) Sprint( fd, " %s", *pp ) ; } else Sprint( fd, " (NULL)"); Sputchar( fd, '\n' ) ; } #ifdef LIBWRAP if ( SC_LIBWRAP(scp) != NULL ) { tabprint( fd, tab_level + 1, "Libwrap = %s\n", SC_LIBWRAP(scp) ); } #endif if ( SC_REDIR_ADDR(scp) != NULL ) { char redirname[NI_MAXHOST]; unsigned int len = 0; if( SC_REDIR_ADDR(scp)->sa.sa_family == AF_INET ) len = sizeof(struct sockaddr_in); if( SC_REDIR_ADDR(scp)->sa.sa_family == AF_INET6 ) len = sizeof(struct sockaddr_in6); memset(redirname, 0, sizeof(redirname)); if( getnameinfo(&SC_REDIR_ADDR(scp)->sa, len, redirname, NI_MAXHOST, NULL, 0, 0) != 0 ) strcpy(redirname, "unknown"); tabprint( fd, tab_level+1, "Redirect = %s:%d\n", redirname, SC_REDIR_ADDR(scp)->sa_in.sin_port ); } if ( SC_IS_RPC( scp ) ) { struct rpc_data *rdp = SC_RPCDATA( scp ) ; tabprint( fd, tab_level+1, "RPC data\n" ) ; tabprint( fd, tab_level+2, "program number = %ld\n", rdp->rd_program_number ) ; tabprint( fd, tab_level+2, "rpc_version = " ) ; if ( rdp->rd_min_version == rdp->rd_max_version ) Sprint( fd, "%ld\n", rdp->rd_min_version ) ; else Sprint( fd, "%ld-%ld\n", rdp->rd_min_version, rdp->rd_max_version ) ; } if ( SC_SPECIFIED( scp, A_ACCESS_TIMES ) ) { tabprint( fd, tab_level+1, "Access times =" ) ; ti_dump( SC_ACCESS_TIMES(scp), fd ) ; Sputchar ( fd, '\n' ) ; } } /* This is important enough that each service should list it. */ tabprint( fd, tab_level+1, "Only from: " ) ; if ( SC_ONLY_FROM(scp) ) { /* Next check is done since -= doesn't zero out lists. */ if ( pset_count(SC_ONLY_FROM(scp)) == 0) Sprint( fd, "All sites" ); else addrlist_dump( SC_ONLY_FROM(scp), fd ) ; } else Sprint( fd, "All sites" ); Sputchar( fd, '\n' ) ; /* This is important enough that each service should list it. */ tabprint( fd, tab_level+1, "No access: " ) ; if ( SC_NO_ACCESS(scp) ) { /* Next check is done since -= doesn't zero out lists. */ if ( pset_count(SC_NO_ACCESS(scp)) == 0) Sprint( fd, "No blocked sites" ); else addrlist_dump( SC_NO_ACCESS(scp), fd ) ; } else Sprint( fd, "No blocked sites" ); Sputchar( fd, '\n' ) ; if ( SC_SENSOR(scp) ) { tabprint( fd, tab_level+1, "Deny Time: " ) ; Sprint( fd, "%d\n", SC_DENY_TIME(scp)); } dump_log_data( fd, scp, tab_level+1 ) ; if ( SC_IS_PRESENT( scp, A_PASSENV ) ) { tabprint( fd, tab_level+1, "Passenv =" ) ; for ( u = 0 ; u < pset_count( SC_PASS_ENV_VARS(scp) ) ; u++ ) Sprint( fd, " %s", (char *) pset_pointer( SC_PASS_ENV_VARS(scp), u ) ) ; Sputchar ( fd, '\n' ) ; } if ( ! is_defaults ) if ( SC_SPECIFIED( scp, A_ENV ) ) { tabprint( fd, tab_level+1, "Environment additions:\n" ) ; for ( u = 0 ; u < pset_count( SC_ENV_VAR_DEFS(scp) ) ; u++ ) tabprint( fd, tab_level+2, "%s\n", (char *) pset_pointer( SC_ENV_VAR_DEFS(scp), u ) ) ; } if ( SC_ENV( scp )->env_type == CUSTOM_ENV ) { tabprint( fd, tab_level+1, "Environment strings:\n" ) ; for ( pp = env_getvars( SC_ENV( scp )->env_handle ) ; *pp ; pp++ ) tabprint( fd, tab_level+2, "%s\n", *pp ) ; } Sflush( fd ) ; }
void display() { int varilla_horas , varilla_sec; time(<ime); // Obtenemos tiempo newtime = localtime(<ime); // convertimos a hora local glClearColor(1,1,1,1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Ponemos texto en la pantalla. glMatrixMode (GL_PROJECTION); glLoadIdentity(); glOrtho(-8.0, 8.0, -8.0, 8.0, 1.0, 60.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); // Color de las letras glColor3f( 0, 0, 0); Sprint(-3,-2, asctime(newtime)); glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); double aspect = (double)viewport[2] / (double)viewport[3]; gluPerspective(60, aspect, 1, 100); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // movemos hacia atrás un poco glTranslatef( 0, 0, -1 ); gluLookAt(0,0,1,0,0,0, 0,1,0); glPushMatrix(); //glColor3ub(0,0,255); glRotatef( 180, 1.0, 0.0, 0.0); //glutWireSphere(1,15,15); // varilla horas glPushMatrix(); glColor3f(1.0, 0.5, 0.5); glTranslatef( 0, 0, 0.0); glRotatef( (360/12) * newtime->tm_hour+ (360/60) * (60 / (newtime->tm_min+1)), 0.0, 0.0, 1.0); glPushMatrix(); glTranslatef(0.0, 0.0, 2.0); glPopMatrix(); glRotatef( 90, 1.0, 0.0, 0.0); glutSolidCone(0.025,0.5, 6, 16); glPopMatrix(); // varilla minutos glPushMatrix(); glColor3f(1.0, 0.5, 1.0); glTranslatef( 0, 0, 0.0); glRotatef( (360/60) * newtime->tm_min, 0.0, 0.0, 1.0); glPushMatrix(); glTranslatef(0.0, 0.0, 3.0); glScalef(0.5, 0.5, 1.0); glPopMatrix(); glRotatef( 90, 1.0, 0.0, 0.0); glutSolidCone(0.025,0.6, 6, 16); glPopMatrix(); // varilla de los segundos glPushMatrix(); glColor3f(1.0, 0.0, 0.5); glTranslatef( 0, 0, -0.0); glRotatef( (360/60) * newtime->tm_sec, 0.0, 0.0, 1.0); glPushMatrix(); glTranslatef(0.0, 0.0, 4.0); glScalef(0.25, 0.25, 1.0); glPopMatrix(); glRotatef( 90, 1.0, 0.0, 0.0); glutSolidCone(0.025,0.8, 6, 16); glPopMatrix(); //Dibujamos las marcas de las horas for(varilla_horas = 0; varilla_horas < 12; varilla_horas++){ glPushMatrix(); glColor3f(0, 1, 0); glTranslatef(0.0, 0.0, 0.0); glRotatef( (360/12) * varilla_horas, 0.0, 0.0, 1.0); glTranslatef( 0.9, 0.0, 0.0); glRotatef(-180,1,0,0); glutSolidCone(0.05,0.4, 6, 16); glPopMatrix(); } //Dibujamos las marcas de los segundos for(varilla_sec = 0; varilla_sec < 60; varilla_sec++){ glPushMatrix(); glColor3f(0, 0, 1); glTranslatef(0.0, 0.0, 0.0); glRotatef( (360/60) * varilla_sec, 0.0, 0.0, 1.0); glTranslatef(0.9, 0.0, 0.0); glutSolidCube(0.03); glPopMatrix(); } glPushMatrix(); glTranslatef(0,0,0); glRotatef(alfa, 0.1, 0.2, 0.5); glColor3ub(255,0,255); glutWireCube(0.15); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); }
// render the scene void render() { // clear the screen glClearColor(0.0, 0.0, 0.2, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(0); char* Text = new char[100]; std::string viewText; Text = (char*) "WASD to move sphere, Arrow keys to move cylinder, 1-4 to change light"; Sprint(-0.9,0.9,Text); if( viewType == 1 ) { viewText = "Light source: Ambient"; } else if( viewType == 2 ) { viewText = "Light source: Spotlight"; } else if( viewType == 3 ) { viewText = "Light source: Point"; } else if( viewType == 4 ) { viewText = "Light source: Distance"; } Sprint(-0.9,0.8,viewText.c_str()); // enable the shader program glUseProgram(program); GLuint lightID = glGetUniformLocation(program, "LightPosition_worldspace"); if( viewType == 2 || viewType == 3 ) { // light glm::vec3 lightPos = glm::vec3(0,4,0); glUniform3f(lightID, lightPos.x, lightPos.y, lightPos.z); } else if( viewType == 4 ) { glm::vec3 lightPos = glm::vec3(0,1,-5); glUniform3f(lightID, lightPos.x, lightPos.y, lightPos.z); } // loop through each planet for( int index = 0; index < numImages; index++ ) { // premultiply the matrix for this example images[index].mvp = projection * view * images[index].model; // upload the matrix to the shader glUniformMatrix4fv(loc_mvpmat, 1, GL_FALSE, &(images[index].mvp[0][0])); glUniformMatrix4fv(modelMatrixID, 1, GL_FALSE, &(images[index].model[0][0])); glUniformMatrix4fv(viewMatrixID, 1, GL_FALSE, &(images[index].view[0][0])); // set up the Vertex Buffer Object so it can be drawn glEnableVertexAttribArray(loc_position); glBindBuffer(GL_ARRAY_BUFFER, images[index].vbo_geometry); // set pointers into the vbo for each of the attributes(position and color) glVertexAttribPointer( loc_position,//location of attribute 3,//number of elements GL_FLOAT,//type GL_FALSE,//normalized? sizeof(Vertex),//stride 0);//offset glEnableVertexAttribArray(loc_texture); glBindTexture(GL_TEXTURE_2D, images[index].texture); glVertexAttribPointer( loc_texture, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex,uv)); glEnableVertexAttribArray(vertexNormal_modelspaceID); glBindBuffer(GL_ARRAY_BUFFER, images[index].normalbuffer); // 3rd attribute buffer : normals glVertexAttribPointer( vertexNormal_modelspaceID, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex,normals)); glDrawArrays(GL_TRIANGLES, 0, images[index].geometrySize);//mode, starting index, count } //clean up glDisableVertexAttribArray(loc_position); glDisableVertexAttribArray(loc_texture); glDisableVertexAttribArray(vertexNormal_modelspaceID); //swap the buffers glutSwapBuffers(); }
void Initialize() { int i,j; int localGroupSize; int localNumberOfGroups; int concessionClerkStateRV; int ticketClerkStateRV; int ttTakingTicketsRV; int ticketTakerStateRV; int ticketTakerGroupIndicatorRV; int ticketTakerTheatreCountStatusRV; int localTotalCustomerNumber; int availableCustSizeForGroupArrRV; CreateLock("InitLock"); Acquire("InitLock"); /* int concessionClerkState[GlobalnoOfCC]; /*Stores the Concession Clerks State*/ concessionClerkStateRV = CreateMV("ccState",GlobalnoOfCC); if(concessionClerkStateRV==1) { for(i=0;i<GlobalnoOfCC;i++) { SetMV("ccState",i,1); } } /* int ticketClerkState[GlobalnoOfTC]; /* Stores the state of each Ticket Clerk */ ticketClerkStateRV = CreateMV("ticketClerkState",GlobalnoOfTC); if(ticketClerkStateRV==1) { for(i=0;i<GlobalnoOfTC;i++) { SetMV("ticketClerkState",i,1); } } /* int ttTakingTickets; /*Stores if TT are taking tickets*/ ttTakingTicketsRV = CreateMV("ttTakingTickets",1); if(ttTakingTicketsRV==1) { SetMV("ttTakingTickets",0,1); } /* int ticketTakerState[GlobalnoOfTT]; /*State of each TT(Ticket Taker)*/ ticketTakerStateRV = CreateMV("ticketTakerState",GlobalnoOfTT); if(ticketTakerStateRV==1) { for(i=0;i<GlobalnoOfTT;i++) { SetMV("ticketTakerState",i,1); } } /* int ticketTakerGroupIndicator[GlobalnoOfTT]; /*Indicates a group whether to go inside or wait in lobby*/ ticketTakerGroupIndicatorRV = CreateMV("TTGroupInd",GlobalnoOfTT); if(ticketTakerGroupIndicatorRV==1) { for(i=0;i<GlobalnoOfTT;i++) { SetMV("TTGroupInd",i,1); } } /* int ticketTakerTheatreCountStatus=1; /*count for the ticket taker*/ ticketTakerTheatreCountStatusRV = CreateMV("ttTheCount",1); if(ticketTakerTheatreCountStatusRV==1) { SetMV("ttTheCount",0,1); } /* int availableCustSizeForGroupArr[50]; /*Array for each customer to determine its group*/ availableCustSizeForGroupArrRV=CreateMV("avCustGrpArr",50); for(i=0;i<GlobalnoOfGroups;i++) { if(availableCustSizeForGroupArrRV==1) { SetMV("avCustGrpArr",i,GlobalGroupNormalCustSize); } } Release("InitLock"); /*******************************************************************************************************/ /* int totalCustomerNumber; /* Total Number of Customers */ CreateMV("totCustNum",1); /* int noOfGroups; /* Stores the number of groups generated */ CreateMV("noOfGroups",1); SetMV("noOfGroups",0,GlobalnoOfGroups); /* %%%%%%%%%%%%%% For the time being. %%%%%%%%%%%%%%%% */ /* int noOfTC;*/ CreateMV("noOfTC",1); SetMV("noOfTC",0,GlobalnoOfTC); /* int noOfCC;*/ CreateMV("noOfCC",1); SetMV("noOfCC",0,GlobalnoOfCC); /* int noOfTT;*/ CreateMV("noOfTT",1); SetMV("noOfTT",0,GlobalnoOfTT); /* int noOfCustomers;*/ CreateMV("noOfCustomers",1); /* int groupSize;*/ CreateMV("groupSize",1); /* int totalAmtTicket;*/ /* Total Amount Variable */ CreateMV("totalAmtTicket",1); /* int noOfTickets[GlobalnoOfTC]; /* Keep track of no. of tickets sold by each clerk */ CreateMV("noOfTickets",GlobalnoOfTC); /* int ticketClerkAmount[GlobalnoOfTC]; /* Amount given by customer at each TicketClerk */ CreateMV("ticketClerkAmount",GlobalnoOfTC); /* int totalAmountTicketClerk[GlobalnoOfTC]; /* Amount deposited at each TicketClerk */ CreateMV("totAmtTC",GlobalnoOfTC); /* int ticketClerkOnBreak=0; /* Count of the Ticket Clerks on break*/ CreateMV("tcOnBreak",1); /* int managerTcWait[GlobalnoOfTC]; /* Manager signal for each Ticket Clerk*/ CreateMV("managerTcWait",GlobalnoOfTC); /* int custFindLineTC[GlobalnoOfTC]; /* Variable to say that broadcast customers*/ CreateMV("custFindLineTC",GlobalnoOfTC); /* int reFindLineTC[GlobalnoOfTC]; /*Flag to say that the customer has to find line again*/ CreateMV("reFindLineTC",GlobalnoOfTC); /* int totalAmountConcessionClerk[GlobalnoOfCC]; /*Total Amount stored by all Concession Clerks*/ CreateMV("totAmtCC",GlobalnoOfCC); /* int concessionClerkLineCount[GlobalnoOfCC]; /*Stores the Concession Clerks Line Count*/ CreateMV("ccLineCnt",GlobalnoOfCC); /* $$$$$$$$ Ticket Clerk Variables $$$$$$$$ */ /* int ticketClerkLineCount[GlobalnoOfTC]; /* Stores the Line Count of each Ticket Clerk */ CreateMV("tcLineCnt",GlobalnoOfTC); /* int ticketClerkLineCVInt[GlobalnoOfTC]; */ /* char ticketClerkLineCVChar[GlobalnoOfTC][200]; */ for(i=0;i<GlobalnoOfTC;i++) { Sprint(ticketClerkLineCVChar[i],"TCLineCV",i); /*changed this $$$$$$$$$$$$$$$$$$$$*/ CreateCV(ticketClerkLineCVChar[i]); } /* int ticketClerkLineLockInt; */ CreateLock("tcLineLock"); /* int totalAmtTicketLockInt; */ CreateLock("toAmtTktLck"); /* int ticketClerkCVInt[GlobalnoOfTC]; */ /* char ticketClerkCVChar[GlobalnoOfTC][200]; */ for(i=0;i<GlobalnoOfTC;i++) { Sprint(ticketClerkCVChar[i],"TCCV",i); CreateCV(ticketClerkCVChar[i]); } /* int ticketClerkLockInt[GlobalnoOfTC]; */ /* char ticketClerkLockChar[GlobalnoOfTC][200]; */ for(i=0;i<GlobalnoOfTC;i++) { Sprint(ticketClerkLockChar[i],"TCLock",i); CreateLock(ticketClerkLockChar[i]); } /* int concessionClerkLineCVInt[GlobalnoOfCC]; */ /* char concessionClerkLineCVChar[GlobalnoOfCC][200]; */ for(i=0;i<GlobalnoOfCC;i++) { Sprint(concessionClerkLineCVChar[i],"CCLineCV",i); CreateCV(concessionClerkLineCVChar[i]); } /* int concessionClerkLineLockInt; */ CreateLock("ccLineLock"); /* int totalAmtPopSodaLockInt; */ CreateLock("toAmtPopLck"); /* int noOfSoda[GlobalnoOfCC]; /*customer Vaiable to store soda value on a Concession Clerk*/ CreateMV("noOfSoda",GlobalnoOfCC); /* int noOfPopcorn[GlobalnoOfCC]; /*customer Vaiable to store popcorn value on a Concession Clerk*/ CreateMV("noOfPopcorn",GlobalnoOfCC); /* int totalMoneySoda; /*total money by Soda*/ CreateMV("totalMoneySoda",1); /* int totalMoneyPopcorn; /*total money by popcorn*/ CreateMV("totalMoneyPopcorn",1); /* int amountSoda[GlobalnoOfCC]; /*Amount customer has to pay for Soda*/ CreateMV("amountSoda",GlobalnoOfCC); /* int amountPopcorn[GlobalnoOfCC]; /*Amount customer has to pay for Popcorn*/ CreateMV("amountPopcorn",GlobalnoOfCC); /* int concessionClerkCVInt[GlobalnoOfCC]; */ /* char concessionClerkCVChar[GlobalnoOfTC][200]; */ for(i=0;i<GlobalnoOfTC;i++) { Sprint(concessionClerkCVChar[i],"CCCV",i); CreateCV(concessionClerkCVChar[i]); } /* int concessionClerkLockInt[GlobalnoOfCC]; */ /* char concessionClerkLockChar[GlobalnoOfCC][200]; */ for(i=0;i<GlobalnoOfCC;i++) { Sprint(concessionClerkLockChar[i],"CCLock",i); CreateLock(concessionClerkLockChar[i]); } /* int conClerkOnBreak=0; /*Count of CCs on break*/ CreateMV("conClerkOnBreak",1); /* int managerCcWait[GlobalnoOfCC]; /*Flag for wait of CC*/ CreateMV("managerCcWait",GlobalnoOfCC); /* int custFindLineCC[GlobalnoOfCC]; /*Variable of CC to tell customer to find line*/ CreateMV("custFindLineCC",GlobalnoOfCC); /* int reFindLineCC[GlobalnoOfCC]; /*Flag for customer to find line again*/ CreateMV("reFindLineCC",GlobalnoOfCC); /*********Variables for Technician Manager and Customer Interaction*********/ /* int movieTheaterLockInt; */ CreateLock("movieTheaterLock"); /* int movieTheaterCVInt; */ CreateCV("movieTheaterCV"); /* int custEnteredTheater; /*Count of Cust entering the theater room*/ CreateMV("custEnteredTheater",1); /* int custLeavingTheater; /*Count of Cust leaving the theater room*/ CreateMV("custLeavingTheater",1); /* int isMovieOver; /* Stores the movie state*/ CreateMV("isMovieOver",1); /* int movieTechLockInt; /* Lock for Movie Technician */ CreateLock("movieTechLock"); /* int movieTechCVInt; /* Conditon Variable for Technician*/ CreateCV("movieTechCV"); /* int custFinalExitLockInt; /* Lock for count of finally exiting customers*/ CreateLock("custFinalExitLock"); /* int custFinalExitCount; /*Variable for count of finally exiting customers*/ CreateMV("custFinalExitCount",1); /*/////////////////////////////Ticket Taker//////////////////////////////////*/ /* int custTicketsApproved=0; /*Stores the no of tickets approved to go inside theater room*/ CreateMV("custTicketsApproved",1); /* int ticketTakerLineCount[GlobalnoOfTT]; /*Stores the Line count of each TT*/ CreateMV("ttLineCnt",GlobalnoOfTT); /* int custNoOfTicket[GlobalnoOfTT]; /*Number of tickets of each group*/ CreateMV("custNoOfTicket",GlobalnoOfTT); /* int ticketTakerLineLockInt; /* Lock for the TT Line*/ CreateLock("ttLineLock"); /* int ticketTakerLockInt[GlobalnoOfTT]; /* Lock for each TT*/ /* char ticketTakerLockChar[GlobalnoOfTT][200]; */ for(i=0;i<GlobalnoOfTT;i++) { Sprint(ticketTakerLockChar[i],"TTLock",i); CreateLock(ticketTakerLockChar[i]); } /* int ticketTakerManagerLockInt; /* TicketTaker Manager Lock*/ CreateLock("ttMgrLock"); /* int custTicketsApprovedLockInt; /* Lock for total tickets approved to go inside*/ CreateLock("TktsAppLock"); /* int ticketTakerLineCVInt[GlobalnoOfTT]; /* CV for each TT Line*/ /* char ticketTakerLineCVChar[GlobalnoOfTT][200]; */ for(i=0;i<GlobalnoOfTT;i++) { Sprint(ticketTakerLineCVChar[i],"TTLineCV",i); CreateCV(ticketTakerLineCVChar[i]); } /* int ticketTakerCVInt[GlobalnoOfTT]; /* CV for each TT interaction*/ /* char ticketTakerCVChar[GlobalnoOfTT][200]; */ for(i=0;i<GlobalnoOfTT;i++) { Sprint(ticketTakerCVChar[i],"TTCV",i); CreateCV(ticketTakerCVChar[i]); } /* int ticketTakerManagerCVInt; /* CV for Technician */ CreateCV("ttMgrCV"); /* int customerLobbyCVInt; /*CV for Lobby*/ CreateCV("customerLobbyCV"); /* int customerLobbyLockInt; /*Lock for Lobby*/ CreateLock("customerLobbyLock"); /* int isTakingTickets; /*Stores whether the TT is taking tickets or not*/ CreateMV("isTakingTickets",1); /* int ttWaitShowOverLockInt[GlobalnoOfTT]; /*Lock for TT till the next show starts*/ /* char ttWaitShowOverLockChar[GlobalnoOfTT][200]; */ for(i=0;i<GlobalnoOfTT;i++) { Sprint(ttWaitShowOverLockChar[i],"ttWSOLock",i); CreateLock(ttWaitShowOverLockChar[i]); } /* int ttWaitShowOverCVInt[GlobalnoOfTT]; /*CV for waiting of TT till next show start*/ /* char ttWaitShowOverCVChar[GlobalnoOfTT][200]; */ for(i=0;i<GlobalnoOfTT;i++) { Sprint(ttWaitShowOverCVChar[i],"ttWSOCV",i); CreateCV(ttWaitShowOverCVChar[i]); } /***************************Variables for Group Interaction*********************************/ /* int groupLockInt[GlobalnoOfGroups]; /*Group Lock for each group*/ /* char groupLockChar[GlobalnoOfGroups][200]; */ for(i=0;i<GlobalnoOfGroups;i++) { Sprint(groupLockChar[i],"groupLock",i); CreateLock(groupLockChar[i]); } /* int groupCVInt[GlobalnoOfGroups]; /* CV for each group*/ /* char groupCVChar[GlobalnoOfGroups][200]; */ for(i=0;i<GlobalnoOfGroups;i++) { Sprint(groupCVChar[i],"groupCV",i); CreateCV(groupCVChar[i]); } /* int canGoInsideTheater[GlobalnoOfGroups]; /*Stores whether Cust can go inside*/ CreateMV("canGoInsideTheater",GlobalnoOfGroups); /* int canGoBathroom[GlobalnoOfGroups]; /*Stores whtehr cust can go to bathroom*/ CreateMV("canGoBathroom",GlobalnoOfGroups); /* int counterAfterMuvi[GlobalnoOfGroups]; /* stores the count of cust got up after movie*/ CreateMV("counterAfterMuvi",GlobalnoOfGroups); /* int counterAfterBathroom[GlobalnoOfGroups]; /* stores the count of cust going to bathroom*/ CreateMV("ctrAfterBath",GlobalnoOfGroups); /* int bathroomLobbyCVInt[GlobalnoOfGroups]; /* CV for use when other cust has to wait when 1 goes to bathroom*/ /* char bathroomLobbyCVChar[GlobalnoOfGroups][200]; */ for(i=0;i<GlobalnoOfGroups;i++) { Sprint(bathroomLobbyCVChar[i],"bLobbyCV",i); CreateCV(bathroomLobbyCVChar[i]); } /* int bathroomLockInt; /* Lock for bathroom*/ CreateLock("bathroomLock"); /* int ttWaitingAfterFull[GlobalnoOfTT]; */ CreateMV("ttWaitingAfterFull",GlobalnoOfTT); /* int managerWokeTT[GlobalnoOfTT]; /*manager waking up TT to start taking ticket*/ CreateMV("managerWokeTT",GlobalnoOfTT); /* int countCustTT; /*count of cust going to TT*/ CreateMV("countCustTT",1); /* int total; */ CreateMV("total",1); /* int totalHeadCust; /*Count of all head customer*/ CreateMV("totalHeadCust",1); /* int groupPopcorn[GlobalnoOfGroups]; /*popcorn by each group*/ CreateMV("groupPopcorn",GlobalnoOfGroups); /* int groupSoda[GlobalnoOfGroups]; /* Soda ordered by each group*/ CreateMV("groupSoda",GlobalnoOfGroups); /* int haveTickets[GlobalnoOfGroups]; /*Stores whtehr the head have tickets or not*/ CreateMV("haveTickets",GlobalnoOfGroups); /* int givenFoodChoice[GlobalnoOfGroups]; /*sores whther give the food choice*/ CreateMV("givenFoodChoice",GlobalnoOfGroups); /*Seat variabes*/ /* int rowNo,columnNo; /*row number and column number of seat*/ CreateMV("rowNo",1); CreateMV("columnNo",1); /* int counterVal[GlobalnoOfGroups]; /*counter for each customer accessing seat*/ CreateMV("counterVal",GlobalnoOfGroups); /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ /* int movieRoomSeatNoArray[5][5]; /*array for storing seat avaible or not int movieRoomGrpNoArray[5][5]; /*array for storing seat assigned to which group */ /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ /* int sizeForGroupArr[50]; /*Storing the group size for each group*/ CreateMV("sizeForGroupArr",50); /*Global Part for TC myIndex value*/ /* int ticketClerkIndexLockInt; */ CreateLock("ticketClerkIndexLock"); /* int nextTCIndex=0; */ CreateMV("nextTCIndex",1); /*Global Part for Customer value*/ /* int groupNumberLockInt, customerNumberLockInt, groupSizeLockInt; */ CreateLock("groupNumberLock"); CreateLock("customerNumberLock"); CreateLock("groupSizeLock"); /* int nextGroupNumber=0, nextCustomerNumber=0, nextGroupSize=0; */ CreateMV("nextGroupNumber",1); CreateMV("nextCustomerNumber",1); CreateMV("nextGroupSize",1); /*Global Part for CC myIndex value*/ /* int concessionClerkIndexLockInt; */ CreateLock("ccIndexLock"); /* int nextCCIndex=0; */ CreateMV("nextCCIndex",1); /* int determineCustGroupNumberLockInt; */ CreateLock("custGrpNumLock"); /*Global Part for TT myIndex value*/ /* int ticketTakerIndexLockInt; */ CreateLock("ticketTakerIndexLock"); /* int nextTTIndex=0; */ CreateMV("nextTTIndex",1); /* int checkFinalExitLockInt; */ CreateLock("checkFinalExitLock"); /* int finalExitFlag=0; */ CreateMV("finalExitFlag",1); /* numberOfGroups=noOfGroups;*/ /*$$$$$$$$$$$$$$$$$ From Main Function $$$$$$$$$$$$$$$$$*/ localNumberOfGroups=GetMV("noOfGroups",0); /* Acquire("InitLock"); /* ############################################################### */ /* totalHeadCust=numberOfGroups;*/ SetMV("totalHeadCust",0,localNumberOfGroups); SetMV("totCustNum",0,GlobalnoOfGroups*(GlobalGroupNormalCustSize+1)); for(i=0;i<localNumberOfGroups;i++) { /* groupSize=Rand(5);*/ /*localGroupSize = Rand(5);*/ /*$$$$$$$$$$$$$$$$$ Hardcoded to 0 $$$$$$$$$$$$$$$$$*/ localGroupSize=0; SetMV("groupSize",0,GlobalGroupNormalCustSize); /* sizeForGroupArr[i]=groupSize; /*Assigning group size*/ localGroupSize = GetMV("groupSize",0); SetMV("sizeForGroupArr",i,localGroupSize); /* availableCustSizeForGroupArr[i]=groupSize; */ /* if(availableCustSizeForGroupArrRV==1) { SetMV("avCustGrpArr",i,localGroupSize); //Removed from here to top, inside the lock. } */ /* totalCustomerNumber++;*/ localTotalCustomerNumber=GetMV("totCustNum",0); /* SetMV("totCustNum",0,localTotalCustomerNumber+1);*/ for (j=0;j<localGroupSize;j++ ) { /* totalCustomerNumber++; */ localTotalCustomerNumber=GetMV("totCustNum",0); /* SetMV("totCustNum",0,localTotalCustomerNumber+1);*/ /* Fork(Customer); */ } } /* Release("InitLock"); /* ############################################################### */ /* Release("InitLock"); */ }