parser.h 1008 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * File: parser.h
  3. * Author: Arthur Brandao
  4. *
  5. * Created on 31 octobre 2018
  6. */
  7. #ifndef PARSER_H
  8. #define PARSER_H
  9. /* --- Include --- */
  10. #include "constante.h"
  11. #include "str.h"
  12. /* --- Structure --- */
  13. typedef struct{
  14. char* cmd; //La commande en string
  15. char* name; //Le nom de la commande
  16. int argc; //Le nombre d'argument
  17. char** argv; //Les arguments
  18. int input; //Descripteur de fichier d'entré
  19. int output; //Descripteur de fichier de sortie
  20. int error; //Descripteur de fihier d'erreur
  21. boolean erase[2]; //Si on efface le fichier
  22. boolean bck; //En fond ou non
  23. int next; //Lien avec la prochaine commande
  24. }Command;
  25. typedef struct{
  26. Command** cmd; //Tableau avec toutes les commandes
  27. int length; //Taille du tableau
  28. }CommandTab;
  29. /* --- Fonctions --- */
  30. int parse_line(CommandTab*, char*);
  31. int parse_command(Command*);
  32. int parse_all_command(CommandTab*);
  33. void clean_command(CommandTab*);
  34. #endif /* PARSER_H */