Esempio n. 1
0
void CompilGenerator::generateStructurePrefix(const StructureSPtr& pStructure)
{
    if (pStructure->controlled())
        line() << "controlled ";
        
    if (pStructure->immutable())
        line() << "immutable ";
        
    if (pStructure->partial())
        line() << "partial ";

    line() << "structure " << pStructure->name()->value();
    
    int indexOffset = 0;
    StructureSPtr pBaseStructure = pStructure->baseStructure().lock();
    if (pBaseStructure)
    {
        eol(declarationStream);
        
        ++indexOffset;
        ++mIndent[declarationStream];
        line() << "inherit " << pBaseStructure->name()->value();
        
        const std::vector<ObjectSPtr>& objects = pStructure->objects();
        bool first_alter = true;
        std::vector<ObjectSPtr>::const_iterator it;
        for (it = objects.begin(); it != objects.end(); ++it)
        {
            AlterSPtr pAlter = ObjectFactory::downcastAlter(*it);
            if (!pAlter) continue;
            
            if (first_alter)
            {
                first_alter = false;
                eol(declarationStream);
                ++mIndent[declarationStream];
                ++indexOffset;
                table() << TableAligner::row()
                        << "alter ";
            }
            else
            {
                table() << ","
                        << TableAligner::row();
            }
            
            table() << TableAligner::col()
                    << pAlter->field()->name()->value() << " "
                    << TableAligner::col()
                    << "= "
                    << pAlter->defaultValue()->value();        
        }
    }
    mIndent[declarationStream] -= indexOffset;
    openBlock(declarationStream, indexOffset);
}
Esempio n. 2
0
Tsubtitle* TsubtitleParserMPsub::parse(Tstream &fd, int flags, REFERENCE_TIME start, REFERENCE_TIME stop)
{
    wchar_t line[this->LINE_LEN + 1];
    float a, b;
    int num = 0;
    wchar_t *p, *q;

    do {
        if (!fd.fgets(line, this->LINE_LEN)) {
            return NULL;
        }
    } while (swscanf(line, L"%f %f", &a, &b) != 2);
    TsubtitleText current(this->format);
    mpsub_position += a * (sub_uses_time ? 100.0 : 1.0);
    current.start = this->frameToTime(int(sub_uses_time ? mpsub_position / 100.0 : mpsub_position));
    mpsub_position += b * (sub_uses_time ? 100.0 : 1.0);
    current.stop = this->frameToTime(int(sub_uses_time ? mpsub_position / 100.0 : mpsub_position));

    while (1) {
        if (!fd.fgets(line, this->LINE_LEN)) {
            if (num == 0) {
                return NULL;
            } else {
                return store(current);
            }
        }
        p = line;
        while (iswspace((unsigned short)*p)) {
            p++;
        }
        if (eol(*p) && num > 0) {
            return store(current);
        }
        if (eol(*p)) {
            return NULL;
        }

        for (q = p; !eol(*q); q++) {
            ;
        }
        *q = '\0';
        if (strlen(p)) {
            current.add(p);
            ++num;
        } else {
            if (num) {
                return store(current);
            } else {
                return NULL;
            }
        }
    }
    return NULL; // we should have returned before if it's OK
}
Esempio n. 3
0
void print_offsets(){
    puts_attrib("=================OFF=================", color_entry(COLOR_MAGENTA, COLOR_BLACK)); eol();
    
    puts_attrib("FAT Offset:", color_entry(COLOR_GREEN, COLOR_BLACK));
    print_int(FAT_OFFSET, 16, color_entry(COLOR_RED, COLOR_BLACK)); eol();
    puts_attrib("Root Offset:", color_entry(COLOR_GREEN, COLOR_BLACK));
    print_int(ROOT_OFFSET , 16, color_entry(COLOR_RED, COLOR_BLACK)); eol();
    puts_attrib("Data Offset:", color_entry(COLOR_GREEN, COLOR_BLACK));
    print_int(DATA_OFFSET, 16, color_entry(COLOR_RED, COLOR_BLACK)); eol();
    
    puts_attrib("=================OFF=================",color_entry(COLOR_MAGENTA, COLOR_BLACK)); eol();
}
Esempio n. 4
0
static void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
{
	if (seq < *highest_seq) {
		print_gfs2("------------------------------------------------"
			   "------------------------------------------------");
		eol(0);
		print_gfs2("Journal wrapped here.");
		eol(0);
		print_gfs2("------------------------------------------------"
			   "------------------------------------------------");
		eol(0);
	}
	*highest_seq = seq;
}
Esempio n. 5
0
void print_cluster_list(uint16_t clusternum){
    while(clusternum != FAT12_END_OF_CLUSTERS){
        print_int(clusternum, 10, 0); putc(' ');
        clusternum = fat12_get_fat_entry(clusternum);
    }
    eol();
}
Esempio n. 6
0
void iLine::delete_char()
      {
      if (eol())
            return;
      l->delete_char(col);
      setcol(col);
      }
