Пример #1
0
        DBstatus DBinsert_tform(
        GMTRF   *trfpek,
        DBId    *idpek,
        DBptr   *lapek)

/*      Huvudrutin för lagring av transformation.
 *
 *      In: trfpek => Pekare till en trf-structure.
 *          idpek  => Pekare till identitet-structure.
 *          lapek  => Pekare till DBptr-variabel.
 *
 *      Out: *la    => Logisk adress till post i GM.
 *
 *      (C)microform ab 15/12/92 J. Kjellander
 *
 ******************************************************!*/

  {
/*
***Typ-specifika data.
*/
    trfpek->hed_tf.type = TRFTYP;   /* Typ = transformation */
    trfpek->hed_tf.vers = GMPOSTV0; /* Version */
/*
***Lagra posten.
*/
    return(inpost((GMUNON *)trfpek,idpek,lapek,sizeof(GMTRF)));
  }
    static void GenerateWindow(int widgets, const std::string& filename){

        std::cout << "Loading base files" << std::endl;

        ///
        /// load base files

        // ---------------------------------------------------------------------
        QFile basepre("../window_pre.txt");
        if (!basepre.open(QFile::ReadOnly | QFile::Text)){
            std::cout << "ERROR Loading basepre" << std::endl;
            return;
        }
        QTextStream inpre(&basepre);
        QString basepre_string = inpre.readAll();
        std::cout << "basepre content = " << basepre_string.toStdString() << std::endl;

        // ---------------------------------------------------------------------
        QFile basecore("../window_core.txt");
        if (!basecore.open(QFile::ReadOnly | QFile::Text)){
            std::cout << "ERROR Loading basecore" << std::endl;
            return;
        }
        QTextStream incore(&basecore);
        QString basecore_string = incore.readAll();
        std::cout << "basecore content = " << basecore_string.toStdString() << std::endl;

        // ---------------------------------------------------------------------
        QFile basepost("../window_post.txt");
        if (!basepost.open(QFile::ReadOnly | QFile::Text)){
            std::cout << "ERROR Loading basepost" << std::endl;
            return;
        }
        QTextStream inpost(&basepost);
        QString basepost_string = inpost.readAll();
        std::cout << "basepost content = " << basepost_string.toStdString() << std::endl;

        ///
        /// create window file
        QFile file(filename.c_str());
        if ( file.open(QIODevice::ReadWrite))
        {
            QTextStream stream( &file );
            //
            stream << QString(basepre_string);
            //
            for (int i = 0; i < widgets; i++){
                stream << QString(basecore_string).replace("##widget##",QString::number(i)) << "\n";
            }
            //
            stream << QString(basepost_string);
        }
        file.close();

        std::cout << "done." << std::endl;
    }
Пример #3
0
int main()
{
     int  i,k=-1;
     struct bst **T;
          T=(struct bst**) malloc(sizeof(struct bst*)*10);
          for(i=0;i<10;i++)
              T[i]=NULL;
     char iexp[100];
     char rexp[100];
          printf("\nEnter the expression : \n");
          scanf("%s",&iexp);
          inpost(iexp,rexp);
          printf("\nThe postfix expression is %s",rexp);
          for(i=0;rexp[i]!='\0';i++)
          {
                 switch(rexp[i])
                 {
                                case '+':case '-':case '*':case '/':
                                     {
                                              struct bst *temp;
                                              temp=(struct bst*) malloc(sizeof(struct bst));
                                              temp->data=rexp[i];
                                              temp->left=NULL;
                                              temp->right=NULL;
                                              temp->right=T[k];
                                              T[k]=NULL;
                                              k--;
                                              temp->left=T[k];
                                              T[k]=temp;
                                     }break;
                                
                                default :
                                        {
                                              k++;
                                              struct bst *temp;
                                              temp=(struct bst*) malloc(sizeof(struct bst));
                                              temp->data=rexp[i];
                                              temp->left=NULL;
                                              temp->right=NULL;
                                              T[k]=temp;
                                        }break;
                 }
          }
          printf("\n");
          preorder(T[k]);
          printf("\n");
          inorder(T[k]);
          printf("\n");
          postorder(T[k]);
          printf("\n");
          system("pause");
          return 0;
}           
Пример #4
0
        DBstatus DBinsert_point(
        DBPoint *poipek,
        DBId    *idpek,
        DBptr   *lapek)

/*      Inserts a new point entity in the DB.
 *
 *      In: poipek => Pointer to point data.
 *          idpek  => Pointer point ID.
 *
 *      Out: *lapek => The point address.
 *
 *      FV:  0  => Ok.
 *          -1  => ID utanför virtuellt område.
 *          -2  => IDTAB full.
 *          -3  => Data får inte plats.
 *          -4  => Storhet med detta ID finns redan.
 *
 *      (C)microform ab 13/12/84 J. Kjellander
 *
 *      14/10/85 Headerdata, J. Kjellander
 *      22/3/92  GMPOSTV1, J. Kjellander
 *      1998-04-03 GMPOSTV2, J.Kjellander
 *      2007-03-22 GMPOSTV3, J.Kjellander
 *
 ******************************************************!*/

  {

/*
***Type-specific data.
*/
    poipek->hed_p.type = POITYP;     /* Type = point */
    poipek->hed_p.vers = GMPOSTV3;   /* Version */
/*
***Save.
*/
    return(inpost((GMUNON *)poipek,idpek,lapek,sizeof(DBPoint)));
  }
Пример #5
0
        DBstatus DBinsert_line(
        GMLIN   *linpek,
        DBId    *idpek,
        DBptr   *lapek)

/*      Inserts a line entity in the DB.
 *
 *      In: linpek => Pointer to line data.
 *          idpek  => Pointer to line ID.
 *
 *      Out: *lapek => The line address.
 *
 *      FV:  0  => Ok.
 *          -1  => ID utanför virtuellt område.
 *          -2  => IDTAB full.
 *          -3  => Data får inte plats.
 *          -4  => Storhet med detta ID finns redan.
 *
 *      (C)microform ab 27/12/84 J. Kjellander
 *
 *      14/10/85 Headerdata, J. Kjellander
 *      22/3/92  GMPOSTV1, J. Kjellander
 *      1997-12-24 GMPOSTV2, J.Kjellander
 *
 ******************************************************!*/

  {

/*
***Typ-specifika data.
*/
    linpek->hed_l.type = LINTYP;
    linpek->hed_l.vers = GMPOSTV2;
/*
***Lagra.
*/
    return(inpost((GMUNON *)linpek,idpek,lapek,sizeof(GMLIN)));
  }