| /* |
| * (c) Copyright QNX Software Systems Ltd. 2002. |
| * All Rights Reserved. |
| */ |
| /******** |
| * This is a sample C file that will be used in testing the TranslationUnit |
| * class. It has a specific structure that will be looked for within the |
| * test case. |
| * This file is only ment to contain various C elements, and may not compile |
| * into a running application (but should be valid C) |
| */ |
| |
| #include <stdio.h> |
| #include <unistd.h> |
| |
| /* A function prototype */ |
| int func2p(void); |
| |
| /* A global variable */ |
| int globalvar; |
| |
| /* A enumeration */ |
| enum myenum {ENUM_A=1, ENUM_B=2, ENUM_C=3, ENUM_D=4}; |
| |
| /* A structure. This also includes a typedef around the strcture def |
| * which at the time of writing was not picked up. |
| */ |
| typedef struct mystruct { |
| int a; |
| char b; |
| long c; |
| } mystruct_t; |
| |
| /* A union */ |
| union myunion { |
| int x; |
| char y; |
| long z; |
| }; |
| |
| /* A typedef */ |
| typedef struct mystruct mytype; |
| |
| |
| /* A couple functions */ |
| |
| void * func1(void) |
| { |
| return(NULL); |
| } |
| |
| |
| int func2(void) |
| { |
| return(0); |
| } |
| |
| int main(int argc, char ** argv) |
| { |
| int var1; |
| printf("Hello world\n"); |
| } |
| |
| |
| void func3() |
| { |
| printf("This is not really here\n"); |
| } |