Esempio n. 7
0
QChar iLine::operator*()
      {
      if (eol())
            return QChar::Null;
      QChar c = l->txt[p];
      return (c == '\t')  ? ' ' : c;
      }
Esempio n. 8
0
File: syntax.c Progetto: kusma/vasm
static void handle_globl(char *s)
{
  char *name;
  symbol *sym;

  for (;;) {
    if (!(name = parse_identifier(&s))) {
      syntax_error(10);  /* identifier expected */
      return;
    }
    sym = new_import(name);
    myfree(name);

    if (sym->flags & EXPORT)
      general_error(62,sym->name,get_bind_name(sym)); /* binding already set */
    sym->flags |= EXPORT;

    s = skip(s);
    if (*s == ',')
      s = skip(s+1);
    else
      break;
  }

  eol(s);
}
Esempio n. 9
0
File: syntax.c Progetto: ezrec/vasm
static void handle_rept(char *s)
{
  taddr cnt = parse_constexpr(&s);

  eol(s);
  new_repeat((int)cnt,nodotneeded?"rept":".rept",nodotneeded?"endr":".endr");
}
Esempio n. 10
0
File: cmds.c Progetto: hankem/jed
static int prev_visible_lines (int n)
{
#if JED_HAS_LINE_ATTRIBUTES
   int i, dn;

   i = 0;
   while (i < n)
     {
	Line *l = CLine;

	dn = 0;
	do
	  {
	     l = l->prev;
	     dn++;
	  }
	while ((l != NULL) && (l->flags & JED_LINE_HIDDEN));

	if (l == NULL) break;

	CLine = l;
	LineNum -= dn;
	i++;
     }
   if (i) eol ();			       /* leave point at eol */
   return i;
#else
   return jed_up (n);
#endif
}
Esempio n. 11
0
void CompilGenerator::generateStructureSuffix(const StructureSPtr&)
{
    eot(declarationStream);
    closeBlock(declarationStream);
    eol(declarationStream);
    bAddNewLine = false;
}
Esempio n. 12
0
void CompilGenerator::generateEnumerationPrefix(const EnumerationSPtr& pEnumeration)
{
    if (pEnumeration->structure().lock())
    {
        if (!table().isEmpty())
        {
            eot(declarationStream);
            eol(declarationStream);
        }
        bAddNewLine = true;
    }

    switch (pEnumeration->cast().value())
    {
        case CastableType::ECast::kWeak: 
            line() << "weak ";
            break;
        case CastableType::ECast::kStrong: 
            line() << "strong ";
            break;
        default:
            assert(false && "unknown cast type");
    }
   
    line()  << "enum";
    TypeSPtr pType = pEnumeration->parameterType().lock();
    if (pType)
    {
        line()  << "<" << pType->name()->value() << ">";
    }
    
    line()  << " " << pEnumeration->name()->value();
    openBlock(declarationStream);
}
Esempio n. 13
0
void
setNAEOL(void)
{

	setnoaddr();
	eol();
}
Esempio n. 14
0
File: syntax.c Progetto: ezrec/vasm
static void handle_section(char *s)
{
  char *name,*attr;

  if(!(name=parse_name(&s)))
    return;
  if(*s==','){
    s=skip(s+1);
    attr=s;
    if(*s!='\"')
      syntax_error(7);
    else
      s++;
    attr=s;
    while(*s&&*s!='\"')
      s++;    
    attr=cnvstr(attr,s-attr);
    s=skip(s+1);
  }else{
    attr="";
    if(!strcmp(name,textname)) attr=textattr;
    if(!strcmp(name,dataname)) attr=dataattr;
    if(!strcmp(name,sdataname)) attr=sdataattr;
    if(!strcmp(name,sdata2name)) attr=sdata2attr;
    if(!strcmp(name,rodataname)) attr=rodataattr;
    if(!strcmp(name,bssname)) attr=bssattr;
    if(!strcmp(name,sbssname)) attr=sbssattr;
    if(!strcmp(name,tocdname)) attr=tocdattr;
  }

  new_section(name,attr,1);
  switch_section(name,attr);
  eol(s);
}
Esempio n. 15
0
void _process_byte ()
{
	uint16_t data = CONSOLE_UART::receive ();
	if (data & 0xff00) return;
	uint8_t byte = data & 0xff;
	switch (byte)
	{
		case KEY_ENTER:
			if (_command_len)
			{
				_command [_command_len] = 0;
				eol ();
				if (handler) handler (_command);
			}
			show_prompt ();
			return;
		case KEY_DEL:
		case KEY_BS:
			if (!_command_len) return;
			_command_len --;
			CONSOLE_UART::send_string_p (PSTR ("\x08 \x08"));
			return;
		default:
			if (byte < 0x20 || _command_len == CONSOLE_MAX_CMD_LENGTH - 1)
			{
				CONSOLE_UART::send (0x07);
				return;
			}
			_command [_command_len ++] = byte;
			CONSOLE_UART::send (byte);
	}
	return;
}
Esempio n. 16
0
File: syntax.c Progetto: ezrec/vasm
static void handle_stabs(char *s)
{
  char *name;
  int t,o,d;

  if (*s++ == '\"') {
    name = s;
    while (*s && *s!='\"')
      s++;
    name = cnvstr(name,s-name);
  }
  else {
    syntax_error(7);  /* " expected */
    return;
  }
  s++;
  t = comma_constexpr(&s);
  o = comma_constexpr(&s);
  d = comma_constexpr(&s);
  s = skip(s);
  if (*s == ',') {
    s = skip(s+1);
    stab_entry(name,t,o,d,s);
    s = skip_operand(s);
  }
  else
    syntax_error(9);
  eol(s);
}
Esempio n. 17
0
File: syntax.c Progetto: ezrec/vasm
static void handle_type(char *s)
{
  char *name;
  symbol *sym;

  if(!(name=parse_identifier(&s))){
    syntax_error(10);  /* identifier expected */
    return;
  }
  sym=new_import(name);
  myfree(name);
  s=skip(s);
  if(*s==',')
    s=skip(s+1);
  else
    syntax_error(9);
  if(!strncmp(s,"@object",7)){
    sym->flags|=TYPE_OBJECT;
    s=skip(s+7);
  }else if(!strncmp(s,"@function",9)){
    sym->flags|=TYPE_FUNCTION;
    s=skip(s+9);
  }else
    sym->flags|=parse_constexpr(&s);
  eol(s);
}
Esempio n. 18
0
static void handle_text(char *s)
{
  char *opstart = s;
  operand *op;
  dblock *db = NULL;

  if (db = parse_string(&opstart,*s,8)) {
    add_atom(0,new_data_atom(db,1));
    s = opstart;
  }
  if (!db) {
    op = new_operand();
    s = skip_operand(s);
    if (parse_operand(opstart,s-opstart,op,DATA_OPERAND(8))) {
      atom *a;

      a = new_datadef_atom(8,op);
      a->align = 1;
      add_atom(0,a);
    }
    else
      syntax_error(8);  /* invalid data operand */
  }
  eol(s);
}
Esempio n. 19
0
File: text.c Progetto: hankem/jed
int forward_paragraph(void) /*{{{*/
{
   Jed_Buffer_Hook_Type *h = CBuf->buffer_hooks;

   if ((h != NULL)
       && (h->forward_paragraph_hook != NULL))
     {
	if (0 == SLexecute_function (h->forward_paragraph_hook))
	  return 1;

	return -1;
     }

   while (1)
     {
	if (0 == jed_down (1))
	  {
	     eol ();
	     break;
	  }
	if (is_paragraph_sep ())
	  break;
     }

   return(1);
}
Esempio n. 20
0
File: syntax.c Progetto: ezrec/vasm
static void handle_align(char *s)
{
  taddr align=parse_constexpr(&s);
  atom *a=new_space_atom(number_expr(0),1,0);
  a->align=1<<align;
  add_atom(0,a);
  eol(s);
}
Esempio n. 21
0
File: syntax.c Progetto: ezrec/vasm
static void handle_ident(char *s)
{
  char *name;

  if(name=parse_name(&s))
    setfilename(name);
  eol(s);
}
Esempio n. 22
0
File: syntax.c Progetto: ezrec/vasm
static void handle_endif(char *s)
{
  eol(s);
  if (clev > 0)
    clev--;
  else
    syntax_error(14);  /* endif without if */
}
Esempio n. 23
0
File: syntax.c Progetto: ezrec/vasm
static void handle_else(char *s)
{
  eol(s);
  if (clev > 0)
    cond[clev] = 0;
  else
    syntax_error(17);  /* else without if */
}
Esempio n. 24
0
File: syntax.c Progetto: ezrec/vasm
static void handle_incdir(char *s)
{
  char *name;

  if (name = parse_name(&s))
    new_include_path(name);
  eol(s);
}
Esempio n. 25
0
void print_files(){
    uint16_t i=0;
    uint8_t total = 0;
    for(;i<_bpb.max_files;++i){
        fat12_entry_t _tmp = entries[i];
        if(_tmp.filename[0] == FAT12_ENTRY_FREE || _tmp.filename[0] == FAT12_ENTRY_LAST)
            continue;
        else{
            print_entry(&_tmp);
            eol();
            total++;
        }
    }
    puts_attrib("Total:", color_entry(COLOR_RED, COLOR_BLACK));
    print_int(total, 10, color_entry(COLOR_MAGENTA, COLOR_BLACK));
    eol();
}
Esempio n. 26
0
File: syntax.c Progetto: kusma/vasm
static void handle_incbin(char *s)
{
  char *name;

  if (name = parse_name(&s))
    include_binary_file(name,0,0);
  eol(s);
}
Esempio n. 27
0
void iLine::setcol(int c)
      {
      p = 0;
      for (col = 0; col < c; col++) {
            if (!eol() && !(l->txt[p] == '\t' && ((col+1) % TABL)))
                  ++p;
            }
      }
Esempio n. 28
0
File: cmds.c Progetto: hankem/jed
/* the page up/down commands set cursor_motion to -1 because we do not
 want to use any goal column information */
int pagedown_cmd()
{
   int col, this_line, this_point;
   int n;

   Cursor_Motion = -1;
   if (IN_MINI_WINDOW)
     {
	scroll_completion (1);
	return 1;
     }

   if (eobp())
     {
	eob_bob_error (3);
	return 1;
     }

   n = JWindow->rows;
   if ((CBuf != JWindow->buffer) || (n == 1))
     {
	return next_visible_lines (n);
     }

   if (JWindow->trashed)
     {
	update (NULL, 0, 0, 1);
	if (JWindow->trashed) return next_visible_lines (n);
     }

   /* This is ugly. */

   this_line = LineNum;
   this_point = Point;

   col = calculate_column ();
   if (goto_bottom_of_window ())
     {
	recenter (&Number_One);
     }

   goto_column1 (&col);

   if ((Last_Key_Function == (FVOID_STAR) pageup_cmd)
       && (Jed_This_Key_Function == (FVOID_STAR) pagedown_cmd))
     {
	goto_line (&Last_Page_Line);
	if (Last_Page_Point < CLine->len)
	  Point = Last_Page_Point;
     }
   else if (CLine->next == NULL) eol();
   else bol ();

   Last_Page_Line = this_line;
   Last_Page_Point = this_point;

   return(1);
}
Esempio n. 29
0
File: syntax.c Progetto: ezrec/vasm
static void handle_include(char *s)
{
  char *name;

  if (name = parse_name(&s)) {
    eol(s);
    include_source(name);
  }
}
Esempio n. 30
0
static void handle_align(char *s)
{
  taddr a = parse_constexpr(&s);

  if (a > 63)
    syntax_error(21);  /* bad alignment */
  do_alignment(1LL<<a,number_expr(0));
  eol(s);
}