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