* src/vm/method.h (methodinfo): Moved `entrypoint` to `codeinfo`.
[cacao.git] / src / cacaoh / headers.c
1 /* src/cacaoh/headers.c - functions for header generation
2
3    Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    Contact: cacao@cacaojvm.org
26
27    Authors: Reinhard Grafl
28
29    Changes: Mark Probst
30             Philipp Tomsich
31             Christian Thalinger
32                         Edwin Steiner
33
34    $Id: headers.c 4598 2006-03-14 22:16:47Z edwin $
35
36 */
37
38
39 #include <assert.h>
40 #include <ctype.h>
41 #include <stdarg.h>
42 #include <stdlib.h>
43 #include <string.h>
44
45 #include "config.h"
46 #include "vm/types.h"
47
48 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
49 # if defined(__DARWIN__)
50 #  include <signal.h>
51 # endif
52 # include <ucontext.h>
53 #endif
54
55 #include "mm/boehm.h"
56 #include "mm/memory.h"
57 #include "native/include/java_lang_String.h"
58 #include "native/include/java_lang_Throwable.h"
59 #include "toolbox/chain.h"
60 #include "toolbox/logging.h"
61 #include "vm/builtin.h"
62 #include "vm/class.h"
63 #include "vm/global.h"
64 #include "vm/method.h"
65 #include "vm/loader.h"
66 #include "vm/options.h"
67 #include "vm/stringlocal.h"
68 #include "vm/jit/asmpart.h"
69
70
71 #if defined(ENABLE_INTRP)
72 /* dummy interpreter stack to keep the compiler happy */
73
74 u1 *intrp_main_stack;
75 #endif
76
77
78 /* for raising exceptions from native methods *********************************/
79
80 #if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
81 java_objectheader *_no_threads_exceptionptr = NULL;
82 #endif
83
84
85 /* replace some non-vmcore functions ******************************************/
86
87 functionptr native_findfunction(utf *cname, utf *mname, utf *desc,
88                                                                 bool isstatic)
89 {
90         /* return something different than NULL, otherwise we get an exception */
91
92         return (functionptr) 1;
93 }
94
95 java_objectheader *native_new_and_init(classinfo *c) { return NULL; }
96 java_objectheader *native_new_and_init_string(classinfo *c, java_lang_String *s) { return NULL; }
97 java_objectheader *native_new_and_init_int(classinfo *c, s4 i) { return NULL; }
98 java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwable *t) { return NULL; }
99
100
101 java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
102 { return NULL; }
103
104
105 /* code patching functions */
106 void patcher_builtin_arraycheckcast(u1 *sp) {}
107
108 #if defined(__MIPS__)
109 long compare_and_swap(long *p, long oldval, long newval)
110 {
111         if (*p == oldval) {
112                 *p = newval;
113                 return oldval;
114         } else
115                 return *p;
116 }
117 #endif
118
119
120 u1 *createcompilerstub(methodinfo *m) { return NULL; }
121 #if defined(ENABLE_INTRP)
122 u1 *intrp_createcompilerstub(methodinfo *m) { return NULL; }
123 #endif
124
125 codeinfo *codegen_createnativestub(functionptr f, methodinfo *m) { return NULL; }
126
127 void removecompilerstub(u1 *stub) {}
128 void removenativestub(u1 *stub) {}
129
130 void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop) {}
131 u1* asm_initialize_thread_stack(void *func, u1 *stack) { return NULL; }
132
133 void *asm_switchstackandcall(void *stack, void *func, void **stacktopsave, void * p) { return NULL; }
134
135 void asm_handle_builtin_exception(classinfo *c) {}
136
137
138 #if defined(ENABLE_JIT)
139 void asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out) {}
140 #endif
141
142 #if defined(ENABLE_INTRP)
143 void intrp_asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out) {}
144 #endif
145
146
147 void *Java_java_lang_VMObject_clone(void *env, void *clazz, void * this)
148 {
149         return NULL;
150 }
151
152 typecheck_result typeinfo_is_assignable_to_class(typeinfo *value,classref_or_classinfo dest)
153 {
154         return typecheck_TRUE;
155 }
156
157 void typeinfo_init_classinfo(typeinfo *info,classinfo *c)
158 {
159 }
160
161 bool typeinfo_init_class(typeinfo *info,classref_or_classinfo c)
162 {
163         return true;
164 }
165
166 void typeinfo_print(FILE *file,typeinfo *info,int indent) {}
167
168 void exceptions_print_exception(java_objectheader *xptr) {}
169 void stacktrace_print_trace(java_objectheader *xptr) {}
170
171 void code_free_code_of_method(methodinfo *m) {}
172
173
174 /* exception functions ********************************************************/
175
176 /* these should not be called */
177
178 void throw_main_exception_exit(void) { assert(0); }
179 void throw_exception(void) { assert(0); }
180 void throw_exception_exit(void) { assert(0); }
181
182 java_objectheader *new_verifyerror(methodinfo *m, const char *message)
183 {
184         assert(0);
185
186         /* keep compiler happy */
187
188         return NULL;
189 }
190
191 java_objectheader *new_exception_throwable(const char *classname, java_lang_Throwable *throwable)
192 {
193         assert(0);
194
195         /* keep compiler happy */
196
197         return NULL;
198 }
199
200
201 void throw_cacao_exception_exit(const char *exception, const char *message, ...)
202 {
203         va_list ap;
204
205         fprintf(stderr, "%s: ", exception);
206
207         va_start(ap, message);
208         vfprintf(stderr, message, ap);
209         va_end(ap);
210
211         fputc('\n', stderr);
212
213         exit(1);
214 }
215
216
217 void exceptions_throw_outofmemory_exit(void)
218 {
219         fprintf(stderr, "java.lang.InternalError: Out of memory\n");
220         exit(1);
221 }
222
223
224 java_objectheader *new_exception(const char *classname)
225 {
226         fprintf(stderr, "%s\n", classname);
227         exit(1);
228
229         /* keep compiler happy */
230
231         return NULL;
232 }
233
234
235 java_objectheader *new_exception_message(const char *classname, const char *message)
236 {
237         fprintf(stderr, "%s: %s\n", classname, message);
238         exit(1);
239
240         /* keep compiler happy */
241
242         return NULL;
243 }
244
245
246 java_objectheader *new_exception_utfmessage(const char *classname, utf *message)
247 {
248         fprintf(stderr, "%s: ", classname);
249         utf_display(message);
250         fputc('\n', stderr);
251
252         exit(1);
253
254         /* keep compiler happy */
255
256         return NULL;
257 }
258
259
260 java_objectheader *new_exception_javastring(const char *classname,
261                                                                                         java_lang_String *message)
262 {
263         fprintf(stderr, "%s: ", classname);
264         /* TODO print message */
265         fputc('\n', stderr);
266
267         exit(1);
268
269         /* keep compiler happy */
270
271         return NULL;
272 }
273
274
275 java_objectheader *new_classformaterror(classinfo *c, const char *message, ...)
276 {
277         va_list ap;
278
279         utf_display(c->name);
280         fprintf(stderr, ": ");
281
282         va_start(ap, message);
283         vfprintf(stderr, message, ap);
284         va_end(ap);
285
286         fputc('\n', stderr);
287
288         exit(1);
289
290         /* keep compiler happy */
291
292         return NULL;
293 }
294
295
296 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...)
297 {
298         va_list ap;
299
300         va_start(ap, message);
301         (void) new_classformaterror(c, message, ap);
302         va_end(ap);
303 }
304
305
306 java_objectheader *new_classnotfoundexception(utf *name)
307 {
308         fprintf(stderr, "java.lang.ClassNotFoundException: ");
309         utf_fprint(stderr, name);
310         fputc('\n', stderr);
311
312         exit(1);
313
314         /* keep compiler happy */
315
316         return NULL;
317 }
318
319
320 java_objectheader *new_noclassdeffounderror(utf *name)
321 {
322         fprintf(stderr, "java.lang.NoClassDefFoundError: ");
323         utf_fprint(stderr, name);
324         fputc('\n', stderr);
325
326         exit(1);
327
328         /* keep compiler happy */
329
330         return NULL;
331 }
332
333
334 java_objectheader *exceptions_new_linkageerror(const char *message,
335                                                                                            classinfo *c)
336 {
337         fprintf(stderr, "java.lang.LinkageError: %s",message);
338         if (c) {
339                 utf_fprint_classname(stderr, c->name);
340         }
341         fputc('\n', stderr);
342
343         exit(1);
344
345         /* keep compiler happy */
346
347         return NULL;
348 }
349
350 java_objectheader *exceptions_new_nosuchmethoderror(classinfo *c,
351                                                                                                         utf *name, utf *desc)
352 {
353         fprintf(stderr, "java.lang.NoSuchMethodError: ");
354         utf_fprint(stderr, c->name);
355         fprintf(stderr, ".");
356         utf_fprint(stderr, name);
357         utf_fprint(stderr, desc);
358         fputc('\n', stderr);
359
360         exit(1);
361
362         /* keep compiler happy */
363
364         return NULL;
365 }
366
367
368 java_objectheader *new_internalerror(const char *message, ...)
369 {
370         va_list ap;
371
372         fprintf(stderr, "%s: ", string_java_lang_InternalError);
373
374         va_start(ap, message);
375         vfprintf(stderr, message, ap);
376         va_end(ap);
377
378         exit(1);
379
380         /* keep compiler happy */
381
382         return NULL;
383 }
384
385
386 java_objectheader *new_unsupportedclassversionerror(classinfo *c, const char *message, ...)
387 {
388         va_list ap;
389
390         fprintf(stderr, "%s: ", string_java_lang_UnsupportedClassVersionError);
391
392         utf_display(c->name);
393         fprintf(stderr, ": ");
394
395         va_start(ap, message);
396         vfprintf(stderr, message, ap);
397         va_end(ap);
398
399         exit(1);
400
401         /* keep compiler happy */
402
403         return NULL;
404 }
405
406
407 java_objectheader *new_illegalmonitorstateexception(void)
408 {
409         fprintf(stderr, "%s", string_java_lang_IllegalMonitorStateException);
410         exit(1);
411
412         /* keep compiler happy */
413
414         return NULL;
415 }
416
417
418 java_objectheader *new_negativearraysizeexception(void)
419 {
420         fprintf(stderr, "%s", string_java_lang_NegativeArraySizeException);
421         exit(1);
422
423         /* keep compiler happy */
424
425         return NULL;
426 }
427
428
429 void exceptions_throw_negativearraysizeexception(void)
430 {
431         (void) new_negativearraysizeexception();
432 }
433
434
435 java_objectheader *new_nullpointerexception(void)
436 {
437         fprintf(stderr, "%s", string_java_lang_NullPointerException);
438         exit(1);
439
440         /* keep compiler happy */
441
442         return NULL;
443 }
444
445
446 void exceptions_throw_nullpointerexception(void)
447 {
448         (void) new_nullpointerexception();
449 }
450
451
452 void classnotfoundexception_to_noclassdeffounderror(void)
453 {
454 }
455
456 /* machine dependent stuff ****************************************************/
457
458 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
459 threadcritnode asm_criticalsections;
460 void thread_restartcriticalsection(ucontext_t *uc) {}
461 #endif
462
463 void md_param_alloc(methoddesc *md) {}
464
465
466 #if defined(ENABLE_INTRP)
467 void print_dynamic_super_statistics(void) {}
468 #endif
469
470
471 /************************ global variables **********************/
472
473 chain *ident_chain;     /* chain with method and field names in current class */
474 FILE *file = NULL;
475 static u4 outputsize;
476 static bool dopadding;
477
478
479 static void printIDpart(int c)
480 {
481         if ((c >= 'a' && c <= 'z') ||
482                 (c >= 'A' && c <= 'Z') ||
483                 (c >= '0' && c <= '9') ||
484                 (c == '_'))
485                 putc(c, file);
486         else
487                 putc('_', file);
488 }
489
490
491 void printID(utf *u)
492 {
493         char *utf_ptr = u->text;
494         int i;
495
496         for (i = 0; i < utf_strlen(u); i++) 
497                 printIDpart(utf_nextu2(&utf_ptr));
498 }
499
500
501 static void addoutputsize (int len)
502 {
503         u4 newsize,i;
504         if (!dopadding) return;
505
506         newsize = ALIGN(outputsize, len);
507         
508         for (i = outputsize; i < newsize; i++) fprintf(file, "   u1 pad%d\n", (int) i);
509         outputsize = newsize;
510 }
511
512
513 void printOverloadPart(utf *desc)
514 {
515         char *utf_ptr=desc->text;
516         u2 c;
517
518         fprintf(file, "__");
519
520         while ((c = utf_nextu2(&utf_ptr)) != ')') {
521                 switch (c) {
522                 case 'I':
523                 case 'S':
524                 case 'B':
525                 case 'C':
526                 case 'Z':
527                 case 'J':
528                 case 'F':
529                 case 'D': 
530                         fprintf(file, "%c", (char) c);
531                         break;
532                 case '[':
533                         fprintf(file, "_3");
534                         break;
535                 case 'L':
536                         putc('L', file);
537                         while ((c = utf_nextu2(&utf_ptr)) != ';')
538                                 printIDpart(c);
539                         fprintf(file, "_2");
540                         break;
541                 case '(':
542                         break;
543                 default: 
544                         log_text("invalid method descriptor");
545                         assert(0);
546                 }
547         }
548 }
549
550 static char *printtype(char *utf_ptr)
551 {
552         u2 c;
553
554         switch (utf_nextu2(&utf_ptr)) {
555         case 'V': fprintf (file, "void");
556                 break;
557         case 'I':
558         case 'S':
559         case 'B':
560         case 'C':
561         case 'Z': addoutputsize (4);
562                 fprintf (file, "s4");
563                 break;
564         case 'J': addoutputsize (8);
565                 fprintf (file, "s8");
566                 break;
567         case 'F': addoutputsize (4);
568                 fprintf (file, "float");
569                 break;
570         case 'D': addoutputsize (8);
571                 fprintf (file, "double");
572                 break;
573         case '[':
574                 addoutputsize ( sizeof(java_arrayheader*) ); 
575                 switch (utf_nextu2(&utf_ptr)) {
576                 case 'I':  fprintf (file, "java_intarray*"); break;
577                 case 'J':  fprintf (file, "java_longarray*"); break;
578                 case 'Z':  fprintf (file, "java_booleanarray*"); break;
579                 case 'B':  fprintf (file, "java_bytearray*"); break;
580                 case 'S':  fprintf (file, "java_shortarray*"); break;
581                 case 'C':  fprintf (file, "java_chararray*"); break;
582                 case 'F':  fprintf (file, "java_floatarray*"); break;
583                 case 'D':  fprintf (file, "java_doublearray*"); break;
584                                 
585                 case '[': fprintf(file, "java_objectarray*");
586                         while ((c = utf_nextu2(&utf_ptr)) == '[');
587                         if (c == 'L')
588                                 while (utf_nextu2(&utf_ptr) != ';');
589                         break;
590                            
591                 case 'L':  fprintf(file, "java_objectarray*");
592                         while (utf_nextu2(&utf_ptr) != ';');
593                         break;
594                 default:
595                         log_text("invalid type descriptor");
596                         assert(0);
597                 }
598                 break;
599                 
600         case 'L': 
601                 addoutputsize ( sizeof(java_objectheader*));
602                 fprintf (file, "struct ");
603                 while ( (c = utf_nextu2(&utf_ptr)) != ';' ) printIDpart (c);     
604                 fprintf (file, "*");
605                 break;
606                                         
607         default:
608                 log_text("Unknown type in field descriptor");
609                 assert(0);
610         }
611         
612         return utf_ptr;
613 }
614
615
616 /***** determine the number of entries of a utf string in the ident chain *****/
617
618 static int searchidentchain_utf(utf *ident) 
619 {
620         utf *u = chain_first(ident_chain);     /* first element of list */
621         int count = 0;
622
623         while (u) {
624                 if (u==ident) count++;         /* string found */
625                 u = chain_next(ident_chain);   /* next element in list */ 
626         }
627
628         return count;
629 }
630
631
632 /************** print structure for direct access to objects ******************/
633
634 static void printfields(classinfo *c)
635 {
636         u4 i;
637         fieldinfo *f;
638         int ident_count;
639         
640         if (!c) {
641                 addoutputsize(sizeof(java_objectheader));
642                 fprintf(file, "   java_objectheader header;\n");
643                 return;
644         }
645                 
646         printfields(c->super.cls);
647         
648         for (i = 0; i < c->fieldscount; i++) {
649                 f = &(c->fields[i]);
650                 
651                 if (!(f->flags & ACC_STATIC)) {
652                         fprintf(file, "   ");
653                         printtype(f->descriptor->text);
654                         fprintf(file, " ");
655                         utf_fprint(file, f->name);
656
657                         /* rename multiple fieldnames */
658                         if ((ident_count = searchidentchain_utf(f->name)))
659                                 fprintf(file, "%d", ident_count - 1);
660                         chain_addlast(ident_chain, f->name);    
661
662                         fprintf(file, ";\n");
663                 }
664         }
665 }
666
667
668 /***************** store prototype for native method in file ******************/
669
670 void printmethod(methodinfo *m)
671 {
672         char *utf_ptr;
673         u2 paramnum = 1;
674
675         /* search for return-type in descriptor */      
676         utf_ptr = m->descriptor->text;
677         while (utf_nextu2(&utf_ptr) != ')');
678
679         /* create remarks */
680         fprintf(file, "\n/*\n * Class:     ");
681         utf_fprint(file, m->class->name);
682         fprintf(file, "\n * Method:    ");
683         utf_fprint(file, m->name);
684         fprintf(file, "\n * Signature: ");
685         utf_fprint(file, m->descriptor);
686         fprintf(file, "\n */\n");
687
688         /* create prototype */                  
689         fprintf(file, "JNIEXPORT ");
690         printtype(utf_ptr);
691         fprintf(file, " JNICALL Java_");
692         printID(m->class->name);
693
694         chain_addlast(ident_chain, m->name);
695
696         fprintf(file, "_");
697         printID(m->name);
698
699         /* ATTENTION: We use the methodinfo's isleafmethod variable as
700            nativelyoverloaded, so we can save some space during
701            runtime. */
702
703         if (m->isleafmethod)
704                 printOverloadPart(m->descriptor);
705
706         fprintf(file, "(JNIEnv *env");
707         
708         utf_ptr = m->descriptor->text + 1;
709                         
710         if (!(m->flags & ACC_STATIC)) {
711                 fprintf(file, ", struct ");
712                 printID(m->class->name);
713                 fprintf(file, "* this");
714
715         } else {
716                 fprintf(file, ", jclass clazz");
717         }
718
719         if ((*utf_ptr) != ')') fprintf(file, ", ");
720                         
721         while ((*utf_ptr) != ')') {
722                 utf_ptr = printtype(utf_ptr);
723                 fprintf(file, " par%d", paramnum++);
724                 if ((*utf_ptr)!=')') fprintf(file, ", ");
725         }
726                         
727         fprintf(file, ");\n\n");
728 }
729
730
731 /******* remove package-name in fully-qualified classname *********************/
732
733 void gen_header_filename(char *buffer, utf *u)
734 {
735         s4 i;
736   
737         for (i = 0; i < utf_strlen(u); i++) {
738                 if ((u->text[i] == '/') || (u->text[i] == '$')) {
739                         buffer[i] = '_';  /* convert '$' and '/' to '_' */
740
741                 } else {
742                         buffer[i] = u->text[i];
743                 }
744         }
745         buffer[utf_strlen(u)] = '\0';
746 }
747
748
749 /* create headerfile for classes and store native methods in chain ************/
750
751 void headerfile_generate(classinfo *c, char *opt_directory)
752 {
753         char header_filename[1024] = "";
754         char classname[1024]; 
755         char uclassname[1024];
756         u2 i;
757         methodinfo *m;                  
758         u2 j;
759         methodinfo *m2;
760         bool nativelyoverloaded;
761
762         /* prevent compiler warnings */
763
764         nativelyoverloaded = false;
765
766         /* open headerfile for class */
767         gen_header_filename(classname, c->name);
768
769         /* create chain for renaming fields */
770         ident_chain = chain_new();
771         
772         if (opt_directory) {
773                 sprintf(header_filename, "%s/%s.h", opt_directory, classname);
774
775         } else {
776                 sprintf(header_filename, "%s.h", classname);
777         }
778
779         file = fopen(header_filename, "w");
780         if (!file) {
781                 log_text("Can not open file to store header information");
782                 assert(0);
783         }
784
785         fprintf(file, "/* This file is machine generated, don't edit it! */\n\n");
786
787         /* convert to uppercase */
788         for (i = 0; classname[i]; i++) {
789                 uclassname[i] = toupper(classname[i]);
790         }
791         uclassname[i] = '\0';
792
793         fprintf(file, "#ifndef _%s_H\n#define _%s_H\n\n", uclassname, uclassname);
794
795         /* create structure for direct access to objects */     
796         fprintf(file, "/* Structure information for class: ");
797         utf_fprint(file, c->name);
798         fprintf(file, " */\n\n");
799         fprintf(file, "typedef struct ");
800         printID(c->name);                                                       
801         fprintf(file, " {\n");
802         outputsize = 0;
803         dopadding = true;
804
805         printfields(c);
806
807         fprintf(file, "} ");
808         printID(c->name);
809         fprintf(file, ";\n\n");
810
811         /* create chain for renaming overloaded methods */
812         chain_free(ident_chain);
813         ident_chain = chain_new();
814
815         /* create method-prototypes */
816                                 
817         /* find overloaded methods */
818
819         for (i = 0; i < c->methodscount; i++) {
820                 m = &(c->methods[i]);
821
822                 if (!(m->flags & ACC_NATIVE))
823                         continue;
824
825                 /* We use the methodinfo's isleafmethod variable as
826                    nativelyoverloaded, so we can save some space during
827                    runtime. */
828
829                 if (!m->isleafmethod) {
830                         nativelyoverloaded = false;
831
832                         for (j = i + 1; j < c->methodscount; j++) {
833                                 m2 = &(c->methods[j]);
834
835                                 if (!(m2->flags & ACC_NATIVE))
836                                         continue;
837
838                                 if (m->name == m2->name) {
839                                         m2->isleafmethod = true;
840                                         nativelyoverloaded = true;
841                                 }
842                         }
843                 }
844
845                 m->isleafmethod = nativelyoverloaded;
846         }
847
848         for (i = 0; i < c->methodscount; i++) {
849                 m = &(c->methods[i]);
850
851                 if (m->flags & ACC_NATIVE)
852                         printmethod(m);
853         }
854
855         chain_free(ident_chain);
856
857         fprintf(file, "#endif\n\n");
858
859         fclose(file);
860 }
861
862
863 /******** print classname, '$' used to seperate inner-class name ***********/
864
865 void print_classname(classinfo *clazz)
866 {
867         utf *u = clazz->name;
868     char *endpos  = u->text + u->blength;
869     char *utf_ptr = u->text; 
870         u2 c;
871
872     while (utf_ptr < endpos) {
873                 if ((c = utf_nextu2(&utf_ptr)) == '_')
874                         putc('$', file);
875                 else
876                         putc(c, file);
877         }
878
879
880
881 /*
882  * These are local overrides for various environment variables in Emacs.
883  * Please do not remove this and leave it at the end of the file, where
884  * Emacs will automagically detect them.
885  * ---------------------------------------------------------------------
886  * Local variables:
887  * mode: c
888  * indent-tabs-mode: t
889  * c-basic-offset: 4
890  * tab-width: 4
891  * End:
892  * vim:noexpandtab:sw=4:ts=4:
893  */