コード例 #1
0
ファイル: link_variables.c プロジェクト: icyrizard/coco
node *LVARglobaldef( node *arg_node, info *arg_info)
{
    char *var_name;

    DBUG_ENTER("LVARglobaldef");

    var_name = VAR_NAME(GLOBALDEF_ID( arg_node));

    /* set declaration of this global variable */
    VAR_DECL(GLOBALDEF_ID( arg_node) ) = arg_node;

    /* check for duplicated variable declaration */
    if(hashmap_contains(arg_info->global, var_name)) {
        CTIerror(":%d: error: '%s' has already been defined in this context",
                NODE_LINE(arg_node), var_name);

        CTIerror(":%d: error: location of earlier definition",
                NODE_LINE((node *)hashmap_get(arg_info->global, var_name)));
        DBUG_RETURN(arg_node);
    }

    /* add global variabele declaration to hashmap */
    hashmap_add(arg_info->global, var_name, arg_node);

    DBUG_RETURN( arg_node);
}
コード例 #2
0
ファイル: boxexfile.c プロジェクト: foliern/LUT_relocate
bool openFile(const char *snetBase, const char *boxBase, const char *boxType)
{
  char *fileName = STRcatn(3, boxBase, ".", boxType);

  if((srcFile = fopen(fileName, "w")) == NULL) {
    CTIerror(CTI_ERRNO_FILE_ACCESS_ERROR,
	     "Source file %s open failed\n", fileName);
    return FALSE;
  }

  writeGenerationInfo(snetBase, boxBase, boxType);

  MEMfree(fileName);

  return TRUE;
}
コード例 #3
0
ファイル: link_variables.c プロジェクト: icyrizard/coco
node *LVARvar( node *arg_node, info *arg_info)
{
    char *var_name;
    node *var_dec;

    DBUG_ENTER("LVARvar");

    var_name = VAR_NAME(arg_node);

    /* check for local variable declaration */
    var_dec = hashmap_get(arg_info->local, var_name);

    /* check for global variable declaration */
    if(!var_dec)
        var_dec = hashmap_get(arg_info->global, var_name);

    if(var_dec)
        VAR_DECL(arg_node) = var_dec;
    else
        CTIerror(":%d: error: unknown identifier '%s'", NODE_LINE(arg_node), var_name);

    DBUG_RETURN( arg_node);
}