Exemple #1
0
void quicksort(int A[10],int f,int l){
	
	int i,j,tmp;
	if(l>f){
		i=f+1;
		j=l;
		i=icheck(A,i,f);
		j=jcheck(A,j,f);
		
		while(i<j){
			tmp=A[i];
			A[i]=A[j];
			A[j]=tmp;
			i++;
			j--;
			i=icheck(A,i,f);
			j=jcheck(A,j,f);
		}
		tmp=A[f];
		A[f]=A[j];
		A[j]=tmp;
		quicksort(A,f,j-1);
		quicksort(A,j+1,l);
	
	}

}
Exemple #2
0
int
m_Enumerate(Object *in, Object *out)
{
    int i;
    int *ip = NULL;
    char *cp = NULL;
    out[0] = NULL;


    icheck(in[0], "start");
    icheck(in[1], "end");

    if (in[2]) {
	if (!DXExtractInteger(in[2], &i) || (i <= 0)) {
	    DXSetError(ERROR_BAD_PARAMETER, "#10020", "count");
	    goto error;
	}
	ip = &i;
    }
    
    icheck(in[3], "delta");

    if (in[4] && !DXExtractString(in[4], &cp)) {
	DXSetError(ERROR_BAD_PARAMETER, "#10200", "method");
	goto error;
    }
    
    out[0] = (Object)MakeSequence((Array)in[0], (Array)in[1], ip, 
				  (Array)in[3], cp);
    
  error:
    return out[0] ? OK : ERROR;
}
Exemple #3
0
 int
main(void)
{
	FILE *f;
	Akind *a = 0;
	int Ldef = 0;
	unsigned int nanbits[2];

	fpinit_ASL();
#ifdef WRITE_ARITH_H	/* for Symantec's buggy "make" */
	f = fopen("arith.h", "w");
	if (!f) {
		printf("Cannot open arith.h\n");
		return 1;
		}
#else
	f = stdout;
#endif

	if (sizeof(double) == 2*sizeof(long))
		a = Lcheck();
	else if (sizeof(double) == 2*sizeof(int)) {
		Ldef = 1;
		a = icheck();
		}
	else if (sizeof(double) == sizeof(long))
		a = ccheck();
	if (a) {
		fprintf(f, "#define %s\n#define Arith_Kind_ASL %d\n",
			a->name, a->kind);
		if (Ldef)
			fprintf(f, "#define Long int\n#define Intcast (int)(long)\n");
		if (dalign)
			fprintf(f, "#define Double_Align\n");
		if (sizeof(char*) == 8)
			fprintf(f, "#define X64_bit_pointers\n");
#ifndef NO_LONG_LONG
		if (sizeof(long long) > sizeof(long)
		 && sizeof(long long) == sizeof(void*))
			fprintf(f, "#define LONG_LONG_POINTERS\n");
		if (sizeof(long long) < 8)
#endif
			fprintf(f, "#define NO_LONG_LONG\n");
		if (a->kind <= 2) {
			if (fzcheck())
				fprintf(f, "#define Sudden_Underflow\n");
			t_nan = -a->kind;
			if (need_nancheck())
				fprintf(f, "#define NANCHECK\n");
			if (sizeof(double) == 2*sizeof(unsigned int)) {
				get_nanbits(nanbits, a->kind);
				fprintf(f, "#define QNaN0 0x%x\n", nanbits[0]);
				fprintf(f, "#define QNaN1 0x%x\n", nanbits[1]);
				}
			}
		return 0;
		}
	fprintf(f, "/* Unknown arithmetic */\n");
	return 1;
	}
Exemple #4
0
int
main(void)
{
	Akind *a = 0;
	int Ldef = 0;
	FILE *f;

#ifdef WRITE_ARITH_H	/* for Symantec's buggy "make" */
	f = fopen("arith.h", "w");
	if (!f) {
		printf("Cannot open arith.h\n");
		return 1;
		}
#else
	f = stdout;
#endif

	if (sizeof(double) == 2*sizeof(long))
		a = Lcheck();
	else if (sizeof(double) == 2*sizeof(int)) {
		Ldef = 1;
		a = icheck();
		}
	else if (sizeof(double) == sizeof(long))
		a = ccheck();
	if (a) {
		fprintf(f, "#define %s\n#define Arith_Kind_ASL %d\n",
			a->name, a->kind);
		if (Ldef)
			fprintf(f, "#define Long int\n#define Intcast (int)(long)\n");
		if (dalign)
			fprintf(f, "#define Double_Align\n");
		if (sizeof(char*) == 8)
			fprintf(f, "#define X64_bit_pointers\n");
#ifndef NO_LONG_LONG
		if (sizeof(long long) < 8)
#endif
			fprintf(f, "#define NO_LONG_LONG\n");
		if (a->kind <= 2 && fzcheck())
			fprintf(f, "#define Sudden_Underflow\n");
#ifdef WRITE_ARITH_H
		fclose(f);
#endif
		return 0;
		}
	fprintf(f, "/* Unknown arithmetic */\n");
#ifdef WRITE_ARITH_H
	fclose(f);
#endif
	return 1;
	}