internalヘッダに関数説明コメントを追加

libptouch_internal.h の内部関数宣言に用途と戻り値の簡潔な説明を付け、実装読解時の確認コストを下げる。

Made-with: Cursor
This commit is contained in:
knb
2026-04-16 13:54:36 +09:00
parent 28a0c73f6a
commit d683bf983a

View File

@@ -25,13 +25,18 @@ struct libptouch_ctx {
uint16_t usb_pid; /* 0 if USB not open; used to pick 128- vs 560-dot raster */ uint16_t usb_pid; /* 0 if USB not open; used to pick 128- vs 560-dot raster */
}; };
/* ctx に最終エラー(コードとメッセージ)を記録する。公開 API のエラー返却前に使う。 */
void ptouch_set_error(libptouch_ctx *ctx, libptouch_err_t code, const char *msg); void ptouch_set_error(libptouch_ctx *ctx, libptouch_err_t code, const char *msg);
/* libusb のエラー番号を人が読めるメッセージにして ptouch_set_error に渡す。 */
void ptouch_set_error_usb(libptouch_ctx *ctx, int libusb_err, const char *what); void ptouch_set_error_usb(libptouch_ctx *ctx, int libusb_err, const char *what);
/* bulk OUT 転送。成功時 0、失敗時 libusb の負のエラーコード。 */
int ptouch_bulk_out(libusb_device_handle *h, uint8_t ep, const uint8_t *data, int ptouch_bulk_out(libusb_device_handle *h, uint8_t ep, const uint8_t *data,
int len, unsigned int timeout_ms); int len, unsigned int timeout_ms);
/* bulk IN で len バイトを揃えるまで読む。成功時 0、失敗時 libusb の負のエラーコード。 */
int ptouch_bulk_in_exact(libusb_device_handle *h, uint8_t ep, uint8_t *buf, int ptouch_bulk_in_exact(libusb_device_handle *h, uint8_t ep, uint8_t *buf,
int len, unsigned int timeout_ms); int len, unsigned int timeout_ms);
/* ctx の bulk OUT エンドポイントへ buf を送る。印刷ジョブのチャンク送信用。 */
libptouch_err_t ptouch_bulk_send_job(libptouch_ctx *ctx, const uint8_t *buf, libptouch_err_t ptouch_bulk_send_job(libptouch_ctx *ctx, const uint8_t *buf,
size_t len, const char *what); size_t len, const char *what);