hlp:桂林国际齿轮泵代码

This commit is contained in:
kite_lucs
2026-10-09 10:25:24 +08:00
commit fd606b3c81
2447 changed files with 999531 additions and 0 deletions
@@ -0,0 +1,182 @@
/*
* codabar.c -- encoding for Codabar
*
* Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "barcode.h"
/* this is ordered in decades to simplify encoding */
static char alphabet[] =
"0123456789" "-$:/.+ABCD";
#define CODE_A 16
#define CODE_B 17
#define NARROW 12
#define WIDE 14
/* Patterns */
static char *patterns[] = {
"1111133","1111331","1113113","3311111","1131131",
"3111131","1311113","1311311","1331111","3113111",
"1113311","1133111","3111313","3131113","3131311",
"1131313","1133131","1313113","1113133","1113331" };
/*
* Check that the text can be encoded. Returns 0 or -1.
* If it's all lowecase convert to uppercase and accept it.
* If the first character is a letter (A to D), the last one must be too;
* no other character should be a letter.
*/
int Barcode_cbr_verify(unsigned char *text)
{
int i, lower=0, upper=0;
int startpresent = 0;
if (!strlen(text))
return -1;
for (i=0; text[i]; i++) {
char * pos;
if (isupper(text[i])) upper++;
if (islower(text[i])) lower++;
pos = strchr(alphabet,toupper(text[i]));
if (!pos)
return -1;
if (i == 0 && pos - alphabet >= CODE_A)
startpresent = 1;
else if (pos - alphabet >= CODE_A &&
(!startpresent || i != strlen(text) - 1))
return -1;
}
if (lower && upper)
return -1;
return 0;
}
static int add_one(char *ptr, int code)
{
sprintf(ptr,"1%s", /* separator */ patterns[code]);
return 0;
}
/*
* The encoding functions fills the "partial" and "textinfo" fields.
* Lowercase chars are converted to uppercase
*/
int Barcode_cbr_encode(struct Barcode_Item *bc)
{
static char *text;
static char *partial; /* dynamic */
static char *textinfo; /* dynamic */
char *c, *ptr, *textptr;
int i, code, textpos, usesum, checksum = 0, startpresent;
if (bc->partial)
free(bc->partial);
if (bc->textinfo)
free(bc->textinfo);
bc->partial = bc->textinfo = NULL; /* safe */
if (!bc->encoding)
bc->encoding = strdup("codabar");
text = bc->ascii;
if (!text) {
bc->error = EINVAL;
return -1;
}
/* the partial code is 8 * (head + text + check + tail) + margin + term. */
partial = malloc( (strlen(text) + 3) * 8 + 2);
if (!partial) {
bc->error = errno;
return -1;
}
/* the text information is at most "nnn:fff:c " * (strlen + check) +term */
textinfo = malloc(10*(strlen(text) + 1) + 2);
if (!textinfo) {
bc->error = errno;
free(partial);
return -1;
}
ptr = partial;
textptr = textinfo;
textpos = 0;
usesum = bc->flags & BARCODE_NO_CHECKSUM ? 0 : 1;
/* if no start character specified, A is used as a start character */
if (!isalpha(text[0])) {
add_one(ptr, CODE_A);
ptr += strlen(ptr);
textpos = WIDE;
checksum = CODE_A;
startpresent = 0;
} else {
startpresent = 1;
}
for (i=0; i<strlen(text); i++) {
c = strchr(alphabet, toupper(text[i]));
if (!c) {
bc->error = EINVAL; /* impossible if text is verified */
free(partial);
free(textinfo);
return -1;
}
code = c - alphabet;
add_one(ptr, code);
sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i]));
textpos += code < 12 ? NARROW : WIDE;
textptr += strlen(textptr);
ptr += strlen(ptr);
checksum += code;
if (startpresent && usesum && i == strlen(text) - 2) {
/* stuff a check symbol before the stop */
c = strchr(alphabet, toupper(text[i+1]));
if (!c) /* impossible */
continue;
code = c - alphabet;
checksum += code;
/* Complement to a multiple of 16 */
checksum = (checksum + 15) / 16 * 16 - checksum;
add_one(ptr, checksum);
ptr += strlen(ptr);
}
}
if (!startpresent) {
if (usesum) {
/* if no start character specified, B is used as a stop char */
checksum += CODE_B;
checksum = (checksum + 15) / 16 * 16 - checksum;
add_one(ptr, checksum);
ptr += strlen(ptr);
}
add_one(ptr, CODE_B);
}
bc->partial = partial;
bc->textinfo = textinfo;
return 0;
}
@@ -0,0 +1,251 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogFontSize</class>
<widget class="QDialog" name="DialogFontSize">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>309</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>110</x>
<y>260</y>
<width>291</width>
<height>41</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>17</x>
<y>10</y>
<width>401</width>
<height>185</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>12</number>
</property>
<item row="3" column="0">
<widget class="QRadioButton" name="radioButton9HoriL">
<property name="text">
<string>9点(左横)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton16Point">
<property name="text">
<string>16点(中/英)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton7HoriL">
<property name="text">
<string>7点(左横)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="radioButton7Point">
<property name="text">
<string>7点(英)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="radioButton5Point">
<property name="text">
<string>5点(英)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QRadioButton" name="radioButton9HoriR">
<property name="text">
<string>9点(右横)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="radioButton12Point">
<property name="text">
<string>12点(中/英)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radioButton9Point">
<property name="text">
<string>9点(中/英)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QRadioButton" name="radioButton7HoriR">
<property name="text">
<string>7点(右横)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="radioButton24Point">
<property name="text">
<string>24点(中/英)</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QRadioButton" name="radioButton7Bangla">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>7点(孟加拉)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QRadioButton" name="radioButton32Point">
<property name="text">
<string>32点</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QRadioButton" name="radioButton7PointNum">
<property name="text">
<string>7点(rf7)</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QRadioButton" name="radioButton21PointNum">
<property name="text">
<string>21点(rf21)</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QRadioButton" name="radioButton12NewRoman">
<property name="text">
<string>12点(新罗马)</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>40</x>
<y>210</y>
<width>321</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>123456890ABCDEFGWXYZ</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="labFontInfo">
<property name="geometry">
<rect>
<x>70</x>
<y>250</y>
<width>311</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>30</x>
<y>270</y>
<width>89</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>查字库标识</string>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogFontSize</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogFontSize</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB