NR == 1		{
		n= index (FILENAME, ".desc");
		modulename= substr (FILENAME, 0, n-1);
		while ((n= index (modulename, ".")) != 0) {
		  modulename= substr (modulename, 0, n-1) \
		              "_"                         \
		              substr(modulename,n+1);
		  }
		printf ("#ifndef %s_HH\n", modulename);
		printf ("#define %s_HH\n\n", modulename);
		printf ("#define PUBLIC\n");
		printf ("#define PRIVATE static\n\n");
		flvi = 0;
		}

/^SHARED/	{
		  n= index ($0, $2);
		  info= substr ($0, n);
		  n= index (info, ";");
		  if (n > 0)
		    info= substr (info, 0, n-1);
		  decl= info;
		  n= index (info, "=");
		  flvi = 3;
		  if (n > 0)
		  {
		    decl= substr (info, 0, n-1);
		    if (index(info, ";") != length(info))
		       flvi = 2;
		  }
		  printf ("#ifndef %s_IMP\n", modulename);
		  printf ("extern\t%s;\n", decl);
		  printf ("#else\n");
		  printf ("\t%s", info);
		  state= 10;
		}

/^PUBLIC/	{ state= 1; }

		{
		  if (state == 0)
		    print;
		  else if (state == 1) {
		    type= $2;
		    state= 2;
		    }
		  else if (state == 2) {
		    n= index ($0, "(");
		    name= substr ($0, 0, n-1);
		    printf ("%s\t%s();\n\n", type, name);
		    state= 3;
		    }
		  else if (state == 10){
		    if (flvi == 2){
		       if (index($0, ";") > 0){
		    	  printf (";\n#endif\n\n");
			  flvi = 0;
		       }
		       else{
			  flvi = 1;
			  printf("\n");
		       }
		    }
		    else if (flvi == 1){
		       if (index($0, ";") > 0){
			  print;
		    	  printf ("#endif\n\n");
			  flvi = 0;
		       }
		       else print;
		    }
		    else{
		       state= 0;
		       if (flvi == 3)
			  printf(";\n#endif\n\n");
		       flvi = 0;
		    }
		  }
		}

/^$/		{ state= 0; }

END		{
		printf ("#endif\n");
		}
