IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ada Discussion :

Problème de mise à jour d'un tableau dans une partition shared passive


Sujet :

Ada

  1. #1
    Invité
    Invité(e)
    Par défaut Problème de mise à jour d'un tableau dans une partition shared passive
    Bonjour,
    Je m'attendais un peu à avoir ce genre de problème.
    j'ai déclaré un tableau de "projet" (nom + version) dans une partition shared passive et je ne parviens pas à mettre à jour la version.

    Voici les codes.


    La partition racine (pragma pure)
    Code ada : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
     
    -- Adam is Ada manufacture.
    -- Adam (C) 2013 Copyright Manuel De Girardi
    --------------------------------------------
    -- Author      : Manuel De Girardi        --
    -- Date        : 2013/08/11:00_000.0      --
    -- Version     : 0.0.0release             --
    -- Description : Ada manufacture.         --
    --------------------------------------------
    package Adam is
     
       pragma Pure (Adam);
     
       subtype Name_Type is String(1..256);
       -- Name is string of 256 characters.
     
       --type Release_Type is (Alpha, Beta, Debug, Release);
     
       type Version_Type is
          record
             Maj : Natural := 0;
             Min : Natural := 0;
             Rev : Natural := 0;
             --Rel : Release_Type := Alpha;
          end record;
       -- Version is triplet of natural.      
     
       Default_Version : constant Version_type := (0, 0, 0);
       -- the default value for remove.
     
       type Project_Type is tagged
          record
             Name    : Name_Type;
             Version : Version_Type;
          end record;
       -- Project is a name and version.            
     
       type Project_Set_Type is array (Positive range <>) of Project_Type;
       -- Project_Set is positive array of project.   
     
       Max_Projects : constant Positive := 128;
       -- Maximum number of project in Adam.Systemic.Project_Set.
     
       subtype Project_Index_Type is Natural range 0..Max_Projects;
       -- Project_Index is the index of valid project in Adam.Systemic.Project_Set.
     
     
     
    end Adam;


    La partition partagée, (pragma shared passive) contenant mon tableau.
    Code ada : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
     
    -- Adam is Ada manufacture.
    -- Adam (C) 2013 Copyright Manuel De Girardi
    --------------------------------------------
    -- Author      : Manuel De Girardi        --
    -- Date        : 2013/08/11:43_000.0      --
    -- Version     : 0.0.3alpha               --
    -- Description : Ada manufacture.         --
    --------------------------------------------
    package Adam.Systemic is
     
       pragma Shared_Passive (Adam.Systemic);      
     
       procedure Add(Project : out Project_Type; Name : in Name_Type; Version : in Version_Type);
       function Exist(Name : in Name_Type) return Boolean;
       function Project(Name : in Name_Type) return Project_Type;
       function List return Project_Set_Type;
       procedure Upgrade(Project : out Project_Type; name : in Name_Type; Version : in Version_Type);
       Full_Set, Empty_Set, Project_Not_Match : exception;
       Not_Initialized, Already_Initialized : exception;
    private
     
       procedure Reset;   
     
       procedure Remove(Name : in Name_Type);
     
       Passwd       : Name_Type;   
       Initialized  : Boolean := False;
     
       Project_Set  : Project_Set_Type(1..Max_Projects);
       Last_Project : Project_Index_Type := 0;   
    end Adam.Systemic;


    Le corps de la procédure "upgrade"
    Code ada : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
     procedure Upgrade(Project : out Project_Type; name : in Name_Type; Version : in Version_Type) is
          Index : Project_Index_Type := 1;
     
       begin
     
          if Last_Project < 1 then
             raise Empty_Set;
          end if;
          loop
             if project_Set(Index).Name = Name then
                exit;
             end if;
             exit when Index = Last_Project;
             Index := Index + 1;
          end loop;
          if Project_Set(Index).Name = Name then     
             Project := (Name, Version);
             Project_Set(Index) := Project;          
          else
             raise Project_Not_Match;
          end if;      
       end Upgrade;

    La version reste la même dans mon tableau après upgrade vers une nouvelle version.
    Vous pouvez télécharger, non vas cette version, à laquelle j'ai enlever le release dans la version, mais celle avec release sur sourceforge.net projet Ada manufacture by jovalise.

    Merci pour vos réponses.

  2. #2
    Invité
    Invité(e)
    Par défaut
    Re-

    Je crois que j'ai trouvé le problème.
    Je suis sur Gnu/Linux et j'ai fait une gaffe dans le fichier install.sh
    Je pense que le problème est du aux droits d'accès en lecture écriture exécution aux fichiers.

    Du coup je poste ma nouvelle version de install.sh qui n'est encore pas la bonne.

    Code bash : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
     
    #!/bin/bash
    declare work_dir=/usr/local
    # # creating new user adamufacture with group adamanufacture
    adduser adamanufacture
     
    project=adamanufacture
    version=0.0.4alpha
     
    # Construct the four script to call Ada manufacture from only one directory.
     
    declare -a objects=(${project}-init ${project}-mkproject ${project}-rmproject ${project}-list ${project}-reset ${project}-upproject)
    echo "installing sh ..."
     
    declare sh_dir=$work_dir/bin/${project}-${version}
    declare bin_dir=$work_dir/bin/${project}-${version}/bin
    declare lib_dir=$work_dir/src/lib
    declare obj_dir=$work_dir/lib/${project}-${version}
    declare shared_dir=$work_dir/share/${project}-${version}
     
    #admin the rights of usr/local sub directory
    chown -R adamanufacture.adamanufacture $bin_dir
    chown -R adamanufacture.adamanufacture $shared_dir
     
    for i in ${!objects[*]}; do
        echo "${objects[i]}";
     
        chmod 4755 $bin_dir/${objects[i]}
        echo "#!/bin/bash" > $sh_dir/${objects[i]}.sh
        echo "declare work_dir=/usr/local" >> $sh_dir/${objects[i]}.sh
        echo "declare bin_dir=$work_dir/bin/${project}-${version}" >> $sh_dir/${objects[i]}.sh
        echo "declare lib_dir=$work_dir/src/lib" >> $sh_dir/${objects[i]}.sh
        echo "declare obj_dir=$work_dir/lib/${project}-${version}" >> $sh_dir/${objects[i]}.sh
        echo "declare shared_dir=$work_dir/share/${project}-${version}" >> $sh_dir/${objects[i]}.sh
        echo "cd ${shared_dir}" >> $sh_dir/${objects[i]}.sh
        echo "$bin_dir/${objects[i]}" >>  $sh_dir/${objects[i]}.sh    
        chmod a+x $sh_dir/${objects[i]}.sh;
     
    done;


    Donc, je sais pas quoi mettre pour les chown et les chmod.
    Mais c'est moins un problème Ada. :/

Discussions similaires

  1. Réponses: 0
    Dernier message: 17/04/2014, 11h24
  2. Problème de mise à jour d'un champ dans bdd
    Par Tommy57 dans le forum VB.NET
    Réponses: 5
    Dernier message: 17/09/2010, 08h57
  3. [AC-2003] problème de mise à jour des champs disponibles dans TCD
    Par patbeautifulday dans le forum IHM
    Réponses: 3
    Dernier message: 03/03/2010, 08h59
  4. Réponses: 1
    Dernier message: 08/07/2009, 11h52
  5. Réponses: 1
    Dernier message: 24/04/2006, 16h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo