Rizin
unix-like reverse engineering framework and cli tools
yxml.h File Reference
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Classes

struct  yxml_t
 

Enumerations

enum  yxml_ret_t {
  YXML_EEOF = -5 , YXML_EREF = -4 , YXML_ECLOSE = -3 , YXML_ESTACK = -2 ,
  YXML_ESYN = -1 , YXML_OK = 0 , YXML_ELEMSTART = 1 , YXML_CONTENT = 2 ,
  YXML_ELEMEND = 3 , YXML_ATTRSTART = 4 , YXML_ATTRVAL = 5 , YXML_ATTREND = 6 ,
  YXML_PISTART = 7 , YXML_PICONTENT = 8 , YXML_PIEND = 9
}
 

Functions

void yxml_init (yxml_t *, void *, size_t)
 
yxml_ret_t yxml_parse (yxml_t *, int)
 
yxml_ret_t yxml_eof (yxml_t *)
 
static size_t yxml_symlen (yxml_t *x, const char *s)
 

Enumeration Type Documentation

◆ yxml_ret_t

enum yxml_ret_t
Enumerator
YXML_EEOF 
YXML_EREF 
YXML_ECLOSE 
YXML_ESTACK 
YXML_ESYN 
YXML_OK 
YXML_ELEMSTART 
YXML_CONTENT 
YXML_ELEMEND 
YXML_ATTRSTART 
YXML_ATTRVAL 
YXML_ATTREND 
YXML_PISTART 
YXML_PICONTENT 
YXML_PIEND 

Definition at line 39 of file yxml.h.

39  {
40  YXML_EEOF = -5, /* Unexpected EOF */
41  YXML_EREF = -4, /* Invalid character or entity reference (&whatever;) */
42  YXML_ECLOSE = -3, /* Close tag does not match open tag (<Tag> .. </OtherTag>) */
43  YXML_ESTACK = -2, /* Stack overflow (too deeply nested tags or too long element/attribute name) */
44  YXML_ESYN = -1, /* Syntax error (unexpected byte) */
45  YXML_OK = 0, /* Character consumed, no new token present */
46  YXML_ELEMSTART = 1, /* Start of an element: '<Tag ..' */
47  YXML_CONTENT = 2, /* Element content */
48  YXML_ELEMEND = 3, /* End of an element: '.. />' or '</Tag>' */
49  YXML_ATTRSTART = 4, /* Attribute: 'Name=..' */
50  YXML_ATTRVAL = 5, /* Attribute value */
51  YXML_ATTREND = 6, /* End of attribute '.."' */
52  YXML_PISTART = 7, /* Start of a processing instruction */
53  YXML_PICONTENT = 8, /* Content of a PI */
54  YXML_PIEND = 9 /* End of a processing instruction */
55 } yxml_ret_t;
yxml_ret_t
Definition: yxml.h:39
@ YXML_PICONTENT
Definition: yxml.h:53
@ YXML_ATTREND
Definition: yxml.h:51
@ YXML_ATTRVAL
Definition: yxml.h:50
@ YXML_ESTACK
Definition: yxml.h:43
@ YXML_PIEND
Definition: yxml.h:54
@ YXML_EREF
Definition: yxml.h:41
@ YXML_ESYN
Definition: yxml.h:44
@ YXML_ATTRSTART
Definition: yxml.h:49
@ YXML_ELEMSTART
Definition: yxml.h:46
@ YXML_EEOF
Definition: yxml.h:40
@ YXML_PISTART
Definition: yxml.h:52
@ YXML_ELEMEND
Definition: yxml.h:48
@ YXML_OK
Definition: yxml.h:45
@ YXML_CONTENT
Definition: yxml.h:47
@ YXML_ECLOSE
Definition: yxml.h:42

Function Documentation

◆ yxml_eof()

yxml_ret_t yxml_eof ( yxml_t x)

Definition at line 1056 of file yxml.c.

1056  {
1057  if(x->state != YXMLS_misc3)
1058  return YXML_EEOF;
1059  return YXML_OK;
1060 }
int x
Definition: mipsasm.c:20
@ YXMLS_misc3
Definition: yxml.c:76

References x, YXML_EEOF, YXML_OK, and YXMLS_misc3.

Referenced by rz_cf_value_dict_parse().

◆ yxml_init()

void yxml_init ( yxml_t x,
void *  stack,
size_t  stacksize 
)

Definition at line 327 of file yxml.c.

327  {
328  memset(x, 0, sizeof(*x));
329  x->line = 1;
330  x->stack = (unsigned char*)stack;
331  x->stacksize = stacksize;
332  *x->stack = 0;
333  x->elem = x->pi = x->attr = (char *)x->stack;
334  x->state = YXMLS_init;
335 }
return memset(p, 0, total)
Definition: z80asm.h:140
@ YXMLS_init
Definition: yxml.c:64

References memset(), x, and YXMLS_init.

Referenced by rz_cf_value_dict_parse().

◆ yxml_parse()

yxml_ret_t yxml_parse ( yxml_t x,
int  _ch 
)

Definition at line 338 of file yxml.c.

338  {
339  /* Ensure that characters are in the range of 0..255 rather than -126..125.
340  * All character comparisons are done with positive integers. */
341  unsigned ch = (unsigned)(_ch+256) & 0xff;
342  if(!ch)
343  return YXML_ESYN;
344  x->total++;
345 
346  /* End-of-Line normalization, "\rX", "\r\n" and "\n" are recognized and
347  * normalized to a single '\n' as per XML 1.0 section 2.11. XML 1.1 adds
348  * some non-ASCII character sequences to this list, but we can only handle
349  * ASCII here without making assumptions about the input encoding. */
350  if(x->ignore == ch) {
351  x->ignore = 0;
352  return YXML_OK;
353  }
354  x->ignore = (ch == 0xd) * 0xa;
355  if(ch == 0xa || ch == 0xd) {
356  ch = 0xa;
357  x->line++;
358  x->byte = 0;
359  }
360  x->byte++;
361 
362  switch((yxml_state_t)x->state) {
363  case YXMLS_string:
364  if(ch == *x->string) {
365  x->string++;
366  if(!*x->string)
367  x->state = x->nextstate;
368  return YXML_OK;
369  }
370  break;
371  case YXMLS_attr0:
372  if(yxml_isName(ch))
373  return yxml_attrname(x, ch);
374  if(yxml_isSP(ch)) {
375  x->state = YXMLS_attr1;
376  return yxml_attrnameend(x, ch);
377  }
378  if(ch == (unsigned char)'=') {
379  x->state = YXMLS_attr2;
380  return yxml_attrnameend(x, ch);
381  }
382  break;
383  case YXMLS_attr1:
384  if(yxml_isSP(ch))
385  return YXML_OK;
386  if(ch == (unsigned char)'=') {
387  x->state = YXMLS_attr2;
388  return YXML_OK;
389  }
390  break;
391  case YXMLS_attr2:
392  if(yxml_isSP(ch))
393  return YXML_OK;
394  if(ch == (unsigned char)'\'' || ch == (unsigned char)'"') {
395  x->state = YXMLS_attr3;
396  x->quote = ch;
397  return YXML_OK;
398  }
399  break;
400  case YXMLS_attr3:
401  if(yxml_isAttValue(ch))
402  return yxml_dataattr(x, ch);
403  if(ch == (unsigned char)'&') {
404  x->state = YXMLS_attr4;
405  return yxml_refstart(x, ch);
406  }
407  if(x->quote == ch) {
408  x->state = YXMLS_elem2;
409  return yxml_attrvalend(x, ch);
410  }
411  break;
412  case YXMLS_attr4:
413  if(yxml_isRef(ch))
414  return yxml_ref(x, ch);
415  if(ch == (unsigned char)'\x3b') {
416  x->state = YXMLS_attr3;
417  return yxml_refattrval(x, ch);
418  }
419  break;
420  case YXMLS_cd0:
421  if(ch == (unsigned char)']') {
422  x->state = YXMLS_cd1;
423  return YXML_OK;
424  }
425  if(yxml_isChar(ch))
426  return yxml_datacontent(x, ch);
427  break;
428  case YXMLS_cd1:
429  if(ch == (unsigned char)']') {
430  x->state = YXMLS_cd2;
431  return YXML_OK;
432  }
433  if(yxml_isChar(ch)) {
434  x->state = YXMLS_cd0;
435  return yxml_datacd1(x, ch);
436  }
437  break;
438  case YXMLS_cd2:
439  if(ch == (unsigned char)']')
440  return yxml_datacontent(x, ch);
441  if(ch == (unsigned char)'>') {
442  x->state = YXMLS_misc2;
443  return YXML_OK;
444  }
445  if(yxml_isChar(ch)) {
446  x->state = YXMLS_cd0;
447  return yxml_datacd2(x, ch);
448  }
449  break;
450  case YXMLS_comment0:
451  if(ch == (unsigned char)'-') {
452  x->state = YXMLS_comment1;
453  return YXML_OK;
454  }
455  break;
456  case YXMLS_comment1:
457  if(ch == (unsigned char)'-') {
458  x->state = YXMLS_comment2;
459  return YXML_OK;
460  }
461  break;
462  case YXMLS_comment2:
463  if(ch == (unsigned char)'-') {
464  x->state = YXMLS_comment3;
465  return YXML_OK;
466  }
467  if(yxml_isChar(ch))
468  return YXML_OK;
469  break;
470  case YXMLS_comment3:
471  if(ch == (unsigned char)'-') {
472  x->state = YXMLS_comment4;
473  return YXML_OK;
474  }
475  if(yxml_isChar(ch)) {
476  x->state = YXMLS_comment2;
477  return YXML_OK;
478  }
479  break;
480  case YXMLS_comment4:
481  if(ch == (unsigned char)'>') {
482  x->state = x->nextstate;
483  return YXML_OK;
484  }
485  break;
486  case YXMLS_dt0:
487  if(ch == (unsigned char)'>') {
488  x->state = YXMLS_misc1;
489  return YXML_OK;
490  }
491  if(ch == (unsigned char)'\'' || ch == (unsigned char)'"') {
492  x->state = YXMLS_dt1;
493  x->quote = ch;
494  x->nextstate = YXMLS_dt0;
495  return YXML_OK;
496  }
497  if(ch == (unsigned char)'<') {
498  x->state = YXMLS_dt2;
499  return YXML_OK;
500  }
501  if(yxml_isChar(ch))
502  return YXML_OK;
503  break;
504  case YXMLS_dt1:
505  if(x->quote == ch) {
506  x->state = x->nextstate;
507  return YXML_OK;
508  }
509  if(yxml_isChar(ch))
510  return YXML_OK;
511  break;
512  case YXMLS_dt2:
513  if(ch == (unsigned char)'?') {
514  x->state = YXMLS_pi0;
515  x->nextstate = YXMLS_dt0;
516  return YXML_OK;
517  }
518  if(ch == (unsigned char)'!') {
519  x->state = YXMLS_dt3;
520  return YXML_OK;
521  }
522  break;
523  case YXMLS_dt3:
524  if(ch == (unsigned char)'-') {
525  x->state = YXMLS_comment1;
526  x->nextstate = YXMLS_dt0;
527  return YXML_OK;
528  }
529  if(yxml_isChar(ch)) {
530  x->state = YXMLS_dt4;
531  return YXML_OK;
532  }
533  break;
534  case YXMLS_dt4:
535  if(ch == (unsigned char)'\'' || ch == (unsigned char)'"') {
536  x->state = YXMLS_dt1;
537  x->quote = ch;
538  x->nextstate = YXMLS_dt4;
539  return YXML_OK;
540  }
541  if(ch == (unsigned char)'>') {
542  x->state = YXMLS_dt0;
543  return YXML_OK;
544  }
545  if(yxml_isChar(ch))
546  return YXML_OK;
547  break;
548  case YXMLS_elem0:
549  if(yxml_isName(ch))
550  return yxml_elemname(x, ch);
551  if(yxml_isSP(ch)) {
552  x->state = YXMLS_elem1;
553  return yxml_elemnameend(x, ch);
554  }
555  if(ch == (unsigned char)'/') {
556  x->state = YXMLS_elem3;
557  return yxml_elemnameend(x, ch);
558  }
559  if(ch == (unsigned char)'>') {
560  x->state = YXMLS_misc2;
561  return yxml_elemnameend(x, ch);
562  }
563  break;
564  case YXMLS_elem1:
565  if(yxml_isSP(ch))
566  return YXML_OK;
567  if(ch == (unsigned char)'/') {
568  x->state = YXMLS_elem3;
569  return YXML_OK;
570  }
571  if(ch == (unsigned char)'>') {
572  x->state = YXMLS_misc2;
573  return YXML_OK;
574  }
575  if(yxml_isNameStart(ch)) {
576  x->state = YXMLS_attr0;
577  return yxml_attrstart(x, ch);
578  }
579  break;
580  case YXMLS_elem2:
581  if(yxml_isSP(ch)) {
582  x->state = YXMLS_elem1;
583  return YXML_OK;
584  }
585  if(ch == (unsigned char)'/') {
586  x->state = YXMLS_elem3;
587  return YXML_OK;
588  }
589  if(ch == (unsigned char)'>') {
590  x->state = YXMLS_misc2;
591  return YXML_OK;
592  }
593  break;
594  case YXMLS_elem3:
595  if(ch == (unsigned char)'>') {
596  x->state = YXMLS_misc2;
597  return yxml_selfclose(x, ch);
598  }
599  break;
600  case YXMLS_enc0:
601  if(yxml_isSP(ch))
602  return YXML_OK;
603  if(ch == (unsigned char)'=') {
604  x->state = YXMLS_enc1;
605  return YXML_OK;
606  }
607  break;
608  case YXMLS_enc1:
609  if(yxml_isSP(ch))
610  return YXML_OK;
611  if(ch == (unsigned char)'\'' || ch == (unsigned char)'"') {
612  x->state = YXMLS_enc2;
613  x->quote = ch;
614  return YXML_OK;
615  }
616  break;
617  case YXMLS_enc2:
618  if(yxml_isAlpha(ch)) {
619  x->state = YXMLS_enc3;
620  return YXML_OK;
621  }
622  break;
623  case YXMLS_enc3:
624  if(yxml_isEncName(ch))
625  return YXML_OK;
626  if(x->quote == ch) {
627  x->state = YXMLS_xmldecl6;
628  return YXML_OK;
629  }
630  break;
631  case YXMLS_etag0:
632  if(yxml_isNameStart(ch)) {
633  x->state = YXMLS_etag1;
634  return yxml_elemclose(x, ch);
635  }
636  break;
637  case YXMLS_etag1:
638  if(yxml_isName(ch))
639  return yxml_elemclose(x, ch);
640  if(yxml_isSP(ch)) {
641  x->state = YXMLS_etag2;
642  return yxml_elemcloseend(x, ch);
643  }
644  if(ch == (unsigned char)'>') {
645  x->state = YXMLS_misc2;
646  return yxml_elemcloseend(x, ch);
647  }
648  break;
649  case YXMLS_etag2:
650  if(yxml_isSP(ch))
651  return YXML_OK;
652  if(ch == (unsigned char)'>') {
653  x->state = YXMLS_misc2;
654  return YXML_OK;
655  }
656  break;
657  case YXMLS_init:
658  if(ch == (unsigned char)'\xef') {
659  x->state = YXMLS_string;
660  x->nextstate = YXMLS_misc0;
661  x->string = (unsigned char *)"\xbb\xbf";
662  return YXML_OK;
663  }
664  if(yxml_isSP(ch)) {
665  x->state = YXMLS_misc0;
666  return YXML_OK;
667  }
668  if(ch == (unsigned char)'<') {
669  x->state = YXMLS_le0;
670  return YXML_OK;
671  }
672  break;
673  case YXMLS_le0:
674  if(ch == (unsigned char)'!') {
675  x->state = YXMLS_lee1;
676  return YXML_OK;
677  }
678  if(ch == (unsigned char)'?') {
679  x->state = YXMLS_leq0;
680  return YXML_OK;
681  }
682  if(yxml_isNameStart(ch)) {
683  x->state = YXMLS_elem0;
684  return yxml_elemstart(x, ch);
685  }
686  break;
687  case YXMLS_le1:
688  if(ch == (unsigned char)'!') {
689  x->state = YXMLS_lee1;
690  return YXML_OK;
691  }
692  if(ch == (unsigned char)'?') {
693  x->state = YXMLS_pi0;
694  x->nextstate = YXMLS_misc1;
695  return YXML_OK;
696  }
697  if(yxml_isNameStart(ch)) {
698  x->state = YXMLS_elem0;
699  return yxml_elemstart(x, ch);
700  }
701  break;
702  case YXMLS_le2:
703  if(ch == (unsigned char)'!') {
704  x->state = YXMLS_lee2;
705  return YXML_OK;
706  }
707  if(ch == (unsigned char)'?') {
708  x->state = YXMLS_pi0;
709  x->nextstate = YXMLS_misc2;
710  return YXML_OK;
711  }
712  if(ch == (unsigned char)'/') {
713  x->state = YXMLS_etag0;
714  return YXML_OK;
715  }
716  if(yxml_isNameStart(ch)) {
717  x->state = YXMLS_elem0;
718  return yxml_elemstart(x, ch);
719  }
720  break;
721  case YXMLS_le3:
722  if(ch == (unsigned char)'!') {
723  x->state = YXMLS_comment0;
724  x->nextstate = YXMLS_misc3;
725  return YXML_OK;
726  }
727  if(ch == (unsigned char)'?') {
728  x->state = YXMLS_pi0;
729  x->nextstate = YXMLS_misc3;
730  return YXML_OK;
731  }
732  break;
733  case YXMLS_lee1:
734  if(ch == (unsigned char)'-') {
735  x->state = YXMLS_comment1;
736  x->nextstate = YXMLS_misc1;
737  return YXML_OK;
738  }
739  if(ch == (unsigned char)'D') {
740  x->state = YXMLS_string;
741  x->nextstate = YXMLS_dt0;
742  x->string = (unsigned char *)"OCTYPE";
743  return YXML_OK;
744  }
745  break;
746  case YXMLS_lee2:
747  if(ch == (unsigned char)'-') {
748  x->state = YXMLS_comment1;
749  x->nextstate = YXMLS_misc2;
750  return YXML_OK;
751  }
752  if(ch == (unsigned char)'[') {
753  x->state = YXMLS_string;
754  x->nextstate = YXMLS_cd0;
755  x->string = (unsigned char *)"CDATA[";
756  return YXML_OK;
757  }
758  break;
759  case YXMLS_leq0:
760  if(ch == (unsigned char)'x') {
761  x->state = YXMLS_xmldecl0;
762  x->nextstate = YXMLS_misc1;
763  return yxml_pistart(x, ch);
764  }
765  if(yxml_isNameStart(ch)) {
766  x->state = YXMLS_pi1;
767  x->nextstate = YXMLS_misc1;
768  return yxml_pistart(x, ch);
769  }
770  break;
771  case YXMLS_misc0:
772  if(yxml_isSP(ch))
773  return YXML_OK;
774  if(ch == (unsigned char)'<') {
775  x->state = YXMLS_le0;
776  return YXML_OK;
777  }
778  break;
779  case YXMLS_misc1:
780  if(yxml_isSP(ch))
781  return YXML_OK;
782  if(ch == (unsigned char)'<') {
783  x->state = YXMLS_le1;
784  return YXML_OK;
785  }
786  break;
787  case YXMLS_misc2:
788  if(ch == (unsigned char)'<') {
789  x->state = YXMLS_le2;
790  return YXML_OK;
791  }
792  if(ch == (unsigned char)'&') {
793  x->state = YXMLS_misc2a;
794  return yxml_refstart(x, ch);
795  }
796  if(yxml_isChar(ch))
797  return yxml_datacontent(x, ch);
798  break;
799  case YXMLS_misc2a:
800  if(yxml_isRef(ch))
801  return yxml_ref(x, ch);
802  if(ch == (unsigned char)'\x3b') {
803  x->state = YXMLS_misc2;
804  return yxml_refcontent(x, ch);
805  }
806  break;
807  case YXMLS_misc3:
808  if(yxml_isSP(ch))
809  return YXML_OK;
810  if(ch == (unsigned char)'<') {
811  x->state = YXMLS_le3;
812  return YXML_OK;
813  }
814  break;
815  case YXMLS_pi0:
816  if(yxml_isNameStart(ch)) {
817  x->state = YXMLS_pi1;
818  return yxml_pistart(x, ch);
819  }
820  break;
821  case YXMLS_pi1:
822  if(yxml_isName(ch))
823  return yxml_piname(x, ch);
824  if(ch == (unsigned char)'?') {
825  x->state = YXMLS_pi4;
826  return yxml_pinameend(x, ch);
827  }
828  if(yxml_isSP(ch)) {
829  x->state = YXMLS_pi2;
830  return yxml_pinameend(x, ch);
831  }
832  break;
833  case YXMLS_pi2:
834  if(ch == (unsigned char)'?') {
835  x->state = YXMLS_pi3;
836  return YXML_OK;
837  }
838  if(yxml_isChar(ch))
839  return yxml_datapi1(x, ch);
840  break;
841  case YXMLS_pi3:
842  if(ch == (unsigned char)'>') {
843  x->state = x->nextstate;
844  return yxml_pivalend(x, ch);
845  }
846  if(yxml_isChar(ch)) {
847  x->state = YXMLS_pi2;
848  return yxml_datapi2(x, ch);
849  }
850  break;
851  case YXMLS_pi4:
852  if(ch == (unsigned char)'>') {
853  x->state = x->nextstate;
854  return yxml_pivalend(x, ch);
855  }
856  break;
857  case YXMLS_std0:
858  if(yxml_isSP(ch))
859  return YXML_OK;
860  if(ch == (unsigned char)'=') {
861  x->state = YXMLS_std1;
862  return YXML_OK;
863  }
864  break;
865  case YXMLS_std1:
866  if(yxml_isSP(ch))
867  return YXML_OK;
868  if(ch == (unsigned char)'\'' || ch == (unsigned char)'"') {
869  x->state = YXMLS_std2;
870  x->quote = ch;
871  return YXML_OK;
872  }
873  break;
874  case YXMLS_std2:
875  if(ch == (unsigned char)'y') {
876  x->state = YXMLS_string;
877  x->nextstate = YXMLS_std3;
878  x->string = (unsigned char *)"es";
879  return YXML_OK;
880  }
881  if(ch == (unsigned char)'n') {
882  x->state = YXMLS_string;
883  x->nextstate = YXMLS_std3;
884  x->string = (unsigned char *)"o";
885  return YXML_OK;
886  }
887  break;
888  case YXMLS_std3:
889  if(x->quote == ch) {
890  x->state = YXMLS_xmldecl8;
891  return YXML_OK;
892  }
893  break;
894  case YXMLS_ver0:
895  if(yxml_isSP(ch))
896  return YXML_OK;
897  if(ch == (unsigned char)'=') {
898  x->state = YXMLS_ver1;
899  return YXML_OK;
900  }
901  break;
902  case YXMLS_ver1:
903  if(yxml_isSP(ch))
904  return YXML_OK;
905  if(ch == (unsigned char)'\'' || ch == (unsigned char)'"') {
906  x->state = YXMLS_string;
907  x->quote = ch;
908  x->nextstate = YXMLS_ver2;
909  x->string = (unsigned char *)"1.";
910  return YXML_OK;
911  }
912  break;
913  case YXMLS_ver2:
914  if(yxml_isNum(ch)) {
915  x->state = YXMLS_ver3;
916  return YXML_OK;
917  }
918  break;
919  case YXMLS_ver3:
920  if(yxml_isNum(ch))
921  return YXML_OK;
922  if(x->quote == ch) {
923  x->state = YXMLS_xmldecl4;
924  return YXML_OK;
925  }
926  break;
927  case YXMLS_xmldecl0:
928  if(ch == (unsigned char)'m') {
929  x->state = YXMLS_xmldecl1;
930  return yxml_piname(x, ch);
931  }
932  if(yxml_isName(ch)) {
933  x->state = YXMLS_pi1;
934  return yxml_piname(x, ch);
935  }
936  if(ch == (unsigned char)'?') {
937  x->state = YXMLS_pi4;
938  return yxml_pinameend(x, ch);
939  }
940  if(yxml_isSP(ch)) {
941  x->state = YXMLS_pi2;
942  return yxml_pinameend(x, ch);
943  }
944  break;
945  case YXMLS_xmldecl1:
946  if(ch == (unsigned char)'l') {
947  x->state = YXMLS_xmldecl2;
948  return yxml_piname(x, ch);
949  }
950  if(yxml_isName(ch)) {
951  x->state = YXMLS_pi1;
952  return yxml_piname(x, ch);
953  }
954  if(ch == (unsigned char)'?') {
955  x->state = YXMLS_pi4;
956  return yxml_pinameend(x, ch);
957  }
958  if(yxml_isSP(ch)) {
959  x->state = YXMLS_pi2;
960  return yxml_pinameend(x, ch);
961  }
962  break;
963  case YXMLS_xmldecl2:
964  if(yxml_isSP(ch)) {
965  x->state = YXMLS_xmldecl3;
966  return yxml_piabort(x, ch);
967  }
968  if(yxml_isName(ch)) {
969  x->state = YXMLS_pi1;
970  return yxml_piname(x, ch);
971  }
972  break;
973  case YXMLS_xmldecl3:
974  if(yxml_isSP(ch))
975  return YXML_OK;
976  if(ch == (unsigned char)'v') {
977  x->state = YXMLS_string;
978  x->nextstate = YXMLS_ver0;
979  x->string = (unsigned char *)"ersion";
980  return YXML_OK;
981  }
982  break;
983  case YXMLS_xmldecl4:
984  if(yxml_isSP(ch)) {
985  x->state = YXMLS_xmldecl5;
986  return YXML_OK;
987  }
988  if(ch == (unsigned char)'?') {
989  x->state = YXMLS_xmldecl9;
990  return YXML_OK;
991  }
992  break;
993  case YXMLS_xmldecl5:
994  if(yxml_isSP(ch))
995  return YXML_OK;
996  if(ch == (unsigned char)'?') {
997  x->state = YXMLS_xmldecl9;
998  return YXML_OK;
999  }
1000  if(ch == (unsigned char)'e') {
1001  x->state = YXMLS_string;
1002  x->nextstate = YXMLS_enc0;
1003  x->string = (unsigned char *)"ncoding";
1004  return YXML_OK;
1005  }
1006  if(ch == (unsigned char)'s') {
1007  x->state = YXMLS_string;
1008  x->nextstate = YXMLS_std0;
1009  x->string = (unsigned char *)"tandalone";
1010  return YXML_OK;
1011  }
1012  break;
1013  case YXMLS_xmldecl6:
1014  if(yxml_isSP(ch)) {
1015  x->state = YXMLS_xmldecl7;
1016  return YXML_OK;
1017  }
1018  if(ch == (unsigned char)'?') {
1019  x->state = YXMLS_xmldecl9;
1020  return YXML_OK;
1021  }
1022  break;
1023  case YXMLS_xmldecl7:
1024  if(yxml_isSP(ch))
1025  return YXML_OK;
1026  if(ch == (unsigned char)'?') {
1027  x->state = YXMLS_xmldecl9;
1028  return YXML_OK;
1029  }
1030  if(ch == (unsigned char)'s') {
1031  x->state = YXMLS_string;
1032  x->nextstate = YXMLS_std0;
1033  x->string = (unsigned char *)"tandalone";
1034  return YXML_OK;
1035  }
1036  break;
1037  case YXMLS_xmldecl8:
1038  if(yxml_isSP(ch))
1039  return YXML_OK;
1040  if(ch == (unsigned char)'?') {
1041  x->state = YXMLS_xmldecl9;
1042  return YXML_OK;
1043  }
1044  break;
1045  case YXMLS_xmldecl9:
1046  if(ch == (unsigned char)'>') {
1047  x->state = YXMLS_misc1;
1048  return YXML_OK;
1049  }
1050  break;
1051  }
1052  return YXML_ESYN;
1053 }
static void struct sockaddr socklen_t static fromlen static backlog static fork char char char static envp int struct rusage static rusage struct utsname static buf struct sembuf unsigned
Definition: sflib.h:97
static yxml_ret_t yxml_ref(yxml_t *x, unsigned ch)
Definition: yxml.c:284
static yxml_ret_t yxml_pistart(yxml_t *x, unsigned ch)
Definition: yxml.c:268
static yxml_ret_t yxml_refcontent(yxml_t *x, unsigned ch)
Definition: yxml.c:323
static yxml_ret_t yxml_refattrval(yxml_t *x, unsigned ch)
Definition: yxml.c:324
static yxml_ret_t yxml_attrvalend(yxml_t *x, unsigned ch)
Definition: yxml.c:265
static yxml_ret_t yxml_attrname(yxml_t *x, unsigned ch)
Definition: yxml.c:263
#define yxml_isSP(c)
Definition: yxml.c:105
static yxml_ret_t yxml_datacontent(yxml_t *x, unsigned ch)
Definition: yxml.c:150
#define yxml_isAlpha(c)
Definition: yxml.c:106
yxml_state_t
Definition: yxml.c:33
@ YXMLS_ver3
Definition: yxml.c:89
@ YXMLS_comment4
Definition: yxml.c:47
@ YXMLS_enc3
Definition: yxml.c:60
@ YXMLS_ver1
Definition: yxml.c:87
@ YXMLS_xmldecl5
Definition: yxml.c:95
@ YXMLS_comment0
Definition: yxml.c:43
@ YXMLS_etag1
Definition: yxml.c:62
@ YXMLS_elem0
Definition: yxml.c:53
@ YXMLS_attr1
Definition: yxml.c:36
@ YXMLS_cd1
Definition: yxml.c:41
@ YXMLS_std2
Definition: yxml.c:84
@ YXMLS_pi4
Definition: yxml.c:81
@ YXMLS_misc0
Definition: yxml.c:72
@ YXMLS_le3
Definition: yxml.c:68
@ YXMLS_cd2
Definition: yxml.c:42
@ YXMLS_misc2a
Definition: yxml.c:75
@ YXMLS_dt1
Definition: yxml.c:49
@ YXMLS_attr3
Definition: yxml.c:38
@ YXMLS_xmldecl6
Definition: yxml.c:96
@ YXMLS_le1
Definition: yxml.c:66
@ YXMLS_elem2
Definition: yxml.c:55
@ YXMLS_comment3
Definition: yxml.c:46
@ YXMLS_cd0
Definition: yxml.c:40
@ YXMLS_std3
Definition: yxml.c:85
@ YXMLS_enc0
Definition: yxml.c:57
@ YXMLS_xmldecl9
Definition: yxml.c:99
@ YXMLS_elem1
Definition: yxml.c:54
@ YXMLS_etag0
Definition: yxml.c:61
@ YXMLS_xmldecl3
Definition: yxml.c:93
@ YXMLS_etag2
Definition: yxml.c:63
@ YXMLS_comment1
Definition: yxml.c:44
@ YXMLS_pi2
Definition: yxml.c:79
@ YXMLS_std1
Definition: yxml.c:83
@ YXMLS_std0
Definition: yxml.c:82
@ YXMLS_dt0
Definition: yxml.c:48
@ YXMLS_xmldecl4
Definition: yxml.c:94
@ YXMLS_dt2
Definition: yxml.c:50
@ YXMLS_pi3
Definition: yxml.c:80
@ YXMLS_misc1
Definition: yxml.c:73
@ YXMLS_lee2
Definition: yxml.c:70
@ YXMLS_xmldecl7
Definition: yxml.c:97
@ YXMLS_ver0
Definition: yxml.c:86
@ YXMLS_string
Definition: yxml.c:34
@ YXMLS_xmldecl1
Definition: yxml.c:91
@ YXMLS_attr2
Definition: yxml.c:37
@ YXMLS_ver2
Definition: yxml.c:88
@ YXMLS_xmldecl8
Definition: yxml.c:98
@ YXMLS_dt3
Definition: yxml.c:51
@ YXMLS_dt4
Definition: yxml.c:52
@ YXMLS_enc1
Definition: yxml.c:58
@ YXMLS_pi0
Definition: yxml.c:77
@ YXMLS_comment2
Definition: yxml.c:45
@ YXMLS_enc2
Definition: yxml.c:59
@ YXMLS_xmldecl0
Definition: yxml.c:90
@ YXMLS_pi1
Definition: yxml.c:78
@ YXMLS_le2
Definition: yxml.c:67
@ YXMLS_lee1
Definition: yxml.c:69
@ YXMLS_xmldecl2
Definition: yxml.c:92
@ YXMLS_le0
Definition: yxml.c:65
@ YXMLS_misc2
Definition: yxml.c:74
@ YXMLS_leq0
Definition: yxml.c:71
@ YXMLS_elem3
Definition: yxml.c:56
@ YXMLS_attr4
Definition: yxml.c:39
@ YXMLS_attr0
Definition: yxml.c:35
#define yxml_isChar(c)
Definition: yxml.c:103
static yxml_ret_t yxml_refstart(yxml_t *x, unsigned ch)
Definition: yxml.c:277
static yxml_ret_t yxml_datapi1(yxml_t *x, unsigned ch)
Definition: yxml.c:157
static yxml_ret_t yxml_datacd1(yxml_t *x, unsigned ch)
Definition: yxml.c:172
static yxml_ret_t yxml_datacd2(yxml_t *x, unsigned ch)
Definition: yxml.c:180
static yxml_ret_t yxml_attrstart(yxml_t *x, unsigned ch)
Definition: yxml.c:262
#define yxml_isRef(c)
Definition: yxml.c:117
#define yxml_isName(c)
Definition: yxml.c:111
static yxml_ret_t yxml_datapi2(yxml_t *x, unsigned ch)
Definition: yxml.c:164
static yxml_ret_t yxml_attrnameend(yxml_t *x, unsigned ch)
Definition: yxml.c:264
static yxml_ret_t yxml_piname(yxml_t *x, unsigned ch)
Definition: yxml.c:269
#define yxml_isNameStart(c)
Definition: yxml.c:110
#define yxml_isAttValue(c)
Definition: yxml.c:113
static yxml_ret_t yxml_pinameend(yxml_t *x, unsigned ch)
Definition: yxml.c:271
static yxml_ret_t yxml_elemcloseend(yxml_t *x, unsigned ch)
Definition: yxml.c:255
static yxml_ret_t yxml_dataattr(yxml_t *x, unsigned ch)
Definition: yxml.c:189
static yxml_ret_t yxml_elemname(yxml_t *x, unsigned ch)
Definition: yxml.c:227
static yxml_ret_t yxml_piabort(yxml_t *x, unsigned ch)
Definition: yxml.c:270
static yxml_ret_t yxml_elemclose(yxml_t *x, unsigned ch)
Definition: yxml.c:247
#define yxml_isEncName(c)
Definition: yxml.c:109
static yxml_ret_t yxml_selfclose(yxml_t *x, unsigned ch)
Definition: yxml.c:233
static yxml_ret_t yxml_elemstart(yxml_t *x, unsigned ch)
Definition: yxml.c:226
static yxml_ret_t yxml_pivalend(yxml_t *x, unsigned ch)
Definition: yxml.c:274
static yxml_ret_t yxml_elemnameend(yxml_t *x, unsigned ch)
Definition: yxml.c:228
#define yxml_isNum(c)
Definition: yxml.c:107

References unsigned, x, yxml_attrname(), yxml_attrnameend(), yxml_attrstart(), yxml_attrvalend(), yxml_dataattr(), yxml_datacd1(), yxml_datacd2(), yxml_datacontent(), yxml_datapi1(), yxml_datapi2(), yxml_elemclose(), yxml_elemcloseend(), yxml_elemname(), yxml_elemnameend(), yxml_elemstart(), YXML_ESYN, yxml_isAlpha, yxml_isAttValue, yxml_isChar, yxml_isEncName, yxml_isName, yxml_isNameStart, yxml_isNum, yxml_isRef, yxml_isSP, YXML_OK, yxml_piabort(), yxml_piname(), yxml_pinameend(), yxml_pistart(), yxml_pivalend(), yxml_ref(), yxml_refattrval(), yxml_refcontent(), yxml_refstart(), yxml_selfclose(), YXMLS_attr0, YXMLS_attr1, YXMLS_attr2, YXMLS_attr3, YXMLS_attr4, YXMLS_cd0, YXMLS_cd1, YXMLS_cd2, YXMLS_comment0, YXMLS_comment1, YXMLS_comment2, YXMLS_comment3, YXMLS_comment4, YXMLS_dt0, YXMLS_dt1, YXMLS_dt2, YXMLS_dt3, YXMLS_dt4, YXMLS_elem0, YXMLS_elem1, YXMLS_elem2, YXMLS_elem3, YXMLS_enc0, YXMLS_enc1, YXMLS_enc2, YXMLS_enc3, YXMLS_etag0, YXMLS_etag1, YXMLS_etag2, YXMLS_init, YXMLS_le0, YXMLS_le1, YXMLS_le2, YXMLS_le3, YXMLS_lee1, YXMLS_lee2, YXMLS_leq0, YXMLS_misc0, YXMLS_misc1, YXMLS_misc2, YXMLS_misc2a, YXMLS_misc3, YXMLS_pi0, YXMLS_pi1, YXMLS_pi2, YXMLS_pi3, YXMLS_pi4, YXMLS_std0, YXMLS_std1, YXMLS_std2, YXMLS_std3, YXMLS_string, YXMLS_ver0, YXMLS_ver1, YXMLS_ver2, YXMLS_ver3, YXMLS_xmldecl0, YXMLS_xmldecl1, YXMLS_xmldecl2, YXMLS_xmldecl3, YXMLS_xmldecl4, YXMLS_xmldecl5, YXMLS_xmldecl6, YXMLS_xmldecl7, YXMLS_xmldecl8, and YXMLS_xmldecl9.

Referenced by rz_cf_value_dict_parse().

◆ yxml_symlen()

static size_t yxml_symlen ( yxml_t x,
const char *  s 
)
inlinestatic

Definition at line 159 of file yxml.h.

159  {
160  return (x->stack + x->stacklen) - (const unsigned char*)s;
161 }
static RzSocket * s
Definition: rtr.c:28

References s, and x.