Last change
on this file since 140 was
117,
checked in by rosiere, 15 years ago
|
1) Platforms : add new organization for test
2) Load_Store_Unit : add array to count nb_check in store_queue
3) Issue_queue and Core_Glue : rewrite the issue network
4) Special_Register_Unit : add reset value to register CID
5) Softwares : add multicontext test
6) Softwares : add SPECINT
7) Softwares : add MiBench?
7) Read_queue : inhib access for r0
8) Change Core_Glue (network) - dont yet support priority and load balancing scheme
|
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id
|
File size:
1020 bytes
|
Rev | Line | |
---|
[117] | 1 | #include <stdlib.h> |
---|
| 2 | #include <stdio.h> |
---|
| 3 | #include <string.h> |
---|
| 4 | |
---|
| 5 | #define UNLIMIT |
---|
| 6 | #define MAXARRAY 60000 /* this number, if too large, will cause a seg. fault!! */ |
---|
| 7 | |
---|
| 8 | struct myStringStruct { |
---|
| 9 | char qstring[128]; |
---|
| 10 | }; |
---|
| 11 | |
---|
| 12 | int compare_myStringStruct(const void *elem1, const void *elem2) |
---|
| 13 | { |
---|
| 14 | int result; |
---|
| 15 | |
---|
| 16 | result = strcmp((*((struct myStringStruct *)elem1)).qstring, (*((struct myStringStruct *)elem2)).qstring); |
---|
| 17 | |
---|
| 18 | return (result < 0) ? 1 : ((result == 0) ? 0 : -1); |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | int |
---|
| 23 | main_qsort_small(int argc, char *argv[]) { |
---|
| 24 | struct myStringStruct array[MAXARRAY]; |
---|
| 25 | FILE *fp; |
---|
| 26 | int i,count=0; |
---|
| 27 | |
---|
| 28 | if (argc<2) { |
---|
| 29 | fprintf(stderr,"Usage: qsort_small <file>\n"); |
---|
| 30 | exit(-1); |
---|
| 31 | } |
---|
| 32 | else { |
---|
| 33 | fp = fopen(argv[1],"r"); |
---|
| 34 | |
---|
| 35 | while((fscanf(fp, "%s", (char *)(&array[count].qstring)) == 1) && (count < MAXARRAY)) { |
---|
| 36 | count++; |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | printf("\nSorting %d elements.\n\n",count); |
---|
| 40 | qsort(array,count,sizeof(struct myStringStruct),compare_myStringStruct); |
---|
| 41 | |
---|
| 42 | for(i=0;i<count;i++) |
---|
| 43 | printf("%s\n", array[i].qstring); |
---|
| 44 | return 0; |
---|
| 45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.