I control old halcompile file in ubuntu 10.04 and new one on ubuntu 14.04 ....


there is some row referred ios system (but not warm about)...

and these part all new .... these can explain count e names error .... but not 
-lmodbus and -lm error ....


/*(row 868)*/ print >>f, """ 
/*******************************************************/
int __comp_parse_count(int *argc, char **argv) {
    int i;
    for (i = 0; i < *argc; i ++) {
        if (strncmp(argv[i], "count=", 6) == 0) {
            errno = 0;
            count = strtoul(&argv[i][6], NULL, 0);
            for (; i+1 < *argc; i ++) {
                argv[i] = argv[i+1];
            }
            argv[i] = NULL;
            (*argc)--;
            if (errno == 0) {
                return 1;
            }
        }
    }
    return 0;
}
"""
        print >>f, """
int __comp_parse_names(int *argc, char **argv) {
    int i;
    for (i = 0; i < *argc; i ++) {
        if (strncmp(argv[i], "names=", 6) == 0) {
            char *p = &argv[i][6];
            int j;
            for (; i+1 < *argc; i ++) {
                argv[i] = argv[i+1];
            }
            argv[i] = NULL;
            (*argc)--;
            for (j = 0; j < 16; j ++) {
                names[j] = strtok(p, ",");
                p = NULL;
                if (names[j] == NULL) {
                    return 1;
                }
            }
            return 1;
        }
    }
    return 0;
}
/*(row 912)*/ """



________________________________
Da: giorgio foga <giorgiof...@hotmail.it>
Inviato: mercoledì 30 novembre 2016 18.24
A: Enhanced Machine Controller EMC
Oggetto: [Emc-users] Lcnc git master... halcompile

due to some problems can not be explained
(an 1 year old LCNC Ja9 on Ubuntu 10.04 make unrecognize error, and plus after 
install of JA9 is affect to mesa ssreial error sometime at emergency stop)
 I had to update.
Not wanting to use wheezy I installed ubuntu 14.04 .... in the end all right.
But I should use a userspace component libmodbus3.1.2 .... I can not use 
halcompile...

The Component is the same ... nothings is change ... I edit the first part 
(whitout header & hal pin) ..

#include <stdio.h>    /* Standard input/output definitions */
#include <stdlib.h>
#include <stdint.h>   /* Standard types */
#include <string.h>   /* String function definitions */
#include <fcntl.h>    /* File control definitions */
#include <errno.h>    /* Error number definitions */
#include <signal.h>
#include <modbus/modbus.h>
#include <math.h>
#include <assert.h>

#define MAP(n)  mb_mapping->tab_registers[n]
#define INP(g)  mb_mapping->tab_input_registers[g]
#define WRI(nr , val) ret=modbus_write_register(ctx, nr, val)

char *address;
char ad0[4];
char ad1[4];
char ad2[4];
char ad3[4];
char point[2] = ".";
char str[16];
float test = 1502.0;
float test1 = 169.0;
float test2 = 254.0;
float test3 = 000.0;
float test4 = 103.0;
int tt1 = 0;
int tt2 = 0;
int tt3 = 0;
int tt4 = 0;
int hole;
int done = 0;
int firstimeconnect = 0;
int ret = -1;
int CorrectOnOfSign =0;


float kft;
uint16_t FCpy[2];
uint16_t RfCpy[2];



    int s = -1;
    modbus_t *ctx;
    modbus_mapping_t *mb_mapping;
    int rc;
    int i;
    int test_of = 0;
    uint8_t *query;
    uint8_t In_tab[100];
    uint16_t Reg_tab[100];
    int header_length;


//void adios(int sig){done = 1;}

float Rcf(uint16_t a, uint16_t b)
{
   uint16_t a1[2];
   float r1;
   a1[0] = a;
   a1[1] = b;
   r1 = modbus_get_float(a1);
   kft = r1;
   return kft;
}

uint16_t SdFloat(float a)
{
    modbus_set_float(a, FCpy);
    return *FCpy;
}


void user_mainloop(void)  /* start "main" */
{

   /* signal(SIGINT, adios);
    signal(SIGTERM, adios);*/


while(!done)    /*"start  main loop "  */
 {
    usleep(20000);


    FOR_ALL_INSTS()
            {

               testo =1;

    if (firstimeconnect == 0){


             hole = floor(jaaddress); //jaaddress;



         if (hole != 0)
           {
            tt1 = floor(ja30ip);
            tt2 = floor(ja31ip); //test2);
            tt3 = floor(ja32ip);
            tt4 = floor(ja33ip);
            sprintf(ad0, "%hu", tt1); //ja30ip);
           sprintf(ad1, "%hu", tt2); //ja31ip);
           sprintf(ad2, "%hu", tt3); //ja32ip);
            sprintf(ad3, "%hu", tt4); //ja33ip);
            strcpy(str, ad0);
            strcat(str, point);
            strcat(str, ad1);
            strcat(str, point);
              strcat(str, ad2);
            strcat(str, point);
            strcat(str, ad3);
           address = str;
           }
         else { address = "0";}


        ctx = modbus_new_tcp(address, hole);
        query = malloc(MODBUS_TCP_MAX_ADU_LENGTH);
        header_length = modbus_get_header_length(ctx);

        modbus_set_debug(ctx, false);

        mb_mapping = modbus_mapping_new(0,0,200,0);

        if (mb_mapping == NULL) {
            //fprintf(stderr, "Failed to allocate the mapping: %s\n",
                //modbus_strerror(errno));
            modbus_free(ctx);
             //return -1;
        }
........................

but obtain these error at compile ...


k1MbServer.c: In function '__comp_parse_names':
/tmp/tmpLc0aCs/k1MbServer.c:573:17: error: 'names' undeclared (first use in 
this function)
                 names[j] = strtok(p, ",");

/*******the same for comp__parse_count************/*

/tmp/cc1kjkzO.o: in function "user_mainloop":
/tmp/tmp_RtXP2/k1MbServer.comp:210: undefined reference  "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:216: undefined reference  "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:217: undefined reference  "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:218: undefined reference  "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:219: undefined reference  "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:236: undefined reference  "modbus_new_tcp"
/tmp/tmp_RtXP2/k1MbServer.comp:238: undefined reference  
"modbus_get_header_length"
/tmp/tmp_RtXP2/k1MbServer.comp:240: undefined reference  "modbus_set_debug"

//and other about modbus

..... Any suggest about?? ...

andypugh talk about halcompile bug .... is possible there are a path problem??

I've install on /home/linuxcnc-dev .... and libmodbus is on /usr/.......
for compile I've used these command:

cd linuxcnc-dev
. ./rip-xxxx or . ./scripts/rip-xxx (in the same way I've compile my custom 
kins with success)
halcompile --install k1MbServer.comp (same resutl halcompile --compile 
k1MbServer.comp)

regards
giorgio







------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users
Emc-users Info Page - 
SourceForge<https://lists.sourceforge.net/lists/listinfo/emc-users>
lists.sourceforge.net
This list is for users of the Enhanced Machine Controller (EMC). Topics include 
how to obtain, install, configure, and use EMC, as well as other general EMC 
related ...


------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to