private void generateCHeaders(File f) {

		Classes c = new Classes();
		FileReader fr = null;
		BufferedReader br = null;
		try {
			// Apertura del fichero y creacion de BufferedReader para poder
			// hacer una lectura comoda (disponer del metodo readLine()).
			fr = new FileReader (f);
			br = new BufferedReader(fr);
			// Lectura del fichero
			String linea;

			String methodRE = "((([a-zA-Z][a-zA-Z0-9_]*))(\\s+))+((?:[a-zA-Z_~][a-zA-Z0-9_]*))(\\(.*\\))";

		    Pattern p = Pattern.compile(methodRE,Pattern.CASE_INSENSITIVE | Pattern.DOTALL);

			while((linea=br.readLine())!=null){
				Matcher m = p.matcher(linea);
				if (m.find())
				{
					/*String var1=m.group(1).trim();
					String var4=m.group(4);
					String var5=m.group(5);
					String var6=m.group(6);
					String name = var1+var4+var5+var6;*/
					String name = m.group(0);
					c.getMethod().add(new Method(name));
					System.out.print(name+"\n");
				}
			}
		}
		catch(Exception e){
			System.out.println(e.getMessage());
			e.printStackTrace();
		}finally{
			// En el finally cerramos el fichero, para asegurarnos
			// que se cierra tanto si todo va bien como si salta 
			// una excepcion.
			try{                    
				if( null != fr ){   
					fr.close();     
				}                  
			}catch (Exception e2){
				System.out.println(e2.getMessage());
				e2.printStackTrace();
			}
		}
		System.out.println("Detected methods: "+c.getMethod().size());
		FileWriter fichero = null;
		PrintWriter pw = null;
		try
		{
			String codeFileName = f.getName();
			codeFileName = codeFileName.replace(".c", ".h");
			fichero = new FileWriter(codeFileName);
			pw = new PrintWriter(fichero);
			//write in the file
			pw.println("/*");
			pw.println(" * "+codeFileName);
			pw.println(" *");
			pw.println(" * Created on: "+new SimpleDateFormat().format(new Date()).toString());
			pw.println(" * Author: makeHeaders");
			pw.println(" */");
			pw.println("");
			//insert include declarations
			String def = codeFileName.toUpperCase();
			def = def.replace(".", "_");
			def.concat("_");
			pw.println("#ifndef "+def);
			pw.println("#define "+def);
			//pw.println("#include <stdlib.h>");
			pw.println("");
			pw.println("// Add your includes here");
			pw.println("//");
			pw.println("// End of includes declaration");
			pw.println("");
			pw.println("typedef struct");
			pw.println("{");
			pw.println("\t//Define your structure here");
			String className = codeFileName.replace(".h", "");
			String first = String.valueOf(className.charAt(0));
			first = first.toUpperCase();
			className = first+className.substring(1);
			pw.println("}"+className+";");
			pw.println("");
			ArrayList<Method> mthds = c.getMethod();
			for (Method m : mthds) {
				pw.println(m.getName()+";");
				pw.println("");
			}
			pw.println("#endif /* "+def+" */");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				// Nuevamente aprovechamos el finally para 
				// asegurarnos que se cierra el fichero.
				if (null != fichero)
					fichero.close();
			} catch (Exception e2) {
				e2.printStackTrace();
			}
		}
	}