最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Halcon10-C語言打印消息

2023-07-02 11:39 作者:Halcom中國  | 我要投稿

#include "HalconC.h"

#include <stdio.h>




/* ignore automatic error handling */

void no_exit()

{

? (void)set_check("~give_error");

}



/* activate automatic error handling (default) */

void do_exit()

{

? (void)set_check("give_error");

}



/*?

?* handling of errors:

?*? ?a: user defined error handling

?*? ?b: exit on error

?*/

void test_errors()

{

? Herror? ? err;? ? ? ? ? ? ? ? ? ?/* message number */

? char? ? ? message[MAX_STRING];? ?/* error text */

? long? ? ? WrongWindowHandle = 0; /* no window available */

??

? (void)printf("Ignore automatic exit on error:\n");

? no_exit();

? (void)printf("- Trying to display a circle ... But because there's\n");

? (void)printf("? no valid graphics window, an error will occur!\n");

? err = disp_circle(WrongWindowHandle,100.0,100.0,100.0);

? if (err != H_MSG_TRUE)

? {

? ? (void)get_error_text(err,(char*)message);

? ? (void)printf("My error message: (%d) \n%s\n",err,message);

? ? (void)printf("... we should have opened a window!\n\n");

? }


? (void)printf("Switch on automatic exit on error:\n");

? do_exit();

? (void)printf("- Trying to display a circle ... But because there's\n");

? (void)printf("? no valid graphics window, the program will terminate!\n");

? (void)disp_circle(WrongWindowHandle,100.0,100.0,100.0);

}




/*

?* Types of messages:

?* Attention: Messages are no error and do not cause runtime errors!

?*? ? ? ? ? ? They are always returned.

?*

?*? ?H_MSG_TRUE:? everything is perfect

?*? ?H_MSG_FAIL:? something failed (try again)

?*? ?H_MSG_VOID:? you can't continue with this result

?*/

void test_messages()

{

? ?Herror? ? err;

? ?Hobject? ?Image,Circle,Empty,Result;

? ?long? ? ? WindowHandle;

? ?Htuple? ? task, value;

? ?

? ?(void)printf("Provoking a success message (H_MSG_TRUE):\n");

? ?err = open_window(1,1,100,100,0,"visible","",&WindowHandle);

? ?if (err == H_MSG_TRUE)

? ? ?(void)printf("- open_window:? H_MSG_TRUE (%d)\n",err);

? ?(void)printf("We wait until the mouse is inside the graphics window ...\n\n");

? ?do

? ?{

? ? ?err = get_mposition(WindowHandle,_,_,_);

? ?} while (err == H_MSG_FAIL);

? ?(void)close_window(WindowHandle);

? ?

? ?(void)printf("Now provoking a failure message (H_MSG_FAIL):\n");

? ?err = read_image(&Image,"this_image_does_not_exist");

? ?if (err == H_MSG_FAIL)

? ? ?(void)printf("- read_image (file not found): H_MSG_FAIL (%d)\n\n",err);

? ?else

? ? ?(void)printf("This is really funny! (%d)\n\n", err);

? ?

? ?(void)printf("Now provoking a void message (H_MSG_VOID):\n");

? ?/* create circle with radius 1.0 */

? ?(void)gen_circle(&Circle,100.0,100.0,1.0);? ? ?

? ?/* select large segments */

? ?(void)select_shape(Circle,&Empty,"area","and",1000.0,1000000.0);

? ?/* now we have an empty list! */

? ?create_tuple(&task,1);

? ?set_s(task,"empty_region_result",0);

? ?create_tuple(&value,1);

? ?set_d(value,H_MSG_FAIL,0);

? ?set_system("no_object_result","void");

? ?destroy_tuple(task);

? ?destroy_tuple(value);

? ?/* contour of nothing -> VOID message */

? ?err = boundary(Empty,&Result,"inner");

? ?if (err == H_MSG_VOID)

? ? ?(void)printf("- contour1 (no objects):? H_MSG_VOID (%d)\n\n",err);

? ?else

? ? ?(void)printf("That is really funny! (%d)\n\n", err);

}




main()

{

? (void)printf("-----------------------------\n");

? (void)printf("Example program for HALCON/C:\n");

? (void)printf("-----------------------------\n");

? (void)printf("- error handling\n");

? (void)printf("- H_MSG_TRUE, H_MSG_FAIL, and H_MSG_VOID\n\n");


? test_messages();

? test_errors();


? return(0);

}


Halcon10-C語言打印消息的評論 (共 條)

分享到微博請遵守國家法律
娄烦县| 遵化市| 峨眉山市| 兴仁县| 津南区| 米易县| 溆浦县| 潼南县| 蒙城县| 宝丰县| 台安县| 原平市| 普格县| 正蓝旗| 仁化县| 成都市| 贺州市| 广河县| 图们市| 牙克石市| 满洲里市| 大名县| 邵武市| 正蓝旗| 邹城市| 蒙山县| 浦城县| 仲巴县| 盐山县| 乌兰浩特市| 南昌县| 木兰县| 湟中县| 湄潭县| 松滋市| 济南市| 厦门市| 宝鸡市| 曲阳县| 微博| 馆陶县|