All pastes #608705 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-08 13:31 UTC
rendered paste body
// -------------------------------------------------------------------------------------------------------------------------------------
// Function:    AllenVM_CPU_BASE_CMP_GT();
// Purpose:     Greater than.
// Returns:     0/1 wether false/true.
// -------------------------------------------------------------------------------------------------------------------------------------

static int AllenVM_CPU_BASE_CMP_GT(struct AllenInterp *i, int argc, char **argv, void *pd) {
 char buf[TBASE_CMP_BSIZE]; int n,x,y; register float c=1;                               // Buffer and parameters.
 for(n=1; n<argc-1; ++n) { if (!strcmp(argv[n],":")) break; }                            // Get parameters.

 for(x=1; x<n; ++x)                                                                      // Loop through first parameters.
  for(y=n; y<argc; ++y)                                                                  // Loop through second parameters.
   if(atof(argv[x]) <= atof(argv[y])) { c=0; break; }                                    // Make comparison.

 snprintf(buf,TBASE_CMP_BSIZE,"%f",c);                                                   // Copy result to buffer as float.
 AllenVM_InterpSetResult(i,buf);                                                         // Set interpreter result.
 return Allen_VM_OK;                                                                     // Everything ok.
}