diff --git a/Chapter1.typ b/Chapter1.typ index f4e5367..2f76a14 100644 --- a/Chapter1.typ +++ b/Chapter1.typ @@ -22,7 +22,7 @@ #i ในโลกปัจจุบัน อินเทอร์เน็ตนั้นก็เป็นสิ่งที่สำคัญมากเช่นกัน และสถานที่ส่วนใหญ่มักจะมีอินเทอร์เน็ต จึงก่อให้เกิดการที่มีอุปกรณ์อินเทอร์เน็ตรอบตัวเพิ่มขึ้นทุกวัน และได้มีสิ่งที่เรียกว่า Internet of Things -(IoT) เกิดขึ้น ซึ่งคืออุปกรณ์ที่ถูกปรับปรุงให้ใช้งานได้ดีขึ้นด้วยเทคโนโลยีไร้สายต่าง ๆ เช่น Wi-Fi, +(IoT) เกิดขึ้น ซึ่งคืออุปกรณ์ที่ถูกปรับปรุงให้ใช้งานได้ดีขึ้นด้วยเทคโนโลยีไร้สายต่าง ๆ เช่น#jb Wi-Fi, Bluetooth, Zigbee, และ Thread #i โครงงานนี้จึงมีเป้าหมายที่จะแก้ไขปัญหาที่กล่าวไปข้างต้น พร้อมศึกษาและเรียนรู้เกี่ยวกับเทคโนโลยีไร้สาย @@ -50,7 +50,7 @@ Wi-Fi และ NFC เพื่อสร้างอุปกรณ์ยืน #i เครื่องยืนยันตัวตนด้วย NFC คืออุปกรณ์ความปลอดภัยที่มีหน้าที่ในการยืนยันตัวตนบุคคลที่เข้าออกพื้นที่ โดยใช้เทคโนโลยี NFC -เป็นระบบยืนยันตัวตนบุคคลและใช้เซนเซอร์ตรวจจับความเคลื่อนใหวในการตรวจสอบหากมีบุคคลเข้าไปโดยไม่ได้รับอนุญาต +เป็นระบบยืนยันตัวตนบุคคลและใช้เซนเซอร์ตรวจจับความเคลื่อนไหวในการตรวจสอบหากมีบุคคลเข้าไปโดยไม่ได้รับอนุญาต #show: page-theme diff --git a/Chapter2/CLanguage.typ b/Chapter2/CLanguage.typ index c749ef8..f201c32 100644 --- a/Chapter2/CLanguage.typ +++ b/Chapter2/CLanguage.typ @@ -28,86 +28,268 @@ Boehm garbage collector ตามลำดับ === การพัฒนาช่วงแรก -==== ภาษา B +#h(9.75em) ที่มาของภาษา C มีความเชื่อมโยงอย่างใกล้ชิดกับการพัฒนาระบบปฏิบัติการ#jb Unix +ซึ่งเดิมทีเขียนด้วยภาษาแอสเซมบลีบน PDP-7 โดย Dennis Ritchie และ Ken Thompson +โดยนำแนวคิดหลายอย่างจากเพื่อนร่วมงานมาใช้ ในที่สุดพวกเขาก็ตัดสินใจย้ายระบบปฏิบัติการไปยัง PDP-11 +เวอร์ชัน Unix ดั้งเดิมบน PDP-11 ก็ได้รับการพัฒนาด้วยภาษาแอสเซมบลีเช่นกัน -==== ภาษา B ใหม่และ C รุ่นแรก +=== ภาษา B -==== โครงสร้างและการเขียน Unix kernel ใหม่ +#h(13.5em) ทอมป์สันต้องการภาษาโปรแกรมสำหรับการพัฒนายูทิลิตี้สำหรับแพลตฟอร์มใหม่ +เขาพยายามเขียนคอมไพเลอร์ Fortran ก่อน +แต่ในไม่ช้าเขาก็ล้มเลิกความคิดนั้นและสร้างเวอร์ชันย่อของภาษาโปรแกรมระบบ ที่พัฒนาขึ้นใหม่ชื่อ BCPL แทน +คำอธิบายอย่างเป็นทางการของ BCPL ยังไม่พร้อมใช้งานในขณะนั้นและทอมป์สันได้แก้ไขไวยากรณ์ให้ +"กระชับ" น้อยลงและคล้ายกับ ALGOL ที่เรียบง่ายกว่า ที่เรียกว่า SMALGOL เขาเรียกผลลัพธ์ นี้ว่า B +โดยอธิบายว่าเป็น#jb "ความหมายของ BCPL ที่มีไวยากรณ์ SMALGOL จำนวนมาก" เช่นเดียวกับ BCPL, B +มีคอมไพเลอร์ บูตสแตรปเพื่ออำนวยความสะดวกในการพอร์ตไปยังเครื่องใหม่ในที่สุด +มีการเขียนยูทิลิตี้เพียงไม่กี่ตัวใน B เพราะมันช้าเกินไปและไม่สามารถใช้ประโยชน์จากคุณสมบัติของ PDP-11 +เช่นการเข้าถึงที่อยู่ไบต์ได้ + +=== ภาษา B ใหม่และ C รุ่นแรก + +#h(13.5em) ในปี พ.ศ. 2514 ริชชีเริ่มปรับปรุง B เพื่อใช้คุณสมบัติของ PDP-11 ที่ทรงพลังยิ่งขึ้น +การเพิ่มเติมที่สำคัญคือประเภทข้อมูลอักขระ เขาเรียกสิ่งนี้ว่า New B (NB) ทอมป์สันเริ่มใช้ NB เพื่อเขียน +เคอร์เนล Unix และข้อกำหนดของเขากำหนดทิศทางการพัฒนาภาษา + +จนถึงปี 1972 มีการเพิ่มประเภทข้อมูลที่หลากหลายมากขึ้นให้กับภาษา NB ภาษา NB มีอาร์เรย์ของ int และ +char และได้มีการเพิ่มพอยเตอร์ ความสามารถในการสร้างพอยเตอร์ไปยังประเภทอื่นๆ +อาร์เรย์ของทุกประเภท และประเภทที่จะส่งคืนจากฟังก์ชัน +อาร์เรย์ภายในนิพจน์ได้รับการปฏิบัติเสมือนเป็นพอยเตอร์ มีการเขียนคอมไพเลอร์ใหม่ และเปลี่ยนชื่อภาษาเป็น +C + +คอมไพเลอร์ C และยูทิลิตี้บางส่วนที่สร้างขึ้นด้วยคอมไพเลอร์นี้ถูกรวมอยู่ใน Unix เวอร์ชัน 2 +ซึ่งเรียกอีกอย่างว่า Research Unix + +=== โครงสร้างและการเขียน Unix kernel ใหม่ + +#h(13.5em) ใน Unix เวอร์ชัน 4 ซึ่งวางจำหน่ายในเดือนพฤศจิกายน พ.ศ. 2516 เคอร์เนล ของ Unix +ได้รับการเขียนใหม่อย่างกว้างขวางด้วยภาษา C ในเวลานั้น ภาษา C +ได้รับคุณสมบัติที่ทรงพลังบางอย่างเช่นประเภท struct + +ตัวประมวลผลล่วงหน้าได้รับการแนะนำประมาณปี 1973 ตามคำแนะนำของ Alan Snyder +และยังเป็นการยอมรับถึงประโยชน์ของกลไกการรวมไฟล์ที่มีอยู่ใน BCPL และPL/I +เวอร์ชันดั้งเดิมให้เฉพาะไฟล์ที่รวมไว้และการแทนที่สตริงแบบง่ายเท่านั้น `#include` รวม `#define` +ถึงมาโครที่ไม่มีพารามิเตอร์ หลังจากนั้นไม่นาน ก็มีการขยายเพิ่มเติม โดยส่วนใหญ่โดย Mike Lesk +และต่อมาโดย John Reiser เพื่อรวมมาโครที่มีอาร์กิวเมนต์และการคอมไพล์แบบมีเงื่อนไข + +Unix เป็นหนึ่งในเคอร์เนลระบบปฏิบัติการแรกๆ +ที่เขียนด้วยภาษาอื่นที่ไม่ใช่ภาษาแอสเซมบลีตัวอย่างก่อนหน้านี้ได้แก่ ระบบ Multics (ซึ่งเขียนด้วยภาษา +PL/I ) และ Master Control Program (MCP) สำหรับ Burroughs B5000 (ซึ่งเขียนด้วยภาษา +ALGOL ) ในปี 1961 ในช่วงปี 1977 Ritchie และ Stephen C. Johnson +ได้ทำการเปลี่ยนแปลงเพิ่มเติมให้กับภาษาเพื่ออำนวยความสะดวกในการพกพาระบบปฏิบัติการUnix +คอมไพเลอร์ Portable C ของ Johnson เป็นพื้นฐานสำหรับการใช้งาน C บนแพลตฟอร์มใหม่ๆ +หลายแพลตฟอร์ม === K&R C +#h(9.75em) ในปี พ.ศ. 2521 Brian KernighanและDennis Ritchie ได้ตีพิมพ์หนังสือ The C +Programming Language ฉบับพิมพ์ครั้งแรกหนังสือเล่มนี้รู้จักกันในชื่อย่อ K&R +ตามชื่อย่อของผู้เขียนและทำหน้าที่เป็นข้อกำหนดที่ไม่เป็นทางการ ของภาษาเป็นเวลาหลายปีเวอร์ชันของภาษา +C ที่อธิบายไว้ในหนังสือเล่มนี้มักเรียกกันว่า "K&R C" เนื่องจาก หนังสือเล่มนี้ได้รับการเผยแพร่ในปี พ.ศ. +2521 จึงเรียกอีกอย่างว่า C78 หนังสือฉบับพิมพ์ครั้งที่สองครอบคลุมมาตรฐาน ANSI C ในภายหลัง +ซึ่งจะกล่าวถึงต่อไป + +K&R ได้เพิ่มฟีเจอร์ด้านภาษาหลายอย่าง: + ++ ไลบรารีอินพุต/เอาต์พุตมาตรฐาน ++ long int ประเภทข้อมูล ++ unsigned int ประเภทข้อมูล ++ ตัวดำเนินการกำหนดค่าแบบผสมในรูปแบบ =_op_ (เช่น `=-`) ถูกเปลี่ยนเป็นรูปแบบ _op_= (นั่นคือ + `-=`)#jb เพื่อขจัดความกำกวมทางความหมายที่เกิดจากโครงสร้างเช่น `i=-10` ซึ่งถูกตีความว่า + `i =- 10` (ลด `i` ลง 10) แทนที่จะเป็นความหมายที่ตั้งใจไว้ (ให้ `i` เป็น -10) + +#h(9.75em) แม้หลังจากมีการเผยแพร่มาตรฐาน ANSI ปี 1989 แล้วก็ตาม เป็นเวลาหลายปีที่ K&R C +ยังคงถูกพิจารณาว่าเป็น "ตัวหารร่วมที่ต่ำที่สุด" ที่โปรแกรมเมอร์ภาษา C +ยึดถือเมื่อต้องการความสามารถในการพกพาได้สูงสุด +เนื่องจากคอมไพเลอร์รุ่นเก่าจำนวนมากยังคงถูกใช้งานอยู่และเนื่องจากโค้ด K&R C +ที่เขียนอย่างระมัดระวังก็สามารถเป็นไปตามมาตรฐาน C ได้เช่นกัน + +แม้ว่า C เวอร์ชันต่อมาจะกำหนดให้ฟังก์ชันต้องมีการประกาศประเภทอย่างชัดเจนแต่ C เวอร์ชัน K&R +กำหนดให้ฟังก์ชันที่ส่งคืนค่าประเภทอื่นที่ไม่ใช่ประเภท ที่กำหนดไว้เท่านั้น int ที่จะต้องประกาศก่อนใช้งาน +ฟังก์ชันที่ใช้โดยไม่มีการประกาศล่วงหน้าจะถือว่าส่งคืนค่าประเภทที่กำหนด int ไว้ + === ANSI C และ ISO C +#h(9.75em) ในช่วงปลายทศวรรษ 1970 และ 1980 ภาษา C เวอร์ชันต่างๆ ถูกนำไปใช้งานใน +คอมพิวเตอร์เมนเฟรมมินิคอมพิวเตอร์และไมโครคอมพิวเตอร์หลากหลายรุ่นรวมถึง IBM PC ด้วย +เนื่องจากความนิยมของคอมพิวเตอร์ประเภทนี้เพิ่มขึ้นอย่างมาก + +#h(9.75em) ในปี 1983 สถาบันมาตรฐานแห่งชาติอเมริกัน (ANSI) ได้จัดตั้งคณะกรรมการ#jb X3J11 +เพื่อกำหนดมาตรฐานของภาษา C X3J11 ใช้มาตรฐาน C ที่อิงตามการใช้งานบนระบบ Unix เป็นพื้นฐาน +อย่างไรก็ตามส่วนที่ไม่สามารถพกพาได้ของไลบรารี C บน Unix ได้ถูกส่งต่อไปยังกลุ่มทำงาน IEEE 1003 +เพื่อใช้เป็นพื้นฐานสำหรับ มาตรฐาน POSIX ในปี 1988 ในปี 1989 มาตรฐาน C ได้รับการรับรองเป็น +ANSI X3.159-1989 "ภาษาโปรแกรม C" เวอร์ชันนี้ของภาษามักถูกเรียกว่า ANSI C, Standard C +หรือบางครั้งเรียกว่า C89 + +#h(9.75em) ในปี 1990 มาตรฐาน ANSI C (พร้อมการเปลี่ยนแปลงรูปแบบ) +ได้รับการรับรองโดยองค์การมาตรฐานสากล (ISO) ในชื่อ ISO/IEC 9899:1990 ซึ่งบางครั้งเรียกว่า C90 +ดังนั้น คำว่า "C89" และ "C90" จึงหมายถึงภาษาโปรแกรมเดียวกัน + +#h(9.75em) เช่นเดียวกับองค์กรมาตรฐานแห่งชาติอื่นๆ ANSI ไม่ได้พัฒนามาตรฐาน C ด้วยตนเองอีกต่อไป +แต่จะอ้างอิงถึงมาตรฐาน C สากล ซึ่งดูแลโดยคณะทำงาน ISO/IEC JTC1/SC22 /WG14 +การนำมาตรฐานสากลฉบับปรับปรุงมาใช้ในระดับประเทศมักเกิดขึ้นภายในหนึ่งปีหลังจากที่ ISO +เผยแพร่มาตรฐานดังกล่าว + +#h(9.75em) หนึ่งในเป้าหมายของกระบวนการกำหนดมาตรฐานภาษา C คือการสร้างซูเปอร์เซ็ตของ K&R C +โดยรวมเอาคุณสมบัติที่ไม่เป็นทางการหลายอย่างที่ถูกนำมาใช้ในภายหลัง +คณะกรรมการมาตรฐานยังได้เพิ่มคุณสมบัติเพิ่มเติมอีกหลายอย่างเช่นต้นแบบฟังก์ชัน (ยืมมาจาก C++), +voidพอยเตอร์, การรองรับชุดอักขระและภาษาท้องถิ่นระหว่างประเทศ และการปรับปรุงพรีโปรเซสเซอร์ +แม้ว่าไวยากรณ์สำหรับการประกาศพารามิเตอร์จะได้รับการปรับปรุงให้รวมรูปแบบที่ใช้ใน C++ +แต่ก็ยังคงอนุญาตให้ใช้อินเทอร์เฟซ K&R เพื่อความเข้ากันได้กับซอร์สโค้ดที่มีอยู่ + +#h(9.75em) C89 ได้รับการสนับสนุนจากคอมไพเลอร์ C ในปัจจุบัน และโค้ด C สมัยใหม่ส่วนใหญ่ก็ใช้ C89 +เป็นพื้นฐานโปรแกรมใดๆ ที่เขียนด้วยภาษา C มาตรฐานเท่านั้น และไม่มีข้อสมมติฐานใดๆ ที่ขึ้นอยู่กับฮาร์ดแวร์ +จะทำงานได้อย่างถูกต้องบนแพลตฟอร์มใดๆ ที่มีการใช้งาน C ที่สอดคล้องกับมาตรฐาน +ภายในขีดจำกัดของทรัพยากร หากไม่ระมัดระวัง +โปรแกรมอาจคอมไพล์ได้เฉพาะบนแพลตฟอร์มใดแพลตฟอร์มหนึ่ง หรือด้วยคอมไพเลอร์เฉพาะเท่านั้น +ตัวอย่างเช่น เนื่องจากการใช้ไลบรารีที่ไม่เป็นมาตรฐาน เช่น ไลบรารี GUI +หรือการพึ่งพาคุณลักษณะเฉพาะของคอมไพเลอร์หรือแพลตฟอร์ม เช่น ขนาดที่แน่นอนของชนิดข้อมูลและลำดับไบต์ + +#h(9.75em) +ในกรณีที่โค้ดต้องสามารถคอมไพล์ได้ทั้งโดยคอมไพเลอร์ที่สอดคล้องกับมาตรฐานหรือคอมไพเลอร์ที่ใช้ C แบบ +K&R นั้น `__STDC__` สามารถใช้มาโครเพื่อแบ่งโค้ดออกเป็นส่วนมาตรฐานและส่วน K&R +เพื่อป้องกันการใช้คุณสมบัติที่มีเฉพาะใน C มาตรฐานบนคอมไพเลอร์ที่ใช้ C แบบ K&R + +#h(9.75em) หลังจากกระบวนการกำหนดมาตรฐาน ANSI/ISO ข้อกำหนดภาษา C +ยังคงค่อนข้างคงที่เป็นเวลาหลายปี ในปี 1995 มีการเผยแพร่การแก้ไขมาตรฐานฉบับที่ 1 ของมาตรฐาน C ปี +1990 (ISO/IEC 9899/AMD1:1995 ซึ่งเรียกกันอย่างไม่เป็นทางการว่า C95) +เพื่อแก้ไขรายละเอียดบางประการและเพิ่มการสนับสนุนชุดอักขระสากลที่ครอบคลุมมากขึ้น + === C99 +#h(9.75em) มาตรฐาน C ได้รับการแก้ไขเพิ่มเติมในช่วงปลายทศวรรษ 1990 ส่งผลให้มีการตีพิมพ์ +ISO/IEC 9899:1999 ในปี 1999 ซึ่งโดยทั่วไปเรียกว่า "C99" ต่อมาได้มีการแก้ไขเพิ่มเติมอีกสามครั้งโดย +Technical Corrigenda + +#h(9.75em) C99 ได้นำเสนอคุณสมบัติใหม่หลายประการรวมถึงฟังก์ชันอินไลน์ชนิดข้อมูลใหม่หลายชนิด(รวมถึง +long long intชนิด ข้อมูล complex ที่ใช้แทนจำนวนเชิงซ้อน) +อาร์เรย์ที่มีความยาวแปรผันได้และสมาชิกอาร์เรย์ที่ยืดหยุ่นการสนับสนุนที่ดีขึ้นสำหรับเลขทศลอย IEEE 754 +การสนับสนุนมาโครแบบแปรผัน (มาโครที่มีจำนวนอาร์กิวเมนต์ แปรผันได้) +และการสนับสนุนความคิดเห็นแบบบรรทัดเดียวที่ขึ้นต้นด้วย `@` `//` เช่นเดียวกับใน BCPL หรือ C++ +คุณสมบัติเหล่านี้หลายอย่างได้ถูกนำไปใช้เป็นส่วนขยายในคอมไพเลอร์ C หลายตัวแล้ว + +#h(9.75em) โดยส่วนใหญ่แล้ว C99 สามารถใช้งานร่วมกับ C90 ได้ แต่มีความเข้มงวดมากกว่าในบางด้าน +โดยเฉพาะอย่างยิ่ง การประกาศที่ไม่มีตัวระบุประเภทจะไม่ถือว่ามีintการกำหนดโดยปริยายอีกต่อไป +มีการกำหนดมาโครมาตรฐาน `__STDC_VERSION__` พร้อมค่า `199901L` เพื่อระบุว่ามีการสนับสนุน C99 +คอม ไพเลอร์ C อื่นๆ เช่น GCC, Solaris Studio และคอมไพเลอร์ C อื่นๆ +ในปัจจุบันรองรับคุณสมบัติใหม่หลายอย่างหรือทั้งหมดของ C99 อย่างไรก็ตาม คอมไพเลอร์ C ใน Microsoft +Visual C++ ใช้มาตรฐาน C89 และส่วนต่างๆ ของ C99 ที่จำเป็นสำหรับการใช้งานร่วมกับ C++11 + +#h(9.75em) นอกจากนี้ มาตรฐาน C99 ยังกำหนดให้รองรับตัวระบุที่ใช้ Unicode +ในรูปแบบของอักขระพิเศษ (เช่น `\u0040` หรือ `\U0001f431`) และแนะนำให้รองรับชื่อ Unicode +ดิบด้วย + === C11 +#h(9.75em) งานปรับปรุงมาตรฐาน C ฉบับใหม่เริ่มขึ้นในปี 2550 โดยเรียกกันอย่างไม่เป็นทางการว่า +"C1X" จนกระทั่งมีการประกาศใช้มาตรฐาน ISO/IEC 9899:2011 อย่างเป็นทางการในวันที่ 8 ธันวาคม +2554 คณะกรรมการมาตรฐาน C ได้กำหนดแนวทางเพื่อจำกัดการนำคุณสมบัติใหม่ๆ +ที่ยังไม่ได้รับการทดสอบโดยระบบที่มีอยู่มาใช้ + +#h(9.75em) มาตรฐาน C11 เพิ่มคุณสมบัติใหม่มากมายให้กับภาษา C และไลบรารี +รวมถึงมาโครแบบเจเนริกชนิดโครงสร้างนิรนามการสนับสนุน Unicode ที่ดีขึ้น +การดำเนินการอะตอมิกการทำงานแบบมัลติเธรดและฟังก์ชันตรวจสอบขอบเขต +นอกจากนี้ยังทำให้บางส่วนของไลบรารี C99 ที่มีอยู่เป็นตัวเลือก และปรับปรุงความเข้ากันได้กับ C++ +มาโครมาตรฐาน `__STDC_VERSION__` ถูกกำหนดไว้เพื่อ `201112L` ระบุว่ามีการสนับสนุน C11 แล้ว + === C17 +#h(9.75em) C17 เป็นชื่อเรียกอย่างไม่เป็นทางการของ ISO/IEC 9899:2018 +ซึ่งเป็นมาตรฐานสำหรับภาษาโปรแกรม C ที่เผยแพร่ในเดือนมิถุนายน 2018 +มาตรฐานนี้ไม่ได้เพิ่มคุณสมบัติใหม่ใดๆ ให้กับภาษา แต่เป็นการแก้ไขทางเทคนิคและการชี้แจงข้อบกพร่องใน +C11 เท่านั้น มาโครมาตรฐาน `__STDC_VERSION__` ถูกกำหนดขึ้นเพื่อ `201710L` ระบุว่ามีการรองรับ +C17 แล้ว + === C23 +#h(9.75em) C23 เป็นชื่อเรียกอย่างไม่เป็นทางการของการแก้ไขมาตรฐานภาษา C หลักในปัจจุบัน +ซึ่งในระหว่างการพัฒนาส่วนใหญ่เรียกว่า "C2X" โดยสร้างขึ้นจากเวอร์ชันก่อนหน้า และแนะนำคุณสมบัติใหม่ +เช่น คำหลักใหม่ ความหมายเพิ่มเติมสำหรับเพื่อ `auto` +ให้มีการอนุมานประเภทเมื่อประกาศตัวแปรประเภทใหม่รวมถึง `nullptr_t` และ `_BitInt` (N) +และการขยายไลบรารีมาตรฐาน + +C23 ได้รับการเผยแพร่ในเดือนตุลาคม 2024 ในชื่อ ISO/IEC 9899:2024 มาโครมาตรฐาน +`__STDC_VERSION__` ถูกกำหนดไว้ `202311L` เพื่อระบุว่ามีการสนับสนุน C23 + === C2Y +#h(9.75em) C2Y เป็นชื่อเรียกอย่างไม่เป็นทางการของการแก้ไขมาตรฐานภาษา C ครั้งใหญ่ถัดไป หลังจาก +C23 (C2X) ซึ่งคาดว่าจะออกในช่วงปลายทศวรรษ 2020 ดังนั้นจึงมีเลข '2' ใน "C2Y" ร่างฉบับแรกของ +C2Y ได้รับการเผยแพร่ในเดือนกุมภาพันธ์ 2024 ในชื่อ N3220 โดยกลุ่มทำงาน ISO/IEC JTC1/SC22 +/WG14 + === Embedded C +#h(9.75em) ในอดีตการเขียนโปรแกรม C +สำหรับระบบฝังตัวจำเป็นต้องใช้ส่วนขยายที่ไม่เป็นมาตรฐานของภาษา C เพื่อรองรับคุณสมบัติพิเศษ +เช่นการคำนวณเลขทศนิยมคงที่ +ธนาคารหน่วยความจำหลายชุดที่แตกต่างกันและการดำเนินการอินพุต/เอาต์พุตพื้นฐาน + +#h(9.75em) ในปี 2551 คณะกรรมการมาตรฐาน C ได้เผยแพร่รายงานทางเทคนิคที่ขยายภาษา C +เพื่อแก้ไขปัญหาเหล่านี้โดยการจัดหามาตรฐานทั่วไปสำหรับการใช้งานทั้งหมดให้ปฏิบัติตาม +ซึ่งรวมถึงคุณสมบัติหลายอย่างที่ไม่มีในภาษา C ปกติ เช่น การคำนวณเลขทศนิยมคงที่ +พื้นที่แอดเดรสแบบมีชื่อและการกำหนดแอดเดรสฮาร์ดแวร์ I/O พื้นฐาน + == ตัวแปร (Variables) -#i ตัวแปรในภาษา C เบื้องต้นแล้วประกอบไปด้วยประเภทของข้อมูล และชื่อตัวแปร +#i ตัวแปรในภาษา C เบื้องต้นแล้วประกอบไปด้วยประเภทของข้อมูลและชื่อตัวแปร โดยที่ชื่อตัวแปรนั้นสามารถเป็นรายการที่ถูกแบ่งด้วยเครื่องหมายจุลภาคได้ด้วยเช่นกัน ตัวอย่างคือ -```c -int data; -float a, b, c; -``` +#afigure( + ```c + int data; + float a, b, c; + ```, + kind: image, + caption: [ตัวอย่างการประกาศตัวแปรในภาษา C], +) == ประเภทข้อมูล (Data Types) -#i ข้อมูลที่เกี่ยวข้องกับตัวเลขมักมีประเภท *unsigned* และ *signed* โดยความแตกต่างหากอธิบายสั้น +#h(6em) ข้อมูลที่เกี่ยวข้องกับตัวเลขมักมีประเภท unsigned และ signed โดยความแตกต่างหากอธิบายสั้น ๆ คือ -- *Signed (มีเครื่องหมาย):* ตัวเลขที่สามารถติดลบได้ ระยะข้อมูลตัวอย่างคือ -128 ถึง 127 -- *Unsigned (ไม่มีเครื่องหมาย):* ตัวเลขที่ไม่สามารถติดลบได้ ระยะข้อมูลตัวอย่างคือ 0 ถึง 255 +#[ + #set enum(indent: 6em) + + Signed (มีเครื่องหมาย): ตัวเลขที่สามารถติดลบได้ ระยะข้อมูลตัวอย่างคือ -128 ถึง 127 + + Unsigned (ไม่มีเครื่องหมาย): ตัวเลขที่ไม่สามารถติดลบได้ ระยะข้อมูลตัวอย่างคือ 0 ถึง 255 +] -#i จะสังเกตได้ว่า ข้อมูลประเภท unsigned นั้นสามารถเก็บตัวเลขบวกได้จำนวนมากกว่า คือสูงสุดที่ 255 -แต่หากนำค่าสัมบูรณ์ (absolute value) ของระยะข้อมูลแบบ signed มาบวกกัน เช่น\ +#h(6em) จะสังเกตได้ว่า ข้อมูลประเภท unsigned นั้นสามารถเก็บตัวเลขบวกได้จำนวนมากกว่า คือสูงสุดที่ +255 แต่หากนำค่าสัมบูรณ์ (absolute value) ของระยะข้อมูลแบบ signed มาบวกกัน เช่น\ #math.equation($|-128| + |127|$, alt: "ค่าสัมบูรณ์ของ -128 บวกค่าสัมบูรณ์ของ 127") จะพบว่าได้ค่า 255 หมายความว่า จริง ๆ แล้วข้อมูลประเภท signed สามารถเก็บข้อมูลได้ 255 ตัวเลขเช่นกัน เพียงแต่ว่าครึ่งหนึ่งของตัวเลขที่สามารถเก็บได้เป็นตัวเลขติดลบ -*หมายเหตุ:* เลขคณิตจำนวนเต็มมีนิยามแตกต่างกันสำหรับชนิดจำนวนเต็มแบบ signed และ unsigned -โปรดดูตัวดำเนินการเลขคณิต โดยเฉพาะอย่างยิ่งการโอเวอร์โฟลว์จำนวนเต็ม +#h(6em) ดังนั้นโปรดจำไว้ว่า เลขคณิตจำนวนเต็มมีนิยามแตกต่างกันสำหรับชนิดจำนวนเต็มแบบ signed และ +unsigned โปรดดูตัวดำเนินการเลขคณิต โดยเฉพาะอย่างยิ่งการโอเวอร์โฟลว์จำนวนเต็ม === ประเภทบูลีน (Boolean) -*หมายเหตุ:* ประเภทบูลีนนั้นถูกนำเสนอครั้งแรกในมาตรฐาน C99 +ประเภทบูลีนนั้นถูกนำเสนอครั้งแรกในมาตรฐาน C99 โดยการกล่าวถึงประเภทข้อมูลบูลีนนั้น ในประวัติของภาษา C แล้วมีสองแบบ -โดยการกล่าวถึงประเภทข้อมูลบูลีนนั้น ในประวัติของภาษา C แล้วมีสองแบบ - -- `_Bool` (และมีมาโคร `bool`): จนถึงมาตรฐาน C23 -- `bool` (ที่ไม่ใช่แค่มาโคร): มีตั้งแต่มาตรฐาน C23 ++ `_Bool` (และมีมาโคร `bool`): จนถึงมาตรฐาน C23 ++ `bool` (ที่ไม่ใช่แค่มาโคร): มีตั้งแต่มาตรฐาน C23 === ประเภทจำนวนเต็ม (Integer) -- `short int` (หรืออีกชื่อหนึ่งคือ `short` และสามารถใช้คีย์เวิร์ด `signed` ได้) -- `unsigned short int` (หรือ `unsigned short`) -- `int` (หรือ `signed int`) \ ++ `short int` (หรืออีกชื่อหนึ่งคือ `short` และสามารถใช้คีย์เวิร์ด `signed` ได้) ++ `unsigned short int` (หรือ `unsigned short`) ++ `int` (หรือ `signed int`) \ คือประเภทข้อมูลตัวเลขที่ปกติที่สุด และจะถูกการันตีว่าจะมีขนาดขั้นต่ำ 16 บิตเสมอ โดยระบบทั่วไปส่วนใหญ่ในปัจจุบันจะเป็น 32 บิต -- `unsigned int` (หรือเพียงแค่ `unsigned`): คือประเภท `int` ในแบบ `unsigned`, มี ++ `unsigned int` (หรือเพียงแค่ `unsigned`): คือประเภท `int` ในแบบ `unsigned`, มี modulo arithmetic, และเหมาะสมสำหรับการเปลี่ยนแปลงบิต -- `long int` (หรือ `long`) -- `unsigned long int` (หรือ `unsigned long`) - -#pagebreak() - -- มีเพิ่มตั้งแต่ C99: - - `long long int` (หรือ `long long`) - - `unsigned long long int` (หรือ `unsigned long long`) -- มีเพิ่มตั้งแต่ C23: - - `_BitInt(n)` (หรือ `signed _BitInt(n)`): ประเภทข้อมูล signed แบบมีขนาดชัดเจน โดย ++ `long int` (หรือ `long`) ++ `unsigned long int` (หรือ `unsigned long`) ++ มีเพิ่มตั้งแต่ C99: + + `long long int` (หรือ `long long`) + + `unsigned long long int` (หรือ `unsigned long long`) ++ มีเพิ่มตั้งแต่ C23: + + `_BitInt(n)` (หรือ `signed _BitInt(n)`): ประเภทข้อมูล signed แบบมีขนาดชัดเจน โดย n แทนด้วยจำนวนบิต (รวมถึงบิตเครื่องหมาย และ n จะต้องไม่มากกว่า `BITINT_MAXWIDTH` จากไฟล์ ``) - - `unsigned _BitInt(n)`: เหมือนข้างต้น เพียงแค่เป็นประเภท unsigned + + `unsigned _BitInt(n)`: เหมือนข้างต้น เพียงแค่เป็นประเภท unsigned (และไม่มีบิตเครื่องหมาย) และเหมือนประเภทข้อมูลอื่น ๆ คุณสามารถเรียงคีย์เวิร์ดแบบใดก็ได้ เช่น `unsigned long long int` @@ -221,74 +403,54 @@ float a, b, c; caption: [ขนาดของข้อมูลเป็นบิต (ต่อ)], ) -และนอกจากค่าบิตขั้นต่ำ มาตรฐาน C นั้นการันตีว่า: - -#i ```c 1``` == ```c sizeof(char)``` #sym.lt.eq ```c sizeof(short)``` #sym.lt.eq -```c sizeof(int)``` #sym.lt.eq ```c sizeof(long)``` #sym.lt.eq -```c sizeof(long long)``` - -*หมายเหตุ:* เงื่อนไขนี้อนุญาตกรณีสุดขีดที่ทุกประเภทมีขนาด 64 บิตและ `sizeof` คืนค่า `1` -สำหรับทุกประเภท ==== รูปแบบข้อมูล (data model) -#i รูปแบบข้อมูล หรือ data model คือรูปแบบการเก็บข้อมูลของโปรแกรมซึ่งเป็นสิ่งที่กำหนดขนาดของตัวแปร +#h(13.5em) รูปแบบข้อมูล หรือ data model +คือรูปแบบการเก็บข้อมูลของโปรแกรมซึ่งเป็นสิ่งที่กำหนดขนาดของตัวแปร โดยรูปแบบข้อมูลนั้นจะถูกกำหนดโดยแพลตฟอร์มเป้าหมาย ซึ่งมีหน่วยประมวลผลและระบบปฏิบัติการเป็นปัจจัยหลัก โดยตามตารางในหัวข้อก่อนหน้า หลัก ๆ แล้วมีรูปแบบข้อมูลอยู่ 4 รูปแบบ คือ LP32, ILP32, LLP64, และ LP64 ซึ่งหากต้องการหาความหาย L หมายถึง Long, P หมายถึง Pointer, และ I หมายถึง Integer (จำนวนเต็ม) แล้วตามด้วยเลขบิต -ดังนั้น สรุปแล้วจึงจะมีความหมายดังนี้ - -ระบบ 32 บิต: -- LP32 หรือ 2/4/4: `long` และ Pointer มีขนาด 32 บิต - - Win16 API -- ILP32 หรือ 4/4/4: `int`, `long`, และ Pointer มีขนาด 32 บิต - - Win32 API - - ระบบ Unix และเสมือน Unix (Linux, Mac OS X) - -ระบบ 64 บิต: -- LLP64 หรือ 4/4/8: `long long` และ Pointer มีขนาด 64 บิต - - Win64 API -- LP64 หรือ 4/8/8: `long` และ Pointer มีขนาด 64 บิต - - ระบบ Unix และเสมือน Unix (Linux, Mac OS X) - -#i รูปแบบอื่น ๆ นั้นหาได้ยาก ตัวอย่างเช่น ILP64 (8/8/8: `int`, `long`, และ Pointer ขนาด -64 บิต) ที่มีการใช้งานแค่ในระบบ Unix 64 บิตช่วงเริ่มต้น (เช่น Unicos บน Cray) - -และโปรดจำไว้ว่า ตัวเลขที่มีขนาดแน่นอนนั้นมีให้ใช้งานใน `` ตั้งแต่ C99 === ประเภทจำนวนทศนิยมจริง (Real floating types) -ภาษา C นั้นมีประเภทข้อมูลสำหรับแทนตัวเลขทศนิยมจริง 3 (หรือ 6 ตั้งแต่ C23) ประเภท +#h(9.75em) ภาษา C นั้นมีประเภทข้อมูลสำหรับแทนตัวเลขทศนิยมจริง 3 (หรือ 6 ตั้งแต่ C23) ประเภท -- `float`: จำนวนทศนิยมความแม่นยำเดี่ยว ตรงกับฟอร์แมตมาตรฐาน IEEE-754 binary32 หากรองรับ -- `double`: จำนวนทศนิยมความแม่นยำสองเท่า ตรงกับฟอร์แมตมาตรฐาน IEEE-754 binary64 ++ `float`: จำนวนทศนิยมความแม่นยำเดี่ยว ตรงกับฟอร์แมตมาตรฐาน IEEE-754 binary32 หากรองรับ ++ `double`: จำนวนทศนิยมความแม่นยำสองเท่า ตรงกับฟอร์แมตมาตรฐาน IEEE-754 binary64 หากรองรับ -- `long double`: จำนวนทศนิยมความแม่นยำเพิ่มเติม ตรงกับฟอร์แมตมาตรฐาน IEEE-754 binary128 ++ `long double`: จำนวนทศนิยมความแม่นยำเพิ่มเติม ตรงกับฟอร์แมตมาตรฐาน IEEE-754 binary128 หากรองรับ มิฉะนั้นจะตรงกับ IEEE-754 binary64-extended หากรองรับ มิฉะนั้นจะตรงกับรูปแบบจำนวนทศนิยมที่ไม่ตรงกับมาตรฐาน IEEE-754 รูปแบบใดก็ได้ตราบใดที่มีความแม่นยำกว่า binary64 และระยะข้อมูลนั้นอย่างน้อยก็ต้องดีเท่า binary64 และหากไม่รองรับทั้งหมดนั้น จะตรงกับฟอร์แมตมาตรฐาน IEEE-754 binary64 - - รูปแบบ binary128 นั้นถูกใช้โดยระบบ HP-UX, SPARC, MIPS, ARM64, และ z/OS บางระบบ - - รูปแบบ IEEE-754 binary64-extended ที่รู้จักกันอย่างแพร่หลายที่สุดคือรูปแบบความแม่นยำเพิ่มเติม + + รูปแบบ binary128 นั้นถูกใช้โดยระบบ HP-UX, SPARC, MIPS, ARM64, และ z/OS บางระบบ + + รูปแบบ IEEE-754 binary64-extended ที่รู้จักกันอย่างแพร่หลายที่สุดคือรูปแบบความแม่นยำเพิ่มเติม 80 บิต x87 ซึ่งถูกใช้โดยสถาปัตยกรรม x86 และ x86-64 บางระบบ (การยกเว้นที่ควรพูดถึงคือ MSVC ที่กำหนดให้ `long double` อยู่ในรูปแบบเดียวกันกับ `double`, เช่น binary64) เมื่อใช้มาตรฐาน C ตั้งแต่ C23 เป็นต้นไปและหากแพลตฟอร์มของคุณใช้งานคอนแสตนต์มาโคร `__STDC_IEC_60559_DFP__` ข้อมูลประเภทตัวเลขทศนิยมดังต่อไปนี้จะถูกรองรับด้วย: -- `_Decimal32`: แทนรูปแบบมาตรฐาน IEEE-754 decimal32 -- `_Decimal64`: แทนรูปแบบมาตรฐาน IEEE-754 decimal64 -- `_Decimal128`: แทนรูปแบบมาตรฐาน IEEE-754 decimal128 +#[ + #set enum(indent:9.75em) + + `_Decimal32`: แทนรูปแบบมาตรฐาน IEEE-754 decimal32 ++ `_Decimal64`: แทนรูปแบบมาตรฐาน IEEE-754 decimal64 ++ `_Decimal128`: แทนรูปแบบมาตรฐาน IEEE-754 decimal128 +] มิฉะนั้น ประเภทตัวเลขทศนิยมเพิ่มเติมเหล่านี้จะไม่ถูกรองรับ ข้อมูลประเภททศนิยมอาจรองรับค่าพิเศษเพิ่มเติมได้แก่ -- อนันต์ (Infinity, ทั้งบวกและลบ) -- ศูนย์ติดลบ, `-0.0` โดยมีค่าเท่ากับศูยน์ที่ติดบวก แต่อาจมีความหมายในบางสมการ เช่น +#[ + #set enum(indent: 9.75em) + + อนันต์ (Infinity, ทั้งบวกและลบ) ++ ศูนย์ติดลบ, `-0.0` โดยมีค่าเท่ากับศูยน์ที่ติดบวก แต่อาจมีความหมายในบางสมการ เช่น `1.0 / 0.0 == INFINITY` แต่ `1.0 / -0.0 == -INFINITY` -- ไม่ใช่ตัวเลข (not-a-number; NaN) ซึ่งไม่เท่ากับอะไรเลย (รวมถึงตัวมันเอง) ++ ไม่ใช่ตัวเลข (not-a-number; NaN) ซึ่งไม่เท่ากับอะไรเลย (รวมถึงตัวมันเอง) +] ทศนิยมจำนวนจริงสามารถถูกใช้กับตัวดำเนินการทางคณิตศาสตร์ได้ *+ - / \** และฟังก์ชันทางคณิตศาสตร์จาก `` @@ -297,22 +459,15 @@ float a, b, c; === ประเภทจำนวนทศนิยมซับซ้อน (Complex floating types) -#i ประเภทข้อมูลจำนวนทศนิยมซับซ้อนนั้นเป็นประเภทที่แทนตัวเลขเชิงซ้อน (complex number) นั้นคือ -ตัวเลขที่สามารถถูกเขียนแทนเป็นผลรวมของจำนวนจริงและจำนวนจริงที่คูณด้วยจำนวนจินตภาพ: -#math.equation($a + b i$, alt: "a บวก b i") +#h(9.75em) ประเภทข้อมูลจำนวนทศนิยมซับซ้อนนั้นเป็นประเภทที่แทนตัวเลขเชิงซ้อน (complex number) +นั้นคือ ตัวเลขที่สามารถถูกเขียนแทนเป็นผลรวมของจำนวนจริงและจำนวนจริงที่คูณด้วยจำนวนจินตภาพ (a + +bi) โดยประเภทจำนวนเชิงซ้อนมีอยู่สามประเภท ได้แก่ -ประเภทจำนวนเชิงซ้อนมีอยู่สามประเภท ได้แก่ - -- ```c float _Complex``` (และสามารถใช้ ```c float complex``` ได้เช่นกันหากนำเข้า ++ `float _Complex` (และสามารถใช้ `float complex` ได้เช่นกันหากนำเข้า ``) ++ `double _Complex` (และสามารถใช้ `double complex` ได้เช่นกันหากนำเข้า ``) ++ `long double _Complex` (และสามารถใช้ `long double complex` ได้เช่นกันหากนำเข้า ``) -- ```c double _Complex``` (และสามารถใช้ ```c double complex``` ได้เช่นกันหากนำเข้า - ``) -- ```c long double _Complex``` (และสามารถใช้ ```c long double complex``` - ได้เช่นกันหากนำเข้า ``) -*หมายเหตุ:* เหมือนกับประเภทอื่น ๆ สามารถพิมพ์คีย์เวิร์ดในลำดับใดก็ได้ -```c long double complex```, ```c complex long double``` และแม้แต่ -```c double complex long``` นั้นคือประเภทข้อมูลเดียวกัน === ประเภทจำนวนทศนิยมจินตภาพ (Imaginary floating types) @@ -324,52 +479,47 @@ float a, b, c; ประเภทจำนวนเชิงซ้อนมีอยู่สามประเภท ได้แก่ -- ```c float _Imaginary``` (และสามารถใช้ ```c float imaginary``` ได้เช่นกันหากนำเข้า ++ `float _Imaginary` (และสามารถใช้ `float imaginary` ได้เช่นกันหากนำเข้า + ``) ++ `double _Imaginary` (และสามารถใช้ `double imaginary` ได้เช่นกันหากนำเข้า + ``) ++ `long double _Imaginary` (และสามารถใช้ `long double imaginary` ได้เช่นกันหากนำเข้า ``) -- ```c double _Imaginary``` (และสามารถใช้ ```c double imaginary``` - ได้เช่นกันหากนำเข้า ``) -- ```c long double _Imaginary``` (และสามารถใช้ ```c long double imaginary``` - ได้เช่นกันหากนำเข้า ``) -*หมายเหตุ:* เหมือนกับประเภทอื่น ๆ สามารถพิมพ์คีย์เวิร์ดในลำดับใดก็ได้ -```c long double imaginary```, ```c imaginary long double``` และแม้แต่ -```c double imaginary long``` นั้นคือประเภทข้อมูลเดียวกัน === ประเภทตัวอักษร (Character) -- `signed char`: ประเภทสำหรับตัวอักษรแบบ signed -- `unsigned char`: ประเภทสำหรับตัวอักษรแบบ unsigned -- `char`: ประเภทสำหรับตัวอักษรแบบไม่ระบุระยะข้อมูล ซึ่งสามารถเท่ากับ `signed char` หรือ ++ `signed char`: ประเภทสำหรับตัวอักษรแบบ signed ++ `unsigned char`: ประเภทสำหรับตัวอักษรแบบ unsigned ++ `char`: ประเภทสำหรับตัวอักษรแบบไม่ระบุระยะข้อมูล ซึ่งสามารถเท่ากับ `signed char` หรือ `unsigned char` ก็ได้ขึ้นอยู่กับแพลตฟอร์มและคอมไพเลอร์ แต่อย่างไรก็ตาม `char` นั้นไม่ใช่เพียงแค่มาโครที่ลิงก์ไปยังประเภทอื่น ๆ แต่ `char` คือประเภทของมันเอง === คีย์เวิร์ด -- `bool`, `true`, `false`, `char`, `int`, `short`, `long`, `signed`, `unsigned`, ++ `bool`, `true`, `false`, `char`, `int`, `short`, `long`, `signed`, `unsigned`, `float`, `double`. -- `_Bool`, `_BitInt`, `_Complex`, `_Imaginary`, `_Decimal32`, `_Decimal64`, ++ `_Bool`, `_BitInt`, `_Complex`, `_Imaginary`, `_Decimal32`, `_Decimal64`, `_Decimal128`. === ระยะค่าที่เก็บได้ -#i ตารางต่อไปนี้ให้ข้อมูลเกี่ยวกับขอบเขตของประเภทข้อมูลต่าง ๆ - -#i ก่อนมาตรฐาน C23 มาตรฐาน C อนุญาตการแทนตัวเลขแบบใดก็ได้ และระยะขั้นต่ำของตัวเลข N บิตคือ -#math.equation($-(2^(N-1)-1)$, alt: "ลบ 2 ยกกำลัง N ลบ 1 ทั้งหมดลบ 1") ถึง -#math.equation($+2^(N-1)-1$, alt: "บวก 2 ยกกำลัง N ลบ 1 ทั้งหมดลบ 1") (เช่น *-127* -ถึง *127* สำหรับประเภทตัวเลข 8 บิต) ซึ่งตรงกับขอบเขตของส่วนเติมเต็มหนึ่ง (one's complement) +#h(9.75em) ก่อนมาตรฐาน C23 มาตรฐาน C อนุญาตการแทนตัวเลขแบบใดก็ได้ และระยะขั้นต่ำของตัวเลข +N บิตคือ #math.equation($-(2^(N-1)-1)$, alt: "ลบ 2 ยกกำลัง N ลบ 1 ทั้งหมดลบ 1") ถึง +#math.equation($+2^(N-1)-1$, alt: "บวก 2 ยกกำลัง N ลบ 1 ทั้งหมดลบ 1") (เช่น -127 ถึง +127 สำหรับประเภทตัวเลข 8 บิต) ซึ่งตรงกับขอบเขตของส่วนเติมเต็มหนึ่ง (one's complement) หรือการแทนจำนวนมีเครื่องหมาย (sign-and-magnitude) -#i อย่างไรก็ตาม รูปแบบข้อมูลที่ใช้กันอย่างแพร่หลายทั้งหมด (รวมถึง ILP32, LP32, LP64, และ -LLP64) และคอมไพเลอร์ C เกือบทั้งหมดใช้การแทนตัวเลขแบบส่วนเติมเต็มสอง (two's complement) -(มีข้อยกเว้นที่ทราบแค่บางคอมไพเลอร์สำหรับระบบ UNISYS) และตั้งแต่มาตรฐาน C23 +#h(9.75em) อย่างไรก็ตาม รูปแบบข้อมูลที่ใช้กันอย่างแพร่หลายทั้งหมด (รวมถึง ILP32, LP32, LP64, +และ LLP64) และคอมไพเลอร์ C เกือบทั้งหมดใช้การแทนตัวเลขแบบส่วนเติมเต็มสอง (two's +complement) (มีข้อยกเว้นที่ทราบแค่บางคอมไพเลอร์สำหรับระบบ UNISYS) และตั้งแต่มาตรฐาน C23 มันคือการแทนตัวเลขแบบเดียวที่ถูกอนุญาตให้ใช้โดยมาตรฐาน และมีขอบเขตที่แน่นอนระหว่าง #math.equation($-2^(N-1)$, alt: "ลบ 2 ยกกำลัง N ลบ 1") ถึง #math.equation( $+2^(N-1)-1$, alt: "บวก 2 ยกกำลัง N ลบ 1 ทั้งหมดลบ 1", -) (เช่น *-128* ถึง *127* สำหรับประเภทตัวเลข 8 บิต) +) (เช่น -128 ถึง 127 สำหรับประเภทตัวเลข 8 บิต) -(มีการเพิ่มจุลภาคในทศนิยมเพื่อเพิ่มความสะดวกในการอ่าน) +#h(9.75em) ตารางต่อไปนี้ให้ข้อมูลเกี่ยวกับขอบเขตของประเภทข้อมูลต่าง ๆ (มีการเพิ่มจุลภาคในทศนิยมเพื่อเพิ่มความสะดวกในการอ่าน) #show table.cell.where(x: 0): strong #show math.equation.where(block: true): set block(spacing: 0.6em) @@ -439,17 +589,17 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห [IEEE-754], table.cell( [ - - min subnormal: + + min subnormal: #math.equation( $± 1.401,298,4 · 10^(-45)$, alt: "บวกลบ 1.4012984 คูณ 10 ยกกำลัง -45", ) - - min normal: + + min normal: #math.equation( $± 1.175,494,3 · 10^(-38)$, alt: "บวกลบ 1.1754943 คูณ 10 ยกกำลัง -38", ) - - max: \ + + max: \ #math.equation( $± 3.402,823,4 · 10^(38)$, alt: "บวกลบ 3.4028234 คูณ 10 ยกกำลัง 38", @@ -459,11 +609,11 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห ), table.cell( [ - - min subnormal:\ + + min subnormal:\ `±0x1p-149` - - min normal:\ + + min normal:\ `±0x1p-126` - - max:\ + + max:\ `±0x1.fffffep+127` ], align: left, @@ -473,19 +623,19 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห [IEEE-754], table.cell( [ - - min subnormal: + + min subnormal: #math.equation( $± 4.940,656,458,412\ · 10^(-324)$, alt: "บวกลบ 4.940656458412 คูณ 10 ยกกำลัง ลบ 324", block: true, ) - - min normal: + + min normal: #math.equation( $± 2.225,073,858,507,201,\ 4 · 10^(-308)$, alt: "บวกลบ 2.2250738585072014 คูณ 10 ยกกำลัง ลบ 308", block: true, ) - - max: + + max: #math.equation( $± 1.797,693,134,862,315,\ 7 · 10^308$, alt: "บวกลบ 1.7976931348623157 คูณ 10 ยกกำลัง 308", @@ -496,11 +646,11 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห ), table.cell( [ - - min subnormal: + + min subnormal: `±0x1p-1074` - - min normal:\ + + min normal:\ `±0x1p-1022` - - max: `±0x1` \ `.fffffffffffffp+1023` + + max: `±0x1` \ `.fffffffffffffp+1023` ], align: left, ), @@ -527,19 +677,19 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห [x86], table.cell( [ - - min subnormal: + + min subnormal: #math.equation( $± 3.645,199,531,882,474,\ 602,528 · 10^(-4951)$, alt: "บวกลบ 3.645199531882474602528 คูณ 10 ยกกำลัง ลบ 4951", block: true, ) - - min normal: + + min normal: #math.equation( $± 3.362,103,143,112,093,\ 506,263 · 10^(-4932)$, alt: "บวกลบ 3.362103143112093506263 คูณ 10 ยกกำลัง ลบ 4932", block: true, ) - - max: + + max: #math.equation( $± 1.189,731,495,357,231,\ 765,021 · 10^(4932)$, alt: "บวกลบ 1.189731495357231765021 คูณ 10 ยกกำลัง 4932", @@ -550,11 +700,11 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห ), table.cell( [ - - min subnormal: + + min subnormal: `±0x1p-16445` - - min normal: + + min normal: `±0x1p-16382` - - max: `±0x1.ffffffff`\ `fffffffep+16383` + + max: `±0x1.ffffffff`\ `fffffffep+16383` ], align: left, ), @@ -563,19 +713,19 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห [IEEE-754], table.cell( [ - - min subnormal: + + min subnormal: #math.equation( $± 6.475,175,119,438,025,\ 110,924,438,958,227,\ 646,552,5 · 10^(-4966)$, alt: "บวกลบ 6.4751751194380251109244389582276465525 คูณ 10 ยกกำลัง ลบ 4966", block: true, ) - - min normal: + + min normal: #math.equation( $± 3.362,103,143,112,093,\ 506,262,677,817,321,\ 752,602,6 · 10^(-4932)$, alt: "บวกลบ 3.3621031431120935062626778173217526026 คูณ 10 ยกกำลัง ลบ 4932", block: true, ) - - max: + + max: #math.equation( $± 1.189,731,495,357,231,\ 765,085,759,326,628,\ 007,016,2 · 10^4932$, alt: "บวกลบ 1.1897314953572317650857593266280070162 คูณ 10 ยกกำลัง 4932", @@ -586,11 +736,11 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห ), table.cell( [ - - min subnormal: + + min subnormal: `±0x1p-16494` - - min normal: + + min normal: `±0x1p-16382` - - max: `±0x1.ffffffffffffff`\ `ffffffffffffffp+16383` + + max: `±0x1.ffffffffffffff`\ `ffffffffffffffp+16383` ], align: left, ), @@ -601,11 +751,11 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห [], table.cell( [ - - min subnormal:\ + + min subnormal:\ #math.equation($± 1 · 10^(-101)$, alt: "บวกลบ 1 คูณ 10 ยกกำลัง ลบ 101") - - min normal:\ + + min normal:\ #math.equation($± 1 · 10^(-95)$, alt: "บวกลบ 1 คูณ 10 ยกกำลัง ลบ 95") - - max:\ + + max:\ #math.equation( $± 9.999'999 · 10^96$, alt: "บวกลบ 9.999999 คูณ 10 ยกกำลัง 96", @@ -619,11 +769,11 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห [], table.cell( [ - - min subnormal:\ + + min subnormal:\ #math.equation($± 1 · 10^(-398)$, alt: "บวกลบ 1 คูณ 10 ยกกำลัง ลบ -398") - - min normal:\ + + min normal:\ #math.equation($± 1 · 10^(-383)$, alt: "บวกลบ 1 คูณ 10 ยกกำลัง ลบ 383") - - max: + + max: #math.equation( $± 9.999'999'999'999'999\ · 10^384$, alt: "บวกลบ 9.999999999999999 คูณ 10 ยกกำลัง 384", @@ -638,17 +788,17 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห [], table.cell( [ - - min subnormal:\ + + min subnormal:\ #math.equation( $± 1 · 10^(-6176)$, alt: "บวกลบ 1 คูณ 10 ยกกำลัง ลบ 6176", ) - - min normal:\ + + min normal:\ #math.equation( $± 1 · 10^(-6143)$, alt: "บวกลบ 1 คูณ 10 ยกกำลัง ลบ 6143", ) - - max: + + max: #math.equation( $ ± 9.999'999'999'999'999'\ 999'999'999'999'999'999\ · 10^6144 $, alt: "บวกลบ 9.999999999999999999999999999999999 คูณ 10 ยกกำลัง 6144", @@ -665,11 +815,11 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห == ชุดแปลโปรแกรมของกนู (GNU Compiler Collection; GCC) -#i ในกระบวนการการพัฒนาโครงงานนี้ +#h(6em) ในกระบวนการการพัฒนาโครงงานนี้ ชุดแปลโปรแกรมของกนูนั้นถูกใช้เป็นหลักเนื่องจากเป็นชุดแปลโปรแกรม (คอมไพเลอร์; Compiler) ที่ใช้เป็นหลักในการพัฒนาโคดที่สร้างบนพื้นฐาน Arduino และบอร์ดต่าง ๆ รวมถึงบอร์ด ESP32 -#i ชุดคอมไพเลอร์ GNU (GNU Compiler Collection; GCC) (เดิมชื่อ GNU C Compiler) +#h(6em) ชุดคอมไพเลอร์ GNU (GNU Compiler Collection; GCC) (เดิมชื่อ GNU C Compiler) คือชุดคอมไพเลอร์จากโครงการ GNU ที่รองรับภาษาโปรแกรม สถาปัตยกรรมฮาร์ดแวร์ และระบบปฏิบัติการต่าง ๆ มูลนิธิซอฟต์แวร์เสรี (FSF) เผยแพร่ GCC ในฐานะซอฟต์แวร์เสรีภายใต้สัญญาอนุญาตสถูกเรียกาธารณะทั่วไปของ GNU (GNU GPL) GCC @@ -677,13 +827,13 @@ LLP64) และคอมไพเลอร์ C เกือบทั้งห Linux ด้วยโคดประมาณ 15 ล้านบรรทัดในปี 2019 GCC จึงเป็นหนึ่งในโปรแกรมฟรีที่ใหญ่ที่สุดเท่าที่เคยมีมา GCC มีบทบาทสำคัญในการเติบโตของซอฟต์แวร์เสรี ทั้งในฐานะเครื่องมือและตัวอย่าง -#i นอกจากจะเป็นคอมไพเลอร์อย่างเป็นทางการของระบบปฏิบัติการ GNU แล้ว GCC +#h(6em) นอกจากจะเป็นคอมไพเลอร์อย่างเป็นทางการของระบบปฏิบัติการ GNU แล้ว GCC ยังได้รับการยอมรับให้เป็นคอมไพเลอร์มาตรฐานโดยระบบปฏิบัติการคอมพิวเตอร์สมัยใหม่ที่คล้ายกับ Unix อื่นๆ อีกมากมาย รวมถึงระบบปฏิบัติการ Linux ส่วนใหญ่ ระบบปฏิบัติการตระกูล BSD ส่วนใหญ่ก็เปลี่ยนมาใช้ GCC ไม่นานหลังจากเปิดตัว แม้ว่าหลังจากนั้น FreeBSD และ Apple macOS ได้เปลี่ยนมาใช้คอมไพเลอร์ Clang ส่วนใหญ่เป็นเพราะเหตุผลด้านลิขสิทธิ์ GCC ยังสามารถคอมไพเลอร์โคดสำหรับระบบปฏิบัติการ Windows, Android, iOS, Solaris, HP-UX, AIX และ MS-DOS ได้อีกด้วย -#i GCC ได้รับการพอร์ตไปยังแพลตฟอร์มและสถาปัตยกรรมชุดคำสั่งต่าง ๆ มากกว่าคอมไพเลอร์อื่น ๆ +#h(6em) GCC ได้รับการพอร์ตไปยังแพลตฟอร์มและสถาปัตยกรรมชุดคำสั่งต่าง ๆ มากกว่าคอมไพเลอร์อื่น ๆ และถูกนำไปใช้งานอย่างกว้างขวางในฐานะเครื่องมือในการพัฒนาซอฟต์แวร์ทั้งแบบฟรีและแบบที่เป็นกรรมสิทธิ์ นอกจากนี้ GCC ยังพร้อมใช้งานสำหรับระบบฝังตัวมากมาย รวมถึงชิปที่ใช้ ARM และ Power ISA diff --git a/Chapter2/Chapter2.typ b/Chapter2/Chapter2.typ index fc7d729..63dca8f 100644 --- a/Chapter2/Chapter2.typ +++ b/Chapter2/Chapter2.typ @@ -1,6 +1,6 @@ #import "../PageTemplate.typ": page-theme #import "@preview/i-figured:0.2.4" -// #show: page-theme +#set enum(numbering: "1)") #set heading(numbering: "บทที่ 1") #include "Intro.typ" @@ -11,7 +11,6 @@ #include "Buzzer.typ" #include "HTTP.typ" #include "HTTPS.typ" -#pagebreak() #include "TLS.typ" #include "NFC.typ" #include "Flutter.typ" diff --git a/Chapter2/Flutter.typ b/Chapter2/Flutter.typ index 2897f2a..9acb86d 100644 --- a/Chapter2/Flutter.typ +++ b/Chapter2/Flutter.typ @@ -30,8 +30,6 @@ Alibaba สามารถคอมไพล์เป็นโค้ดเครื่อง JavaScript หรือ WebAssembly ได้ รองรับอินเทอร์เฟซ มิกซ์อิน คลาสนามธรรม เจเนอริกแบบรีไฟด์ และการอนุมานชนิดข้อมูล -#pagebreak() - == สถาปัตยกรรม #iii Flutter ถูกออกแบบมาให้เป็นระบบแบบเลเยอร์ที่ต่อขยายได้ @@ -66,26 +64,31 @@ Linux การใช้ตัวฝังตัว โค้ด Flutter สา ที่อยู่เบื้องหลังด้วยคลาส Dart ไลบรารีนี้เปิดเผยส่วนประกอบพื้นฐานระดับต่ำสุด เช่น คลาสสำหรับควบคุมระบบย่อยการรับข้อมูล กราฟิก และการแสดงผลข้อความ +#pagebreak() + #iii โดยทั่วไป นักพัฒนาจะโต้ตอบกับ Flutter ผ่านเฟรมเวิร์ก Flutter ซึ่งเป็นเฟรมเวิร์กที่ทันสมัยและตอบสนองต่อสิ่งรอบข้าง เขียนด้วยภาษา Dart -เฟรมเวิร์กนี้ประกอบด้วยชุดไลบรารีแพลตฟอร์ม เลย์เอาต์ และพื้นฐานที่ครบครัน -ซึ่งประกอบด้วยเลเยอร์หลายชั้น เริ่มจากล่างขึ้นบน ได้แก่: +เฟรมเวิร์กนี้ประกอบด้วยชุดไลบรารี แพลตฟอร์ม#jb เลย์เอาต์ และพื้นฐานที่ครบครัน +ซึ่งประกอบด้วยเลเยอร์หลายชั้น เริ่มจากล่างขึ้นบน ได้แก่ -- คลาสพื้นฐานและบริการส่วนประกอบต่างๆ เช่น แอนิเมชัน การวาดภาพ และท่าทางสัมผัส - ซึ่งนำเสนอนามธรรมที่ใช้กันทั่วไปเหนือพื้นฐานที่อยู่เบื้องหลัง +#[ + #set enum(indent: 5.5em) + + คลาสพื้นฐานและบริการส่วนประกอบต่างๆ เช่น แอนิเมชัน การวาดภาพ และท่าทางสัมผัส + ซึ่งนำเสนอนามธรรมที่ใช้กันทั่วไปเหนือพื้นฐานที่อยู่เบื้องหลัง -- เลเยอร์การเรนเดอร์ให้นามธรรมสำหรับการจัดการเลย์เอาต์ ด้วยเลเยอร์นี้ - คุณสามารถสร้างโครงสร้างแบบต้นไม้ของวัตถุที่เรนเดอร์ได้ คุณสามารถจัดการวัตถุเหล่านี้แบบไดนามิก - โดยโครงสร้างแบบต้นไม้จะอัปเดตเลย์เอาต์โดยอัตโนมัติเพื่อสะท้อนการเปลี่ยนแปลงของคุณ + + เลเยอร์การเรนเดอร์ให้นามธรรมสำหรับการจัดการเลย์เอาต์ ด้วยเลเยอร์นี้ + คุณสามารถสร้างโครงสร้างแบบต้นไม้ของวัตถุที่เรนเดอร์ได้ คุณสามารถจัดการวัตถุเหล่านี้แบบไดนามิก + โดยโครงสร้างแบบต้นไม้จะอัปเดตเลย์เอาต์โดยอัตโนมัติเพื่อสะท้อนการเปลี่ยนแปลงของคุณ -- เลเยอร์วิดเจ็ตเป็นนามธรรมของการประกอบ - วัตถุเรนเดอร์แต่ละชิ้นในเลเยอร์การเรนเดอร์จะมีคลาสที่สอดคล้องกันในเลเยอร์วิดเจ็ต นอกจากนี้ - เลเยอร์วิดเจ็ตยังช่วยให้คุณกำหนดการรวมกันของคลาสที่คุณสามารถนำกลับมาใช้ใหม่ได้ - นี่คือเลเยอร์ที่แนะนำโมเดลการเขียนโปรแกรมแบบตอบสนอง + + เลเยอร์วิดเจ็ตเป็นนามธรรมของการประกอบ + วัตถุเรนเดอร์แต่ละชิ้นในเลเยอร์การเรนเดอร์จะมีคลาสที่สอดคล้องกันในเลเยอร์วิดเจ็ต นอกจากนี้ + เลเยอร์วิดเจ็ตยังช่วยให้คุณกำหนดการรวมกันของคลาสที่คุณสามารถนำกลับมาใช้ใหม่ได้ + นี่คือเลเยอร์ที่แนะนำโมเดลการเขียนโปรแกรมแบบตอบสนอง -- ไลบรารี Material และ Cupertino - นำเสนอชุดควบคุมที่ครอบคลุมซึ่งใช้ส่วนประกอบพื้นฐานของเลเยอร์วิดเจ็ตเพื่อนำภาษาการออกแบบ - Material หรือ iOS ไปใช้ + + ไลบรารี Material และ Cupertino + นำเสนอชุดควบคุมที่ครอบคลุมซึ่งใช้ส่วนประกอบพื้นฐานของเลเยอร์วิดเจ็ตเพื่อนำภาษาการออกแบบ + Material หรือ iOS ไปใช้ +] #iii เฟรมเวิร์ก Flutter มีขนาดค่อนข้างเล็ก ฟีเจอร์ระดับสูงหลายอย่างที่นักพัฒนาอาจใช้ถูกพัฒนาขึ้นมาในรูปแบบของแพ็กเกจ @@ -94,8 +97,6 @@ Linux การใช้ตัวฝังตัว โค้ด Flutter สา แพ็กเกจบางส่วนมาจากระบบนิเวศที่กว้างกว่า ครอบคลุมบริการต่างๆ เช่น การชำระเงินภายในแอป การตรวจสอบสิทธิ์ของ Apple และแอนิเมชัน -#pagebreak() - == โครงสร้างของแอปพลิเคชัน #iii แผนภาพต่อไปนี้แสดงภาพรวมของส่วนประกอบต่างๆ ที่ประกอบกันเป็นแอป Flutter @@ -104,35 +105,41 @@ Linux การใช้ตัวฝังตัว โค้ด Flutter สา คำอธิบายด้านล่างจะอธิบายคำศัพท์บางคำที่ใช้กันทั่วไปในการอธิบายส่วนประกอบของแอป Flutter #afigure( - image("Flutter/app-anatomy.svg", width: 3in), + image("Flutter/app-anatomy.svg", width: 2.5in), attr: [Flutter, ภายใต้ CC BY 4.0], - alt: "แผนผังสถาปัตยกรรม Flutter", - caption: [สถาปัตยกรรม Flutter], + alt: "เลเยอร์ต่าง ๆ ของแอพลิเคชัน Flutter ที่ถูกสร้างโดย flutter create", + caption: [เลเยอร์ต่าง ๆ ของแอพลิเคชัน Flutter], ) -- แอปพลิเคชัน Dart (Dart app) - - ประกอบวิดเจ็ตเข้าด้วยกันเพื่อสร้าง UI ที่ต้องการ - - ดำเนินการตามตรรกะทางธุรกิจ - - นักพัฒนาแอปเป็นเจ้าของ -- เฟรมเวิร์ก (Framework) - - ให้ API ระดับสูงสำหรับการสร้างแอปคุณภาพสูง (ตัวอย่างเช่น วิดเจ็ต การทดสอบการกด#jb - การตรวจจับท่าทาง การเข้าถึงได้ และการอินพุตข้อความ) - - ประกอบต้นวิดเจ็ตของแอปพลิเคชันเป็นฉาก -#pagebreak() -- เอนจิน (Engine) - - มีหน้าที่แปลงฉากเป็นรูปแบบแรสเตอร์ - - ให้การทำงานระดับต่ำของแกนกลางของ Flutter API (เช่น กราฟิก การจัดข้อความ และรันไทม์ +#[ + #set enum(indent: 9.25em) + === แอปพลิเคชัน Dart (Dart app) + + ประกอบวิดเจ็ตเข้าด้วยกันเพื่อสร้าง UI ที่ต้องการ + + ดำเนินการตามตรรกะทางธุรกิจ + + นักพัฒนาแอปเป็นเจ้าของ + + === เฟรมเวิร์ก (Framework) + + ให้ API ระดับสูงสำหรับการสร้างแอปคุณภาพสูง (ตัวอย่างเช่น วิดเจ็ต การทดสอบการกด + การตรวจจับท่าทาง การเข้าถึงได้ และการอินพุต ข้อความ) + + ประกอบต้นวิดเจ็ตของแอปพลิเคชันเป็นฉาก + + === เอนจิน (Engine) + + มีหน้าที่แปลงฉากเป็นรูปแบบแรสเตอร์ + + ให้การทำงานระดับต่ำของแกนกลางของ Flutter API (เช่น กราฟิก การจัดข้อความ และรันไทม์ Dart) - - เปิดเผยฟังก์ชันระดับนี้ให้แก่เฟรมเวิร์กผ่าน API `dart:ui` - - บูรณาการกับแพลตฟอร์มต่าง ๆ ด้วย API ตัวฝังตัว -- ตัวฝังตัว (Embedder) - - ประสานงานกับระบบปฏิบัติการภายใต้สำหรับการเข้าถึงบริการต่าง ๆ เช่น พื้นผิวการเรนเดอร์ + + เปิดเผยฟังก์ชันระดับนี้ให้แก่เฟรมเวิร์กผ่าน API `dart:ui` + + บูรณาการกับแพลตฟอร์มต่าง ๆ ด้วย API ตัวฝังตัว + + === ตัวฝังตัว (Embedder) + + ประสานงานกับระบบปฏิบัติการภายใต้สำหรับการเข้าถึงบริการต่าง ๆ เช่น พื้นผิวการเรนเดอร์ การเข้าถึง และการป้อนข้อมูล - - จัดการลูปอิเวนต์ - - เปิดเผย API เฉพาะแพลตฟอร์มเพื่อบูรณาการตัวฝังตัวเข้าไปยังแอป -- ตัวรัน (Runner) - - ประกอบชิ้นส่วนที่ถูกเปิดเผยโดยตัวฝังตัวเข้าเป็นแพคเกจแอปพลิเคชันที่สามารถใช้งานได้บนแพลตฟอร์มเป้าหมาย - - บางส่วนถูกสร้างขึ้นโดย `flutter create` และมีเจ้าของเป็นผู้พัฒนาแอป + + จัดการลูปอิเวนต์ + + เปิดเผย API เฉพาะแพลตฟอร์มเพื่อบูรณาการตัวฝังตัวเข้าไปยังแอป + + === ตัวรัน (Runner) + + ประกอบชิ้นส่วนที่ถูกเปิดเผยโดยตัวฝังตัวเข้าเป็นแพคเกจแอปพลิเคชันที่สามารถใช้งานได้บนแพลตฟอร์มเป้าหมาย + + บางส่วนถูกสร้างขึ้นโดย `flutter create` และมีเจ้าของเป็นผู้พัฒนาแอป +] == ระบบการดีไซน์ @@ -140,11 +147,11 @@ Linux การใช้ตัวฝังตัว โค้ด Flutter สา #[ #set enum(indent: 5.5em) - + Material Design: การดีไซน์ของ Google สำหรับ Android - + Cupertino Design: การดีไซน์ของ Apple สำหรับ iOS + + Material Design คือการดีไซน์ของ Google สำหรับ Android + + Cupertino Design คือการดีไซน์ของ Apple สำหรับ iOS ] -#iii *หมายเหตุ:* Cupertino Design ถูกแทนที่โดย Liquid Glass แล้ว โดยในปัจจุบันทีม Flutter +#iii อย่างไรก็ตาม Cupertino Design ถูกแทนที่โดย Liquid Glass แล้ว โดยในปัจจุบันทีม Flutter กำลังทำการตรวจสอบและแก้ไขโครงสร้างระบบดีไซน์ ดังนั้น หากมีผู้พัฒนาต้องการใช้เอฟเฟกต์#jb Liquid Glass ในแอปพลิเคชัน Flutter จึงจำเป็นต้องพึงพาแพคเกจบุคคลที่สามก่อนในขณะนี้ (Flutter เวอร์ชัน 3.38.5 ณ เวลาที่พิมพ์) @@ -198,6 +205,8 @@ Glass ในแอปพลิเคชัน Flutter จึงจำเป็ การแปลงแผนผังหลายแผนผังของวัตถุให้เป็นแผนผังระดับล่างของวัตถุ และการแพร่กระจายการเปลี่ยนแปลงไปยังแผนผังวิดเจ็ตเหล่านี้ +#pagebreak() + #iii วิดเจ็ตประกาศส่วนติดต่อผู้ใช้โดยการเขียนทับเมธอด `build()` ซึ่งเป็นฟังก์ชันที่แปลงสถานะเป็น UI: diff --git a/Chapter2/HTTPS.typ b/Chapter2/HTTPS.typ index e7a3861..c5e91db 100644 --- a/Chapter2/HTTPS.typ +++ b/Chapter2/HTTPS.typ @@ -53,16 +53,19 @@ Foundation; EFF) ด้วยการสนับสนุนจากนัก ผู้สร้างเว็บเบราว์เซอร์จึงไว้วางใจผู้ให้บริการออกใบรับรองในการออกใบรับรองที่ถูกต้อง ดังนั้น ผู้ใช้ควรเชื่อถือการเชื่อมต่อ HTTPS ไปยังเว็บไซต์ก็ต่อเมื่อเป็นไปตามเงื่อนไขทั้งหมดต่อไปนี้: -- ผู้ใช้เชื่อมั่นว่าอุปกรณ์ของตน โฮสต์เบราว์เซอร์ และวิธีการเข้าถึงเบราว์เซอร์นั้นไม่ถูกบุกรุก (กล่าวคือ - ไม่มีการโจมตีซัพพลายเชน) -- ผู้ใช้เชื่อมั่นว่าซอฟต์แวร์เบราว์เซอร์ใช้งาน HTTPS - ได้อย่างถูกต้องพร้อมกับผู้ให้บริการออกใบรับรองที่ติดตั้งไว้ล่วงหน้าอย่างถูกต้อง -- ผู้ใช้เชื่อมั่นว่าผู้ให้บริการออกใบรับรองจะรับรองเฉพาะเว็บไซต์ที่ถูกต้องตามกฎหมายเท่านั้น (กล่าวคือ - ผู้ให้บริการออกใบรับรองจะไม่ถูกบุกรุกและไม่มีการออกใบรับรองที่ผิดพลาด) -- เว็บไซต์มีใบรับรองที่ถูกต้อง ซึ่งหมายความว่าได้รับการลงนามโดยผู้ให้บริการที่เชื่อถือได้ -- ใบรับรองระบุเว็บไซต์ได้อย่างถูกต้อง (เช่น เมื่อเบราว์เซอร์เข้าชม https://example.com - ใบรับรองที่ได้รับนั้นถูกต้องสำหรับ example.com และไม่ใช่ของหน่วยงานอื่น) -- ผู้ใช้เชื่อมั่นว่าเลเยอร์การเข้ารหัสของโปรโตคอล (SSL/TLS) มีความปลอดภัยเพียงพอจากการดักฟัง +#[ + #set enum(indent: 6em) + + ผู้ใช้เชื่อมั่นว่าอุปกรณ์ของตน โฮสต์เบราว์เซอร์ และวิธีการเข้าถึงเบราว์เซอร์นั้นไม่ถูกบุกรุก (กล่าวคือ + ไม่มีการโจมตีซัพพลายเชน) + + ผู้ใช้เชื่อมั่นว่าซอฟต์แวร์เบราว์เซอร์ใช้งาน HTTPS + ได้อย่างถูกต้องพร้อมกับผู้ให้บริการออกใบรับรองที่ติดตั้งไว้ล่วงหน้าอย่างถูกต้อง + + ผู้ใช้เชื่อมั่นว่าผู้ให้บริการออกใบรับรองจะรับรองเฉพาะเว็บไซต์ที่ถูกต้องตามกฎหมายเท่านั้น (กล่าวคือ + ผู้ให้บริการออกใบรับรองจะไม่ถูกบุกรุกและไม่มีการออกใบรับรองที่ผิดพลาด) + + เว็บไซต์มีใบรับรองที่ถูกต้อง ซึ่งหมายความว่าได้รับการลงนามโดยผู้ให้บริการที่เชื่อถือได้ + + ใบรับรองระบุเว็บไซต์ได้อย่างถูกต้อง (เช่น เมื่อเบราว์เซอร์เข้าชม https://example.com + ใบรับรองที่ได้รับนั้นถูกต้องสำหรับ example.com และไม่ใช่ของหน่วยงานอื่น) + + ผู้ใช้เชื่อมั่นว่าเลเยอร์การเข้ารหัสของโปรโตคอล (SSL/TLS) มีความปลอดภัยเพียงพอจากการดักฟัง +] #iii HTTPS มีความสำคัญอย่างยิ่งต่อเครือข่ายที่ไม่ปลอดภัยและเครือข่ายที่อาจถูกแทรกแซง เครือข่ายที่ไม่ปลอดภัย เช่น จุดเชื่อมต่อ Wi-Fi สาธารณะ @@ -81,8 +84,7 @@ HTTPS นอกจากนี้ ยังพบว่าเครือข่ #iii การปรับใช้ HTTPS ยังอนุญาตให้ใช้ HTTP/2 และ HTTP/3 (และรุ่นก่อนหน้าอย่าง SPDY และ QUIC) ซึ่งเป็น HTTP เวอร์ชันใหม่ที่ออกแบบมาเพื่อลดเวลา ขนาด และความหน่วงในการโหลดหน้าเว็บ - -#iii และมีการแนะนำให้ใช้ HTTP Strict Transport Security (HSTS) ร่วมกับ HTTPS +และมีการแนะนำให้ใช้ HTTP Strict Transport Security (HSTS) ร่วมกับ HTTPS เพื่อป้องกันผู้ใช้จากการโจมตีแบบ man-in-the-middle โดยเฉพาะอย่างยิ่ง SSL stripping == ความปลอดภัย @@ -107,7 +109,10 @@ QUIC) ซึ่งเป็น HTTP เวอร์ชันใหม่ที คุกกี้บนเว็บไซต์ที่รันผ่าน HTTPS จะต้องเปิดใช้งานแอตทริบิวต์ secure ในเว็บไซต์ที่มีข้อมูลละเอียดอ่อน ผู้ใช้และเซสชันจะถูกเปิดเผยทุกครั้งที่เข้าถึงเว็บไซต์นั้นด้วย HTTP แทนที่จะเป็น HTTPS +#v(1em) + == รายละเอียดทางเทคนิค +#v(1em) === ความแตกต่างจาก HTTP diff --git a/Chapter2/Intro.typ b/Chapter2/Intro.typ index d2b2c9f..0ae73c4 100644 --- a/Chapter2/Intro.typ +++ b/Chapter2/Intro.typ @@ -1,22 +1,23 @@ #import "../PageTemplate.typ": chapter-page, i, jb #show: chapter-page -#set enum(indent: 3em, numbering: n => "2." + str(n)) #heading([#linebreak()ทฤษฎีและเอกสารที่เกี่ยวข้อง]) -#i ผู้จัดทำโครงงาน#h(1em)เครื่องยืนยันตัวตนด้วย NFC#h(1em)ได้ศึกษาทฤษฎีที่เกี่ยวข้องต่าง ๆ และ\ +#i ผู้จัดทำโครงงาน เครื่องยืนยันตัวตนด้วย NFC ได้ศึกษาทฤษฎีที่เกี่ยวข้องต่าง ๆ และ#jb รวบรวมแนวทางและหลักการต่าง ๆ จากเอกสารงานวิจัยที่เกี่ยวข้องดังต่อไปนี้ -+ ไมโครคอนโทรเลอร์ (Microcontroller) -+ เซ็นเซอร์ (Sensors) -+ ลำโพงสัญญาณ (Buzzer) -+ เกณฑ์วิธีขนส่งข้อความหลายมิติ (HyperText Transfer Protocol; HTTP) -+ เกณฑ์วิธีขนส่งข้อความหลายมิติแบบมั่นคง (Hypertext Transfer Protocol Secure; HTTPS) -+ เกณฑ์วิธีความมั่นคงของชั้นขนส่ง (Transport Layer Security; TLS) -+ การสื่อสารสนามใกล้ (Near-field communication; NFC) -+ Flutter -+ Git -+ ภาษาซี (C Programming Language) +#block(inset: (left: 3em))[ + 2.1 ไมโครคอนโทรเลอร์ (Microcontroller)\ + 2.2 เซ็นเซอร์ (Sensors)\ + 2.3 ลำโพงสัญญาณ (Buzzer)\ + 2.4 เกณฑ์วิธีขนส่งข้อความหลายมิติ (HyperText Transfer Protocol; HTTP)\ + 2.5 เกณฑ์วิธีขนส่งข้อความหลายมิติแบบมั่นคง (Hypertext Transfer Protocol Secure; HTTPS)\ + 2.6 เกณฑ์วิธีความมั่นคงของชั้นขนส่ง (Transport Layer Security; TLS)\ + 2.7 การสื่อสารสนามใกล้ (Near-field communication; NFC)\ + 2.8 Flutter\ + 2.9 Git\ + 2.10 ภาษาซี (C Programming Language) +] #set heading(numbering: "1.1") #counter(heading).update((2, 0)) diff --git a/Chapter2/Microcontroller.typ b/Chapter2/Microcontroller.typ index e558287..7ea1b0b 100644 --- a/Chapter2/Microcontroller.typ +++ b/Chapter2/Microcontroller.typ @@ -73,6 +73,8 @@ programmable" (ตั้งโปรแกรมได้ครั้งเด caption: "ไมโครคอนโทรลเลอร์ PIC ต่าง ๆ ที่มี EPROM ภายใน", ) +#v(1em) + #afigure( image( "Microcontroller/Microcomputer_with_EPROM_(piggyback).jpg", @@ -133,20 +135,23 @@ Microchip PIC16C84) ดอลลาร์#jb สหรัฐฯ (1,000 หน่วย แต่ที่ 0.466 ดอลลาร์สหรัฐสำหรับ 5,000 หน่วย) #iiii ในปี 2018 ไมโครคอนโทรลเลอร์ราคาถูกที่สูงกว่าปี 2015 ทั้งหมดมีราคาแพงกว่า -(โดยคำนวณอัตราเงินเฟ้อระหว่างราคาปี 2018 ถึง 2015 สำหรับหน่วยเฉพาะเหล่านั้น) ที่: -- ไมโครคอนโทรลเลอร์ 8 บิตสามารถซื้อได้ในราคา 0.319 ดอลลาร์สหรัฐฯ (1,000 หน่วย) หรือสูงกว่า +(โดยคำนวณอัตราเงินเฟ้อระหว่างราคาปี 2018 ถึง 2015 สำหรับหน่วยเฉพาะเหล่านั้น) +โดยไมโครคอนโทรลเลอร์ 8 บิตสามารถซื้อได้ในราคา 0.319 ดอลลาร์สหรัฐฯ (1,000 หน่วย) หรือสูงกว่า 2.6% -- ไมโครคอนโทรลเลอร์ 16 บิตมีราคา 0.464 ดอลลาร์สหรัฐฯ (1,000 หน่วย) หรือ 21% สูงกว่า -- แบบ 32 บิตในราคา 0.503 ดอลลาร์สหรัฐฯ (1,000 หน่วย แต่อยู่ที่ 0.466 ดอลลาร์สหรัฐฯ สำหรับ -5,000) หรือสูงกว่า 33% + +#iiii ไมโครคอนโทรลเลอร์ 16 บิตมีราคา 0.464 ดอลลาร์สหรัฐฯ (1,000 หน่วย) หรือ 21% สูงกว่า + +#iiii แบบ 32 บิตในราคา 0.503 ดอลลาร์สหรัฐฯ (1,000 หน่วย แต่อยู่ที่ 0.466 ดอลลาร์สหรัฐฯ +สำหรับ 5,000) หรือสูงกว่า 33% === คอมพิวเตอร์ที่เล็กที่สุด #iiii เมื่อวันที่ 21 มิถุนายน 2018 มหาวิทยาลัยมิชิแกนได้ประกาศ "คอมพิวเตอร์ที่เล็กที่สุดในโลก" อุปกรณ์ดังกล่าวเป็น "ระบบเซ็นเซอร์ไร้สายและไร้แบตเตอรี่ขนาด 0.04 ลบ.มม. 16 nW -พร้อมด้วยโปรเซสเซอร์ Cortex-M0+ ในตัวและการสื่อสารแบบออปติกสำหรับการวัดอุณหภูมิของเซลล์" -"วัดด้านข้างเพียง 0.3 มม. ประมาณขนาดเมล็ดข้าว [...] นอกเหนือจาก RAM และเซลล์แสงอาทิตย์แล้ว -อุปกรณ์#jb คอมพิวเตอร์รุ่นใหม่ยังมีโปรเซสเซอร์และเครื่องส่งและตัวรับสัญญาณไร้สาย +พร้อมด้วยโปรเซสเซอร์ Cortex-M0+ ในตัวและการสื่อสารแบบออปติกสำหรับการวัดอุณหภูมิของเซลล์"#jb +"วัดด้านข้างเพียง 0.3 มม. ประมาณขนาดเมล็ดข้าว [...] นอกเหนือจาก RAM +และเซลล์แสงอาทิตย์แล้ว#jb อุปกรณ์ +คอมพิวเตอร์รุ่นใหม่ยังมีโปรเซสเซอร์และเครื่องส่งและตัวรับสัญญาณไร้สาย เนื่องจากมีขนาดเล็กเกินไปที่จะมีเสาอากาศวิทยุแบบธรรมดา อุปกรณ์จึงรับและส่งข้อมูลด้วยแสงที่มองเห็นได้ สถานีฐานให้แสงสำหรับพลังงานและการเขียนโปรแกรม และรับข้อมูล" อุปกรณ์นี้มีขนาด 1/10 ของขนาดที่ IBM อ้างสิทธิ์ก่อนหน้านี้ คอมพิวเตอร์ที่มีขนาดเป็นสถิติโลกเมื่อหลายเดือนก่อนในเดือนมีนาคม 2018 ซึ่ง#jb @@ -156,37 +161,38 @@ IBM อ้างสิทธิ์ก่อนหน้านี้ คอมพ == ประเภท -#iii ณ ปี 2008 มีผู้ขายและสถาปัตยกรรมไมโครคอนโทรลเลอร์จำนวนมาก รวมไปถึง: +#iii ณ ปี 2008 มีผู้ขายและสถาปัตยกรรมไมโครคอนโทรลเลอร์จำนวนมาก รวมไปถึง:#jb -- หน่วยประมวลผล ARM core (หลายผู้ขาย) - - คอร์ประเภท ARM Cortex-M นั้นมีเป้าหมายเพื่อทำงานในไมโครคอนโทรลเลอร์โดยเฉพาะ -- Microchip Technology Atmel AVR (8 บิต), AVR32 (32 บิต), และ AT91SAM (32 บิต) -- คอร์ M8C ของ Cypress Semiconductor's ที่ถูกใช้ใน Cypress PSoC ของพวกเขา -- Freescale ColdFire (32 บิต) และ S08 (8 บิต) -- Freescale 68HC11 (8 บิต) และอื่น ๆ ที่มีรากฐานมาจากครอบครัว Motorola 6800 -- Intel 8051, ซึ่งนอกจาก Intel ก็ถูกผลิตโดย NXP Semiconductors, Infineon, และอื่น ๆ - หลายรายการ -- Infineon: 8 บิต XC800, 16 บิต XE166, 32 บิต XMC4000 (ARM based Cortex M4F), 32 บิต - TriCore, และ 32 บิต Aurix Tricore Bit microcontrollers -- Maxim Integrated MAX32600, MAX32620, MAX32625, MAX32630, MAX32650, MAX32640 -- MIPS -- Microchip Technology PIC, (8 บิต PIC16, PIC18, 16 บิต dsPIC33 / PIC24), (32 บิต - PIC32) -- NXP Semiconductors LPC1000, LPC2000, LPC3000, LPC4000 (32 บิต), LPC900, LPC700 - (8 บิต) -- Parallax Propeller -- PowerPC ISE -- Rabbit 2000 (8 บิต) -- Renesas Electronics: RL78 16 บิต MCU; RX 32 บิต MCU; SuperH; V850 32 บิต MCU; H8; - R8C 16 บิต MCU -- Silicon Laboratories ไมโครคอนโทรลเลอร์ Pipelined 8 บิต 8051 - และไมโครคอนโทรลเลอร์แบบ ARM-based 32 บิต สัญญาณผสม -- STMicroelectronics STM8 (8 บิต), ST10 (16 บิต), STM32 (32 บิต), SPC5 (automotive - 32 บิต) -- Texas Instruments TI MSP430 (16 บิต), MSP432 (32 บิต), C2000 (32 บิต) -- Toshiba TLCS-870 (8 บิต/16 บิต) +#block(inset: (left: 5.5em))[ + + หน่วยประมวลผล ARM core โดยเฉพาะคอร์ประเภท ARM Cortex-M + + Microchip Technology Atmel AVR (8 บิต), AVR32 (32 บิต), และ AT91SAM (32 บิต) + + คอร์ M8C ของ Cypress Semiconductor's ที่ถูกใช้ใน Cypress PSoC ของพวกเขา + + Freescale ColdFire (32 บิต) และ S08 (8 บิต) + + Freescale 68HC11 (8 บิต) และอื่น ๆ ที่มีรากฐานมาจากครอบครัว Motorola 6800 + + Intel 8051, ซึ่งนอกจาก Intel ก็ถูกผลิตโดย NXP Semiconductors, Infineon, และอื่น ๆ + หลายรายการ + + Infineon: 8 บิต XC800, 16 บิต XE166, 32 บิต XMC4000 (ARM based Cortex M4F), 32 + บิต TriCore, และ 32 บิต Aurix Tricore Bit microcontrollers + + Maxim Integrated MAX32600, MAX32620, MAX32625, MAX32630, MAX32650, MAX32640 + + MIPS + + Microchip Technology PIC, (8 บิต PIC16, PIC18, 16 บิต dsPIC33 / PIC24), (32 บิต + PIC32) + + NXP Semiconductors LPC1000, LPC2000, LPC3000, LPC4000 (32 บิต), LPC900, + LPC700 (8 บิต) + + Parallax Propeller + + PowerPC ISE + + Rabbit 2000 (8 บิต) + + Renesas Electronics: RL78 16 บิต MCU; RX 32 บิต MCU; SuperH; V850 32 บิต MCU; + H8; R8C 16 บิต MCU + + Silicon Laboratories ไมโครคอนโทรลเลอร์ Pipelined 8 บิต 8051 + และไมโครคอนโทรลเลอร์แบบ ARM-based 32 บิต สัญญาณผสม + + STMicroelectronics STM8 (8 บิต), ST10 (16 บิต), STM32 (32 บิต), SPC5 + (automotive 32 บิต) + + Texas Instruments TI MSP430 (16 บิต), MSP432 (32 บิต), C2000 (32 บิต) + + Toshiba TLCS-870 (8 บิต/16 บิต) +] -และยังมีอีกมากมาย โดยบางอย่างนั้นถูกใช้ในแอปพลิเคชันที่เจาะจงมาก +#iiii และยังมีอีกมากมาย โดยบางอย่างนั้นถูกใช้ในแอปพลิเคชันที่เจาะจงมาก หรือเหมือนกับหน่วยประมวลผลเฉพาะแอปพลิเคชันมากกว่าไมโครคอนโทรลเลอร์ ตลาดไมโครคอนโทรลเลอร์นั้นกระจัดกระจายเป็นอย่างมาก และมีผู้ขาย เทคโนโลยี และตลาดมากมาย และผู้ขายจำนวนมากขายหลายสถาปัตยกรรม @@ -195,16 +201,27 @@ IBM อ้างสิทธิ์ก่อนหน้านี้ คอมพ #iii ESP32 คือกลุ่มไมโครคอนโทรลเลอร์ราคาประหยัดและประหยัดพลังงานที่ผสานรวมความสามารถทั้ง Wi-Fi และบลูทูธ ชิปเหล่านี้มีตัวเลือกการประมวลผลที่หลากหลาย รวมถึงไมโครโปรเซสเซอร์ Tensilica -Xtensa LX6 ที่มีให้เลือกทั้งแบบ dual-core และ single-core, โปรเซสเซอร์ Xtensa LX7 +Xtensa LX6 ที่มีให้เลือกทั้งแบบ dual-core และ single-core, โปรเซสเซอร์#jb Xtensa LX7 dual-core หรือไมโครโปรเซสเซอร์ RISC-V แบบ single-core นอกจากนี้ ESP32 ยังรวมส่วนประกอบที่จำเป็นสำหรับการสื่อสารข้อมูลไร้สาย เช่น สวิตช์เสาอากาศในตัว บาลัน RF เครื่องขยายกำลัง เครื่องรับสัญญาณรบกวนต่ำ ตัวกรอง และโมดูลการจัดการพลังงาน -#iii โดยทั่วไปแล้ว ESP32 -จะถูกฝังอยู่บนแผงวงจรพิมพ์เฉพาะอุปกรณ์หรือนำเสนอเป็นส่วนหนึ่งของชุดการพัฒนาที่มีพินและตัวเชื่อมต่อ GPIO -ที่หลากหลาย โดยมีการกำหนดค่าที่แตกต่างกันไปตามรุ่นและผู้ผลิต ESP32 ได้รับการออกแบบโดย Espressif -Systems และผลิตโดย TSMC โดยใช้กระบวนการ 40 นาโนเมตร มันเป็นผู้สืบทอดของไมโครคอนโทรลเลอร์ -ESP8266 +#[ + // #set par(spacing: 0.75em) + #afigure( + image("Microcontroller/ESP32-C3_RISC-V_NodeMCU_board.jpg", width: 2in), + alt: "บอร์ดสีดำ มีพิน GPIO ด้านข้างและมีชิพอยู่บริเวณด้านบนบอร์ด", + attr: [Popolon, CC BY-SA 4.0, + https://commons.wikimedia.org/w/index.php?curid=112634884], + caption: [บอร์ด NodeMCU ที่มี ESP32-C3-32S], + ) + + #iii โดยทั่วไปแล้ว ESP32 + จะถูกฝังอยู่บนแผงวงจรพิมพ์เฉพาะอุปกรณ์หรือนำเสนอเป็นส่วนหนึ่งของชุดการพัฒนาที่มีพินและตัวเชื่อมต่อ + GPIO ที่หลากหลาย โดยมีการกำหนดค่าที่แตกต่างกันไปตามรุ่นและผู้ผลิต ESP32 ได้รับการออกแบบโดย + Espressif Systems และผลิตโดย TSMC โดยใช้กระบวนการ 40 นาโนเมตร + มันเป็นผู้สืบทอดของไมโครคอนโทรลเลอร์ ESP8266 +] === Espressif Systems @@ -220,11 +237,10 @@ things (IoT) == ตารางพาร์ทิชัน (Partition Table) -#i ตารางพาร์ทิชันคือสิ่งที่กำหนดการจัดการรูปแบบหน่วยความจำแฟลชและข้อมูลต่าง ๆ +#iii ตารางพาร์ทิชันคือสิ่งที่กำหนดการจัดการรูปแบบหน่วยความจำแฟลชและข้อมูลต่าง ๆ จะถูกเก็บไว้ในแต่ละพาร์ทิชัน โดยผู้พัฒนาสามารถใช้รูปแบบตารางพาร์ทิชันที่ถูกกำหนดมาไว้แล้วหรือสามารถกำหนดรูปแบบตารางพาร์ทิชันเองก็ได้ - -#i โดยตารางพาร์ทัชันที่ถูกใช้ในโครงงานนี้มีรูปแบบดังนี้ +โดยตารางพาร์ทัชันที่ถูกใช้ในโครงงานนี้มีรูปแบบดังนี้ #let partition-table = csv("PartitionTable.csv") @@ -238,73 +254,75 @@ things (IoT) caption: [รายการพาร์ทิชัน], ) -ซึ่งคือตารางค่าเริ่มต้นของ ESP32 ใน Arduino platform +#iii ซึ่งคือตารางค่าเริ่มต้นของ ESP32 ใน Arduino platform อย่างไรก็ตามมีการเปลี่ยนแปลงระบบเก็บไฟล์จาก SPIFFS เป็น LittleFS โดยที่: -+ Name: ชื่อของพาร์ทิชัน ห้ามซ้ำกัน ชื่อนั้นไม่สำคัญต่อระบบและต้องขนาดไม่เกิน 16 ตัวอักษร +#block(inset: (left: 6em))[ + + Name คือ ชื่อของพาร์ทิชัน ห้ามซ้ำกัน ชื่อนั้นไม่สำคัญต่อระบบและต้องขนาดไม่เกิน 16 ตัวอักษร (ไม่มีอักขระพิเศษ) -+ Type: ประเภทของพาร์ทัชัน สามารถเป็น data หรือ app ได้ - - app คือพาร์ทิชันที่ใช้ในการเก็บแอปพลิเคชัน - - data คือพาร์ทิชันที่ใช้ในการเก็บข้อมูลทั่วไป -+ SubType: ประเภทย่อย ระบุการใช้งานของพาร์ทิชัน app และ data - - data - - ota: พาร์ทัชันเก็บข้อมูล OTA (สำหรับการอัพเดททางอากาศ, Over-the-air update) - โดยหากไม่ใช้งาน OTA สามารถนำออกได้ โดยขนาดของพาร์ทิชันนี้ควรจะมีขนาดที่แน่นอนอยู่ที่ 8 KiB - (0x2000 ไบต์) - - nvs: พาร์ทิชันเก็บข้อมูลทั่วไปเช่น ข้อมูล Wi-Fi, ข้อมูลการสอบเทียบ PHY ของอุปกรณ์, - และข้อมูลอื่น ๆ ที่ต้องถูกเก็บบนหน่วยความจำถาวร (Non-volatile memory) - โดยพาร์ทิชันประเภทนี้เหมาะสมสำหรับการเก็บข้อมูลการตั้งค่าเล็กน้อย ใบรองรับคลาวด์ ฯลฯ - และการใช้งาน NVS อีกอย่างคือการเก็บข้อมูลที่ละเอียดอ่อน เนื่องจาก NVS รองรับการเข้ารหัส - และเป็นสิ่งที่แนะนำอย่างมากที่จะมีพาร์ทิชัน NVS ขนาดขั้นต่ำ 12 KiB (0x3000 ไบต์) - และหากจำเป็น คุณสามารถขยายขนาดเพิ่มได้ โดยขนาดที่แนะนำนั้นอยู่ระหว่าง 12 KiB และ 64 - KiB ถึงแม้ว่าคุณจะสามารถขยายให้มันใหญ่กว่านี้ได้ การใช้งานระบบไฟล์เช่น FAT หรือ SPIFFS - นั้นจะเหมาะสมสำหรับข้อมูลที่ใหญ่กว่า - - coredump: ประเภทพาร์ทิชันย่อยนี้มีหน้าที่ในการเก็บข้อมูล core dump บนหน่วยความจำแฟลช โดย - core dump นั้นคือข้อมูลที่ถูกใช้งานสำหรับการตรวจสอบข้อผิด-พลาดร้ายแรงเช่นการแครชและแพนิค - โดยฟังก์ชันนี้จะต้องถูกเปิดในการตั้งค่าโปรเจกต์และตั้งที่หมายในการแฟลช - และพาร์ทิชันนี้มีขนาดที่แนะนำอยู่ที่ 64 KiB (0x10000) - - nvs_keys: พาร์ทิชันที่เป็นประเภทย่อยนี้เก็บคีย์การเข้ารหัสของพาร์ทัชัน NVS - เมื่อการเข้ารหัสถูกใช้งาน โดยมีขนาดอยู่ที่ 4 KiB (0x1000) - - fat: กำหนดพาร์ทิชันสำหรับระบบไฟล์ FAT โดยที่จะเหมาะสมสำหรับข้อมูลใหญ่ ๆ - และหากข้อมูลนั้นถูกเปลี่ยนแปลงบ่อย โดยระบบไฟล์ FAT สามารถใช้ฟีเจอร์ wear leveling - และการเข้ารหัสได้ - - spiffs: กำหนดพาร์ทิชันสำหรับระบบไฟล์ SPIFFS เหมาะสำหรับไฟล์ใหญ่เช่นกันและรองรับ wear - leveling อย่างไรก็ตาม ระบบไฟล์นี้ไม่รองรับการเข้ารหัส - - app - - factory: พาร์ทิชันเก็บแอปพลิเคชันเริ่มต้น - โปรแกรมบูตโหลดเดอร์จะเลือกพาร์ทิชันนี้เป็นแอปพลิเคชันเริ่มต้นหากไม่มีพาร์ทิชัน OTA หรือพาร์ทิชัน - OTA นั้นว่างเปล่า หากมีการใช้พาร์ทิชัน OTA พาร์ทิชัน ota_0 - สามารถถูกใช้เป็นแอปพลิเคชันเริ่มต้นได้และพาร์ทิชัน factory สามารถถูกนำออกได้ - - ota_0 ถึง ota_15: พาร์ทิชัน ota_x นั้นถูกใช้สำหรับอัพเดท OTA โดยฟีเจอร์ OTA - นั้นจำเป็นต้องใช้พาร์ทิชัน OTA อย่างน้อย 2 พาร์ทิชัน (โดยปกติคือ ota_0 และ ota_1) - และจำเป็นต้องใช้พาร์ทิชัน ota ด้วยเช่นกันในการเก็บข้อมูลเกี่ยวกับ OTA โดยสามารถมีพาร์ทิชัน - OTA ได้สูงสุด 16 พาร์ทิชัน แต่ 2 พาร์ทิชันคือจำนวนขั้นต่ำที่ต้องใช้สำหรับฟีเจอร์ OTA แบบเบสิค - - test: ใช้สำหรับการทดสอบในโรงงาน -+ Offset: กำหนดพื้นที่ที่พาร์ทิชันนั้น ๆ เริ่มต้น โดย Offset นั้นถูกกำหนดโดยการรวมค่า Offset - และขนาดของพาร์ทิชันก่อนหน้า \ - หมายเหตุ: Offset จะต้องเป็นทวีคูณของ 4 KiB (0x1000) - และพาร์ทิชันแอพจะต้องจัดตำแหน่งให้มีขนาด 64 KiB (0x10000) โดยหากปล่อยให้ว่าง ค่า Offset - จะถูกคำนวนโดยอัตโนมัติตามตำแหน่งท้ายของพาร์ทิชันก่อนหน้า รวมถึงการจัดตำแหน่งใด ๆ ที่จำเป็น - อย่างไรก็ตาม Offset ของพาร์ทิชันแรกนั้นจะต้องเป็น 0x9000 และ 0x10000 - สำหรับพาร์ทิชันแอปพลิเคชันแรก -+ Size: ขนาดของพาร์ทิชัน โดยค่านี้สามารถเป็นเลขทศนิยม, ตัวเลข Hex (นำหน้าด้วย 0x), - หรือใช้ตัวอักษรต่อท้ายเพื่อบ่งบอกหน่วย K (กิโล) หรือ M (เมกา) เช่น 4096 = 4K = 0x1000 -+ Flags: ในปัจจุบันคอลัมน์นี้ใช้เพียงแค่เพื่อบ่งบอกว่าพาร์ทิชันนั้น ๆ ถูกเข้ารหัสหรือไม่ + + Type คือ ประเภทของพาร์ทิชัน สามารถเป็น data หรือ app ได้ + + app คือพาร์ทิชันที่ใช้ในการเก็บแอปพลิเคชัน + + data คือพาร์ทิชันที่ใช้ในการเก็บข้อมูลทั่วไป + + SubType คือ ประเภทย่อย ระบุการใช้งานของพาร์ทิชัน data และ app + + data + + ota คือ พาร์ทัชันเก็บข้อมูล OTA (สำหรับการอัพเดททางอากาศ, Over-the-air update) + โดยหากไม่ใช้งาน OTA สามารถนำออกได้ โดยขนาดของพาร์ทิชันนี้ควรจะมีขนาดที่แน่นอนอยู่ที่ 8 + KiB (0x2000 ไบต์) + + nvs คือ พาร์ทิชันเก็บข้อมูลทั่วไปเช่น ข้อมูล Wi-Fi, ข้อมูลการสอบเทียบ PHY ของอุปกรณ์, + และข้อมูลอื่น ๆ ที่ต้องถูกเก็บบนหน่วยความจำถาวร (Non-volatile memory) + โดยพาร์ทิชันประเภทนี้เหมาะสมสำหรับการเก็บข้อมูลการตั้งค่าเล็กน้อย ใบรองรับคลาวด์ ฯลฯ + และการใช้งาน NVS อีกอย่างคือการเก็บข้อมูลที่ละเอียดอ่อน เนื่องจาก NVS รองรับการเข้ารหัส + และเป็นสิ่งที่แนะนำอย่างมากที่จะมีพาร์ทิชัน NVS ขนาดขั้นต่ำ 12 KiB (0x3000 ไบต์) + และหากจำเป็น คุณสามารถขยายขนาดเพิ่มได้ โดยขนาดที่แนะนำนั้นอยู่ระหว่าง 12 KiB และ 64 + KiB ถึงแม้ว่าคุณจะสามารถขยายให้มันใหญ่กว่านี้ได้ การใช้งานระบบไฟล์เช่น FAT หรือ SPIFFS + นั้นจะเหมาะสมสำหรับข้อมูลที่ใหญ่กว่า + + coredump คือ ประเภทพาร์ทิชันย่อยนี้มีหน้าที่ในการเก็บข้อมูล core dump บนหน่วยความจำแฟลช + โดย core dump + นั้นคือข้อมูลที่ถูกใช้งานสำหรับการตรวจสอบข้อผิด-พลาดร้ายแรงเช่นการแครชและแพนิค + โดยฟังก์ชันนี้จะต้องถูกเปิดในการตั้งค่าโปรเจกต์และตั้งที่หมายในการแฟลช + และพาร์ทิชันนี้มีขนาดที่แนะนำอยู่ที่ 64 KiB (0x10000) + + nvs_keys คือ พาร์ทิชันที่เป็นประเภทย่อยนี้เก็บคีย์การเข้ารหัสของพาร์ทัชัน NVS + เมื่อการเข้ารหัสถูกใช้งาน โดยมีขนาดอยู่ที่ 4 KiB (0x1000) + + fat คือ กำหนดพาร์ทิชันสำหรับระบบไฟล์ FAT โดยที่จะเหมาะสมสำหรับข้อมูลใหญ่ ๆ + และหากข้อมูลนั้นถูกเปลี่ยนแปลงบ่อย โดยระบบไฟล์ FAT สามารถใช้ฟีเจอร์ wear leveling + และการเข้ารหัสได้ + + spiffs คือ กำหนดพาร์ทิชันสำหรับระบบไฟล์ SPIFFS เหมาะสำหรับไฟล์ใหญ่เช่นกันและรองรับ + wear leveling อย่างไรก็ตาม ระบบไฟล์นี้ไม่รองรับการเข้ารหัส + + app + + factory คือ พาร์ทิชันเก็บแอปพลิเคชันเริ่มต้น + โปรแกรมบูตโหลดเดอร์จะเลือกพาร์ทิชันนี้เป็นแอปพลิเคชันเริ่มต้นหากไม่มีพาร์ทิชัน OTA + หรือพาร์ทิชัน OTA นั้นว่างเปล่า หากมีการใช้พาร์ทิชัน OTA พาร์ทิชัน ota_0 + สามารถถูกใช้เป็นแอปพลิเคชันเริ่มต้นได้และพาร์ทิชัน factory สามารถถูกนำออกได้ + + ota_0 ถึง ota_15 คือ พาร์ทิชัน ota_x นั้นถูกใช้สำหรับอัพเดท OTA โดยฟีเจอร์ OTA + นั้นจำเป็นต้องใช้พาร์ทิชัน OTA อย่างน้อย 2 พาร์ทิชัน (โดยปกติคือ ota_0 และ ota_1) + และจำเป็นต้องใช้พาร์ทิชัน ota ด้วยเช่นกันในการเก็บข้อมูลเกี่ยวกับ OTA โดยสามารถมีพาร์ทิชัน + OTA ได้สูงสุด 16 พาร์ทิชัน แต่ 2 พาร์ทิชันคือจำนวนขั้นต่ำที่ต้องใช้สำหรับฟีเจอร์ OTA แบบเบสิค + + test คือ ใช้สำหรับการทดสอบในโรงงาน + + Offset คือ กำหนดพื้นที่ที่พาร์ทิชันนั้น ๆ เริ่มต้น โดย Offset นั้นถูกกำหนดโดยการรวมค่า Offset + และขนาดของพาร์ทิชันก่อนหน้า 0 อย่างไรก็ตาม Offset จะต้องเป็นทวีคูณของ 4 KiB (0x1000) + และพาร์ทิชันแอพจะต้องจัดตำแหน่งให้มีขนาด 64 KiB (0x10000) โดยหากปล่อยให้ว่าง ค่า Offset + จะถูกคำนวนโดยอัตโนมัติตามตำแหน่งท้ายของพาร์ทิชันก่อนหน้า รวมถึงการจัดตำแหน่งใด ๆ ที่จำเป็น + อย่างไรก็ตาม Offset ของพาร์ทิชันแรกนั้นจะต้องเป็น 0x9000 และ 0x10000 + สำหรับพาร์ทิชันแอปพลิเคชันแรก + + Size คือ ขนาดของพาร์ทิชัน โดยค่านี้สามารถเป็นเลขทศนิยม, ตัวเลข Hex (นำหน้าด้วย 0x), + หรือใช้ตัวอักษรต่อท้ายเพื่อบ่งบอกหน่วย K (กิโล) หรือ M (เมกา) เช่น 4096 = 4K = 0x1000 + + Flags คือ ในปัจจุบันคอลัมน์นี้ใช้เพียงแค่เพื่อบ่งบอกว่าพาร์ทิชันนั้น ๆ ถูกเข้ารหัสหรือไม่ +] == littlefs -#i littlefs คือระบบไฟล์ขนาดเล็กที่ปลอดภัยต่อความล้มเหลวที่ออกแบบมาสำหรับ#jb +#iii littlefs คือระบบไฟล์ขนาดเล็กที่ปลอดภัยต่อความล้มเหลวที่ออกแบบมาสำหรับ#jb ไมโครคอนโทรลเลอร์ -ความยืดหยุ่นในการป้องกันการสูญเสียพลังงาน littlefs ออกแบบมาเพื่อรับมือกับปัญหาไฟฟ้าดับแบบสุ่ม +#iii ความยืดหยุ่นในการป้องกันการสูญเสียพลังงาน littlefs ออกแบบมาเพื่อรับมือกับปัญหาไฟฟ้าดับแบบสุ่ม การดำเนินการไฟล์ทั้งหมดมีการรับประกันการคัดลอกข้อมูลเมื่อเขียนข้อมูล (copy-on-write) ที่แข็งแกร่ง และหากไฟฟ้าดับ ระบบไฟล์จะกลับสู่สถานะปกติล่าสุดที่ทราบ -การปรับระดับการสึกหรอแบบไดนามิก littlefs ออกแบบมาเพื่อแฟลชโดยเฉพาะ +#iii การปรับระดับการสึกหรอแบบไดนามิก littlefs ออกแบบมาเพื่อแฟลชโดยเฉพาะ และมอบการปรับระดับการสึกหรอบนบล็อกแบบไดนามิก นอกจากนี้ littlefs ยังสามารถตรวจจับบล็อกเสียและแก้ไขปัญหาได้ -RAM/ROM แบบมีขอบเขต littlefs ออกแบบมาเพื่อทำงานกับหน่วยความจำขนาดเล็ก การใช้งาน#jb RAM -ถูกจำกัดอย่างเข้มงวด ซึ่งหมายความว่าการใช้ RAM จะไม่เปลี่ยนแปลงเมื่อระบบไฟล์เติบโตขึ้น#jb +#iii RAM/ROM แบบมีขอบเขต littlefs ออกแบบมาเพื่อทำงานกับหน่วยความจำขนาดเล็ก#jb การใช้งาน +RAM ถูกจำกัดอย่างเข้มงวด ซึ่งหมายความว่าการใช้ RAM จะไม่เปลี่ยนแปลงเมื่อระบบไฟล์เติบโตขึ้น ระบบไฟล์ไม่มีการเรียกซ้ำแบบไม่มีขอบเขต และหน่วยความจำแบบไดนามิกถูกจำกัดให้อยู่ในบัฟเฟอร์ที่กำหนดค่าได้ซึ่งสามารถจัดเตรียมแบบคงที่ได้ @@ -322,8 +340,8 @@ RAM/ROM แบบมีขอบเขต littlefs ออกแบบมาเ โดยการจำกัดจำนวนการลบข้อมูลที่อนุญาตบนบล็อกต่อการจัดสรรแต่ละครั้ง ตัวจัดสรรจะปรับระดับการ#jb สึกหรอแบบไดนามิกทั่วทั้งระบบไฟล์ -#show raw: set par(leading: 0.4em) -#show raw: set text(size: 8pt) +#show raw: set par(leading: 0.35em) +#show raw: set text(size: 6pt) #afigure( ``` diff --git a/Chapter2/Microcontroller/ESP32-C3_RISC-V_NodeMCU_board.jpg b/Chapter2/Microcontroller/ESP32-C3_RISC-V_NodeMCU_board.jpg new file mode 100644 index 0000000..22a911e Binary files /dev/null and b/Chapter2/Microcontroller/ESP32-C3_RISC-V_NodeMCU_board.jpg differ diff --git a/Chapter2/NFC.typ b/Chapter2/NFC.typ index 09e7535..be5a5db 100644 --- a/Chapter2/NFC.typ +++ b/Chapter2/NFC.typ @@ -74,13 +74,13 @@ Field) สนามแม่เหล็กไฟฟ้าสลับเป็ มาตรฐาน ISO/IEC 18092 รองรับอัตราข้อมูล 106, 212 หรือ 424 กิโลบิต/วินาที -การสื่อสารเกิดขึ้นระหว่างอุปกรณ์ "ตัวเริ่มต้น" ที่ใช้งานอยู่และอุปกรณ์เป้าหมาย ซึ่งอาจเป็น: +การสื่อสารเกิดขึ้นระหว่างอุปกรณ์ "ตัวเริ่มต้น" ที่ใช้งานอยู่และอุปกรณ์เป้าหมาย ซึ่งอาจเป็น -/ พาสซีฟ: อุปกรณ์ตัวเริ่มต้นจะทำหน้าที่เป็นสนามแม่เหล็กพาหะ ++ พาสซีฟ โดยอุปกรณ์ตัวเริ่มต้นจะทำหน้าที่เป็นสนามแม่เหล็กพาหะ และอุปกรณ์เป้าหมายจะสื่อสารโดยการปรับสนามแม่เหล็กตกกระทบ ในโหมดนี้ อุปกรณ์เป้าหมายอาจดึงพลังงานจากสนามแม่เหล็กที่ตัวเริ่มต้นจัดหาให้ -/ คล่องแคล่ว: ทั้งอุปกรณ์เริ่มต้นและอุปกรณ์เป้าหมายสื่อสารกันโดยการสร้างฟิลด์ของตัวเองสลับกัน ++ คล่องแคล่ว โดยทั้งอุปกรณ์เริ่มต้นและอุปกรณ์เป้าหมายสื่อสารกันโดยการสร้างฟิลด์ของตัวเองสลับกัน อุปกรณ์จะหยุดส่งสัญญาณเพื่อรับข้อมูลจากอีกอุปกรณ์หนึ่ง โหมดนี้กำหนดให้อุปกรณ์ทั้งสองต้องมีแหล่งจ่ายไฟ #figure( @@ -99,13 +99,13 @@ Field) สนามแม่เหล็กไฟฟ้าสลับเป็ จะใช้การเข้ารหัสแบบมิลเลอร์ที่ปรับเปลี่ยนแล้วพร้อมการมอดูเลต 100 เปอร์เซ็นต์ในกรณีอื่นๆทั้งหมดจะใช้การเข้ารหัสแบบแมนเชสเตอร์โดยมีอัตราการมอดูเลต 10 เปอร์เซ็นต์ -อุปกรณ์ NFC ที่ใช้งานอยู่ทุกเครื่องสามารถทำงานในโหมดใดโหมดหนึ่งหรือหลายโหมดได้: +#iii อุปกรณ์ NFC ที่ใช้งานอยู่ทุกเครื่องสามารถทำงานในโหมดใดโหมดหนึ่งหรือหลายโหมดได้ -/ การจำลองการ์ด NFC: ช่วยให้อุปกรณ์ที่รองรับ NFC เช่น สมาร์ทโฟน ทำหน้าที่เหมือนสมาร์ทการ์ด ++ การจำลองการ์ด NFC ช่วยให้อุปกรณ์ที่รองรับ NFC เช่น สมาร์ทโฟน ทำหน้าที่เหมือนสมาร์ทการ์ด ช่วยให้ผู้ใช้ทำธุรกรรมต่างๆ เช่น การชำระเงินหรือการออกตั๋วได้ ดูการจำลองการ์ดโฮสต์ -/ เครื่องอ่าน/เขียน NFC: ช่วยให้อุปกรณ์ที่เปิดใช้งาน NFC สามารถอ่านข้อมูลที่จัดเก็บไว้ในแท็ก NFC ++ เครื่องอ่าน/เขียน NFC ช่วยให้อุปกรณ์ที่เปิดใช้งาน NFC สามารถอ่านข้อมูลที่จัดเก็บไว้ในแท็ก NFC ราคาไม่แพงที่ฝังอยู่ในฉลากหรือโปสเตอร์อัจฉริยะได้ -/ NFC เพียร์ทูเพียร์: ช่วยให้อุปกรณ์ที่เปิดใช้งาน NFC ++ NFC เพียร์ทูเพียร์ ช่วยให้อุปกรณ์ที่เปิดใช้งาน NFC สองเครื่องสามารถสื่อสารกันเพื่อแลกเปลี่ยนข้อมูลในลักษณะ เฉพาะกิจ แท็ก NFC คือหน่วยเก็บข้อมูลแบบพาสซีฟที่อุปกรณ์ NFC สามารถอ่านและเขียนข้อมูลได้ในบางกรณี#jb diff --git a/Chapter2/OpenSSL.typ b/Chapter2/OpenSSL.typ index 314c979..85ee6d4 100644 --- a/Chapter2/OpenSSL.typ +++ b/Chapter2/OpenSSL.typ @@ -19,18 +19,14 @@ OpenSSL ถูกใช้อย่างแพร่หลายในเซิ และ BSD ), Microsoft Windows และ OpenVMS -#iii OpenSSL รองรับอัลกอริทึมการเข้ารหัสที่แตกต่างกันจำนวนหนึ่ง: +#iii OpenSSL รองรับอัลกอริทึมการเข้ารหัสที่แตกต่างกันจำนวนหนึ่ง โดยฟังก์ชันการเข้ารหัสได้แก่ AES, +Blowfish, Camellia, ChaCha20, Poly1305, SEED, CAST-128, DES, IDEA, RC2, RC4, +RC5, Triple DES, GOST 28147-89, SM4 -*รหัส:* -AES, Blowfish, Camellia, ChaCha20, Poly1305, SEED, CAST-128, DES, IDEA, RC2, -RC4, RC5, Triple DES, GOST 28147-89, SM4 +#iii ฟังก์ชันแฮชการเข้ารหัสได้แก่ MD5, MD4, MD2, SHA-1, SHA-2, SHA-3, RIPEMD-160, +MDC-2, GOST R 34.11-94, BLAKE2, วังวน, SM3 -*ฟังก์ชันแฮชการเข้ารหัส:* -MD5, MD4, MD2, SHA-1, SHA-2, SHA-3, RIPEMD-160, MDC-2, GOST R 34.11-94, BLAKE2, -วังวน, SM3 - -*การเข้ารหัสด้วยคีย์สาธารณะ:* -RSA, DSA, การแลกเปลี่ยนคีย์ Diffie--Hellman, เส้นโค้งวงรี, X25519, Ed25519, X448, -Ed448, GOST R 34.10-2001, SM2 +#iii ฟังก์ชันการเข้ารหัสด้วยคีย์สาธารณะได้แก่ RSA, DSA, การแลกเปลี่ยนคีย์ Diffie--Hellman, +เส้นโค้งวงรี, X25519, Ed25519, X448, Ed448, GOST R 34.10-2001, SM2 (การปกปิดแบบสมบูรณ์แบบได้รับการสนับสนุนโดยใช้เส้นโค้งวงรี Diffie--Hellman ตั้งแต่เวอร์ชัน 1.0) diff --git a/Chapter2/PIR.typ b/Chapter2/PIR.typ index fbaafd0..b743b2d 100644 --- a/Chapter2/PIR.typ +++ b/Chapter2/PIR.typ @@ -9,6 +9,8 @@ (IR) ที่แผ่ออกมาจากวัตถุในระยะการมองเห็น เซ็นเซอร์ชนิดนี้มักใช้ในเครื่องตรวจจับความเคลื่อนไหว แบบ PIR เซ็นเซอร์ PIR มักใช้ในสัญญาณเตือนภัยและระบบไฟส่องสว่างอัตโนมัติ +#v(1em) + #afigure( image("PIR/Front-Fresnel_type.jpg", height: image-height), attr: [Jack LaRosa, Public Domain, @@ -17,7 +19,7 @@ PIR เซ็นเซอร์ PIR มักใช้ในสัญญาณ caption: [เครื่องตรวจจับการเคลื่อนไหวแบบ PIR ทั่วไปสำหรับที่พักอาศัย/เชิงพาณิชย์], ) -#iii เซ็นเซอร์ PIR ตรวจจับการเคลื่อนไหวทั่วไป แต่ไม่ได้ให้ข้อมูลว่าใครหรือสิ่งใดเคลื่อนไหว ดังนั้น +#iii เซ็นเซอร์ PIR ตรวจจับการเคลื่อนไหวทั่วไป แต่ไม่ได้ให้ข้อมูลว่าใครหรือสิ่งใดเคลื่อนไหว#jb ดังนั้น จึงจำเป็นต้องใช้ เซ็นเซอร์ IR แบบสร้างภาพ เซ็นเซอร์ PIR มักเรียกสั้นๆ ว่า "PIR" หรือบางครั้งเรียกว่า "PID" ซึ่งย่อมาจาก "เครื่องตรวจจับอินฟราเรดแบบพาสซีฟ" เซ็นเซอร์ PIR ตรวจจับการเคลื่อนไหวทั่วไป แต่ไม่ได้ให้ข้อมูลว่าใครหรือสิ่งใดเคลื่อนไหว ดังนั้น จึงจำเป็นต้องใช้ เซ็นเซอร์ @@ -36,8 +38,11 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก โดยปกติแล้วรังสีนี้มองไม่เห็นด้วยตาเปล่าเนื่องจากแผ่รังสีในช่วงความยาวคลื่นอินฟราเรด แต่อุปกรณ์อิเล็กทรอนิกส์ที่ออกแบบมาเพื่อจุดประสงค์นี้ สามารถตรวจจับได้ -== เครื่องตรวจจับการเคลื่อนไหวแบบ PIR +#v(1em) + +== เครื่องตรวจจับการเคลื่อนไหวแบบ PIR +\ #afigure( image("PIR/Motion_detector.jpg", height: image-height), alt: "เครื่องตรวจจับความเคลื่อนไหว ติดตั้งบนเพดาน", @@ -45,7 +50,6 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก https://commons.wikimedia.org/w/index.php?curid=6087132], caption: [เครื่องตรวจจับความเคลื่อนไหว PIR ใช้สำหรับควบคุมไฟภายนอกอาคารแบบอัตโนมัติ], ) - #afigure( image("PIR/Camera_trap,_fotopułapka,_kamera_leśna,_kamera_obserwacyjna.jpg"), attr: [Dariusz Kowalczyk, CC BY-SA 4.0, @@ -156,6 +160,8 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก โฟกัสแสงไปที่ชิ้นส่วนเซ็นเซอร์ไพโรอิเล็กทริกที่อยู่ด้านล่าง], ) +#v(3em) + #afigure( image("PIR/Fresnel_only.jpg", height: 2in), attr: [Jack LaRosa, Public Domain, @@ -165,6 +171,8 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก โดยมีแหล่งกำเนิดแสงจุดอยู่ด้านหลัง เพื่อแสดงเลนส์แต่ละตัว], ) +#v(3em) + #afigure( image("PIR/Circuit_board_revealed.jpg", height: 2in), attr: [Jack LaRosa, Public Domain, @@ -189,6 +197,8 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก caption: [PID ทั่วไปสำหรับที่พักอาศัย/เชิงพาณิชย์ที่ ใช้กระจกแบ่งส่วนภายในเพื่อการโฟกัส], ) +#v(1em) + #afigure( image("PIR/Mirror_type_opened.jpg", height: 2in), attr: [Deuxdad, Public Domain, @@ -197,6 +207,8 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก caption: [ถอดฝาครอบออกแล้ว กระจกแบ่งส่วน ด้านล่างมีแผงวงจรพิมพ์ (PC) อยู่ด้านบน], ) +#v(1em) + #afigure( image("PIR/Mirror_in_place.jpg", height: 2in), attr: [Jack LaRosa, Public Domain, @@ -213,6 +225,8 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก caption: [กระจกพาราโบลาแบบแบ่งส่วนถอดออกจากตัวเครื่อง], ) +#v(1em) + #afigure( image("PIR/Rear_of_circuit_board2.jpg", height: 2in), attr: [Jack LaRosa, Public Domain, @@ -222,6 +236,8 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก เซ็นเซอร์ไพโรอิเล็กทริกแสดงด้วยลูกศรสีเขียว], ) +#v(2em) + == รูปแบบลำแสง #afigure( @@ -233,6 +249,8 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก ความยาวของลำแสงเป็นตัวชี้วัดความไวของเครื่องตรวจจับในทิศทางนั้น], ) +#v(2em) + #h(9.75em) จากการโฟกัส ทำให้มุมมองของเครื่องตรวจจับกลายเป็นรูปแบบลำแสง ภายใต้มุมบางมุม (โซน) เซ็นเซอร์ PIR แทบจะไม่ได้รับพลังงานรังสีใด ๆ และภายใต้มุมอื่น ๆ PIR จะได้รับพลังงานอินฟราเรดในปริมาณที่เข้มข้น @@ -295,9 +313,9 @@ IR แบบสร้างภาพ เซ็นเซอร์ PIR มัก == เทอร์โมมิเตอร์แบบควบคุมระยะไกลด้วย PIR -#h(9.75em) มีการออกแบบวงจร PIR ที่ใช้วัดอุณหภูมิของวัตถุที่อยู่ห่างไกลในวงจรดังกล่าว จะใช้เอาต์พุต -PIR แบบไม่มีค่าความแตกต่าง สัญญาณเอาต์พุตจะถูกประเมินตามการสอบเทียบสเปกตรัม IR -ของสสารชนิดเฉพาะที่ต้องการตรวจวัด ด้วยวิธีนี้ การวัดอุณหภูมิจากระยะไกลจึงค่อนข้างแม่นยำและแม่นยำ +#h(9.75em) มีการออกแบบวงจร PIR ที่ใช้วัดอุณหภูมิของวัตถุที่อยู่ห่างไกลในวงจรดังกล่าว#jb +จะใช้เอาต์พุต PIR แบบไม่มีค่าความแตกต่าง สัญญาณเอาต์พุตจะถูกประเมินตามการสอบเทียบ#jb สเปกตรัม +IR ของสสารชนิดเฉพาะที่ต้องการตรวจวัด ด้วยวิธีนี้ การวัดอุณหภูมิจากระยะไกลจึงค่อนข้างแม่นยำและแม่นยำ หากไม่มีการสอบเทียบกับชนิดของวัสดุที่ตรวจวัด อุปกรณ์เทอร์โมมิเตอร์ PIR จะสามารถวัดการเปลี่ยนแปลงของการแผ่รังสี IR ซึ่งสอดคล้องกับการเปลี่ยนแปลงของอุณหภูมิโดยตรง แต่ไม่สามารถคำนวณค่าอุณหภูมิที่แท้จริงได้ diff --git a/Chapter2/TLS.typ b/Chapter2/TLS.typ index 2a48f6f..314dc33 100644 --- a/Chapter2/TLS.typ +++ b/Chapter2/TLS.typ @@ -39,24 +39,26 @@ Navigator โปรโตคอลใช้การจับมือกับรหัสแบบอสมมาตรเพื่อกำหนดค่าการเข้ารหัสไม่เพียงเท่านั้น แต่ยังรวมถึงคีย์ที่ใช้ร่วมกันเฉพาะเซสชัน ซึ่งการสื่อสารต่อไปจะถูกเข้ารหัสโดยใช้รหัสแบบสมมาตรในระหว่างการจับมือนี้ -ไคลเอนต์และเซิร์ฟเวอร์จะตกลงกันเกี่ยวกับพารามิเตอร์ต่างๆ ที่ใช้สร้างความปลอดภัยของการเชื่อมต่อ: +ไคลเอนต์และเซิร์ฟเวอร์จะตกลงกันเกี่ยวกับพารามิเตอร์ต่างๆ ที่ใช้สร้างความปลอดภัยของการเชื่อมต่อ -- การจับมือเริ่มต้นเมื่อไคลเอนต์เชื่อมต่อกับเซิร์ฟเวอร์ที่เปิดใช้งาน TLS +#block(inset: (left: 6em))[ + + การจับมือเริ่มต้นเมื่อไคลเอนต์เชื่อมต่อกับเซิร์ฟเวอร์ที่เปิดใช้งาน TLS เพื่อขอการเชื่อมต่อที่ปลอดภัยและไคลเอนต์แสดงรายการชุดรหัสที่รองรับ (รหัสและฟังก์ชันแฮช) -- จากรายการนี้ เซิร์ฟเวอร์จะเลือกฟังก์ชันรหัสและแฮชที่รองรับ และแจ้งให้ไคลเอนต์ทราบถึงการตัดสินใจ -- โดยปกติแล้วเซิร์ฟเวอร์จะระบุตัวตนในรูปแบบของใบรับรองดิจิทัลใบรับรองประกอบด้วยชื่อเซิร์ฟเวอร์ผู้ให้บริการออกใบรับรอง ++ จากรายการนี้ เซิร์ฟเวอร์จะเลือกฟังก์ชันรหัสและแฮชที่รองรับ และแจ้งให้ไคลเอนต์ทราบถึงการตัดสินใจ ++ โดยปกติแล้วเซิร์ฟเวอร์จะระบุตัวตนในรูปแบบของใบรับรองดิจิทัลใบรับรองประกอบด้วยชื่อเซิร์ฟเวอร์ผู้ให้บริการออกใบรับรอง (CA) ที่เชื่อถือได้ซึ่งรับรองความถูกต้องของใบรับรอง และคีย์การเข้ารหัสสาธารณะของเซิร์ฟเวอร์ -- ลูกค้าต้องยืนยันความถูกต้องของใบรับรองก่อนดำเนินการต่อ -- ในการสร้างคีย์เซสชันที่ใช้สำหรับการเชื่อมต่อที่ปลอดภัย ไคลเอนต์จะต้องทำดังนี้: - - เข้ารหัสตัวเลขสุ่ม (PreMasterSecret) ++ ลูกค้าต้องยืนยันความถูกต้องของใบรับรองก่อนดำเนินการต่อ ++ ในการสร้างคีย์เซสชันที่ใช้สำหรับการเชื่อมต่อที่ปลอดภัย ไคลเอนต์จะต้องทำดังนี้: + + เข้ารหัสตัวเลขสุ่ม (PreMasterSecret) ด้วยคีย์สาธารณะของเซิร์ฟเวอร์และส่งผลลัพธ์ไปยังเซิร์ฟเวอร์ (ซึ่งเฉพาะเซิร์ฟเวอร์เท่านั้นที่จะสามารถถอดรหัสด้วยคีย์ส่วนตัว) จากนั้นทั้งสองฝ่ายใช้ตัวเลขสุ่มเพื่อสร้างคีย์เซสชันเฉพาะสำหรับการเข้ารหัสและถอดรหัสข้อมูลในระหว่างเซสชันในภายหลังหรือ - - ใช้การแลกเปลี่ยนคีย์ Diffie--Hellman (หรือรูปแบบ DH ที่เป็นเส้นโค้งวงรี) + + ใช้การแลกเปลี่ยนคีย์ Diffie--Hellman (หรือรูปแบบ DH ที่เป็นเส้นโค้งวงรี) เพื่อสร้างคีย์เซสชันแบบสุ่มและไม่ซ้ำกันอย่างปลอดภัยสำหรับการเข้ารหัสและถอดรหัส ซึ่งมีคุณสมบัติเพิ่มเติมของการปกปิดแบบส่งต่อ : หากคีย์ส่วนตัวของเซิร์ฟเวอร์ถูกเปิดเผยในอนาคต จะไม่สามารถใช้คีย์นั้นเพื่อถอดรหัสเซสชันปัจจุบันได้ แม้ว่าเซสชันนั้นจะถูกดักจับและบันทึกโดยบุคคลที่สามก็ตาม +] #iii การดำเนินการนี้จะสิ้นสุดการจับมือและเริ่มการเชื่อมต่อที่ปลอดภัยซึ่งจะถูกเข้ารหัสและถอดรหัสด้วยคีย์เซสชันจนกว่าการเชื่อมต่อจะสิ้นสุดลงหากขั้นตอนใดขั้นตอนหนึ่งข้างต้นล้มเหลวการจับมือ @@ -72,18 +74,21 @@ TLS จะล้มเหลวและการเชื่อมต่อจ #iii เมื่อได้รับการรักษาความปลอดภัยโดย TLS การเชื่อมต่อระหว่างไคลเอนต์ (เช่น เว็บเบราว์เซอร์) และเซิร์ฟเวอร์ (เช่น wikipedia.org) จะมีคุณสมบัติทั้งหมดดังต่อไปนี้ -- การเชื่อมต่อเป็นแบบส่วนตัว (หรือมีความลับ) เนื่องจาก มีการใช้ - อัลกอริทึมคีย์แบบสมมาตรในการเข้ารหัสข้อมูลที่ส่ง - คีย์สำหรับการเข้ารหัสแบบสมมาตรนี้จะถูกสร้างขึ้นอย่างเฉพาะเจาะจงสำหรับแต่ละการเชื่อมต่อ - และอิงจากความลับร่วมที่เจรจากันไว้เมื่อเริ่มต้นเซสชัน - เซิร์ฟเวอร์และไคลเอ็นต์จะเจรจารายละเอียดเกี่ยวกับอัลกอริทึมการเข้ารหัสและคีย์การเข้ารหัสที่จะใช้ก่อนที่จะส่งข้อมูลไบต์แรก - (ดูด้านล่าง) การเจรจาความลับร่วมนั้นทั้งปลอดภัย - (ความลับที่เจรจากันไว้จะไม่สามารถเข้าถึงได้โดยผู้ดักฟังและไม่สามารถได้รับ - แม้แต่โดยผู้โจมตีที่วางตัวเองอยู่ตรงกลางการเชื่อมต่อ) และเชื่อถือได้ - (ไม่มีผู้โจมตีคนใดสามารถแก้ไขการสื่อสารระหว่างการเจรจาโดยไม่ถูกตรวจพบ) -- การยืนยันตัวตนของฝ่ายที่สื่อสารสามารถยืนยันได้โดยใช้การเข้ารหัสด้วยคีย์สาธารณะการยืนยันตัวตนนี้จำเป็นสำหรับเซิร์ฟเวอร์และเป็นทางเลือกสำหรับไคลเอนต์ -- การเชื่อมต่อมีความน่าเชื่อถือ (หรือมีความสมบูรณ์) +#[ + #set enum(indent: 6em) + + การเชื่อมต่อเป็นแบบส่วนตัว (หรือมีความลับ) เนื่องจาก มีการใช้ + อัลกอริทึมคีย์แบบสมมาตรในการเข้ารหัสข้อมูลที่ส่ง + คีย์สำหรับการเข้ารหัสแบบสมมาตรนี้จะถูกสร้างขึ้นอย่างเฉพาะเจาะจงสำหรับแต่ละการเชื่อมต่อ + และอิงจากความลับร่วมที่เจรจากันไว้เมื่อเริ่มต้นเซสชัน + เซิร์ฟเวอร์และไคลเอ็นต์จะเจรจารายละเอียดเกี่ยวกับอัลกอริทึมการเข้ารหัสและคีย์การเข้ารหัสที่จะใช้ก่อนที่จะส่งข้อมูลไบต์แรก + (ดูด้านล่าง) การเจรจาความลับร่วมนั้นทั้งปลอดภัย + (ความลับที่เจรจากันไว้จะไม่สามารถเข้าถึงได้โดยผู้ดักฟังและไม่สามารถได้รับ + แม้แต่โดยผู้โจมตีที่วางตัวเองอยู่ตรงกลางการเชื่อมต่อ) และเชื่อถือได้ + (ไม่มีผู้โจมตีคนใดสามารถแก้ไขการสื่อสารระหว่างการเจรจาโดยไม่ถูกตรวจพบ) ++ การยืนยันตัวตนของฝ่ายที่สื่อสารสามารถยืนยันได้โดยใช้การเข้ารหัสด้วยคีย์สาธารณะการยืนยันตัวตนนี้จำเป็นสำหรับเซิร์ฟเวอร์และเป็นทางเลือกสำหรับไคลเอนต์ ++ การเชื่อมต่อมีความน่าเชื่อถือ (หรือมีความสมบูรณ์) เนื่องจากข้อความแต่ละข้อความที่ส่งออกจะมีการตรวจสอบความสมบูรณ์ของข้อความโดยใช้รหัสยืนยันข้อความเพื่อป้องกันการสูญหายหรือการเปลี่ยนแปลงข้อมูลที่ไม่ถูกตรวจพบระหว่างการส่งข้อมูล +] #iii TLS รองรับวิธีการที่หลากหลายสำหรับการแลกเปลี่ยนคีย์ การเข้ารหัสข้อมูล และการตรวจสอบความถูกต้องของข้อความ ดังนั้น การกำหนดค่า TLS diff --git a/Chapter2/X509.typ b/Chapter2/X509.typ index d796695..51abc50 100644 --- a/Chapter2/X509.typ +++ b/Chapter2/X509.typ @@ -26,24 +26,20 @@ Study Group 17 และมีพื้นฐานมาจาก Abstract Synt #iiii โครงสร้างที่กำหนดไว้โดยมาตรฐานจะแสดงอยู่ในภาษาทางการที่เรียกว่า Abstract Syntax Notation One (ASN.1) -โครงสร้างของใบรับรองดิจิทัล X.509 v3 มีดังนี้: +#iiii โครงสร้างของใบรับรองดิจิทัล X.509 v3 มีดังนี้ -- ใบรับรอง - - หมายเลขเวอร์ชัน - - หมายเลขซีเรียล - - รหัสอัลกอริทึมลายเซ็น - - ชื่อผู้ออก - - ระยะเวลาใช้งาน - - ไม่ก่อน - - ไม่หลังจากนั้น - - ชื่อเรื่อง - - ข้อมูลคีย์สาธารณะของเรื่อง - - อัลกอริทึมคีย์สาธารณะ - - คีย์สาธารณะของเรื่อง รหัสประจำตัวผู้ออก (ทางเลือก) รหัสประจำตัวเฉพาะเรื่อง (ทางเลือก) - ส่วนขยาย (ทางเลือก) - - - อัลกอริทึมลายเซ็นใบรับรอง - - ลายเซ็นใบรับรอง ++ ใบรับรอง + + หมายเลขเวอร์ชัน + + หมายเลขซีเรียล + + รหัสอัลกอริทึมลายเซ็น + + ชื่อผู้ออก + + ระยะเวลาใช้งานไม่ก่อนหรือไม่หลังจากนั้น + + ชื่อเรื่อง + + ข้อมูลคีย์สาธารณะของเรื่องได้แก่อัลกอริทึมคีย์สาธารณะ + คีย์สาธารณะของเรื่องเช่นรหัสประจำตัวผู้ออก (ไม่จำเป็น) + รหัสประจำตัวเฉพาะเรื่อง (ไม่จำเป็น) ส่วนขยาย (ไม่จำเป็น) ++ อัลกอริทึมลายเซ็นใบรับรอง ++ ลายเซ็นใบรับรอง #iiii ฟิลด์ส่วนขยาย (ถ้ามี) จะเป็นลำดับของส่วนขยายใบรับรองอย่างน้อยหนึ่งรายการ แต่ละส่วนขยายมีรหัสประจำตัวเฉพาะของตัวเอง ซึ่งแสดงเป็นตัวระบุวัตถุ (OID) @@ -74,38 +70,41 @@ Notation One (ASN.1) #iiii นามสกุลไฟล์ที่ใช้กันทั่วไปสำหรับใบรับรอง X.509 มีหลายประเภทนามสกุลไฟล์เหล่านี้ยังใช้สำหรับข้อมูลอื่น ๆ เช่น คีย์ส่วนตัวด้วย -- `.pem` -- (อีเมลอิเล็กทรอนิกส์ที่เพิ่มความเป็นส่วนตัว) ใบรับรอง DER ที่เข้ารหัส Base64 +#[ + #set enum(indent: 9.75em) + + `.pem` -- (อีเมลอิเล็กทรอนิกส์ที่เพิ่มความเป็นส่วนตัว) ใบรับรอง DER ที่เข้ารหัส Base64 แนบระหว่าง `-----BEGIN CERTIFICATE-----` และ `-----END CERTIFICATE-----` -- `.cer`, `.crt`, `.der` -- โดยปกติจะอยู่ในรูปแบบไบนารี DER แต่ใบรับรองที่เข้ารหัส Base64 ++ `.cer`, `.crt`, `.der` -- โดยปกติจะอยู่ในรูปแบบไบนารี DER แต่ใบรับรองที่เข้ารหัส Base64 ก็เป็นเรื่องปกติเช่นกัน (ดู `.pem` ด้านบน) -- `.p8`, `.p8e`, `.pk8` -- คีย์ส่วนตัวที่ส่งออกตามที่ระบุไว้ใน PKCS\#8 อาจอยู่ในรูปแบบ DER หรือ ++ `.p8`, `.p8e`, `.pk8` -- คีย์ส่วนตัวที่ส่งออกตามที่ระบุไว้ใน PKCS\#8 อาจอยู่ในรูปแบบ DER หรือ PEM ที่ขึ้นต้นด้วย `-----BEGIN PRIVATE KEY-----` คีย์ที่เข้ารหัสจะขึ้นต้นด้วย `-----BEGIN ENCRYPTED PRIVATE KEY-----` และอาจมี `.p8e` เป็นนามสกุลไฟล์ -- `.p10`, `.csr` -- PKCS\#10 เป็นคำขอลงนามใบรับรอง (CSR) ในรูปแบบ PEM ขึ้นต้นด้วย ++ `.p10`, `.csr` -- PKCS\#10 เป็นคำขอลงนามใบรับรอง (CSR) ในรูปแบบ PEM ขึ้นต้นด้วย `-----BEGIN CERTIFICATE REQUEST-----` แบบฟอร์มเหล่านี้สร้างขึ้นเพื่อส่งไปยังผู้ออกใบรับรอง (CA) แบบฟอร์มประกอบด้วยรายละเอียดสำคัญของใบรับรองที่ร้องขอ เช่น ชื่อสามัญ (/CN), หัวเรื่อง, องค์กร, รัฐ, ประเทศ รวมถึงคีย์สาธารณะของใบรับรองที่ต้องการให้ลงนาม คีย์เหล่านี้จะได้รับการลงนามโดย CA และใบรับรองจะถูกส่งกลับคืน ใบรับรองที่ส่งคืนคือใบรับรอง สาธารณะ (ซึ่งมีคีย์สาธารณะแต่ไม่มีคีย์ส่วนตัว) ซึ่งตัวใบรับรองเองสามารถอยู่ในรูปแบบต่างๆ ได้หลายรูปแบบ แต่โดยปกติจะเป็น `.p7r` -- `.p7r` -- คำตอบ ของ PKCS\#7 ต่อ CSR ประกอบด้วยใบรับรองที่เพิ่งลงนาม และใบรับรองของ CA ++ `.p7r` -- คำตอบ ของ PKCS\#7 ต่อ CSR ประกอบด้วยใบรับรองที่เพิ่งลงนาม และใบรับรองของ CA เอง -- `.p7s` -- ลายเซ็นดิจิทัล PKCS\#7 อาจมีไฟล์หรือข้อความที่ลงนามต้นฉบับ ใช้ใน S/MIME ++ `.p7s` -- ลายเซ็นดิจิทัล PKCS\#7 อาจมีไฟล์หรือข้อความที่ลงนามต้นฉบับ ใช้ใน S/MIME สำหรับการลงนามในอีเมลกำหนดไว้ใน RFC 2311 -- `.p7m` -- PKCS\#7 (SignedData, EnvelopedData) ข้อความ เช่น ไฟล์ที่เข้ารหัส ++ `.p7m` -- PKCS\#7 (SignedData, EnvelopedData) ข้อความ เช่น ไฟล์ที่เข้ารหัส ("enveloped") ข้อความ หรือจดหมายอีเมล MIME กำหนดไว้ใน RFC 2311 -- `.p7c` -- โครงสร้าง SignedData แบบ "certs-only" ของ PKCS\#7 ที่เสื่อมลง ++ `.p7c` -- โครงสร้าง SignedData แบบ "certs-only" ของ PKCS\#7 ที่เสื่อมลง โดยไม่มีข้อมูลใดๆ ให้ลงนาม กำหนดไว้ใน RFC 2311 -- `.p7b` -- โครงสร้าง SignedData ของ PKCS\#7 ที่ไม่มีข้อมูล มีเพียงใบรับรองแบบบันเดิลหรือ CRL ++ `.p7b` -- โครงสร้าง SignedData ของ PKCS\#7 ที่ไม่มีข้อมูล มีเพียงใบรับรองแบบบันเดิลหรือ CRL (ไม่ค่อยเกิดขึ้น) แต่ไม่มีคีย์ส่วนตัว ใช้รูปแบบ DER หรือ BER หรือ PEM ที่ขึ้นต้นด้วย `-----BEGIN PKCS7-----` รูปแบบที่ Windows ใช้สำหรับการแลกเปลี่ยนใบรับรอง รองรับโดย Java แต่มักใช้นามสกุล `.keystore` แทน ซึ่งแตกต่างจากใบรับรองแบบ `.pem` รูปแบบนี้มีวิธีที่กำหนดไว้สำหรับการรวมใบรับรองเส้นทางการรับรอง -- `.p12`, `.pfx`, `.pkcs12` -- PKCS\#12 อาจมีใบรับรอง (สาธารณะ) และคีย์ส่วนตัว ++ `.p12`, `.pfx`, `.pkcs12` -- PKCS\#12 อาจมีใบรับรอง (สาธารณะ) และคีย์ส่วนตัว (ป้องกันด้วยรหัสผ่าน) ในไฟล์เดียว `.pfx` - _Personal Information eXchange_ PFX ซึ่งเป็นรุ่นก่อนของ PKCS\#12 (โดยปกติจะมีข้อมูลในรูปแบบ PKCS\#12 เช่น ไฟล์ PFX ที่สร้างใน IIS) -- `.crl` -- รายการเพิกถอนใบรับรอง (CRL) ++ `.crl` -- รายการเพิกถอนใบรับรอง (CRL) หน่วยงานที่ออกใบรับรองจะจัดทำรายการเหล่านี้ขึ้นเพื่อใช้ในการเพิกถอนใบรับรองก่อนหมดอายุ +] #iiii PKCS\#7 เป็นมาตรฐานสำหรับการลงนามหรือเข้ารหัสข้อมูล (เรียกอย่างเป็นทางการว่า "enveloping") diff --git a/Chapter2/x690.typ b/Chapter2/x690.typ index aec3aab..50f9a45 100644 --- a/Chapter2/x690.typ +++ b/Chapter2/x690.typ @@ -3,23 +3,23 @@ = X.690 (การเข้ารหัส DER) -#iii X.690 เป็น มาตรฐาน ITU-T ที่ระบุรูปแบบการเข้ารหัส ASN.1 หลายรูปแบบ: +#iii X.690 เป็น มาตรฐาน ITU-T ที่ระบุรูปแบบการเข้ารหัส ASN.1 หลายรูปแบบ -- กฎการเข้ารหัสพื้นฐาน (BER) -- กฎการเข้ารหัสแบบ Canonical (CER) -- กฎการเข้ารหัสที่โดดเด่น (DER) +== กฎการเข้ารหัสพื้นฐาน (BER) -กฎการเข้ารหัสพื้นฐาน (BER) คือกฎดั้งเดิมที่วางไว้โดยมาตรฐาน ASN.1 +#iiii กฎการเข้ารหัสพื้นฐาน (BER) คือกฎดั้งเดิมที่วางไว้โดยมาตรฐาน ASN.1 สำหรับการเข้ารหัสข้อมูลในรูปแบบไบนารี กฎเหล่านี้ ซึ่งเรียกรวมกันว่าไวยากรณ์การถ่ายโอนในภาษา ASN.1 กำหนดจำนวนอ็อกเท็ต (ไบต์ 8 บิต) ที่ใช้ในการเข้ารหัสข้อมูล -#iii โดยโครงงานนี้ใช้ใบรับรองในรูปแบบการเข้ารหัส DER ซึ่ง DER (Distinguished Encoding +== กฎการเข้ารหัสที่โดดเด่น (DER) + +#iiii โดยโครงงานนี้ใช้ใบรับรองในรูปแบบการเข้ารหัส DER ซึ่ง DER (Distinguished Encoding Rules) เป็น BER แบบจำกัดรูปแบบหนึ่งสำหรับการสร้างไวยากรณ์การถ่ายโอนข้อมูลที่ชัดเจนสำหรับโครงสร้างข้อมูลที่อธิบายโดย ASN.1 เช่นเดียวกับ CER การเข้ารหัส DER ถือเป็นการเข้ารหัส BER ที่ถูกต้อง DER เหมือนกับ BER โดยตัดตัวเลือกของผู้ส่งออกทั้งหมด ยกเว้นตัวเลือกเดียว -#iii DER เป็นส่วนย่อยของ BER ที่ให้วิธีการเข้ารหัสค่า ASN.1 เพียงวิธีเดียว DER +#iiii DER เป็นส่วนย่อยของ BER ที่ให้วิธีการเข้ารหัสค่า ASN.1 เพียงวิธีเดียว DER มีไว้สำหรับสถานการณ์ที่จำเป็นต้องมีการเข้ารหัสเฉพาะ เช่น ในการเข้ารหัสลับและช่วยให้มั่นใจว่าโครงสร้างข้อมูลที่จำเป็นต้องมีการลงนามดิจิทัลจะสร้างการแสดงแบบอนุกรมที่ไม่ซ้ำกัน DER ถือเป็นรูปแบบมาตรฐานของ BER ตัวอย่างเช่นใน BER ค่าบูลีน true diff --git a/Chapter3/BuildApp.typ b/Chapter3/BuildApp.typ new file mode 100644 index 0000000..e878995 --- /dev/null +++ b/Chapter3/BuildApp.typ @@ -0,0 +1,258 @@ +#import "../PageTemplate.typ": * + +== สร้างไฟล์แอปพลิเคชันด้วยตนเอง + +#i โครงงานนี้ใช้แอปพลิเคชันที่สร้างขึ้นมาเอง โดยในการพัฒนาแอปพลิเคชัน +อย่างน้อยต้องมีส่วนประกอบดังกล่าวก่อน + +- Flutter +- Git (ซึ่งคุณจะติดตั้งแล้วหากคุณทำตาม@writingFirmware) + +#i อย่างไรก็ตาม Flutter มีข้อจำกัดว่า มีเพียง Android +เท่านั้นที่ไม่ว่าแพลตฟอร์มไหนก็จะสามารถคอมไพล์ไฟล์ `.apk` ออกมาได้ ดังนั้น +การสร้างแอปพลิเคชันสำหรับ Linux ต้องทำบน Linux เท่านั้น และการสร้างแอปพลิเคชันสำหรับ Windows +ต้องทำบน Windows เท่านั้น + +=== การติดตั้งโปรแกรมเขียนโคด + +#iii จริง ๆ แล้วนั้น Flutter สามารถทำงานกับโปรแกรมเขียนโคดใดก็ได้ +แต่มีโปรแกรมเหล่านี้ที่อาจมีประสบการณ์การพัฒนาที่ดีกว่าโปรแกรมอื่น: + +- Visual Studio Code (VS Code) +- Android Studio +- JetBrains IntelliJ +- Firebase Studio + +#iii โครงงานนี้ใช้โปรแกรมเขียนโคด Android Studio เป็นหลักเนื่องจากแอปพลิเคชันโครงงานมี +Android เป็นเป้าหมายหลัก และ Android SDK สามารถจัดการได้ง่ายกว่าใน Android Studio + +#iii การติดตั้ง Flutter สามารถทำได้สองวิธีด้วยกัน คือการติดตั้งผ่าน Visual Studio Code (VS +Code) และการติดตั้งด้วยตนเอง โดยหากต้องการใช้ VS Code เป็นโปรแกรมเขียนโคดอยู่แล้ว +สามารถติดตั้งผ่าน VS Code ได้เลย แต่ก่อนอื่น ต้องทำการติดตั้งโปรแกรมและไลบรารีพื้นฐานที่จำเป็นสำหรับ +Flutter ก่อน + +#pagebreak() + +=== การติดตั้งโปรแกรมและไลบรารีที่จำเป็น + +#[ + #set enum(indent: 5.5em) + + Windows: ติดตั้ง Git สำหรับ Windows ซึ่งคุณสามารถดูขั้นตอนการติดตั้งได้ที่ + https://git-scm.com/install/windows หรือเพียงแค่ใช้คำสั่งด้านล่าง + #afigure( + ```sh + winget install --id Git.Git -e --source winget + ```, + kind: image, + caption: [คำสั่งในการติดตั้ง Git], + ) + + Linux: โปรดดู@flLinuxDetails สำหรับรายละเอียดแพคเกจและคำสั่งที่ต้องใช้สำหรับระบบต่าง ๆ + + + macOS: ใช้คำสั่งต่อไปนี้ในการติดตั้งเครื่องมือ Xcode ต่าง ๆ รวมถึง Git + #afigure( + ```sh + xcode-select --install + ```, + kind: image, + caption: [คำสั่งในการติดตั้งเครื่องมือ Xcode], + ) +] + +=== การติดตั้งผ่าน Visual Studio Code + +#block(inset: (left: 4.5em))[ + #set enum(indent: 1em) + + เปิด VSCode + + ติดตั้งส่วนขยาย Flutter \ + อยู่ภายใต้ ID `Dart-Code.flutter` ทั้งบน Visual Studio Marketplace และ OpenVSX + + ติดตั้ง Flutter ด้วย VS Code + + เปิด Command Palette ด้วยเมนู *View* > *Command Palette* หรือกด Ctrl + Shift + + P + + ใน Command Palette พิมพ์ `flutter`. + + เลือก *Flutter: New Project* + + VS Code จะให้คุณเลือก Flutter SDK บนคอมพิวเตอร์ของคุณ เลือก *Download SDK* + + เมือหน้าไดอะลอก *Select Folder for Flutter SDK* แสดงขึ้น เลือกสถานที่ที่คุณอยากติดตั้ง + Flutter + + คลิก *Clone Flutter* \ + ในระหว่างการดาวน์โหลด VS Code จะแสดงการแจ้งเตือนนี้: + ``` + Downloading the Flutter SDK. This may take a few minutes. + ``` + การดาวน์โหลดนี้จะใช้เวลาสองสามนาที หากคุณเชื่อว่าการดาวน์โหลดหยุดชะงัก คุณสามารถคลิก + *Cancel* แล้วเริ่มต้นการติดตั้งใหม่ได้ + + คลิก *Add SDK to PATH* \ + เมื่อเสร็จสิ้น จะมีการแจ้งเตือน + ``` + The Flutter SDK was added to your PATH + ``` + + VS Code อาจแสดงการแจ้งเตือนเกี่ยวกับการเก็บข้อมูลของ Google หากคุณยินยอม คลิก *OK* + + เพื่อความแน่ใจ กรุณาปิดเทอร์มินัลทุกหน้าต่างหรือรีสตาร์ท VS Code เพื่อให้แน่ใจว่า Flutter + จะสามารถใช้ผ่านเทอร์มินัลได้ + + เมื่อเสร็จสิ้น ใช้คำสั่ง `flutter doctor -v` ในเทอร์มินัลที่คุณเลือกเพื่อตรวจสอบการติดตั้ง + Flutter ของคุณ \ + หากคำสั่งไม่เจอหรือเกิดข้อผิดพลาดขึ้น ตรวจสอบ + https://docs.flutter.dev/install/troubleshoot สำหรับข้อมูลเพิ่มเติม +] + +=== การติดตั้งด้วยตนเอง + +#iii แนะนำให้ทำตาม https://docs.flutter.dev/install/manual#install-flutter +เนื่องจากกระบวนการนี้ต้องใช้ข้อมูลที่ใหม่ล่าสุด + +1. ดาวน์โหลด Flutter (สามารถหาปุ่มดาวน์โหลดได้จากลิงก์ด้านบน) +2. สร้างโฟลเดอร์สำหรับเก็บ Flutter SDK +3. ทำการแตกไฟล์ที่ดาวน์โหลดมา +4. เพิ่ม Flutter เข้าไปยัง PATH ของคุณ (วิธีการขึ้นอยู่กับระบบปฏิบัติการ) +5. ยืนยันความถูกต้องของการติดตั้งของคุณด้วยคำสั่ง `flutter doctor -v` + +=== ข้อมูลเฉพาะแพลตฟอร์ม + +==== Android + +#iiii ในการพัฒนาแอปพลิเคชัน Android โดยใช้เฟรมเวิร์ก Flutter +จำเป็นต้องใช้ส่วนประกอบเครื่องมือพัฒนา Android ดังนี้ + +- Android SDK (API Level 36 ณ เวลาที่พิมพ์) +- Android SDK Build-Tools +- Android SDK Command-line Tools +- Android SDK Platform-Tools +- Android Emulator (ไม่บังคับ) + +โดยแนะนำให้จัดการและติดตั้งเครื่องมือเหล่านี้ผ่าน Android Studio + +#iiii ในการติดตั้ง Android SDK ควรติดตั้ง Android SDK +ล่าสุดถึงแม้ว่าอุปกรณ์ของคุณจะใช้เวอร์ชันที่เก่ากว่านั้น +เพื่อความมั่นใจว่าแอปพลิเคชันจะสามารถใช้กับอุปกรณ์ที่ใหม่ล่าสุดได้ + +#iiii แอปพลิเคชัน Android จะมี SDK/API level เป้าหมาย (Target SDK/API level) และ +SDK/API level ขั้นต่ำ (Minimum SDK/API level) โครงงานนี้ ณ เวลาที่พิมพ์ ใช้ API level +เป้าหมาย 36 (Android 16) และ API level ขั้นต่ำ 24 (Android 7) ซึ่งรวมกันแล้ว +แอปพลิเคชัน#jb Android จะสามารถติดตั้งได้บนระบบตั้งแต่ API level ขั้นต่ำจนถึง API level +เป้าหมาย หรือก็คือ แอปพลิเคชันในโครงงานนี้สามารถติดตั้งได้ตั้งแต่บนระบบ Android 7 ถึง Android 16 +นั่นเอง + +===== Java/Kotlin + +#iiiii Java และ Kotlin เป็นภาษาสำคัญสำหรับการพัฒนาแอปพลิเคชัน Android ถึงอย่างไรก็ตาม +แอปพลิเคชัน Flutter นั้นถูกเขียนด้วยภาษา Dart แต่ยังจำเป็นต้องมีโคด Java และ Kotlin +เล็กน้อยเพื่อเริ่มต้นแอปพลิเคชัน Flutter + +#iiiii โดยปกติแล้ว Flutter จะสร้างโคดพื้นฐานขึ้นมาให้สำหรับการเริ่มแอปพลิเคชันแบบพื้นฐาน +ดังนั้นจึงไม่จำเป็นต้องมีการเขียนโคด Java หรือ Kotlin เอง แต่ในบางกรณี +อาจต้องเขียนโคดเพิ่มเองหากมีความต้องการเข้าถึงฟีเจอร์พื้นฐานระบบที่ Flutter ไม่มี API +เพื่อให้เข้าถึงได้และไม่มีแพคเกจเพื่อรองรับฟีเจอร์ที่ต้องการ + +#iiiii โครงการนี้ใช้ Java 21 (JetBrains Runtime/Azul Zulu OpenJDK) +เป็นหลักในการทำงานกับ Gradle แต่แอปพลิเคชัน Android ที่ผลิตออกมานั้น +เพื่อให้เข้ากับเวอร์ชันที่เก่ากว่าของระบบปฏิบัติการได้ ใช้ Java 11 + +===== Gradle + +#iiiii Gradle เป็นเครื่องมือสร้างระบบอัตโนมัติสำหรับการพัฒนาซอฟต์แวร์หลายภาษา จัดการงานต่าง ๆ +เช่น การคอมไพล์ การแพ็คเกจ การทดสอบ การปรับใช้ และการเผยแพร่ ภาษาที่รองรับ ได้แก่ Java +(รวมถึงภาษา Kotlin, Groovy, Scala ที่ใช้ JDK), C/C++ และ JavaScript Gradle +พัฒนาต่อยอดจากแนวคิดของ Apache Ant และ Apache Maven และนำเสนอภาษาเฉพาะโดเมนที่ใช้ +Groovy และ Kotlin ซึ่งต่างจากการกำหนดค่าโครงการที่ใช้ XML ที่ Maven ใช้ Gradle +ใช้กราฟแบบอะไซคลิกกำกับทิศทางเพื่อจัดการการอ้างอิง กราฟนี้ใช้เพื่อกำหนดลำดับของงานที่ควรดำเนินการ +Gradle ทำงานบน Java Virtual Machine + +#iiiii Gradle คือเครื่องมือหลักที่ใช้ในการจัดการโปรเจกต์ Java ส่วนใหญ่ รวมถึงโปรเจกต์ Android +โดยในโครงการนี้ จะใช้ Gradle เวอร์ชัน 8.14.3 เป็นหลัก + +#iiiii โดยปกติแล้ว ผู้พัฒนานั้นไม่มีความจำเป็นที่จะต้องแตะต้อง Gradle ด้วยตนเอง และ Flutter +จะทำการจัดการเอง แต่หากมีความจำเป็นต้องใช้คำสั่ง Gradle ด้วยตนเอง จะมีสคริปต์ `gradlew` (หรือ +`gradlew.bat` สำหรับผู้ใช้ Windows) ภายในโฟลเดอร์ `android` ของโปรเจกต์ Flutter +เสมอเพื่อเรียกใช้ Gradle ที่ถูกดาวน์โหลดมาสำหรับโปรเจกต์นั้น ๆ + +==== Linux + +#iiii เช่นเดียวกับ Android ที่กล่าวไปข้างต้น Flutter +มีการสร้างโคดสำหรับการเปิดแอปพลิเคชันแบบพื้นฐาน แต่สำหรับ Linux แล้วนั้น Flutter ใช้โคด C++ +และเฟรมเวิร์ก CMake ในการสร้างรากฐานของแอปพลิเคชัน + +#iiii ในการพัฒนาแอปพลิเคชันสำหรับ Linux ต้องติดตั้งโปรแกรมเพิ่มเติม#jb (build dependencies) +ขยายความคือ ด้านบนคือสิ่งที่จำเป็นหากมีระบบอื่นเป็นเป้าหมาย แต่หากต้องการพัฒนาแอปพลิเคชัน Linux +ต้องติดตั้งโปรแกรมในรายการหน้าถัดไปเพิ่ม + +#pagebreak() + +#grid( + columns: 2, + column-gutter: 1in, + [ + - GTK 3 (ไลบรารีสำหรับการพัฒนา) + - pkg-config + - ไลบรารี GNU Standard C++ v3 + ], + [ + - Clang + - CMake + - Ninja + ], +) + +#iiii การติดตั้งไลบรารีและโปรแกรมที่กล่าวไปข้างต้นจะแตกต่างกันไปแต่ละการแจกจ่าย Linux และ +Flutter ใช้ไลบรารีพื้นฐานดังกล่าวในการทำงานของแอปพลิเคชัน (runtime dependencies) + +- GTK 3 +- blkid +- LZMA + +แต่โดยทั่วไปแล้ว ไลบรารีเหล่านี้ควรถูกติดตั้งมาอยู่แล้วหากคุณใช้ graphical desktop ทั่วไป + +===== Debian + +#afigure( + ```sh + # Development dependencies: + sudo apt install curl git unzip xz-utils zip libglu1-mesa + + # Linux build dependencies: + sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev libstdc++-12-dev + + # Runtime dependencies: + sudo apt install libgtk-3-0 libblkid1 liblzma5 + ```, + kind: image, + caption: [คำสั่งในการติดตั้งรายการแพคเกจต่าง ๆ บน Debian], +) + +===== Fedora Linux + +#afigure( + ```sh + # Development dependencies: + sudo dnf install curl git unzip xz zip mesa-libglu + + # Linux build dependencies: + sudo dnf install clang cmake ninja-build pkgconf gtk3 + + # Runtime dependencies: + sudo dnf install gtk3 libblkid xz + ```, + kind: image, + caption: [คำสั่งในการติดตั้งรายการแพคเกจต่าง ๆ บน Fedora Linux], +) + +===== Arch Linux + +#afigure( + ```sh + # Development dependencies: + sudo pacman -S --needed curl git unzip xz zip glu + + # Linux build dependencies: + sudo pacman -S --needed clang cmake ninja pkgconf gtk3 + + # Runtime dependencies: + sudo pacman -S --needed util-linux-libs xz gtk3 + ```, + kind: image, + caption: [คำสั่งในการติดตั้งรายการแพคเกจต่าง ๆ บน Arch Linux], +) + +==== macOS/iOS + +#iiii การพัฒนาแอปพลิเคชันสำหรับ macOS และ iOS นั้นต้องทำบน#jb macOS +เท่านั้นและจำเป็นต้องพึ่งพาเครื่องมือ Xcode แต่เนื่องจากในโครงงานนี้ไม่มีผู้ใช้ macOS +จึงไม่สามารถสร้างไบนารีสำหรับ macOS และ iOS ออกมาได้ และไม่ใช่เป้าหมายของโครงงานนี้เช่นกัน diff --git a/Chapter3/Chapter3.typ b/Chapter3/Chapter3.typ index d9e6b70..c6c4d0e 100644 --- a/Chapter3/Chapter3.typ +++ b/Chapter3/Chapter3.typ @@ -344,260 +344,7 @@ https://gitskette.dailitation.xyz/linesofcodes/liteauth-firmware32 และท #iiii *หมายเหตุ:* โปรดใช้คำสั่งประเภท `pio run` ในโฟลเดอร์ของโปรเจกต์ -=== สร้างไฟล์แอปพลิเคชันด้วยตนเอง - -#iii โครงงานนี้ใช้แอปพลิเคชันที่สร้างขึ้นมาเอง โดยในการพัฒนาแอปพลิเคชัน -อย่างน้อยต้องมีส่วนประกอบดังกล่าวก่อน - -- Flutter -- Git (ซึ่งคุณจะติดตั้งแล้วหากคุณทำตาม@writingFirmware) - -#iii อย่างไรก็ตาม Flutter มีข้อจำกัดว่า มีเพียง Android -เท่านั้นที่ไม่ว่าแพลตฟอร์มไหนก็จะสามารถคอมไพล์ไฟล์ `.apk` ออกมาได้ ดังนั้น -การสร้างแอปพลิเคชันสำหรับ Linux ต้องทำบน Linux เท่านั้น และการสร้างแอปพลิเคชันสำหรับ Windows -ต้องทำบน Windows เท่านั้น - -==== การติดตั้งโปรแกรมเขียนโคด - -#iiiii จริง ๆ แล้วนั้น Flutter สามารถทำงานกับโปรแกรมเขียนโคดใดก็ได้ -แต่มีโปรแกรมเหล่านี้ที่อาจมีประสบการณ์การพัฒนาที่ดีกว่าโปรแกรมอื่น: - -- Visual Studio Code (VS Code) -- Android Studio -- JetBrains IntelliJ -- Firebase Studio - -#iii โครงงานนี้ใช้โปรแกรมเขียนโคด Android Studio เป็นหลักเนื่องจากแอปพลิเคชันโครงงานมี -Android เป็นเป้าหมายหลัก และ Android SDK สามารถจัดการได้ง่ายกว่าใน Android Studio - -#iii การติดตั้ง Flutter สามารถทำได้สองวิธีด้วยกัน คือการติดตั้งผ่าน Visual Studio Code (VS -Code) และการติดตั้งด้วยตนเอง โดยหากต้องการใช้ VS Code เป็นโปรแกรมเขียนโคดอยู่แล้ว -สามารถติดตั้งผ่าน VS Code ได้เลย แต่ก่อนอื่น ต้องทำการติดตั้งโปรแกรมและไลบรารีพื้นฐานที่จำเป็นสำหรับ -Flutter ก่อน - -#pagebreak() - -==== การติดตั้งโปรแกรมและไลบรารีที่จำเป็น - -#[ - #set enum(indent: 9.25em) - + Windows: ติดตั้ง Git สำหรับ Windows ซึ่งคุณสามารถดูขั้นตอนการติดตั้งได้ที่ - https://git-scm.com/install/windows หรือเพียงแค่ใช้คำสั่งด้านล่าง - #afigure( - ```sh - winget install --id Git.Git -e --source winget - ```, - kind: image, - caption: [คำสั่งในการติดตั้ง Git], - ) - + Linux: โปรดดู@flLinuxDetails สำหรับรายละเอียดแพคเกจและคำสั่งที่ต้องใช้สำหรับระบบต่าง ๆ - - + macOS: ใช้คำสั่งต่อไปนี้ในการติดตั้งเครื่องมือ Xcode ต่าง ๆ รวมถึง Git - #afigure( - ```sh - xcode-select --install - ```, - kind: image, - caption: [คำสั่งในการติดตั้งเครื่องมือ Xcode], - ) -] - -==== การติดตั้งผ่าน Visual Studio Code - -#block(inset: (left: 8.25em))[ - #set enum(indent: 1em) - + เปิด VSCode - + ติดตั้งส่วนขยาย Flutter \ - อยู่ภายใต้ ID `Dart-Code.flutter` ทั้งบน Visual Studio Marketplace และ OpenVSX - + ติดตั้ง Flutter ด้วย VS Code - + เปิด Command Palette ด้วยเมนู *View* > *Command Palette* หรือกด Ctrl + Shift + - P - + ใน Command Palette พิมพ์ `flutter`. - + เลือก *Flutter: New Project* - + VS Code จะให้คุณเลือก Flutter SDK บนคอมพิวเตอร์ของคุณ เลือก *Download SDK* - + เมือหน้าไดอะลอก *Select Folder for Flutter SDK* แสดงขึ้น เลือกสถานที่ที่คุณอยากติดตั้ง - Flutter - + คลิก *Clone Flutter* \ - ในระหว่างการดาวน์โหลด VS Code จะแสดงการแจ้งเตือนนี้: - ``` - Downloading the Flutter SDK. This may take a few minutes. - ``` - การดาวน์โหลดนี้จะใช้เวลาสองสามนาที หากคุณเชื่อว่าการดาวน์โหลดหยุดชะงัก คุณสามารถคลิก - *Cancel* แล้วเริ่มต้นการติดตั้งใหม่ได้ - + คลิก *Add SDK to PATH* \ - เมื่อเสร็จสิ้น จะมีการแจ้งเตือน - ``` - The Flutter SDK was added to your PATH - ``` - + VS Code อาจแสดงการแจ้งเตือนเกี่ยวกับการเก็บข้อมูลของ Google หากคุณยินยอม คลิก *OK* - + เพื่อความแน่ใจ กรุณาปิดเทอร์มินัลทุกหน้าต่างหรือรีสตาร์ท VS Code เพื่อให้แน่ใจว่า Flutter - จะสามารถใช้ผ่านเทอร์มินัลได้ - + เมื่อเสร็จสิ้น ใช้คำสั่ง `flutter doctor -v` ในเทอร์มินัลที่คุณเลือกเพื่อตรวจสอบการติดตั้ง - Flutter ของคุณ \ - หากคำสั่งไม่เจอหรือเกิดข้อผิดพลาดขึ้น ตรวจสอบ - https://docs.flutter.dev/install/troubleshoot สำหรับข้อมูลเพิ่มเติม -] - -==== การติดตั้งด้วยตนเอง - -#iiii แนะนำให้ทำตาม https://docs.flutter.dev/install/manual#install-flutter -เนื่องจากกระบวนการนี้ต้องใช้ข้อมูลที่ใหม่ล่าสุด - -1. ดาวน์โหลด Flutter (สามารถหาปุ่มดาวน์โหลดได้จากลิงก์ด้านบน) -2. สร้างโฟลเดอร์สำหรับเก็บ Flutter SDK -3. ทำการแตกไฟล์ที่ดาวน์โหลดมา -4. เพิ่ม Flutter เข้าไปยัง PATH ของคุณ (วิธีการขึ้นอยู่กับระบบปฏิบัติการ) -5. ยืนยันความถูกต้องของการติดตั้งของคุณด้วยคำสั่ง `flutter doctor -v` - -==== ข้อมูลเกี่ยวกับแพลตฟอร์ม - -===== Android - -#iiiii ในการพัฒนาแอปพลิเคชัน Android โดยใช้เฟรมเวิร์ก Flutter -จำเป็นต้องใช้ส่วนประกอบเครื่องมือพัฒนา Android ดังนี้ - -- Android SDK (API Level 36 ณ เวลาที่พิมพ์) -- Android SDK Build-Tools -- Android SDK Command-line Tools -- Android SDK Platform-Tools -- Android Emulator (ไม่บังคับ) - -โดยแนะนำให้จัดการและติดตั้งเครื่องมือเหล่านี้ผ่าน Android Studio - -#iiiii ในการติดตั้ง Android SDK ควรติดตั้ง Android SDK -ล่าสุดถึงแม้ว่าอุปกรณ์ของคุณจะใช้เวอร์ชันที่เก่ากว่านั้น -เพื่อความมั่นใจว่าแอปพลิเคชันจะสามารถใช้กับอุปกรณ์ที่ใหม่ล่าสุดได้ - -#iiiii แอปพลิเคชัน Android จะมี SDK/API level เป้าหมาย (Target SDK/API level) และ -SDK/API level ขั้นต่ำ (Minimum SDK/API level) โครงงานนี้ ณ เวลาที่พิมพ์ ใช้ API level -เป้าหมาย 36 (Android 16) และ API level ขั้นต่ำ 24 (Android 7) ซึ่งรวมกันแล้ว -แอปพลิเคชัน#jb Android จะสามารถติดตั้งได้บนระบบตั้งแต่ API level ขั้นต่ำจนถึง API level -เป้าหมาย หรือก็คือ แอปพลิเคชันในโครงงานนี้สามารถติดตั้งได้ตั้งแต่บนระบบ Android 7 ถึง Android 16 -นั่นเอง - -====== Java/Kotlin - -#iiiiii Java และ Kotlin เป็นภาษาสำคัญสำหรับการพัฒนาแอปพลิเคชัน Android ถึงอย่างไรก็ตาม -แอปพลิเคชัน Flutter นั้นถูกเขียนด้วยภาษา Dart แต่ยังจำเป็นต้องมีโคด Java และ Kotlin -เล็กน้อยเพื่อเริ่มต้นแอปพลิเคชัน Flutter - -#iiiiii โดยปกติแล้ว Flutter จะสร้างโคดพื้นฐานขึ้นมาให้สำหรับการเริ่มแอปพลิเคชันแบบพื้นฐาน -ดังนั้นจึงไม่จำเป็นต้องมีการเขียนโคด Java หรือ Kotlin เอง แต่ในบางกรณี -อาจต้องเขียนโคดเพิ่มเองหากมีความต้องการเข้าถึงฟีเจอร์พื้นฐานระบบที่ Flutter ไม่มี API -เพื่อให้เข้าถึงได้และไม่มีแพคเกจเพื่อรองรับฟีเจอร์ที่ต้องการ - -#iiiiii โครงการนี้ใช้ Java 21 (JetBrains Runtime/Azul Zulu OpenJDK) -เป็นหลักในการทำงานกับ Gradle แต่แอปพลิเคชัน Android ที่ผลิตออกมานั้น -เพื่อให้เข้ากับเวอร์ชันที่เก่ากว่าของระบบปฏิบัติการได้ ใช้ Java 11 - -====== Gradle - -#iiiiii Gradle เป็นเครื่องมือสร้างระบบอัตโนมัติสำหรับการพัฒนาซอฟต์แวร์หลายภาษา จัดการงานต่าง ๆ -เช่น การคอมไพล์ การแพ็คเกจ การทดสอบ การปรับใช้ และการเผยแพร่ ภาษาที่รองรับ ได้แก่ Java -(รวมถึงภาษา Kotlin, Groovy, Scala ที่ใช้ JDK), C/C++ และ JavaScript Gradle -พัฒนาต่อยอดจากแนวคิดของ Apache Ant และ Apache Maven และนำเสนอภาษาเฉพาะโดเมนที่ใช้ -Groovy และ Kotlin ซึ่งต่างจากการกำหนดค่าโครงการที่ใช้ XML ที่ Maven ใช้ Gradle -ใช้กราฟแบบอะไซคลิกกำกับทิศทางเพื่อจัดการการอ้างอิง กราฟนี้ใช้เพื่อกำหนดลำดับของงานที่ควรดำเนินการ -Gradle ทำงานบน Java Virtual Machine - -#iiiiii Gradle คือเครื่องมือหลักที่ใช้ในการจัดการโปรเจกต์ Java ส่วนใหญ่ รวมถึงโปรเจกต์ Android -โดยในโครงการนี้ จะใช้ Gradle เวอร์ชัน 8.14.3 เป็นหลัก - -#iiiiii โดยปกติแล้ว ผู้พัฒนานั้นไม่มีความจำเป็นที่จะต้องแตะต้อง Gradle ด้วยตนเอง และ Flutter -จะทำการจัดการเอง แต่หากมีความจำเป็นต้องใช้คำสั่ง Gradle ด้วยตนเอง จะมีสคริปต์ `gradlew` (หรือ -`gradlew.bat` สำหรับผู้ใช้ Windows) ภายในโฟลเดอร์ `android` ของโปรเจกต์ Flutter -เสมอเพื่อเรียกใช้ Gradle ที่ถูกดาวน์โหลดมาสำหรับโปรเจกต์นั้น ๆ - -===== Linux - -#iiiii เช่นเดียวกับ Android ที่กล่าวไปข้างต้น Flutter -มีการสร้างโคดสำหรับการเปิดแอปพลิเคชันแบบพื้นฐาน แต่สำหรับ Linux แล้วนั้น Flutter ใช้โคด C++ -และเฟรมเวิร์ก CMake ในการสร้างรากฐานของแอปพลิเคชัน - -#iiiii ในการพัฒนาแอปพลิเคชันสำหรับ Linux ต้องติดตั้งโปรแกรมเพิ่มเติม (build dependencies) -ขยายความคือ ด้านบนคือสิ่งที่จำเป็นหากมีระบบอื่นเป็นเป้าหมาย แต่หากต้องการพัฒนาแอปพลิเคชัน Linux -ต้องติดตั้งโปรแกรมในรายการด้านล่างเพิ่ม - -#grid( - columns: 2, - column-gutter: 1in, - [ - - GTK 3 (ไลบรารีสำหรับการพัฒนา) - - pkg-config - - ไลบรารี GNU Standard C++ v3 - ], - [ - - Clang - - CMake - - Ninja - ], -) - -#iiiii การติดตั้งไลบรารีและโปรแกรมที่กล่าวไปข้างต้นจะแตกต่างกันไปแต่ละการแจกจ่าย Linux และ -Flutter ใช้ไลบรารีพื้นฐานดังกล่าวในการทำงานของแอปพลิเคชัน (runtime dependencies) - -- GTK 3 -- blkid -- LZMA - -แต่โดยทั่วไปแล้ว ไลบรารีเหล่านี้ควรถูกติดตั้งมาอยู่แล้วหากคุณใช้ graphical desktop ทั่วไป - -====== Debian - -#afigure( - ```sh - # Development dependencies: - sudo apt install curl git unzip xz-utils zip libglu1-mesa - - # Linux build dependencies: - sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev libstdc++-12-dev - - # Runtime dependencies: - sudo apt install libgtk-3-0 libblkid1 liblzma5 - ```, - kind: image, - caption: [คำสั่งในการติดตั้งรายการแพคเกจต่าง ๆ บน Debian], -) - -====== Fedora Linux - -#afigure( - ```sh - # Development dependencies: - sudo dnf install curl git unzip xz zip mesa-libglu - - # Linux build dependencies: - sudo dnf install clang cmake ninja-build pkgconf gtk3 - - # Runtime dependencies: - sudo dnf install gtk3 libblkid xz - ```, - kind: image, - caption: [คำสั่งในการติดตั้งรายการแพคเกจต่าง ๆ บน Fedora Linux], -) - -====== Arch Linux - -#afigure( - ```sh - # Development dependencies: - sudo pacman -S --needed curl git unzip xz zip glu - - # Linux build dependencies: - sudo pacman -S --needed clang cmake ninja pkgconf gtk3 - - # Runtime dependencies: - sudo pacman -S --needed util-linux-libs xz gtk3 - ```, - kind: image, - caption: [คำสั่งในการติดตั้งรายการแพคเกจต่าง ๆ บน Arch Linux], -) - -===== macOS/iOS - -#iiiii การพัฒนาแอปพลิเคชันสำหรับ macOS และ iOS นั้นต้องทำบน#jb macOS -เท่านั้นและจำเป็นต้องพึ่งพาเครื่องมือ Xcode แต่เนื่องจากในโครงงานนี้ไม่มีผู้ใช้ macOS -จึงไม่สามารถสร้างไบนารีสำหรับ macOS และ iOS ออกมาได้ และไม่ใช่เป้าหมายของโครงงานนี้เช่นกัน +#include "BuildApp.typ" == การทดสอบ diff --git a/Chapter3/imgs/IMG_20251226_140332784.jpg b/Chapter3/imgs/IMG_20251226_140332784.jpg new file mode 100644 index 0000000..43aa09b Binary files /dev/null and b/Chapter3/imgs/IMG_20251226_140332784.jpg differ diff --git a/ปก.typ b/Cover.typ similarity index 96% rename from ปก.typ rename to Cover.typ index 642a897..e8e3d65 100644 --- a/ปก.typ +++ b/Cover.typ @@ -3,7 +3,7 @@ set page( paper: "a4", margin: ( - top: 1.5in, + top: 4cm, left: 1.5in, right: 1in, bottom: 1in, @@ -29,15 +29,15 @@ "assets/nktc.jpg", width: 4cm, alt: "วิทยาลัยเทคนิคหนองคาย", -) +)\ เครื่องยืนยันตัวตนด้วย NFC -#v(8em) +#v(1fr) #grid( columns: 2, - align: (right, left), + align: left, column-gutter: 1em, row-gutter: 0.75em, "ประภากร", "ศรีวรสาร", @@ -45,7 +45,7 @@ "ศตคุณ", "อุตมะ", ) -#v(10em) +#v(1fr) โครงงานนี้เป็นส่วนหนึ่งของ วิชาโครงงานรหัสวิชา 21909-2023 \ ตามหลักสูตรประกาศนียบัตรวิชาชีพ พุทธศักราช 2567 \ diff --git a/History.typ b/History.typ index 4e0537f..bed0fdf 100644 --- a/History.typ +++ b/History.typ @@ -1,3 +1,6 @@ +#import "PageTemplate.typ": * +#show: page-theme + = ประวัติย่อผู้จัดทำ #place(right, box(stroke: (thickness: 1pt), width: 0.8in, height: 1in)) @@ -7,11 +10,11 @@ row-gutter: 1em, column-gutter: 2em, [ชื่อ], [นางสาวประภากร ศรีวรสาร], - [เกิด], [วันที่ 2 ตุลาคม พ.ศ.255x], + [เกิด], [วันที่ 2 ตุลาคม พ.ศ.2551], [ที่อยู่], [ - บ้านเลขที่ ก หมู่ที่ ข ตำบล ค\ - อำเภอ ง จังหวัด หนองคาย + บ้านเลขที่ 192 หมู่ที่ 15 ตำบล ในเมือง\ + อำเภอ เมืองหนองคาย จังหวัด หนองคาย ], ) @@ -21,8 +24,8 @@ columns: 3, row-gutter: 1em, column-gutter: 2em, - [พ.ศ.25xx], [ป.6], [โรงเรียน x], - [พ.ศ.25xx], [ม.3], [โรงเรียน y], + [พ.ศ.2564], [ป.6], [โรงเรียน อนุบาลหนองคาย], + [พ.ศ.2567], [ม.3], [โรงเรียน ปทุมเทพวิทยาคาร], [พ.ศ.2569], [ปวช.], [สาขาวิชาช่างเทคนิคคอมพิวเตอร์ วิทยาลัยเทคนิคหนองคาย], ) diff --git a/PageTemplate.typ b/PageTemplate.typ index 35c6a02..8a74aaf 100644 --- a/PageTemplate.typ +++ b/PageTemplate.typ @@ -66,7 +66,11 @@ ) set list(indent: 1em) show raw.where(block: false): set text(font: "Laksaman", size: 10.5pt) - show raw.where(block: true): set block(fill: rgb("#282A36"), inset: 1.5em) + show raw.where(block: true): set block( + fill: rgb("#282A36"), + stroke: black + 2pt, + inset: 1.5em, + ) show raw.where(block: true): set raw(theme: "Dracula.tmTheme") show raw.where(block: true): set text( fill: rgb("#F8F8F2"), @@ -77,6 +81,8 @@ show heading: set block(below: 1em) show heading.where(level: 1): set text(size: 12pt, weight: "bold") show heading.where(level: 1): set align(center) + show heading.where(level: 1): set block(below: 2em) + show heading.where(level: 2): set block(above: 2em) show heading.where(level: 2): set text(weight: "bold") show heading: it => { if it.level > 2 { @@ -90,6 +96,66 @@ } show math.equation: set text(font: "Laksaman") show table.cell.where(y: 0): strong + show image: it => { + block(stroke: black + 2pt, it) + } + show figure.where(kind: "i-figured-table"): set align(start) + show figure.where(kind: table): set figure.caption(position: top) + show figure.caption: it => { + text(weight: "bold")[ + #it.supplement + #it.counter.display(it.numbering) + ] + it.body + } + show figure.caption.where(position: bottom): it => place(center, it, dy: 2em) + set figure.caption(separator: "") + // show figure.where(kind: image): set figure(gap: 2em) + show figure.where(kind: image): set block(below: 2.5em) + set enum(number-align: start + top) + set ref(supplement: "หัวข้อ") + doc +} + +#let fake-h1(body) = { + align(center, text(body, weight: "bold", size: 12pt)) +} + +#let sane-theme(doc) = { + set page( + paper: "a4", + margin: ( + top: 1.5in, + left: 1.5in, + right: 1in, + bottom: 1in, + ), + header: context [ + #h(1fr) + #counter(page).display(thai-numbering) + ], + ) + set text( + lang: "th", + font: "Laksaman", + size: 10.5pt, + ) + set par( + justify: true, + justification-limits: ( + tracking: (min: -1pt, max: 3pt), + ), + leading: 1em, + ) + set list(indent: 1em) + show raw: set text(font: "Cascadia Code") + show heading: set text(size: 10.5pt) + show heading: set block(below: 1em) + show heading.where(level: 1): set text(size: 12pt, weight: "bold") + show heading.where(level: 1): set align(center) + show heading.where(level: 2): set text(weight: "bold") + show math.equation: set text(font: "Laksaman") + show table.cell.where(y: 0): strong show figure.caption: it => { text(weight: "bold")[ #it.supplement diff --git a/References.yaml b/References.yaml index 079d66f..962f9b8 100644 --- a/References.yaml +++ b/References.yaml @@ -91,12 +91,12 @@ wkTls: wkC: type: Web title: C (programming language) - date: 2025-11-26 + date: 2026-1-3 language: en publisher: มูลนิธิวิกิมีเดีย (ภายใต้ CC BY-SA 4.0) url: - date: 2025-11-30 - value: https://en.wikipedia.org/w/index.php?title=C_(programming_language)&oldid=1324211766 + date: 2026-1-5 + value: https://en.wikipedia.org/w/index.php?title=C_(programming_language)&oldid=1330924334 wkGcc: type: Web diff --git a/main.typ b/main.typ index 0e270da..3527245 100644 --- a/main.typ +++ b/main.typ @@ -9,93 +9,123 @@ ), ) -#include "ปก.typ" - -#counter(page).update(1) -#show: page-theme -#include "Abstract.typ" -#pagebreak() -#include "Acknowledgements.typ" -#pagebreak() - -#show outline: set heading(outlined: true) -#show outline.entry: it => { - show linebreak: [ ] - link( - it.element.location(), - it.indented(it.prefix(), context [ - #it.body() - #box(width: 1fr, repeat[.]) - #context thai-numbering(counter(page).at(it.element.location()).first()) - ]), +#[ + #show raw.where(block: false): set text(font: "Laksaman", size: 10.5pt) + #show raw.where(block: true): set block(fill: rgb("#282A36"), inset: 1.5em) + #show raw.where(block: true): set raw(theme: "Dracula.tmTheme") + #show raw.where(block: true): set text( + fill: rgb("#F8F8F2"), + font: "Cascadia Code", + size: 10pt, ) -} -#outline(depth: 2, indent: 3.75em) + #include "Cover.typ" -#pagebreak() + #counter(page).update(1) + #show: page-theme + #include "Abstract.typ" + #pagebreak() + #include "Acknowledgements.typ" + #pagebreak() -#import "@preview/i-figured:0.2.4" + #show outline: set heading(outlined: true) + #show outline.entry: it => { + show linebreak: [ ] + link( + it.element.location(), + grid( + columns: 3, + column-gutter: 1fr, + it.indented(it.prefix(), it.body()), + h(1em), + context thai-numbering(counter(page).at(it.element.location()).first()), + ), + ) + } -#i-figured.outline(target-kind: table, title: [สารบัญตาราง]) + #[ + #set page(header: none) + #show outline.entry: it => { + it -#pagebreak() + context { + let outline-pages = counter(page).at(it.location()).first() + let current-page = counter(page).get().first() -#i-figured.outline( - title: [สารบัญภาพ], -) - -#show heading: i-figured.reset-counters -#show figure: i-figured.show-figure - -#include "Chapter1.typ" -#include "Chapter2/Chapter2.typ" -#include "Chapter3/Chapter3.typ" -#include "Chapter4.typ" -#include "Chapter5.typ" - -#bibliography( - "References.yaml", - title: "บรรณานุกรม", - full: true, - style: "nong-khai-technical-college-project-guidelines.csl", -) - -#pagebreak() - -= บรรณานุกรมภาพ - -#let image-credits() = context { - let figures = query(figure.where(kind: "i-figured-image")) - let attributions = query() - let offset = 0 - - for (idx, f) in figures.enumerate() { - if idx >= attributions.len() { - return + if current-page > outline-pages { + fake-h1("สารบัญ (ต่อ)") + v(1em) + } + } } + #outline(depth: 2, indent: 3.75em) + ] - if attributions.at(idx).body.body == [] { - offset += 1 - if idx + offset >= attributions.len() { + #pagebreak() + + #import "@preview/i-figured:0.2.4" + + #i-figured.outline(target-kind: table, title: [สารบัญตาราง]) + + #pagebreak() + + #i-figured.outline( + title: [สารบัญภาพ], + ) + + #show heading: i-figured.reset-counters + #show figure: i-figured.show-figure + + #include "Chapter1.typ" + #include "Chapter2/Chapter2.typ" + #include "Chapter3/Chapter3.typ" + #include "Chapter4.typ" + #include "Chapter5.typ" + + #bibliography( + "References.yaml", + title: "บรรณานุกรม", + full: true, + style: "nong-khai-technical-college-project-guidelines.csl", + ) + + #pagebreak() + + = บรรณานุกรมภาพ + + #let image-credits() = context { + let figures = query(figure.where(kind: "i-figured-image")) + let attributions = query() + let offset = 0 + + for (idx, f) in figures.enumerate() { + if idx >= attributions.len() { return } - if attributions.at(idx + offset).body.body == [] { - continue + if attributions.at(idx).body.body == [] { + offset += 1 + + if idx + offset >= attributions.len() { + return + } + + if attributions.at(idx + offset).body.body == [] { + continue + } } + + f.caption + linebreak() + h(2.2em) + attributions.at(idx + offset).body.body + linebreak() } - - f.caption - linebreak() - h(2.2em) - attributions.at(idx + offset).body.body - linebreak() } -} -#image-credits() + #image-credits() +] #include "ภาคผนวก/ภาคผนวก.typ" #include "History.typ" diff --git a/ภาคผนวก/gpl-3.0.typ b/ภาคผนวก/gpl-3.0.typ index cdf5cb2..62fc04f 100644 --- a/ภาคผนวก/gpl-3.0.typ +++ b/ภาคผนวก/gpl-3.0.typ @@ -1,3 +1,5 @@ +#import "../PageTemplate.typ": sane-theme +#show: sane-theme #set heading(offset: 1) #set enum(numbering: "a)") @@ -8,71 +10,67 @@ Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. #link("https://fsf.org/") -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. == Preamble -The GNU General Public License is a free, copyleft license for software -and other kinds of works. +The GNU General Public License is a free, copyleft license for software and +other kinds of works. -The licenses for most software and other practical works are designed to -take away your freedom to share and change the works. By contrast, the -GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program–to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. +The licenses for most software and other practical works are designed to take +away your freedom to share and change the works. By contrast, the GNU General +Public License is intended to guarantee your freedom to share and change all +versions of a program–to make sure it remains free software for all its users. +We, the Free Software Foundation, use the GNU General Public License for most of +our software; it applies also to any other work released this way by its +authors. You can apply it to your programs, too. -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for them if -you wish), that you receive source code or can get it if you want it, -that you can change the software or use pieces of it in new free -programs, and that you know you can do these things. +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for them if you wish), that you +receive source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs, and that you know you can do +these things. -To protect your rights, we need to prevent others from denying you these -rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. +To protect your rights, we need to prevent others from denying you these rights +or asking you to surrender the rights. Therefore, you have certain +responsibilities if you distribute copies of the software, or if you modify it: +responsibilities to respect the freedom of others. -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must pass on to the recipients the same freedoms that -you received. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must pass on to the recipients the same freedoms that you received. You +must make sure that they, too, receive or can get the source code. And you must +show them these terms so they know their rights. -Developers that use the GNU GPL protect your rights with two steps: (1) -assert copyright on the software, and (2) offer you this License giving -you legal permission to copy, distribute and/or modify it. +Developers that use the GNU GPL protect your rights with two steps: (1) assert +copyright on the software, and (2) offer you this License giving you legal +permission to copy, distribute and/or modify it. -For the developers’ and authors’ protection, the GPL clearly explains -that there is no warranty for this free software. For both users’ and -authors’ sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. +For the developers’ and authors’ protection, the GPL clearly explains that there +is no warranty for this free software. For both users’ and authors’ sake, the +GPL requires that modified versions be marked as changed, so that their problems +will not be attributed erroneously to authors of previous versions. -Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of protecting -users’ freedom to change the software. The systematic pattern of such -abuse occurs in the area of products for individuals to use, which is -precisely where it is most unacceptable. Therefore, we have designed -this version of the GPL to prohibit the practice for those products. If -such problems arise substantially in other domains, we stand ready to -extend this provision to those domains in future versions of the GPL, as -needed to protect the freedom of users. +Some devices are designed to deny users access to install or run modified +versions of the software inside them, although the manufacturer can do so. This +is fundamentally incompatible with the aim of protecting users’ freedom to +change the software. The systematic pattern of such abuse occurs in the area of +products for individuals to use, which is precisely where it is most +unacceptable. Therefore, we have designed this version of the GPL to prohibit +the practice for those products. If such problems arise substantially in other +domains, we stand ready to extend this provision to those domains in future +versions of the GPL, as needed to protect the freedom of users. -Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. +Finally, every program is threatened constantly by software patents. States +should not allow patents to restrict development and use of software on +general-purpose computers, but in those that do, we wish to avoid the special +danger that patents applied to a free program could make it effectively +proprietary. To prevent this, the GPL assures that patents cannot be used to +render the program non-free. -The precise terms and conditions for copying, distribution and -modification follow. +The precise terms and conditions for copying, distribution and modification +follow. == TERMS AND CONDITIONS @@ -80,549 +78,501 @@ modification follow. "This License" refers to version 3 of the GNU General Public License. -"Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. +"Copyright" also means copyright-like laws that apply to other kinds of works, +such as semiconductor masks. -"The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. +"The Program" refers to any copyrightable work licensed under this License. Each +licensee is addressed as "you". "Licensees" and "recipients" may be individuals +or organizations. -To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. +To "modify" a work means to copy from or adapt all or part of the work in a +fashion requiring copyright permission, other than the making of an exact copy. +The resulting work is called a "modified version" of the earlier work or a work +"based on" the earlier work. -A "covered work" means either the unmodified Program or a work based on -the Program. +A "covered work" means either the unmodified Program or a work based on the +Program. -To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. +To "propagate" a work means to do anything with it that, without permission, +would make you directly or secondarily liable for infringement under applicable +copyright law, except executing it on a computer or modifying a private copy. +Propagation includes copying, distribution (with or without modification), +making available to the public, and in some countries other activities as well. -To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. +To "convey" a work means any kind of propagation that enables other parties to +make or receive copies. Mere interaction with a user through a computer network, +with no transfer of a copy, is not conveying. -An interactive user interface displays "Appropriate Legal Notices" to -the extent that it includes a convenient and prominently visible feature -that (1) displays an appropriate copyright notice, and (2) tells the -user that there is no warranty for the work (except to the extent that -warranties are provided), that licensees may convey the work under this -License, and how to view a copy of this License. If the interface -presents a list of user commands or options, such as a menu, a prominent -item in the list meets this criterion. +An interactive user interface displays "Appropriate Legal Notices" to the extent +that it includes a convenient and prominently visible feature that (1) displays +an appropriate copyright notice, and (2) tells the user that there is no +warranty for the work (except to the extent that warranties are provided), that +licensees may convey the work under this License, and how to view a copy of this +License. If the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. === 1. Source Code. -The "source code" for a work means the preferred form of the work for -making modifications to it. "Object code" means any non-source form of a -work. +The "source code" for a work means the preferred form of the work for making +modifications to it. "Object code" means any non-source form of a work. -A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that is -widely used among developers working in that language. +A "Standard Interface" means an interface that either is an official standard +defined by a recognized standards body, or, in the case of interfaces specified +for a particular programming language, one that is widely used among developers +working in that language. -The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that Major -Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A "Major -Component", in this context, means a major essential component (kernel, -window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, -or an object code interpreter used to run it. +The "System Libraries" of an executable work include anything, other than the +work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only to +enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code +form. A "Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on +which the executable work runs, or a compiler used to produce the work, or an +object code interpreter used to run it. -The "Corresponding Source" for a work in object code form means all the -source code needed to generate, install, and (for an executable work) -run the object code and to modify the work, including scripts to control -those activities. However, it does not include the work’s System -Libraries, or general-purpose tools or generally available free programs -which are used unmodified in performing those activities but which are -not part of the work. For example, Corresponding Source includes -interface definition files associated with source files for the work, -and the source code for shared libraries and dynamically linked -subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms -and other parts of the work. +The "Corresponding Source" for a work in object code form means all the source +code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. +However, it does not include the work’s System Libraries, or general-purpose +tools or generally available free programs which are used unmodified in +performing those activities but which are not part of the work. For example, +Corresponding Source includes interface definition files associated with source +files for the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, such as by +intimate data communication or control flow between those subprograms and other +parts of the work. -The Corresponding Source need not include anything that users can -regenerate automatically from other parts of the Corresponding Source. +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. -The Corresponding Source for a work in source code form is that same -work. +The Corresponding Source for a work in source code form is that same work. === 2. Basic Permissions. -All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. +All rights granted under this License are granted for the term of copyright on +the Program, and are irrevocable provided the stated conditions are met. This +License explicitly affirms your unlimited permission to run the unmodified +Program. The output from running a covered work is covered by this License only +if the output, given its content, constitutes a covered work. This License +acknowledges your rights of fair use or other equivalent, as provided by +copyright law. -You may make, run and propagate covered works that you do not convey, -without conditions so long as your license otherwise remains in force. -You may convey covered works to others for the sole purpose of having -them make modifications exclusively for you, or provide you with -facilities for running those works, provided that you comply with the -terms of this License in conveying all material for which you do not -control copyright. Those thus making or running the covered works for -you must do so exclusively on your behalf, under your direction and -control, on terms that prohibit them from making any copies of your -copyrighted material outside their relationship with you. +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey +covered works to others for the sole purpose of having them make modifications +exclusively for you, or provide you with facilities for running those works, +provided that you comply with the terms of this License in conveying all +material for which you do not control copyright. Those thus making or running +the covered works for you must do so exclusively on your behalf, under your +direction and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes -it unnecessary. +Conveying under any other circumstances is permitted solely under the conditions +stated below. Sublicensing is not allowed; section 10 makes it unnecessary. === 3. Protecting Users’ Legal Rights From Anti-Circumvention Law. -No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article 11 -of the WIPO copyright treaty adopted on 20 December 1996, or similar -laws prohibiting or restricting circumvention of such measures. +No covered work shall be deemed part of an effective technological measure under +any applicable law fulfilling obligations under article 11 of the WIPO copyright +treaty adopted on 20 December 1996, or similar laws prohibiting or restricting +circumvention of such measures. When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to the -covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work’s -users, your or third parties’ legal rights to forbid circumvention of -technological measures. +circumvention of technological measures to the extent such circumvention is +effected by exercising rights under this License with respect to the covered +work, and you disclaim any intention to limit operation or modification of the +work as a means of enforcing, against the work’s users, your or third parties’ +legal rights to forbid circumvention of technological measures. === 4. Conveying Verbatim Copies. -You may convey verbatim copies of the Program’s source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; keep -intact all notices stating that this License and any non-permissive -terms added in accord with section 7 apply to the code; keep intact all -notices of the absence of any warranty; and give all recipients a copy -of this License along with the Program. +You may convey verbatim copies of the Program’s source code as you receive it, +in any medium, provided that you conspicuously and appropriately publish on each +copy an appropriate copyright notice; keep intact all notices stating that this +License and any non-permissive terms added in accord with section 7 apply to the +code; keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. -You may charge any price or no price for each copy that you convey, and -you may offer support or warranty protection for a fee. +You may charge any price or no price for each copy that you convey, and you may +offer support or warranty protection for a fee. === 5. Conveying Modified Source Versions. -You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the terms -of section 4, provided that you also meet all of these conditions: +You may convey a work based on the Program, or the modifications to produce it +from the Program, in the form of source code under the terms of section 4, +provided that you also meet all of these conditions: -+ The work must carry prominent notices stating that you modified it, - and giving a relevant date. -+ The work must carry prominent notices stating that it is released - under this License and any conditions added under section 7. This - requirement modifies the requirement in section 4 to "keep intact - all notices". -+ You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will - therefore apply, along with any applicable section 7 additional - terms, to the whole of the work, and all its parts, regardless of - how they are packaged. This License gives no permission to license - the work in any other way, but it does not invalidate such - permission if you have separately received it. -+ If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work - need not make them do so. ++ The work must carry prominent notices stating that you modified it, and giving + a relevant date. ++ The work must carry prominent notices stating that it is released under this + License and any conditions added under section 7. This requirement modifies + the requirement in section 4 to "keep intact all notices". ++ You must license the entire work, as a whole, under this License to anyone who + comes into possession of a copy. This License will therefore apply, along with + any applicable section 7 additional terms, to the whole of the work, and all + its parts, regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not invalidate + such permission if you have separately received it. ++ If the work has interactive user interfaces, each must display Appropriate + Legal Notices; however, if the Program has interactive interfaces that do not + display Appropriate Legal Notices, your work need not make them do so. -A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, and -which are not combined with it such as to form a larger program, in or -on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not used -to limit the access or legal rights of the compilation’s users beyond -what the individual works permit. Inclusion of a covered work in an -aggregate does not cause this License to apply to the other parts of the -aggregate. +A compilation of a covered work with other separate and independent works, which +are not by their nature extensions of the covered work, and which are not +combined with it such as to form a larger program, in or on a volume of a +storage or distribution medium, is called an "aggregate" if the compilation and +its resulting copyright are not used to limit the access or legal rights of the +compilation’s users beyond what the individual works permit. Inclusion of a +covered work in an aggregate does not cause this License to apply to the other +parts of the aggregate. === 6. Conveying Non-Source Forms. -You may convey a covered work in object code form under the terms of -sections 4 and 5, provided that you also convey the machine-readable -Corresponding Source under the terms of this License, in one of these -ways: +You may convey a covered work in object code form under the terms of sections 4 +and 5, provided that you also convey the machine-readable Corresponding Source +under the terms of this License, in one of these ways: -+ Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium customarily - used for software interchange. -+ Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a written - offer, valid for at least three years and valid for as long as you - offer spare parts or customer support for that product model, to - give anyone who possesses the object code either (1) a copy of the - Corresponding Source for all the software in the product that is - covered by this License, on a durable physical medium customarily - used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, - or (2) access to copy the Corresponding Source from a network server - at no charge. -+ Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This alternative - is allowed only occasionally and noncommercially, and only if you - received the object code with such an offer, in accord with - subsection 6b. -+ Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) that - supports equivalent copying facilities, provided you maintain clear - directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. -+ Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of - the work are being offered to the general public at no charge under - subsection 6d. ++ Convey the object code in, or embodied in, a physical product (including a + physical distribution medium), accompanied by the Corresponding Source fixed + on a durable physical medium customarily used for software interchange. ++ Convey the object code in, or embodied in, a physical product (including a + physical distribution medium), accompanied by a written offer, valid for at + least three years and valid for as long as you offer spare parts or customer + support for that product model, to give anyone who possesses the object code + either (1) a copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical medium + customarily used for software interchange, for a price no more than your + reasonable cost of physically performing this conveying of source, or (2) + access to copy the Corresponding Source from a network server at no charge. ++ Convey individual copies of the object code with a copy of the written offer + to provide the Corresponding Source. This alternative is allowed only + occasionally and noncommercially, and only if you received the object code + with such an offer, in accord with subsection 6b. ++ Convey the object code by offering access from a designated place (gratis or + for a charge), and offer equivalent access to the Corresponding Source in the + same way through the same place at no further charge. You need not require + recipients to copy the Corresponding Source along with the object code. If the + place to copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) that supports + equivalent copying facilities, provided you maintain clear directions next to + the object code saying where to find the Corresponding Source. Regardless of + what server hosts the Corresponding Source, you remain obligated to ensure + that it is available for as long as needed to satisfy these requirements. ++ Convey the object code using peer-to-peer transmission, provided you inform + other peers where the object code and Corresponding Source of the work are + being offered to the general public at no charge under subsection 6d. -A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be included -in conveying the object code work. +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. -A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for -incorporation into a dwelling. In determining whether a product is a -consumer product, doubtful cases shall be resolved in favor of coverage. -For a particular product received by a particular user, "normally used" -refers to a typical or common use of that class of product, regardless -of the status of the particular user or of the way in which the -particular user actually uses, or expects or is expected to use, the -product. A product is a consumer product regardless of whether the -product has substantial commercial, industrial or non-consumer uses, -unless such uses represent the only significant mode of use of the -product. +A "User Product" is either (1) a "consumer product", which means any tangible +personal property which is normally used for personal, family, or household +purposes, or (2) anything designed or sold for incorporation into a dwelling. In +determining whether a product is a consumer product, doubtful cases shall be +resolved in favor of coverage. For a particular product received by a particular +user, "normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way in which +the particular user actually uses, or expects or is expected to use, the +product. A product is a consumer product regardless of whether the product has +substantial commercial, industrial or non-consumer uses, unless such uses +represent the only significant mode of use of the product. -"Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product -from a modified version of its Corresponding Source. The information -must suffice to ensure that the continued functioning of the modified -object code is in no case prevented or interfered with solely because -modification has been made. +"Installation Information" for a User Product means any methods, procedures, +authorization keys, or other information required to install and execute +modified versions of a covered work in that User Product from a modified version +of its Corresponding Source. The information must suffice to ensure that the +continued functioning of the modified object code is in no case prevented or +interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied by -the Installation Information. But this requirement does not apply if -neither you nor any third party retains the ability to install modified -object code on the User Product (for example, the work has been -installed in ROM). +specifically for use in, a User Product, and the conveying occurs as part of a +transaction in which the right of possession and use of the User Product is +transferred to the recipient in perpetuity or for a fixed term (regardless of +how the transaction is characterized), the Corresponding Source conveyed under +this section must be accompanied by the Installation Information. But this +requirement does not apply if neither you nor any third party retains the +ability to install modified object code on the User Product (for example, the +work has been installed in ROM). The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. +requirement to continue to provide support service, warranty, or updates for a +work that has been modified or installed by the recipient, or for the User +Product in which it has been modified or installed. Access to a network may be +denied when the modification itself materially and adversely affects the +operation of the network or violates the rules and protocols for communication +across the network. -Corresponding Source conveyed, and Installation Information provided, in -accord with this section must be in a format that is publicly documented -(and with an implementation available to the public in source code -form), and must require no special password or key for unpacking, -reading or copying. +Corresponding Source conveyed, and Installation Information provided, in accord +with this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require no +special password or key for unpacking, reading or copying. === 7. Additional Terms. -"Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by this -License without regard to the additional permissions. +"Additional permissions" are terms that supplement the terms of this License by +making exceptions from one or more of its conditions. Additional permissions +that are applicable to the entire Program shall be treated as though they were +included in this License, to the extent that they are valid under applicable +law. If additional permissions apply only to part of the Program, that part may +be used separately under those permissions, but the entire Program remains +governed by this License without regard to the additional permissions. -When you convey a copy of a covered work, you may at your option remove -any additional permissions from that copy, or from any part of it. -(Additional permissions may be written to require their own removal in -certain cases when you modify the work.) You may place additional -permissions on material, added by you to a covered work, for which you -have or can give appropriate copyright permission. +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when +you modify the work.) You may place additional permissions on material, added by +you to a covered work, for which you have or can give appropriate copyright +permission. -Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders -of that material) supplement the terms of this License with terms: +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: -+ Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or -+ Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or -+ Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or -+ Limiting the use for publicity purposes of names of licensors or - authors of the material; or -+ Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -+ Requiring indemnification of licensors and authors of that material - by anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any - liability that these contractual assumptions directly impose on - those licensors and authors. ++ Disclaiming warranty or limiting liability differently from the terms of + sections 15 and 16 of this License; or ++ Requiring preservation of specified reasonable legal notices or author + attributions in that material or in the Appropriate Legal Notices displayed by + works containing it; or ++ Prohibiting misrepresentation of the origin of that material, or requiring + that modified versions of such material be marked in reasonable ways as + different from the original version; or ++ Limiting the use for publicity purposes of names of licensors or authors of + the material; or ++ Declining to grant rights under trademark law for use of some trade names, + trademarks, or service marks; or ++ Requiring indemnification of licensors and authors of that material by anyone + who conveys the material (or modified versions of it) with contractual + assumptions of liability to the recipient, for any liability that these + contractual assumptions directly impose on those licensors and authors. -All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains a -further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms of -that license document, provided that the further restriction does not -survive such relicensing or conveying. +All other non-permissive additional terms are considered "further restrictions" +within the meaning of section 10. If the Program as you received it, or any part +of it, contains a notice stating that it is governed by this License along with +a term that is a further restriction, you may remove that term. If a license +document contains a further restriction but permits relicensing or conveying +under this License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does not survive +such relicensing or conveying. -If you add terms to a covered work in accord with this section, you must -place, in the relevant source files, a statement of the additional terms -that apply to those files, or a notice indicating where to find the -applicable terms. +If you add terms to a covered work in accord with this section, you must place, +in the relevant source files, a statement of the additional terms that apply to +those files, or a notice indicating where to find the applicable terms. -Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; the above -requirements apply either way. +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements +apply either way. === 8. Termination. -You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). +You may not propagate or modify a covered work except as expressly provided +under this License. Any attempt otherwise to propagate or modify it is void, and +will automatically terminate your rights under this License (including any +patent licenses granted under the third paragraph of section 11). -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally terminates -your license, and (b) permanently, if the copyright holder fails to -notify you of the violation by some reasonable means prior to 60 days -after the cessation. +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated (a) provisionally, unless and until +the copyright holder explicitly and finally terminates your license, and (b) +permanently, if the copyright holder fails to notify you of the violation by +some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by -some reasonable means, this is the first time you have received notice -of violation of this License (for any work) from that copyright holder, -and you cure the violation prior to 30 days after your receipt of the -notice. +permanently if the copyright holder notifies you of the violation by some +reasonable means, this is the first time you have received notice of violation +of this License (for any work) from that copyright holder, and you cure the +violation prior to 30 days after your receipt of the notice. -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. +Termination of your rights under this section does not terminate the licenses of +parties who have received copies or rights from you under this License. If your +rights have been terminated and not permanently reinstated, you do not qualify +to receive new licenses for the same material under section 10. === 9. Acceptance Not Required for Having Copies. -You are not required to accept this License in order to receive or run a -copy of the Program. Ancillary propagation of a covered work occurring -solely as a consequence of using peer-to-peer transmission to receive a -copy likewise does not require acceptance. However, nothing other than -this License grants you permission to propagate or modify any covered -work. These actions infringe copyright if you do not accept this -License. Therefore, by modifying or propagating a covered work, you -indicate your acceptance of this License to do so. +You are not required to accept this License in order to receive or run a copy of +the Program. Ancillary propagation of a covered work occurring solely as a +consequence of using peer-to-peer transmission to receive a copy likewise does +not require acceptance. However, nothing other than this License grants you +permission to propagate or modify any covered work. These actions infringe +copyright if you do not accept this License. Therefore, by modifying or +propagating a covered work, you indicate your acceptance of this License to do +so. === 10. Automatic Licensing of Downstream Recipients. -Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. +Each time you convey a covered work, the recipient automatically receives a +license from the original licensors, to run, modify and propagate that work, +subject to this License. You are not responsible for enforcing compliance by +third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who -receives a copy of the work also receives whatever licenses to the work -the party’s predecessor in interest had or could give under the previous -paragraph, plus a right to possession of the Corresponding Source of the -work from the predecessor in interest, if the predecessor has it or can -get it with reasonable efforts. +organization, or merging organizations. If propagation of a covered work results +from an entity transaction, each party to that transaction who receives a copy +of the work also receives whatever licenses to the work the party’s predecessor +in interest had or could give under the previous paragraph, plus a right to +possession of the Corresponding Source of the work from the predecessor in +interest, if the predecessor has it or can get it with reasonable efforts. -You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may not -impose a license fee, royalty, or other charge for exercise of rights -granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that any -patent claim is infringed by making, using, selling, offering for sale, -or importing the Program or any portion of it. +You may not impose any further restrictions on the exercise of the rights +granted or affirmed under this License. For example, you may not impose a +license fee, royalty, or other charge for exercise of rights granted under this +License, and you may not initiate litigation (including a cross-claim or +counterclaim in a lawsuit) alleging that any patent claim is infringed by +making, using, selling, offering for sale, or importing the Program or any +portion of it. === 11. Patents. -A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The work -thus licensed is called the contributor’s "contributor version". +A "contributor" is a copyright holder who authorizes use under this License of +the Program or a work on which the Program is based. The work thus licensed is +called the contributor’s "contributor version". A contributor’s "essential patent claims" are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter -acquired, that would be infringed by some manner, permitted by this -License, of making, using, or selling its contributor version, but do -not include claims that would be infringed only as a consequence of -further modification of the contributor version. For purposes of this -definition, "control" includes the right to grant patent sublicenses in -a manner consistent with the requirements of this License. +controlled by the contributor, whether already acquired or hereafter acquired, +that would be infringed by some manner, permitted by this License, of making, +using, or selling its contributor version, but do not include claims that would +be infringed only as a consequence of further modification of the contributor +version. For purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. -Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor’s essential patent claims, to make, -use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. +Each contributor grants you a non-exclusive, worldwide, royalty-free patent +license under the contributor’s essential patent claims, to make, use, sell, +offer for sale, import and otherwise run, modify and propagate the contents of +its contributor version. -In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. +In the following three paragraphs, a "patent license" is any express agreement +or commitment, however denominated, not to enforce a patent (such as an express +permission to practice a patent or covenant not to sue for patent infringement). +To "grant" such a patent license to a party means to make such an agreement or +commitment not to enforce a patent against the party. -If you convey a covered work, knowingly relying on a patent license, and -the Corresponding Source of the work is not available for anyone to -copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient’s use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of +charge and under the terms of this License, through a publicly available network +server or other readily accessible means, then you must either (1) cause the +Corresponding Source to be so available, or (2) arrange to deprive yourself of +the benefit of the patent license for this particular work, or (3) arrange, in a +manner consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have actual +knowledge that, but for the patent license, your conveying the covered work in a +country, or your recipient’s use of the covered work in a country, would +infringe one or more identifiable patents in that country that you have reason +to believe are valid. -If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify or -convey a specific copy of the covered work, then the patent license you -grant is automatically extended to all recipients of the covered work -and works based on it. +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a +patent license to some of the parties receiving the covered work authorizing +them to use, propagate, modify or convey a specific copy of the covered work, +then the patent license you grant is automatically extended to all recipients of +the covered work and works based on it. -A patent license is "discriminatory" if it does not include within the -scope of its coverage, prohibits the exercise of, or is conditioned on -the non-exercise of one or more of the rights that are specifically -granted under this License. You may not convey a covered work if you are -a party to an arrangement with a third party that is in the business of -distributing software, under which you make payment to the third party -based on the extent of your activity of conveying the work, and under -which the third party grants, to any of the parties who would receive -the covered work from you, a discriminatory patent license (a) in -connection with copies of the covered work conveyed by you (or copies -made from those copies), or (b) primarily for and in connection with -specific products or compilations that contain the covered work, unless -you entered into that arrangement, or that patent license was granted, -prior to 28 March 2007. +A patent license is "discriminatory" if it does not include within the scope of +its coverage, prohibits the exercise of, or is conditioned on the non-exercise +of one or more of the rights that are specifically granted under this License. +You may not convey a covered work if you are a party to an arrangement with a +third party that is in the business of distributing software, under which you +make payment to the third party based on the extent of your activity of +conveying the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by you (or +copies made from those copies), or (b) primarily for and in connection with +specific products or compilations that contain the covered work, unless you +entered into that arrangement, or that patent license was granted, prior to 28 +March 2007. -Nothing in this License shall be construed as excluding or limiting any -implied license or other defenses to infringement that may otherwise be -available to you under applicable patent law. +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to you +under applicable patent law. === 12. No Surrender of Others’ Freedom. If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not convey it at all. For example, if you agree to terms that -obligate you to collect a royalty for further conveying from those to -whom you convey the Program, the only way you could satisfy both those -terms and this License would be to refrain entirely from conveying the -Program. +otherwise) that contradict the conditions of this License, they do not excuse +you from the conditions of this License. If you cannot convey a covered work so +as to satisfy simultaneously your obligations under this License and any other +pertinent obligations, then as a consequence you may not convey it at all. For +example, if you agree to terms that obligate you to collect a royalty for +further conveying from those to whom you convey the Program, the only way you +could satisfy both those terms and this License would be to refrain entirely +from conveying the Program. === 13. Use with the GNU Affero General Public License. -Notwithstanding any other provision of this License, you have permission -to link or combine any covered work with a work licensed under version 3 -of the GNU Affero General Public License into a single combined work, -and to convey the resulting work. The terms of this License will -continue to apply to the part which is the covered work, but the special -requirements of the GNU Affero General Public License, section 13, -concerning interaction through a network will apply to the combination -as such. +Notwithstanding any other provision of this License, you have permission to link +or combine any covered work with a work licensed under version 3 of the GNU +Affero General Public License into a single combined work, and to convey the +resulting work. The terms of this License will continue to apply to the part +which is the covered work, but the special requirements of the GNU Affero +General Public License, section 13, concerning interaction through a network +will apply to the combination as such. === 14. Revised Versions of this License. -The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. -Each version is given a distinguishing version number. If the Program -specifies that a certain numbered version of the GNU General Public -License "or any later version" applies to it, you have the option of -following the terms and conditions either of that numbered version or of -any later version published by the Free Software Foundation. If the -Program does not specify a version number of the GNU General Public -License, you may choose any version ever published by the Free Software -Foundation. +Each version is given a distinguishing version number. If the Program specifies +that a certain numbered version of the GNU General Public License "or any later +version" applies to it, you have the option of following the terms and +conditions either of that numbered version or of any later version published by +the Free Software Foundation. If the Program does not specify a version number +of the GNU General Public License, you may choose any version ever published by +the Free Software Foundation. -If the Program specifies that a proxy can decide which future versions -of the GNU General Public License can be used, that proxy’s public -statement of acceptance of a version permanently authorizes you to -choose that version for the Program. +If the Program specifies that a proxy can decide which future versions of the +GNU General Public License can be used, that proxy’s public statement of +acceptance of a version permanently authorizes you to choose that version for +the Program. Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or -copyright holder as a result of your choosing to follow a later version. +However, no additional obligations are imposed on any author or copyright holder +as a result of your choosing to follow a later version. === 15. Disclaimer of Warranty. -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT -WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF -THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER +PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. === 16. Limitation of Liability. -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR -CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT -NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES -SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE -WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE +THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE +PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY +HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. === 17. Interpretation of Sections 15 and 16. -If the disclaimer of warranty and limitation of liability provided above -cannot be given local legal effect according to their terms, reviewing -courts shall apply local law that most closely approximates an absolute -waiver of all civil liability in connection with the Program, unless a -warranty or assumption of liability accompanies a copy of the Program in -return for a fee. +If the disclaimer of warranty and limitation of liability provided above cannot +be given local legal effect according to their terms, reviewing courts shall +apply local law that most closely approximates an absolute waiver of all civil +liability in connection with the Program, unless a warranty or assumption of +liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS == How to Apply These Terms to Your New Programs -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. +If you develop a new program, and you want it to be of the greatest possible use +to the public, the best way to achieve this is to make it free software which +everyone can redistribute and change under these terms. -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively state -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively state the exclusion of +warranty; and each file should have at least the "copyright" line and a pointer +to where the full notice is found. ``` @@ -644,8 +594,8 @@ the exclusion of warranty; and each file should have at least the Also add information on how to contact you by electronic and paper mail. -If the program does terminal interaction, make it output a short notice -like this when it starts in an interactive mode: +If the program does terminal interaction, make it output a short notice like +this when it starts in an interactive mode: ``` Copyright (C) @@ -654,19 +604,20 @@ like this when it starts in an interactive mode: under certain conditions; type `show c' for details. ``` -The hypothetical commands \`show w’ and \`show c’ should show the -appropriate parts of the General Public License. Of course, your -program’s commands might be different; for a GUI interface, you would -use an "about box". +The hypothetical commands \`show w’ and \`show c’ should show the appropriate +parts of the General Public License. Of course, your program’s commands might be +different; for a GUI interface, you would use an "about box". -You should also get your employer (if you work as a programmer) or -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. For more information on this, and how to apply and follow the -GNU GPL, see #link("https://www.gnu.org/licenses/");. +You should also get your employer (if you work as a programmer) or school, if +any, to sign a "copyright disclaimer" for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see #link( + "https://www.gnu.org/licenses/", +);. -The GNU General Public License does not permit incorporating your -program into proprietary programs. If your program is a subroutine -library, you may consider it more useful to permit linking proprietary -applications with the library. If this is what you want to do, use the -GNU Lesser General Public License instead of this License. But first, -please read #link("https://www.gnu.org/licenses/why-not-lgpl.html");. +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider +it more useful to permit linking proprietary applications with the library. If +this is what you want to do, use the GNU Lesser General Public License instead +of this License. But first, please read #link( + "https://www.gnu.org/licenses/why-not-lgpl.html", +);. diff --git a/ภาคผนวก/ภาคผนวก.typ b/ภาคผนวก/ภาคผนวก.typ index db5af63..d74a3bd 100644 --- a/ภาคผนวก/ภาคผนวก.typ +++ b/ภาคผนวก/ภาคผนวก.typ @@ -1,39 +1,49 @@ #import "../PageTemplate.typ": * -#show: page-theme -= ภาคผนวก +#[ + #show: page-theme + = ภาคผนวก -== ลิขสิทธิ์เนื้อหาโครงงาน + == ลิขสิทธิ์เนื้อหาโครงงาน -#i #sym.copyright พ.ศ. 2568 งานนี้อยู่ภายใต้สัญญาอนุญาต Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) หากต้องการดูรายละเอียดเพิ่มเติมเกี่ยวกับสัญญาอนุญาตนี้ โปรดไปที่ https://creativecommons.org/licenses/by-sa/4.0/ + #i #sym.copyright พ.ศ. 2568 งานนี้อยู่ภายใต้สัญญาอนุญาต Creative Commons + Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) + หากต้องการดูรายละเอียดเพิ่มเติมเกี่ยวกับสัญญาอนุญาตนี้ โปรดไปที่ + https://creativecommons.org/licenses/by-sa/4.0/ -#i นอกจากที่กล่าวถึงในบรรณานุกรมภาพแล้ว หนังสือโครงงานนี้มีการใช้ไอคอนจาก Visual Studio Code (จาก GitHub repository `microsoft/vscode-codicons`) เวอร์ชัน 0.0.43 และไอคอนจากปลั๊กอิน Dart ใน Visual Studio Code (`Dart-Code/Dart-Code`) เวอร์ชัน 3.124.0 ซึ่งทั้งคู่อยู่ภายใต้ MIT license + #i นอกจากที่กล่าวถึงในบรรณานุกรมภาพแล้ว หนังสือโครงงานนี้มีการใช้ไอคอนจาก Visual Studio + Code (จาก GitHub repository `microsoft/vscode-codicons`) เวอร์ชัน 0.0.43 + และไอคอนจากปลั๊กอิน Dart ใน Visual Studio Code (`Dart-Code/Dart-Code`) เวอร์ชัน + 3.124.0 ซึ่งทั้งคู่อยู่ภายใต้ MIT license -== ลิขสิทธิ์ซอร์สโคดโครงงาน + == ลิขสิทธิ์ซอร์สโคดโครงงาน -#i เนื่องจากโคดในโครงการนี้เป็นสาธารณะและถูกปกป้องด้วยกฎหมายลิขสิทธิ์ -โคดนี้จึงมาพร้อมกับสัญญาอนุญาตในการใช้งานโคดสาธารณะทั่วไปของ GNU (GNU Public License) เวอร์ชัน 3 + #i เนื่องจากโคดในโครงการนี้เป็นสาธารณะและถูกปกป้องด้วยกฎหมายลิขสิทธิ์ + โคดนี้จึงมาพร้อมกับสัญญาอนุญาตในการใช้งานโคดสาธารณะทั่วไปของ GNU (GNU Public License) + เวอร์ชัน 3 -#i โดยสรุปแล้ว สัญญาอนุญาตนี้มีคุณสมบัติดังนี้ (ไม่ใช่คำแนะนำทางกฎหมาย -โปรดอ่านเนื้อหาสัญญาเต็มเพื่อรายละเอียดที่ชัดเจน) + #i โดยสรุปแล้ว สัญญาอนุญาตนี้มีคุณสมบัติดังนี้ (ไม่ใช่คำแนะนำทางกฎหมาย + โปรดอ่านเนื้อหาสัญญาเต็มเพื่อรายละเอียดที่ชัดเจน) -การอนุญาต: -- อนุญาตการใช้เนื้อหาที่ติดลิขสิทธิ์ในเชิงพาณิชย์ -- อนุญาตให้สามารถเผยแพร่เนื้อหาที่ติดลิขสิทธ์ได้ -- อนุญาตให้ดัดแปลงเนื้อหาที่ติดลิขสิทธิ์ได้ -- ใบอนุญาตนี้ให้สิทธิ์ในการจดสิทธิบัตรจากผู้สนับสนุน -- อนุญาตให้ใช้และดัดแปลงเนื้อหาที่ติดลิขสิทธิ์อย่างเป็นส่วนตัวได้ + การอนุญาต: + - อนุญาตการใช้เนื้อหาที่ติดลิขสิทธิ์ในเชิงพาณิชย์ + - อนุญาตให้สามารถเผยแพร่เนื้อหาที่ติดลิขสิทธ์ได้ + - อนุญาตให้ดัดแปลงเนื้อหาที่ติดลิขสิทธิ์ได้ + - ใบอนุญาตนี้ให้สิทธิ์ในการจดสิทธิบัตรจากผู้สนับสนุน + - อนุญาตให้ใช้และดัดแปลงเนื้อหาที่ติดลิขสิทธิ์อย่างเป็นส่วนตัวได้ -โดยมีเงื่อนไขว่า: -- โคดต้องถูกเปิดเผยหากเนื้อหาที่ติดลิขสิทธิ์ถูกแจกจ่าย -- สัญญาอนุญาตต้องถูกรวมกับเนื้อหาที่ติดลิขสิทธิ์ที่ถูกเผยแพร่ -- การแก้ไขเนื้อหาที่ติดลิขสิทธิ์จะต้องอยู่ภายใต้สัญญาอนุญาตเดียวกัน -- หากมีการแก้ไขเนื้อหาที่ติดลิขสัทธิ์ ต้องมีหมายเหตุชัดเจนว่างานนั้นถูกแก้ไขจากงานต้นฉบับ + โดยมีเงื่อนไขว่า: + - โคดต้องถูกเปิดเผยหากเนื้อหาที่ติดลิขสิทธิ์ถูกแจกจ่าย + - สัญญาอนุญาตต้องถูกรวมกับเนื้อหาที่ติดลิขสิทธิ์ที่ถูกเผยแพร่ + - การแก้ไขเนื้อหาที่ติดลิขสิทธิ์จะต้องอยู่ภายใต้สัญญาอนุญาตเดียวกัน + - หากมีการแก้ไขเนื้อหาที่ติดลิขสัทธิ์ ต้องมีหมายเหตุชัดเจนว่างานนั้นถูกแก้ไขจากงานต้นฉบับ -และมีข้อจำกัดว่า: -- ผู้ที่เป็นเจ้าของงานไม่มีความรับผิดชอบใด ๆ ทั้งสิ้นหากเกิดความเสียหายต่อการใช้หรือใช้ไม่ได้ของโปรแกรม -- โปรแกรมไม่มีการรับประกันใด ๆ ทั้งสิ้น + และมีข้อจำกัดว่า: + - ผู้ที่เป็นเจ้าของงานไม่มีความรับผิดชอบใด ๆ + ทั้งสิ้นหากเกิดความเสียหายต่อการใช้หรือใช้ไม่ได้ของโปรแกรม + - โปรแกรมไม่มีการรับประกันใด ๆ ทั้งสิ้น -สัญญาอนุญาตแบบเต็มที่ถูกบังคับใช้กับโคดในโครงงานนี้มีดังนี้ + สัญญาอนุญาตแบบเต็มที่ถูกบังคับใช้กับโคดในโครงงานนี้มีดังนี้ +] #include "gpl-3.0.typ"